Mesa (main): iris: Avoid making some invalid CCS surface states

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 10 05:10:55 UTC 2022


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

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Mon Jan 10 22:37:33 2022 -0500

iris: Avoid making some invalid CCS surface states

Although a resource may support CCS with its original format, a texture
view of that resource may have a format that doesn't support
compression. Don't create CCS surface states for such texture views.

This change affects iris' behavior when running piglit's
arb_texture_view-rendering-formats_gles3 test on SKL.

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

---

 src/gallium/drivers/iris/iris_state.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 8d66ab83712..3738d9155a7 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2500,10 +2500,6 @@ iris_create_sampler_view(struct pipe_context *ctx,
 
    isv->res = (struct iris_resource *) tex;
 
-   alloc_surface_states(&isv->surface_state, isv->res->aux.sampler_usages);
-
-   isv->surface_state.bo_address = isv->res->bo->address;
-
    isl_surf_usage_flags_t usage = ISL_SURF_USAGE_TEXTURE_BIT;
 
    if (isv->base.target == PIPE_TEXTURE_CUBE ||
@@ -2526,6 +2522,20 @@ iris_create_sampler_view(struct pipe_context *ctx,
       .usage = usage,
    };
 
+   unsigned aux_usages = 0;
+
+   if ((isv->res->aux.usage == ISL_AUX_USAGE_CCS_D ||
+        isv->res->aux.usage == ISL_AUX_USAGE_CCS_E ||
+        isv->res->aux.usage == ISL_AUX_USAGE_GFX12_CCS_E) &&
+       !isl_format_supports_ccs_e(devinfo, isv->view.format)) {
+      aux_usages = 1 << ISL_AUX_USAGE_NONE;
+   } else {
+      aux_usages = isv->res->aux.sampler_usages;
+   }
+
+   alloc_surface_states(&isv->surface_state, aux_usages);
+   isv->surface_state.bo_address = isv->res->bo->address;
+
    /* Fill out SURFACE_STATE for this view. */
    if (tmpl->target != PIPE_BUFFER) {
       isv->view.base_level = tmpl->u.tex.first_level;
@@ -2682,12 +2692,21 @@ iris_create_surface(struct pipe_context *ctx,
                           ISL_SURF_USAGE_STENCIL_BIT))
       return psurf;
 
+   unsigned aux_usages = 0;
+
+   if ((res->aux.usage == ISL_AUX_USAGE_CCS_E ||
+        res->aux.usage == ISL_AUX_USAGE_GFX12_CCS_E) &&
+       !isl_format_supports_ccs_e(devinfo, view->format)) {
+      aux_usages = 1 << ISL_AUX_USAGE_NONE;
+   } else {
+      aux_usages = res->aux.possible_usages;
+   }
 
-   alloc_surface_states(&surf->surface_state, res->aux.possible_usages);
+   alloc_surface_states(&surf->surface_state, aux_usages);
    surf->surface_state.bo_address = res->bo->address;
 
 #if GFX_VER == 8
-   alloc_surface_states(&surf->surface_state_read, res->aux.possible_usages);
+   alloc_surface_states(&surf->surface_state_read, aux_usages);
    surf->surface_state_read.bo_address = res->bo->address;
 #endif
 



More information about the mesa-commit mailing list