aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/dce_v8_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 9b4dcf76ce6c..d6e51d4b04f0 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -1096,23 +1096,10 @@ static u32 dce_v8_0_latency_watermark(struct dce8_wm_params *wm)
1096 a.full = dfixed_const(available_bandwidth); 1096 a.full = dfixed_const(available_bandwidth);
1097 b.full = dfixed_const(wm->num_heads); 1097 b.full = dfixed_const(wm->num_heads);
1098 a.full = dfixed_div(a, b); 1098 a.full = dfixed_div(a, b);
1099 tmp = div_u64((u64) dmif_size * (u64) wm->disp_clk, mc_latency + 512);
1100 tmp = min(dfixed_trunc(a), tmp);
1099 1101
1100 b.full = dfixed_const(mc_latency + 512); 1102 lb_fill_bw = min(tmp, wm->disp_clk * wm->bytes_per_pixel / 1000);
1101 c.full = dfixed_const(wm->disp_clk);
1102 b.full = dfixed_div(b, c);
1103
1104 c.full = dfixed_const(dmif_size);
1105 b.full = dfixed_div(c, b);
1106
1107 tmp = min(dfixed_trunc(a), dfixed_trunc(b));
1108
1109 b.full = dfixed_const(1000);
1110 c.full = dfixed_const(wm->disp_clk);
1111 b.full = dfixed_div(c, b);
1112 c.full = dfixed_const(wm->bytes_per_pixel);
1113 b.full = dfixed_mul(b, c);
1114
1115 lb_fill_bw = min(tmp, dfixed_trunc(b));
1116 1103
1117 a.full = dfixed_const(max_src_lines_per_dst_line * wm->src_width * wm->bytes_per_pixel); 1104 a.full = dfixed_const(max_src_lines_per_dst_line * wm->src_width * wm->bytes_per_pixel);
1118 b.full = dfixed_const(1000); 1105 b.full = dfixed_const(1000);
@@ -1220,14 +1207,14 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev,
1220{ 1207{
1221 struct drm_display_mode *mode = &amdgpu_crtc->base.mode; 1208 struct drm_display_mode *mode = &amdgpu_crtc->base.mode;
1222 struct dce8_wm_params wm_low, wm_high; 1209 struct dce8_wm_params wm_low, wm_high;
1223 u32 pixel_period; 1210 u32 active_time;
1224 u32 line_time = 0; 1211 u32 line_time = 0;
1225 u32 latency_watermark_a = 0, latency_watermark_b = 0; 1212 u32 latency_watermark_a = 0, latency_watermark_b = 0;
1226 u32 tmp, wm_mask, lb_vblank_lead_lines = 0; 1213 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1227 1214
1228 if (amdgpu_crtc->base.enabled && num_heads && mode) { 1215 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1229 pixel_period = 1000000 / (u32)mode->clock; 1216 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
1230 line_time = min((u32)mode->crtc_htotal * pixel_period, (u32)65535); 1217 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
1231 1218
1232 /* watermark for high clocks */ 1219 /* watermark for high clocks */
1233 if (adev->pm.dpm_enabled) { 1220 if (adev->pm.dpm_enabled) {
@@ -1242,7 +1229,7 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev,
1242 1229
1243 wm_high.disp_clk = mode->clock; 1230 wm_high.disp_clk = mode->clock;
1244 wm_high.src_width = mode->crtc_hdisplay; 1231 wm_high.src_width = mode->crtc_hdisplay;
1245 wm_high.active_time = mode->crtc_hdisplay * pixel_period; 1232 wm_high.active_time = active_time;
1246 wm_high.blank_time = line_time - wm_high.active_time; 1233 wm_high.blank_time = line_time - wm_high.active_time;
1247 wm_high.interlaced = false; 1234 wm_high.interlaced = false;
1248 if (mode->flags & DRM_MODE_FLAG_INTERLACE) 1235 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
@@ -1281,7 +1268,7 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev,
1281 1268
1282 wm_low.disp_clk = mode->clock; 1269 wm_low.disp_clk = mode->clock;
1283 wm_low.src_width = mode->crtc_hdisplay; 1270 wm_low.src_width = mode->crtc_hdisplay;
1284 wm_low.active_time = mode->crtc_hdisplay * pixel_period; 1271 wm_low.active_time = active_time;
1285 wm_low.blank_time = line_time - wm_low.active_time; 1272 wm_low.blank_time = line_time - wm_low.active_time;
1286 wm_low.interlaced = false; 1273 wm_low.interlaced = false;
1287 if (mode->flags & DRM_MODE_FLAG_INTERLACE) 1274 if (mode->flags & DRM_MODE_FLAG_INTERLACE)