drm/amdgpu/display: add quirk handling for stutter mode
authorjsg <jsg@openbsd.org>
Mon, 1 Aug 2022 16:01:50 +0000 (16:01 +0000)
committerjsg <jsg@openbsd.org>
Mon, 1 Aug 2022 16:01:50 +0000 (16:01 +0000)
From Alex Deucher
8bae037b0fb429466fed1585440f337396d72efa in linux 5.15.y/5.15.58
3ce51649cdf23ab463494df2bd6d1e9529ebdc6a in mainline linux

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

index b905e16..d00bae5 100644 (file)
@@ -1315,6 +1315,37 @@ static struct hpd_rx_irq_offload_work_queue *hpd_rx_irq_create_workqueue(struct
        return hpd_rx_offload_wq;
 }
 
+struct amdgpu_stutter_quirk {
+       u16 chip_vendor;
+       u16 chip_device;
+       u16 subsys_vendor;
+       u16 subsys_device;
+       u8 revision;
+};
+
+static const struct amdgpu_stutter_quirk amdgpu_stutter_quirk_list[] = {
+       /* https://bugzilla.kernel.org/show_bug.cgi?id=214417 */
+       { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+       { 0, 0, 0, 0, 0 },
+};
+
+static bool dm_should_disable_stutter(struct pci_dev *pdev)
+{
+       const struct amdgpu_stutter_quirk *p = amdgpu_stutter_quirk_list;
+
+       while (p && p->chip_device != 0) {
+               if (pdev->vendor == p->chip_vendor &&
+                   pdev->device == p->chip_device &&
+                   pdev->subsystem_vendor == p->subsys_vendor &&
+                   pdev->subsystem_device == p->subsys_device &&
+                   pdev->revision == p->revision) {
+                       return true;
+               }
+               ++p;
+       }
+       return false;
+}
+
 static int amdgpu_dm_init(struct amdgpu_device *adev)
 {
        struct dc_init_data init_data;
@@ -1423,6 +1454,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
        if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY)
                adev->dm.dc->debug.disable_stutter = amdgpu_pp_feature_mask & PP_STUTTER_MODE ? false : true;
+       if (dm_should_disable_stutter(adev->pdev))
+               adev->dm.dc->debug.disable_stutter = true;
 
        if (amdgpu_dc_debug_mask & DC_DISABLE_STUTTER)
                adev->dm.dc->debug.disable_stutter = true;