From patchwork Thu Jul 18 16:15:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11049289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C35C6C5 for ; Thu, 18 Jul 2019 16:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CE40283B2 for ; Thu, 18 Jul 2019 16:15:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60FBC28607; Thu, 18 Jul 2019 16:15:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1863E283B2 for ; Thu, 18 Jul 2019 16:15:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 34BE06E43F; Thu, 18 Jul 2019 16:15:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9713E6E431; Thu, 18 Jul 2019 16:15:35 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id z28so27998928ljn.4; Thu, 18 Jul 2019 09:15:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vfJth78zrsCE8EvAkb2q7xxIdGu3poPk3dyoAqmz7bA=; b=paVj8PyKinyf5ARQBNEY9lEK/fsCSPVhMvKdwOOKycAWuzpzRsNT/vpI5J3h8epIwd mGtwSRat/bTCLwoMvPGXBv4VirdDtTAuW4kNF7ubyMb4/YChzmA1ot8V1tLsBmWOmBPq VfQ9nY75juvFgrAe5r7Qvjx4e4Qb8Nzm10UzKh5dsYKPu9djSfrHYX8UuaI/cNchYuEk MPe8Mr3WU+BaZgH2X3MekHqvaFxxArQW0FuHhWVJWAVbZVG+qLAgsWRaQmmvbe9XA3fw FC+YEdJeL3U6uOW7ZJZV225Z9cmbN1PlhnYgwiy3zeBmv9Xcu9V8J8sXDFS9pBpmYstG 9hfw== X-Gm-Message-State: APjAAAWlBPwDw2jv1fLEFSraFshwrr9ndwXspW+r361p1IKeCLuM80G7 yFJIGDhY0GEF8ouZWym7z75tfhC1DmH94A== X-Google-Smtp-Source: APXvYqz+lvIEFfsf44rKsdxmLLQVJPn5lk9Rv8gUung+m8ggZXDMg+iNeOqEP6Hx4DqN5fgQu97mtQ== X-Received: by 2002:a2e:3013:: with SMTP id w19mr24846595ljw.73.1563466532065; Thu, 18 Jul 2019 09:15:32 -0700 (PDT) Received: from saturn.lan (18.158-248-194.customer.lyse.net. [158.248.194.18]) by smtp.gmail.com with ESMTPSA id d21sm4057995lfc.73.2019.07.18.09.15.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 18 Jul 2019 09:15:31 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Intel Graphics Development Date: Thu, 18 Jul 2019 18:15:01 +0200 Message-Id: <20190718161507.2047-6-sam@ravnborg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190718161507.2047-1-sam@ravnborg.org> References: <20190718161507.2047-1-sam@ravnborg.org> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vfJth78zrsCE8EvAkb2q7xxIdGu3poPk3dyoAqmz7bA=; b=BbtCb9g2DsNiEp4NQaoJ4QYlf9TOBMn5FNfXAILkgRxVvjMv4oYQ2QWQur2QpY1oDs tY+hq6tQpdn6sv4GaAaRN3zqoKMtOJxKTS+CE/FeurecYR2py7DmD+wOYqDqFPliavRD kUvnCwNnxdpmg77SNaygFlJnpzjhLEFeu3r3pjJqPBA1qYv13+DJUC4oqyBIegVvlLUf yV55m8LLBBHpOjCBjccG83p4/fiVAPoDBnjNwfJNh1ay525CqTZIoid4MD9BRXItWgVc N7jdcGxdFSDusx5NEMh0a+wZcDux71kNRXlqKP3VfMBmJJZlGukoBFODa+OKNFpsR1xe 1F0g== Subject: [Intel-gfx] [PATCH v1 05/11] drm/vblank: drop use of DRM_WAIT_ON() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sam Ravnborg , Rob Herring , Maxime Ripard , CK Hu , Thierry Reding , Chunming Zhou , Jani Nikula , linux-mediatek@lists.infradead.org, Stefan Agner , Matthias Brugger , linux-arm-kernel@lists.infradead.org, Boris Brezillon , Thomas Zimmermann , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Philipp Zabel , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP DRM_WAIT_ON() is from the deprecated drm_os_linux header and the modern replacement is the wait_event_*. The return values differ, so a conversion is needed to keep the original interface towards userspace. Introduced a switch/case to make code obvious and to allow different debug prints depending on the result. Signed-off-by: Sam Ravnborg Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: Daniel Vetter Reviewed-by: Sean Paul --- drivers/gpu/drm/drm_vblank.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 603ab105125d..8e9ac187500e 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "drm_internal.h" @@ -1672,19 +1671,31 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, if (req_seq != seq) { DRM_DEBUG("waiting on vblank count %llu, crtc %u\n", req_seq, pipe); - DRM_WAIT_ON(ret, vblank->queue, 3 * HZ, - vblank_passed(drm_vblank_count(dev, pipe), - req_seq) || - !READ_ONCE(vblank->enabled)); + ret = wait_event_interruptible_timeout(vblank->queue, + vblank_passed(drm_vblank_count(dev, pipe), req_seq) || + !READ_ONCE(vblank->enabled), + msecs_to_jiffies(3000)); } - if (ret != -EINTR) { + switch (ret) { + case 0: + /* timeout */ + ret = -EBUSY; drm_wait_vblank_reply(dev, pipe, &vblwait->reply); - - DRM_DEBUG("crtc %d returning %u to client\n", + DRM_DEBUG("timeout waiting for vblank. crtc %d returning %u to client\n", pipe, vblwait->reply.sequence); - } else { + break; + case -ERESTARTSYS: + /* interrupted by signal */ + ret = -EINTR; DRM_DEBUG("crtc %d vblank wait interrupted by signal\n", pipe); + break; + default: + ret = 0; + drm_wait_vblank_reply(dev, pipe, &vblwait->reply); + DRM_DEBUG("crtc %d returning %u to client\n", + pipe, vblwait->reply.sequence); + break; } done: