From 1e18c58047ef5920dbe442bc6fc42e62dc0edb7d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 24 Apr 2020 13:54:43 -0700 Subject: [PATCH] freedreno: mark more state dirty when rebinding resources Plus a bonus typo fix. Signed-off-by: Rob Clark Part-of: --- .../drivers/freedreno/freedreno_context.h | 4 +++- .../drivers/freedreno/freedreno_resource.c | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 8665d886a69..faaade508fa 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -143,9 +143,11 @@ enum fd_dirty_3d_state { FD_DIRTY_PROG = BIT(16), FD_DIRTY_CONST = BIT(17), FD_DIRTY_TEX = BIT(18), + FD_DIRTY_IMAGE = BIT(19), + FD_DIRTY_SSBO = BIT(20), /* only used by a2xx.. possibly can be removed.. */ - FD_DIRTY_TEXSTATE = BIT(19), + FD_DIRTY_TEXSTATE = BIT(21), }; /* per shader-stage dirty state: */ diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 247fbe53072..46deed39b8c 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -61,7 +61,7 @@ /** * Go through the entire state and see if the resource is bound * anywhere. If it is, mark the relevant state as dirty. This is - * called on realloc_bo to ensure the neccessary state is re- + * called on realloc_bo to ensure the necessary state is re- * emitted so the GPU looks at the new backing bo. */ static void @@ -82,16 +82,20 @@ rebind_resource(struct fd_context *ctx, struct pipe_resource *prsc) for (unsigned i = 1; i < num_ubos; i++) { if (ctx->dirty_shader[stage] & FD_DIRTY_SHADER_CONST) break; - if (ctx->constbuf[stage].cb[i].buffer == prsc) + if (ctx->constbuf[stage].cb[i].buffer == prsc) { ctx->dirty_shader[stage] |= FD_DIRTY_SHADER_CONST; + ctx->dirty |= FD_DIRTY_CONST; + } } /* Textures */ for (unsigned i = 0; i < ctx->tex[stage].num_textures; i++) { if (ctx->dirty_shader[stage] & FD_DIRTY_SHADER_TEX) break; - if (ctx->tex[stage].textures[i] && (ctx->tex[stage].textures[i]->texture == prsc)) + if (ctx->tex[stage].textures[i] && (ctx->tex[stage].textures[i]->texture == prsc)) { ctx->dirty_shader[stage] |= FD_DIRTY_SHADER_TEX; + ctx->dirty |= FD_DIRTY_TEX; + } } /* Images */ @@ -99,8 +103,10 @@ rebind_resource(struct fd_context *ctx, struct pipe_resource *prsc) for (unsigned i = 0; i < num_images; i++) { if (ctx->dirty_shader[stage] & FD_DIRTY_SHADER_IMAGE) break; - if (ctx->shaderimg[stage].si[i].resource == prsc) + if (ctx->shaderimg[stage].si[i].resource == prsc) { ctx->dirty_shader[stage] |= FD_DIRTY_SHADER_IMAGE; + ctx->dirty |= FD_DIRTY_IMAGE; + } } /* SSBOs */ @@ -108,8 +114,10 @@ rebind_resource(struct fd_context *ctx, struct pipe_resource *prsc) for (unsigned i = 0; i < num_ssbos; i++) { if (ctx->dirty_shader[stage] & FD_DIRTY_SHADER_SSBO) break; - if (ctx->shaderbuf[stage].sb[i].buffer == prsc) + if (ctx->shaderbuf[stage].sb[i].buffer == prsc) { ctx->dirty_shader[stage] |= FD_DIRTY_SHADER_SSBO; + ctx->dirty |= FD_DIRTY_SSBO; + } } } } -- 2.30.2