Mesa (main): iris: Use constants for emitting cso_z->packets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 18:02:26 UTC 2021


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

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Thu Jun 17 10:12:12 2021 -0700

iris: Use constants for emitting cso_z->packets

This should be a bit faster and easier to follow.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11454>

---

 src/gallium/drivers/iris/iris_state.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index ec7bee062e3..b596da19d97 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -6241,9 +6241,9 @@ iris_upload_dirty_render_state(struct iris_context *ice,
          union isl_color_value clear_value =
             iris_resource_get_clear_color(zres, NULL, NULL);
 
-         uint32_t clear_length = GENX(3DSTATE_CLEAR_PARAMS_length) * 4;
-         uint32_t cso_z_size = batch->screen->isl_dev.ds.size - clear_length;
-         uint32_t *clear_params = cso_z->packets + cso_z_size / 4;
+         uint32_t *clear_params =
+            cso_z->packets + ARRAY_SIZE(cso_z->packets) -
+            GENX(3DSTATE_CLEAR_PARAMS_length);
 
          iris_pack_command(GENX(3DSTATE_CLEAR_PARAMS), clear_params, clear) {
             clear.DepthClearValueValid = true;
@@ -6251,7 +6251,7 @@ iris_upload_dirty_render_state(struct iris_context *ice,
          }
       }
 
-      iris_batch_emit(batch, cso_z->packets, batch->screen->isl_dev.ds.size);
+      iris_batch_emit(batch, cso_z->packets, sizeof(cso_z->packets));
 
       if (zres)
          genX(emit_depth_state_workarounds)(ice, batch, &zres->surf);



More information about the mesa-commit mailing list