Skip to contentSkip to conversation

drm: Add drm_crtc_vblank_waitqueue()

PATCH Superseded [email protected] 3 participants 10 messages May 22, 2014 – Jul 25, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: Add drm_crtc_vblank_waitqueue()

From: Ville Syrjälä <[email protected]>

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

---
 include/drm/drmP.h | 4 ++++
 1 file changed, 4 insertions(+)
include/drm/drmP.h +4 -0
index 76ccaab..c294560 100644
@@ -1378,6 +1378,10 @@ 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);
 
+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);
Signature · 6 lines
1.8.5.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm/i915: Kill intel_crtc->vbl_wait

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

---
 drivers/gpu/drm/i915/i915_irq.c      | 25 ++++++-------------------
 drivers/gpu/drm/i915/intel_display.c |  2 --
 drivers/gpu/drm/i915/intel_drv.h     |  2 --
 drivers/gpu/drm/i915/intel_sprite.c  |  5 +++--
 4 files changed, 9 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +6 -19
index 304f86a..5905a9d 100644
@@ -1724,19 +1724,6 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 	}
 }
 
-static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
-{
-	struct intel_crtc *crtc;
-
-	if (!drm_handle_vblank(dev, pipe))
-		return false;
-
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
-	return true;
-}
-
 static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1791,7 +1778,7 @@ static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir)
 
 	for_each_pipe(pipe) {
 		if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS)
-			intel_pipe_handle_vblank(dev, pipe);
+			drm_handle_vblank(dev, pipe);
 
 		if (pipe_stats[pipe] & PLANE_FLIP_DONE_INT_STATUS_VLV) {
 			intel_prepare_page_flip(dev, pipe);
@@ -2068,7 +2055,7 @@ static void ilk_display_irq_handler(struct drm_device *dev, u32 de_iir)
 
 	for_each_pipe(pipe) {
 		if (de_iir & DE_PIPE_VBLANK(pipe))
-			intel_pipe_handle_vblank(dev, pipe);
+			drm_handle_vblank(dev, pipe);
 
 		if (de_iir & DE_PIPE_FIFO_UNDERRUN(pipe))
 			if (intel_set_cpu_fifo_underrun_reporting(dev, pipe, false))
@@ -2118,7 +2105,7 @@ static void ivb_display_irq_handler(struct drm_device *dev, u32 de_iir)
 
 	for_each_pipe(pipe) {
 		if (de_iir & (DE_PIPE_VBLANK_IVB(pipe)))
-			intel_pipe_handle_vblank(dev, pipe);
+			drm_handle_vblank(dev, pipe);
 
 		/* plane/pipes map 1:1 on ilk+ */
 		if (de_iir & DE_PLANE_FLIP_DONE_IVB(pipe)) {
@@ -2261,7 +2248,7 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
 
 		pipe_iir = I915_READ(GEN8_DE_PIPE_IIR(pipe));
 		if (pipe_iir & GEN8_PIPE_VBLANK)
-			intel_pipe_handle_vblank(dev, pipe);
+			drm_handle_vblank(dev, pipe);
 
 		if (pipe_iir & GEN8_PIPE_PRIMARY_FLIP_DONE) {
 			intel_prepare_page_flip(dev, pipe);
@@ -3731,7 +3718,7 @@ static bool i8xx_handle_vblank(struct drm_device *dev,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u16 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane);
 
-	if (!intel_pipe_handle_vblank(dev, pipe))
+	if (!drm_handle_vblank(dev, pipe))
 		return false;
 
 	if ((iir & flip_pending) == 0)
@@ -3916,7 +3903,7 @@ static bool i915_handle_vblank(struct drm_device *dev,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane);
 
-	if (!intel_pipe_handle_vblank(dev, pipe))
+	if (!drm_handle_vblank(dev, pipe))
 		return false;
 
 	if ((iir & flip_pending) == 0)
drivers/gpu/drm/i915/intel_display.c +0 -2
index 019e9e1..aab638c 100644
@@ -10966,8 +10966,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 		intel_crtc->plane = !pipe;
 	}
 
-	init_waitqueue_head(&intel_crtc->vbl_wait);
-
 	BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
 	       dev_priv->plane_to_crtc_mapping[intel_crtc->plane] != NULL);
 	dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base;
drivers/gpu/drm/i915/intel_drv.h +0 -2
index d7c52b2..0071138 100644
@@ -408,8 +408,6 @@ struct intel_crtc {
 		struct intel_pipe_wm active;
 	} wm;
 
-	wait_queue_head_t vbl_wait;
-
 	int scanline_offset;
 };
 
drivers/gpu/drm/i915/intel_sprite.c +3 -2
index d6acd6b..7cd6a4f 100644
@@ -53,6 +53,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 	enum pipe pipe = crtc->pipe;
 	long timeout = msecs_to_jiffies_timeout(1);
 	int scanline, min, max, vblank_start;
+	wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
 	DEFINE_WAIT(wait);
 
 	WARN_ON(!mutex_is_locked(&crtc->base.mutex));
@@ -81,7 +82,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 		 * other CPUs can see the task state update by the time we
 		 * read the scanline.
 		 */
-		prepare_to_wait(&crtc->vbl_wait, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE);
 
 		scanline = intel_get_crtc_scanline(crtc);
 		if (scanline < min || scanline > max)
@@ -100,7 +101,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 		local_irq_disable();
 	}
 
-	finish_wait(&crtc->vbl_wait, &wait);
+	finish_wait(wq, &wait);
 
 	drm_vblank_put(dev, pipe);
 
Signature · 6 lines
1.8.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] drm/i915: Kill intel_crtc->vbl_wait

