zink: blow up broken xservers more reliably

only certain drivers can successfully run an xserver with implicit modifier
handling, and the rest will have broken rendering

until such time that a vk extension emerges to handle this more widely,
break this interop for drivers where it's already broken

fixes #9819

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25299>
This commit is contained in:
Mike Blumenkrantz
2023-09-19 13:00:03 -04:00
committed by Marge Bot
parent ff093f522a
commit 1c3db3e39a
3 changed files with 16 additions and 1 deletions

View File

@@ -1851,8 +1851,13 @@ zink_resource_from_handle(struct pipe_screen *pscreen,
int modifier_count = 1;
if (whandle->modifier != DRM_FORMAT_MOD_INVALID)
modifier = whandle->modifier;
else
else {
if (!zink_screen(pscreen)->driver_workarounds.can_do_invalid_linear_modifier) {
mesa_loge("zink: display server doesn't support DRI3 modifiers and driver can't handle INVALID<->LINEAR!");
return NULL;
}
whandle->modifier = modifier;
}
templ2.bind |= ZINK_BIND_DMABUF;
struct pipe_resource *pres = resource_create(pscreen, &templ2, whandle, usage, &modifier, modifier_count, NULL, NULL);
if (pres) {

View File

@@ -2872,6 +2872,15 @@ init_driver_workarounds(struct zink_screen *screen)
break;
}
/* these drivers can successfully do INVALID <-> LINEAR dri3 modifier swap */
switch (screen->info.driver_props.driverID) {
case VK_DRIVER_ID_MESA_TURNIP:
screen->driver_workarounds.can_do_invalid_linear_modifier = true;
break;
default:
break;
}
/* these drivers have no difference between unoptimized and optimized shader compilation */
switch (screen->info.driver_props.driverID) {
case VK_DRIVER_ID_MESA_LLVMPIPE:

View File

@@ -1537,6 +1537,7 @@ struct zink_screen {
bool no_hw_gl_point;
bool lower_robustImageAccess2;
bool needs_zs_shader_swizzle;
bool can_do_invalid_linear_modifier;
unsigned z16_unscaled_bias;
unsigned z24_unscaled_bias;
} driver_workarounds;