[PATCH v2 1/2] drm: Add drm_crtc_vblank_waitqueue()

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Thu May 22 09:36:03 PDT 2014


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Add a small static inline helper to grab the vblank wait queue based on
the drm_crtc.

This is useful for drivers to do internal vblank waits using
wait_event() & co.

v2: Pimp commit message (Daniel)
    Add kernel doc (Daniel)

Suggested-by: Daniel Vetter <daniel at ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 Documentation/DocBook/drm.tmpl |  1 +
 include/drm/drmP.h             | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 9574bf2..527a3f9 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -2522,6 +2522,7 @@ void (*disable_vblank) (struct drm_device *dev, int crtc);</synopsis>
     <sect2>
       <title>Vertical Blanking and Interrupt Handling Functions Reference</title>
 !Edrivers/gpu/drm/drm_irq.c
+!Iinclude/drm/drmP.h drm_crtc_vblank_waitqueue
     </sect2>
   </sect1>
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 76ccaab..48dc3e5 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1378,6 +1378,17 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 					    const struct drm_display_mode *mode);
 
+/**
+ * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC
+ * @crtc: which CRTC's vblank waitqueue to retrieve
+ *
+ * This function returns a pointer to the vblank waitqueue for the CRTC.
+ * Drivers can use this to implement vblank waits using wait_event() & co.
+ */
+static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc)
+{
+	return &crtc->dev->vblank[drm_crtc_index(crtc)].queue;
+}
 
 /* Modesetting support */
 extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
-- 
1.8.5.5



More information about the dri-devel mailing list