blob: 46a3c1b6246382392325e98f7c518de2c820b244 [file] [log] [blame]
Manasi Navarea408c852018-11-27 13:41:07 -08001// SPDX-License-Identifier: MIT
2/*
3 * Copyright © 2018 Intel Corp
4 *
5 * Author:
6 * Manasi Navare <manasi.d.navare@intel.com>
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/errno.h>
13#include <linux/byteorder/generic.h>
David Francisdc433322019-02-21 15:19:59 -050014#include <drm/drm_print.h>
Manasi Navarea408c852018-11-27 13:41:07 -080015#include <drm/drm_dp_helper.h>
16#include <drm/drm_dsc.h>
17
18/**
19 * DOC: dsc helpers
20 *
Manasi Navare05bad232019-02-06 13:31:48 -080021 * VESA specification for DP 1.4 adds a new feature called Display Stream
22 * Compression (DSC) used to compress the pixel bits before sending it on
23 * DP/eDP/MIPI DSI interface. DSC is required to be enabled so that the existing
24 * display interfaces can support high resolutions at higher frames rates uisng
25 * the maximum available link capacity of these interfaces.
26 *
Manasi Navarea408c852018-11-27 13:41:07 -080027 * These functions contain some common logic and helpers to deal with VESA
28 * Display Stream Compression standard required for DSC on Display Port/eDP or
29 * MIPI display interfaces.
30 */
31
32/**
33 * drm_dsc_dp_pps_header_init() - Initializes the PPS Header
34 * for DisplayPort as per the DP 1.4 spec.
David Francisdbfbe712019-02-21 15:20:01 -050035 * @pps_header: Secondary data packet header for DSC Picture
36 * Parameter Set as defined in &struct dp_sdp_header
Manasi Navare05bad232019-02-06 13:31:48 -080037 *
38 * DP 1.4 spec defines the secondary data packet for sending the
39 * picture parameter infoframes from the source to the sink.
David Francisdbfbe712019-02-21 15:20:01 -050040 * This function populates the SDP header defined in
41 * &struct dp_sdp_header.
Manasi Navarea408c852018-11-27 13:41:07 -080042 */
David Francisdbfbe712019-02-21 15:20:01 -050043void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header)
Manasi Navarea408c852018-11-27 13:41:07 -080044{
David Francisdbfbe712019-02-21 15:20:01 -050045 memset(pps_header, 0, sizeof(*pps_header));
Manasi Navarea408c852018-11-27 13:41:07 -080046
David Francisdbfbe712019-02-21 15:20:01 -050047 pps_header->HB1 = DP_SDP_PPS;
48 pps_header->HB2 = DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1;
Manasi Navarea408c852018-11-27 13:41:07 -080049}
50EXPORT_SYMBOL(drm_dsc_dp_pps_header_init);
51
52/**
Jani Nikulaa8f65ba2020-12-08 14:33:53 +020053 * drm_dsc_dp_rc_buffer_size - get rc buffer size in bytes
54 * @rc_buffer_block_size: block size code, according to DPCD offset 62h
55 * @rc_buffer_size: number of blocks - 1, according to DPCD offset 63h
56 *
57 * return:
58 * buffer size in bytes, or 0 on invalid input
59 */
60int drm_dsc_dp_rc_buffer_size(u8 rc_buffer_block_size, u8 rc_buffer_size)
61{
62 int size = 1024 * (rc_buffer_size + 1);
63
64 switch (rc_buffer_block_size) {
65 case DP_DSC_RC_BUF_BLK_SIZE_1:
66 return 1 * size;
67 case DP_DSC_RC_BUF_BLK_SIZE_4:
68 return 4 * size;
69 case DP_DSC_RC_BUF_BLK_SIZE_16:
70 return 16 * size;
71 case DP_DSC_RC_BUF_BLK_SIZE_64:
72 return 64 * size;
73 default:
74 return 0;
75 }
76}
77EXPORT_SYMBOL(drm_dsc_dp_rc_buffer_size);
78
79/**
David Francisdbfbe712019-02-21 15:20:01 -050080 * drm_dsc_pps_payload_pack() - Populates the DSC PPS
Manasi Navarea408c852018-11-27 13:41:07 -080081 *
David Francisdbfbe712019-02-21 15:20:01 -050082 * @pps_payload:
83 * Bitwise struct for DSC Picture Parameter Set. This is defined
84 * by &struct drm_dsc_picture_parameter_set
Manasi Navarea408c852018-11-27 13:41:07 -080085 * @dsc_cfg:
Manasi Navare05bad232019-02-06 13:31:48 -080086 * DSC Configuration data filled by driver as defined by
87 * &struct drm_dsc_config
88 *
David Francisdbfbe712019-02-21 15:20:01 -050089 * DSC source device sends a picture parameter set (PPS) containing the
90 * information required by the sink to decode the compressed frame. Driver
91 * populates the DSC PPS struct using the DSC configuration parameters in
92 * the order expected by the DSC Display Sink device. For the DSC, the sink
93 * device expects the PPS payload in big endian format for fields
94 * that span more than 1 byte.
Manasi Navarea408c852018-11-27 13:41:07 -080095 */
David Francisdbfbe712019-02-21 15:20:01 -050096void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_payload,
Manasi Navarea408c852018-11-27 13:41:07 -080097 const struct drm_dsc_config *dsc_cfg)
98{
99 int i;
100
Cai Huoqing0ae865e2021-07-30 21:27:29 +0800101 /* Protect against someone accidentally changing struct size */
David Francisdbfbe712019-02-21 15:20:01 -0500102 BUILD_BUG_ON(sizeof(*pps_payload) !=
Manasi Navarea408c852018-11-27 13:41:07 -0800103 DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1 + 1);
104
David Francisdbfbe712019-02-21 15:20:01 -0500105 memset(pps_payload, 0, sizeof(*pps_payload));
Manasi Navarea408c852018-11-27 13:41:07 -0800106
107 /* PPS 0 */
David Francisdbfbe712019-02-21 15:20:01 -0500108 pps_payload->dsc_version =
Manasi Navarea408c852018-11-27 13:41:07 -0800109 dsc_cfg->dsc_version_minor |
110 dsc_cfg->dsc_version_major << DSC_PPS_VERSION_MAJOR_SHIFT;
111
112 /* PPS 1, 2 is 0 */
113
114 /* PPS 3 */
David Francisdbfbe712019-02-21 15:20:01 -0500115 pps_payload->pps_3 =
Manasi Navarea408c852018-11-27 13:41:07 -0800116 dsc_cfg->line_buf_depth |
117 dsc_cfg->bits_per_component << DSC_PPS_BPC_SHIFT;
118
119 /* PPS 4 */
David Francisdbfbe712019-02-21 15:20:01 -0500120 pps_payload->pps_4 =
Manasi Navarea408c852018-11-27 13:41:07 -0800121 ((dsc_cfg->bits_per_pixel & DSC_PPS_BPP_HIGH_MASK) >>
122 DSC_PPS_MSB_SHIFT) |
123 dsc_cfg->vbr_enable << DSC_PPS_VBR_EN_SHIFT |
David Francis06d7cec2019-02-21 15:20:00 -0500124 dsc_cfg->simple_422 << DSC_PPS_SIMPLE422_SHIFT |
Manasi Navarea408c852018-11-27 13:41:07 -0800125 dsc_cfg->convert_rgb << DSC_PPS_CONVERT_RGB_SHIFT |
126 dsc_cfg->block_pred_enable << DSC_PPS_BLOCK_PRED_EN_SHIFT;
127
128 /* PPS 5 */
David Francisdbfbe712019-02-21 15:20:01 -0500129 pps_payload->bits_per_pixel_low =
Manasi Navarea408c852018-11-27 13:41:07 -0800130 (dsc_cfg->bits_per_pixel & DSC_PPS_LSB_MASK);
131
132 /*
133 * The DSC panel expects the PPS packet to have big endian format
134 * for data spanning 2 bytes. Use a macro cpu_to_be16() to convert
135 * to big endian format. If format is little endian, it will swap
136 * bytes to convert to Big endian else keep it unchanged.
137 */
138
139 /* PPS 6, 7 */
David Francisdbfbe712019-02-21 15:20:01 -0500140 pps_payload->pic_height = cpu_to_be16(dsc_cfg->pic_height);
Manasi Navarea408c852018-11-27 13:41:07 -0800141
142 /* PPS 8, 9 */
David Francisdbfbe712019-02-21 15:20:01 -0500143 pps_payload->pic_width = cpu_to_be16(dsc_cfg->pic_width);
Manasi Navarea408c852018-11-27 13:41:07 -0800144
145 /* PPS 10, 11 */
David Francisdbfbe712019-02-21 15:20:01 -0500146 pps_payload->slice_height = cpu_to_be16(dsc_cfg->slice_height);
Manasi Navarea408c852018-11-27 13:41:07 -0800147
148 /* PPS 12, 13 */
David Francisdbfbe712019-02-21 15:20:01 -0500149 pps_payload->slice_width = cpu_to_be16(dsc_cfg->slice_width);
Manasi Navarea408c852018-11-27 13:41:07 -0800150
151 /* PPS 14, 15 */
David Francisdbfbe712019-02-21 15:20:01 -0500152 pps_payload->chunk_size = cpu_to_be16(dsc_cfg->slice_chunk_size);
Manasi Navarea408c852018-11-27 13:41:07 -0800153
154 /* PPS 16 */
David Francisdbfbe712019-02-21 15:20:01 -0500155 pps_payload->initial_xmit_delay_high =
Manasi Navarea408c852018-11-27 13:41:07 -0800156 ((dsc_cfg->initial_xmit_delay &
157 DSC_PPS_INIT_XMIT_DELAY_HIGH_MASK) >>
158 DSC_PPS_MSB_SHIFT);
159
160 /* PPS 17 */
David Francisdbfbe712019-02-21 15:20:01 -0500161 pps_payload->initial_xmit_delay_low =
Manasi Navarea408c852018-11-27 13:41:07 -0800162 (dsc_cfg->initial_xmit_delay & DSC_PPS_LSB_MASK);
163
164 /* PPS 18, 19 */
David Francisdbfbe712019-02-21 15:20:01 -0500165 pps_payload->initial_dec_delay =
Manasi Navarea408c852018-11-27 13:41:07 -0800166 cpu_to_be16(dsc_cfg->initial_dec_delay);
167
168 /* PPS 20 is 0 */
169
170 /* PPS 21 */
David Francisdbfbe712019-02-21 15:20:01 -0500171 pps_payload->initial_scale_value =
Manasi Navarea408c852018-11-27 13:41:07 -0800172 dsc_cfg->initial_scale_value;
173
174 /* PPS 22, 23 */
David Francisdbfbe712019-02-21 15:20:01 -0500175 pps_payload->scale_increment_interval =
Manasi Navarea408c852018-11-27 13:41:07 -0800176 cpu_to_be16(dsc_cfg->scale_increment_interval);
177
178 /* PPS 24 */
David Francisdbfbe712019-02-21 15:20:01 -0500179 pps_payload->scale_decrement_interval_high =
Manasi Navarea408c852018-11-27 13:41:07 -0800180 ((dsc_cfg->scale_decrement_interval &
181 DSC_PPS_SCALE_DEC_INT_HIGH_MASK) >>
182 DSC_PPS_MSB_SHIFT);
183
184 /* PPS 25 */
David Francisdbfbe712019-02-21 15:20:01 -0500185 pps_payload->scale_decrement_interval_low =
Manasi Navarea408c852018-11-27 13:41:07 -0800186 (dsc_cfg->scale_decrement_interval & DSC_PPS_LSB_MASK);
187
188 /* PPS 26[7:0], PPS 27[7:5] RESERVED */
189
190 /* PPS 27 */
David Francisdbfbe712019-02-21 15:20:01 -0500191 pps_payload->first_line_bpg_offset =
Manasi Navarea408c852018-11-27 13:41:07 -0800192 dsc_cfg->first_line_bpg_offset;
193
194 /* PPS 28, 29 */
David Francisdbfbe712019-02-21 15:20:01 -0500195 pps_payload->nfl_bpg_offset =
Manasi Navarea408c852018-11-27 13:41:07 -0800196 cpu_to_be16(dsc_cfg->nfl_bpg_offset);
197
198 /* PPS 30, 31 */
David Francisdbfbe712019-02-21 15:20:01 -0500199 pps_payload->slice_bpg_offset =
Manasi Navarea408c852018-11-27 13:41:07 -0800200 cpu_to_be16(dsc_cfg->slice_bpg_offset);
201
202 /* PPS 32, 33 */
David Francisdbfbe712019-02-21 15:20:01 -0500203 pps_payload->initial_offset =
Manasi Navarea408c852018-11-27 13:41:07 -0800204 cpu_to_be16(dsc_cfg->initial_offset);
205
206 /* PPS 34, 35 */
David Francisdbfbe712019-02-21 15:20:01 -0500207 pps_payload->final_offset = cpu_to_be16(dsc_cfg->final_offset);
Manasi Navarea408c852018-11-27 13:41:07 -0800208
209 /* PPS 36 */
David Francisdbfbe712019-02-21 15:20:01 -0500210 pps_payload->flatness_min_qp = dsc_cfg->flatness_min_qp;
Manasi Navarea408c852018-11-27 13:41:07 -0800211
212 /* PPS 37 */
David Francisdbfbe712019-02-21 15:20:01 -0500213 pps_payload->flatness_max_qp = dsc_cfg->flatness_max_qp;
Manasi Navarea408c852018-11-27 13:41:07 -0800214
215 /* PPS 38, 39 */
Jani Nikula1f22ed32020-12-08 14:33:50 +0200216 pps_payload->rc_model_size = cpu_to_be16(dsc_cfg->rc_model_size);
Manasi Navarea408c852018-11-27 13:41:07 -0800217
218 /* PPS 40 */
David Francisdbfbe712019-02-21 15:20:01 -0500219 pps_payload->rc_edge_factor = DSC_RC_EDGE_FACTOR_CONST;
Manasi Navarea408c852018-11-27 13:41:07 -0800220
221 /* PPS 41 */
David Francisdbfbe712019-02-21 15:20:01 -0500222 pps_payload->rc_quant_incr_limit0 =
Manasi Navarea408c852018-11-27 13:41:07 -0800223 dsc_cfg->rc_quant_incr_limit0;
224
225 /* PPS 42 */
David Francisdbfbe712019-02-21 15:20:01 -0500226 pps_payload->rc_quant_incr_limit1 =
Manasi Navarea408c852018-11-27 13:41:07 -0800227 dsc_cfg->rc_quant_incr_limit1;
228
229 /* PPS 43 */
David Francisdbfbe712019-02-21 15:20:01 -0500230 pps_payload->rc_tgt_offset = DSC_RC_TGT_OFFSET_LO_CONST |
Manasi Navarea408c852018-11-27 13:41:07 -0800231 DSC_RC_TGT_OFFSET_HI_CONST << DSC_PPS_RC_TGT_OFFSET_HI_SHIFT;
232
233 /* PPS 44 - 57 */
234 for (i = 0; i < DSC_NUM_BUF_RANGES - 1; i++)
David Francisdbfbe712019-02-21 15:20:01 -0500235 pps_payload->rc_buf_thresh[i] =
Manasi Navarea408c852018-11-27 13:41:07 -0800236 dsc_cfg->rc_buf_thresh[i];
237
238 /* PPS 58 - 87 */
239 /*
240 * For DSC sink programming the RC Range parameter fields
241 * are as follows: Min_qp[15:11], max_qp[10:6], offset[5:0]
242 */
243 for (i = 0; i < DSC_NUM_BUF_RANGES; i++) {
David Francisdbfbe712019-02-21 15:20:01 -0500244 pps_payload->rc_range_parameters[i] =
Ville Syrjälä40d51c02019-07-10 15:51:40 +0300245 cpu_to_be16((dsc_cfg->rc_range_params[i].range_min_qp <<
246 DSC_PPS_RC_RANGE_MINQP_SHIFT) |
247 (dsc_cfg->rc_range_params[i].range_max_qp <<
248 DSC_PPS_RC_RANGE_MAXQP_SHIFT) |
249 (dsc_cfg->rc_range_params[i].range_bpg_offset));
Manasi Navarea408c852018-11-27 13:41:07 -0800250 }
251
252 /* PPS 88 */
David Francisdbfbe712019-02-21 15:20:01 -0500253 pps_payload->native_422_420 = dsc_cfg->native_422 |
Manasi Navarea408c852018-11-27 13:41:07 -0800254 dsc_cfg->native_420 << DSC_PPS_NATIVE_420_SHIFT;
255
256 /* PPS 89 */
David Francisdbfbe712019-02-21 15:20:01 -0500257 pps_payload->second_line_bpg_offset =
Manasi Navarea408c852018-11-27 13:41:07 -0800258 dsc_cfg->second_line_bpg_offset;
259
260 /* PPS 90, 91 */
David Francisdbfbe712019-02-21 15:20:01 -0500261 pps_payload->nsl_bpg_offset =
Manasi Navarea408c852018-11-27 13:41:07 -0800262 cpu_to_be16(dsc_cfg->nsl_bpg_offset);
263
264 /* PPS 92, 93 */
David Francisdbfbe712019-02-21 15:20:01 -0500265 pps_payload->second_line_offset_adj =
Manasi Navarea408c852018-11-27 13:41:07 -0800266 cpu_to_be16(dsc_cfg->second_line_offset_adj);
267
268 /* PPS 94 - 127 are O */
269}
David Francisdbfbe712019-02-21 15:20:01 -0500270EXPORT_SYMBOL(drm_dsc_pps_payload_pack);
David Francisdc433322019-02-21 15:19:59 -0500271
272/**
273 * drm_dsc_compute_rc_parameters() - Write rate control
274 * parameters to the dsc configuration defined in
David Francis06d7cec2019-02-21 15:20:00 -0500275 * &struct drm_dsc_config in accordance with the DSC 1.2
David Francisdc433322019-02-21 15:19:59 -0500276 * specification. Some configuration fields must be present
277 * beforehand.
278 *
279 * @vdsc_cfg:
280 * DSC Configuration data partially filled by driver
281 */
282int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg)
283{
284 unsigned long groups_per_line = 0;
285 unsigned long groups_total = 0;
286 unsigned long num_extra_mux_bits = 0;
287 unsigned long slice_bits = 0;
288 unsigned long hrd_delay = 0;
289 unsigned long final_scale = 0;
290 unsigned long rbs_min = 0;
291
David Francis06d7cec2019-02-21 15:20:00 -0500292 if (vdsc_cfg->native_420 || vdsc_cfg->native_422) {
293 /* Number of groups used to code each line of a slice */
294 groups_per_line = DIV_ROUND_UP(vdsc_cfg->slice_width / 2,
295 DSC_RC_PIXELS_PER_GROUP);
David Francisdc433322019-02-21 15:19:59 -0500296
David Francis06d7cec2019-02-21 15:20:00 -0500297 /* chunksize in Bytes */
298 vdsc_cfg->slice_chunk_size = DIV_ROUND_UP(vdsc_cfg->slice_width / 2 *
299 vdsc_cfg->bits_per_pixel,
300 (8 * 16));
301 } else {
302 /* Number of groups used to code each line of a slice */
303 groups_per_line = DIV_ROUND_UP(vdsc_cfg->slice_width,
304 DSC_RC_PIXELS_PER_GROUP);
305
306 /* chunksize in Bytes */
307 vdsc_cfg->slice_chunk_size = DIV_ROUND_UP(vdsc_cfg->slice_width *
308 vdsc_cfg->bits_per_pixel,
309 (8 * 16));
310 }
David Francisdc433322019-02-21 15:19:59 -0500311
312 if (vdsc_cfg->convert_rgb)
313 num_extra_mux_bits = 3 * (vdsc_cfg->mux_word_size +
314 (4 * vdsc_cfg->bits_per_component + 4)
315 - 2);
David Francis06d7cec2019-02-21 15:20:00 -0500316 else if (vdsc_cfg->native_422)
317 num_extra_mux_bits = 4 * vdsc_cfg->mux_word_size +
318 (4 * vdsc_cfg->bits_per_component + 4) +
319 3 * (4 * vdsc_cfg->bits_per_component) - 2;
David Francisdc433322019-02-21 15:19:59 -0500320 else
321 num_extra_mux_bits = 3 * vdsc_cfg->mux_word_size +
322 (4 * vdsc_cfg->bits_per_component + 4) +
323 2 * (4 * vdsc_cfg->bits_per_component) - 2;
324 /* Number of bits in one Slice */
325 slice_bits = 8 * vdsc_cfg->slice_chunk_size * vdsc_cfg->slice_height;
326
327 while ((num_extra_mux_bits > 0) &&
328 ((slice_bits - num_extra_mux_bits) % vdsc_cfg->mux_word_size))
329 num_extra_mux_bits--;
330
331 if (groups_per_line < vdsc_cfg->initial_scale_value - 8)
332 vdsc_cfg->initial_scale_value = groups_per_line + 8;
333
334 /* scale_decrement_interval calculation according to DSC spec 1.11 */
335 if (vdsc_cfg->initial_scale_value > 8)
336 vdsc_cfg->scale_decrement_interval = groups_per_line /
337 (vdsc_cfg->initial_scale_value - 8);
338 else
339 vdsc_cfg->scale_decrement_interval = DSC_SCALE_DECREMENT_INTERVAL_MAX;
340
341 vdsc_cfg->final_offset = vdsc_cfg->rc_model_size -
342 (vdsc_cfg->initial_xmit_delay *
343 vdsc_cfg->bits_per_pixel + 8) / 16 + num_extra_mux_bits;
344
345 if (vdsc_cfg->final_offset >= vdsc_cfg->rc_model_size) {
346 DRM_DEBUG_KMS("FinalOfs < RcModelSze for this InitialXmitDelay\n");
347 return -ERANGE;
348 }
349
350 final_scale = (vdsc_cfg->rc_model_size * 8) /
351 (vdsc_cfg->rc_model_size - vdsc_cfg->final_offset);
352 if (vdsc_cfg->slice_height > 1)
353 /*
354 * NflBpgOffset is 16 bit value with 11 fractional bits
355 * hence we multiply by 2^11 for preserving the
356 * fractional part
357 */
358 vdsc_cfg->nfl_bpg_offset = DIV_ROUND_UP((vdsc_cfg->first_line_bpg_offset << 11),
359 (vdsc_cfg->slice_height - 1));
360 else
361 vdsc_cfg->nfl_bpg_offset = 0;
362
David Francisdc433322019-02-21 15:19:59 -0500363 /* Number of groups used to code the entire slice */
364 groups_total = groups_per_line * vdsc_cfg->slice_height;
365
366 /* slice_bpg_offset is 16 bit value with 11 fractional bits */
367 vdsc_cfg->slice_bpg_offset = DIV_ROUND_UP(((vdsc_cfg->rc_model_size -
368 vdsc_cfg->initial_offset +
369 num_extra_mux_bits) << 11),
370 groups_total);
371
372 if (final_scale > 9) {
373 /*
374 * ScaleIncrementInterval =
375 * finaloffset/((NflBpgOffset + SliceBpgOffset)*8(finalscale - 1.125))
376 * as (NflBpgOffset + SliceBpgOffset) has 11 bit fractional value,
377 * we need divide by 2^11 from pstDscCfg values
378 */
379 vdsc_cfg->scale_increment_interval =
380 (vdsc_cfg->final_offset * (1 << 11)) /
381 ((vdsc_cfg->nfl_bpg_offset +
382 vdsc_cfg->slice_bpg_offset) *
383 (final_scale - 9));
384 } else {
385 /*
386 * If finalScaleValue is less than or equal to 9, a value of 0 should
387 * be used to disable the scale increment at the end of the slice
388 */
389 vdsc_cfg->scale_increment_interval = 0;
390 }
391
David Francisdc433322019-02-21 15:19:59 -0500392 /*
393 * DSC spec mentions that bits_per_pixel specifies the target
394 * bits/pixel (bpp) rate that is used by the encoder,
395 * in steps of 1/16 of a bit per pixel
396 */
397 rbs_min = vdsc_cfg->rc_model_size - vdsc_cfg->initial_offset +
398 DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay *
399 vdsc_cfg->bits_per_pixel, 16) +
400 groups_per_line * vdsc_cfg->first_line_bpg_offset;
401
402 hrd_delay = DIV_ROUND_UP((rbs_min * 16), vdsc_cfg->bits_per_pixel);
403 vdsc_cfg->rc_bits = (hrd_delay * vdsc_cfg->bits_per_pixel) / 16;
404 vdsc_cfg->initial_dec_delay = hrd_delay - vdsc_cfg->initial_xmit_delay;
405
406 return 0;
407}
408EXPORT_SYMBOL(drm_dsc_compute_rc_parameters);