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 CA6BACAC591 for ; Thu, 11 Sep 2025 02:59:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9159610EA0B; Thu, 11 Sep 2025 02:59:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="IqfV7lGg"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C73710EA07; Thu, 11 Sep 2025 02:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757559581; x=1789095581; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fOfWU/xSh6h3EBCc0gCQgy/IT+uG3j5SxVJuUupuB1k=; b=IqfV7lGgTgWYgp8ziM7gVoVkMvb+H2tmzhaPMFNOjZvHcLVZOP256UX3 DEqu9BDwrM89gVoMIuoe0t005FqdxAVNhtc3y88LXFALuZ3sG3UI96jU9 TowAQQGWG52ZqfZL5jt4s4r+dsstHZ/DWLa4dcC76WqoArzWqdpUUUdeX jBKy78d643MlgXCCtbboBU4HBgx7t9Ar9FFzX3jC9Ym3QrnTgqoqdy8VX WY9pbgXMPy55+lvY0t324Qg9JMs2bAZLZS95RvzwvClclAQm5G170RCDK krus2K8QISIuoMhhaHrsSaS2zKpLU6+hJhpD9fgXN3GjxUlyB4MzOBtaE w==; X-CSE-ConnectionGUID: UTFCK+C2R9i9qynFhgLzWw== X-CSE-MsgGUID: bKvFGhmqQbGRhDIBz06AvQ== X-IronPort-AV: E=McAfee;i="6800,10657,11549"; a="85327080" X-IronPort-AV: E=Sophos;i="6.18,256,1751266800"; d="scan'208";a="85327080" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2025 19:59:41 -0700 X-CSE-ConnectionGUID: J4qZL2QGRzCZ7lgRZM+Ewg== X-CSE-MsgGUID: TgO07Zz8RVe5hqXjzGYG7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,256,1751266800"; d="scan'208";a="173955533" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2025 19:59:38 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ville.syrjala@linux.intel.com, Ankit Nautiyal , Mitul Golani Subject: [PATCH 08/15] drm/i915/vrr: Use vrr.sync_start for getting vtotal Date: Thu, 11 Sep 2025 08:15:47 +0530 Message-ID: <20250911024554.692469-9-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250911024554.692469-1-ankit.k.nautiyal@intel.com> References: <20250911024554.692469-1-ankit.k.nautiyal@intel.com> 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" Currently, in intel_vrr_get_config() crtc_vtotal is computed from vrr.vmin vtotal, since the VTOTAL.Vtotal bits are deprecated. Since vmin is currently set to crtc_vtotal, this gives us the vtotal. However, as we move to optimized guardband, vmin will be modified to set to the minimum Vtotal for highest refresh rate supported. Instead of depending on vmin, compute vtotal from crtc_vsync_start and vrr.vsync_start. This works since vrr.vsync_start is measured from the end of vblank, and crtc_vsync_start is measured from start of the scanline. Together their sum is equal to the crtc_vtotal. Signed-off-by: Ankit Nautiyal Reviewed-by: Mitul Golani --- drivers/gpu/drm/i915/display/intel_vrr.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index fd690de5b45b..855974174afd 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -735,17 +735,6 @@ void intel_vrr_get_config(struct intel_crtc_state *crtc_state) TRANS_VRR_VMAX(display, cpu_transcoder)) + 1; crtc_state->vrr.vmin = intel_de_read(display, TRANS_VRR_VMIN(display, cpu_transcoder)) + 1; - - /* - * For platforms that always use VRR Timing Generator, the VTOTAL.Vtotal - * bits are not filled. Since for these platforms TRAN_VMIN is always - * filled with crtc_vtotal, use TRAN_VRR_VMIN to get the vtotal for - * adjusted_mode. - */ - if (intel_vrr_always_use_vrr_tg(display)) - crtc_state->hw.adjusted_mode.crtc_vtotal = - intel_vrr_vmin_vtotal(crtc_state); - if (HAS_AS_SDP(display)) { trans_vrr_vsync = intel_de_read(display, @@ -755,6 +744,16 @@ void intel_vrr_get_config(struct intel_crtc_state *crtc_state) crtc_state->vrr.vsync_end = REG_FIELD_GET(VRR_VSYNC_END_MASK, trans_vrr_vsync); } + /* + * For platforms that always use VRR Timing Generator, the VTOTAL.Vtotal + * bits are not filled. Since vrr.vsync_start is computed as: + * crtc_vtotal - crtc_vsync_start, we can derive vtotal from + * vrr.vsync_start and crtc_vsync_start. + */ + if (intel_vrr_always_use_vrr_tg(display)) + crtc_state->hw.adjusted_mode.crtc_vtotal = + crtc_state->hw.adjusted_mode.crtc_vsync_start + + crtc_state->vrr.vsync_start; } vrr_enable = trans_vrr_ctl & VRR_CTL_VRR_ENABLE; -- 2.45.2