From patchwork Wed Feb 28 15:11:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 129996 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp1647568edc; Wed, 28 Feb 2018 07:11:52 -0800 (PST) X-Google-Smtp-Source: AH8x225Xl96Le9G+zda4/E6XkH6kh4ssiNY3RErTEuwP+5lCm7PEYN0tZpbxIj1Ce3SfnhYwJyQk X-Received: by 10.101.97.135 with SMTP id c7mr14425854pgv.425.1519830712027; Wed, 28 Feb 2018 07:11:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519830712; cv=none; d=google.com; s=arc-20160816; b=oJX1u7HETmUb+hfEGMQAXvLNUOQDtZ2PGHcs+upAxnmRuASbOLDYzPtdtHhLO3DU5q 2htU7N71JVovAnDJ1orJXlebqOkJd+d7IHLqmYOfSYeTHJqycCqfpl/EL3zqxbKMwWOa xfA4wuPXGr082LVgbfJJiWF4g86STY3gTKe6kXY0kv/4ESCRCYb7QzkSCx5Bii9DVnCM 7p1HNoft74KhNWNXqTcYZ/4GW0dE5k7+b2hfTalVKUXIpSgq+lD4iMu2/GZmDXWM/YNy hENt9YIBtAuLIRyhB+3OQa+VBPYdKXGD6jYYHHcgO07/sAO9QyJG4i3QqRoDSdUesudd QFMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=OGTeSkEEKsBBGyf3vwvjZA13YvunmiY5vMqAJRs/0J0=; b=l4dTFdTm+BqyxqIv9snd3wLU/8uAwECK0UGuLCded5nb6u+JgVM4+nAgR9Mjsi8M7G mpRgLpp7yt8F9y80vWV4VWXWcfGxfwcvwRbkNQFVT7N2RAbBJuAc3TRir9bA4K1G37U8 AoKo71f70rLx35AT2Jiu5Y2r+0LONMAV38EEYD4jojT2tOdtQ6l02AphYy+5QEsblFqa KGX9/t5cFtdom8dIjtuF2RqHxm1xbpuSDQ7Qv1+oXtvoig768Ubz2fcxiQzbdL01RLH+ e8Wrk2bO5kZ1EAq7N6TgO+UKYRiLWFmq0UYJn6KjEJUuREsUtHaC0LpMiDxFTbMSZ5SR sBGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t11-v6si1428997plr.411.2018.02.28.07.11.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 07:11:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9C826E979; Wed, 28 Feb 2018 15:11:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 318 seconds by postgrey-1.36 at gabe; Wed, 28 Feb 2018 15:11:48 UTC Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4039E6E979 for ; Wed, 28 Feb 2018 15:11:48 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.15]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w1SFBiKW006031; Wed, 28 Feb 2018 15:11:44 GMT From: Liviu Dudau To: DRI-devel Subject: [PATCH] drm/arm: mali-dp: Reorder atomic_commit_hw_done to avoid waiting on wrong vblank event Date: Wed, 28 Feb 2018 15:11:44 +0000 Message-Id: <20180228151144.21209-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.16.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ayan Halder , Liviu Dudau , Alexandru-Cosmin Gheorghe , Mali DP Maintainers MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" mali-dp driver sets the 'go' bit (config_valid) and then waits for confirmation from the hardware that the config has been updated before arming the vblank event. The issue is that config_valid is actually asserted by the hardware after vblank event, during the prefetch phase, so when arming the vblank event we are going to wait on the wrong vblank. Fix it by arming the vblank event first and then setting the config_valid bit. That way the event will be signalled for the correct vblank interrupt. Reported-by: Alexandru-Cosmin Gheorghe Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_drv.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index d88a3b9d59cc..ac44c6127a4f 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -189,12 +189,6 @@ static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state) struct drm_device *drm = state->dev; struct malidp_drm *malidp = drm->dev_private; - if (malidp->crtc.enabled) { - /* only set config_valid if the CRTC is enabled */ - if (malidp_set_and_wait_config_valid(drm)) - DRM_DEBUG_DRIVER("timed out waiting for updated configuration\n"); - } - event = malidp->crtc.state->event; if (event) { malidp->crtc.state->event = NULL; @@ -206,6 +200,12 @@ static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state) drm_crtc_send_vblank_event(&malidp->crtc, event); spin_unlock_irq(&drm->event_lock); } + if (malidp->crtc.enabled) { + /* only set config_valid if the CRTC is enabled */ + if (malidp_set_and_wait_config_valid(drm)) + DRM_DEBUG_DRIVER("timed out waiting for updated configuration\n"); + } + drm_atomic_helper_commit_hw_done(state); } @@ -232,8 +232,6 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state) malidp_atomic_commit_hw_done(state); - drm_atomic_helper_wait_for_vblanks(drm, state); - pm_runtime_put(drm->dev); drm_atomic_helper_cleanup_planes(drm, state);