diff mbox

[03/12] drm: Make blocking vblank wait return when the vblank interrupts get disabled

Message ID 1400093477-3217-4-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter May 14, 2014, 6:51 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

If there's a blocking vblank wait in progress while the vblank interrupt
gets disabled, the current code will just let the vblank wait time out.
Instead make it return immediately when vblank interrupts get disabled.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_irq.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Thierry Reding May 21, 2014, 11:20 a.m. UTC | #1
On Wed, May 14, 2014 at 08:51:05PM +0200, Daniel Vetter wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> If there's a blocking vblank wait in progress while the vblank interrupt
> gets disabled, the current code will just let the vblank wait time out.
> Instead make it return immediately when vblank interrupts get disabled.

Can this even happen? drm_wait_vblank() takes a vblank reference earlier
and drops it right before returning. But perhaps this will become
obvious since from a quick peek some of the subsequent patches seem like
they will make it possible to force VBLANK off?

Thierry
Thierry Reding May 21, 2014, 11:24 a.m. UTC | #2
On Wed, May 21, 2014 at 01:20:55PM +0200, Thierry Reding wrote:
> On Wed, May 14, 2014 at 08:51:05PM +0200, Daniel Vetter wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > If there's a blocking vblank wait in progress while the vblank interrupt
> > gets disabled, the current code will just let the vblank wait time out.
> > Instead make it return immediately when vblank interrupts get disabled.
> 
> Can this even happen? drm_wait_vblank() takes a vblank reference earlier
> and drops it right before returning. But perhaps this will become
> obvious since from a quick peek some of the subsequent patches seem like
> they will make it possible to force VBLANK off?

Ah, it seems like drm_vblank_off() can already do exactly that, in which
case this makes sense:

Reviewed-by: Thierry Reding <treding@nvidia.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 90c59a8c820f..13d671ed3421 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1189,6 +1189,7 @@  int drm_wait_vblank(struct drm_device *dev, void *data,
 	DRM_WAIT_ON(ret, dev->vblank[crtc].queue, 3 * HZ,
 		    (((drm_vblank_count(dev, crtc) -
 		       vblwait->request.sequence) <= (1 << 23)) ||
+		     !dev->vblank[crtc].enabled ||
 		     !dev->irq_enabled));
 
 	if (ret != -EINTR) {