mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-08 04:16:22 +00:00
glamor/glamor_egl: Set gl vendor to "nvidia" by default for nvidia cards
Also pick an `EGLDeviceEXT` suitable for nvidia's gl library. For nvidia 470 and below, there isn't an official gbm backend. If the dumb backend is used, we can't initialze on the gbm platform. If the mesa backend is used, we can initialize on the gbm platform, but if we do, we risk EGL internally picking the wrong `EGLDeviceEXT` See: https://github.com/X11Libre/xserver/pull/2847 Signed-off-by: stefan11111 <stefan11111github@gmail.com>
This commit is contained in:
parent
c26aa9e5fa
commit
d482f4482b
1 changed files with 34 additions and 0 deletions
|
|
@ -1597,6 +1597,24 @@ glamor_egl_set_glvnd_vendor(ScreenPtr screen)
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we're on nvidia and the user didn't request a particular gl vendor, set it to nvidia.
|
||||
* See: https://github.com/X11Libre/xserver/pull/2847
|
||||
*/
|
||||
#ifdef WITH_LIBDRM
|
||||
if (glamor_egl->fd >= 0) {
|
||||
drmVersionPtr version = drmGetVersion(glamor_egl->fd);
|
||||
if (version) {
|
||||
if (version->name && !strcmp(version->name, "nvidia-drm")) {
|
||||
drmFreeVersion(version);
|
||||
glamor_set_glvnd_vendor(screen, "nvidia");
|
||||
return;
|
||||
}
|
||||
drmFreeVersion(version);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (glamor_egl->gbm) {
|
||||
const char *gbm_backend_name;
|
||||
|
|
@ -2218,6 +2236,22 @@ glamor_egl_init_display(glamor_egl_priv_t *glamor_egl, int *dri_fd, int *out_pla
|
|||
#define EGL_PLATFORM_GBM_KHR 0x31D7
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If we're on nvidia and the user didn't request a particular gl vendor, set it to nvidia.
|
||||
* See: https://github.com/X11Libre/xserver/pull/2847
|
||||
*/
|
||||
#ifdef WITH_LIBDRM
|
||||
if (!glamor_egl->glvnd_vendor && (glamor_egl->fd >= 0)) {
|
||||
drmVersionPtr version = drmGetVersion(glamor_egl->fd);
|
||||
if (version) {
|
||||
if (version->name && !strcmp(version->name, "nvidia-drm")) {
|
||||
glamor_egl->glvnd_vendor = strdup("nvidia");
|
||||
}
|
||||
drmFreeVersion(version);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If the user didn't give us a GL driver/library name,
|
||||
* we populate it with what we queried
|
||||
|
|
|
|||
Loading…
Reference in a new issue