Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: clarify DC checks

There are several places where we don't want to check
if a particular asic could support DC, but rather, if
DC is enabled. Set a flag if DC is enabled and check
for that rather than if a device supports DC or not.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+25 -21
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1065 1065 struct work_struct reset_work; 1066 1066 1067 1067 bool job_hang; 1068 + bool dc_enabled; 1068 1069 }; 1069 1070 1070 1071 static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
··· 847 847 struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif; 848 848 849 849 if (atif->notifications.brightness_change) { 850 - if (amdgpu_device_has_dc_support(adev)) { 850 + if (adev->dc_enabled) { 851 851 #if defined(CONFIG_DRM_AMD_DC) 852 852 struct amdgpu_display_manager *dm = &adev->dm; 853 853
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
··· 1969 1969 amdgpu_ta_if_debugfs_init(adev); 1970 1970 1971 1971 #if defined(CONFIG_DRM_AMD_DC) 1972 - if (amdgpu_device_has_dc_support(adev)) 1972 + if (adev->dc_enabled) 1973 1973 dtn_debugfs_init(adev); 1974 1974 #endif 1975 1975
+17 -15
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 4224 4224 4225 4225 amdgpu_ras_resume(adev); 4226 4226 4227 - /* 4228 - * Most of the connector probing functions try to acquire runtime pm 4229 - * refs to ensure that the GPU is powered on when connector polling is 4230 - * performed. Since we're calling this from a runtime PM callback, 4231 - * trying to acquire rpm refs will cause us to deadlock. 4232 - * 4233 - * Since we're guaranteed to be holding the rpm lock, it's safe to 4234 - * temporarily disable the rpm helpers so this doesn't deadlock us. 4235 - */ 4227 + if (adev->mode_info.num_crtc) { 4228 + /* 4229 + * Most of the connector probing functions try to acquire runtime pm 4230 + * refs to ensure that the GPU is powered on when connector polling is 4231 + * performed. Since we're calling this from a runtime PM callback, 4232 + * trying to acquire rpm refs will cause us to deadlock. 4233 + * 4234 + * Since we're guaranteed to be holding the rpm lock, it's safe to 4235 + * temporarily disable the rpm helpers so this doesn't deadlock us. 4236 + */ 4236 4237 #ifdef CONFIG_PM 4237 - dev->dev->power.disable_depth++; 4238 + dev->dev->power.disable_depth++; 4238 4239 #endif 4239 - if (!amdgpu_device_has_dc_support(adev)) 4240 - drm_helper_hpd_irq_event(dev); 4241 - else 4242 - drm_kms_helper_hotplug_event(dev); 4240 + if (!adev->dc_enabled) 4241 + drm_helper_hpd_irq_event(dev); 4242 + else 4243 + drm_kms_helper_hotplug_event(dev); 4243 4244 #ifdef CONFIG_PM 4244 - dev->dev->power.disable_depth--; 4245 + dev->dev->power.disable_depth--; 4245 4246 #endif 4247 + } 4246 4248 adev->in_suspend = false; 4247 4249 4248 4250 if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D0))
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
··· 549 549 */ 550 550 if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) && 551 551 amdgpu_bo_support_uswc(bo_flags) && 552 - amdgpu_device_has_dc_support(adev) && 552 + adev->dc_enabled && 553 553 adev->mode_info.gpu_vm_support) 554 554 domain |= AMDGPU_GEM_DOMAIN_GTT; 555 555 #endif ··· 1316 1316 "dither", 1317 1317 amdgpu_dither_enum_list, sz); 1318 1318 1319 - if (amdgpu_device_has_dc_support(adev)) { 1319 + if (adev->dc_enabled) { 1320 1320 adev->mode_info.abm_level_property = 1321 1321 drm_property_create_range(adev_to_drm(adev), 0, 1322 1322 "abm level", 0, 4);
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 2471 2471 if (ret) 2472 2472 return ret; 2473 2473 2474 - if (amdgpu_device_has_dc_support(adev)) { 2474 + if (adev->dc_enabled) { 2475 2475 struct drm_crtc *crtc; 2476 2476 2477 2477 drm_for_each_crtc(crtc, drm_dev) {
+1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4592 4592 adev_to_drm(adev)->dev, 4593 4593 &dev_attr_s3_debug); 4594 4594 #endif 4595 + adev->dc_enabled = true; 4595 4596 4596 4597 return 0; 4597 4598 }
+1 -1
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
··· 1508 1508 struct pp_hwmgr *hwmgr = handle; 1509 1509 struct amdgpu_device *adev = hwmgr->adev; 1510 1510 1511 - if (!amdgpu_device_has_dc_support(adev)) { 1511 + if (!adev->dc_enabled) { 1512 1512 amdgpu_dpm_get_active_displays(adev); 1513 1513 adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtc_count; 1514 1514 adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev);