]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
resolutionSet/resolutionKMS: Work around DRM control node removal
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:31 +0000 (11:23 -0700)
DRM control nodes were removed in linux 4.10. Work with an updated
version of the vmwgfx kernel module and target render- or primary
nodes instead.

open-vm-tools/services/plugins/resolutionKMS/resolutionKMS.c
open-vm-tools/services/plugins/resolutionSet/resolutionCommon.c
open-vm-tools/services/plugins/resolutionSet/resolutionCommon.h
open-vm-tools/services/plugins/resolutionSet/resolutionX11.c

index dd142b8eeb838372a67aa16d547926c8db2e3270..6aff01817a38152fd2ea6a2b3bb53e4a9d070234 100644 (file)
@@ -440,7 +440,7 @@ ToolsOnLoad(ToolsAppCtx *ctx)
       return NULL;
    }
 
-   kmsInfo.fd = resolutionCheckForKMS(ctx, TRUE);
+   kmsInfo.fd = resolutionCheckForKMS(ctx);
    if (kmsInfo.fd < 0) {
       return NULL;
    }
index 85c7a4cd3975e4618c5e78ec4edca7255aa580f4..ac887f6887a4733d3c807ce7ca183a9871f235b0 100644 (file)
@@ -41,7 +41,7 @@
 
 /* Required DRM version for resolutionKMS */
 #define RESOLUTION_DRM_MAJOR  2
-#define RESOLUTION_DRM_MINOR  10
+#define RESOLUTION_DRM_MINOR  12
 
 /* Required Xorg driver version for resolutionKMS default on */
 #define RESOLUTION_XORG_MAJOR 13
@@ -180,8 +180,7 @@ skipCheck:
  *-----------------------------------------------------------------------------
  */
 static int
-resolutionDRMCheckVersion(int fd) // IN: An open DRM file
-                                  // descriptor.
+resolutionDRMCheckVersion(int fd)  // IN: An open DRM file descriptor.
 {
     drmVersionPtr ver = drmGetVersion(fd);
 
@@ -192,9 +191,9 @@ resolutionDRMCheckVersion(int fd) // IN: An open DRM file
 
     if (ver->version_major != RESOLUTION_DRM_MAJOR ||
        ver->version_minor < RESOLUTION_DRM_MINOR) {
-       g_debug("%s: Insufficient DRM version for resolutionKMS.\n", __func__);
-       drmFreeVersion(ver);
-       return -1;
+       g_debug("%s: Insufficient DRM version for resolutionKMS.\n", __func__);
+       drmFreeVersion(ver);
+       return -1;
     }
 
     drmFreeVersion(ver);
@@ -221,7 +220,7 @@ resolutionDRMCheckVersion(int fd) // IN: An open DRM file
  *
  *-----------------------------------------------------------------------------
  */
-int
+static int
 resolutionDRMRPrimaryCheckOpen(void)
 {
     int fd = -1;
@@ -248,44 +247,6 @@ resolutionDRMRPrimaryCheckOpen(void)
 }
 
 
-/*
- *-----------------------------------------------------------------------------
- *
- * resolutionDRMDontrolCheckOpen --
- *
- *     Opens a control node to DRM. Then checks that drm supports GUI topology
- *     communication.
- *
- * Results:
- *     If succesful returns a positive open file descriptor. Otherwise
- *     returns -1.
- *
- * Side effects:
- *      Uses a render- or primary node for version check, since the
- *      version check is not available for control nodes. May thus temporarily
- *      become master and race with the X server.
- *
- *-----------------------------------------------------------------------------
- */
-int
-resolutionDRMControlCheckOpen(void)
-{
-    int fd;
-
-    fd = resolutionOpenDRM("controlD");
-    if (fd < 0) {
-       g_debug("%s: Failed to open DRM Control node.\n", __func__);
-       return -1;
-    }
-
-    if (!resolutionDRMCheckVersion(fd)) {
-       return fd;
-    }
-
-    close(fd);
-    return -1;
-}
-
 /*
  *-----------------------------------------------------------------------------
  *
@@ -306,12 +267,8 @@ resolutionDRMControlCheckOpen(void)
  *-----------------------------------------------------------------------------
  */
 int
-resolutionCheckForKMS(ToolsAppCtx *ctx,  // IN: The ToolsAppCtx for
+resolutionCheckForKMS(ToolsAppCtx *ctx)  // IN: The ToolsAppCtx for
                                         // configuration db access.
-                     gboolean control)  // IN: Whether to open a control node
-                                         // to DRM (supply layout info) or
-                                         // to open a render node to get the
-                                         // version only.
 {
     GError *err = NULL;
     gboolean doResolutionKMS;
@@ -358,10 +315,7 @@ resolutionCheckForKMS(ToolsAppCtx *ctx,  // IN: The ToolsAppCtx for
        g_message("%s: dlopen succeeded.\n", __func__);
     }
 
-    if (control)
-       fd = resolutionDRMControlCheckOpen();
-    else
-       fd = resolutionDRMRPrimaryCheckOpen();
+    fd = resolutionDRMRPrimaryCheckOpen();
 
     if (fd < 0)
        g_warning("%s: No system support for resolutionKMS.\n", __func__);
index 04c60baab2aab0a6ddea40063499a6a88fb3af73..6565190f88d64750c4b8cce1574aa781b2af4f66 100644 (file)
 #include "vmware/tools/plugin.h"
 #ifdef ENABLE_RESOLUTIONKMS
 
-int resolutionCheckForKMS(ToolsAppCtx *ctx, gboolean control);
+int resolutionCheckForKMS(ToolsAppCtx *ctx);
 void resolutionDRMClose(int fd);
 
 #else
 
-static inline int resolutionCheckForKMS(ToolsAppCtx *ctx, gboolean control)
+static inline int resolutionCheckForKMS(ToolsAppCtx *ctx)
 {
     return -1;
 }
index ae975281b9f15c765107b35092dbfe7450e455fa..cec4aa287efe0f28d9bb9cfc7ce64f7a1ab5c612 100644 (file)
@@ -592,7 +592,7 @@ ResolutionToolkitInit(ToolsAppCtx *ctx) // IN: For config database access
    Display *display;
    int fd;
 
-   fd = resolutionCheckForKMS(ctx, FALSE);
+   fd = resolutionCheckForKMS(ctx);
    if (fd >= 0) {
       resolutionDRMClose(fd);
       g_message("%s: Backing off for resolutionKMS.\n", __func__);