Blob Blame History Raw
From 4c01758cbe7db02d84ac0cba0c626e855bf927d6 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Thu, 20 May 2021 12:11:42 +0200
Subject: [PATCH xserver 23/27] xwayland: Add preferred GLVND vendor to
 xwl_screen
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If Xwayland's EGLstream backend supports hardware acceleration with the
NVIDIA closed-source driver, the GLX library also needs to be one
shipped by NVIDIA, that's what GLVND is for.

Add a new member to the xwl_screen that the backend can optionally set
to the preferred GLVND vendor to use.

If not set, "mesa" is assumed.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
(cherry picked from commit 24fc8aea1e4bbaba780f1a316fba797a0198f603)
---
 hw/xwayland/xwayland-glx.c    | 3 +++
 hw/xwayland/xwayland-screen.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/hw/xwayland/xwayland-glx.c b/hw/xwayland/xwayland-glx.c
index 7e2a87fc1..eba8946ab 100644
--- a/hw/xwayland/xwayland-glx.c
+++ b/hw/xwayland/xwayland-glx.c
@@ -378,6 +378,9 @@ egl_screen_probe(ScreenPtr pScreen)
         return NULL;
     }
 
+    if (!screen->base.glvnd && xwl_screen->glvnd_vendor)
+        screen->base.glvnd = strdup(xwl_screen->glvnd_vendor);
+
     if (!screen->base.glvnd)
         screen->base.glvnd = strdup("mesa");
 
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
index 5fe4712bd..b965dddd7 100644
--- a/hw/xwayland/xwayland-screen.h
+++ b/hw/xwayland/xwayland-screen.h
@@ -107,6 +107,9 @@ struct xwl_screen {
     struct glamor_context *glamor_ctx;
 
     Atom allow_commits_prop;
+
+    /* The preferred GLVND vendor. If NULL, "mesa" is assumed. */
+    const char *glvnd_vendor;
 };
 
 /* Apps which use randr/vidmode to change the mode when going fullscreen,
-- 
2.31.1