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 0B7B5D49228 for ; Fri, 12 Dec 2025 13:02:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FDB210E760; Fri, 12 Dec 2025 13:02:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="lCl1eEdy"; dkim-atps=neutral Received: from lankhorst.se (lankhorst.se [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id E70C510E34A; Fri, 12 Dec 2025 13:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1765544541; bh=ljdH+hDI0eSDgcq0NlQSCPKmrCPd8ts57wYujzpvmhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCl1eEdyclXvTM/zFPOpNgpK1bFyTrUEkR4xSGHhX2AadyPDk9iY8/PENpDIZVHug dobaeCLfxPbfxj1gKGJT1m9MZourHtpOMevnHCDJMz5xYapUs2Un5mEDWAgU8uYInI K52DDyQDC+hwONyCF+xqRiBrI8dIFz1QxacQjEEDYpXrB7Ztzx1MV9c++/ORX8msOm +34FyaKicFsG+AHy7/s/TCF1WfQhUIrk/anqAvnGEFm42b0ZDgE7r00RO5uyac/Sie /1pwLS1MGYKXLVqi25vikcWCmH1oq9jucuJ0BmfrbFpb3uRl7Kw+kJe4gDnwrryJrL 2GQHp0LVgyPnw== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Sebastian Andrzej Siewior , Maarten Lankhorst Subject: [PATCH 07/11] drm/i915/display: Handle vlv dsi workaround in scanline_in_safe_range too Date: Fri, 12 Dec 2025 14:02:13 +0100 Message-ID: <20251212130205.963029-20-dev@lankhorst.se> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251212130205.963029-13-dev@lankhorst.se> References: <20251212130205.963029-13-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 f72da4099119c..0261baed14615 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -712,6 +712,24 @@ static bool scanline_in_safe_range(struct intel_vblank_evade_ctx *evade, int *sc { *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; } @@ -742,24 +760,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