diff options
author | Nikola Cornij <nikola.cornij@amd.com> | 2019-03-28 17:40:18 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-06-22 09:34:09 -0500 |
commit | 23882a693fe11228cfd38c74cd8db3e54edaef82 (patch) | |
tree | bd2b2bb0b5a5a127bdbb759fe5c827992e06de03 | |
parent | d438d113380eff1c27a1d239a9bd624e0fb15b6d (diff) | |
download | linux-23882a693fe11228cfd38c74cd8db3e54edaef82.tar.gz linux-23882a693fe11228cfd38c74cd8db3e54edaef82.tar.bz2 linux-23882a693fe11228cfd38c74cd8db3e54edaef82.zip |
drm/amd/display: Make sure DSC slice height is divisible by 2 for 4:2:0 color format
[why] DSC spec requires this
Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c index c649f62d183d..6357325d3c90 100644 --- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c @@ -658,14 +658,23 @@ static bool setup_dsc_config( dsc_cfg->num_slices_h = num_slices_h; slice_width = pic_width / num_slices_h; - // Vertical number of slices: start from policy and pick the first one that height is divisible by + // Vertical number of slices: start from policy and pick the first one that height is divisible by. + // For 4:2:0 make sure the slice height is divisible by 2 as well. pic_height = timing->v_addressable + timing->v_border_top + timing->v_border_bottom; num_slices_v = dsc_policy.num_slices_v; if (num_slices_v < 1) num_slices_v = 1; - while (num_slices_v >= 1 && (pic_height % num_slices_v != 0)) + while (num_slices_v >= 1) { + if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420) { + int slice_height = pic_height / num_slices_v; + if (pic_height % num_slices_v == 0 && slice_height % 2 == 0) + break; + } else if (pic_height % num_slices_v == 0) + break; + num_slices_v--; + } dsc_cfg->num_slices_v = num_slices_v; |