Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf652034 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Abhinav Kumar
Browse files

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.]

Change-Id: I48b6b3ab4c97b20b79ebff0cb367acb1f53e95cc
Signed-off-by: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170404165221.28240-2-daniels@collabora.com
[abhinavk@codeaurora.org: resolved trivial merge conflicts]
Git-commit: 5db06a8a98f515f67446a69c57577c4c363ec65d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
parent 4dabf448
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
	}
+2 −0
Original line number Diff line number Diff line
@@ -1098,6 +1098,7 @@ EXPORT_SYMBOL(drm_arm_vblank_event);
void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
			       struct drm_pending_vblank_event *e)
{
	e->event.crtc_id = crtc->base.id;
	drm_arm_vblank_event(crtc->dev, drm_crtc_index(crtc), e);
}
EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
@@ -1144,6 +1145,7 @@ EXPORT_SYMBOL(drm_send_vblank_event);
void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
				struct drm_pending_vblank_event *e)
{
	e->event.crtc_id = crtc->base.id;
	drm_send_vblank_event(crtc->dev, drm_crtc_index(crtc), e);
}
EXPORT_SYMBOL(drm_crtc_send_vblank_event);
+2 −1
Original line number Diff line number Diff line
@@ -639,6 +639,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 {
@@ -842,7 +843,7 @@ struct drm_event_vblank {
	__u32 tv_sec;
	__u32 tv_usec;
	__u32 sequence;
	__u32 reserved;
	__u32 crtc_id; /* 0 on older kernels that do not support this */
};

/* typedef area */