Mesa (staging/21.3): freedreno: Add FD_DIRTY_RASTERIZER_CLIP_PLANE_ENABLE

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 25 21:32:51 UTC 2022


Module: Mesa
Branch: staging/21.3
Commit: 7fc7d044dc3e6155450881d6b116ef3ca0d5869e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7fc7d044dc3e6155450881d6b116ef3ca0d5869e

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Jan 20 18:11:46 2022 -0800

freedreno: Add FD_DIRTY_RASTERIZER_CLIP_PLANE_ENABLE

Add a dirty bit for clip_plane_enable changes.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14643>
(cherry picked from commit 5e2bd30ea4c0f570c99d58490ace2ae3a3bd5e44)

---

 .pick_status.json                                 |  2 +-
 src/gallium/drivers/freedreno/freedreno_context.h |  5 +++--
 src/gallium/drivers/freedreno/freedreno_state.c   | 10 ++++++++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 96421f3157a..278898c833e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -724,7 +724,7 @@
         "description": "freedreno: Add FD_DIRTY_RASTERIZER_CLIP_PLANE_ENABLE",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index 9da86bf27d2..105f631f934 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -172,8 +172,9 @@ enum fd_dirty_3d_state {
     * from hw perspective:
     */
    FD_DIRTY_RASTERIZER_DISCARD = BIT(24),
-   FD_DIRTY_BLEND_DUAL = BIT(25),
-#define NUM_DIRTY_BITS 26
+   FD_DIRTY_RASTERIZER_CLIP_PLANE_ENABLE = BIT(25),
+   FD_DIRTY_BLEND_DUAL = BIT(26),
+#define NUM_DIRTY_BITS 27
 
    /* additional flag for state requires updated resource tracking: */
    FD_DIRTY_RESOURCE = BIT(31),
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index 5d5b942be39..7ce964320c2 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -38,6 +38,8 @@
 #include "freedreno_texture.h"
 #include "freedreno_util.h"
 
+#define get_safe(ptr, field) ((ptr) ? (ptr)->field : 0)
+
 /* All the generic state handling.. In case of CSO's that are specific
  * to the GPU version, when the bind and the delete are common they can
  * go in here.
@@ -434,7 +436,8 @@ fd_rasterizer_state_bind(struct pipe_context *pctx, void *hwcso) in_dt
 {
    struct fd_context *ctx = fd_context(pctx);
    struct pipe_scissor_state *old_scissor = fd_context_get_scissor(ctx);
-   bool discard = ctx->rasterizer && ctx->rasterizer->rasterizer_discard;
+   bool discard = get_safe(ctx->rasterizer, rasterizer_discard);
+   unsigned clip_plane_enable = get_safe(ctx->rasterizer, clip_plane_enable);
 
    ctx->rasterizer = hwcso;
    fd_context_dirty(ctx, FD_DIRTY_RASTERIZER);
@@ -453,8 +456,11 @@ fd_rasterizer_state_bind(struct pipe_context *pctx, void *hwcso) in_dt
    if (old_scissor != fd_context_get_scissor(ctx))
       fd_context_dirty(ctx, FD_DIRTY_SCISSOR);
 
-   if (ctx->rasterizer && (discard != ctx->rasterizer->rasterizer_discard))
+   if (discard != get_safe(ctx->rasterizer, rasterizer_discard))
       fd_context_dirty(ctx, FD_DIRTY_RASTERIZER_DISCARD);
+
+   if (clip_plane_enable != get_safe(ctx->rasterizer, clip_plane_enable))
+      fd_context_dirty(ctx, FD_DIRTY_RASTERIZER_CLIP_PLANE_ENABLE);
 }
 
 static void



More information about the mesa-commit mailing list