Mesa (master): freedreno: scissor vs disabled scissor micro-opt
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 30 20:21:11 UTC 2020
Module: Mesa
Branch: master
Commit: f62cad6b7f8d6061dccc1fe548aee1477805d3e8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f62cad6b7f8d6061dccc1fe548aee1477805d3e8
Author: Rob Clark <robdclark at chromium.org>
Date: Wed Apr 22 15:26:02 2020 -0700
freedreno: scissor vs disabled scissor micro-opt
We don't need to deref and check rast state every time scissor changes,
only when rast state changes.
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>
---
src/gallium/drivers/freedreno/freedreno_context.c | 2 ++
src/gallium/drivers/freedreno/freedreno_context.h | 7 ++++---
src/gallium/drivers/freedreno/freedreno_state.c | 6 ++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 7c9eb4186b2..17a40a9fa6a 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -427,6 +427,8 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
list_add(&ctx->node, &ctx->screen->context_list);
fd_screen_unlock(ctx->screen);
+ ctx->current_scissor = &ctx->disabled_scissor;
+
ctx->log_out = stdout;
if ((fd_mesa_debug & FD_DBG_LOG) &&
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index b6a8aa3bf5f..b3a0f212dd0 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -278,6 +278,9 @@ struct fd_context {
*/
bool in_discard_blit : 1;
+ /* points to either scissor or disabled_scissor depending on rast state: */
+ struct pipe_scissor_state *current_scissor;
+
struct pipe_scissor_state scissor;
/* we don't have a disable/enable bit for scissor, so instead we keep
@@ -463,9 +466,7 @@ fd_context_all_clean(struct fd_context *ctx)
static inline struct pipe_scissor_state *
fd_context_get_scissor(struct fd_context *ctx)
{
- if (ctx->rasterizer && ctx->rasterizer->scissor)
- return &ctx->scissor;
- return &ctx->disabled_scissor;
+ return ctx->current_scissor;
}
static inline bool
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index b2e8c53676c..698ca82e521 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -400,6 +400,12 @@ fd_rasterizer_state_bind(struct pipe_context *pctx, void *hwcso)
ctx->rasterizer = hwcso;
ctx->dirty |= FD_DIRTY_RASTERIZER;
+ if (ctx->rasterizer && ctx->rasterizer->scissor) {
+ ctx->current_scissor = &ctx->scissor;
+ } else {
+ ctx->current_scissor = &ctx->disabled_scissor;
+ }
+
/* if scissor enable bit changed we need to mark scissor
* state as dirty as well:
* NOTE: we can do a shallow compare, since we only care
More information about the mesa-commit
mailing list