intel: Split gen_device_info out into libintel_dev
[mesa.git] / src / intel / isl / isl_format.c
index 31c74bd5f0fd52b038064b9b3ff938041624b91d..a5bbdbceb1a7dff84936007c62e740e8a230bc28 100644 (file)
@@ -24,7 +24,7 @@
 #include <assert.h>
 
 #include "isl.h"
-#include "common/gen_device_info.h"
+#include "dev/gen_device_info.h"
 
 struct surface_format_info {
    bool exists;
@@ -406,7 +406,7 @@ isl_format_supports_sampling(const struct gen_device_info *devinfo,
        */
       if (fmtl->txc == ISL_TXC_ASTC)
          return format < ISL_FORMAT_ASTC_HDR_2D_4X4_FLT16;
-   } else if (devinfo->is_broxton) {
+   } else if (gen_device_info_is_9lp(devinfo)) {
       const struct isl_format_layout *fmtl = isl_format_get_layout(format);
       /* Support for ASTC HDR exists on Broxton even though big-core
        * GPUs didn't get it until Cannonlake.
@@ -439,7 +439,7 @@ isl_format_supports_filtering(const struct gen_device_info *devinfo,
        */
       if (fmtl->txc == ISL_TXC_ASTC)
          return format < ISL_FORMAT_ASTC_HDR_2D_4X4_FLT16;
-   } else if (devinfo->is_broxton) {
+   } else if (gen_device_info_is_9lp(devinfo)) {
       const struct isl_format_layout *fmtl = isl_format_get_layout(format);
       /* Support for ASTC HDR exists on Broxton even though big-core
        * GPUs didn't get it until Cannonlake.
@@ -536,6 +536,30 @@ isl_format_supports_ccs_e(const struct gen_device_info *devinfo,
    if (!format_info[format].exists)
       return false;
 
+   /* For simplicity, only report that a format supports CCS_E if blorp can
+    * perform bit-for-bit copies with an image of that format while compressed.
+    * This allows ISL users to avoid having to resolve the image before
+    * performing such a copy. We may want to change this behavior in the
+    * future.
+    *
+    * R11G11B10_FLOAT has no equivalent UINT format. Given how blorp_copy
+    * currently works, bit-for-bit copy operations are not possible without an
+    * intermediate resolve.
+    */
+   if (format == ISL_FORMAT_R11G11B10_FLOAT)
+      return false;
+
+   /* blorp_copy currently doesn't support formats with different bit-widths
+    * per-channel. Until that support is added, report that these formats don't
+    * support CCS_E. FIXME: Add support for these formats.
+    */
+   if (format == ISL_FORMAT_B10G10R10A2_UNORM ||
+       format == ISL_FORMAT_B10G10R10A2_UNORM_SRGB ||
+       format == ISL_FORMAT_R10G10B10A2_UNORM ||
+       format == ISL_FORMAT_R10G10B10A2_UINT) {
+      return false;
+   }
+
    return format_gen(devinfo) >= format_info[format].ccs_e;
 }
 
@@ -554,16 +578,19 @@ isl_format_supports_multisampling(const struct gen_device_info *devinfo,
     *       - any compressed texture format (BC*)
     *       - any YCRCB* format
     *
-    * The restriction on the format's size is removed on Broadwell.  Also,
-    * there is an exception for HiZ which we treat as a compressed format and
-    * is allowed to be multisampled on Broadwell and earlier.
+    * The restriction on the format's size is removed on Broadwell. Moreover,
+    * empirically it looks that even IvyBridge can handle multisampled surfaces
+    * with format sizes all the way to 128-bits (RGBA32F, RGBA32I, RGBA32UI).
+    *
+    * Also, there is an exception for HiZ which we treat as a compressed
+    * format and is allowed to be multisampled on Broadwell and earlier.
     */
    if (format == ISL_FORMAT_HIZ) {
       /* On SKL+, HiZ is always single-sampled even when the primary surface
        * is multisampled.  See also isl_surf_get_hiz_surf().
        */
       return devinfo->gen <= 8;
-   } else if (devinfo->gen < 8 && isl_format_get_layout(format)->bpb > 64) {
+   } else if (devinfo->gen < 7 && isl_format_get_layout(format)->bpb > 64) {
       return false;
    } else if (isl_format_is_compressed(format)) {
       return false;
@@ -605,7 +632,7 @@ isl_formats_are_ccs_e_compatible(const struct gen_device_info *devinfo,
           fmtl1->channels.a.bits == fmtl2->channels.a.bits;
 }
 
-static inline bool
+static bool
 isl_format_has_channel_type(enum isl_format fmt, enum isl_base_type type)
 {
    const struct isl_format_layout *fmtl = isl_format_get_layout(fmt);