| @@ -79,34 +79,6 @@ typedef struct r300_context *r300ContextPtr; | |||
| /************ DMA BUFFERS **************/ | |||
| /* Texture related */ | |||
| typedef struct _r300_texture_image r300_texture_image; | |||
| struct _r300_texture_image { | |||
| struct gl_texture_image base; | |||
| /** | |||
| * If mt != 0, the image is stored in hardware format in the | |||
| * given mipmap tree. In this case, base.Data may point into the | |||
| * mapping of the buffer object that contains the mipmap tree. | |||
| * | |||
| * If mt == 0, the image is stored in normal memory pointed to | |||
| * by base.Data. | |||
| */ | |||
| struct _radeon_mipmap_tree *mt; | |||
| struct radeon_bo *bo; | |||
| int mtlevel; /** if mt != 0, this is the image's level in the mipmap tree */ | |||
| int mtface; /** if mt != 0, this is the image's face in the mipmap tree */ | |||
| }; | |||
| static INLINE r300_texture_image *get_r300_texture_image(struct gl_texture_image *image) | |||
| { | |||
| return (r300_texture_image*)image; | |||
| } | |||
| /* The blit width for texture uploads | |||
| */ | |||
| #define R300_BLIT_WIDTH_BYTES 1024 | |||
| @@ -412,7 +412,7 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx, | |||
| */ | |||
| static struct gl_texture_image *r300NewTextureImage(GLcontext *ctx) | |||
| { | |||
| return CALLOC(sizeof(r300_texture_image)); | |||
| return CALLOC(sizeof(radeon_texture_image)); | |||
| } | |||
| /** | |||
| @@ -420,7 +420,7 @@ static struct gl_texture_image *r300NewTextureImage(GLcontext *ctx) | |||
| */ | |||
| static void r300FreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage) | |||
| { | |||
| r300_texture_image* image = get_r300_texture_image(timage); | |||
| radeon_texture_image* image = get_radeon_texture_image(timage); | |||
| if (image->mt) { | |||
| radeon_miptree_unreference(image->mt); | |||
| @@ -437,7 +437,7 @@ static void r300FreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage | |||
| /* Set Data pointer and additional data for mapped texture image */ | |||
| static void teximage_set_map_data(r300_texture_image *image) | |||
| static void teximage_set_map_data(radeon_texture_image *image) | |||
| { | |||
| radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; | |||
| image->base.Data = image->mt->bo->ptr + lvl->faces[image->mtface].offset; | |||
| @@ -448,7 +448,7 @@ static void teximage_set_map_data(r300_texture_image *image) | |||
| /** | |||
| * Map a single texture image for glTexImage and friends. | |||
| */ | |||
| static void r300_teximage_map(r300_texture_image *image, GLboolean write_enable) | |||
| static void r300_teximage_map(radeon_texture_image *image, GLboolean write_enable) | |||
| { | |||
| if (image->mt) { | |||
| assert(!image->base.Data); | |||
| @@ -459,7 +459,7 @@ static void r300_teximage_map(r300_texture_image *image, GLboolean write_enable) | |||
| } | |||
| static void r300_teximage_unmap(r300_texture_image *image) | |||
| static void r300_teximage_unmap(radeon_texture_image *image) | |||
| { | |||
| if (image->mt) { | |||
| assert(image->base.Data); | |||
| @@ -483,7 +483,7 @@ static void r300MapTexture(GLcontext *ctx, struct gl_texture_object *texObj) | |||
| radeon_bo_map(t->mt->bo, GL_FALSE); | |||
| for(face = 0; face < t->mt->faces; ++face) { | |||
| for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level) | |||
| teximage_set_map_data(get_r300_texture_image(texObj->Image[face][level])); | |||
| teximage_set_map_data(get_radeon_texture_image(texObj->Image[face][level])); | |||
| } | |||
| } | |||
| @@ -519,7 +519,7 @@ static void r300_teximage( | |||
| { | |||
| r300ContextPtr rmesa = R300_CONTEXT(ctx); | |||
| radeonTexObj* t = radeon_tex_obj(texObj); | |||
| r300_texture_image* image = get_r300_texture_image(texImage); | |||
| radeon_texture_image* image = get_radeon_texture_image(texImage); | |||
| R300_FIREVERTICES(rmesa); | |||
| @@ -688,7 +688,7 @@ static void r300_texsubimage(GLcontext* ctx, int dims, int level, | |||
| int compressed) | |||
| { | |||
| r300ContextPtr rmesa = R300_CONTEXT(ctx); | |||
| r300_texture_image* image = get_r300_texture_image(texImage); | |||
| radeon_texture_image* image = get_radeon_texture_image(texImage); | |||
| R300_FIREVERTICES(rmesa); | |||
| @@ -788,7 +788,7 @@ r300TexSubImage3D(GLcontext * ctx, GLenum target, GLint level, | |||
| static void r300_generate_mipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj) | |||
| { | |||
| GLuint face = face_for_target(target); | |||
| r300_texture_image *baseimage = get_r300_texture_image(texObj->Image[face][texObj->BaseLevel]); | |||
| radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[face][texObj->BaseLevel]); | |||
| r300_teximage_map(baseimage, GL_FALSE); | |||
| _mesa_generate_mipmap(ctx, target, texObj); | |||
| @@ -265,7 +265,7 @@ static void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcst | |||
| /** | |||
| * Ensure that the given image is stored in the given miptree from now on. | |||
| */ | |||
| static void migrate_image_to_miptree(radeon_mipmap_tree *mt, r300_texture_image *image, int face, int level) | |||
| static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_image *image, int face, int level) | |||
| { | |||
| radeon_mipmap_level *dstlvl = &mt->levels[level - mt->firstLevel]; | |||
| unsigned char *dest; | |||
| @@ -326,7 +326,7 @@ static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object | |||
| { | |||
| r300ContextPtr rmesa = R300_CONTEXT(ctx); | |||
| radeonTexObj *t = radeon_tex_obj(texObj); | |||
| r300_texture_image *baseimage = get_r300_texture_image(texObj->Image[0][texObj->BaseLevel]); | |||
| radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[0][texObj->BaseLevel]); | |||
| int face, level; | |||
| if (t->validated || t->image_override) | |||
| @@ -372,7 +372,7 @@ static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object | |||
| /* Ensure all images are stored in the single main miptree */ | |||
| for(face = 0; face < t->mt->faces; ++face) { | |||
| for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level) { | |||
| r300_texture_image *image = get_r300_texture_image(texObj->Image[face][level]); | |||
| radeon_texture_image *image = get_radeon_texture_image(texObj->Image[face][level]); | |||
| if (RADEON_DEBUG & DEBUG_TEXTURE) | |||
| fprintf(stderr, " face %i, level %i... ", face, level); | |||
| if (t->mt == image->mt) { | |||
| @@ -465,7 +465,7 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) | |||
| struct gl_texture_object *texObj; | |||
| struct gl_texture_image *texImage; | |||
| struct radeon_renderbuffer *rb; | |||
| r300_texture_image *rImage; | |||
| radeon_texture_image *rImage; | |||
| radeonContextPtr radeon; | |||
| r300ContextPtr rmesa; | |||
| GLframebuffer *fb; | |||
| @@ -482,7 +482,7 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) | |||
| texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target); | |||
| texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0); | |||
| rImage = get_r300_texture_image(texImage); | |||
| rImage = get_radeon_texture_image(texImage); | |||
| t = radeon_tex_obj(texObj); | |||
| if (t == NULL) { | |||
| return; | |||
| @@ -110,6 +110,35 @@ struct radeon_state_atom { | |||
| void (*emit) (GLcontext *, struct radeon_state_atom *atom); | |||
| }; | |||
| /* Texture related */ | |||
| typedef struct _radeon_texture_image radeon_texture_image; | |||
| struct _radeon_texture_image { | |||
| struct gl_texture_image base; | |||
| /** | |||
| * If mt != 0, the image is stored in hardware format in the | |||
| * given mipmap tree. In this case, base.Data may point into the | |||
| * mapping of the buffer object that contains the mipmap tree. | |||
| * | |||
| * If mt == 0, the image is stored in normal memory pointed to | |||
| * by base.Data. | |||
| */ | |||
| struct _radeon_mipmap_tree *mt; | |||
| struct radeon_bo *bo; | |||
| int mtlevel; /** if mt != 0, this is the image's level in the mipmap tree */ | |||
| int mtface; /** if mt != 0, this is the image's face in the mipmap tree */ | |||
| }; | |||
| static INLINE radeon_texture_image *get_radeon_texture_image(struct gl_texture_image *image) | |||
| { | |||
| return (radeon_texture_image*)image; | |||
| } | |||
| typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr; | |||
| #define RADEON_TXO_MICRO_TILE (1 << 3) | |||