Quoted 24 lines · On Thu, May 22, 2014 at 06:39:33PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

---
 drivers/gpu/drm/i915/i915_irq.c      | 25 ++++++-------------------
 drivers/gpu/drm/i915/intel_display.c |  2 --
 drivers/gpu/drm/i915/intel_drv.h     |  2 --
 drivers/gpu/drm/i915/intel_sprite.c  |  5 +++--
 4 files changed, 9 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -2
index 304f86a..5905a9d 100644
@@ -1724,19 +1724,6 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 	}
 }
 
-static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
-{

drivers/gpu/drm/i915/i915_irq.c static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir) · line 1738

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +0 -10
-	struct intel_crtc *crtc;
-
-	if (!drm_handle_vblank(dev, pipe))
-		return false;
-
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
-	return true;
-}

Can we keep this bare wrapper? It is quite useful for hooking in vblank checks - i.e. saves me having to reinrtoduce it.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw

PATCH v2 2/2 drm/i915: Kill intel_crtc->vbl_wait

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

v2: Keep intel_pipe_handle_vblank() (Chris)

---
 drivers/gpu/drm/i915/i915_irq.c      | 5 -----
 drivers/gpu/drm/i915/intel_display.c | 2 --
 drivers/gpu/drm/i915/intel_drv.h     | 2 --
 drivers/gpu/drm/i915/intel_sprite.c  | 5 +++--
 4 files changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -5
index 304f86a..bc4cdbd 100644
@@ -1726,14 +1726,9 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 
 static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
 {
-	struct intel_crtc *crtc;
-
 	if (!drm_handle_vblank(dev, pipe))
 		return false;
 
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
 	return true;
 }
 
drivers/gpu/drm/i915/intel_display.c +0 -2
index 019e9e1..aab638c 100644
@@ -10966,8 +10966,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 		intel_crtc->plane = !pipe;
 	}
 
-	init_waitqueue_head(&intel_crtc->vbl_wait);
-
 	BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
 	       dev_priv->plane_to_crtc_mapping[intel_crtc->plane] != NULL);
 	dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base;
drivers/gpu/drm/i915/intel_drv.h +0 -2
index d7c52b2..0071138 100644
@@ -408,8 +408,6 @@ struct intel_crtc {
 		struct intel_pipe_wm active;
 	} wm;
 
-	wait_queue_head_t vbl_wait;
-
 	int scanline_offset;
 };
 
drivers/gpu/drm/i915/intel_sprite.c +3 -2
index d6acd6b..7cd6a4f 100644
@@ -53,6 +53,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 	enum pipe pipe = crtc->pipe;
 	long timeout = msecs_to_jiffies_timeout(1);
 	int scanline, min, max, vblank_start;
+	wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
 	DEFINE_WAIT(wait);
 
 	WARN_ON(!mutex_is_locked(&crtc->base.mutex));
@@ -81,7 +82,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 		 * other CPUs can see the task state update by the time we
 		 * read the scanline.
 		 */
-		prepare_to_wait(&crtc->vbl_wait, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE);
 
 		scanline = intel_get_crtc_scanline(crtc);
 		if (scanline < min || scanline > max)
