r300: release bo from pixmap

This commit is contained in:
Jerome Glisse 2008-11-13 20:04:50 +01:00
parent c26ec97b13
commit 93a9d2f18d
3 changed files with 26 additions and 4 deletions

View file

@ -139,6 +139,7 @@ struct _r300_texture_image {
* by base.Data.
*/
struct _r300_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 */

View file

@ -429,6 +429,10 @@ static void r300FreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage
} else {
_mesa_free_texture_image_data(ctx, timage);
}
if (image->bo) {
radeon_bo_unref(image->bo);
image->bo = NULL;
}
}

View file

@ -465,6 +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;
radeonContextPtr radeon;
r300ContextPtr rmesa;
GLframebuffer *fb;
@ -478,6 +479,11 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit];
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);
t = r300_tex_obj(texObj);
if (t == NULL) {
return;
}
radeon_update_renderbuffers(pDRICtx, dPriv);
rb = (void*)fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
@ -487,14 +493,25 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
}
_mesa_lock_texture(radeon->glCtx, texObj);
if (t->bo) {
t->bo = NULL;
}
if (t->mt) {
t->mt = NULL;
}
if (rImage->bo) {
radeon_bo_unref(rImage->bo);
rImage->bo = NULL;
}
if (rImage->mt) {
r300_miptree_unreference(rImage->mt);
rImage->mt = NULL;
}
_mesa_init_teximage_fields(radeon->glCtx, target, texImage,
rb->width, rb->height, rb->cpp, 0, rb->cpp);
texImage->TexFormat = &_mesa_texformat_rgba8888_rev;
rImage->bo = rb->bo;
t = r300_tex_obj(texObj);
if (t == NULL) {
return;
}
t->bo = rb->bo;
t->tile_bits = 0;
t->image_override = GL_TRUE;