[PATCH 27/50] drm/irq: Replace DRM_WAIT_ON with wait_event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Note that I've dropped the timeout - we don't expect the display
hardware to ever hang, and the current code isn't really up to handle
this correctly anyway.

The only risk I see is that old user modesetting drivers wreak havoc
with themselves by disabling the interrupt support at the wrong time.
But then again this means we're running X and will get a signal sooner
or later anyway. So it should get out of the loop latest when the user
attempts to do a vt switch.

Also extract the condition into a temporary macro for better
readability.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 drivers/gpu/drm/drm_irq.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index e7de2da57234..c0c6bdedefef 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1244,12 +1244,14 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
 	DRM_DEBUG("waiting on vblank count %d, crtc %d\n",
 		  vblwait->request.sequence, crtc);
 	dev->vblank[crtc].last_wait = vblwait->request.sequence;
-	DRM_WAIT_ON(ret, dev->vblank[crtc].queue, 3 * HZ,
-		    (((drm_vblank_count(dev, crtc) -
-		       vblwait->request.sequence) <= (1 << 23)) ||
-		     !dev->irq_enabled));
-
-	if (ret != -EINTR) {
+#define C \
+	(((drm_vblank_count(dev, crtc) - vblwait->request.sequence) \
+	  <= (1 << 23)) || \
+	 !dev->irq_enabled)
+	ret = wait_event_interruptible(dev->vblank[crtc].queue, C);
+#undef C
+
+	if (ret == 0) {
 		struct timeval now;
 
 		vblwait->reply.sequence = drm_vblank_count_and_time(dev, crtc, &now);
-- 
1.8.4.3

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux