drm/amd/display: handle range offsets in VRR ranges
authorjsg <jsg@openbsd.org>
Thu, 4 Apr 2024 07:48:59 +0000 (07:48 +0000)
committerjsg <jsg@openbsd.org>
Thu, 4 Apr 2024 07:48:59 +0000 (07:48 +0000)
From Alex Deucher
23b99c7bf6ecf643a4a37bd98eeae81323aef6f8 in linux-6.6.y/6.6.24
937844d661354bf142dc1c621396fdab10ecbacc in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 00d5f22..ff0e1ac 100644 (file)
@@ -10790,14 +10790,23 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
                                if (range->flags != 1)
                                        continue;
 
-                               amdgpu_dm_connector->min_vfreq = range->min_vfreq;
-                               amdgpu_dm_connector->max_vfreq = range->max_vfreq;
-                               amdgpu_dm_connector->pixel_clock_mhz =
-                                       range->pixel_clock_mhz * 10;
-
                                connector->display_info.monitor_range.min_vfreq = range->min_vfreq;
                                connector->display_info.monitor_range.max_vfreq = range->max_vfreq;
 
+                               if (edid->revision >= 4) {
+                                       if (data->pad2 & DRM_EDID_RANGE_OFFSET_MIN_VFREQ)
+                                               connector->display_info.monitor_range.min_vfreq += 255;
+                                       if (data->pad2 & DRM_EDID_RANGE_OFFSET_MAX_VFREQ)
+                                               connector->display_info.monitor_range.max_vfreq += 255;
+                               }
+
+                               amdgpu_dm_connector->min_vfreq =
+                                       connector->display_info.monitor_range.min_vfreq;
+                               amdgpu_dm_connector->max_vfreq =
+                                       connector->display_info.monitor_range.max_vfreq;
+                               amdgpu_dm_connector->pixel_clock_mhz =
+                                       range->pixel_clock_mhz * 10;
+
                                break;
                        }