Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/dpu: calculate data_width like downstream

Derive INTF data_width from dce_bytes_per_line rather than
timing->width when DSC is enabled. Use DIV_ROUND_UP to avoid
rounding errors.

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Tested-by: Pengyu Luo <mitltlatltl@gmail.com> # Lenovo Legion Y700 Gen4 (SM8750)
Patchwork: https://patchwork.freedesktop.org/patch/713333/
Link: https://lore.kernel.org/r/20260322-fix-data-width-calc-v2-1-d5f28136bc4e@pm.me
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

authored by

Alexander Koskovich and committed by
Dmitry Baryshkov
3bd3d499 7c5166fd

+24 -5
+2
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
··· 10 10 #include "dpu_formats.h" 11 11 #include "dpu_trace.h" 12 12 #include "disp/msm_disp_snapshot.h" 13 + #include "msm_dsc_helper.h" 13 14 14 15 #include <drm/display/drm_dsc_helper.h> 15 16 #include <drm/drm_managed.h> ··· 137 136 timing->width = timing->width * drm_dsc_get_bpp_int(dsc) / 138 137 (dsc->bits_per_component * 3); 139 138 timing->xres = timing->width; 139 + timing->dce_bytes_per_line = msm_dsc_get_bytes_per_line(dsc); 140 140 } 141 141 } 142 142
+21 -5
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
··· 173 173 data_width = p->width; 174 174 175 175 /* 176 - * If widebus is enabled, data is valid for only half the active window 177 - * since the data rate is doubled in this mode. But for the compression 178 - * mode in DP case, the p->width is already adjusted in 179 - * drm_mode_to_intf_timing_params() 176 + * If widebus is disabled: 177 + * For uncompressed stream, the data is valid for the entire active 178 + * window period. 179 + * For compressed stream, data is valid for a shorter time period 180 + * inside the active window depending on the compression ratio. 181 + * 182 + * If widebus is enabled: 183 + * For uncompressed stream, data is valid for only half the active 184 + * window, since the data rate is doubled in this mode. 185 + * For compressed stream, data validity window needs to be adjusted for 186 + * compression ratio and then further halved. 187 + * 188 + * For the compression mode in DP case, the p->width is already 189 + * adjusted in drm_mode_to_intf_timing_params(). 180 190 */ 181 - if (p->wide_bus_en && !dp_intf) 191 + if (p->compression_en && !dp_intf) { 192 + if (p->wide_bus_en) 193 + data_width = DIV_ROUND_UP(p->dce_bytes_per_line, 6); 194 + else 195 + data_width = DIV_ROUND_UP(p->dce_bytes_per_line, 3); 196 + } else if (p->wide_bus_en && !dp_intf) { 182 197 data_width = p->width >> 1; 198 + } 183 199 184 200 /* TODO: handle DSC+DP case, we only handle DSC+DSI case so far */ 185 201 if (p->compression_en && !dp_intf &&
+1
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
··· 35 35 36 36 bool wide_bus_en; 37 37 bool compression_en; 38 + u32 dce_bytes_per_line; 38 39 }; 39 40 40 41 struct dpu_hw_intf_prog_fetch {