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

drm/dsc: Define Display Stream Compression PPS infoframe

This patch defines a new header file for all the DSC 1.2 structures
and creates a structure for PPS infoframe which will be used to send
picture parameter set secondary data packet for display stream compression.
All the PPS infoframe syntax elements are taken from DSC 1.2 specification
from VESA.

v4:
* Remove redundant blankline in doc (Ville)
* use drm_dsc namespace for all structs (Ville)
* Use packed struct (Ville)
v3:
* Add the SPDX shorthand (Chris Wilson)
v2:
* Do not use bitfields in the struct (Jani Nikula)

Cc: Gaurav K Singh <gaurav.k.singh@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Acked-by: Sean Paul <seanpaul@chromium.org> (For merging through
drm-intel)
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181127214125.17658-2-manasi.d.navare@intel.com

+342
+342
include/drm/drm_dsc.h
··· 1 + /* SPDX-License-Identifier: MIT 2 + * Copyright (C) 2018 Intel Corp. 3 + * 4 + * Authors: 5 + * Manasi Navare <manasi.d.navare@intel.com> 6 + */ 7 + 8 + #ifndef DRM_DSC_H_ 9 + #define DRM_DSC_H_ 10 + 11 + #include <drm/drm_dp_helper.h> 12 + 13 + /* VESA Display Stream Compression DSC 1.2 constants */ 14 + #define DSC_NUM_BUF_RANGES 15 15 + 16 + /** 17 + * struct picture_parameter_set - Represents 128 bytes of Picture Parameter Set 18 + * 19 + * The VESA DSC standard defines picture parameter set (PPS) which display 20 + * stream compression encoders must communicate to decoders. 21 + * The PPS is encapsulated in 128 bytes (PPS 0 through PPS 127). The fields in 22 + * this structure are as per Table 4.1 in Vesa DSC specification v1.1/v1.2. 23 + * The PPS fields that span over more than a byte should be stored in Big Endian 24 + * format. 25 + */ 26 + struct drm_dsc_picture_parameter_set { 27 + /** 28 + * @dsc_version: 29 + * PPS0[3:0] - dsc_version_minor: Contains Minor version of DSC 30 + * PPS0[7:4] - dsc_version_major: Contains major version of DSC 31 + */ 32 + u8 dsc_version; 33 + /** 34 + * @pps_identifier: 35 + * PPS1[7:0] - Application specific identifier that can be 36 + * used to differentiate between different PPS tables. 37 + */ 38 + u8 pps_identifier; 39 + /** 40 + * @pps_reserved: 41 + * PPS2[7:0]- RESERVED Byte 42 + */ 43 + u8 pps_reserved; 44 + /** 45 + * @pps_3: 46 + * PPS3[3:0] - linebuf_depth: Contains linebuffer bit depth used to 47 + * generate the bitstream. (0x0 - 16 bits for DSC 1.2, 0x8 - 8 bits, 48 + * 0xA - 10 bits, 0xB - 11 bits, 0xC - 12 bits, 0xD - 13 bits, 49 + * 0xE - 14 bits for DSC1.2, 0xF - 14 bits for DSC 1.2. 50 + * PPS3[7:4] - bits_per_component: Bits per component for the original 51 + * pixels of the encoded picture. 52 + * 0x0 = 16bpc (allowed only when dsc_version_minor = 0x2) 53 + * 0x8 = 8bpc, 0xA = 10bpc, 0xC = 12bpc, 0xE = 14bpc (also 54 + * allowed only when dsc_minor_version = 0x2) 55 + */ 56 + u8 pps_3; 57 + /** 58 + * @pps_4: 59 + * PPS4[1:0] -These are the most significant 2 bits of 60 + * compressed BPP bits_per_pixel[9:0] syntax element. 61 + * PPS4[2] - vbr_enable: 0 = VBR disabled, 1 = VBR enabled 62 + * PPS4[3] - simple_422: Indicates if decoder drops samples to 63 + * reconstruct the 4:2:2 picture. 64 + * PPS4[4] - Convert_rgb: Indicates if DSC color space conversion is 65 + * active. 66 + * PPS4[5] - blobk_pred_enable: Indicates if BP is used to code any 67 + * groups in picture 68 + * PPS4[7:6] - Reseved bits 69 + */ 70 + u8 pps_4; 71 + /** 72 + * @bits_per_pixel_low: 73 + * PPS5[7:0] - This indicates the lower significant 8 bits of 74 + * the compressed BPP bits_per_pixel[9:0] element. 75 + */ 76 + u8 bits_per_pixel_low; 77 + /** 78 + * @pic_height: 79 + * PPS6[7:0], PPS7[7:0] -pic_height: Specifies the number of pixel rows 80 + * within the raster. 81 + */ 82 + __be16 pic_height; 83 + /** 84 + * @pic_width: 85 + * PPS8[7:0], PPS9[7:0] - pic_width: Number of pixel columns within 86 + * the raster. 87 + */ 88 + __be16 pic_width; 89 + /** 90 + * @slice_height: 91 + * PPS10[7:0], PPS11[7:0] - Slice height in units of pixels. 92 + */ 93 + __be16 slice_height; 94 + /** 95 + * @slice_width: 96 + * PPS12[7:0], PPS13[7:0] - Slice width in terms of pixels. 97 + */ 98 + __be16 slice_width; 99 + /** 100 + * @chunk_size: 101 + * PPS14[7:0], PPS15[7:0] - Size in units of bytes of the chunks 102 + * that are used for slice multiplexing. 103 + */ 104 + __be16 chunk_size; 105 + /** 106 + * @initial_xmit_delay_high: 107 + * PPS16[1:0] - Most Significant two bits of initial transmission delay. 108 + * It specifies the number of pixel times that the encoder waits before 109 + * transmitting data from its rate buffer. 110 + * PPS16[7:2] - Reserved 111 + */ 112 + u8 initial_xmit_delay_high; 113 + /** 114 + * @initial_xmit_delay_low: 115 + * PPS17[7:0] - Least significant 8 bits of initial transmission delay. 116 + */ 117 + u8 initial_xmit_delay_low; 118 + /** 119 + * @initial_dec_delay: 120 + * 121 + * PPS18[7:0], PPS19[7:0] - Initial decoding delay which is the number 122 + * of pixel times that the decoder accumulates data in its rate buffer 123 + * before starting to decode and output pixels. 124 + */ 125 + __be16 initial_dec_delay; 126 + /** 127 + * @pps20_reserved: 128 + * 129 + * PPS20[7:0] - Reserved 130 + */ 131 + u8 pps20_reserved; 132 + /** 133 + * @initial_scale_value: 134 + * PPS21[5:0] - Initial rcXformScale factor used at beginning 135 + * of a slice. 136 + * PPS21[7:6] - Reserved 137 + */ 138 + u8 initial_scale_value; 139 + /** 140 + * @scale_increment_interval: 141 + * PPS22[7:0], PPS23[7:0] - Number of group times between incrementing 142 + * the rcXformScale factor at end of a slice. 143 + */ 144 + __be16 scale_increment_interval; 145 + /** 146 + * @scale_decrement_interval_high: 147 + * PPS24[3:0] - Higher 4 bits indicating number of group times between 148 + * decrementing the rcXformScale factor at beginning of a slice. 149 + * PPS24[7:4] - Reserved 150 + */ 151 + u8 scale_decrement_interval_high; 152 + /** 153 + * @scale_decrement_interval_low: 154 + * PPS25[7:0] - Lower 8 bits of scale decrement interval 155 + */ 156 + u8 scale_decrement_interval_low; 157 + /** 158 + * @pps26_reserved: 159 + * PPS26[7:0] 160 + */ 161 + u8 pps26_reserved; 162 + /** 163 + * @first_line_bpg_offset: 164 + * PPS27[4:0] - Number of additional bits that are allocated 165 + * for each group on first line of a slice. 166 + * PPS27[7:5] - Reserved 167 + */ 168 + u8 first_line_bpg_offset; 169 + /** 170 + * @nfl_bpg_offset: 171 + * PPS28[7:0], PPS29[7:0] - Number of bits including frac bits 172 + * deallocated for each group for groups after the first line of slice. 173 + */ 174 + __be16 nfl_bpg_offset; 175 + /** 176 + * @slice_bpg_offset: 177 + * PPS30, PPS31[7:0] - Number of bits that are deallocated for each 178 + * group to enforce the slice constraint. 179 + */ 180 + __be16 slice_bpg_offset; 181 + /** 182 + * @initial_offset: 183 + * PPS32,33[7:0] - Initial value for rcXformOffset 184 + */ 185 + __be16 initial_offset; 186 + /** 187 + * @final_offset: 188 + * PPS34,35[7:0] - Maximum end-of-slice value for rcXformOffset 189 + */ 190 + __be16 final_offset; 191 + /** 192 + * @flatness_min_qp: 193 + * PPS36[4:0] - Minimum QP at which flatness is signaled and 194 + * flatness QP adjustment is made. 195 + * PPS36[7:5] - Reserved 196 + */ 197 + u8 flatness_min_qp; 198 + /** 199 + * @flatness_max_qp: 200 + * PPS37[4:0] - Max QP at which flatness is signalled and 201 + * the flatness adjustment is made. 202 + * PPS37[7:5] - Reserved 203 + */ 204 + u8 flatness_max_qp; 205 + /** 206 + * @rc_model_size: 207 + * PPS38,39[7:0] - Number of bits within RC Model. 208 + */ 209 + __be16 rc_model_size; 210 + /** 211 + * @rc_edge_factor: 212 + * PPS40[3:0] - Ratio of current activity vs, previous 213 + * activity to determine presence of edge. 214 + * PPS40[7:4] - Reserved 215 + */ 216 + u8 rc_edge_factor; 217 + /** 218 + * @rc_quant_incr_limit0: 219 + * PPS41[4:0] - QP threshold used in short term RC 220 + * PPS41[7:5] - Reserved 221 + */ 222 + u8 rc_quant_incr_limit0; 223 + /** 224 + * @rc_quant_incr_limit1: 225 + * PPS42[4:0] - QP threshold used in short term RC 226 + * PPS42[7:5] - Reserved 227 + */ 228 + u8 rc_quant_incr_limit1; 229 + /** 230 + * @rc_tgt_offset: 231 + * PPS43[3:0] - Lower end of the variability range around the target 232 + * bits per group that is allowed by short term RC. 233 + * PPS43[7:4]- Upper end of the variability range around the target 234 + * bits per group that i allowed by short term rc. 235 + */ 236 + u8 rc_tgt_offset; 237 + /** 238 + * @rc_buf_thresh: 239 + * PPS44[7:0] - PPS57[7:0] - Specifies the thresholds in RC model for 240 + * the 15 ranges defined by 14 thresholds. 241 + */ 242 + u8 rc_buf_thresh[DSC_NUM_BUF_RANGES - 1]; 243 + /** 244 + * @rc_range_parameters: 245 + * PPS58[7:0] - PPS87[7:0] 246 + * Parameters that correspond to each of the 15 ranges. 247 + */ 248 + __be16 rc_range_parameters[DSC_NUM_BUF_RANGES]; 249 + /** 250 + * @native_422_420: 251 + * PPS88[0] - 0 = Native 4:2:2 not used 252 + * 1 = Native 4:2:2 used 253 + * PPS88[1] - 0 = Native 4:2:0 not use 254 + * 1 = Native 4:2:0 used 255 + * PPS88[7:2] - Reserved 6 bits 256 + */ 257 + u8 native_422_420; 258 + /** 259 + * @second_line_bpg_offset: 260 + * PPS89[4:0] - Additional bits/group budget for the 261 + * second line of a slice in Native 4:2:0 mode. 262 + * Set to 0 if DSC minor version is 1 or native420 is 0. 263 + * PPS89[7:5] - Reserved 264 + */ 265 + u8 second_line_bpg_offset; 266 + /** 267 + * @nsl_bpg_offset: 268 + * PPS90[7:0], PPS91[7:0] - Number of bits that are deallocated 269 + * for each group that is not in the second line of a slice. 270 + */ 271 + __be16 nsl_bpg_offset; 272 + /** 273 + * @second_line_offset_adj: 274 + * PPS92[7:0], PPS93[7:0] - Used as offset adjustment for the second 275 + * line in Native 4:2:0 mode. 276 + */ 277 + __be16 second_line_offset_adj; 278 + /** 279 + * @pps_long_94_reserved: 280 + * PPS 94, 95, 96, 97 - Reserved 281 + */ 282 + u32 pps_long_94_reserved; 283 + /** 284 + * @pps_long_98_reserved: 285 + * PPS 98, 99, 100, 101 - Reserved 286 + */ 287 + u32 pps_long_98_reserved; 288 + /** 289 + * @pps_long_102_reserved: 290 + * PPS 102, 103, 104, 105 - Reserved 291 + */ 292 + u32 pps_long_102_reserved; 293 + /** 294 + * @pps_long_106_reserved: 295 + * PPS 106, 107, 108, 109 - reserved 296 + */ 297 + u32 pps_long_106_reserved; 298 + /** 299 + * @pps_long_110_reserved: 300 + * PPS 110, 111, 112, 113 - reserved 301 + */ 302 + u32 pps_long_110_reserved; 303 + /** 304 + * @pps_long_114_reserved: 305 + * PPS 114 - 117 - reserved 306 + */ 307 + u32 pps_long_114_reserved; 308 + /** 309 + * @pps_long_118_reserved: 310 + * PPS 118 - 121 - reserved 311 + */ 312 + u32 pps_long_118_reserved; 313 + /** 314 + * @pps_long_122_reserved: 315 + * PPS 122- 125 - reserved 316 + */ 317 + u32 pps_long_122_reserved; 318 + /** 319 + * @pps_short_126_reserved: 320 + * PPS 126, 127 - reserved 321 + */ 322 + __be16 pps_short_126_reserved; 323 + } __packed; 324 + 325 + /** 326 + * struct drm_dsc_pps_infoframe - DSC infoframe carrying the Picture Parameter 327 + * Set Metadata 328 + * 329 + * This structure represents the DSC PPS infoframe required to send the Picture 330 + * Parameter Set metadata required before enabling VESA Display Stream 331 + * Compression. This is based on the DP Secondary Data Packet structure and 332 + * comprises of SDP Header as defined in drm_dp_helper.h and PPS payload. 333 + * 334 + * @pps_header: Header for PPS as per DP SDP header format 335 + * @pps_payload: PPS payload fields as per DSC specification Table 4-1 336 + */ 337 + struct drm_dsc_pps_infoframe { 338 + struct dp_sdp_header pps_header; 339 + struct drm_dsc_picture_parameter_set pps_payload; 340 + } __packed; 341 + 342 + #endif /* _DRM_DSC_H_ */