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: 9814325 X-Patchwork-Delegate: agross@codeaurora.org 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 92322603F2 for ; Wed, 28 Jun 2017 13:38:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8537E28549 for ; Wed, 28 Jun 2017 13:38:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79CD52855A; Wed, 28 Jun 2017 13:38:12 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A561728549 for ; Wed, 28 Jun 2017 13:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751616AbdF1NiJ (ORCPT ); Wed, 28 Jun 2017 09:38:09 -0400 Received: from mblankhorst.nl ([141.105.120.124]:38165 "EHLO mblankhorst.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbdF1NiI (ORCPT ); Wed, 28 Jun 2017 09:38:08 -0400 From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org Cc: Maarten Lankhorst , Boris Brezillon , David Airlie , Daniel Vetter , Jani Nikula , Sean Paul , CK Hu , Philipp Zabel , Matthias Brugger , Rob Clark , Ben Skeggs , Thierry Reding , Jonathan Hunter , Jyri Sarha , Tomi Valkeinen , Eric Anholt , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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; } }