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

Author: Kenneth Graunke <[email protected]>
Date:   Mon Dec  6 15:42:01 2021 -0800

iris: Fix and refactor check for clear color being fully zero

I missed updating this code to check res->aux.clear_color_unknown when
I added it a while back.  While we're here, also refactor this code into
a helper function - I'll want to use it in another place shortly.

Fixes: e83da2d8e3b ("iris: Don't try to CPU read imported clear color BOs")

Reviewed-by: Nanley Chery <[email protected]>
Reviewed-by: Caio Oliveira <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14687>
(cherry picked from commit 09072a08030061f16b290984305e4ba09e2ad3fe)

---

 .pick_status.json                    |  2 +-
 src/gallium/drivers/iris/iris_blit.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 41affd8a5e1..0425b049109 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -364,7 +364,7 @@
         "description": "iris: Fix and refactor check for clear color being 
fully zero",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "e83da2d8e3b1129d6857bb18cb212fdd08cbc69b"
     },
diff --git a/src/gallium/drivers/iris/iris_blit.c 
b/src/gallium/drivers/iris/iris_blit.c
index a755f9427eb..ad097a1ff24 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -337,6 +337,16 @@ pipe_format_for_aspect(enum pipe_format format, unsigned 
pipe_mask)
    }
 }
 
+static bool
+clear_color_is_fully_zero(const struct iris_resource *res)
+{
+   return !res->aux.clear_color_unknown &&
+          res->aux.clear_color.u32[0] == 0 &&
+          res->aux.clear_color.u32[1] == 0 &&
+          res->aux.clear_color.u32[2] == 0 &&
+          res->aux.clear_color.u32[3] == 0;
+}
+
 /**
  * The pipe->blit() driver hook.
  *
@@ -590,10 +600,7 @@ get_copy_region_aux_settings(struct iris_context *ice,
        *   original format (e.g. A8_UNORM/R8_UINT).
        */
       *out_clear_supported = (devinfo->ver >= 11 && !is_render_target) ||
-                             (res->aux.clear_color.u32[0] == 0 &&
-                              res->aux.clear_color.u32[1] == 0 &&
-                              res->aux.clear_color.u32[2] == 0 &&
-                              res->aux.clear_color.u32[3] == 0);
+                             clear_color_is_fully_zero(res);
       break;
    default:
       *out_aux_usage = ISL_AUX_USAGE_NONE;

Reply via email to