loader: Don't load nouveau GL on nvidia kmd
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The vulkan driver already has a check for this. This prevents the GL
driver from loading too.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13484
Fixes: e99446fc ("egl: Add EGL_EXT_device_query_name and EGL_EXT_device_persistent_id")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36449>
This commit is contained in:
Mel Henning 2025-07-29 12:28:12 -04:00 committed by Marge Bot
parent 6a217a06d9
commit 4be68b119e
3 changed files with 25 additions and 9 deletions

View file

@ -47,6 +47,7 @@
#include <GL/gl.h>
#include "mesa_interface.h"
#include "loader.h"
#include "util/drm_is_nouveau.h"
#include "util/libdrm.h"
#include "util/os_file.h"
#include "util/os_misc.h"
@ -138,6 +139,10 @@ iris_predicate(int fd, const char *driver)
bool
nouveau_zink_predicate(int fd, const char *driver)
{
/* Never load on nv proprietary driver */
if (!drm_fd_is_nouveau(fd))
return false;
#if !defined(HAVE_NVK) || !defined(HAVE_ZINK)
if (!strcmp(driver, "zink"))
return false;

View file

@ -7,6 +7,7 @@
#include "nouveau_device.h"
#include "util/os_misc.h"
#include "util/drm_is_nouveau.h"
#include "vk_log.h"
#include <fcntl.h>
@ -21,15 +22,7 @@ drm_device_is_nouveau(const char *path)
if (fd < 0)
return false;
drmVersionPtr ver = drmGetVersion(fd);
if (!ver) {
close(fd);
return false;
}
const bool is_nouveau = !strncmp("nouveau", ver->name, ver->name_len);
drmFreeVersion(ver);
const bool is_nouveau = drm_fd_is_nouveau(fd);
close(fd);
return is_nouveau;

18
src/util/drm_is_nouveau.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef DRM_IS_NOUVEAU
#define DRM_IS_NOUVEAU
#include "util/libdrm.h"
static inline bool
drm_fd_is_nouveau(int fd)
{
drmVersionPtr ver = drmGetVersion(fd);
if (!ver) {
return false;
}
const bool is_nouveau = !strncmp("nouveau", ver->name, ver->name_len);
drmFreeVersion(ver);
return is_nouveau;
}
#endif