loader: Ignore NOUVEAU_USE_ZINK on Hopper+

The old Nouveau GL driver has no support for GPUs after Ada.  Instead,
users will always get NVK+Zink on Hopper+.  Right now, if the user sets
NOUVEAU_USE_ZINK=false, the loader will return "nouveau" and EGL/GLX
will try to load that, fail, and then fall back to Zink.  With this
patch, we instead print a warning message and then load Zink anyway.

Backport-to: 25.2
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36329>
(cherry picked from commit 36631a4edc)
This commit is contained in:
Faith Ekstrand 2025-07-23 14:04:21 -04:00 committed by Eric Engestrom
parent 99467bc9c2
commit 4402800d64
2 changed files with 24 additions and 3 deletions

View file

@ -2664,7 +2664,7 @@
"description": "loader: Ignore NOUVEAU_USE_ZINK on Hopper+",
"nominated": true,
"nomination_type": 4,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -145,6 +145,7 @@ nouveau_zink_predicate(int fd, const char *driver)
#else
bool prefer_zink = false;
bool require_zink = false;
/* Enable Zink by default on Turing and later GPUs
*
@ -161,14 +162,34 @@ nouveau_zink_predicate(int fd, const char *driver)
if (ret == 0 && r.value >= 0x160) {
prefer_zink = true;
}
/* Nouveau GL isn't enabled on anything after Ada */
if (ret == 0 && r.value >= 0x1a0) {
require_zink = true;
}
}
assert(!require_zink || prefer_zink);
prefer_zink = debug_get_bool_option("NOUVEAU_USE_ZINK", prefer_zink);
if (prefer_zink && !strcmp(driver, "zink"))
bool use_zink = prefer_zink;
if (require_zink) {
/* nouveau_zink_predicate() typically gets called twice but we only want
* to warn once.
*/
static bool warned = false;
if (!prefer_zink && !warned) {
log_(_LOADER_WARNING,
"NOUVEAU_USE_ZINK is ignored for Blackwell and later GPUs.\n");
warned = true;
}
use_zink = true;
}
if (use_zink && !strcmp(driver, "zink"))
return true;
if (!prefer_zink && !strcmp(driver, "nouveau"))
if (!use_zink && !strcmp(driver, "nouveau"))
return true;
return false;
#endif