summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/r300_texstate.c
diff options
context:
space:
mode:
authorJerome Glisse <[email protected]>2008-11-13 20:04:50 +0100
committerJerome Glisse <[email protected]>2008-11-14 11:26:17 +0100
commit93a9d2f18de8517af92eba787a4eee34765481ab (patch)
treee0a25589aace12919eb0222695ea85d42de7d644 /src/mesa/drivers/dri/r300/r300_texstate.c
parentc26ec97b1390deb7c2ae586450e621a7095dac87 (diff)
r300: release bo from pixmap
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_texstate.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 9153646aa73..bb2f0937c13 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -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;