Mesa (main): iris: Fix and refactor check for clear color being fully zero

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 24 23:47:36 UTC 2022


Module: Mesa
Branch: main
Commit: 09072a08030061f16b290984305e4ba09e2ad3fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09072a08030061f16b290984305e4ba09e2ad3fe

Author: Kenneth Graunke <kenneth at whitecape.org>
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 <nanley.g.chery at intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14687>

---

 src/gallium/drivers/iris/iris_blit.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c
index 504817de210..99811b7553a 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -343,6 +343,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.
  *
@@ -595,10 +605,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_dest) ||
-                             (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;



More information about the mesa-commit mailing list