diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2013-07-08 11:26:42 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-07-08 17:40:09 -0400 |
commit | 66edc1c95d75d66b11f1d2e2332c0c27b3f89a77 (patch) | |
tree | 920848d72cf0423a0d72eac7a84528d090fbbcdd | |
parent | 7e1f3c0419b0be9f20e08848ab23221a6dc3d77e (diff) |
drm/radeon/dpm: add helper to calculate vblank time
Required for checking vblank time for mclk changes.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600_dpm.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600_dpm.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 1 |
4 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index c7ad4b930850..b9d3b43f19c0 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1841,6 +1841,9 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc, | |||
1841 | atombios_crtc_set_base(crtc, x, y, old_fb); | 1841 | atombios_crtc_set_base(crtc, x, y, old_fb); |
1842 | atombios_overscan_setup(crtc, mode, adjusted_mode); | 1842 | atombios_overscan_setup(crtc, mode, adjusted_mode); |
1843 | atombios_scaler_setup(crtc); | 1843 | atombios_scaler_setup(crtc); |
1844 | /* update the hw version fpr dpm */ | ||
1845 | radeon_crtc->hw_mode = *adjusted_mode; | ||
1846 | |||
1844 | return 0; | 1847 | return 0; |
1845 | } | 1848 | } |
1846 | 1849 | ||
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index 76368c04f809..b88f54b134ab 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -150,6 +150,30 @@ void r600_dpm_print_ps_status(struct radeon_device *rdev, | |||
150 | printk("\n"); | 150 | printk("\n"); |
151 | } | 151 | } |
152 | 152 | ||
153 | u32 r600_dpm_get_vblank_time(struct radeon_device *rdev) | ||
154 | { | ||
155 | struct drm_device *dev = rdev->ddev; | ||
156 | struct drm_crtc *crtc; | ||
157 | struct radeon_crtc *radeon_crtc; | ||
158 | u32 line_time_us, vblank_lines; | ||
159 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ | ||
160 | |||
161 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
162 | radeon_crtc = to_radeon_crtc(crtc); | ||
163 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { | ||
164 | line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / | ||
165 | radeon_crtc->hw_mode.clock; | ||
166 | vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - | ||
167 | radeon_crtc->hw_mode.crtc_vdisplay + | ||
168 | (radeon_crtc->v_border * 2); | ||
169 | vblank_time_us = vblank_lines * line_time_us; | ||
170 | break; | ||
171 | } | ||
172 | } | ||
173 | |||
174 | return vblank_time_us; | ||
175 | } | ||
176 | |||
153 | void r600_calculate_u_and_p(u32 i, u32 r_c, u32 p_b, | 177 | void r600_calculate_u_and_p(u32 i, u32 r_c, u32 p_b, |
154 | u32 *p, u32 *u) | 178 | u32 *p, u32 *u) |
155 | { | 179 | { |
diff --git a/drivers/gpu/drm/radeon/r600_dpm.h b/drivers/gpu/drm/radeon/r600_dpm.h index a95ab214289b..7c822d9ae53d 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.h +++ b/drivers/gpu/drm/radeon/r600_dpm.h | |||
@@ -129,6 +129,7 @@ void r600_dpm_print_class_info(u32 class, u32 class2); | |||
129 | void r600_dpm_print_cap_info(u32 caps); | 129 | void r600_dpm_print_cap_info(u32 caps); |
130 | void r600_dpm_print_ps_status(struct radeon_device *rdev, | 130 | void r600_dpm_print_ps_status(struct radeon_device *rdev, |
131 | struct radeon_ps *rps); | 131 | struct radeon_ps *rps); |
132 | u32 r600_dpm_get_vblank_time(struct radeon_device *rdev); | ||
132 | bool r600_is_uvd_state(u32 class, u32 class2); | 133 | bool r600_is_uvd_state(u32 class, u32 class2); |
133 | void r600_calculate_u_and_p(u32 i, u32 r_c, u32 p_b, | 134 | void r600_calculate_u_and_p(u32 i, u32 r_c, u32 p_b, |
134 | u32 *p, u32 *u); | 135 | u32 *p, u32 *u); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index b568cb19a7fa..8296632a4235 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -335,6 +335,7 @@ struct radeon_crtc { | |||
335 | u32 line_time; | 335 | u32 line_time; |
336 | u32 wm_low; | 336 | u32 wm_low; |
337 | u32 wm_high; | 337 | u32 wm_high; |
338 | struct drm_display_mode hw_mode; | ||
338 | }; | 339 | }; |
339 | 340 | ||
340 | struct radeon_encoder_primary_dac { | 341 | struct radeon_encoder_primary_dac { |