dri2: Fix exposing robustness with swkms.

In the original change I noticed that missing robustness on swkms seemed
to be an oversight, since it was enabled on sw-non-kms, so I exposed the
ext based on the underlying pipe query.  However it turns out that there
is a dri_screen flag for allowing robust contexts that exists to do error
checking for GLX, which was under an !swkms check.  So we would expose the
ext, but then throw an error if you tried to create one.

Fixes: e6285ea55f ("egl: Replace the robustness DRI2 ext check with a pipe cap query.")
Closes: #8066
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20679>
This commit is contained in:
Emma Anholt 2023-01-12 10:43:06 -08:00 committed by Marge Bot
parent ca8c8f2fc1
commit 6b0db6bf8b
2 changed files with 9 additions and 4 deletions

View file

@ -2246,11 +2246,11 @@ dri2_init_screen_extensions(struct dri_screen *screen,
screen->buffer_damage_extension.set_damage_region =
dri2_set_damage_region;
*nExt++ = &screen->buffer_damage_extension.base;
}
if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) {
*nExt++ = &dri2Robustness.base;
screen->has_reset_status_query = true;
}
if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) {
*nExt++ = &dri2Robustness.base;
screen->has_reset_status_query = true;
}
/* Ensure the extension list didn't overrun its buffer and is still

View file

@ -63,6 +63,11 @@ dri_create_context(struct dri_screen *screen,
screen->dri2.backgroundCallable;
const struct driOptionCache *optionCache = &screen->dev->option_cache;
/* This is effectively doing error checking for GLX context creation (by both
* Mesa and the X server) when the driver doesn't support the robustness ext.
* EGL already checks, so it won't send us the flags if the ext isn't
* available.
*/
if (screen->has_reset_status_query) {
allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
allowed_attribs |= __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;