Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1060060pxk; Mon, 31 Aug 2020 08:44:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxer4VZyhIhus2Je99yRwcnh6y2yO6UBMrkAlaJ6CRSzgygMx3EQRzBneU1TupSYwO4KgwJ X-Received: by 2002:a17:906:dc03:: with SMTP id yy3mr1737866ejb.380.1598888679011; Mon, 31 Aug 2020 08:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598888679; cv=none; d=google.com; s=arc-20160816; b=b0S9JLSqM8fvyNtFK+mRquQZJNVVn/SFdCXRgDZNu7V/WE1Lq6tEZ6xzkBZkJ4Zejc 7mJ2zALZ6PA0uTSTvsHCSou60ORAAf4LqG2EhLJOPF06seyVFCAQRNFJ4rIBTbCkkSTe 4QtiOE7IRw0WVTHAx8mfC9h0iGDD3o/FvZBEtcOy5te7CY5ooKrOa28GVlyjjU4XycdQ /wf9Ev+98ZFHEXzaad2ukRau7Aqz/ufHNDOqPTBXBQPWuxewNnaF0H9wU7iHqnSClrdY CSH4Pox/dH+LQ5/ARMf2Kq9ywVRiQJALH7Kig3ssZWoHCZ0WEIxO5jBVc17IApo4Qzn2 wSdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Lx0f1Z9vsvzuBozenOMY81jaxBASQLgdLid9/hxJtIA=; b=0QkCNI2McOOYB4oF7F9ryQitmDIFmOLt0vq3K2H8muemct2Lfq0VvaiThDqCpGq2Kk vDN5Q6QfrSOhBOqUp7ZFOhn22yvASnF09iGJfKtUaRcdIZfRNUg4LUzCCE1KSdSNsIl6 HNVE9K7eJBKjDLLg+7UvjwU9Tm2QxPUuyRnxORajuToqXNufkA49SHYO8gU8BfSVN6ze xxbiO9qPgCPyjD2kyl9RCYZsyQ9rCRuiAM8meBRQYXcZGH5egAiel7u4rN2GEgVPHuWW RNaU7VhLel4lv8SVgl3bkC0XXH6XD3tPinGH5ltnVbvQaQkVp5t5izwkrhVlCEkdKzHt Iy0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Vn84u4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si5002132edo.516.2020.08.31.08.44.15; Mon, 31 Aug 2020 08:44:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Vn84u4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729236AbgHaPkP (ORCPT + 99 others); Mon, 31 Aug 2020 11:40:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:38944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728483AbgHaP34 (ORCPT ); Mon, 31 Aug 2020 11:29:56 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 08C5320936; Mon, 31 Aug 2020 15:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887796; bh=8CtIqjoJ1SacnqIRXbMc/xIzgI0xr7BYm3qPaqxHkiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Vn84u4g4uuKK7vxNtGXaS1V/V/l1k4hJYevQKeTpOz3onfdRxk/8znuOi9ct0vLh wVSgHVPy5H5zNxUbO8uVdMRNzfFiVXeBUazq2J0nL4XClaKDxlvNp4pXOhr4hMcTCb 8dxTpuo9rYWkgdZ8Ut74A6kLauuRznSZVv2VTnCg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rob Clark , Stephen Boyd , Sasha Levin , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.8 13/42] drm/msm: enable vblank during atomic commits Date: Mon, 31 Aug 2020 11:29:05 -0400 Message-Id: <20200831152934.1023912-13-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831152934.1023912-1-sashal@kernel.org> References: <20200831152934.1023912-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark [ Upstream commit 43906812eaab06423f56af5cca9a9fcdbb4ac454 ] This has roughly the same effect as drm_atomic_helper_wait_for_vblanks(), basically just ensuring that vblank accounting is enabled so that we get valid timestamp/seqn on pageflip events. Signed-off-by: Rob Clark Tested-by: Stephen Boyd Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_atomic.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 5ccfad794c6a5..561bfa48841c3 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -27,6 +27,34 @@ int msm_atomic_prepare_fb(struct drm_plane *plane, return msm_framebuffer_prepare(new_state->fb, kms->aspace); } +/* + * Helpers to control vblanks while we flush.. basically just to ensure + * that vblank accounting is switched on, so we get valid seqn/timestamp + * on pageflip events (if requested) + */ + +static void vblank_get(struct msm_kms *kms, unsigned crtc_mask) +{ + struct drm_crtc *crtc; + + for_each_crtc_mask(kms->dev, crtc, crtc_mask) { + if (!crtc->state->active) + continue; + drm_crtc_vblank_get(crtc); + } +} + +static void vblank_put(struct msm_kms *kms, unsigned crtc_mask) +{ + struct drm_crtc *crtc; + + for_each_crtc_mask(kms->dev, crtc, crtc_mask) { + if (!crtc->state->active) + continue; + drm_crtc_vblank_put(crtc); + } +} + static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) { unsigned crtc_mask = BIT(crtc_idx); @@ -44,6 +72,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) kms->funcs->enable_commit(kms); + vblank_get(kms, crtc_mask); + /* * Flush hardware updates: */ @@ -58,6 +88,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) kms->funcs->wait_flush(kms, crtc_mask); trace_msm_atomic_wait_flush_finish(crtc_mask); + vblank_put(kms, crtc_mask); + mutex_lock(&kms->commit_lock); kms->funcs->complete_commit(kms, crtc_mask); mutex_unlock(&kms->commit_lock); @@ -221,6 +253,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) */ kms->pending_crtc_mask &= ~crtc_mask; + vblank_get(kms, crtc_mask); + /* * Flush hardware updates: */ @@ -235,6 +269,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) kms->funcs->wait_flush(kms, crtc_mask); trace_msm_atomic_wait_flush_finish(crtc_mask); + vblank_put(kms, crtc_mask); + mutex_lock(&kms->commit_lock); kms->funcs->complete_commit(kms, crtc_mask); mutex_unlock(&kms->commit_lock); -- 2.25.1