iris: handle the failure of converting unsupported yuv formats to isl
authorJames Xiong <james.xiong@intel.com>
Wed, 20 Nov 2019 23:59:00 +0000 (15:59 -0800)
committerMarge Bot <eric+marge@anholt.net>
Thu, 6 Feb 2020 00:43:58 +0000 (00:43 +0000)
Signed-off-by: James Xiong <james.xiong@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3527>

src/gallium/drivers/iris/iris_formats.c
src/gallium/drivers/iris/iris_resource.c

index e8e813187c1d16d0f3502fdaf6a3a9ee6ae7fca6..dc497c161bd96b898bd315980a13cb063762a647 100644 (file)
@@ -40,9 +40,13 @@ iris_format_for_usage(const struct gen_device_info *devinfo,
                       isl_surf_usage_flags_t usage)
 {
    enum isl_format format = isl_format_for_pipe_format(pformat);
-   const struct isl_format_layout *fmtl = isl_format_get_layout(format);
    struct isl_swizzle swizzle = ISL_SWIZZLE_IDENTITY;
 
+   if (format == ISL_FORMAT_UNSUPPORTED)
+      return (struct iris_format_info) { .fmt = format, .swizzle = swizzle };
+
+   const struct isl_format_layout *fmtl = isl_format_get_layout(format);
+
    if (!util_format_is_srgb(pformat)) {
       if (util_format_is_intensity(pformat)) {
          swizzle = ISL_SWIZZLE(RED, RED, RED, RED);
index bdd715df2c968666649482eb09d8081619cbe93f..7ca6097840af2c6cacecf82f34e6a6437346fd98 100644 (file)
@@ -85,7 +85,8 @@ modifier_is_supported(const struct gen_device_info *devinfo,
 
       enum isl_format linear_format = isl_format_srgb_to_linear(rt_format);
 
-      if (!isl_format_supports_ccs_e(devinfo, linear_format))
+      if (linear_format == ISL_FORMAT_UNSUPPORTED ||
+          !isl_format_supports_ccs_e(devinfo, linear_format))
          return false;
 
       return devinfo->gen >= 9 && devinfo->gen <= 11;