Backport NVIDIA graphics card display name fixes
Resolves: RHEL-111572
This commit is contained in:
parent
501a06cea2
commit
c6ea33b9cd
@ -14,7 +14,7 @@
|
||||
|
||||
Name: gnome-control-center
|
||||
Version: 40.0
|
||||
Release: 45%{?dist}
|
||||
Release: 46%{?dist}
|
||||
Summary: Utilities to configure the GNOME desktop
|
||||
|
||||
License: GPLv2+ and CC-BY-SA
|
||||
@ -92,6 +92,9 @@ Patch27: 0001-calibrator-Avoid-clearing-background.patch
|
||||
# https://issues.redhat.com/browse/RHEL-135180
|
||||
Patch28: region-set-system-wide-locale-from-user.patch
|
||||
|
||||
# https://redhat.atlassian.net/browse/RHEL-111572
|
||||
Patch29: info-overview-backport-nvidia-card-name-fixes.patch
|
||||
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: cups-devel
|
||||
BuildRequires: desktop-file-utils
|
||||
@ -281,6 +284,10 @@ chrpath --delete $RPM_BUILD_ROOT%{_bindir}/gnome-control-center
|
||||
%dir %{_datadir}/gnome/wm-properties
|
||||
|
||||
%changelog
|
||||
* Tue Apr 14 2026 Felipe Borges <feborges@redhat.com> - 40.0-46
|
||||
- Backport NVIDIA graphics card display name fixes
|
||||
Resolves: RHEL-111572
|
||||
|
||||
* Tue Feb 10 2026 Felipe Borges <feborges@redhat.com> - 40.0-45
|
||||
- Fix system locale not getting set from within user settings
|
||||
Resolves: RHEL-135180
|
||||
|
||||
125
info-overview-backport-nvidia-card-name-fixes.patch
Normal file
125
info-overview-backport-nvidia-card-name-fixes.patch
Normal file
@ -0,0 +1,125 @@
|
||||
From 7f8ee8ea0ca441ea4c280d48ef8e015daca44bbf Mon Sep 17 00:00:00 2001
|
||||
From: Felipe Borges <felipeborges@gnome.org>
|
||||
Date: Tue, 14 Apr 2026 11:23:47 +0200
|
||||
Subject: [PATCH] info-overview: Backport NVIDIA GPU name fixes for
|
||||
print-renderer
|
||||
|
||||
When SwitcherooControl runs the print-renderer helper with DRI_PRIME, the
|
||||
NVIDIA proprietary GL stack may not honor that selection; the helper can
|
||||
then report a bogus GL_RENDERER and About falls back to a generic udev
|
||||
name (e.g. "NVIDIA Corporation").
|
||||
|
||||
gnome-control-center-print-renderer (after querying GL_RENDERER), checks
|
||||
GL_VERSION for NVIDIA and invalidates the result when DRI_PRIME is set
|
||||
but __GLX_VENDOR_LIBRARY_NAME is not "nvidia", so we fall back to
|
||||
Switcheroo's device Name instead of a wrong renderer string.
|
||||
|
||||
When spawning the helper, we should pass DISPLAY, WAYLAND_DISPLAY, and
|
||||
XDG_RUNTIME_DIR from the running process instead of relying on full
|
||||
inherited environment in all cases.
|
||||
|
||||
Upstream:
|
||||
- 098adb5a75c78177d2958eb47e30c889eb613470 ("about: fix multiple GPU name
|
||||
display with NVIDIA GPU on Desktop PC", #3375)
|
||||
- 82bd9c71931cea251f06835b5d9bec7164468788 ("about: fix NVIDIA GPU name
|
||||
display if get_renderer_from_switcheroo failed", #3474)
|
||||
- 2b111f062e27137db59af698d37f2f02645b2fe2 ("system-details-window:
|
||||
Don't inherit env vars from parent")
|
||||
|
||||
Adapted for GTK3 (gdk_window_create_gl_context).
|
||||
|
||||
https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/3375
|
||||
https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/3474
|
||||
|
||||
Resolves: RHEL-111572
|
||||
---
|
||||
panels/info-overview/cc-info-overview-panel.c | 12 +++++++--
|
||||
.../gnome-control-center-print-renderer.c | 26 +++++++++++++++++++
|
||||
2 files changed, 36 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
|
||||
index 8c5f92e64..ff9f64c15 100644
|
||||
--- a/panels/info-overview/cc-info-overview-panel.c
|
||||
+++ b/panels/info-overview/cc-info-overview-panel.c
|
||||
@@ -258,14 +258,22 @@ get_renderer_from_helper (const char **env)
|
||||
g_auto(GStrv) envp = NULL;
|
||||
g_autofree char *renderer = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
+ /* Environment variables that are needed to run the helper on X11 and Wayland */
|
||||
+ static const char *env_vars[] = { "DISPLAY", "WAYLAND_DISPLAY", "XDG_RUNTIME_DIR" };
|
||||
+ guint i;
|
||||
+
|
||||
+ for (i = 0; i < G_N_ELEMENTS (env_vars); i++)
|
||||
+ {
|
||||
+ const char *value = g_getenv (env_vars[i]);
|
||||
+ if (value)
|
||||
+ envp = g_environ_setenv (envp, env_vars[i], value, TRUE);
|
||||
+ }
|
||||
|
||||
g_debug ("About to launch '%s'", argv[0]);
|
||||
|
||||
if (env != NULL)
|
||||
{
|
||||
- guint i;
|
||||
g_debug ("With environment:");
|
||||
- envp = g_get_environ ();
|
||||
for (i = 0; env != NULL && env[i] != NULL; i = i + 2)
|
||||
{
|
||||
g_debug (" %s = %s", env[i], env[i+1]);
|
||||
diff --git a/panels/info-overview/gnome-control-center-print-renderer.c b/panels/info-overview/gnome-control-center-print-renderer.c
|
||||
index 3e83703c3..141601b46 100644
|
||||
--- a/panels/info-overview/gnome-control-center-print-renderer.c
|
||||
+++ b/panels/info-overview/gnome-control-center-print-renderer.c
|
||||
@@ -22,6 +22,8 @@
|
||||
* Matthias Clasen <mclasen@redhat.com>
|
||||
*/
|
||||
|
||||
+#include <string.h>
|
||||
+
|
||||
#include <gtk/gtk.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
@@ -31,6 +33,7 @@ get_gtk_gles_renderer (void)
|
||||
GtkWidget *win;
|
||||
GdkGLContext *context;
|
||||
char *renderer = NULL;
|
||||
+ g_autofree char *gl_version = NULL;
|
||||
|
||||
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_realize (win);
|
||||
@@ -39,9 +42,32 @@ get_gtk_gles_renderer (void)
|
||||
return NULL;
|
||||
gdk_gl_context_make_current (context);
|
||||
renderer = g_strdup ((char *) glGetString (GL_RENDERER));
|
||||
+ gl_version = g_strdup ((char *) glGetString (GL_VERSION));
|
||||
gdk_gl_context_clear_current ();
|
||||
g_object_unref (context);
|
||||
|
||||
+ if (gl_version && strstr (gl_version, "NVIDIA") != NULL)
|
||||
+ {
|
||||
+ const char *glvnd_libname = g_getenv ("__GLX_VENDOR_LIBRARY_NAME");
|
||||
+ const char *dri_prime = g_getenv ("DRI_PRIME");
|
||||
+ if (g_strcmp0 (glvnd_libname, "nvidia") != 0 && dri_prime != NULL)
|
||||
+ {
|
||||
+ /* This helper is launched with parameters from a
|
||||
+ * non-NVIDIA GPU, but is running using a NVIDIA
|
||||
+ * library. As such, DRI_PRIME envvar from switcheroo
|
||||
+ * does not actually take effect, and the GPU name is
|
||||
+ * invalid.
|
||||
+ *
|
||||
+ * If there is no DRI_PRIME envvar neither, assuming
|
||||
+ * we failed to use switcheroo to get GPU names, and
|
||||
+ * this is called with basic envvars listed in
|
||||
+ * cc-info-overview-panel.c:get_renderer_from_helper()
|
||||
+ */
|
||||
+ g_free (renderer);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return renderer;
|
||||
}
|
||||
|
||||
--
|
||||
2.52.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user