Commit 6b5fc488 authored by Rex Zhu's avatar Rex Zhu Committed by Greg Kroah-Hartman

drm/amd/powerplay: fix segment fault issue in multi-display case.

commit f9e9c08e upstream.
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1a788dd0
...@@ -816,10 +816,13 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device, ...@@ -816,10 +816,13 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
struct drm_device *ddev = adev->ddev; struct drm_device *ddev = adev->ddev;
struct drm_crtc *crtc; struct drm_crtc *crtc;
uint32_t line_time_us, vblank_lines; uint32_t line_time_us, vblank_lines;
struct cgs_mode_info *mode_info;
if (info == NULL) if (info == NULL)
return -EINVAL; return -EINVAL;
mode_info = info->mode_info;
if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {
list_for_each_entry(crtc, list_for_each_entry(crtc,
&ddev->mode_config.crtc_list, head) { &ddev->mode_config.crtc_list, head) {
...@@ -828,7 +831,7 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device, ...@@ -828,7 +831,7 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
info->active_display_mask |= (1 << amdgpu_crtc->crtc_id); info->active_display_mask |= (1 << amdgpu_crtc->crtc_id);
info->display_count++; info->display_count++;
} }
if (info->mode_info != NULL && if (mode_info != NULL &&
crtc->enabled && amdgpu_crtc->enabled && crtc->enabled && amdgpu_crtc->enabled &&
amdgpu_crtc->hw_mode.clock) { amdgpu_crtc->hw_mode.clock) {
line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) / line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) /
...@@ -836,10 +839,10 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device, ...@@ -836,10 +839,10 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end -
amdgpu_crtc->hw_mode.crtc_vdisplay + amdgpu_crtc->hw_mode.crtc_vdisplay +
(amdgpu_crtc->v_border * 2); (amdgpu_crtc->v_border * 2);
info->mode_info->vblank_time_us = vblank_lines * line_time_us; mode_info->vblank_time_us = vblank_lines * line_time_us;
info->mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode); mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode);
info->mode_info->ref_clock = adev->clock.spll.reference_freq; mode_info->ref_clock = adev->clock.spll.reference_freq;
info->mode_info++; mode_info = NULL;
} }
} }
} }
......
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