Mesa (staging/22.0): mesa: flush bitmap caches when changing scissors or window rects state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 20:48:24 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 35f872b3bc0ad9dae4a287a2ff178261f203284f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=35f872b3bc0ad9dae4a287a2ff178261f203284f

Author: Sviatoslav Peleshko <sviatoslav.peleshko at globallogic.com>
Date:   Tue Apr 12 12:52:27 2022 +0300

mesa: flush bitmap caches when changing scissors or window rects state

If we change the sate without flushing the bitmap cache, the cache might be
rendered with the new scissor, which excludes some parts that should've
been rendered with the old state, and vice versa.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6233

Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko at globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15881>
(cherry picked from commit dd7278aa10af21b8622cb5721253eb90c3c0752f)

---

 .pick_status.json       | 2 +-
 src/mesa/main/enable.c  | 5 +++++
 src/mesa/main/scissor.c | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 477368ef1dc..80345b1889e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1476,7 +1476,7 @@
         "description": "mesa: flush bitmap caches when changing scissors or window rects state",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": null
     },
     {
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b6b34f90e24..e1c74225fb3 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -45,6 +45,7 @@
 #include "varray.h"
 #include "api_exec_decl.h"
 
+#include "state_tracker/st_cb_bitmap.h"
 #include "state_tracker/st_context.h"
 
 void
@@ -865,6 +866,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             GLbitfield newEnabled =
                state * ((1 << ctx->Const.MaxViewports) - 1);
             if (newEnabled != ctx->Scissor.EnableFlags) {
+               st_flush_bitmap_cache(st_context(ctx));
+
                FLUSH_VERTICES(ctx, 0,
                               GL_SCISSOR_BIT | GL_ENABLE_BIT);
                ctx->NewDriverState |= ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
@@ -1390,6 +1393,8 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
          return;
       }
       if (((ctx->Scissor.EnableFlags >> index) & 1) != state) {
+         st_flush_bitmap_cache(st_context(ctx));
+
          FLUSH_VERTICES(ctx, 0,
                         GL_SCISSOR_BIT | GL_ENABLE_BIT);
          ctx->NewDriverState |= ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 054c5abaccd..90ac5e57676 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -30,6 +30,7 @@
 #include "main/scissor.h"
 #include "api_exec_decl.h"
 
+#include "state_tracker/st_cb_bitmap.h"
 #include "state_tracker/st_context.h"
 
 /**
@@ -50,6 +51,9 @@ set_scissor_no_notify(struct gl_context *ctx, unsigned idx,
        height == ctx->Scissor.ScissorArray[idx].Height)
       return;
 
+   if (ctx->Scissor.EnableFlags)
+      st_flush_bitmap_cache(st_context(ctx));
+
    FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT);
    ctx->NewDriverState |= ST_NEW_SCISSOR;
 
@@ -294,6 +298,8 @@ _mesa_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
       box += 4;
    }
 
+   st_flush_bitmap_cache(st_context(ctx));
+
    FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT);
    ctx->NewDriverState |= ST_NEW_WINDOW_RECTANGLES;
 



More information about the mesa-commit mailing list