drm/amdgpu: change vblank_time's calculation method to reduce computational error.
Subsystems (2)
PATCH 1/1 drm/amdgpu: change vblank_time's calculation method to reduce computational error.
Change-Id If0f10dc8002ef8b923177cbf36d0d76316bd017c
Signed-off-by Rex Zhu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +8 -6
@@ -113,24 +113,26 @@ void amdgpu_dpm_print_ps_status(struct amdgpu_device *adev,printk ("\n" ); } +u32 amdgpu_dpm_get_vblank_time (struct amdgpu_device *adev) {struct drm_device *dev = adev->ddev;struct drm_crtc *crtc;struct amdgpu_crtc *amdgpu_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 */ if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { amdgpu_crtc =to_amdgpu_crtc (crtc);if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) { - line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal *1000 ) / - amdgpu_crtc->hw_mode.clock; - vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - + vblank_in_pixels = + amdgpu_crtc->hw_mode.crtc_htotal * + (amdgpu_crtc->hw_mode.crtc_vblank_end - amdgpu_crtc->hw_mode.crtc_vdisplay + - (amdgpu_crtc->v_border *2 ); - vblank_time_us = vblank_lines * line_time_us; + (amdgpu_crtc->v_border *2 )); + + vblank_time_us = vblank_in_pixels *1000 / amdgpu_crtc->hw_mode.clock;break ; } }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1476091817-23581-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byQuoted 2 lines · Rex Zhu
Change-Id If0f10dc8002ef8b923177cbf36d0d76316bd017cSigned-off-by Rex Zhu <[email protected]>
Reviewed-by Alex Deucher <[email protected]>
Quoted 44 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +8
-7@@ -113,24 +113,26 @@ void amdgpu_dpm_print_ps_status(struct amdgpu_device *adev,printk ("\n" ); } +u32 amdgpu_dpm_get_vblank_time (struct amdgpu_device *adev) {struct drm_device *dev = adev->ddev;struct drm_crtc *crtc;struct amdgpu_crtc *amdgpu_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 */ if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { amdgpu_crtc =to_amdgpu_crtc (crtc);if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) { - line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal *1000 ) / - amdgpu_crtc->hw_mode.clock; - vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - + vblank_in_pixels = + amdgpu_crtc->hw_mode.crtc_htotal * + (amdgpu_crtc->hw_mode.crtc_vblank_end - amdgpu_crtc->hw_mode.crtc_vdisplay + - (amdgpu_crtc->v_border *2 ); - vblank_time_us = vblank_lines * line_time_us; + (amdgpu_crtc->v_border *2 )); + + vblank_time_us = vblank_in_pixels *1000 / amdgpu_crtc->hw_mode.clock;break ; } } --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx