[Mesa-dev] [PATCH] radeon, r200: fix buffer validation after CS flush

Alex Deucher alexdeucher at gmail.com
Wed Aug 6 06:51:38 PDT 2014


On Wed, Aug 6, 2014 at 9:28 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> 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 <joro-2013 at t-online.de>
> Cc: mesa-stable at lists.freedesktop.org

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  src/mesa/drivers/dri/r200/r200_context.c            |  1 +
>  src/mesa/drivers/dri/r200/r200_state.c              |  2 +-
>  src/mesa/drivers/dri/r200/r200_state.h              |  1 +
>  src/mesa/drivers/dri/radeon/radeon_common.c         | 14 +-------------
>  src/mesa/drivers/dri/radeon/radeon_common_context.h |  1 +
>  src/mesa/drivers/dri/radeon/radeon_context.c        |  1 +
>  src/mesa/drivers/dri/radeon/radeon_state.c          |  2 +-
>  src/mesa/drivers/dri/radeon/radeon_state.h          |  1 +
>  8 files changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
> index 71dfcf3..d5749f3 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 2c7b652..983430f 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 db0f01f..a396b06 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 67c6dc7..515e55a 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 6cd1535..ac3e7b5 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 1ceb4ab..edd94e2 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 f6bc5df..843b041 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 cb98969..41e5de6 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 );
>
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list