aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/dce_v6_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v6_0.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 838cf1a778f2..6604bcf783b7 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -861,23 +861,10 @@ static u32 dce_v6_0_latency_watermark(struct dce6_wm_params *wm)
861 a.full = dfixed_const(available_bandwidth); 861 a.full = dfixed_const(available_bandwidth);
862 b.full = dfixed_const(wm->num_heads); 862 b.full = dfixed_const(wm->num_heads);
863 a.full = dfixed_div(a, b); 863 a.full = dfixed_div(a, b);
864 tmp = div_u64((u64) dmif_size * (u64) wm->disp_clk, mc_latency + 512);
865 tmp = min(dfixed_trunc(a), tmp);
864 866
865 b.full = dfixed_const(mc_latency + 512); 867 lb_fill_bw = min(tmp, wm->disp_clk * wm->bytes_per_pixel / 1000);
866 c.full = dfixed_const(wm->disp_clk);
867 b.full = dfixed_div(b, c);
868
869 c.full = dfixed_const(dmif_size);
870 b.full = dfixed_div(c, b);
871
872 tmp = min(dfixed_trunc(a), dfixed_trunc(b));
873
874 b.full = dfixed_const(1000);
875 c.full = dfixed_const(wm->disp_clk);
876 b.full = dfixed_div(c, b);
877 c.full = dfixed_const(wm->bytes_per_pixel);
878 b.full = dfixed_mul(b, c);
879
880 lb_fill_bw = min(tmp, dfixed_trunc(b));
881 868
882 a.full = dfixed_const(max_src_lines_per_dst_line * wm->src_width * wm->bytes_per_pixel); 869 a.full = dfixed_const(max_src_lines_per_dst_line * wm->src_width * wm->bytes_per_pixel);
883 b.full = dfixed_const(1000); 870 b.full = dfixed_const(1000);
@@ -986,7 +973,7 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev,
986 struct drm_display_mode *mode = &amdgpu_crtc->base.mode; 973 struct drm_display_mode *mode = &amdgpu_crtc->base.mode;
987 struct dce6_wm_params wm_low, wm_high; 974 struct dce6_wm_params wm_low, wm_high;
988 u32 dram_channels; 975 u32 dram_channels;
989 u32 pixel_period; 976 u32 active_time;
990 u32 line_time = 0; 977 u32 line_time = 0;
991 u32 latency_watermark_a = 0, latency_watermark_b = 0; 978 u32 latency_watermark_a = 0, latency_watermark_b = 0;
992 u32 priority_a_mark = 0, priority_b_mark = 0; 979 u32 priority_a_mark = 0, priority_b_mark = 0;
@@ -996,8 +983,8 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev,
996 fixed20_12 a, b, c; 983 fixed20_12 a, b, c;
997 984
998 if (amdgpu_crtc->base.enabled && num_heads && mode) { 985 if (amdgpu_crtc->base.enabled && num_heads && mode) {
999 pixel_period = 1000000 / (u32)mode->clock; 986 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock;
1000 line_time = min((u32)mode->crtc_htotal * pixel_period, (u32)65535); 987 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535);
1001 priority_a_cnt = 0; 988 priority_a_cnt = 0;
1002 priority_b_cnt = 0; 989 priority_b_cnt = 0;
1003 990
@@ -1016,7 +1003,7 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev,
1016 1003
1017 wm_high.disp_clk = mode->clock; 1004 wm_high.disp_clk = mode->clock;
1018 wm_high.src_width = mode->crtc_hdisplay; 1005 wm_high.src_width = mode->crtc_hdisplay;
1019 wm_high.active_time = mode->crtc_hdisplay * pixel_period; 1006 wm_high.active_time = active_time;
1020 wm_high.blank_time = line_time - wm_high.active_time; 1007 wm_high.blank_time = line_time - wm_high.active_time;
1021 wm_high.interlaced = false; 1008 wm_high.interlaced = false;
1022 if (mode->flags & DRM_MODE_FLAG_INTERLACE) 1009 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
@@ -1043,7 +1030,7 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev,
1043 1030
1044 wm_low.disp_clk = mode->clock; 1031 wm_low.disp_clk = mode->clock;
1045 wm_low.src_width = mode->crtc_hdisplay; 1032 wm_low.src_width = mode->crtc_hdisplay;
1046 wm_low.active_time = mode->crtc_hdisplay * pixel_period; 1033 wm_low.active_time = active_time;
1047 wm_low.blank_time = line_time - wm_low.active_time; 1034 wm_low.blank_time = line_time - wm_low.active_time;
1048 wm_low.interlaced = false; 1035 wm_low.interlaced = false;
1049 if (mode->flags & DRM_MODE_FLAG_INTERLACE) 1036 if (mode->flags & DRM_MODE_FLAG_INTERLACE)