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 D83B9D41D69 for ; Thu, 11 Dec 2025 16:28:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A0FA10E844; Thu, 11 Dec 2025 16:28:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="BE/FUsKj"; dkim-atps=neutral Received: from lankhorst.se (lankhorst.se [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6EC010E844; Thu, 11 Dec 2025 16:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1765470529; bh=Mi72tZLkVY+OWZNlHhJHSloPqeEUuXErW5xRvyEChLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BE/FUsKjL78Ebpz8XOiV+4rjbmebWYtF0OfxtaQELhVic+p59skGwBnutCUEaQ0Br eJzAOM8Q6fz3/lNPgb0jdpndzXRqPywp1VaNWNrgkhH00FM31qvLUV30RGP3oVs1je yb8Lu2kZyAHpgvOq6y5ih+wtsxaJfToNfotcuAlkgq9VMOVHDR11QX/vzSQKN9yL5W jeAlAuX5fQKIJFvPR9YioijWcbnh0DgUszEHKDCuPshX109DwdqHAbgdFbhDJBKd09 7W+UvJZfRu7+i8/gfci1qahh9uOgrUYKK/i+6wZDrxz5UtzihUGdEsw2h8PAqnurNU 12sMaq2XsheAw== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: Sebastian Andrzej Siewior , Maarten Lankhorst , Uma Shankar Subject: [PATCH 5/9] drm/i915/display: Move vblank put until after critical section Date: Thu, 11 Dec 2025 17:19:28 +0100 Message-ID: <20251211161923.843758-16-dev@lankhorst.se> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251211161923.843758-11-dev@lankhorst.se> References: <20251211161923.843758-11-dev@lankhorst.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 Reviewed-by: Uma Shankar --- 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 2c5d917fbd7e9..3e84a2078a0a7 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