r300: fix swtcl bo leak problem.
authorDave Airlie <airlied@redhat.com>
Tue, 24 Nov 2009 01:56:45 +0000 (11:56 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 24 Nov 2009 01:56:45 +0000 (11:56 +1000)
We can get a lot of swtcl bo allocations - need to probably abstract
this a bit further.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/drivers/dri/radeon/radeon_dma.c

index 2a1bd7357a319d397818bc7e4c6914bb1018b4d9..89a99974e291fd4983f97b4943ed4f0d0e804ed1 100644 (file)
@@ -451,9 +451,11 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize )
                 rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
                 rmesa->dma.current_vertexptr );
 
-       rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo;
-       radeon_bo_ref(rmesa->swtcl.bo);
-       radeon_bo_map(rmesa->swtcl.bo, 1);
+       if (!rmesa->swtcl.bo) {
+               rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo;
+               radeon_bo_ref(rmesa->swtcl.bo);
+               radeon_bo_map(rmesa->swtcl.bo, 1);
+       }
 
        head = (rmesa->swtcl.bo->ptr + rmesa->dma.current_vertexptr);
        rmesa->dma.current_vertexptr += bytes;