zink: enable srgb-mutable for dmabufs when possible

this should "just work"

...except on intel

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37873>
This commit is contained in:
Mike Blumenkrantz
2025-02-21 12:34:34 -05:00
committed by Marge Bot
parent 9d0e73335a
commit da2647f14e
3 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -1266,7 +1266,8 @@ create_image(struct zink_screen *screen, struct zink_resource_object *obj,
/* we often 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 (!(templ->bind & ZINK_BIND_MUTABLE) && (!alloc_info->whandle || alloc_info->whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE)) {
bool can_srgb = screen->driver_workarounds.srgb_dmabufs || (!alloc_info->whandle || alloc_info->whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE);
if (!(templ->bind & ZINK_BIND_MUTABLE) && can_srgb) {
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)
+2
View File
@@ -3032,6 +3032,8 @@ init_driver_workarounds(struct zink_screen *screen)
abort();
}
screen->driver_workarounds.srgb_dmabufs = zink_driverid(screen) != VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA;
/* these drivers benefit from renderpass optimization */
switch (zink_driverid(screen)) {
case VK_DRIVER_ID_MESA_LLVMPIPE:
+2
View File
@@ -1544,6 +1544,8 @@ struct zink_screen {
bool can_2d_view_sparse;
bool general_depth_layout;
bool general_layout;
/* intel driver is somehow broken for srgb-compatible dmabufs...but only in mesa CI */
bool srgb_dmabufs;
} driver_workarounds;
};