Mesa (staging/21.3): mesa: always call _mesa_update_pixel

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Nov 7 21:49:51 UTC 2021


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

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Tue Nov  2 14:01:06 2021 +0100

mesa: always call _mesa_update_pixel

10c75ae4 moved handling of this state to the functions that
depend on ctx->_ImageTransferState.

So we can't depend on _NEW_PIXEL being set to call this function,
since it'll be always clear earlier by _mesa_update_state_locked.

Example sequence that would trigger the issue:
  glPixelTransferi(...)
  glClear(...)
  glTexSubImage2D(...) <-- won't use the new value set by
                           glPixelTransferi because glClear caused
                           _NEW_PIXEL to be cleared.

_NEW_PIXEL itself is kept because st_update_pixel_transfer depends
on it.

Fixes: 10c75ae4 ("mesa: move _mesa_update_pixel out of _mesa_update_state")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5273
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13596>
(cherry picked from commit 1ee3fbd703752460248958f9b7e42a855023b274)

---

 .pick_status.json        |  2 +-
 src/mesa/main/drawpix.c  |  9 +++------
 src/mesa/main/readpix.c  |  3 +--
 src/mesa/main/teximage.c | 15 +++++----------
 4 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index da5fb94aa9d..8b34dc0099b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -139,7 +139,7 @@
         "description": "mesa: always call _mesa_update_pixel",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "10c75ae41c4e914a0160f9d93bbe1e65b5e14517"
     },
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index a6c48f2d2e4..9df1406e1e6 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -73,8 +73,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
     */
    _mesa_set_vp_override(ctx, GL_TRUE);
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState)
       _mesa_update_state(ctx);
@@ -245,8 +244,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
     */
    _mesa_set_vp_override(ctx, GL_TRUE);
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState)
       _mesa_update_state(ctx);
@@ -334,8 +332,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
       return;    /* do nothing */
    }
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState)
       _mesa_update_state(ctx);
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index f52474ca1af..41c44ffa9c9 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -1056,8 +1056,7 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
       return;
    }
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState)
       _mesa_update_state(ctx);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 4254f106963..acf6ee651a2 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3145,8 +3145,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
          unpack = &unpack_no_border;
       }
 
-      if (ctx->NewState & _NEW_PIXEL)
-         _mesa_update_pixel(ctx);
+      _mesa_update_pixel(ctx);
 
       _mesa_lock_texture(ctx, texObj);
       {
@@ -3587,8 +3586,7 @@ texture_sub_image(struct gl_context *ctx, GLuint dims,
 {
    FLUSH_VERTICES(ctx, 0, 0);
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    _mesa_lock_texture(ctx, texObj);
    {
@@ -4271,8 +4269,7 @@ copy_texture_sub_image_err(struct gl_context *ctx, GLuint dims,
                   _mesa_enum_to_string(target),
                   level, xoffset, yoffset, zoffset, x, y, width, height);
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);
@@ -4297,8 +4294,7 @@ copy_texture_sub_image_no_error(struct gl_context *ctx, GLuint dims,
 {
    FLUSH_VERTICES(ctx, 0, 0);
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);
@@ -4329,8 +4325,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO
                   _mesa_enum_to_string(internalFormat),
                   x, y, width, height, border);
 
-   if (ctx->NewState & _NEW_PIXEL)
-      _mesa_update_pixel(ctx);
+   _mesa_update_pixel(ctx);
 
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);



More information about the mesa-commit mailing list