From 681f04f6d3d4f5a01a9fa0886bc6caecf4657aef Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 6 Aug 2007 12:07:48 -0600 Subject: [PATCH] remove intel dependencies from intel_mipmap_tree.c --- src/mesa/drivers/dri/i915pipe/intel_fbo.c | 4 +- src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.c | 53 +++++++++++----------- src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.h | 24 +++++----- src/mesa/drivers/dri/i915pipe/intel_tex.c | 4 +- src/mesa/drivers/dri/i915pipe/intel_tex_copy.c | 2 +- src/mesa/drivers/dri/i915pipe/intel_tex_image.c | 24 +++++----- src/mesa/drivers/dri/i915pipe/intel_tex_subimage.c | 4 +- src/mesa/drivers/dri/i915pipe/intel_tex_validate.c | 22 ++++----- 8 files changed, 68 insertions(+), 69 deletions(-) diff --git a/src/mesa/drivers/dri/i915pipe/intel_fbo.c b/src/mesa/drivers/dri/i915pipe/intel_fbo.c index 267c12fd4b7..fe5b1a37df3 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_fbo.c +++ b/src/mesa/drivers/dri/i915pipe/intel_fbo.c @@ -566,12 +566,12 @@ intel_render_texture(GLcontext * ctx, } /* compute offset of the particular 2D image within the texture region */ - imageOffset = intel_miptree_image_offset(intel_image->mt, + imageOffset = st_miptree_image_offset(intel_image->mt, att->CubeMapFace, att->TextureLevel); if (att->Texture->Target == GL_TEXTURE_3D) { - const GLuint *offsets = intel_miptree_depth_offsets(intel_image->mt, + const GLuint *offsets = st_miptree_depth_offsets(intel_image->mt, att->TextureLevel); imageOffset += offsets[att->Zoffset]; } diff --git a/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.c index 990e5c0e40b..6a91ddbe5e5 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.c @@ -25,7 +25,6 @@ * **************************************************************************/ -#include "intel_context.h" #include "intel_mipmap_tree.h" #include "enums.h" @@ -52,7 +51,7 @@ target_to_target(GLenum target) } struct pipe_mipmap_tree * -intel_miptree_create(struct intel_context *intel, +st_miptree_create(struct pipe_context *pipe, GLenum target, GLenum internal_format, GLuint first_level, @@ -79,9 +78,9 @@ intel_miptree_create(struct intel_context *intel, mt->compressed = compress_byte ? 1 : 0; mt->refcount = 1; - ok = intel->pipe->mipmap_tree_layout(intel->pipe, mt); + ok = pipe->mipmap_tree_layout(pipe, mt); if (ok) - mt->region = intel->pipe->region_alloc(intel->pipe, + mt->region = pipe->region_alloc(pipe, mt->cpp, mt->pitch, mt->total_height); if (!mt->region) { @@ -94,7 +93,7 @@ intel_miptree_create(struct intel_context *intel, void -intel_miptree_reference(struct pipe_mipmap_tree **dst, +st_miptree_reference(struct pipe_mipmap_tree **dst, struct pipe_mipmap_tree *src) { src->refcount++; @@ -103,8 +102,8 @@ intel_miptree_reference(struct pipe_mipmap_tree **dst, } void -intel_miptree_release(struct intel_context *intel, - struct pipe_mipmap_tree **mt) +st_miptree_release(struct pipe_context *pipe, + struct pipe_mipmap_tree **mt) { if (!*mt) return; @@ -115,7 +114,7 @@ intel_miptree_release(struct intel_context *intel, DBG("%s deleting %p\n", __FUNCTION__, *mt); - intel->pipe->region_release(intel->pipe, &((*mt)->region)); + pipe->region_release(pipe, &((*mt)->region)); for (i = 0; i < MAX_TEXTURE_LEVELS; i++) if ((*mt)->level[i].image_offset) @@ -135,7 +134,7 @@ intel_miptree_release(struct intel_context *intel, * Not sure whether I want to pass gl_texture_image here. */ GLboolean -intel_miptree_match_image(struct pipe_mipmap_tree *mt, +st_miptree_match_image(struct pipe_mipmap_tree *mt, struct gl_texture_image *image, GLuint face, GLuint level) { @@ -168,7 +167,7 @@ intel_miptree_match_image(struct pipe_mipmap_tree *mt, * These functions present that view to mesa: */ const GLuint * -intel_miptree_depth_offsets(struct pipe_mipmap_tree *mt, GLuint level) +st_miptree_depth_offsets(struct pipe_mipmap_tree *mt, GLuint level) { static const GLuint zero = 0; @@ -180,8 +179,8 @@ intel_miptree_depth_offsets(struct pipe_mipmap_tree *mt, GLuint level) GLuint -intel_miptree_image_offset(struct pipe_mipmap_tree * mt, - GLuint face, GLuint level) +st_miptree_image_offset(struct pipe_mipmap_tree * mt, + GLuint face, GLuint level) { if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) return (mt->level[level].level_offset + @@ -199,7 +198,7 @@ intel_miptree_image_offset(struct pipe_mipmap_tree * mt, * \return address of mapping */ GLubyte * -intel_miptree_image_map(struct intel_context * intel, +st_miptree_image_map(struct pipe_context *pipe, struct pipe_mipmap_tree * mt, GLuint face, GLuint level, @@ -215,17 +214,17 @@ intel_miptree_image_map(struct intel_context * intel, memcpy(image_offsets, mt->level[level].image_offset, mt->level[level].depth * sizeof(GLuint)); - ptr = intel->pipe->region_map(intel->pipe, mt->region); + ptr = pipe->region_map(pipe, mt->region); - return ptr + intel_miptree_image_offset(mt, face, level); + return ptr + st_miptree_image_offset(mt, face, level); } void -intel_miptree_image_unmap(struct intel_context *intel, +st_miptree_image_unmap(struct pipe_context *pipe, struct pipe_mipmap_tree *mt) { DBG("%s\n", __FUNCTION__); - intel->pipe->region_unmap(intel->pipe, mt->region); + pipe->region_unmap(pipe, mt->region); } @@ -233,7 +232,7 @@ intel_miptree_image_unmap(struct intel_context *intel, /* Upload data for a particular image. */ void -intel_miptree_image_data(struct intel_context *intel, +st_miptree_image_data(struct pipe_context *pipe, struct pipe_mipmap_tree *dst, GLuint face, GLuint level, @@ -241,8 +240,8 @@ intel_miptree_image_data(struct intel_context *intel, GLuint src_row_pitch, GLuint src_image_pitch) { GLuint depth = dst->level[level].depth; - GLuint dst_offset = intel_miptree_image_offset(dst, face, level); - const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); + GLuint dst_offset = st_miptree_image_offset(dst, face, level); + const GLuint *dst_depth_offset = st_miptree_depth_offsets(dst, level); GLuint i; GLuint height = 0; @@ -251,7 +250,7 @@ intel_miptree_image_data(struct intel_context *intel, height = dst->level[level].height; if(dst->compressed) height /= 4; - intel->pipe->region_data(intel->pipe, dst->region, + pipe->region_data(pipe, dst->region, dst_offset + dst_depth_offset[i], /* dst_offset */ 0, 0, /* dstx, dsty */ src, @@ -266,7 +265,7 @@ intel_miptree_image_data(struct intel_context *intel, /* Copy mipmap image between trees */ void -intel_miptree_image_copy(struct intel_context *intel, +st_miptree_image_copy(struct pipe_context *pipe, struct pipe_mipmap_tree *dst, GLuint face, GLuint level, struct pipe_mipmap_tree *src) @@ -274,16 +273,16 @@ intel_miptree_image_copy(struct intel_context *intel, GLuint width = src->level[level].width; GLuint height = src->level[level].height; GLuint depth = src->level[level].depth; - GLuint dst_offset = intel_miptree_image_offset(dst, face, level); - GLuint src_offset = intel_miptree_image_offset(src, face, level); - const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); - const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level); + GLuint dst_offset = st_miptree_image_offset(dst, face, level); + GLuint src_offset = st_miptree_image_offset(src, face, level); + const GLuint *dst_depth_offset = st_miptree_depth_offsets(dst, level); + const GLuint *src_depth_offset = st_miptree_depth_offsets(src, level); GLuint i; if (dst->compressed) height /= 4; for (i = 0; i < depth; i++) { - intel->pipe->region_copy(intel->pipe, + pipe->region_copy(pipe, dst->region, dst_offset + dst_depth_offset[i], 0, 0, diff --git a/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.h b/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.h index f453462f517..59f1bfcab45 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/i915pipe/intel_mipmap_tree.h @@ -34,7 +34,7 @@ struct pipe_region; -struct pipe_mipmap_tree *intel_miptree_create(struct intel_context *intel, +struct pipe_mipmap_tree *st_miptree_create(struct pipe_context *pipe, GLenum target, GLenum internal_format, GLuint first_level, @@ -45,47 +45,47 @@ struct pipe_mipmap_tree *intel_miptree_create(struct intel_context *intel, GLuint cpp, GLuint compress_byte); -void intel_miptree_reference(struct pipe_mipmap_tree **dst, +void st_miptree_reference(struct pipe_mipmap_tree **dst, struct pipe_mipmap_tree *src); -void intel_miptree_release(struct intel_context *intel, +void st_miptree_release(struct pipe_context *pipe, struct pipe_mipmap_tree **mt); /* Check if an image fits an existing mipmap tree layout */ -GLboolean intel_miptree_match_image(struct pipe_mipmap_tree *mt, +GLboolean st_miptree_match_image(struct pipe_mipmap_tree *mt, struct gl_texture_image *image, GLuint face, GLuint level); /* Return a pointer to an image within a tree. Return image stride as * well. */ -GLubyte *intel_miptree_image_map(struct intel_context *intel, +GLubyte *st_miptree_image_map(struct pipe_context *pipe, struct pipe_mipmap_tree *mt, GLuint face, GLuint level, GLuint * row_stride, GLuint * image_stride); -void intel_miptree_image_unmap(struct intel_context *intel, +void st_miptree_image_unmap(struct pipe_context *pipe, struct pipe_mipmap_tree *mt); /* Return the linear offset of an image relative to the start of the * tree: */ -GLuint intel_miptree_image_offset(struct pipe_mipmap_tree *mt, - GLuint face, GLuint level); +GLuint st_miptree_image_offset(struct pipe_mipmap_tree *mt, + GLuint face, GLuint level); /* Return pointers to each 2d slice within an image. Indexed by depth * value. */ -const GLuint *intel_miptree_depth_offsets(struct pipe_mipmap_tree *mt, - GLuint level); +const GLuint *st_miptree_depth_offsets(struct pipe_mipmap_tree *mt, + GLuint level); /* Upload an image into a tree */ -void intel_miptree_image_data(struct intel_context *intel, +void st_miptree_image_data(struct pipe_context *pipe, struct pipe_mipmap_tree *dst, GLuint face, GLuint level, @@ -94,7 +94,7 @@ void intel_miptree_image_data(struct intel_context *intel, /* Copy an image between two trees */ -void intel_miptree_image_copy(struct intel_context *intel, +void st_miptree_image_copy(struct pipe_context *pipe, struct pipe_mipmap_tree *dst, GLuint face, GLuint level, struct pipe_mipmap_tree *src); diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex.c b/src/mesa/drivers/dri/i915pipe/intel_tex.c index 9e494d21bad..5e9ab1c9ca3 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex.c +++ b/src/mesa/drivers/dri/i915pipe/intel_tex.c @@ -50,7 +50,7 @@ intelDeleteTextureObject(GLcontext *ctx, struct intel_texture_object *intelObj = intel_texture_object(texObj); if (intelObj->mt) - intel_miptree_release(intel, &intelObj->mt); + st_miptree_release(intel->pipe, &intelObj->mt); _mesa_delete_texture_object(ctx, texObj); } @@ -65,7 +65,7 @@ intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) DBG("%s\n", __FUNCTION__); if (intelImage->mt) { - intel_miptree_release(intel, &intelImage->mt); + st_miptree_release(intel->pipe, &intelImage->mt); } if (texImage->Data) { diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c b/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c index 0a3f153d569..bf06b5fed56 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c +++ b/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c @@ -102,7 +102,7 @@ do_copy_texsubimage(struct intel_context *intel, /* XXX still need the lock ? */ LOCK_HARDWARE(intel); { - GLuint image_offset = intel_miptree_image_offset(intelImage->mt, + GLuint image_offset = st_miptree_image_offset(intelImage->mt, intelImage->face, intelImage->level); const GLint orig_x = x; diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex_image.c b/src/mesa/drivers/dri/i915pipe/intel_tex_image.c index 596493f45a1..19aa61ae831 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex_image.c +++ b/src/mesa/drivers/dri/i915pipe/intel_tex_image.c @@ -125,7 +125,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, assert(!intelObj->mt); if (intelImage->base.IsCompressed) comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); - intelObj->mt = intel_miptree_create(intel, + intelObj->mt = st_miptree_create(intel->pipe, intelObj->base.Target, intelImage->base.InternalFormat, firstLevel, @@ -214,7 +214,7 @@ try_pbo_upload(struct intel_context *intel, else src_stride = width; - dst_offset = intel_miptree_image_offset(intelImage->mt, + dst_offset = st_miptree_image_offset(intelImage->mt, intelImage->face, intelImage->level); @@ -328,7 +328,7 @@ intelTexImage(GLcontext * ctx, * Release any old malloced memory. */ if (intelImage->mt) { - intel_miptree_release(intel, &intelImage->mt); + st_miptree_release(intel->pipe, &intelImage->mt); assert(!texImage->Data); } else if (texImage->Data) { @@ -343,11 +343,11 @@ intelTexImage(GLcontext * ctx, intelObj->mt->first_level == level && intelObj->mt->last_level == level && intelObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB && - !intel_miptree_match_image(intelObj->mt, &intelImage->base, + !st_miptree_match_image(intelObj->mt, &intelImage->base, intelImage->face, intelImage->level)) { DBG("release it\n"); - intel_miptree_release(intel, &intelObj->mt); + st_miptree_release(intel->pipe, &intelObj->mt); assert(!intelObj->mt); } @@ -361,10 +361,10 @@ intelTexImage(GLcontext * ctx, assert(!intelImage->mt); if (intelObj->mt && - intel_miptree_match_image(intelObj->mt, &intelImage->base, + st_miptree_match_image(intelObj->mt, &intelImage->base, intelImage->face, intelImage->level)) { - intel_miptree_reference(&intelImage->mt, intelObj->mt); + st_miptree_reference(&intelImage->mt, intelObj->mt); assert(intelImage->mt); } @@ -438,7 +438,7 @@ intelTexImage(GLcontext * ctx, LOCK_HARDWARE(intel); if (intelImage->mt) { - texImage->Data = intel_miptree_image_map(intel, + texImage->Data = st_miptree_image_map(intel->pipe, intelImage->mt, intelImage->face, intelImage->level, @@ -485,7 +485,7 @@ intelTexImage(GLcontext * ctx, _mesa_unmap_teximage_pbo(ctx, unpack); if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); + st_miptree_image_unmap(intel->pipe, intelImage->mt); texImage->Data = NULL; } @@ -580,7 +580,7 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, * kernel. Need to explicitly map and unmap it. */ intelImage->base.Data = - intel_miptree_image_map(intel, + st_miptree_image_map(intel->pipe, intelImage->mt, intelImage->face, intelImage->level, @@ -612,7 +612,7 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, /* Unmap */ if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); + st_miptree_image_unmap(intel->pipe, intelImage->mt); intelImage->base.Data = NULL; } } @@ -653,7 +653,7 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, return; if (intelObj->mt) - intel_miptree_release(intel, &intelObj->mt); + st_miptree_release(intel->pipe, &intelObj->mt); intelObj->imageOverride = GL_TRUE; intelObj->depthOverride = depth; diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex_subimage.c b/src/mesa/drivers/dri/i915pipe/intel_tex_subimage.c index d660c2dceec..50ffd0ed1d3 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/i915pipe/intel_tex_subimage.c @@ -76,7 +76,7 @@ intelTexSubimage(GLcontext * ctx, * from uploading the buffer under us. */ if (intelImage->mt) - texImage->Data = intel_miptree_image_map(intel, + texImage->Data = st_miptree_image_map(intel->pipe, intelImage->mt, intelImage->face, intelImage->level, @@ -108,7 +108,7 @@ intelTexSubimage(GLcontext * ctx, _mesa_unmap_teximage_pbo(ctx, packing); if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); + st_miptree_image_unmap(intel->pipe, intelImage->mt); texImage->Data = NULL; } diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex_validate.c b/src/mesa/drivers/dri/i915pipe/intel_tex_validate.c index 242fe1237bb..d366970b266 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex_validate.c +++ b/src/mesa/drivers/dri/i915pipe/intel_tex_validate.c @@ -72,19 +72,19 @@ copy_image_data_to_tree(struct intel_context *intel, if (intelImage->mt) { /* Copy potentially with the blitter: */ - intel_miptree_image_copy(intel, + st_miptree_image_copy(intel->pipe, intelObj->mt, intelImage->face, intelImage->level, intelImage->mt); - intel_miptree_release(intel, &intelImage->mt); + st_miptree_release(intel->pipe, &intelImage->mt); } else { assert(intelImage->base.Data != NULL); /* More straightforward upload. */ - intel_miptree_image_data(intel, + st_miptree_image_data(intel->pipe, intelObj->mt, intelImage->face, intelImage->level, @@ -96,7 +96,7 @@ copy_image_data_to_tree(struct intel_context *intel, intelImage->base.Data = NULL; } - intel_miptree_reference(&intelImage->mt, intelObj->mt); + st_miptree_reference(&intelImage->mt, intelObj->mt); } @@ -130,7 +130,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) */ if (firstImage->base.Border) { if (intelObj->mt) { - intel_miptree_release(intel, &intelObj->mt); + st_miptree_release(intel->pipe, &intelObj->mt); } return GL_FALSE; } @@ -147,9 +147,9 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) firstImage->mt->last_level >= intelObj->lastLevel) { if (intelObj->mt) - intel_miptree_release(intel, &intelObj->mt); + st_miptree_release(intel->pipe, &intelObj->mt); - intel_miptree_reference(&intelObj->mt, firstImage->mt); + st_miptree_reference(&intelObj->mt, firstImage->mt); } if (firstImage->base.IsCompressed) { @@ -177,14 +177,14 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intelObj->mt->depth0 != firstImage->base.Depth || intelObj->mt->cpp != cpp || intelObj->mt->compressed != firstImage->base.IsCompressed)) { - intel_miptree_release(intel, &intelObj->mt); + st_miptree_release(intel->pipe, &intelObj->mt); } /* May need to create a new tree: */ if (!intelObj->mt) { - intelObj->mt = intel_miptree_create(intel, + intelObj->mt = st_miptree_create(intel->pipe, intelObj->base.Target, firstImage->base.InternalFormat, intelObj->firstLevel, @@ -237,7 +237,7 @@ intel_tex_map_images(struct intel_context *intel, if (intelImage->mt) { intelImage->base.Data = - intel_miptree_image_map(intel, + st_miptree_image_map(intel->pipe, intelImage->mt, intelImage->face, intelImage->level, @@ -266,7 +266,7 @@ intel_tex_unmap_images(struct intel_context *intel, intel_texture_image(intelObj->base.Image[face][i]); if (intelImage->mt) { - intel_miptree_image_unmap(intel, intelImage->mt); + st_miptree_image_unmap(intel->pipe, intelImage->mt); intelImage->base.Data = NULL; } } -- 2.11.0