drm/vmwgfx: Work around drm removal of control nodes
authorThomas Hellstrom <thellstrom@vmware.com>
Tue, 21 Feb 2017 10:42:27 +0000 (17:42 +0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 26 Feb 2017 21:52:28 +0000 (22:52 +0100)
vmware tools has a daemon that gets layout information from the GUI and
forwards it to DRM so that the modesetting code can set preferred connector
locations and modes. This daemon was using control nodes but since control
nodes were just removed, make it possible for the daemon to use render- or
primary nodes instead. This is a bit ugly but will allow drm to proceed with
removal of the mostly unused control-node code and allow vmware to proceed
with fixing up automatic layout settings for gnome-shell/wayland.

We bump minor to inform user-space about the api change.

Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170221104227.2854-1-thellstrom@vmware.com
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h

index 541a5887dd6c49ab6f5a2f3ec684e775cda39357..d08f26973d0b1954737e51f16da2b192dfe15555 100644 (file)
@@ -199,9 +199,14 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
        VMW_IOCTL_DEF(VMW_PRESENT_READBACK,
                      vmw_present_readback_ioctl,
                      DRM_MASTER | DRM_AUTH),
+       /*
+        * The permissions of the below ioctl are overridden in
+        * vmw_generic_ioctl(). We require either
+        * DRM_MASTER or capable(CAP_SYS_ADMIN).
+        */
        VMW_IOCTL_DEF(VMW_UPDATE_LAYOUT,
                      vmw_kms_update_layout_ioctl,
-                     DRM_MASTER | DRM_CONTROL_ALLOW),
+                     DRM_RENDER_ALLOW),
        VMW_IOCTL_DEF(VMW_CREATE_SHADER,
                      vmw_shader_define_ioctl,
                      DRM_AUTH | DRM_RENDER_ALLOW),
@@ -1123,6 +1128,10 @@ static long vmw_generic_ioctl(struct file *filp, unsigned int cmd,
 
                        return (long) vmw_execbuf_ioctl(dev, arg, file_priv,
                                                        _IOC_SIZE(cmd));
+               } else if (nr == DRM_COMMAND_BASE + DRM_VMW_UPDATE_LAYOUT) {
+                       if (!drm_is_current_master(file_priv) &&
+                           !capable(CAP_SYS_ADMIN))
+                               return -EACCES;
                }
 
                if (unlikely(ioctl->cmd != cmd))
index 1e59a486bba8a65577bc24464e4ea441731049c4..59ff4197173aedb24f0883571c62cdbf4cd54de4 100644 (file)
@@ -41,9 +41,9 @@
 #include <drm/ttm/ttm_module.h>
 #include "vmwgfx_fence.h"
 
-#define VMWGFX_DRIVER_DATE "20160210"
+#define VMWGFX_DRIVER_DATE "20170221"
 #define VMWGFX_DRIVER_MAJOR 2
-#define VMWGFX_DRIVER_MINOR 11
+#define VMWGFX_DRIVER_MINOR 12
 #define VMWGFX_DRIVER_PATCHLEVEL 0
 #define VMWGFX_FILE_PAGE_OFFSET 0x00100000
 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)