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 BDE8AD6E2B2 for ; Thu, 18 Dec 2025 16:33:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4642B10EA5F; Thu, 18 Dec 2025 16:33:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="d64QBk7g"; dkim-atps=neutral Received: from lankhorst.se (lankhorst.se [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 933F510EA52; Thu, 18 Dec 2025 16:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1766075617; bh=Mi72tZLkVY+OWZNlHhJHSloPqeEUuXErW5xRvyEChLQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d64QBk7gVOwNRFGfTu2cNxiWnKNTJBD1gu4OkWDQPB3GaZP7ythwp4AaJZokfNV0X fcxjQ8ygOxrgSwJoij8e/h2Bl8fjvRFsdZnQ5lpzSxBz65IFI3qc6S/LZCdGLOFKnb Ec4JKOWBuFylSVOBpIqyD6LIGDLnr0hRV0JyCN6VblufmY/a8c0XZCl+/MifC3cD3H qV7VjTvEmIJnK7Zo8EPXvE10RxQSYvDOdJKyLjQC1m3KEHrBHxgTtuIZif0AhEl02C MYKgN5AaEBrNr0sRGhRjybdDX/gea2eLizG7pHdQVlrBBii8Q1Omj/H1Ti4AuyGxLH lwLfZg583mCQg== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [i915-rt v4 05/20] drm/i915/display: Move vblank put until after critical section Date: Thu, 18 Dec 2025 17:33:53 +0100 Message-ID: <20251218163408.97508-6-dev@lankhorst.se> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251218163408.97508-1-dev@lankhorst.se> References: <20251218163408.97508-1-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