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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Set pm_display_cfg in non-dc mode

those display informations are needed by powerplay.

Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
d91ea496 b3892e2b

+37 -15
+20
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
··· 115 115 pr_cont("\n"); 116 116 } 117 117 118 + void amdgpu_dpm_get_active_displays(struct amdgpu_device *adev) 119 + { 120 + struct drm_device *ddev = adev->ddev; 121 + struct drm_crtc *crtc; 122 + struct amdgpu_crtc *amdgpu_crtc; 123 + 124 + adev->pm.dpm.new_active_crtcs = 0; 125 + adev->pm.dpm.new_active_crtc_count = 0; 126 + if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { 127 + list_for_each_entry(crtc, 128 + &ddev->mode_config.crtc_list, head) { 129 + amdgpu_crtc = to_amdgpu_crtc(crtc); 130 + if (amdgpu_crtc->enabled) { 131 + adev->pm.dpm.new_active_crtcs |= (1 << amdgpu_crtc->crtc_id); 132 + adev->pm.dpm.new_active_crtc_count++; 133 + } 134 + } 135 + } 136 + } 137 + 118 138 119 139 u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev) 120 140 {
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h
··· 482 482 struct amdgpu_ps *rps); 483 483 u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev); 484 484 u32 amdgpu_dpm_get_vrefresh(struct amdgpu_device *adev); 485 + void amdgpu_dpm_get_active_displays(struct amdgpu_device *adev); 485 486 bool amdgpu_is_uvd_state(u32 class, u32 class2); 486 487 void amdgpu_calculate_u_and_p(u32 i, u32 r_c, u32 p_b, 487 488 u32 *p, u32 *u);
+16 -15
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
··· 1658 1658 1659 1659 void amdgpu_pm_compute_clocks(struct amdgpu_device *adev) 1660 1660 { 1661 - struct drm_device *ddev = adev->ddev; 1662 - struct drm_crtc *crtc; 1663 - struct amdgpu_crtc *amdgpu_crtc; 1664 1661 int i = 0; 1665 1662 1666 1663 if (!adev->pm.dpm_enabled) ··· 1672 1675 amdgpu_fence_wait_empty(ring); 1673 1676 } 1674 1677 1678 + if (!amdgpu_device_has_dc_support(adev)) { 1679 + mutex_lock(&adev->pm.mutex); 1680 + amdgpu_dpm_get_active_displays(adev); 1681 + adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtcs; 1682 + adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev); 1683 + adev->pm.pm_display_cfg.min_vblank_time = amdgpu_dpm_get_vblank_time(adev); 1684 + /* we have issues with mclk switching with refresh rates over 120 hz on the non-DC code. */ 1685 + if (adev->pm.pm_display_cfg.vrefresh > 120) 1686 + adev->pm.pm_display_cfg.min_vblank_time = 0; 1687 + if (adev->powerplay.pp_funcs->display_configuration_change) 1688 + adev->powerplay.pp_funcs->display_configuration_change( 1689 + adev->powerplay.pp_handle, 1690 + &adev->pm.pm_display_cfg); 1691 + mutex_unlock(&adev->pm.mutex); 1692 + } 1693 + 1675 1694 if (adev->powerplay.pp_funcs->dispatch_tasks) { 1676 1695 amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_DISPLAY_CONFIG_CHANGE, NULL); 1677 1696 } else { 1678 1697 mutex_lock(&adev->pm.mutex); 1679 - adev->pm.dpm.new_active_crtcs = 0; 1680 - adev->pm.dpm.new_active_crtc_count = 0; 1681 - if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { 1682 - list_for_each_entry(crtc, 1683 - &ddev->mode_config.crtc_list, head) { 1684 - amdgpu_crtc = to_amdgpu_crtc(crtc); 1685 - if (amdgpu_crtc->enabled) { 1686 - adev->pm.dpm.new_active_crtcs |= (1 << amdgpu_crtc->crtc_id); 1687 - adev->pm.dpm.new_active_crtc_count++; 1688 - } 1689 - } 1690 - } 1691 1698 /* update battery/ac status */ 1692 1699 if (power_supply_is_system_supplied() > 0) 1693 1700 adev->pm.dpm.ac_power = true;