radeon: cleanup cmdbuffer
authorDave Airlie <airlied@redhat.com>
Wed, 11 Feb 2009 06:52:56 +0000 (16:52 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Feb 2009 06:52:56 +0000 (16:52 +1000)
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/radeon/common_misc.c

index bbc71575950af7461c423dc418bbfc5541b5bf11..ec702f6eb3c96322f38537624f31189157442b98 100644 (file)
@@ -97,12 +97,12 @@ static INLINE void r300EmitAtoms(r300ContextPtr r300, GLboolean dirty)
        struct radeon_state_atom *atom;
        int dwords;
 
-    cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
+       cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
        BEGIN_BATCH_NO_AUTOSTATE(2);
        OUT_BATCH(cmdpacket0(r300->radeon.radeonScreen, R300_TX_INVALTAGS, 1));
        OUT_BATCH(R300_TX_FLUSH);
        END_BATCH();
-    end_3d(r300);
+       end_3d(r300);
 
        /* Emit actual atoms */
        foreach(atom, &r300->hw.atomlist) {
@@ -724,6 +724,5 @@ void r300DestroyCmdBuf(r300ContextPtr r300)
        foreach(atom, &r300->hw.atomlist) {
                FREE(atom->cmd);
        }
-       rcommonDestroyCmdBuf(&r300->radeon);
 
 }
index 9ab7e3ae881cf333a84923d6a79b6d78be7ecc38..3e47888e458d677b0d556ded3a6f22b2db74e77b 100644 (file)
@@ -487,15 +487,17 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
                _swrast_DestroyContext(r300->radeon.glCtx);
 
                rcommonFlushCmdBuf(&r300->radeon, __FUNCTION__);
-               r300DestroyCmdBuf(r300);
 
                if (radeon->state.scissor.pClipRects) {
                        FREE(radeon->state.scissor.pClipRects);
                        radeon->state.scissor.pClipRects = NULL;
                }
 
+               r300DestroyCmdBuf(r300);
+
                radeonCleanupContext(&r300->radeon);
 
+
                /* the memory manager might be accessed when Mesa frees the shared
                 * state, so don't destroy it earlier
                 */
index 21719c69eca7736184c592a7f300316c584ba115..333db053bbbe07cd694e2073834a180e1a34d3cb 100644 (file)
@@ -866,6 +866,9 @@ void radeonCleanupContext(radeonContextPtr radeon)
        FILE *track;
        struct radeon_renderbuffer *rb;
        GLframebuffer *fb;
+
+       /* free the Mesa context */
+       _mesa_destroy_context(radeon->glCtx);
        
        fb = (void*)radeon->dri.drawable->driverPrivate;
        rb = (void *)fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
@@ -906,12 +909,13 @@ void radeonCleanupContext(radeonContextPtr radeon)
         * radeon->glCtx->DriverCtx = NULL;
         */
 
-       /* free the Mesa context */
-       _mesa_destroy_context(radeon->glCtx);
+
 
        /* free the option cache */
        driDestroyOptionCache(&radeon->optionCache);
 
+       rcommonDestroyCmdBuf(radeon);
+
        if (radeon->state.scissor.pClipRects) {
                FREE(radeon->state.scissor.pClipRects);
                radeon->state.scissor.pClipRects = 0;