Commit 73e35e42 authored by Alex Deucher's avatar Alex Deucher Committed by Greg Kroah-Hartman

drm/radeon: change vblank_time's calculation method to reduce computational error.

commit 02cfb5fc upstream.

Ported from Rex's amdgpu change.
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4fb5e84d
...@@ -156,19 +156,20 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev) ...@@ -156,19 +156,20 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev)
struct drm_device *dev = rdev->ddev; struct drm_device *dev = rdev->ddev;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc; struct radeon_crtc *radeon_crtc;
u32 line_time_us, vblank_lines; u32 vblank_in_pixels;
u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */
if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) {
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
radeon_crtc = to_radeon_crtc(crtc); radeon_crtc = to_radeon_crtc(crtc);
if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) {
line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / vblank_in_pixels =
radeon_crtc->hw_mode.clock; radeon_crtc->hw_mode.crtc_htotal *
vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - (radeon_crtc->hw_mode.crtc_vblank_end -
radeon_crtc->hw_mode.crtc_vdisplay + radeon_crtc->hw_mode.crtc_vdisplay +
(radeon_crtc->v_border * 2); (radeon_crtc->v_border * 2));
vblank_time_us = vblank_lines * line_time_us;
vblank_time_us = vblank_in_pixels * 1000 / radeon_crtc->hw_mode.clock;
break; break;
} }
} }
......
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