egl/dri2: if zink is preferred from dri3 skip dri2 paths.
This just avoids some error prints. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27739>
This commit is contained in:
@@ -217,6 +217,12 @@ struct dmabuf_feedback {
|
||||
};
|
||||
#endif
|
||||
|
||||
enum dri2_egl_driver_fail {
|
||||
DRI2_EGL_DRIVER_LOADED = 0,
|
||||
DRI2_EGL_DRIVER_FAILED = 1,
|
||||
DRI2_EGL_DRIVER_PREFER_ZINK = 2,
|
||||
};
|
||||
|
||||
struct dri2_egl_display {
|
||||
const struct dri2_egl_display_vtbl *vtbl;
|
||||
|
||||
|
@@ -1601,18 +1601,19 @@ static const __DRIextension *dri3_image_loader_extensions[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static EGLBoolean
|
||||
static enum dri2_egl_driver_fail
|
||||
dri2_initialize_x11_dri3(_EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_display_create();
|
||||
|
||||
enum dri2_egl_driver_fail status = DRI2_EGL_DRIVER_FAILED;
|
||||
if (!dri2_dpy)
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
|
||||
if (!dri2_get_xcb_connection(disp, dri2_dpy))
|
||||
goto cleanup;
|
||||
|
||||
if (!dri3_x11_connect(dri2_dpy))
|
||||
status = dri3_x11_connect(dri2_dpy);
|
||||
if (status != DRI2_EGL_DRIVER_LOADED)
|
||||
goto cleanup;
|
||||
|
||||
if (!dri2_load_driver_dri3(disp))
|
||||
@@ -1668,11 +1669,11 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
|
||||
|
||||
_eglLog(_EGL_INFO, "Using DRI3");
|
||||
|
||||
return EGL_TRUE;
|
||||
return DRI2_EGL_DRIVER_LOADED;
|
||||
|
||||
cleanup:
|
||||
dri2_display_destroy(disp);
|
||||
return EGL_FALSE;
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1775,16 +1776,20 @@ cleanup:
|
||||
EGLBoolean
|
||||
dri2_initialize_x11(_EGLDisplay *disp)
|
||||
{
|
||||
enum dri2_egl_driver_fail status = DRI2_EGL_DRIVER_FAILED;
|
||||
if (disp->Options.ForceSoftware || disp->Options.Zink)
|
||||
return dri2_initialize_x11_swrast(disp);
|
||||
|
||||
#ifdef HAVE_DRI3
|
||||
if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false))
|
||||
if (dri2_initialize_x11_dri3(disp))
|
||||
if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false)) {
|
||||
status = dri2_initialize_x11_dri3(disp);
|
||||
if (status == DRI2_EGL_DRIVER_LOADED)
|
||||
return EGL_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
|
||||
if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false) &&
|
||||
status != DRI2_EGL_DRIVER_PREFER_ZINK)
|
||||
if (dri2_initialize_x11_dri2(disp))
|
||||
return EGL_TRUE;
|
||||
|
||||
|
@@ -538,7 +538,7 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
|
||||
#define DRI3_SUPPORTED_MINOR 0
|
||||
#endif
|
||||
|
||||
EGLBoolean
|
||||
enum dri2_egl_driver_fail
|
||||
dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
{
|
||||
xcb_dri3_query_version_reply_t *dri3_query;
|
||||
@@ -561,15 +561,15 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
|
||||
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_dri3_id);
|
||||
if (!(extension && extension->present))
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
|
||||
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_present_id);
|
||||
if (!(extension && extension->present))
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
|
||||
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_xfixes_id);
|
||||
if (!(extension && extension->present))
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
|
||||
dri3_query_cookie = xcb_dri3_query_version(
|
||||
dri2_dpy->conn, DRI3_SUPPORTED_MAJOR, DRI3_SUPPORTED_MINOR);
|
||||
@@ -586,7 +586,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
_eglLog(_EGL_WARNING, "DRI3: failed to query the version");
|
||||
free(dri3_query);
|
||||
free(error);
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
}
|
||||
|
||||
dri2_dpy->dri3_major_version = dri3_query->major_version;
|
||||
@@ -599,7 +599,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
_eglLog(_EGL_WARNING, "DRI3: failed to query Present version");
|
||||
free(present_query);
|
||||
free(error);
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
}
|
||||
|
||||
dri2_dpy->present_major_version = present_query->major_version;
|
||||
@@ -613,7 +613,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
_eglLog(_EGL_WARNING, "DRI3: failed to query xfixes version");
|
||||
free(error);
|
||||
free(xfixes_query);
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
}
|
||||
free(xfixes_query);
|
||||
|
||||
@@ -626,7 +626,7 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
if (conn_error)
|
||||
_eglLog(_EGL_WARNING, "DRI3: Failed to initialize");
|
||||
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
}
|
||||
|
||||
loader_get_user_preferred_fd(&dri2_dpy->fd_render_gpu,
|
||||
@@ -637,13 +637,13 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
|
||||
if (!strcmp(dri2_dpy->driver_name, "zink")) {
|
||||
close(dri2_dpy->fd_render_gpu);
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_PREFER_ZINK;
|
||||
}
|
||||
|
||||
if (!dri2_dpy->driver_name) {
|
||||
_eglLog(_EGL_WARNING, "DRI3: No driver found");
|
||||
close(dri2_dpy->fd_render_gpu);
|
||||
return EGL_FALSE;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
@@ -654,5 +654,5 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
|
||||
drmGetRenderDeviceNameFromFd(dri2_dpy->fd_render_gpu);
|
||||
#endif
|
||||
|
||||
return EGL_TRUE;
|
||||
return DRI2_EGL_DRIVER_LOADED;
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ struct dri3_egl_surface {
|
||||
extern const __DRIimageLoaderExtension dri3_image_loader_extension;
|
||||
extern struct dri2_egl_display_vtbl dri3_x11_display_vtbl;
|
||||
|
||||
EGLBoolean
|
||||
enum dri2_egl_driver_fail
|
||||
dri3_x11_connect(struct dri2_egl_display *dri2_dpy);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user