Module: Mesa Branch: staging/22.2 Commit: c3cccad4415d63de5ca9ead5973716f61d44ce22 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3cccad4415d63de5ca9ead5973716f61d44ce22
Author: Mike Blumenkrantz <[email protected]> Date: Wed Aug 31 20:16:35 2022 -0400 zink: only add srgb mutable for images with modifiers these are supposed to be for dmabuf handling, so checking for mutable swapchain is both pointless and wrong Fixes: 28ee911ad67 ("zink: handle mutable swapchain images with dmabuf") Reviewed-by: Emma Anholt <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18358> (cherry picked from commit cd00a36d479ba0bda2a86f7d822c0dc4f93bcbb0) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_resource.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index cc68b724875..d4cbbdfa5fb 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6160,7 +6160,7 @@ "description": "zink: only add srgb mutable for images with modifiers", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "28ee911ad67192bc7a0683b6061b89e372482faf" }, diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index a1b4c9089a6..945f69ed108 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -657,7 +657,11 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t bool success = false; VkImageCreateInfo ici; enum pipe_format srgb = PIPE_FORMAT_NONE; - if (screen->info.have_KHR_swapchain_mutable_format) { + /* We use modifiers as a proxy for "this surface is used as a window system render target". + * For winsys, we need to be able to mutate between srgb and linear, but we don't need general + * image view/shader image format compatibility (that path means losing fast clears or compression on some hardware). + */ + if (ici_modifier_count) { srgb = util_format_is_srgb(templ->format) ? util_format_linear(templ->format) : util_format_srgb(templ->format); /* why do these helpers have different default return values? */ if (srgb == templ->format)
