aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_irq.c44
-rw-r--r--include/drm/drmP.h2
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 6f16a104d6d0..e64d24951fc2 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1010,6 +1010,50 @@ void drm_crtc_vblank_put(struct drm_crtc *crtc)
1010EXPORT_SYMBOL(drm_crtc_vblank_put); 1010EXPORT_SYMBOL(drm_crtc_vblank_put);
1011 1011
1012/** 1012/**
1013 * drm_wait_one_vblank - wait for one vblank
1014 * @dev: DRM device
1015 * @crtc: crtc index
1016 *
1017 * This waits for one vblank to pass on @crtc, using the irq driver interfaces.
1018 * It is a failure to call this when the vblank irq for @crtc is disabled, e.g.
1019 * due to lack of driver support or because the crtc is off.
1020 */
1021void drm_wait_one_vblank(struct drm_device *dev, int crtc)
1022{
1023 int ret;
1024 u32 last;
1025
1026 ret = drm_vblank_get(dev, crtc);
1027 if (WARN_ON(ret))
1028 return;
1029
1030 last = drm_vblank_count(dev, crtc);
1031
1032 ret = wait_event_timeout(dev->vblank[crtc].queue,
1033 last != drm_vblank_count(dev, crtc),
1034 msecs_to_jiffies(100));
1035
1036 WARN_ON(ret == 0);
1037
1038 drm_vblank_put(dev, crtc);
1039}
1040EXPORT_SYMBOL(drm_wait_one_vblank);
1041
1042/**
1043 * drm_crtc_wait_one_vblank - wait for one vblank
1044 * @crtc: DRM crtc
1045 *
1046 * This waits for one vblank to pass on @crtc, using the irq driver interfaces.
1047 * It is a failure to call this when the vblank irq for @crtc is disabled, e.g.
1048 * due to lack of driver support or because the crtc is off.
1049 */
1050void drm_crtc_wait_one_vblank(struct drm_crtc *crtc)
1051{
1052 drm_wait_one_vblank(crtc->dev, drm_crtc_index(crtc));
1053}
1054EXPORT_SYMBOL(drm_crtc_wait_one_vblank);
1055
1056/**
1013 * drm_vblank_off - disable vblank events on a CRTC 1057 * drm_vblank_off - disable vblank events on a CRTC
1014 * @dev: DRM device 1058 * @dev: DRM device
1015 * @crtc: CRTC in question 1059 * @crtc: CRTC in question
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d3d9be6b83ef..c2209178981f 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1327,6 +1327,8 @@ extern int drm_vblank_get(struct drm_device *dev, int crtc);
1327extern void drm_vblank_put(struct drm_device *dev, int crtc); 1327extern void drm_vblank_put(struct drm_device *dev, int crtc);
1328extern int drm_crtc_vblank_get(struct drm_crtc *crtc); 1328extern int drm_crtc_vblank_get(struct drm_crtc *crtc);
1329extern void drm_crtc_vblank_put(struct drm_crtc *crtc); 1329extern void drm_crtc_vblank_put(struct drm_crtc *crtc);
1330extern void drm_wait_one_vblank(struct drm_device *dev, int crtc);
1331extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
1330extern void drm_vblank_off(struct drm_device *dev, int crtc); 1332extern void drm_vblank_off(struct drm_device *dev, int crtc);
1331extern void drm_vblank_on(struct drm_device *dev, int crtc); 1333extern void drm_vblank_on(struct drm_device *dev, int crtc);
1332extern void drm_crtc_vblank_off(struct drm_crtc *crtc); 1334extern void drm_crtc_vblank_off(struct drm_crtc *crtc);