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 8A593C44500 for ; Fri, 26 Jun 2026 13:42:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48D6C10F5D2; Fri, 26 Jun 2026 13:42:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="aBDeioRM"; dkim-atps=neutral Received: from lankhorst.se (unknown [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A5B210F5C8; Fri, 26 Jun 2026 13:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1782481322; bh=urxsbtugd8+UdPADq6BZx60lq8D4HcydlFOp3SgwB5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aBDeioRMCjaOXgmlvEDqFb4NU9SJ00tgKfAC/gSHDNQwvnUo/9+D2v4iJ7Yl8w/Zd TV+3uItasmTMl5C+24wg6Q92JqsAvP+FmNwXcPtTioAE5cCOF1hk+461cmdFwELGUA xEyn2w1+yWSLYSSjmPptQ4q2hRpCULsrGl/KNHjn3ArHfu5UwNNOXYugAkYfGNwktq gdMvQmJzmdi2qmympFpmNBRegexKcxIOWcKcxU/rxAegdiJyv0QN9gwKfM9mW84v9W 2sGNoavxACGfrKgjQhn3MK0i9uxX61dThBe19yivzN/Cg71JED0qHIshuezBBxip/O JBXHQcEEjy7Cw== From: Maarten Lankhorst To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, Maarten Lankhorst , Uma Shankar Subject: [PATCH v10.5 07/29] drm/i915/display: Handle vlv dsi workaround in scanline_in_safe_range too Date: Fri, 26 Jun 2026 15:41:58 +0200 Message-ID: <20260626134222.1198252-8-dev@lankhorst.se> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260626134222.1198252-1-dev@lankhorst.se> References: <20260626134222.1198252-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 Reviewed-by: Uma Shankar --- 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 ca08059e088ea..6f1fa952b5391 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.53.0