mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Tomasz Pakuła" <tomasz.pakula.oficjalny@gmail.com>
To: alexander.deucher@amd.com, harry.wentland@amd.com, sunpeng.li@amd.com
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	siqueira@igalia.com, dri-devel@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	tomasz.pakula.oficjalny@gmail.com, bernhard.berger@gmail.com,
	michel.daenzer@mailbox.org, daniel@fooishbar.org
Subject: [PATCH v2 04/19] drm/amd/display: Use bigger VRR range if found in AMD vsdb
Date: Sun, 25 Jan 2026 19:38:59 +0100	[thread overview]
Message-ID: <20260125183914.459228-5-tomasz.pakula.oficjalny@gmail.com> (raw)
In-Reply-To: <20260125183914.459228-1-tomasz.pakula.oficjalny@gmail.com>

[Why]
Some monitors only expose their full VRR range in AMD vsdb for some
reason.

[How]
Compare exposed ranges and use the bigger one.

This check could be merged with the previous one but it's better to keep
them separate to easily convey their meaning.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4177
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e4f4d6ba09c3..68a59275dead 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -13221,6 +13221,18 @@ static bool copy_range_to_amdgpu_connector(struct drm_connector *conn)
 	return is_freesync_capable(range);
 }
 
+/*
+ * Returns true if range from AMD vsdb is bigger
+ */
+static bool compare_ranges(struct drm_connector *conn,
+			   struct amdgpu_hdmi_vsdb_info *vsdb)
+{
+	struct drm_monitor_range_info *range = &conn->display_info.monitor_range;
+
+	return (vsdb->max_refresh_rate_hz - vsdb->min_refresh_rate_hz) >
+	       (range->max_vfreq - range->min_vfreq);
+}
+
 /**
  * amdgpu_dm_update_freesync_caps - Update Freesync capabilities
  *
@@ -13294,6 +13306,10 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
 		if (valid_vsdb_cea && is_monitor_range_invalid(connector))
 			monitor_range_from_vsdb(connector, &vsdb_info);
 
+		/* Use bigger range if found in AMD vsdb */
+		if (valid_vsdb_cea && compare_ranges(connector, &vsdb_info))
+			monitor_range_from_vsdb(connector, &vsdb_info);
+
 		if (dpcd_caps.allow_invalid_MSA_timing_param)
 			freesync_capable = copy_range_to_amdgpu_connector(connector);
 
-- 
2.52.0


  parent reply	other threads:[~2026-01-25 18:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 18:38 [PATCH v2 00/19] drm/amd: VRR fixes, HDMI Gaming Features Tomasz Pakuła
2026-01-25 18:38 ` [PATCH v2 01/19] drm/amd/display: Return if DisplayID not found in parse_amd_vsdb() Tomasz Pakuła
2026-01-25 18:38 ` [PATCH v2 02/19] drm/amd/display: Refactor amdgpu_dm_update_freesync_caps() Tomasz Pakuła
2026-01-25 18:38 ` [PATCH v2 03/19] drm/amd/display: Check for VRR range in CEA AMD vsdb Tomasz Pakuła
2026-01-25 18:38 ` Tomasz Pakuła [this message]
2026-01-25 18:39 ` [PATCH v2 05/19] drm/amd/display: Refactor PCON VRR compatibility check Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 06/19] drm/amd/display: Add PCON VRR ID check override Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 07/19] drm/amd/display: Add CH7218 PCON ID Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 08/19] drm/edid: Parse more info from HDMI Forum vsdb Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 09/19] drm/amd/display: Rename PCON adaptive sync types Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 10/19] drm/amd/display: Enable HDMI VRR over PCON Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 11/19] drm/amd/display: Support HDMI VRRmax=0 Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 12/19] drm/amd/display: Build HDMI vsif in correct slot Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 13/19] drm/amd/display: Save HDMI gaming info to edid caps Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 14/19] drm/amd/display: Restore ALLM support in HDMI vsif Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 15/19] drm/amd/display: Trigger ALLM if it's available Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 16/19] drm/amd/display: Add parameter to control ALLM behavior Tomasz Pakuła
2026-01-26 14:07   ` kernel test robot
2026-01-26 14:38   ` kernel test robot
2026-01-25 18:39 ` [PATCH v2 17/19] drm/amd/display: Reintroduce VTEM info frame Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 18/19] drm/amd/display: Enable HDMI VRR Tomasz Pakuła
2026-01-25 18:39 ` [PATCH v2 19/19] drm/amd/display: Add HDMI VRR desktop mode Tomasz Pakuła

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260125183914.459228-5-tomasz.pakula.oficjalny@gmail.com \
    --to=tomasz.pakula.oficjalny@gmail.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bernhard.berger@gmail.com \
    --cc=daniel@fooishbar.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunpeng.li@amd.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®