1 /* 2 * Copyright © 2018 NVIDIA Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 #ifndef VIC41_H 24 #define VIC41_H 25 26 #include <stdint.h> 27 28 #define NVB1B6_VIDEO_COMPOSITOR_SET_APPLICATION_ID 0x00000200 29 #define NVB1B6_VIDEO_COMPOSITOR_EXECUTE 0x00000300 30 #define NVB1B6_VIDEO_COMPOSITOR_SET_PICTURE_INDEX 0x00000700 31 #define NVB1B6_VIDEO_COMPOSITOR_SET_CONTROL_PARAMS 0x00000704 32 #define NVB1B6_VIDEO_COMPOSITOR_SET_CONFIG_STRUCT_OFFSET 0x00000708 33 #define NVB1B6_VIDEO_COMPOSITOR_SET_FILTER_STRUCT_OFFSET 0x0000070c 34 #define NVB1B6_VIDEO_COMPOSITOR_SET_HIST_OFFSET 0x00000714 35 #define NVB1B6_VIDEO_COMPOSITOR_SET_OUTPUT_SURFACE_LUMA_OFFSET 0x00000720 36 #define NVB1B6_VIDEO_COMPOSITOR_SET_HISTORY_BUFFER_OFFSET(slot) (0x00000780 + (slot) * 4) 37 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE0_LUMA_OFFSET(slot) (0x00001200 + (slot) * 0x00000060) 38 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE0_CHROMA_U_OFFSET(slot) (0x00001204 + (slot) * 0x00000060) 39 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE0_CHROMA_V_OFFSET(slot) (0x00001208 + (slot) * 0x00000060) 40 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE1_LUMA_OFFSET(slot) (0x0000120c + (slot) * 0x00000060) 41 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE1_CHROMA_U_OFFSET(slot) (0x00001210 + (slot) * 0x00000060) 42 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE1_CHROMA_V_OFFSET(slot) (0x00001214 + (slot) * 0x00000060) 43 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE2_LUMA_OFFSET(slot) (0x00001218 + (slot) * 0x00000060) 44 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE2_CHROMA_U_OFFSET(slot) (0x0000121c + (slot) * 0x00000060) 45 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE2_CHROMA_V_OFFSET(slot) (0x00001220 + (slot) * 0x00000060) 46 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE3_LUMA_OFFSET(slot) (0x00001224 + (slot) * 0x00000060) 47 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE3_CHROMA_U_OFFSET(slot) (0x00001228 + (slot) * 0x00000060) 48 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE3_CHROMA_V_OFFSET(slot) (0x0000122c + (slot) * 0x00000060) 49 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE4_LUMA_OFFSET(slot) (0x00001230 + (slot) * 0x00000060) 50 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE4_CHROMA_U_OFFSET(slot) (0x00001234 + (slot) * 0x00000060) 51 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE4_CHROMA_V_OFFSET(slot) (0x00001238 + (slot) * 0x00000060) 52 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE5_LUMA_OFFSET(slot) (0x0000123c + (slot) * 0x00000060) 53 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE5_CHROMA_U_OFFSET(slot) (0x00001240 + (slot) * 0x00000060) 54 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE5_CHROMA_V_OFFSET(slot) (0x00001244 + (slot) * 0x00000060) 55 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE6_LUMA_OFFSET(slot) (0x00001248 + (slot) * 0x00000060) 56 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE6_CHROMA_U_OFFSET(slot) (0x0000124c + (slot) * 0x00000060) 57 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE6_CHROMA_V_OFFSET(slot) (0x00001250 + (slot) * 0x00000060) 58 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE7_LUMA_OFFSET(slot) (0x00001254 + (slot) * 0x00000060) 59 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE7_CHROMA_U_OFFSET(slot) (0x00001258 + (slot) * 0x00000060) 60 #define NVB1B6_VIDEO_COMPOSITOR_SET_SURFACE7_CHROMA_V_OFFSET(slot) (0x0000125c + (slot) * 0x00000060) 61 62 typedef struct { 63 uint64_t SlotEnable : 1; /* 0 */ 64 uint64_t DeNoise : 1; /* 1 */ 65 uint64_t AdvancedDenoise : 1; /* 2 */ 66 uint64_t CadenceDetect : 1; /* 3 */ 67 uint64_t MotionMap : 1; /* 4 */ 68 uint64_t MMapCombine : 1; /* 5 */ 69 uint64_t IsEven : 1; /* 6 */ 70 uint64_t ChromaEven : 1; /* 7 */ 71 uint64_t CurrentFieldEnable : 1; /* 8 */ 72 uint64_t PrevFieldEnable : 1; /* 9 */ 73 uint64_t NextFieldEnable : 1; /* 10 */ 74 uint64_t NextNrFieldEnable : 1; /* 11 */ 75 uint64_t CurMotionFieldEnable : 1; /* 12 */ 76 uint64_t PrevMotionFieldEnable : 1; /* 13 */ 77 uint64_t PpMotionFieldEnable : 1; /* 14 */ 78 uint64_t CombMotionFieldEnable : 1; /* 15 */ 79 uint64_t FrameFormat : 4; /* 19..16 */ 80 uint64_t FilterLengthY : 2; /* 21..20 */ 81 uint64_t FilterLengthX : 2; /* 23..22 */ 82 uint64_t Panoramic : 12; /* 35..24 */ 83 uint64_t ChromaUpLengthY : 2; /* 37..36 */ 84 uint64_t ChromaUpLengthX : 2; /* 39..38 */ 85 uint64_t reserved1 : 18; /* 57..40 */ 86 uint64_t DetailFltClamp : 6; /* 63..58 */ 87 uint64_t FilterNoise : 10; /* 73..64 */ 88 uint64_t FilterDetail : 10; /* 83..74 */ 89 uint64_t ChromaNoise : 10; /* 93..84 */ 90 uint64_t ChromaDetail : 10; /* 103..94 */ 91 uint64_t DeinterlaceMode : 4; /* 107..104 */ 92 uint64_t MotionAccumWeight : 3; /* 110..108 */ 93 uint64_t NoiseIir : 11; /* 121..111 */ 94 uint64_t LightLevel : 4; /* 125..122 */ 95 uint64_t reserved4 : 2; /* 127..126 */ 96 /* 128 */ 97 uint64_t SoftClampLow : 10; /* 9..0 */ 98 uint64_t SoftClampHigh : 10; /* 19..10 */ 99 uint64_t reserved5 : 12; /* 31..20 */ 100 uint64_t reserved6 : 2; /* 33..32 */ 101 uint64_t PlanarAlpha : 8; /* 41..34 */ 102 uint64_t ConstantAlpha : 1; /* 42 */ 103 uint64_t StereoInterleave : 3; /* 45..43 */ 104 uint64_t ClipEnabled : 1; /* 46 */ 105 uint64_t ClearRectMask : 8; /* 54..47 */ 106 uint64_t DegammaMode : 2; /* 56..55 */ 107 uint64_t reserved7 : 1; /* 57 */ 108 uint64_t DecompressEnable : 1; /* 58 */ 109 uint64_t DecompressKind : 4; /* 62..59 */ 110 uint64_t reserved9 : 1; /* 63 */ 111 uint64_t DecompressCtbCount : 8; /* 71..64 */ 112 uint64_t DecompressZbcColor : 32; /* 103..72 */ 113 uint64_t reserved12 : 24; /* 127..104 */ 114 /* 256 */ 115 uint64_t SourceRectLeft : 30; /* 29..0 */ 116 uint64_t reserved14 : 2; /* 31..30 */ 117 uint64_t SourceRectRight : 30; /* 61..32 */ 118 uint64_t reserved15 : 2; /* 63..62 */ 119 uint64_t SourceRectTop : 30; /* 93..64 */ 120 uint64_t reserved16 : 2; /* 95..94 */ 121 uint64_t SourceRectBottom : 30; /* 125..96 */ 122 uint64_t reserved17 : 2; /* 127..126 */ 123 /* 384 */ 124 uint64_t DestRectLeft : 14; /* 13..0 */ 125 uint64_t reserved18 : 2; /* 15..14 */ 126 uint64_t DestRectRight : 14; /* 29..16 */ 127 uint64_t reserved19 : 2; /* 31..30 */ 128 uint64_t DestRectTop : 14; /* 45..32 */ 129 uint64_t reserved20 : 2; /* 47..46 */ 130 uint64_t DestRectBottom : 14; /* 61..48 */ 131 uint64_t reserved21 : 2; /* 63..62 */ 132 uint64_t reserved22 : 32; /* 95..64 */ 133 uint64_t reserved23 : 32; /* 127..96 */ 134 } SlotConfig; 135 136 typedef struct { 137 uint64_t SlotPixelFormat : 7; /* 6..0 */ 138 uint64_t SlotChromaLocHoriz : 2; /* 8..7 */ 139 uint64_t SlotChromaLocVert : 2; /* 10..9 */ 140 uint64_t SlotBlkKind : 4; /* 14..11 */ 141 uint64_t SlotBlkHeight : 4; /* 18..15 */ 142 uint64_t SlotCacheWidth : 3; /* 21..19 */ 143 uint64_t reserved0 : 10; /* 31..22 */ 144 uint64_t SlotSurfaceWidth : 14; /* 45..32 */ 145 uint64_t SlotSurfaceHeight : 14; /* 59..46 */ 146 uint64_t reserved1 : 4; /* 63..60 */ 147 uint64_t SlotLumaWidth : 14; /* 77..64 */ 148 uint64_t SlotLumaHeight : 14; /* 91..78 */ 149 uint64_t reserved2 : 4; /* 95..92 */ 150 uint64_t SlotChromaWidth : 14; /* 109..96 */ 151 uint64_t SlotChromaHeight : 14; /* 123..110 */ 152 uint64_t reserved3 : 4; /* 127..124 */ 153 } SlotSurfaceConfig; 154 155 typedef struct { 156 uint64_t luma_coeff0 : 20; /* 19..0 */ 157 uint64_t luma_coeff1 : 20; /* 39..20 */ 158 uint64_t luma_coeff2 : 20; /* 59..40 */ 159 uint64_t luma_r_shift : 4; /* 63..60 */ 160 uint64_t luma_coeff3 : 20; /* 83..64 */ 161 uint64_t LumaKeyLower : 10; /* 93..84 */ 162 uint64_t LumaKeyUpper : 10; /* 103..94 */ 163 uint64_t LumaKeyEnabled : 1; /* 104 */ 164 uint64_t reserved0 : 2; /* 106..105 */ 165 uint64_t reserved1 : 21; /* 127..107 */ 166 } LumaKeyStruct; 167 168 typedef struct { 169 uint64_t matrix_coeff00 : 20; /* 19..0 */ 170 uint64_t matrix_coeff10 : 20; /* 39..20 */ 171 uint64_t matrix_coeff20 : 20; /* 59..40 */ 172 uint64_t matrix_r_shift : 4; /* 63..60 */ 173 uint64_t matrix_coeff01 : 20; /* 83..64 */ 174 uint64_t matrix_coeff11 : 20; /* 103..84 */ 175 uint64_t matrix_coeff21 : 20; /* 123..104 */ 176 uint64_t reserved0 : 3; /* 126..124 */ 177 uint64_t matrix_enable : 1; /* 127 */ 178 /* 128 */ 179 uint64_t matrix_coeff02 : 20; /* 19..0 */ 180 uint64_t matrix_coeff12 : 20; /* 39..20 */ 181 uint64_t matrix_coeff22 : 20; /* 59..40 */ 182 uint64_t reserved1 : 4; /* 63..60 */ 183 uint64_t matrix_coeff03 : 20; /* 83..64 */ 184 uint64_t matrix_coeff13 : 20; /* 103..84 */ 185 uint64_t matrix_coeff23 : 20; /* 123..104 */ 186 uint64_t reserved2 : 4; /* 127..124 */ 187 } MatrixStruct; 188 189 typedef struct { 190 uint64_t ClearRect0Left : 14; /* 13..0 */ 191 uint64_t reserved0 : 2; /* 15..14 */ 192 uint64_t ClearRect0Right : 14; /* 29..16 */ 193 uint64_t reserved1 : 2; /* 31..30 */ 194 uint64_t ClearRect0Top : 14; /* 45..32 */ 195 uint64_t reserved2 : 2; /* 47..46 */ 196 uint64_t ClearRect0Bottom : 14; /* 61..48 */ 197 uint64_t reserved3 : 2; /* 63..62 */ 198 uint64_t ClearRect1Left : 14; /* 77..64 */ 199 uint64_t reserved4 : 2; /* 79..78 */ 200 uint64_t ClearRect1Right : 14; /* 93..80 */ 201 uint64_t reserved5 : 2; /* 95..94 */ 202 uint64_t ClearRect1Top : 14; /* 109..96 */ 203 uint64_t reserved6 : 2; /* 111..110 */ 204 uint64_t ClearRect1Bottom : 14; /* 125..112 */ 205 uint64_t reserved7 : 2; /* 127..126 */ 206 } ClearRectStruct; 207 208 typedef struct { 209 uint64_t reserved0 : 2; /* 1..0 */ 210 uint64_t AlphaK1 : 8; /* 9..2 */ 211 uint64_t reserved1 : 6; /* 17..10 */ 212 uint64_t AlphaK2 : 8; /* 25..18 */ 213 uint64_t reserved2 : 6; /* 31..26 */ 214 uint64_t SrcFactCMatchSelect : 3; /* 34..32 */ 215 uint64_t reserved3 : 1; /* 35 */ 216 uint64_t DstFactCMatchSelect : 3; /* 38..36 */ 217 uint64_t reserved4 : 1; /* 39 */ 218 uint64_t SrcFactAMatchSelect : 3; /* 42..40 */ 219 uint64_t reserved5 : 1; /* 43 */ 220 uint64_t DstFactAMatchSelect : 3; /* 46..44 */ 221 uint64_t reserved6 : 1; /* 47 */ 222 uint64_t reserved7 : 4; /* 51..48 */ 223 uint64_t reserved8 : 4; /* 55..52 */ 224 uint64_t reserved9 : 4; /* 59..56 */ 225 uint64_t reserved10 : 4; /* 63..60 */ 226 uint64_t reserved11 : 2; /* 65..64 */ 227 uint64_t OverrideR : 10; /* 75..66 */ 228 uint64_t OverrideG : 10; /* 85..76 */ 229 uint64_t OverrideB : 10; /* 95..86 */ 230 uint64_t reserved12 : 2; /* 97..96 */ 231 uint64_t OverrideA : 8; /* 105..98 */ 232 uint64_t reserved13 : 2; /* 107..106 */ 233 uint64_t UseOverrideR : 1; /* 108 */ 234 uint64_t UseOverrideG : 1; /* 109 */ 235 uint64_t UseOverrideB : 1; /* 110 */ 236 uint64_t UseOverrideA : 1; /* 111 */ 237 uint64_t MaskR : 1; /* 112 */ 238 uint64_t MaskG : 1; /* 113 */ 239 uint64_t MaskB : 1; /* 114 */ 240 uint64_t MaskA : 1; /* 115 */ 241 uint64_t reserved14 : 12; /* 127..116 */ 242 } BlendingSlotStruct; 243 244 typedef struct { 245 uint64_t AlphaFillMode : 3; /* 2..0 */ 246 uint64_t AlphaFillSlot : 3; /* 5..3 */ 247 uint64_t reserved0 : 2; /* 6..5 */ 248 uint64_t BackgroundAlpha : 8; /* 15..7 */ 249 uint64_t BackgroundR : 10; /* 25..16 */ 250 uint64_t BackgroundG : 10; /* 35..26 */ 251 uint64_t BackgroundB : 10; /* 45..36 */ 252 uint64_t RegammaMode : 2; /* 47..46 */ 253 uint64_t OutputFlipX : 1; /* 48 */ 254 uint64_t OutputFlipY : 1; /* 49 */ 255 uint64_t OutputTranspose : 1; /* 50 */ 256 uint64_t reserved1 : 1; /* 51 */ 257 uint64_t reserved2 : 12; /* 63..52 */ 258 uint64_t TargetRectLeft : 14; /* 77..64 */ 259 uint64_t reserved3 : 2; /* 79..78 */ 260 uint64_t TargetRectRight : 14; /* 93..80 */ 261 uint64_t reserved4 : 2; /* 95..94 */ 262 uint64_t TargetRectTop : 14; /* 109..96 */ 263 uint64_t reserved5 : 2; /* 111..110 */ 264 uint64_t TargetRectBottom : 14; /* 125..112 */ 265 uint64_t reserved6 : 2; /* 127..126 */ 266 } OutputConfig; 267 268 typedef struct { 269 uint64_t OutPixelFormat : 7; /* 6..0 */ 270 uint64_t OutChromaLocHoriz : 2; /* 8..7 */ 271 uint64_t OutChromaLocVert : 2; /* 10..9 */ 272 uint64_t OutBlkKind : 4; /* 14..11 */ 273 uint64_t OutBlkHeight : 4; /* 18..15 */ 274 uint64_t reserved0 : 3; /* 21..19 */ 275 uint64_t reserved1 : 10; /* 31..22 */ 276 uint64_t OutSurfaceWidth : 14; /* 45..32 */ 277 uint64_t OutSurfaceHeight : 14; /* 59..46 */ 278 uint64_t reserved2 : 4; /* 63..60 */ 279 uint64_t OutLumaWidth : 14; /* 77..64 */ 280 uint64_t OutLumaHeight : 14; /* 91..78 */ 281 uint64_t reserved3 : 4; /* 95..92 */ 282 uint64_t OutChromaWidth : 14; /* 109..96 */ 283 uint64_t OutChromaHeight : 14; /* 123..110 */ 284 uint64_t reserved4 : 4; /* 127..124 */ 285 } OutputSurfaceConfig; 286 287 typedef struct { 288 uint64_t f00 : 10; /* 9..0 */ 289 uint64_t f10 : 10; /* 19..10 */ 290 uint64_t f20 : 10; /* 29..20 */ 291 uint64_t reserved0 : 2; /* 31..30 */ 292 uint64_t f01 : 10; /* 41..32 */ 293 uint64_t f11 : 10; /* 51..42 */ 294 uint64_t f21 : 10; /* 61..52 */ 295 uint64_t reserved1 : 2; /* 63..62 */ 296 uint64_t f02 : 10; /* 73..64 */ 297 uint64_t f12 : 10; /* 83..74 */ 298 uint64_t f22 : 10; /* 93..84 */ 299 uint64_t reserved2 : 2; /* 95..94 */ 300 uint64_t f03 : 10; /* 105..96 */ 301 uint64_t f13 : 10; /* 115..106 */ 302 uint64_t f23 : 10; /* 125..116 */ 303 uint64_t reserved3 : 2; /* 127..126 */ 304 } FilterCoeffStruct; 305 306 typedef struct { 307 uint64_t DownsampleHoriz : 11; /* 10..0 */ 308 uint64_t reserved0 : 5; /* 15..11 */ 309 uint64_t DownsampleVert : 11; /* 26..16 */ 310 uint64_t reserved1 : 5; /* 31..27 */ 311 uint64_t reserved2 : 32; /* 63..32 */ 312 uint64_t reserved3 : 32; /* 95..64 */ 313 uint64_t reserved4 : 32; /* 127..96 */ 314 } PipeConfig; 315 316 typedef struct { 317 uint64_t OldCadence : 32; /* 31..0 */ 318 uint64_t OldDiff : 32; /* 63..32 */ 319 uint64_t OldWeave : 32; /* 95..64 */ 320 uint64_t OlderWeave : 32; /* 127..96 */ 321 } SlotHistoryBuffer; 322 323 typedef struct { 324 uint64_t crc0 : 32; /* 31..0 */ 325 uint64_t crc1 : 32; /* 63..32 */ 326 uint64_t crc2 : 32; /* 95..64 */ 327 uint64_t crc3 : 32; /* 127..96 */ 328 } PartitionCrcStruct; 329 330 typedef struct { 331 uint64_t crc0 : 32; /* 31..0 */ 332 uint64_t crc1 : 32; /* 63..32 */ 333 } SlotCrcStruct; 334 335 typedef struct { 336 uint64_t ErrorStatus : 32; /* 31..0 */ 337 uint64_t CycleCount : 32; /* 63..32 */ 338 uint64_t reserved0 : 32; /* 95..64 */ 339 uint64_t reserved1 : 32; /* 127..96 */ 340 } StatusStruct; 341 342 typedef struct { 343 SlotConfig slotConfig; 344 SlotSurfaceConfig slotSurfaceConfig; 345 LumaKeyStruct lumaKeyStruct; 346 MatrixStruct colorMatrixStruct; 347 MatrixStruct gamutMatrixStruct; 348 BlendingSlotStruct blendingSlotStruct; 349 } SlotStruct; 350 351 typedef struct { 352 FilterCoeffStruct filterCoeffStruct[520]; 353 } FilterStruct; 354 355 typedef struct { 356 PipeConfig pipeConfig; 357 OutputConfig outputConfig; 358 OutputSurfaceConfig outputSurfaceConfig; 359 MatrixStruct outColorMatrixStruct; 360 ClearRectStruct clearRectStruct[4]; 361 SlotStruct slotStruct[16]; 362 } ConfigStruct; 363 364 typedef struct { 365 PartitionCrcStruct partitionCrcStruct[4]; 366 } InterfaceCrcStruct; 367 368 typedef struct { 369 SlotCrcStruct slotCrcStruct[16]; 370 } InputCrcStruct; 371 372 #endif 373