From patchwork Thu Jun 13 05:13:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13696126 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 BEE92C27C6E for ; Thu, 13 Jun 2024 05:14:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E00B310E0D1; Thu, 13 Jun 2024 05:14:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="HV9UcMPd"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id F308F10E0BA; Thu, 13 Jun 2024 05:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718255673; x=1749791673; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mm341tiMN5I5+gsGKHoOStTTQcHsvagZvFREtL06uyg=; b=HV9UcMPdLuKx3PTpkVeIIcqO35m79h7VS6s4CZVHtuvbdBzkQknAdhqt gRJVuClONCvIVIFW8K1PKvsNSKKf1g3vsKxVKDgnX4+8++26i8CiC/3aL kR8VeEa/rz3MOvf+AkKzjWLaSXAyOp7UZcdYLlwuse3ym8uzqA4FtSdJd IyxEYZbtAgZ9KWUSJ2t6kiCjfs8XJESVmw/NG8QtI4Dc2WV6pFMvGyhpA w8TIqDPqI0c7B4ZBmvN4HFMOuz5O2kMUfk2aP+I+dht9uq6XJs3yBitgA dOOwsd0LFHCfbCBM/MGu4NObwjdQnzcrE8RXC/1I5OXLKgPZGFjYr5Eqj A==; X-CSE-ConnectionGUID: c6WzzHRGSdq3J64/xs2JYw== X-CSE-MsgGUID: 1z4xw2s0RbeV2oHxgyK/gQ== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="14774876" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="14774876" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 22:13:10 -0700 X-CSE-ConnectionGUID: M746CE4cT1GMVA5Q7A4eeA== X-CSE-MsgGUID: uH//63J8S7K6fgwbVc5njQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40126100" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 22:13:09 -0700 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: mitulkumar.ajitkumar.golani@intel.com, ankit.k.nautiyal@intel.com, suraj.kandpal@intel.com, jani.nikula@linux.intel.com, sfr@canb.auug.org.au Subject: [PATCH 1/2] drm/dp: Describe target_rr_divider in struct drm_dp_as_sdp Date: Thu, 13 Jun 2024 10:43:16 +0530 Message-ID: <20240613051317.345753-2-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613051317.345753-1-mitulkumar.ajitkumar.golani@intel.com> References: <20240613051317.345753-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Describe newly added parameter target_rr_divider in struct drm_dp_as_sdp. Fixes: a20c6d954d75 ("drm/dp: Add refresh rate divider to struct representing AS SDP") Cc: Mitul Golani Cc: Arun R Murthy Cc: Suraj Kandpal Cc: Ankit Nautiyal Cc: Jani Nikula Cc: Stephen Rothwell Signed-off-by: Mitul Golani Reviewed-by: Ankit Nautiyal --- include/drm/display/drm_dp_helper.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index ea03e1dd26ba..7f2567fa230d 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -112,6 +112,7 @@ struct drm_dp_vsc_sdp { * @target_rr: Target Refresh * @duration_incr_ms: Successive frame duration increase * @duration_decr_ms: Successive frame duration decrease + * @target_rr_divider: Target refresh rate divider * @mode: Adaptive Sync Operation Mode */ struct drm_dp_as_sdp { From patchwork Thu Jun 13 05:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13696127 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 9482DC27C4F for ; Thu, 13 Jun 2024 05:14:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3D4610E102; Thu, 13 Jun 2024 05:14:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ha+RRgfv"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 80A4510E0E3; Thu, 13 Jun 2024 05:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718255674; x=1749791674; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OZBtXAMCtAdeOMqNCZ4pBFqxx7eEzPwFu88Hq+F5bS8=; b=ha+RRgfv++/B8bwdpmL3MshU81StM+qzw2Kyb8bNpveES102x3gX5qCP jldRCDTsb+X5nx73N1HgkP+JSx8POxitWB71pbhsaoyaIaKO/jHLmCXmu SZv/+Oj4eE+glk4CFxGv5xyN9acaKZgLDe8H/jh9jY/6Xg9fWBA8xNoi9 mo17CCT9f8WbwLXikLZ4IQCSbsVZnMSrB7TrlxPA5Y6Gb6D5Pe+uUFC1l Cs3kOiSUUjOSJd6KjH6aDk702tmTQ1Kj1zJYMQAjtytkqom2Kb4CfTrB/ Sa5a3etAjlZeCZLoBDDJHeQFJ0/jZEj+wp7bNcqBTnX8FLl3GYDwOZLoJ g==; X-CSE-ConnectionGUID: 3wJSfBN2Sde+kowNStX5aw== X-CSE-MsgGUID: v1yev2bCR1qYcN5E6prl4A== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="14774881" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="14774881" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 22:13:13 -0700 X-CSE-ConnectionGUID: KbF81kRJQiKCeY9AeezASQ== X-CSE-MsgGUID: 1SkBb4NiSCyrmOzWTTUmAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40126111" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 22:13:11 -0700 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: mitulkumar.ajitkumar.golani@intel.com, ankit.k.nautiyal@intel.com, suraj.kandpal@intel.com, jani.nikula@linux.intel.com, sfr@canb.auug.org.au Subject: [PATCH 2/2] drm/i915/display: Update calculation to avoid overflow Date: Thu, 13 Jun 2024 10:43:17 +0530 Message-ID: <20240613051317.345753-3-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613051317.345753-1-mitulkumar.ajitkumar.golani@intel.com> References: <20240613051317.345753-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Update calculation to avoid overflow. Fixes: 1676ecd303ac ("drm/i915: Compute CMRR and calculate vtotal") Cc: Mitul Golani Cc: Ankit Nautiyal Cc: Suraj Kandpal Cc: Jani Nikula Cc: Stephen Rothwell Signed-off-by: Mitul Golani Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_vrr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index eb5b62b54d32..6430da25957d 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -147,10 +147,11 @@ cmrr_get_vtotal(struct intel_crtc_state *crtc_state, bool video_mode_required) multiplier_n = 1000; } - crtc_state->cmrr.cmrr_n = - desired_refresh_rate * adjusted_mode->crtc_htotal * multiplier_n; - vtotal = (adjusted_mode->crtc_clock * 1000 * multiplier_n) / crtc_state->cmrr.cmrr_n; - adjusted_pixel_rate = adjusted_mode->crtc_clock * 1000 * multiplier_m; + crtc_state->cmrr.cmrr_n = mul_u32_u32(desired_refresh_rate * adjusted_mode->crtc_htotal, + multiplier_n); + vtotal = DIV_ROUND_UP_ULL(mul_u32_u32(adjusted_mode->crtc_clock * 1000, multiplier_n), + crtc_state->cmrr.cmrr_n); + adjusted_pixel_rate = mul_u32_u32(adjusted_mode->crtc_clock * 1000, multiplier_m); crtc_state->cmrr.cmrr_m = do_div(adjusted_pixel_rate, crtc_state->cmrr.cmrr_n); return vtotal;