From: Ander Conselvan de Oliveira Date: Tue, 4 Apr 2017 16:52:21 +0000 (+0100) Subject: FROMLIST: drm: Pass CRTC ID in userspace vblank events X-Git-Tag: release-20171130_firefly~4^2~610 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=398e38d802598838fb1227ee0fd8bd2bc1576996;p=firefly-linux-kernel-4.4.55.git FROMLIST: drm: Pass CRTC ID in userspace vblank events 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 Signed-off-by: Daniel Stone Cc: Maarten Lankhorst Reviewed-by: Sean Paul (am from https://patchwork.kernel.org/patch/9662099/) Change-Id: Ibe6949782e5df5363d4eaa3e98b3ff413239cf26 Signed-off-by: Jacob Chen --- diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 92f079556b98..34757168ffaa 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -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; } diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 84a9d348a4b6..5149380a76e5 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -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 {