iris: Use known formats for tex_cache_flush_hack
authorNanley Chery <nanley.g.chery@intel.com>
Sat, 13 May 2023 00:04:40 +0000 (17:04 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 22 May 2023 22:20:58 +0000 (22:20 +0000)
Instead of using ISL_FORMAT_UNSUPPORTED, use the known format to avoid
extra cache flushes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23087>

src/gallium/drivers/iris/iris_blit.c

index 35a3946..e1694b4 100644 (file)
@@ -279,8 +279,7 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
 static bool
 is_astc(enum isl_format format)
 {
-   return format != ISL_FORMAT_UNSUPPORTED &&
-          isl_format_get_layout(format)->txc == ISL_TXC_ASTC;
+   return isl_format_get_layout(format)->txc == ISL_TXC_ASTC;
 }
 
 static void
@@ -679,6 +678,10 @@ iris_copy_region(struct blorp_context *blorp,
       batch->name == IRIS_BATCH_BLITTER ? IRIS_DOMAIN_OTHER_WRITE
                                         : IRIS_DOMAIN_RENDER_WRITE;
 
+   enum isl_format src_fmt, dst_fmt;
+   blorp_copy_get_formats(&screen->isl_dev, &src_res->surf, &dst_res->surf,
+                          &src_fmt, &dst_fmt);
+
    enum isl_aux_usage src_aux_usage, dst_aux_usage;
    bool src_clear_supported, dst_clear_supported;
    get_copy_region_aux_settings(ice, batch, src_res, src_level,
@@ -687,7 +690,7 @@ iris_copy_region(struct blorp_context *blorp,
                                 &dst_aux_usage, &dst_clear_supported, true);
 
    if (iris_batch_references(batch, src_res->bo))
-      tex_cache_flush_hack(batch, ISL_FORMAT_UNSUPPORTED, src_res->surf.format);
+      tex_cache_flush_hack(batch, src_fmt, src_res->surf.format);
 
    if (dst->target == PIPE_BUFFER)
       util_range_add(&dst_res->base.b, &dst_res->valid_buffer_range, dstx, dstx + src_box->width);
@@ -757,7 +760,7 @@ iris_copy_region(struct blorp_context *blorp,
 
    blorp_batch_finish(&blorp_batch);
 
-   tex_cache_flush_hack(batch, ISL_FORMAT_UNSUPPORTED, src_res->surf.format);
+   tex_cache_flush_hack(batch, src_fmt, src_res->surf.format);
 }
 
 /**