Mesa (master): freedreno: Move blend gmem checks to a blend dirty state check.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 25 23:18:24 UTC 2021
Module: Mesa
Branch: master
Commit: 6e29757a57a83e2847ccd61e43e7bf44e791df26
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e29757a57a83e2847ccd61e43e7bf44e791df26
Author: Eric Anholt <eric at anholt.net>
Date: Fri Jan 22 10:24:40 2021 -0800
freedreno: Move blend gmem checks to a blend dirty state check.
We don't need to do this every draw call. We do now consider the blend
enable field of a non-present color buffer, because it's not worth
filtering that case out.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8602>
---
src/gallium/drivers/freedreno/freedreno_draw.c | 14 +++++++++-----
src/gallium/drivers/freedreno/freedreno_state.h | 10 ----------
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 723eb928b3b..61cbbf98a4a 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -105,8 +105,6 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
}
}
- if (fd_logicop_enabled(ctx))
- batch->gmem_reason |= FD_GMEM_LOGICOP_ENABLED;
for (unsigned i = 0; i < pfb->nr_cbufs; i++) {
struct pipe_resource *surf;
@@ -124,13 +122,19 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
buffers |= PIPE_CLEAR_COLOR0 << i;
- if (fd_blend_enabled(ctx, i))
- batch->gmem_reason |= FD_GMEM_BLEND_ENABLED;
-
if (ctx->dirty & FD_DIRTY_FRAMEBUFFER)
resource_written(batch, pfb->cbufs[i]->texture);
}
+ if (ctx->dirty & FD_DIRTY_BLEND) {
+ if (ctx->blend->logicop_enable)
+ batch->gmem_reason |= FD_GMEM_LOGICOP_ENABLED;
+ for (unsigned i = 0; i < pfb->nr_cbufs; i++) {
+ if (ctx->blend->rt[i].blend_enable)
+ batch->gmem_reason |= FD_GMEM_BLEND_ENABLED;
+ }
+ }
+
/* Mark SSBOs */
if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_SSBO) {
const struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[PIPE_SHADER_FRAGMENT];
diff --git a/src/gallium/drivers/freedreno/freedreno_state.h b/src/gallium/drivers/freedreno/freedreno_state.h
index 57262104d35..b45a2daac32 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.h
+++ b/src/gallium/drivers/freedreno/freedreno_state.h
@@ -45,16 +45,6 @@ static inline bool fd_stencil_enabled(struct fd_context *ctx)
return ctx->zsa && ctx->zsa->stencil[0].enabled;
}
-static inline bool fd_logicop_enabled(struct fd_context *ctx)
-{
- return ctx->blend && ctx->blend->logicop_enable;
-}
-
-static inline bool fd_blend_enabled(struct fd_context *ctx, unsigned n)
-{
- return ctx->blend && ctx->blend->rt[n].blend_enable;
-}
-
static inline bool fd_depth_clamp_enabled(struct fd_context *ctx)
{
return !(ctx->rasterizer->depth_clip_near && ctx->rasterizer->depth_clip_far);
More information about the mesa-commit
mailing list