Skip to content

Commit ef4374f

Browse files
surajk8aknautiyal
authored andcommitted
drm/i915/dsc: Move rc param calculation for native_420
Move rc_param calculation for native_420 into calculate_rc_parameter. second_line_bpg_offset and second_line_offset_adj are both rc params and it would be better to have these calculated where all the other rc parameters are calculated. --v2 -Add the reason for commit in commit message [Jani] --v3 -Move nsl_second_line_bpg_offset with the other 420 calculation in calculate_rc_param [Ankit] --v4 -Fix comment alignment [Ankit] Cc: Jani Nikula <[email protected]> Cc: Ankit Nautiyal <[email protected]> Signed-off-by: Suraj Kandpal <[email protected]> Reviewed-by: Ankit Nautiyal <[email protected]> Signed-off-by: Ankit Nautiyal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a811c2e commit ef4374f

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

drivers/gpu/drm/i915/display/intel_vdsc.c

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,28 @@ calculate_rc_params(struct drm_dsc_config *vdsc_cfg)
7878
else
7979
vdsc_cfg->first_line_bpg_offset = 2 * (vdsc_cfg->slice_height - 1);
8080

81+
/*
82+
* According to DSC 1.2 spec in Section 4.1 if native_420 is set:
83+
* -second_line_bpg_offset is 12 in general and equal to 2*(slice_height-1) if slice
84+
* height < 8.
85+
* -second_line_offset_adj is 512 as shown by emperical values to yield best chroma
86+
* preservation in second line.
87+
* -nsl_bpg_offset is calculated as second_line_offset/slice_height -1 then rounded
88+
* up to 16 fractional bits, we left shift second line offset by 11 to preserve 11
89+
* fractional bits.
90+
*/
91+
if (vdsc_cfg->native_420) {
92+
if (vdsc_cfg->slice_height >= 8)
93+
vdsc_cfg->second_line_bpg_offset = 12;
94+
else
95+
vdsc_cfg->second_line_bpg_offset =
96+
2 * (vdsc_cfg->slice_height - 1);
97+
98+
vdsc_cfg->second_line_offset_adj = 512;
99+
vdsc_cfg->nsl_bpg_offset = DIV_ROUND_UP(vdsc_cfg->second_line_bpg_offset << 11,
100+
vdsc_cfg->slice_height - 1);
101+
}
102+
81103
/* Our hw supports only 444 modes as of today */
82104
if (bpp >= 12)
83105
vdsc_cfg->initial_offset = 2048;
@@ -190,30 +212,12 @@ int intel_dsc_compute_params(struct intel_crtc_state *pipe_config)
190212
vdsc_cfg->bits_per_pixel = compressed_bpp << 4;
191213

192214
/*
193-
* According to DSC 1.2 specs in Section 4.1 if native_420 is set:
194-
* -We need to double the current bpp.
195-
* -second_line_bpg_offset is 12 in general and equal to 2*(slice_height-1) if slice
196-
* height < 8.
197-
* -second_line_offset_adj is 512 as shown by emperical values to yeild best chroma
198-
* preservation in second line.
199-
* -nsl_bpg_offset is calculated as second_line_offset/slice_height -1 then rounded
200-
* up to 16 fractional bits, we left shift second line offset by 11 to preserve 11
201-
* fractional bits.
215+
* According to DSC 1.2 specs in Section 4.1 if native_420 is set
216+
* we need to double the current bpp.
202217
*/
203-
if (vdsc_cfg->native_420) {
218+
if (vdsc_cfg->native_420)
204219
vdsc_cfg->bits_per_pixel <<= 1;
205220

206-
if (vdsc_cfg->slice_height >= 8)
207-
vdsc_cfg->second_line_bpg_offset = 12;
208-
else
209-
vdsc_cfg->second_line_bpg_offset =
210-
2 * (vdsc_cfg->slice_height - 1);
211-
212-
vdsc_cfg->second_line_offset_adj = 512;
213-
vdsc_cfg->nsl_bpg_offset = DIV_ROUND_UP(vdsc_cfg->second_line_bpg_offset << 11,
214-
vdsc_cfg->slice_height - 1);
215-
}
216-
217221
vdsc_cfg->bits_per_component = pipe_config->pipe_bpp / 3;
218222

219223
drm_dsc_set_rc_buf_thresh(vdsc_cfg);

0 commit comments

Comments
 (0)