diff options
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 2151ea551d3b..607f493ae801 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -980,7 +980,8 @@ static void send_vblank_event(struct drm_device *dev, | |||
980 | struct drm_pending_vblank_event *e, | 980 | struct drm_pending_vblank_event *e, |
981 | unsigned long seq, struct timeval *now) | 981 | unsigned long seq, struct timeval *now) |
982 | { | 982 | { |
983 | WARN_ON_SMP(!spin_is_locked(&dev->event_lock)); | 983 | assert_spin_locked(&dev->event_lock); |
984 | |||
984 | e->event.sequence = seq; | 985 | e->event.sequence = seq; |
985 | e->event.tv_sec = now->tv_sec; | 986 | e->event.tv_sec = now->tv_sec; |
986 | e->event.tv_usec = now->tv_usec; | 987 | e->event.tv_usec = now->tv_usec; |
@@ -993,6 +994,57 @@ static void send_vblank_event(struct drm_device *dev, | |||
993 | } | 994 | } |
994 | 995 | ||
995 | /** | 996 | /** |
997 | * drm_arm_vblank_event - arm vblank event after pageflip | ||
998 | * @dev: DRM device | ||
999 | * @pipe: CRTC index | ||
1000 | * @e: the event to prepare to send | ||
1001 | * | ||
1002 | * A lot of drivers need to generate vblank events for the very next vblank | ||
1003 | * interrupt. For example when the page flip interrupt happens when the page | ||
1004 | * flip gets armed, but not when it actually executes within the next vblank | ||
1005 | * period. This helper function implements exactly the required vblank arming | ||
1006 | * behaviour. | ||
1007 | * | ||
1008 | * Caller must hold event lock. Caller must also hold a vblank reference for | ||
1009 | * the event @e, which will be dropped when the next vblank arrives. | ||
1010 | * | ||
1011 | * This is the legacy version of drm_crtc_arm_vblank_event(). | ||
1012 | */ | ||
1013 | void drm_arm_vblank_event(struct drm_device *dev, unsigned int pipe, | ||
1014 | struct drm_pending_vblank_event *e) | ||
1015 | { | ||
1016 | assert_spin_locked(&dev->event_lock); | ||
1017 | |||
1018 | e->pipe = pipe; | ||
1019 | e->event.sequence = drm_vblank_count(dev, pipe); | ||
1020 | list_add_tail(&e->base.link, &dev->vblank_event_list); | ||
1021 | } | ||
1022 | EXPORT_SYMBOL(drm_arm_vblank_event); | ||
1023 | |||
1024 | /** | ||
1025 | * drm_crtc_arm_vblank_event - arm vblank event after pageflip | ||
1026 | * @crtc: the source CRTC of the vblank event | ||
1027 | * @e: the event to send | ||
1028 | * | ||
1029 | * A lot of drivers need to generate vblank events for the very next vblank | ||
1030 | * interrupt. For example when the page flip interrupt happens when the page | ||
1031 | * flip gets armed, but not when it actually executes within the next vblank | ||
1032 | * period. This helper function implements exactly the required vblank arming | ||
1033 | * behaviour. | ||
1034 | * | ||
1035 | * Caller must hold event lock. Caller must also hold a vblank reference for | ||
1036 | * the event @e, which will be dropped when the next vblank arrives. | ||
1037 | * | ||
1038 | * This is the native KMS version of drm_arm_vblank_event(). | ||
1039 | */ | ||
1040 | void drm_crtc_arm_vblank_event(struct drm_crtc *crtc, | ||
1041 | struct drm_pending_vblank_event *e) | ||
1042 | { | ||
1043 | drm_arm_vblank_event(crtc->dev, drm_crtc_index(crtc), e); | ||
1044 | } | ||
1045 | EXPORT_SYMBOL(drm_crtc_arm_vblank_event); | ||
1046 | |||
1047 | /** | ||
996 | * drm_send_vblank_event - helper to send vblank event after pageflip | 1048 | * drm_send_vblank_event - helper to send vblank event after pageflip |
997 | * @dev: DRM device | 1049 | * @dev: DRM device |
998 | * @pipe: CRTC index | 1050 | * @pipe: CRTC index |