From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6A33CCFA08 for ; Mon, 3 Nov 2025 17:46:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88F7110E4BC; Mon, 3 Nov 2025 17:46:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="hisoVKcZ"; dkim-atps=neutral Received: from lankhorst.se (lankhorst.se [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 05FEC10E4B8 for ; Mon, 3 Nov 2025 17:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1762192012; bh=ayTfIiXKSdAI7v9LVwmS0rL6yyY/P57eSpD8YoJWyyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hisoVKcZXNonHxhw3vU1eLYsy9YbmDV0UEcTE5TiyRTun0J7YYewkwfnbVTT0YhIR pmnZ3D2oxGXwZYbC5g3zFeaZDclQjP6yQTAxabye9Cd/6cJJYgmJLNSQRzKMgV1Goz ZzBzeNSxR0QKLBJ24d0vw04hOyk+eDhRa+Xr8wtKpT5r5J9l5ewuMV6vJ4m9cWW0DL y5zpnNncxwnkdpLpzKBe0dt0e3zYcm2NGIHR4iRRA1PPfNeqaKy+v0P1YgdnvxZ67m 8cpSrCjDjI212O52IhtJssUSnGZVgAccxoq4Bs7sbOdCwRI3M/J7jupkMaGVCIAkmO gy1ZD491phTlA== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org Cc: Maarten Lankhorst , Mario Kleiner , Mike Galbraith , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH 3/7] drm/i915/display: Move vblank put until after critical section Date: Mon, 3 Nov 2025 18:47:06 +0100 Message-ID: <20251103174718.139798-4-dev@lankhorst.se> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251103174718.139798-1-dev@lankhorst.se> References: <20251103174718.139798-1-dev@lankhorst.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" drm_crtc_vblank_put may take some locks, this should probably not be the first thing we do after entering the time sensitive part. A better place is after programming is completed. Add a flag to put the vblank after completion. In the case of drm_vblank_work_schedule, we may not even need to disable the vblank interrupt any more if it takes its own reference. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/i915/display/intel_cursor.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c index 7aa14348aa6d4..6b3bc8d94e51a 100644 --- a/drivers/gpu/drm/i915/display/intel_cursor.c +++ b/drivers/gpu/drm/i915/display/intel_cursor.c @@ -816,6 +816,7 @@ intel_legacy_cursor_update(struct drm_plane *_plane, to_intel_crtc_state(crtc->base.state); struct intel_crtc_state *new_crtc_state; struct intel_vblank_evade_ctx evade; + bool has_vblank = false; int ret; /* @@ -913,6 +914,8 @@ intel_legacy_cursor_update(struct drm_plane *_plane, intel_psr_lock(crtc_state); if (!drm_WARN_ON(display->drm, drm_crtc_vblank_get(&crtc->base))) { + has_vblank = true; + /* * TODO: maybe check if we're still in PSR * and skip the vblank evasion entirely? @@ -922,8 +925,6 @@ intel_legacy_cursor_update(struct drm_plane *_plane, local_irq_disable(); intel_vblank_evade(&evade); - - drm_crtc_vblank_put(&crtc->base); } else { local_irq_disable(); } @@ -939,6 +940,9 @@ intel_legacy_cursor_update(struct drm_plane *_plane, intel_psr_unlock(crtc_state); + if (has_vblank) + drm_crtc_vblank_put(&crtc->base); + if (old_plane_state->ggtt_vma != new_plane_state->ggtt_vma) { drm_vblank_work_init(&old_plane_state->unpin_work, &crtc->base, intel_cursor_unpin_work); -- 2.51.0