FROMLIST: drm/core: Reuse the reserved member in drm_event_vblank for crtc_id.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 10 Aug 2016 10:46:23 +0000 (12:46 +0200)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 20 Mar 2017 03:10:55 +0000 (11:10 +0800)
When doing a atomic commit affecting multiple crtc's, multiple events
are generated. The user_data member does not allow you to distinguish,
because they all have the same pointer.

I've chosen to use crtc_id, because using pipe would create ambiguity
when pipe = 0. A test for != 0 is easier to implement, and crtc_id
will never be 0.

Change-Id: Ie2daba50f711f298872f15498b8d46dedb38c0ff
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9272895/)

drivers/gpu/drm/drm_irq.c
include/uapi/drm/drm.h

index 1fe14579e8c941b002c5362f7c69936c85cf855b..c8006fb47c7ac1f7ca2988176a13bccc65ae0684 100644 (file)
@@ -1101,6 +1101,7 @@ EXPORT_SYMBOL(drm_arm_vblank_event);
 void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
                               struct drm_pending_vblank_event *e)
 {
 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);
        drm_arm_vblank_event(crtc->dev, drm_crtc_index(crtc), e);
 }
 EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
@@ -1147,6 +1148,7 @@ EXPORT_SYMBOL(drm_send_vblank_event);
 void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
                                struct drm_pending_vblank_event *e)
 {
 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);
        drm_send_vblank_event(crtc->dev, drm_crtc_index(crtc), e);
 }
 EXPORT_SYMBOL(drm_crtc_send_vblank_event);
index 3b01fb86ca8e17733d73bf2c7b0eb32d5047aeb6..84a9d348a4b674c9af0687c5f5741adf485d3c82 100644 (file)
@@ -834,7 +834,7 @@ struct drm_event_vblank {
        __u32 tv_sec;
        __u32 tv_usec;
        __u32 sequence;
        __u32 tv_sec;
        __u32 tv_usec;
        __u32 sequence;
-       __u32 reserved;
+       __u32 crtc_id; /* 0 on older kernels that do not support this */
 };
 
 /* typedef area */
 };
 
 /* typedef area */