[Mesa-dev] [PATCH 30/30] i965: Enable non-CCS_E fast-clears on gen9+

Jason Ekstrand jason at jlekstrand.net
Fri May 26 23:30:34 UTC 2017


Sky Lake and above can fast-clear exactly the same set of formats as
older hardware.  The only restriction is that you can't *texture* from
it unless the format supports CCS_E but you can fast-clear and render to
it just fine.  All of the code exists and now that we have sane resolves,
we can trivially turn it on.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 4e3736f..52eb11d 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -206,12 +206,7 @@ intel_miptree_supports_non_msrt_fast_clear(struct brw_context *brw,
    if (!brw->format_supported_as_render_target[mt->format])
       return false;
 
-   if (brw->gen >= 9) {
-      mesa_format linear_format = _mesa_get_srgb_format_linear(mt->format);
-      const uint32_t brw_format = brw_isl_format_for_mesa_format(linear_format);
-      return isl_format_supports_ccs_e(&brw->screen->devinfo, brw_format);
-   } else
-      return true;
+   return true;
 }
 
 /* On Gen9 support for color buffer compression was extended to single
@@ -255,16 +250,12 @@ intel_miptree_supports_lossless_compressed(struct brw_context *brw,
    if (_mesa_get_format_datatype(mt->format) == GL_FLOAT)
       return false;
 
-   /* Fast clear mechanism and lossless compression go hand in hand. */
+   /* Fast clear support is a pre-requisite for lossless compression */
    if (!intel_miptree_supports_non_msrt_fast_clear(brw, mt))
       return false;
 
-   /* Fast clear can be also used to clear srgb surfaces by using equivalent
-    * linear format. This trick, however, can't be extended to be used with
-    * lossless compression and therefore a check is needed to see if the format
-    * really is linear.
-    */
-   return _mesa_get_srgb_format_linear(mt->format) == mt->format;
+   enum isl_format isl_format = brw_isl_format_for_mesa_format(mt->format);
+   return isl_format_supports_ccs_e(&brw->screen->devinfo, isl_format);
 }
 
 /**
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list