drm/amd/display: Properly handle additional cases where DCN is not supported
authorjsg <jsg@openbsd.org>
Thu, 23 Feb 2023 02:24:10 +0000 (02:24 +0000)
committerjsg <jsg@openbsd.org>
Thu, 23 Feb 2023 02:24:10 +0000 (02:24 +0000)
From Alex Deucher
b4e79d0c7f9bb938525716b3e05cfca6418e2bae in linux-6.1.y/6.1.13
6fc547a5a2ef5ce05b16924106663ab92f8f87a7 in mainline linux

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

index e1c98e9..4f4ff31 100644 (file)
@@ -4528,6 +4528,17 @@ DEVICE_ATTR_WO(s3_debug);
 static int dm_early_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       struct amdgpu_mode_info *mode_info = &adev->mode_info;
+       struct atom_context *ctx = mode_info->atom_context;
+       int index = GetIndexIntoMasterTable(DATA, Object_Header);
+       u16 data_offset;
+
+       /* if there is no object header, skip DM */
+       if (!amdgpu_atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset)) {
+               adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
+               dev_info(adev->dev, "No object header, skipping DM\n");
+               return -ENOENT;
+       }
 
        switch (adev->asic_type) {
 #if defined(CONFIG_DRM_AMD_DC_SI)