From cd00a36d479ba0bda2a86f7d822c0dc4f93bcbb0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 31 Aug 2022 20:16:35 -0400 Subject: [PATCH] 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 Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_resource.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 588b17f2f31..715af98a70b 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -665,7 +665,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)