FROMLIST: drm: Pass CRTC ID in userspace vblank events
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Tue, 4 Apr 2017 16:52:21 +0000 (17:52 +0100)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 11 May 2017 07:38:50 +0000 (15:38 +0800)
With the atomic API, it is possible that a single commit affects
multiple crtcs. If the user requests an event with that commit, one
event will be sent for each CRTC, but it is not possible to distinguish
which crtc an event is for in user space. To solve this, the reserved
field in struct drm_vblank_event is repurposed to include the crtc_id
which the event is for.

The DRM_CAP_CRTC_IN_VBLANK_EVENT is added to allow userspace to query if
the crtc field will be set properly.

[daniels: Rebased, using Maarten's forward-port.]

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
(am from https://patchwork.kernel.org/patch/9662099/)

Change-Id: Ibe6949782e5df5363d4eaa3e98b3ff413239cf26
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
drivers/gpu/drm/drm_ioctl.c
include/uapi/drm/drm.h

index 92f079556b98565d8fb4bad334da5cf74cabfe03..34757168ffaa81100398a9e22e5f41c93e52a8d6 100644 (file)
@@ -312,6 +312,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
        case DRM_CAP_ADDFB2_MODIFIERS:
                req->value = dev->mode_config.allow_fb_modifiers;
                break;
+       case DRM_CAP_CRTC_IN_VBLANK_EVENT:
+               req->value = 1;
+               break;
        default:
                return -EINVAL;
        }
index 84a9d348a4b674c9af0687c5f5741adf485d3c82..5149380a76e53320ac82b790978dc5dc3dc757b6 100644 (file)
@@ -631,6 +631,7 @@ struct drm_gem_open {
 #define DRM_CAP_CURSOR_WIDTH           0x8
 #define DRM_CAP_CURSOR_HEIGHT          0x9
 #define DRM_CAP_ADDFB2_MODIFIERS       0x10
+#define DRM_CAP_CRTC_IN_VBLANK_EVENT   0x12
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {