From 83a43aca233cfdf8f8cac26895ef4ea4105d96af Mon Sep 17 00:00:00 2001 From: Aapo Tahkola Date: Sat, 8 Apr 2006 20:05:50 +0000 Subject: [PATCH] fix some conflict happenings at context destroy by freeing buffers immediately. array locking can be done with vbos for vtxfmt_a so we dont really need to try to reuse them. --- src/mesa/drivers/dri/r300/r300_render.c | 2 +- src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index a0375f90227..e6ed06a69d6 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -382,7 +382,6 @@ GLboolean r300_run_vb_render(GLcontext *ctx, r300UpdateShaders(rmesa); if (rmesa->state.VB.LockCount == 0 || 1) { - r300ReleaseArrays(ctx); r300EmitArrays(ctx, GL_FALSE); r300UpdateShaderStates(rmesa); @@ -446,6 +445,7 @@ GLboolean r300_run_vb_render(GLcontext *ctx, #ifdef USER_BUFFERS r300UseArrays(ctx); #endif + r300ReleaseArrays(ctx); return GL_FALSE; } diff --git a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c index 5ea9bb4eb45..8f7620482f3 100644 --- a/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c +++ b/src/mesa/drivers/dri/r300/radeon_vtxfmt_a.c @@ -182,7 +182,7 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G unsigned int min = ~0, max = 0; struct tnl_prim prim; static void *ptr = NULL; - static struct r300_dma_region rvb; + struct r300_dma_region rvb; const GLvoid *indices = c_indices; if (count > 65535) { @@ -205,8 +205,8 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G return; FLUSH_CURRENT( ctx, 0 ); - r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__); + memset(&rvb, 0, sizeof(rvb)); switch (type) { case GL_UNSIGNED_BYTE: for (i=0; i < count; i++) { @@ -311,8 +311,10 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G return; } } else { - if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) + if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) { + r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__); goto fallback; + } rmesa->state.VB.Count = max - min + 1; } @@ -337,6 +339,7 @@ static void radeonDrawElements( GLenum mode, GLsizei count, GLenum type, const G if(rvb.buf) radeon_mm_use(rmesa, rvb.buf->id); + r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__); return; fallback: @@ -355,7 +358,7 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei int elt_size; int i; void *ptr = NULL; - static struct r300_dma_region rvb; + struct r300_dma_region rvb; const GLvoid *indices = c_indices; if (count > 65535) { @@ -381,9 +384,9 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei #ifdef OPTIMIZE_ELTS min = 0; #endif - r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__); - switch(type){ + memset(&rvb, 0, sizeof(rvb)); + switch (type){ case GL_UNSIGNED_BYTE: elt_size = 2; @@ -473,8 +476,10 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei return; }*/ } else { - if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) + if (setup_arrays(rmesa, min) >= R300_FALLBACK_TCL) { + r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__); goto fallback; + } rmesa->state.VB.Count = max - min + 1; } @@ -501,6 +506,7 @@ static void radeonDrawRangeElements(GLenum mode, GLuint min, GLuint max, GLsizei if(rvb.buf) radeon_mm_use(rmesa, rvb.buf->id); + r300ReleaseDmaRegion(rmesa, &rvb, __FUNCTION__); return ; fallback: -- 2.30.2