1 1.1 riastrad /* $NetBSD: drm_dsc.h,v 1.2 2021/12/18 23:45:45 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* SPDX-License-Identifier: MIT 4 1.1 riastrad * Copyright (C) 2018 Intel Corp. 5 1.1 riastrad * 6 1.1 riastrad * Authors: 7 1.1 riastrad * Manasi Navare <manasi.d.navare (at) intel.com> 8 1.1 riastrad */ 9 1.1 riastrad 10 1.1 riastrad #ifndef DRM_DSC_H_ 11 1.1 riastrad #define DRM_DSC_H_ 12 1.1 riastrad 13 1.1 riastrad #include <drm/drm_dp_helper.h> 14 1.1 riastrad 15 1.1 riastrad /* VESA Display Stream Compression DSC 1.2 constants */ 16 1.1 riastrad #define DSC_NUM_BUF_RANGES 15 17 1.1 riastrad #define DSC_MUX_WORD_SIZE_8_10_BPC 48 18 1.1 riastrad #define DSC_MUX_WORD_SIZE_12_BPC 64 19 1.1 riastrad #define DSC_RC_PIXELS_PER_GROUP 3 20 1.1 riastrad #define DSC_SCALE_DECREMENT_INTERVAL_MAX 4095 21 1.1 riastrad #define DSC_RANGE_BPG_OFFSET_MASK 0x3f 22 1.1 riastrad 23 1.1 riastrad /* DSC Rate Control Constants */ 24 1.1 riastrad #define DSC_RC_MODEL_SIZE_CONST 8192 25 1.1 riastrad #define DSC_RC_EDGE_FACTOR_CONST 6 26 1.1 riastrad #define DSC_RC_TGT_OFFSET_HI_CONST 3 27 1.1 riastrad #define DSC_RC_TGT_OFFSET_LO_CONST 3 28 1.1 riastrad 29 1.1 riastrad /* DSC PPS constants and macros */ 30 1.1 riastrad #define DSC_PPS_VERSION_MAJOR_SHIFT 4 31 1.1 riastrad #define DSC_PPS_BPC_SHIFT 4 32 1.1 riastrad #define DSC_PPS_MSB_SHIFT 8 33 1.1 riastrad #define DSC_PPS_LSB_MASK (0xFF << 0) 34 1.1 riastrad #define DSC_PPS_BPP_HIGH_MASK (0x3 << 8) 35 1.1 riastrad #define DSC_PPS_VBR_EN_SHIFT 2 36 1.1 riastrad #define DSC_PPS_SIMPLE422_SHIFT 3 37 1.1 riastrad #define DSC_PPS_CONVERT_RGB_SHIFT 4 38 1.1 riastrad #define DSC_PPS_BLOCK_PRED_EN_SHIFT 5 39 1.1 riastrad #define DSC_PPS_INIT_XMIT_DELAY_HIGH_MASK (0x3 << 8) 40 1.1 riastrad #define DSC_PPS_SCALE_DEC_INT_HIGH_MASK (0xF << 8) 41 1.1 riastrad #define DSC_PPS_RC_TGT_OFFSET_HI_SHIFT 4 42 1.1 riastrad #define DSC_PPS_RC_RANGE_MINQP_SHIFT 11 43 1.1 riastrad #define DSC_PPS_RC_RANGE_MAXQP_SHIFT 6 44 1.1 riastrad #define DSC_PPS_NATIVE_420_SHIFT 1 45 1.1 riastrad #define DSC_1_2_MAX_LINEBUF_DEPTH_BITS 16 46 1.1 riastrad #define DSC_1_2_MAX_LINEBUF_DEPTH_VAL 0 47 1.1 riastrad #define DSC_1_1_MAX_LINEBUF_DEPTH_BITS 13 48 1.1 riastrad 49 1.1 riastrad /** 50 1.1 riastrad * struct drm_dsc_rc_range_parameters - DSC Rate Control range parameters 51 1.1 riastrad * 52 1.1 riastrad * This defines different rate control parameters used by the DSC engine 53 1.1 riastrad * to compress the frame. 54 1.1 riastrad */ 55 1.1 riastrad struct drm_dsc_rc_range_parameters { 56 1.1 riastrad /** 57 1.1 riastrad * @range_min_qp: Min Quantization Parameters allowed for this range 58 1.1 riastrad */ 59 1.1 riastrad u8 range_min_qp; 60 1.1 riastrad /** 61 1.1 riastrad * @range_max_qp: Max Quantization Parameters allowed for this range 62 1.1 riastrad */ 63 1.1 riastrad u8 range_max_qp; 64 1.1 riastrad /** 65 1.1 riastrad * @range_bpg_offset: 66 1.1 riastrad * Bits/group offset to apply to target for this group 67 1.1 riastrad */ 68 1.1 riastrad u8 range_bpg_offset; 69 1.1 riastrad }; 70 1.1 riastrad 71 1.1 riastrad /** 72 1.1 riastrad * struct drm_dsc_config - Parameters required to configure DSC 73 1.1 riastrad * 74 1.1 riastrad * Driver populates this structure with all the parameters required 75 1.1 riastrad * to configure the display stream compression on the source. 76 1.1 riastrad */ 77 1.1 riastrad struct drm_dsc_config { 78 1.1 riastrad /** 79 1.1 riastrad * @line_buf_depth: 80 1.1 riastrad * Bits per component for previous reconstructed line buffer 81 1.1 riastrad */ 82 1.1 riastrad u8 line_buf_depth; 83 1.1 riastrad /** 84 1.1 riastrad * @bits_per_component: Bits per component to code (8/10/12) 85 1.1 riastrad */ 86 1.1 riastrad u8 bits_per_component; 87 1.1 riastrad /** 88 1.1 riastrad * @convert_rgb: 89 1.1 riastrad * Flag to indicate if RGB - YCoCg conversion is needed 90 1.1 riastrad * True if RGB input, False if YCoCg input 91 1.1 riastrad */ 92 1.1 riastrad bool convert_rgb; 93 1.1 riastrad /** 94 1.1 riastrad * @slice_count: Number fo slices per line used by the DSC encoder 95 1.1 riastrad */ 96 1.1 riastrad u8 slice_count; 97 1.1 riastrad /** 98 1.1 riastrad * @slice_width: Width of each slice in pixels 99 1.1 riastrad */ 100 1.1 riastrad u16 slice_width; 101 1.1 riastrad /** 102 1.1 riastrad * @slice_height: Slice height in pixels 103 1.1 riastrad */ 104 1.1 riastrad u16 slice_height; 105 1.1 riastrad /** 106 1.1 riastrad * @simple_422: True if simple 4_2_2 mode is enabled else False 107 1.1 riastrad */ 108 1.1 riastrad bool simple_422; 109 1.1 riastrad /** 110 1.1 riastrad * @pic_width: Width of the input display frame in pixels 111 1.1 riastrad */ 112 1.1 riastrad u16 pic_width; 113 1.1 riastrad /** 114 1.1 riastrad * @pic_height: Vertical height of the input display frame 115 1.1 riastrad */ 116 1.1 riastrad u16 pic_height; 117 1.1 riastrad /** 118 1.1 riastrad * @rc_tgt_offset_high: 119 1.1 riastrad * Offset to bits/group used by RC to determine QP adjustment 120 1.1 riastrad */ 121 1.1 riastrad u8 rc_tgt_offset_high; 122 1.1 riastrad /** 123 1.1 riastrad * @rc_tgt_offset_low: 124 1.1 riastrad * Offset to bits/group used by RC to determine QP adjustment 125 1.1 riastrad */ 126 1.1 riastrad u8 rc_tgt_offset_low; 127 1.1 riastrad /** 128 1.1 riastrad * @bits_per_pixel: 129 1.1 riastrad * Target bits per pixel with 4 fractional bits, bits_per_pixel << 4 130 1.1 riastrad */ 131 1.1 riastrad u16 bits_per_pixel; 132 1.1 riastrad /** 133 1.1 riastrad * @rc_edge_factor: 134 1.1 riastrad * Factor to determine if an edge is present based on the bits produced 135 1.1 riastrad */ 136 1.1 riastrad u8 rc_edge_factor; 137 1.1 riastrad /** 138 1.1 riastrad * @rc_quant_incr_limit1: 139 1.1 riastrad * Slow down incrementing once the range reaches this value 140 1.1 riastrad */ 141 1.1 riastrad u8 rc_quant_incr_limit1; 142 1.1 riastrad /** 143 1.1 riastrad * @rc_quant_incr_limit0: 144 1.1 riastrad * Slow down incrementing once the range reaches this value 145 1.1 riastrad */ 146 1.1 riastrad u8 rc_quant_incr_limit0; 147 1.1 riastrad /** 148 1.1 riastrad * @initial_xmit_delay: 149 1.1 riastrad * Number of pixels to delay the initial transmission 150 1.1 riastrad */ 151 1.1 riastrad u16 initial_xmit_delay; 152 1.1 riastrad /** 153 1.1 riastrad * @initial_dec_delay: 154 1.1 riastrad * Initial decoder delay, number of pixel times that the decoder 155 1.1 riastrad * accumulates data in its rate buffer before starting to decode 156 1.1 riastrad * and output pixels. 157 1.1 riastrad */ 158 1.1 riastrad u16 initial_dec_delay; 159 1.1 riastrad /** 160 1.1 riastrad * @block_pred_enable: 161 1.1 riastrad * True if block prediction is used to code any groups within the 162 1.1 riastrad * picture. False if BP not used 163 1.1 riastrad */ 164 1.1 riastrad bool block_pred_enable; 165 1.1 riastrad /** 166 1.1 riastrad * @first_line_bpg_offset: 167 1.1 riastrad * Number of additional bits allocated for each group on the first 168 1.1 riastrad * line of slice. 169 1.1 riastrad */ 170 1.1 riastrad u8 first_line_bpg_offset; 171 1.1 riastrad /** 172 1.1 riastrad * @initial_offset: Value to use for RC model offset at slice start 173 1.1 riastrad */ 174 1.1 riastrad u16 initial_offset; 175 1.1 riastrad /** 176 1.1 riastrad * @rc_buf_thresh: Thresholds defining each of the buffer ranges 177 1.1 riastrad */ 178 1.1 riastrad u16 rc_buf_thresh[DSC_NUM_BUF_RANGES - 1]; 179 1.1 riastrad /** 180 1.1 riastrad * @rc_range_params: 181 1.1 riastrad * Parameters for each of the RC ranges defined in 182 1.1 riastrad * &struct drm_dsc_rc_range_parameters 183 1.1 riastrad */ 184 1.1 riastrad struct drm_dsc_rc_range_parameters rc_range_params[DSC_NUM_BUF_RANGES]; 185 1.1 riastrad /** 186 1.1 riastrad * @rc_model_size: Total size of RC model 187 1.1 riastrad */ 188 1.1 riastrad u16 rc_model_size; 189 1.1 riastrad /** 190 1.1 riastrad * @flatness_min_qp: Minimum QP where flatness information is sent 191 1.1 riastrad */ 192 1.1 riastrad u8 flatness_min_qp; 193 1.1 riastrad /** 194 1.1 riastrad * @flatness_max_qp: Maximum QP where flatness information is sent 195 1.1 riastrad */ 196 1.1 riastrad u8 flatness_max_qp; 197 1.1 riastrad /** 198 1.1 riastrad * @initial_scale_value: Initial value for the scale factor 199 1.1 riastrad */ 200 1.1 riastrad u8 initial_scale_value; 201 1.1 riastrad /** 202 1.1 riastrad * @scale_decrement_interval: 203 1.1 riastrad * Specifies number of group times between decrementing the scale factor 204 1.1 riastrad * at beginning of a slice. 205 1.1 riastrad */ 206 1.1 riastrad u16 scale_decrement_interval; 207 1.1 riastrad /** 208 1.1 riastrad * @scale_increment_interval: 209 1.1 riastrad * Number of group times between incrementing the scale factor value 210 1.1 riastrad * used at the beginning of a slice. 211 1.1 riastrad */ 212 1.1 riastrad u16 scale_increment_interval; 213 1.1 riastrad /** 214 1.1 riastrad * @nfl_bpg_offset: Non first line BPG offset to be used 215 1.1 riastrad */ 216 1.1 riastrad u16 nfl_bpg_offset; 217 1.1 riastrad /** 218 1.1 riastrad * @slice_bpg_offset: BPG offset used to enforce slice bit 219 1.1 riastrad */ 220 1.1 riastrad u16 slice_bpg_offset; 221 1.1 riastrad /** 222 1.1 riastrad * @final_offset: Final RC linear transformation offset value 223 1.1 riastrad */ 224 1.1 riastrad u16 final_offset; 225 1.1 riastrad /** 226 1.1 riastrad * @vbr_enable: True if VBR mode is enabled, false if disabled 227 1.1 riastrad */ 228 1.1 riastrad bool vbr_enable; 229 1.1 riastrad /** 230 1.1 riastrad * @mux_word_size: Mux word size (in bits) for SSM mode 231 1.1 riastrad */ 232 1.1 riastrad u8 mux_word_size; 233 1.1 riastrad /** 234 1.1 riastrad * @slice_chunk_size: 235 1.1 riastrad * The (max) size in bytes of the "chunks" that are used in slice 236 1.1 riastrad * multiplexing. 237 1.1 riastrad */ 238 1.1 riastrad u16 slice_chunk_size; 239 1.1 riastrad /** 240 1.1 riastrad * @rc_bits: Rate control buffer size in bits 241 1.1 riastrad */ 242 1.1 riastrad u16 rc_bits; 243 1.1 riastrad /** 244 1.1 riastrad * @dsc_version_minor: DSC minor version 245 1.1 riastrad */ 246 1.1 riastrad u8 dsc_version_minor; 247 1.1 riastrad /** 248 1.1 riastrad * @dsc_version_major: DSC major version 249 1.1 riastrad */ 250 1.1 riastrad u8 dsc_version_major; 251 1.1 riastrad /** 252 1.1 riastrad * @native_422: True if Native 4:2:2 supported, else false 253 1.1 riastrad */ 254 1.1 riastrad bool native_422; 255 1.1 riastrad /** 256 1.1 riastrad * @native_420: True if Native 4:2:0 supported else false. 257 1.1 riastrad */ 258 1.1 riastrad bool native_420; 259 1.1 riastrad /** 260 1.1 riastrad * @second_line_bpg_offset: 261 1.1 riastrad * Additional bits/grp for seconnd line of slice for native 4:2:0 262 1.1 riastrad */ 263 1.1 riastrad u8 second_line_bpg_offset; 264 1.1 riastrad /** 265 1.1 riastrad * @nsl_bpg_offset: 266 1.1 riastrad * Num of bits deallocated for each grp that is not in second line of 267 1.1 riastrad * slice 268 1.1 riastrad */ 269 1.1 riastrad u16 nsl_bpg_offset; 270 1.1 riastrad /** 271 1.1 riastrad * @second_line_offset_adj: 272 1.1 riastrad * Offset adjustment for second line in Native 4:2:0 mode 273 1.1 riastrad */ 274 1.1 riastrad u16 second_line_offset_adj; 275 1.1 riastrad }; 276 1.1 riastrad 277 1.1 riastrad /** 278 1.1 riastrad * struct picture_parameter_set - Represents 128 bytes of Picture Parameter Set 279 1.1 riastrad * 280 1.1 riastrad * The VESA DSC standard defines picture parameter set (PPS) which display 281 1.1 riastrad * stream compression encoders must communicate to decoders. 282 1.1 riastrad * The PPS is encapsulated in 128 bytes (PPS 0 through PPS 127). The fields in 283 1.1 riastrad * this structure are as per Table 4.1 in Vesa DSC specification v1.1/v1.2. 284 1.1 riastrad * The PPS fields that span over more than a byte should be stored in Big Endian 285 1.1 riastrad * format. 286 1.1 riastrad */ 287 1.1 riastrad struct drm_dsc_picture_parameter_set { 288 1.1 riastrad /** 289 1.1 riastrad * @dsc_version: 290 1.1 riastrad * PPS0[3:0] - dsc_version_minor: Contains Minor version of DSC 291 1.1 riastrad * PPS0[7:4] - dsc_version_major: Contains major version of DSC 292 1.1 riastrad */ 293 1.1 riastrad u8 dsc_version; 294 1.1 riastrad /** 295 1.1 riastrad * @pps_identifier: 296 1.1 riastrad * PPS1[7:0] - Application specific identifier that can be 297 1.1 riastrad * used to differentiate between different PPS tables. 298 1.1 riastrad */ 299 1.1 riastrad u8 pps_identifier; 300 1.1 riastrad /** 301 1.1 riastrad * @pps_reserved: 302 1.1 riastrad * PPS2[7:0]- RESERVED Byte 303 1.1 riastrad */ 304 1.1 riastrad u8 pps_reserved; 305 1.1 riastrad /** 306 1.1 riastrad * @pps_3: 307 1.1 riastrad * PPS3[3:0] - linebuf_depth: Contains linebuffer bit depth used to 308 1.1 riastrad * generate the bitstream. (0x0 - 16 bits for DSC 1.2, 0x8 - 8 bits, 309 1.1 riastrad * 0xA - 10 bits, 0xB - 11 bits, 0xC - 12 bits, 0xD - 13 bits, 310 1.1 riastrad * 0xE - 14 bits for DSC1.2, 0xF - 14 bits for DSC 1.2. 311 1.1 riastrad * PPS3[7:4] - bits_per_component: Bits per component for the original 312 1.1 riastrad * pixels of the encoded picture. 313 1.1 riastrad * 0x0 = 16bpc (allowed only when dsc_version_minor = 0x2) 314 1.1 riastrad * 0x8 = 8bpc, 0xA = 10bpc, 0xC = 12bpc, 0xE = 14bpc (also 315 1.1 riastrad * allowed only when dsc_minor_version = 0x2) 316 1.1 riastrad */ 317 1.1 riastrad u8 pps_3; 318 1.1 riastrad /** 319 1.1 riastrad * @pps_4: 320 1.1 riastrad * PPS4[1:0] -These are the most significant 2 bits of 321 1.1 riastrad * compressed BPP bits_per_pixel[9:0] syntax element. 322 1.1 riastrad * PPS4[2] - vbr_enable: 0 = VBR disabled, 1 = VBR enabled 323 1.1 riastrad * PPS4[3] - simple_422: Indicates if decoder drops samples to 324 1.1 riastrad * reconstruct the 4:2:2 picture. 325 1.1 riastrad * PPS4[4] - Convert_rgb: Indicates if DSC color space conversion is 326 1.1 riastrad * active. 327 1.1 riastrad * PPS4[5] - blobk_pred_enable: Indicates if BP is used to code any 328 1.1 riastrad * groups in picture 329 1.1 riastrad * PPS4[7:6] - Reseved bits 330 1.1 riastrad */ 331 1.1 riastrad u8 pps_4; 332 1.1 riastrad /** 333 1.1 riastrad * @bits_per_pixel_low: 334 1.1 riastrad * PPS5[7:0] - This indicates the lower significant 8 bits of 335 1.1 riastrad * the compressed BPP bits_per_pixel[9:0] element. 336 1.1 riastrad */ 337 1.1 riastrad u8 bits_per_pixel_low; 338 1.1 riastrad /** 339 1.1 riastrad * @pic_height: 340 1.1 riastrad * PPS6[7:0], PPS7[7:0] -pic_height: Specifies the number of pixel rows 341 1.1 riastrad * within the raster. 342 1.1 riastrad */ 343 1.1 riastrad __be16 pic_height; 344 1.1 riastrad /** 345 1.1 riastrad * @pic_width: 346 1.1 riastrad * PPS8[7:0], PPS9[7:0] - pic_width: Number of pixel columns within 347 1.1 riastrad * the raster. 348 1.1 riastrad */ 349 1.1 riastrad __be16 pic_width; 350 1.1 riastrad /** 351 1.1 riastrad * @slice_height: 352 1.1 riastrad * PPS10[7:0], PPS11[7:0] - Slice height in units of pixels. 353 1.1 riastrad */ 354 1.1 riastrad __be16 slice_height; 355 1.1 riastrad /** 356 1.1 riastrad * @slice_width: 357 1.1 riastrad * PPS12[7:0], PPS13[7:0] - Slice width in terms of pixels. 358 1.1 riastrad */ 359 1.1 riastrad __be16 slice_width; 360 1.1 riastrad /** 361 1.1 riastrad * @chunk_size: 362 1.1 riastrad * PPS14[7:0], PPS15[7:0] - Size in units of bytes of the chunks 363 1.1 riastrad * that are used for slice multiplexing. 364 1.1 riastrad */ 365 1.1 riastrad __be16 chunk_size; 366 1.1 riastrad /** 367 1.1 riastrad * @initial_xmit_delay_high: 368 1.1 riastrad * PPS16[1:0] - Most Significant two bits of initial transmission delay. 369 1.1 riastrad * It specifies the number of pixel times that the encoder waits before 370 1.1 riastrad * transmitting data from its rate buffer. 371 1.1 riastrad * PPS16[7:2] - Reserved 372 1.1 riastrad */ 373 1.1 riastrad u8 initial_xmit_delay_high; 374 1.1 riastrad /** 375 1.1 riastrad * @initial_xmit_delay_low: 376 1.1 riastrad * PPS17[7:0] - Least significant 8 bits of initial transmission delay. 377 1.1 riastrad */ 378 1.1 riastrad u8 initial_xmit_delay_low; 379 1.1 riastrad /** 380 1.1 riastrad * @initial_dec_delay: 381 1.1 riastrad * 382 1.1 riastrad * PPS18[7:0], PPS19[7:0] - Initial decoding delay which is the number 383 1.1 riastrad * of pixel times that the decoder accumulates data in its rate buffer 384 1.1 riastrad * before starting to decode and output pixels. 385 1.1 riastrad */ 386 1.1 riastrad __be16 initial_dec_delay; 387 1.1 riastrad /** 388 1.1 riastrad * @pps20_reserved: 389 1.1 riastrad * 390 1.1 riastrad * PPS20[7:0] - Reserved 391 1.1 riastrad */ 392 1.1 riastrad u8 pps20_reserved; 393 1.1 riastrad /** 394 1.1 riastrad * @initial_scale_value: 395 1.1 riastrad * PPS21[5:0] - Initial rcXformScale factor used at beginning 396 1.1 riastrad * of a slice. 397 1.1 riastrad * PPS21[7:6] - Reserved 398 1.1 riastrad */ 399 1.1 riastrad u8 initial_scale_value; 400 1.1 riastrad /** 401 1.1 riastrad * @scale_increment_interval: 402 1.1 riastrad * PPS22[7:0], PPS23[7:0] - Number of group times between incrementing 403 1.1 riastrad * the rcXformScale factor at end of a slice. 404 1.1 riastrad */ 405 1.1 riastrad __be16 scale_increment_interval; 406 1.1 riastrad /** 407 1.1 riastrad * @scale_decrement_interval_high: 408 1.1 riastrad * PPS24[3:0] - Higher 4 bits indicating number of group times between 409 1.1 riastrad * decrementing the rcXformScale factor at beginning of a slice. 410 1.1 riastrad * PPS24[7:4] - Reserved 411 1.1 riastrad */ 412 1.1 riastrad u8 scale_decrement_interval_high; 413 1.1 riastrad /** 414 1.1 riastrad * @scale_decrement_interval_low: 415 1.1 riastrad * PPS25[7:0] - Lower 8 bits of scale decrement interval 416 1.1 riastrad */ 417 1.1 riastrad u8 scale_decrement_interval_low; 418 1.1 riastrad /** 419 1.1 riastrad * @pps26_reserved: 420 1.1 riastrad * PPS26[7:0] 421 1.1 riastrad */ 422 1.1 riastrad u8 pps26_reserved; 423 1.1 riastrad /** 424 1.1 riastrad * @first_line_bpg_offset: 425 1.1 riastrad * PPS27[4:0] - Number of additional bits that are allocated 426 1.1 riastrad * for each group on first line of a slice. 427 1.1 riastrad * PPS27[7:5] - Reserved 428 1.1 riastrad */ 429 1.1 riastrad u8 first_line_bpg_offset; 430 1.1 riastrad /** 431 1.1 riastrad * @nfl_bpg_offset: 432 1.1 riastrad * PPS28[7:0], PPS29[7:0] - Number of bits including frac bits 433 1.1 riastrad * deallocated for each group for groups after the first line of slice. 434 1.1 riastrad */ 435 1.1 riastrad __be16 nfl_bpg_offset; 436 1.1 riastrad /** 437 1.1 riastrad * @slice_bpg_offset: 438 1.1 riastrad * PPS30, PPS31[7:0] - Number of bits that are deallocated for each 439 1.1 riastrad * group to enforce the slice constraint. 440 1.1 riastrad */ 441 1.1 riastrad __be16 slice_bpg_offset; 442 1.1 riastrad /** 443 1.1 riastrad * @initial_offset: 444 1.1 riastrad * PPS32,33[7:0] - Initial value for rcXformOffset 445 1.1 riastrad */ 446 1.1 riastrad __be16 initial_offset; 447 1.1 riastrad /** 448 1.1 riastrad * @final_offset: 449 1.1 riastrad * PPS34,35[7:0] - Maximum end-of-slice value for rcXformOffset 450 1.1 riastrad */ 451 1.1 riastrad __be16 final_offset; 452 1.1 riastrad /** 453 1.1 riastrad * @flatness_min_qp: 454 1.1 riastrad * PPS36[4:0] - Minimum QP at which flatness is signaled and 455 1.1 riastrad * flatness QP adjustment is made. 456 1.1 riastrad * PPS36[7:5] - Reserved 457 1.1 riastrad */ 458 1.1 riastrad u8 flatness_min_qp; 459 1.1 riastrad /** 460 1.1 riastrad * @flatness_max_qp: 461 1.1 riastrad * PPS37[4:0] - Max QP at which flatness is signalled and 462 1.1 riastrad * the flatness adjustment is made. 463 1.1 riastrad * PPS37[7:5] - Reserved 464 1.1 riastrad */ 465 1.1 riastrad u8 flatness_max_qp; 466 1.1 riastrad /** 467 1.1 riastrad * @rc_model_size: 468 1.1 riastrad * PPS38,39[7:0] - Number of bits within RC Model. 469 1.1 riastrad */ 470 1.1 riastrad __be16 rc_model_size; 471 1.1 riastrad /** 472 1.1 riastrad * @rc_edge_factor: 473 1.1 riastrad * PPS40[3:0] - Ratio of current activity vs, previous 474 1.1 riastrad * activity to determine presence of edge. 475 1.1 riastrad * PPS40[7:4] - Reserved 476 1.1 riastrad */ 477 1.1 riastrad u8 rc_edge_factor; 478 1.1 riastrad /** 479 1.1 riastrad * @rc_quant_incr_limit0: 480 1.1 riastrad * PPS41[4:0] - QP threshold used in short term RC 481 1.1 riastrad * PPS41[7:5] - Reserved 482 1.1 riastrad */ 483 1.1 riastrad u8 rc_quant_incr_limit0; 484 1.1 riastrad /** 485 1.1 riastrad * @rc_quant_incr_limit1: 486 1.1 riastrad * PPS42[4:0] - QP threshold used in short term RC 487 1.1 riastrad * PPS42[7:5] - Reserved 488 1.1 riastrad */ 489 1.1 riastrad u8 rc_quant_incr_limit1; 490 1.1 riastrad /** 491 1.1 riastrad * @rc_tgt_offset: 492 1.1 riastrad * PPS43[3:0] - Lower end of the variability range around the target 493 1.1 riastrad * bits per group that is allowed by short term RC. 494 1.1 riastrad * PPS43[7:4]- Upper end of the variability range around the target 495 1.1 riastrad * bits per group that i allowed by short term rc. 496 1.1 riastrad */ 497 1.1 riastrad u8 rc_tgt_offset; 498 1.1 riastrad /** 499 1.1 riastrad * @rc_buf_thresh: 500 1.1 riastrad * PPS44[7:0] - PPS57[7:0] - Specifies the thresholds in RC model for 501 1.1 riastrad * the 15 ranges defined by 14 thresholds. 502 1.1 riastrad */ 503 1.1 riastrad u8 rc_buf_thresh[DSC_NUM_BUF_RANGES - 1]; 504 1.1 riastrad /** 505 1.1 riastrad * @rc_range_parameters: 506 1.1 riastrad * PPS58[7:0] - PPS87[7:0] 507 1.1 riastrad * Parameters that correspond to each of the 15 ranges. 508 1.1 riastrad */ 509 1.1 riastrad __be16 rc_range_parameters[DSC_NUM_BUF_RANGES]; 510 1.1 riastrad /** 511 1.1 riastrad * @native_422_420: 512 1.1 riastrad * PPS88[0] - 0 = Native 4:2:2 not used 513 1.1 riastrad * 1 = Native 4:2:2 used 514 1.1 riastrad * PPS88[1] - 0 = Native 4:2:0 not use 515 1.1 riastrad * 1 = Native 4:2:0 used 516 1.1 riastrad * PPS88[7:2] - Reserved 6 bits 517 1.1 riastrad */ 518 1.1 riastrad u8 native_422_420; 519 1.1 riastrad /** 520 1.1 riastrad * @second_line_bpg_offset: 521 1.1 riastrad * PPS89[4:0] - Additional bits/group budget for the 522 1.1 riastrad * second line of a slice in Native 4:2:0 mode. 523 1.1 riastrad * Set to 0 if DSC minor version is 1 or native420 is 0. 524 1.1 riastrad * PPS89[7:5] - Reserved 525 1.1 riastrad */ 526 1.1 riastrad u8 second_line_bpg_offset; 527 1.1 riastrad /** 528 1.1 riastrad * @nsl_bpg_offset: 529 1.1 riastrad * PPS90[7:0], PPS91[7:0] - Number of bits that are deallocated 530 1.1 riastrad * for each group that is not in the second line of a slice. 531 1.1 riastrad */ 532 1.1 riastrad __be16 nsl_bpg_offset; 533 1.1 riastrad /** 534 1.1 riastrad * @second_line_offset_adj: 535 1.1 riastrad * PPS92[7:0], PPS93[7:0] - Used as offset adjustment for the second 536 1.1 riastrad * line in Native 4:2:0 mode. 537 1.1 riastrad */ 538 1.1 riastrad __be16 second_line_offset_adj; 539 1.1 riastrad /** 540 1.1 riastrad * @pps_long_94_reserved: 541 1.1 riastrad * PPS 94, 95, 96, 97 - Reserved 542 1.1 riastrad */ 543 1.1 riastrad u32 pps_long_94_reserved; 544 1.1 riastrad /** 545 1.1 riastrad * @pps_long_98_reserved: 546 1.1 riastrad * PPS 98, 99, 100, 101 - Reserved 547 1.1 riastrad */ 548 1.1 riastrad u32 pps_long_98_reserved; 549 1.1 riastrad /** 550 1.1 riastrad * @pps_long_102_reserved: 551 1.1 riastrad * PPS 102, 103, 104, 105 - Reserved 552 1.1 riastrad */ 553 1.1 riastrad u32 pps_long_102_reserved; 554 1.1 riastrad /** 555 1.1 riastrad * @pps_long_106_reserved: 556 1.1 riastrad * PPS 106, 107, 108, 109 - reserved 557 1.1 riastrad */ 558 1.1 riastrad u32 pps_long_106_reserved; 559 1.1 riastrad /** 560 1.1 riastrad * @pps_long_110_reserved: 561 1.1 riastrad * PPS 110, 111, 112, 113 - reserved 562 1.1 riastrad */ 563 1.1 riastrad u32 pps_long_110_reserved; 564 1.1 riastrad /** 565 1.1 riastrad * @pps_long_114_reserved: 566 1.1 riastrad * PPS 114 - 117 - reserved 567 1.1 riastrad */ 568 1.1 riastrad u32 pps_long_114_reserved; 569 1.1 riastrad /** 570 1.1 riastrad * @pps_long_118_reserved: 571 1.1 riastrad * PPS 118 - 121 - reserved 572 1.1 riastrad */ 573 1.1 riastrad u32 pps_long_118_reserved; 574 1.1 riastrad /** 575 1.1 riastrad * @pps_long_122_reserved: 576 1.1 riastrad * PPS 122- 125 - reserved 577 1.1 riastrad */ 578 1.1 riastrad u32 pps_long_122_reserved; 579 1.1 riastrad /** 580 1.1 riastrad * @pps_short_126_reserved: 581 1.1 riastrad * PPS 126, 127 - reserved 582 1.1 riastrad */ 583 1.1 riastrad __be16 pps_short_126_reserved; 584 1.1 riastrad } __packed; 585 1.1 riastrad 586 1.1 riastrad /** 587 1.1 riastrad * struct drm_dsc_pps_infoframe - DSC infoframe carrying the Picture Parameter 588 1.1 riastrad * Set Metadata 589 1.1 riastrad * 590 1.1 riastrad * This structure represents the DSC PPS infoframe required to send the Picture 591 1.1 riastrad * Parameter Set metadata required before enabling VESA Display Stream 592 1.1 riastrad * Compression. This is based on the DP Secondary Data Packet structure and 593 1.1 riastrad * comprises of SDP Header as defined &struct struct dp_sdp_header in drm_dp_helper.h 594 1.1 riastrad * and PPS payload defined in &struct drm_dsc_picture_parameter_set. 595 1.1 riastrad * 596 1.1 riastrad * @pps_header: Header for PPS as per DP SDP header format of type 597 1.1 riastrad * &struct dp_sdp_header 598 1.1 riastrad * @pps_payload: PPS payload fields as per DSC specification Table 4-1 599 1.1 riastrad * as represented in &struct drm_dsc_picture_parameter_set 600 1.1 riastrad */ 601 1.1 riastrad struct drm_dsc_pps_infoframe { 602 1.1 riastrad struct dp_sdp_header pps_header; 603 1.1 riastrad struct drm_dsc_picture_parameter_set pps_payload; 604 1.1 riastrad } __packed; 605 1.1 riastrad 606 1.1 riastrad void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header); 607 1.1 riastrad void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_sdp, 608 1.1 riastrad const struct drm_dsc_config *dsc_cfg); 609 1.1 riastrad int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); 610 1.1 riastrad 611 1.1 riastrad #endif /* _DRM_DSC_H_ */ 612