@@ -100,7 +101,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 		local_irq_disable();
 	}
 
-	finish_wait(&crtc->vbl_wait, &wait);
+	finish_wait(wq, &wait);
 
 	drm_vblank_put(dev, pipe);
 
Signature · 6 lines
1.8.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH v2 2/2] drm/i915: Kill intel_crtc->vbl_wait

Quoted 9 lines · On Thu, May 22, 2014 at 07:00:50PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

v2: Keep intel_pipe_handle_vblank() (Chris)

Both patches merged to dinq, thanks.
-Daniel

Quoted 89 lines
---
 drivers/gpu/drm/i915/i915_irq.c      | 5 -----
 drivers/gpu/drm/i915/intel_display.c | 2 --
 drivers/gpu/drm/i915/intel_drv.h     | 2 --
 drivers/gpu/drm/i915/intel_sprite.c  | 5 +++--
 4 files changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -5
index 304f86a..bc4cdbd 100644
@@ -1726,14 +1726,9 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 
 static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
 {
-	struct intel_crtc *crtc;
-
 	if (!drm_handle_vblank(dev, pipe))
 		return false;
 
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
 	return true;
 }
 
drivers/gpu/drm/i915/intel_display.c +0 -2
index 019e9e1..aab638c 100644
@@ -10966,8 +10966,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 		intel_crtc->plane = !pipe;
 	}
 
-	init_waitqueue_head(&intel_crtc->vbl_wait);
-
 	BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
 	       dev_priv->plane_to_crtc_mapping[intel_crtc->plane] != NULL);
 	dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base;
drivers/gpu/drm/i915/intel_drv.h +0 -2
index d7c52b2..0071138 100644
@@ -408,8 +408,6 @@ struct intel_crtc {
 		struct intel_pipe_wm active;
 	} wm;
 
-	wait_queue_head_t vbl_wait;
-
 	int scanline_offset;
 };
 
drivers/gpu/drm/i915/intel_sprite.c +3 -2
index d6acd6b..7cd6a4f 100644
@@ -53,6 +53,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 	enum pipe pipe = crtc->pipe;
 	long timeout = msecs_to_jiffies_timeout(1);
 	int scanline, min, max, vblank_start;
+	wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
 	DEFINE_WAIT(wait);
 
 	WARN_ON(!mutex_is_locked(&crtc->base.mutex));
@@ -81,7 +82,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 		 * other CPUs can see the task state update by the time we
 		 * read the scanline.
 		 */
-		prepare_to_wait(&crtc->vbl_wait, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE);
 
 		scanline = intel_get_crtc_scanline(crtc);
 		if (scanline < min || scanline > max)
@@ -100,7 +101,7 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl
 		local_irq_disable();
 	}
 
-	finish_wait(&crtc->vbl_wait, &wait);
+	finish_wait(wq, &wait);
 
 	drm_vblank_put(dev, pipe);
 
Signature · 6 lines
1.8.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw

Re: [Intel-gfx] [PATCH 2/2] drm/i915: Kill intel_crtc->vbl_wait

In reply to Chris Wilson
Quoted 23 lines · Chris Wilson
Quoted 22 lines · On Thu, May 22, 2014 at 06:39:33PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

---
 drivers/gpu/drm/i915/i915_irq.c      | 25 ++++++-------------------
 drivers/gpu/drm/i915/intel_display.c |  2 --
 drivers/gpu/drm/i915/intel_drv.h     |  2 --
 drivers/gpu/drm/i915/intel_sprite.c  |  5 +++--
 4 files changed, 9 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 304f86a..5905a9d 100644
@@ -1724,19 +1724,6 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 	}
 }
 
Quoted 15 lines

drivers/gpu/drm/i915/i915_irq.c static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir) · line 1738

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +0 -12
-static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
-{
-	struct intel_crtc *crtc;
-
-	if (!drm_handle_vblank(dev, pipe))
-		return false;
-
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
-	return true;
-}

Can we keep this bare wrapper? It is quite useful for hooking in vblank checks - i.e. saves me having to reinrtoduce it.

Just smash them into drm_handle_vblank?
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#6 lore raw

Re: [Intel-gfx] [PATCH 2/2] drm/i915: Kill intel_crtc->vbl_wait

Quoted 40 lines · Daniel Vetter
Quoted 23 lines · Chris Wilson
Quoted 22 lines · On Thu, May 22, 2014 at 06:39:33PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

