mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 07:31:41 +00:00
drm/amdgpu: change vblank_time's calculation method to reduce computational error.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
This commit is contained in:
parent
4a446d5584
commit
dc8184aa86
1 changed files with 8 additions and 6 deletions
|
@ -113,24 +113,26 @@ void amdgpu_dpm_print_ps_status(struct amdgpu_device *adev,
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev)
|
u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = adev->ddev;
|
struct drm_device *dev = adev->ddev;
|
||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
struct amdgpu_crtc *amdgpu_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 */
|
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) {
|
if (adev->mode_info.num_crtc && adev->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) {
|
||||||
amdgpu_crtc = to_amdgpu_crtc(crtc);
|
amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||||
if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) {
|
if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) {
|
||||||
line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) /
|
vblank_in_pixels =
|
||||||
amdgpu_crtc->hw_mode.clock;
|
amdgpu_crtc->hw_mode.crtc_htotal *
|
||||||
vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end -
|
(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));
|
||||||
vblank_time_us = vblank_lines * line_time_us;
|
|
||||||
|
vblank_time_us = vblank_in_pixels * 1000 / amdgpu_crtc->hw_mode.clock;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue