From 4402800d64aa2da8799960925557bef4a3aae10f Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Wed, 23 Jul 2025 14:04:21 -0400 Subject: [PATCH] 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 Part-of: (cherry picked from commit 36631a4edc363f3411e511c96eaf63944a8bc75b) --- .pick_status.json | 2 +- src/loader/loader.c | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 03e1b3d798a..e818e702d74 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/loader/loader.c b/src/loader/loader.c index 02734d7d2f9..5b5c8b196a7 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -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