---
 drivers/gpu/drm/i915/i915_irq.c      | 25 ++++++-------------------
 drivers/gpu/drm/i915/intel_display.c |  2 --
 drivers/gpu/drm/i915/intel_drv.h     |  2 --
 drivers/gpu/drm/i915/intel_sprite.c  |  5 +++--
 4 files changed, 9 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 304f86a..5905a9d 100644
@@ -1724,19 +1724,6 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 	}
 }
 
Quoted 15 lines

drivers/gpu/drm/i915/i915_irq.c static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir) · line 1738

Quoted 12 lines
drivers/gpu/drm/i915/i915_irq.c +0 -12
-static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
-{
-	struct intel_crtc *crtc;
-
-	if (!drm_handle_vblank(dev, pipe))
-		return false;
-
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
-	return true;
-}

Can we keep this bare wrapper? It is quite useful for hooking in vblank checks - i.e. saves me having to reinrtoduce it.

Quoted 1 line

Just smash them into drm_handle_vblank?

The ones I have in mind the pageflip stall checks and gpu-boost for missed pageflips, i.e. driver specific.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

Re: [PATCH 2/2] drm/i915: Kill intel_crtc->vbl_wait

Quoted 41 lines · Chris Wilson
Quoted 40 lines · Daniel Vetter
Quoted 38 lines · Chris Wilson
Quoted 24 lines · On Thu, May 22, 2014 at 06:39:33PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Share the waitqueue that drm_irq uses when performing the vblank evade trick for atomic pipe updates.

---
 drivers/gpu/drm/i915/i915_irq.c      | 25 ++++++-------------------
 drivers/gpu/drm/i915/intel_display.c |  2 --
 drivers/gpu/drm/i915/intel_drv.h     |  2 --
 drivers/gpu/drm/i915/intel_sprite.c  |  5 +++--
 4 files changed, 9 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -2
index 304f86a..5905a9d 100644
@@ -1724,19 +1724,6 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 	}
 }
 
-static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)
-{

drivers/gpu/drm/i915/i915_irq.c static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir) · line 1738

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +0 -10
-	struct intel_crtc *crtc;
-
-	if (!drm_handle_vblank(dev, pipe))
-		return false;
-
-	crtc = to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
-	wake_up(&crtc->vbl_wait);
-
-	return true;
-}

Can we keep this bare wrapper? It is quite useful for hooking in vblank checks - i.e. saves me having to reinrtoduce it.

Quoted 4 lines
Quoted 1 line

Just smash them into drm_handle_vblank?

The ones I have in mind the pageflip stall checks and gpu-boost for missed pageflips, i.e. driver specific.

Hm yeah, the pageflip stall check should be in the vblank handler. And yeah boosting harder in the vblank handler if an outstanding pageflip hasn't been completed yet also makes sense. I'll augment Ville's patch v2 with these reasons and merge that one.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#8 lore raw
In reply to [email protected]
Quoted 4 lines · On Thu, May 22, 2014 at 06:39:32PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

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

Maybe add that this is useful for drivers to do internal vblank waits using wait event.

Quoted 11 lines
---
 include/drm/drmP.h | 4 ++++
 1 file changed, 4 insertions(+)
include/drm/drmP.h +0 -0
index 76ccaab..c294560 100644

include/drm/drmP.h extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, · line 1381

Quoted 4 lines
include/drm/drmP.h +1 -0
@@ -1378,6 +1378,10 @@ 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);
 
+static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc)

Kerneldoc + pulling into the drm_irq docs missing. I guess we need to do an include directive which exactly names this function ... No other way with the drm header mess :(
-Daniel

Quoted 13 lines
include/drm/drmP.h +3 -0
+{
+	return &crtc->dev->vblank[drm_crtc_index(crtc)].queue;
+}
 
 /* Modesetting support */
 extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
Signature · 6 lines
1.8.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#9 lore raw

PATCH v2 1/2 drm: Add drm_crtc_vblank_waitqueue()

From: Ville Syrjälä <[email protected]>

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)

---
 Documentation/DocBook/drm.tmpl |  1 +
 include/drm/drmP.h             | 11 +++++++++++
 2 files changed, 12 insertions(+)
Documentation/DocBook/drm.tmpl +1 -0
index 9574bf2..527a3f9 100644
@@ -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>
 
include/drm/drmP.h +11 -0
index 76ccaab..48dc3e5 100644
@@ -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);
Signature · 6 lines
1.8.5.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx