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 08F77C4453D for ; Wed, 21 Jan 2026 13:53:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDF5810E7DC; Wed, 21 Jan 2026 13:53:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="l+MFLoex"; dkim-atps=neutral Received: from lankhorst.se (lankhorst.se [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC8A010E7D0; Wed, 21 Jan 2026 13:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1769003616; bh=YRoiYfqTq+DjVXL78bFsvN6yf5U7bvy7F2CzrQJxi5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+MFLoexQCNcVqU0rLcePQpsRta/fdn3k/QevfFVaN4MdEn/wThRntyQjgAQnaVgT hZ4MnYO0DS37PJF12MqBv8dPHNSvegaBAR2K0zTNNhgzzF/sdq1ofkRa+GxM2gs+up qwu7tS90cZWP2KVWo5iATuG7KFic58nWYjVoV2rNLnzh1YmR0oSlkJLZA8tIYsEKfS 5pmGMRbiaHB5TH6aq7S0fDbgbLtAnPIycoipdfP0o0OI2EaFxlzXbzgUTyOKQNfQPT /smwGUnj6hnUk12nOKhs2BdOMZ3TqZLeTckjpiAYCmrXvF+6u8yDA8t6b0bLNUx/h4 12YMF9VMfIl2Q== From: Maarten Lankhorst To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Maarten Lankhorst Subject: [i915-rt v5 07/21] drm/i915/display: Handle vlv dsi workaround in scanline_in_safe_range too Date: Wed, 21 Jan 2026 14:53:03 +0100 Message-ID: <20260121135318.651622-8-dev@lankhorst.se> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260121135318.651622-1-dev@lankhorst.se> References: <20260121135318.651622-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" 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 58c374a7530fe..6bc784563a7c1 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -739,6 +739,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; } @@ -769,24 +787,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