Mesa (main): iris: Use fill_surface_states for compressed resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 22 16:54:47 UTC 2022


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

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Fri Jul 15 12:05:24 2022 -0400

iris: Use fill_surface_states for compressed resources

In iris_create_surface, use the fill_surface_states helper function instead of
an open-coded solution for compressed resources.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17598>

---

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

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index daff435c4cd..f3e33a67e41 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2743,6 +2743,9 @@ iris_create_surface(struct pipe_context *ctx,
                           ISL_SURF_USAGE_STENCIL_BIT))
       return psurf;
 
+   /* Fill out a SURFACE_STATE for each possible auxiliary surface mode and
+    * return the pipe_surface.
+    */
    unsigned aux_usages = 0;
 
    if ((res->aux.usage == ISL_AUX_USAGE_CCS_E ||
@@ -2756,38 +2759,17 @@ iris_create_surface(struct pipe_context *ctx,
 
    alloc_surface_states(&surf->surface_state, aux_usages);
    surf->surface_state.bo_address = res->bo->address;
+   fill_surface_states(&screen->isl_dev, &surf->surface_state, res,
+                       &isl_surf, view, offset_B, tile_x_el, tile_y_el);
 
 #if GFX_VER == 8
    alloc_surface_states(&surf->surface_state_read, aux_usages);
    surf->surface_state_read.bo_address = res->bo->address;
+   fill_surface_states(&screen->isl_dev, &surf->surface_state_read, res,
+                       &read_surf, read_view, read_surf_offset_B,
+                       read_surf_tile_x_sa, read_surf_tile_y_sa);
 #endif
 
-   if (!isl_format_is_compressed(res->surf.format)) {
-      /* This is a normal surface.  Fill out a SURFACE_STATE for each possible
-       * auxiliary surface mode and return the pipe_surface.
-       */
-      fill_surface_states(&screen->isl_dev, &surf->surface_state, res,
-                          &res->surf, view, 0, 0, 0);
-#if GFX_VER == 8
-      fill_surface_states(&screen->isl_dev, &surf->surface_state_read, res,
-                          &read_surf, read_view, read_surf_offset_B,
-                          read_surf_tile_x_sa, read_surf_tile_y_sa);
-#endif
-      return psurf;
-   }
-
-   struct isl_surf_fill_state_info f = {
-      .surf = &isl_surf,
-      .view = view,
-      .mocs = iris_mocs(res->bo, &screen->isl_dev,
-                        ISL_SURF_USAGE_RENDER_TARGET_BIT),
-      .address = res->bo->address + offset_B,
-      .x_offset_sa = tile_x_el, /* Single-sampled, so el == sa */
-      .y_offset_sa = tile_y_el, /* Single-sampled, so el == sa */
-   };
-
-   isl_surf_fill_state_s(&screen->isl_dev, surf->surface_state.cpu, &f);
-
    return psurf;
 }
 



More information about the mesa-commit mailing list