diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2016-10-10 03:57:21 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-13 18:25:48 -0400 |
commit | dc8184aa8621ee8048652496884d9f40d4bb407f (patch) | |
tree | 722dbe7a1ddc4dd2be903ff70c8db4b6b98e409e | |
parent | 4a446d55843fb82fc5bc6c72d27bfc20b6c294c3 (diff) |
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
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c index fe36caf1b7d7..14f57d9915e3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | |||
@@ -113,24 +113,26 @@ void amdgpu_dpm_print_ps_status(struct amdgpu_device *adev, | |||
113 | printk("\n"); | 113 | printk("\n"); |
114 | } | 114 | } |
115 | 115 | ||
116 | |||
116 | u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev) | 117 | u32 amdgpu_dpm_get_vblank_time(struct amdgpu_device *adev) |
117 | { | 118 | { |
118 | struct drm_device *dev = adev->ddev; | 119 | struct drm_device *dev = adev->ddev; |
119 | struct drm_crtc *crtc; | 120 | struct drm_crtc *crtc; |
120 | struct amdgpu_crtc *amdgpu_crtc; | 121 | struct amdgpu_crtc *amdgpu_crtc; |
121 | u32 line_time_us, vblank_lines; | 122 | u32 vblank_in_pixels; |
122 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ | 123 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ |
123 | 124 | ||
124 | if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { | 125 | if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { |
125 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 126 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
126 | amdgpu_crtc = to_amdgpu_crtc(crtc); | 127 | amdgpu_crtc = to_amdgpu_crtc(crtc); |
127 | if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) { | 128 | if (crtc->enabled && amdgpu_crtc->enabled && amdgpu_crtc->hw_mode.clock) { |
128 | line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) / | 129 | vblank_in_pixels = |
129 | amdgpu_crtc->hw_mode.clock; | 130 | amdgpu_crtc->hw_mode.crtc_htotal * |
130 | vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - | 131 | (amdgpu_crtc->hw_mode.crtc_vblank_end - |
131 | amdgpu_crtc->hw_mode.crtc_vdisplay + | 132 | amdgpu_crtc->hw_mode.crtc_vdisplay + |
132 | (amdgpu_crtc->v_border * 2); | 133 | (amdgpu_crtc->v_border * 2)); |
133 | vblank_time_us = vblank_lines * line_time_us; | 134 | |
135 | vblank_time_us = vblank_in_pixels * 1000 / amdgpu_crtc->hw_mode.clock; | ||
134 | break; | 136 | break; |
135 | } | 137 | } |
136 | } | 138 | } |