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 19B4FD6E2B3 for ; Thu, 18 Dec 2025 16:33:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9ECED10EA69; Thu, 18 Dec 2025 16:33:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="K0h7HskZ"; dkim-atps=neutral Received: from lankhorst.se (lankhorst.se [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CCA310EA63; Thu, 18 Dec 2025 16:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1766075620; bh=6nHfLCV0ds0yjPzVJSi07ejEkPqchX7aWxMrbWVbMPk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K0h7HskZqtBfCKb1UyQ7ZhsD6SoGUUR3+qOotVt2J9PltvN/KrTjufNUrCBV3vCG+ J6lzX84pmxJZ+KBOWWmy/c5V7f6JxHD4ssuaXqYyF0uaJv8A1wHg9KO5LJUiMsscQd mAFEn9Ms/vfy7nrXxEkSaDkJ03DFhq9wwSMUVsmY/Di2dofhzxE/LtTogs41IA2Vho F1EF+1BaDXAst+qKZFQTsM2TW2GY5rCtOh+uaIu91LnkjlNtTFe4RelLiuhuMTPsA/ GoSLilOf1OjLzl+8pka+mEywOwVjY9W/0DecpHFJDM23cXaTDhSuGZxlagsnttBvEQ SZeGkABFga+6Q== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [i915-rt v4 07/20] drm/i915/display: Handle vlv dsi workaround in scanline_in_safe_range too Date: Thu, 18 Dec 2025 17:33:55 +0100 Message-ID: <20251218163408.97508-8-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" Now that we have a macro, might as well handle the VLV dsi workaround too. This makes the vblank evasion code slightly more deterministic, by not looping with interrupts disabled. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/i915/display/intel_vblank.c | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c index 289f390762b7c..d700fd04cb407 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -715,6 +715,24 @@ static bool scanline_in_safe_range(struct intel_vblank_evade_ctx *evade, int *sc else *scanline = __intel_get_crtc_scanline(evade->crtc); + /* + * On VLV/CHV DSI the scanline counter would appear to + * increment approx. 1/3 of a scanline before start of vblank. + * The registers still get latched at start of vblank however. + * This means we must not write any registers on the first + * line of vblank (since not the whole line is actually in + * vblank). And unfortunately we can't use the interrupt to + * wait here since it will fire too soon. We could use the + * frame start interrupt instead since it will fire after the + * critical scanline, but that would require more changes + * in the interrupt code. So for now we'll just do the nasty + * thing and poll for the bad scanline to pass us by. + * + * FIXME figure out if BXT+ DSI suffers from this as well + */ + if (evade->need_vlv_dsi_wa && *scanline == evade->vblank_start) + return false; + return *scanline < evade->min || *scanline > evade->max; } @@ -745,24 +763,6 @@ int intel_vblank_evade(struct intel_vblank_evade_ctx *evade) local_irq_disable(); } - /* - * On VLV/CHV DSI the scanline counter would appear to - * increment approx. 1/3 of a scanline before start of vblank. - * The registers still get latched at start of vblank however. - * This means we must not write any registers on the first - * line of vblank (since not the whole line is actually in - * vblank). And unfortunately we can't use the interrupt to - * wait here since it will fire too soon. We could use the - * frame start interrupt instead since it will fire after the - * critical scanline, but that would require more changes - * in the interrupt code. So for now we'll just do the nasty - * thing and poll for the bad scanline to pass us by. - * - * FIXME figure out if BXT+ DSI suffers from this as well - */ - while (evade->need_vlv_dsi_wa && scanline == evade->vblank_start) - scanline = intel_get_crtc_scanline(crtc); - return scanline; } -- 2.51.0