OSDN Git Service

radeon: ensure cmdbuf space for state + AOS is available
authorDave Airlie <airlied@redhat.com>
Mon, 6 Jul 2009 10:35:15 +0000 (20:35 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 6 Jul 2009 10:39:49 +0000 (20:39 +1000)
The problem is if we find out later we don't have any cmdbuf space but
we've already written the arrays to the DMA buffer object, we end up
emitting the current cmdbuf which has references to the current DMA object
we then send that to the hw and we can't reference the arrays we just emitted
to the old DMA buffer. things go bad, crash boom.

This can probably be tuned further + swtcl probably needs some fixes

src/mesa/drivers/dri/r300/r300_draw.c

index 20fe8db..fe8014b 100644 (file)
@@ -417,6 +417,12 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx,
 
        r300FixupIndexBuffer(ctx, ib, bo, &nr_bo);
 
+       /* ensure we have the cmd buf space in advance to cover
+        * the state + DMA AOS pointers */
+       rcommonEnsureCmdBufSpace(&r300->radeon,
+                           r300->radeon.hw.max_state_size + (50*sizeof(int)),
+                           __FUNCTION__);
+
        r300SetVertexFormat(ctx, arrays, max_index + 1, bo, &nr_bo);
 
        if (r300->fallback)