From: Marek Olšák Date: Fri, 1 Aug 2014 17:36:37 +0000 (+0200) Subject: radeon,r200: fix buffer validation after CS flush X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=085a86154553d86f8e4296b4c732901f781bdfd8;p=mesa.git radeon,r200: fix buffer validation after CS flush This validates all bound buffers (CB, ZB, textures, DMA) at the beginning of CS. This fixes "bo->space_accouned" assertion failures. Tested by: Jochen Rollwagen Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Alex Deucher --- diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 71dfcf337f0..d5749f3e10d 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -190,6 +190,7 @@ static void r200_init_vtbl(radeonContextPtr radeon) radeon->vtbl.check_blit = r200_check_blit; radeon->vtbl.blit = r200_blit; radeon->vtbl.is_format_renderable = radeonIsFormatRenderable; + radeon->vtbl.revalidate_all_buffers = r200ValidateBuffers; } diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 2c7b652952a..983430fe301 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2210,7 +2210,7 @@ static void update_texturematrix( struct gl_context *ctx ) } } -static GLboolean r200ValidateBuffers(struct gl_context *ctx) +GLboolean r200ValidateBuffers(struct gl_context *ctx) { r200ContextPtr rmesa = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index db0f01f30e7..a396b06c8fb 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -47,6 +47,7 @@ extern void r200UpdateViewportOffset( struct gl_context *ctx ); extern void r200UpdateWindow( struct gl_context *ctx ); extern void r200UpdateDrawBuffer(struct gl_context *ctx); +extern GLboolean r200ValidateBuffers(struct gl_context *ctx); extern GLboolean r200ValidateState( struct gl_context *ctx ); extern void r200_vtbl_update_scissor( struct gl_context *ctx ); diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 67c6dc7b2a7..515e55a5a6f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -532,17 +532,6 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean emitAll) COMMIT_BATCH(); } -static GLboolean radeon_revalidate_bos(struct gl_context *ctx) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - int ret; - - ret = radeon_cs_space_check(radeon->cmdbuf.cs); - if (ret == RADEON_CS_SPACE_FLUSH) - return GL_FALSE; - return GL_TRUE; -} - void radeonEmitState(radeonContextPtr radeon) { radeon_print(RADEON_STATE, RADEON_NORMAL, "%s\n", __FUNCTION__); @@ -661,9 +650,8 @@ int rcommonFlushCmdBufLocked(radeonContextPtr rmesa, const char *caller) radeon_cs_erase(rmesa->cmdbuf.cs); rmesa->cmdbuf.flushing = 0; - if (radeon_revalidate_bos(&rmesa->glCtx) == GL_FALSE) { + if (!rmesa->vtbl.revalidate_all_buffers(&rmesa->glCtx)) fprintf(stderr,"failed to revalidate buffers\n"); - } return ret; } diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 6cd15356634..ac3e7b529b2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -496,6 +496,7 @@ struct radeon_context { unsigned reg_height, unsigned flip_y); unsigned (*is_format_renderable)(mesa_format mesa_format); + GLboolean (*revalidate_all_buffers)(struct gl_context *ctx); } vtbl; }; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 1ceb4ab869e..edd94e2ae9f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -157,6 +157,7 @@ static void r100_init_vtbl(radeonContextPtr radeon) radeon->vtbl.check_blit = r100_check_blit; radeon->vtbl.blit = r100_blit; radeon->vtbl.is_format_renderable = radeonIsFormatRenderable; + radeon->vtbl.revalidate_all_buffers = r100ValidateBuffers; } /* Create the device specific context. diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index f6bc5df0e47..843b041ab5b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -1992,7 +1992,7 @@ static void update_texturematrix( struct gl_context *ctx ) } } -static GLboolean r100ValidateBuffers(struct gl_context *ctx) +GLboolean r100ValidateBuffers(struct gl_context *ctx) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h index cb98969c492..41e5de65ee4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.h +++ b/src/mesa/drivers/dri/radeon/radeon_state.h @@ -50,6 +50,7 @@ extern void radeonUpdateDrawBuffer( struct gl_context *ctx ); extern void radeonUploadTexMatrix( r100ContextPtr rmesa, int unit, GLboolean swapcols ); +extern GLboolean r100ValidateBuffers(struct gl_context *ctx); extern GLboolean radeonValidateState( struct gl_context *ctx );