From patchwork Wed Jun 28 13:28:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 9814291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5EC060365 for ; Wed, 28 Jun 2017 13:29:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C955928514 for ; Wed, 28 Jun 2017 13:29:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDDBE28518; Wed, 28 Jun 2017 13:29:08 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C43628514 for ; Wed, 28 Jun 2017 13:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=p9Nn+3EOG6DXpeDYwu9vZuSrvcQXB18e5V10feHsyh8=; b=hxYn98wdLHMjiGhUYUMuzxe2Fm XkFey79n4qZ22o3Mr7oC/m1bgltKw0WAqMpUi50xdVJnBtcTEZMGOAfpBYRzG2lb+NC8+URNaDNd6 hmfvBtK4NeAogB46VWMUwJdGCb2jxb7F+1J3Zc1ffxn77OA2GOSyrK3FnBCNMPziCwHzulW90jjsk D3NT8JGd5fygkcLvT1r3YA+ZQSAne5qIqfGuGgsGZpqKhqa7X4MdtrJ3FIg9ihitXC7ePNyhoDLuK SZQcE9SUVvr7MwsdiW43QCHQwZqLSfG89vJTgy6wU3xuWjjMlCRYnHu/t2ylj+cw2YnKUdQNDGy3o AXcQttOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dQD1m-0004Bv-2A; Wed, 28 Jun 2017 13:29:06 +0000 Received: from mblankhorst.nl ([2a02:2308::216:3eff:fe92:dfa3]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dQD1Y-0003xb-S8; Wed, 28 Jun 2017 13:28:54 +0000 From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/atomic: Wait indefinitely and interruptibly for hw_done. Date: Wed, 28 Jun 2017 15:28:12 +0200 Message-Id: <20170628132812.14927-2-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170628132812.14927-1-maarten.lankhorst@linux.intel.com> References: <20170628132812.14927-1-maarten.lankhorst@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170628_062853_059112_666E76A2 X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , nouveau@lists.freedesktop.org, Eric Anholt , Thierry Reding , Daniel Vetter , Boris Brezillon , Jonathan Hunter , Tomi Valkeinen , Ben Skeggs , CK Hu , linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Maarten Lankhorst , Jani Nikula , linux-mediatek@lists.infradead.org, Jyri Sarha , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Clark , Philipp Zabel , Sean Paul , freedreno@lists.freedesktop.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Without waiting for hw_done, previous atomic updates may dereference the wrong state and cause a lot of confusion. The real fix is fixing all obj->state to use the accessor macros, but for now wait indefinitely and interruptibly. Cc: Boris Brezillon Cc: David Airlie Cc: Daniel Vetter Cc: Jani Nikula Cc: Sean Paul Cc: CK Hu Cc: Philipp Zabel Cc: Matthias Brugger Cc: Rob Clark Cc: Ben Skeggs Cc: Thierry Reding Cc: Jonathan Hunter Cc: Jyri Sarha Cc: Tomi Valkeinen Cc: Eric Anholt Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Cc: intel-gfx@lists.freedesktop.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: linux-tegra@vger.kernel.org Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/drm_atomic_helper.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index f66b6c45cdd0..56e7729d993d 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2144,8 +2144,7 @@ EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes); int drm_atomic_helper_swap_state(struct drm_atomic_state *state, bool stall) { - int i; - long ret; + int i, ret; struct drm_connector *connector; struct drm_connector_state *old_conn_state, *new_conn_state; struct drm_crtc *crtc; @@ -2168,12 +2167,11 @@ int drm_atomic_helper_swap_state(struct drm_atomic_state *state, if (!commit) continue; - ret = wait_for_completion_timeout(&commit->hw_done, - 10*HZ); - if (ret == 0) - DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n", - crtc->base.id, crtc->name); + ret = wait_for_completion_interruptible(&commit->hw_done); drm_crtc_commit_put(commit); + + if (ret) + return ret; } }