Commit 7c6e84a8 authored by Alex Deucher's avatar Alex Deucher Committed by Jiri Slaby

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 avatarJiri Slaby <jslaby@suse.cz>
parent 5478f85a
...@@ -155,19 +155,20 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev) ...@@ -155,19 +155,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