[Mesa-dev] [PATCH v2] anv/formats: handle correctly multisamples in gen7

Juan A. Suarez Romero jasuarez at igalia.com
Thu Feb 16 12:51:10 UTC 2017


According to Ivybridge PRM, Volume 4 Part 1 p73, signed integer formats
cannot be multisampled.

Also in the same PRM p63, any format with greater than 64 bits per
element cannot be multisampled.

This fixes the following Vulkan CTS tests in Haswell:

dEQP-VK.memory.requirements.image.regular_tiling_optimal
dEQP-VK.memory.requirements.image.transient_tiling_optimal

It also fixes crashes in the following Vulkan CTS tests in Haswell (becoming now
skip):

dEQP-VK.glsl.texture_functions.query.texturesamples.isampler2dms_fragment
dEQP-VK.glsl.texture_functions.query.texturesamples.isampler2dms_vertex
dEQP-VK.glsl.texture_functions.query.texturesamples.isampler2dmsarray_fragment
dEQP-VK.glsl.texture_functions.query.texturesamples.isampler2dmsarray_vertex
dEQP-VK.pipeline.multisample.sampled_image.64x64_1.r16g16_sint.samples_4
dEQP-VK.pipeline.multisample.sampled_image.64x64_1.r16g16_sint.samples_8
dEQP-VK.pipeline.multisample.sampled_image.64x64_1.r32g32b32a32_sfloat.samples_4
dEQP-VK.pipeline.multisample.sampled_image.64x64_1.r32g32b32a32_sfloat.samples_8
dEQP-VK.pipeline.multisample.sampled_image.64x64_4.r16g16_sint.samples_4
dEQP-VK.pipeline.multisample.sampled_image.64x64_4.r16g16_sint.samples_8
dEQP-VK.pipeline.multisample.sampled_image.64x64_4.r32g32b32a32_sfloat.samples_4
dEQP-VK.pipeline.multisample.sampled_image.64x64_4.r32g32b32a32_sfloat.samples_8
dEQP-VK.pipeline.multisample.sampled_image.79x31_1.r16g16_sint.samples_4
dEQP-VK.pipeline.multisample.sampled_image.79x31_1.r16g16_sint.samples_8
dEQP-VK.pipeline.multisample.sampled_image.79x31_1.r32g32b32a32_sfloat.samples_4
dEQP-VK.pipeline.multisample.sampled_image.79x31_1.r32g32b32a32_sfloat.samples_8
dEQP-VK.pipeline.multisample.sampled_image.79x31_4.r16g16_sint.samples_4
dEQP-VK.pipeline.multisample.sampled_image.79x31_4.r16g16_sint.samples_8
dEQP-VK.pipeline.multisample.sampled_image.79x31_4.r32g32b32a32_sfloat.samples_4
dEQP-VK.pipeline.multisample.sampled_image.79x31_4.r32g32b32a32_sfloat.samples_8

v2:
- Vulkan spec says framebufferColorSampleCounts and
  sampledImageColorSampleCounts must support 1x and 4x multisampling
  (Jason)
- Add SINT restriction in isl_format_supports_multisampling() (Jason)

Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
---
 src/intel/isl/isl_format.c     | 22 +++++++++++++++++++++-
 src/intel/vulkan/anv_formats.c |  4 +++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index 0452bf8..6fa30a7 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -526,16 +526,36 @@ isl_format_supports_multisampling(const struct gen_device_info *devinfo,
     *       - any compressed texture format (BC*)
     *       - any YCRCB* format
     *
+    * These restrictions also apply on Ivybridge.
+    *
     * 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.
+    *
+    * From the Ivybridge PRM, Volume 4 Part 1 p73, SURFACE_STATE, Number of
+    * Multisamples:
+    *
+    *    - This field must be set to MULTISAMPLECOUNT_1 for SINT MSRTs when
+    *      all RT channels are not written.
+    *
+    * And errata from the Ivybridge PRM, Volume 4 Part 1 p77,
+    * RENDER_SURFACE_STATE, MCS Enable:
+    *
+    *   This field must be set to 0 [MULTISAMPLECOUNT_1] for all SINT MSRTs
+    *   when all RT channels are not written.
+    *
+    * Note that the above SINT restrictions apply only to *MSRTs* (that is,
+    * *multisampled* render targets). The restrictions seem to permit an MCS
+    * if the render target is singlesampled.
     */
    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 < 8 &&
+              (isl_format_get_layout(format)->bpb > 64 ||
+               isl_format_has_sint_channel(format))) {
       return false;
    } else if (isl_format_is_compressed(format)) {
       return false;
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 6005791..88f5e02 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -552,7 +552,9 @@ anv_get_image_format_properties(
        goto unsupported;
    }
 
-   if (info->tiling == VK_IMAGE_TILING_OPTIMAL &&
+   if (isl_format_supports_multisampling(&physical_device->info,
+                                         anv_formats[info->format].isl_format) &&
+       info->tiling == VK_IMAGE_TILING_OPTIMAL &&
        info->type == VK_IMAGE_TYPE_2D &&
        (format_feature_flags & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
                                 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) &&
-- 
2.9.3



More information about the mesa-dev mailing list