From patchwork Fri Jun 14 04:25:57 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: 13697873 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 88052C27C6E for ; Fri, 14 Jun 2024 04:26:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B1F210EC20; Fri, 14 Jun 2024 04:26:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="XOric4Ey"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD6D910EC20; Fri, 14 Jun 2024 04:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718339156; x=1749875156; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/mARJ/PA1cJ2osPuLnWluKW1i6Ht0hnII8eJ6E6Qeqk=; b=XOric4EyPhTI4aedx4lysSS2Xyc5XpMM4NqJ0O0rShJgT/vDxXPvuHUl EJpmqm/HEaoifU1uj21GRco6V2Z6odpg6NSKr9fqLYS01ep8ITdheGR5T JAFJHXNxQlTQ66gDmDNYO1SZWQxtl4K6GhlGc/ooPU2sBF2If54jGE1Tq xtbiCzd/uq2zzlpoD2hDZ94AK9uPPuseveYL5hhld3sXMdIKk9B8V4wDl IbTybcWRIaaPhE0BBhavt/hU3H08JQcGwpq0/0h/plCl7fftaDnbApR/n nonmNgzFY0En9yOoRsrlFt3xhNjBGDDHxbHutPE/6Q86u/5G3jJAVQBPL w==; X-CSE-ConnectionGUID: Sn8LAtocRjWSwj+7INUS0Q== X-CSE-MsgGUID: sajEFAnRRc+fQegILCuk4A== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="37731521" X-IronPort-AV: E=Sophos;i="6.08,236,1712646000"; d="scan'208";a="37731521" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2024 21:25:51 -0700 X-CSE-ConnectionGUID: FBGfw/sBQY6FHbo8ei2qCQ== X-CSE-MsgGUID: vV4qXGLsTBOEsSkdMFRgrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,236,1712646000"; d="scan'208";a="40343360" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa008.fm.intel.com with ESMTP; 13 Jun 2024 21:25:48 -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, lucas.demarchi@intel.com Subject: [PATCH v2 1/2] drm/dp: Describe target_rr_divider in struct drm_dp_as_sdp Date: Fri, 14 Jun 2024 09:55:57 +0530 Message-ID: <20240614042558.376983-2-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240614042558.376983-1-mitulkumar.ajitkumar.golani@intel.com> References: <20240614042558.376983-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 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" Describe newly added parameter target_rr_divider in struct drm_dp_as_sdp. -v2: Remove extra line from commit message.(Lucas) 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 Fri Jun 14 04:25:58 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: 13697872 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 4E896C27C77 for ; Fri, 14 Jun 2024 04:26:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5656A10EC23; Fri, 14 Jun 2024 04:26:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mLxAbu0S"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id A21C310EC1D; Fri, 14 Jun 2024 04:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718339156; x=1749875156; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lrgk9n6nepoKyXCF6DFOP2mNFLE1mOcFS0wZHogcQMs=; b=mLxAbu0StNuZakrL2PdES8W/DrGDjQwbGyE6+whkizgRbyMC2o6qmN/l M3DYYVYJZiLahlrESxpEqVNMMiJ3Qfj0pr0kp6N0olTUNi9Sbu5/H4br1 2rnMoSF0h/Vc21RAz+h9Y8OCavMvL/q/N+E1JlxtHsiDWQnigrORBO37T 0NpWMODWd5azSxkMv11oZnz/bFHm+9GRitfBz8vdjXifLAyikEPsv+Ash 7DuIETxj7baer8qyFkufFfntyLQMd+cPr4D6Sl5AjhUjKqWRBx/ZUn1Ye ueE9q4SksiojTyE7cKagkOsqpHjsGvJu4m7pnPteEFq/MUw85TZzBt08P A==; X-CSE-ConnectionGUID: hlv7j4BMQ4ilvn7hfkK/Pw== X-CSE-MsgGUID: u8GmVvxSSJSPvRoN/iipEw== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="37731526" X-IronPort-AV: E=Sophos;i="6.08,236,1712646000"; d="scan'208";a="37731526" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2024 21:25:54 -0700 X-CSE-ConnectionGUID: hI4hfTIvSCuqj5F8/MTLLQ== X-CSE-MsgGUID: 17UBm4znQmm8d9ojk9e2mg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,236,1712646000"; d="scan'208";a="40343373" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa008.fm.intel.com with ESMTP; 13 Jun 2024 21:25:51 -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, lucas.demarchi@intel.com Subject: [PATCH v2 2/2] drm/i915/display: Update calculation to avoid overflow Date: Fri, 14 Jun 2024 09:55:58 +0530 Message-ID: <20240614042558.376983-3-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240614042558.376983-1-mitulkumar.ajitkumar.golani@intel.com> References: <20240614042558.376983-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 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" Update calculation to avoid overflow. -v2: Remove extra line from commit message.(Lucas) 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;