From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: [PATCH 27/50] drm/irq: Replace DRM_WAIT_ON with wait_event Date: Wed, 11 Dec 2013 11:34:48 +0100 Message-ID: <1386758111-3446-28-git-send-email-daniel.vetter@ffwll.ch> References: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f178.google.com (mail-ea0-f178.google.com [209.85.215.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 2394B105778 for ; Wed, 11 Dec 2013 02:35:05 -0800 (PST) Received: by mail-ea0-f178.google.com with SMTP id d10so2867960eaj.9 for ; Wed, 11 Dec 2013 02:35:05 -0800 (PST) In-Reply-To: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: DRI Development Cc: Daniel Vetter List-Id: dri-devel@lists.freedesktop.org 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 --- 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