Module: Mesa
Branch: master
Commit: 9871521b302117682afbefa7316a41a1a00485b2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9871521b302117682afbefa7316a41a1a00485b2

Author: Younes Manton <[email protected]>
Date:   Sun Sep 27 10:56:42 2009 -0400

llvmpipe: Grab a ref when the fb is set.

Based on softpipe commit a77226071f6814a53358a5d6caff685889d0e4ec.

---

 src/gallium/drivers/llvmpipe/lp_context.c       |    9 +++++++--
 src/gallium/drivers/llvmpipe/lp_state_surface.c |    4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_context.c 
b/src/gallium/drivers/llvmpipe/lp_context.c
index a4b2bd8..202cb8e 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -107,11 +107,16 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
    if (llvmpipe->draw)
       draw_destroy( llvmpipe->draw );
 
-   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
+   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
       lp_destroy_tile_cache(llvmpipe->cbuf_cache[i]);
+      pipe_surface_reference(&llvmpipe->framebuffer.cbufs[i], NULL);
+   }
+   pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL);
 
-   for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
+   for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
       lp_destroy_tex_tile_cache(llvmpipe->tex_cache[i]);
+      pipe_texture_reference(&llvmpipe->texture[i], NULL);
+   }
 
    for (i = 0; i < Elements(llvmpipe->constants); i++) {
       if (llvmpipe->constants[i].buffer) {
diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c 
b/src/gallium/drivers/llvmpipe/lp_state_surface.c
index 177a26b..2c29144 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c
@@ -56,7 +56,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
          lp_flush_tile_cache(lp->cbuf_cache[i]);
 
          /* assign new */
-         lp->framebuffer.cbufs[i] = fb->cbufs[i];
+         pipe_surface_reference(&lp->framebuffer.cbufs[i], fb->cbufs[i]);
 
          /* update cache */
          lp_tile_cache_set_surface(lp->cbuf_cache[i], fb->cbufs[i]);
@@ -81,7 +81,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
       }
 
       /* assign new */
-      lp->framebuffer.zsbuf = fb->zsbuf;
+      pipe_surface_reference(&lp->framebuffer.zsbuf, fb->zsbuf);
 
       /* Tell draw module how deep the Z/depth buffer is */
       if (lp->framebuffer.zsbuf) {

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to