From 5e00b2d8a7ed4706c7e4dec59d517a2a2401f525 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 27 Jul 2022 15:13:06 -0400 Subject: [PATCH] zink: use modifier feature flags during surface creation when necessary cc: mesa-stable Acked-by: Emma Anholt Part-of: (cherry picked from commit 22eff86eafd5766e7b1de4c24f1b110d652e718b) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_surface.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 998ce4e6f5d..4c9b6fa695d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -787,7 +787,7 @@ "description": "zink: use modifier feature flags during surface creation when necessary", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c index 15a3e8ec9a6..97902a9eb84 100644 --- a/src/gallium/drivers/zink/zink_surface.c +++ b/src/gallium/drivers/zink/zink_surface.c @@ -147,6 +147,14 @@ create_surface(struct pipe_context *pctx, screen->format_props[templ->format].linearTilingFeatures; VkImageUsageFlags attachment = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); usage_info.usage = res->obj->vkusage & ~attachment; + if (res->obj->modifier_aspect) { + feats = res->obj->vkfeats; + /* intersect format features for current modifier */ + for (unsigned i = 0; i < screen->modifier_props[templ->format].drmFormatModifierCount; i++) { + if (res->obj->modifier == screen->modifier_props[templ->format].pDrmFormatModifierProperties[i].drmFormatModifier) + feats &= screen->modifier_props[templ->format].pDrmFormatModifierProperties[i].drmFormatModifierTilingFeatures; + } + } if ((res->obj->vkusage & attachment) && !(feats & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) { ivci->pNext = &usage_info;