Commit d09ef243 authored by Alex Deucher's avatar Alex Deucher

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: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a347ca97
...@@ -1065,6 +1065,7 @@ struct amdgpu_device { ...@@ -1065,6 +1065,7 @@ struct amdgpu_device {
struct work_struct reset_work; struct work_struct reset_work;
bool job_hang; bool job_hang;
bool dc_enabled;
}; };
static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev) static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
......
...@@ -847,7 +847,7 @@ int amdgpu_acpi_init(struct amdgpu_device *adev) ...@@ -847,7 +847,7 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif; struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif;
if (atif->notifications.brightness_change) { if (atif->notifications.brightness_change) {
if (amdgpu_device_has_dc_support(adev)) { if (adev->dc_enabled) {
#if defined(CONFIG_DRM_AMD_DC) #if defined(CONFIG_DRM_AMD_DC)
struct amdgpu_display_manager *dm = &adev->dm; struct amdgpu_display_manager *dm = &adev->dm;
......
...@@ -1969,7 +1969,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev) ...@@ -1969,7 +1969,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
amdgpu_ta_if_debugfs_init(adev); amdgpu_ta_if_debugfs_init(adev);
#if defined(CONFIG_DRM_AMD_DC) #if defined(CONFIG_DRM_AMD_DC)
if (amdgpu_device_has_dc_support(adev)) if (adev->dc_enabled)
dtn_debugfs_init(adev); dtn_debugfs_init(adev);
#endif #endif
......
...@@ -4224,25 +4224,27 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon) ...@@ -4224,25 +4224,27 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
amdgpu_ras_resume(adev); amdgpu_ras_resume(adev);
/* if (adev->mode_info.num_crtc) {
* Most of the connector probing functions try to acquire runtime pm /*
* refs to ensure that the GPU is powered on when connector polling is * Most of the connector probing functions try to acquire runtime pm
* performed. Since we're calling this from a runtime PM callback, * refs to ensure that the GPU is powered on when connector polling is
* trying to acquire rpm refs will cause us to deadlock. * performed. Since we're calling this from a runtime PM callback,
* * trying to acquire rpm refs will cause us to deadlock.
* Since we're guaranteed to be holding the rpm lock, it's safe to *
* temporarily disable the rpm helpers so this doesn't deadlock us. * Since we're guaranteed to be holding the rpm lock, it's safe to
*/ * temporarily disable the rpm helpers so this doesn't deadlock us.
*/
#ifdef CONFIG_PM #ifdef CONFIG_PM
dev->dev->power.disable_depth++; dev->dev->power.disable_depth++;
#endif #endif
if (!amdgpu_device_has_dc_support(adev)) if (!adev->dc_enabled)
drm_helper_hpd_irq_event(dev); drm_helper_hpd_irq_event(dev);
else else
drm_kms_helper_hotplug_event(dev); drm_kms_helper_hotplug_event(dev);
#ifdef CONFIG_PM #ifdef CONFIG_PM
dev->dev->power.disable_depth--; dev->dev->power.disable_depth--;
#endif #endif
}
adev->in_suspend = false; adev->in_suspend = false;
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D0)) if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D0))
......
...@@ -549,7 +549,7 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, ...@@ -549,7 +549,7 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
*/ */
if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) && if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
amdgpu_bo_support_uswc(bo_flags) && amdgpu_bo_support_uswc(bo_flags) &&
amdgpu_device_has_dc_support(adev) && adev->dc_enabled &&
adev->mode_info.gpu_vm_support) adev->mode_info.gpu_vm_support)
domain |= AMDGPU_GEM_DOMAIN_GTT; domain |= AMDGPU_GEM_DOMAIN_GTT;
#endif #endif
...@@ -1316,7 +1316,7 @@ int amdgpu_display_modeset_create_props(struct amdgpu_device *adev) ...@@ -1316,7 +1316,7 @@ int amdgpu_display_modeset_create_props(struct amdgpu_device *adev)
"dither", "dither",
amdgpu_dither_enum_list, sz); amdgpu_dither_enum_list, sz);
if (amdgpu_device_has_dc_support(adev)) { if (adev->dc_enabled) {
adev->mode_info.abm_level_property = adev->mode_info.abm_level_property =
drm_property_create_range(adev_to_drm(adev), 0, drm_property_create_range(adev_to_drm(adev), 0,
"abm level", 0, 4); "abm level", 0, 4);
......
...@@ -2471,7 +2471,7 @@ static int amdgpu_runtime_idle_check_display(struct device *dev) ...@@ -2471,7 +2471,7 @@ static int amdgpu_runtime_idle_check_display(struct device *dev)
if (ret) if (ret)
return ret; return ret;
if (amdgpu_device_has_dc_support(adev)) { if (adev->dc_enabled) {
struct drm_crtc *crtc; struct drm_crtc *crtc;
drm_for_each_crtc(crtc, drm_dev) { drm_for_each_crtc(crtc, drm_dev) {
......
...@@ -4592,6 +4592,7 @@ static int dm_early_init(void *handle) ...@@ -4592,6 +4592,7 @@ static int dm_early_init(void *handle)
adev_to_drm(adev)->dev, adev_to_drm(adev)->dev,
&dev_attr_s3_debug); &dev_attr_s3_debug);
#endif #endif
adev->dc_enabled = true;
return 0; return 0;
} }
......
...@@ -1508,7 +1508,7 @@ static void pp_pm_compute_clocks(void *handle) ...@@ -1508,7 +1508,7 @@ static void pp_pm_compute_clocks(void *handle)
struct pp_hwmgr *hwmgr = handle; struct pp_hwmgr *hwmgr = handle;
struct amdgpu_device *adev = hwmgr->adev; struct amdgpu_device *adev = hwmgr->adev;
if (!amdgpu_device_has_dc_support(adev)) { if (!adev->dc_enabled) {
amdgpu_dpm_get_active_displays(adev); amdgpu_dpm_get_active_displays(adev);
adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtc_count; adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtc_count;
adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev); adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment