From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:31 +0000 (-0700) Subject: resolutionSet/resolutionKMS: Work around DRM control node removal X-Git-Tag: stable-10.2.0~290 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24bb7361bb1ed63201030841282369e571490f8b;p=thirdparty%2Fopen-vm-tools.git resolutionSet/resolutionKMS: Work around DRM control node removal 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. --- diff --git a/open-vm-tools/services/plugins/resolutionKMS/resolutionKMS.c b/open-vm-tools/services/plugins/resolutionKMS/resolutionKMS.c index dd142b8ee..6aff01817 100644 --- a/open-vm-tools/services/plugins/resolutionKMS/resolutionKMS.c +++ b/open-vm-tools/services/plugins/resolutionKMS/resolutionKMS.c @@ -440,7 +440,7 @@ ToolsOnLoad(ToolsAppCtx *ctx) return NULL; } - kmsInfo.fd = resolutionCheckForKMS(ctx, TRUE); + kmsInfo.fd = resolutionCheckForKMS(ctx); if (kmsInfo.fd < 0) { return NULL; } diff --git a/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.c b/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.c index 85c7a4cd3..ac887f688 100644 --- a/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.c +++ b/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.c @@ -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__); diff --git a/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.h b/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.h index 04c60baab..6565190f8 100644 --- a/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.h +++ b/open-vm-tools/services/plugins/resolutionSet/resolutionCommon.h @@ -28,12 +28,12 @@ #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; } diff --git a/open-vm-tools/services/plugins/resolutionSet/resolutionX11.c b/open-vm-tools/services/plugins/resolutionSet/resolutionX11.c index ae975281b..cec4aa287 100644 --- a/open-vm-tools/services/plugins/resolutionSet/resolutionX11.c +++ b/open-vm-tools/services/plugins/resolutionSet/resolutionX11.c @@ -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__);