Mesa (main): zink: NV_linear_color_attachment

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 00:26:27 UTC 2022


Module: Mesa
Branch: main
Commit: 7af76d1aaec345dfb934ffd0c184f455f190bcf0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7af76d1aaec345dfb934ffd0c184f455f190bcf0

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Apr 18 16:58:47 2022 -0400

zink: NV_linear_color_attachment

this fixes staging blits on nvidia

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16016>

---

 src/gallium/drivers/zink/zink_device_info.py | 3 +++
 src/gallium/drivers/zink/zink_screen.c       | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_device_info.py b/src/gallium/drivers/zink/zink_device_info.py
index e0a88984fb4..ae101b89d35 100644
--- a/src/gallium/drivers/zink/zink_device_info.py
+++ b/src/gallium/drivers/zink/zink_device_info.py
@@ -144,6 +144,9 @@ EXTENSIONS = [
         features=True,
         conditions=["$feats.vertexAttributeInstanceRateDivisor"]),
     Extension("VK_EXT_calibrated_timestamps"),
+    Extension("VK_NV_linear_color_attachment",
+              alias="linear_color",
+              features=True),
     Extension("VK_KHR_shader_clock",
        alias="shader_clock",
        features=True,
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 366a9a586e8..a0e03f8b645 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1661,8 +1661,14 @@ populate_format_props(struct zink_screen *screen)
             mod_props.pDrmFormatModifierProperties = mods;
             props.pNext = &mod_props;
          }
+         VkFormatProperties3 props3 = {0};
+         props3.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3;
+         props3.pNext = props.pNext;
+         props.pNext = &props3;
          VKSCR(GetPhysicalDeviceFormatProperties2)(screen->pdev, format, &props);
          screen->format_props[i] = props.formatProperties;
+         if (props3.linearTilingFeatures & VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV)
+            screen->format_props[i].linearTilingFeatures |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
          if (screen->info.have_EXT_image_drm_format_modifier && mod_props.drmFormatModifierCount) {
             screen->modifier_props[i].drmFormatModifierCount = mod_props.drmFormatModifierCount;
             screen->modifier_props[i].pDrmFormatModifierProperties = ralloc_array(screen, VkDrmFormatModifierPropertiesEXT, mod_props.drmFormatModifierCount);



More information about the mesa-commit mailing list