radeon: Increase reference count of current renderbuffers.
authorMichel Dänzer <daenzer@vmware.com>
Wed, 20 May 2009 14:39:33 +0000 (16:39 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Wed, 20 May 2009 15:00:57 +0000 (17:00 +0200)
Fixes

glxinfo: main/renderbuffer.c:2159: _mesa_reference_renderbuffer: Assertion
`oldRb->Magic == 0xaabbccdd' failed.

src/mesa/drivers/dri/radeon/radeon_common.c
src/mesa/drivers/dri/radeon/radeon_common.h
src/mesa/drivers/dri/radeon/radeon_common_context.c
src/mesa/drivers/dri/radeon/radeon_common_context.h

index 2f55dadcb982ed0520048f9af2d91608ee31c82e..76e884d705b76b22a3f05445199f75ba1e781ae1 100644 (file)
@@ -752,8 +752,8 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
                ctx->NewState |= (_NEW_DEPTH | _NEW_STENCIL);
        }
        
-       radeon->state.depth.rrb = rrbDepth;
-       radeon->state.color.rrb = rrbColor;
+       _mesa_reference_renderbuffer(&radeon->state.depth.rb, &rrbDepth->base);
+       _mesa_reference_renderbuffer(&radeon->state.color.rb, &rrbColor->base);
        radeon->state.color.draw_offset = offset;
 
 #if 0
index c2fbb0950d5fd6a06e9955e5fe868ddbb7e86ec2..b60792df0be0d1b98a1092a0330ccf29a7ea1de1 100644 (file)
@@ -77,7 +77,7 @@ static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_fram
 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
 {
        struct radeon_renderbuffer *rrb;
-       rrb = rmesa->state.depth.rrb;
+       rrb = radeon_renderbuffer(rmesa->state.depth.rb);
        if (!rrb)
                return NULL;
 
@@ -88,7 +88,7 @@ static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPt
 {
        struct radeon_renderbuffer *rrb;
 
-       rrb = rmesa->state.color.rrb;
+       rrb = radeon_renderbuffer(rmesa->state.color.rb);
        if (!rrb)
                return NULL;
        return rrb;
index 6fb6f92cb94d16d3f33ab17d6a136659e653ddc1..622bb98f3ecf9c43b7eedfcefa3cce5f0cafe674 100644 (file)
@@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "drirenderbuffer.h"
 #include "main/context.h"
 #include "main/framebuffer.h"
+#include "main/renderbuffer.h"
 #include "main/state.h"
 #include "main/simple_list.h"
 #include "swrast/swrast.h"
@@ -651,10 +652,10 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
                radeon_update_renderbuffers(driContextPriv, driDrawPriv);
                if (driDrawPriv != driReadPriv)
                        radeon_update_renderbuffers(driContextPriv, driReadPriv);
-               radeon->state.color.rrb =
-                       radeon_get_renderbuffer(&drfb->base, BUFFER_BACK_LEFT);
-               radeon->state.depth.rrb =
-                       radeon_get_renderbuffer(&drfb->base, BUFFER_DEPTH);
+               _mesa_reference_renderbuffer(&radeon->state.color.rb,
+                       &(radeon_get_renderbuffer(&drfb->base, BUFFER_BACK_LEFT)->base));
+               _mesa_reference_renderbuffer(&radeon->state.depth.rb,
+                       &(radeon_get_renderbuffer(&drfb->base, BUFFER_DEPTH)->base));
        } else {
                radeon_make_renderbuffer_current(radeon, drfb);
        }
index 446c2f6269b75a96587ac9ad063fb833651e50dd..af05f4ae32e0c1db6f0884575cf887ea908eea76 100644 (file)
@@ -121,13 +121,13 @@ struct radeon_framebuffer
 struct radeon_colorbuffer_state {
        GLuint clear;
        int roundEnable;
-       struct radeon_renderbuffer *rrb;
+       struct gl_renderbuffer *rb;
        uint32_t draw_offset; /* offset into color renderbuffer - FBOs */
 };
 
 struct radeon_depthbuffer_state {
        GLuint clear;
-       struct radeon_renderbuffer *rrb;
+       struct gl_renderbuffer *rb;
 };
 
 struct radeon_scissor_state {