]> source.dussan.org Git - tigervnc.git/commitdiff
Add option to specify used DRI3 render node
authorPierre Ossman <ossman@cendio.se>
Thu, 6 Jun 2024 12:24:41 +0000 (14:24 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 20 Jun 2024 12:41:48 +0000 (14:41 +0200)
Allows users to use a secondary GPU, or to disable DRI3 in case of
issues.

unix/xserver/hw/vnc/Xvnc.man
unix/xserver/hw/vnc/vncDRI3.c
unix/xserver/hw/vnc/vncDRI3.h
unix/xserver/hw/vnc/xvnc.c

index 075141faa3de10d37863cd6b39d70f618e5bab35..05d34e815c455c75e3aa7a22ac597667fca5b9e9 100644 (file)
@@ -46,6 +46,11 @@ Specify pixel format for server to use (BGRnnn or RGBnnn). The default for
 depth 16 is RGB565 and for depth 24 and 32 is RGB888.
 .
 .TP
+.B \-rendernode \fIpath\fP
+DRM render node to use for DRI3 GPU acceleration. Specify an empty path to
+disable DRI3. Default is /dev/dri/renderD128.
+.
+.TP
 .B \-interface \fIIP address\fP
 Listen on interface. By default Xvnc listens on all available interfaces.
 .
index 3d261667a2c423fc760f6321cfe73cb37cf95474..1e643ece560ff2cf5a2589c00e6e31d07f527cc3 100644 (file)
@@ -37,6 +37,8 @@
 #error "This code is not compatible with accessors"
 #endif
 
+const char *renderNode = "/dev/dri/renderD128";
+
 static DevPrivateKeyRec vncDRI3ScreenPrivateKey;
 static DevPrivateKeyRec vncDRI3PixmapPrivateKey;
 
@@ -452,6 +454,15 @@ Bool vncDRI3Init(ScreenPtr screen)
     return FALSE;
 #endif
 
+  /* Empty render node is interpreted as disabling DRI3 */
+  if (renderNode[0] == '\0')
+    return TRUE;
+
+  if (renderNode[0] != '/') {
+    ErrorF("Invalid render node path \"%s\"\n", renderNode);
+    return FALSE;
+  }
+
   if (!dixRegisterPrivateKey(&vncDRI3ScreenPrivateKey, PRIVATE_SCREEN,
                              sizeof(vncDRI3ScreenPrivateRec)))
     return FALSE;
@@ -465,7 +476,7 @@ Bool vncDRI3Init(ScreenPtr screen)
 #ifdef HAVE_GBM
   screenPriv = vncDRI3ScreenPrivate(screen);
 
-  screenPriv->devicePath = "/dev/dri/renderD128";
+  screenPriv->devicePath = renderNode;
 
   screenPriv->fd = open(screenPriv->devicePath, O_RDWR|O_CLOEXEC);
   if (screenPriv->fd < 0) {
index 636171bac7bbaeb0db7772460385a4f14b7180fc..4f89a25aefe7537db4d8430374f62c3ecc5d62b1 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <dix.h>
 
+extern const char *renderNode;
+
 Bool vncDRI3Init(ScreenPtr screen);
 
 Bool vncDRI3IsHardwarePixmap(PixmapPtr pixmap);
index a441f824015c344cec68023c5757ac6dece1aa5f..45da17fb6c96cd76ecbf30be5b32ce4ce6f0c743 100644 (file)
@@ -223,6 +223,9 @@ ddxUseMsg(void)
     ErrorF("-inetd                 has been launched from inetd\n");
     ErrorF
         ("-noclipboard           disable clipboard settings modification via vncconfig utility\n");
+#ifdef DRI3
+    ErrorF("-rendernode PATH       DRM render node to use for DRI3\n");
+#endif
     ErrorF("-verbose [n]           verbose startup messages\n");
     ErrorF("-quiet                 minimal startup messages\n");
     ErrorF("-version               show the server version\n");
@@ -405,6 +408,15 @@ ddxProcessArgument(int argc, char *argv[], int i)
         return 1;
     }
 
+#ifdef DRI3
+    if (strcmp(argv[i], "-rendernode") == 0) {
+        CHECK_FOR_REQUIRED_ARGUMENTS(1);
+        ++i;
+        renderNode = argv[i];
+        return 2;
+    }
+#endif
+
     if (!strcmp(argv[i], "-verbose")) {
         if (++i < argc && argv[i]) {
             char *end;