1 /* 2 * Copyright © 2016-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 VIC40_H 24 #define VIC40_H 25 26 #include <stdint.h> 27 28 #define NVB0B6_VIDEO_COMPOSITOR_SET_APPLICATION_ID 0x00000200 29 #define NVB0B6_VIDEO_COMPOSITOR_EXECUTE 0x00000300 30 #define NVB0B6_VIDEO_COMPOSITOR_SET_SURFACE0_SLOT0_LUMA_OFFSET 0x00000400 31 #define NVB0B6_VIDEO_COMPOSITOR_SET_SURFACE0_SLOT0_CHROMA_U_OFFSET 0x00000404 32 #define NVB0B6_VIDEO_COMPOSITOR_SET_SURFACE0_SLOT0_CHROMA_V_OFFSET 0x00000408 33 #define NVB0B6_VIDEO_COMPOSITOR_SET_CONTROL_PARAMS 0x00000704 34 #define NVB0B6_VIDEO_COMPOSITOR_SET_CONFIG_STRUCT_OFFSET 0x00000708 35 #define NVB0B6_VIDEO_COMPOSITOR_SET_HIST_OFFSET 0x00000714 36 #define NVB0B6_VIDEO_COMPOSITOR_SET_OUTPUT_SURFACE_LUMA_OFFSET 0x00000720 37 38 typedef struct { 39 uint64_t SlotEnable : 1; /* 0 */ 40 uint64_t DeNoise : 1; /* 1 */ 41 uint64_t AdvancedDenoise : 1; /* 2 */ 42 uint64_t CadenceDetect : 1; /* 3 */ 43 uint64_t MotionMap : 1; /* 4 */ 44 uint64_t MMapCombine : 1; /* 5 */ 45 uint64_t IsEven : 1; /* 6 */ 46 uint64_t ChromaEven : 1; /* 7 */ 47 uint64_t CurrentFieldEnable : 1; /* 8 */ 48 uint64_t PrevFieldEnable : 1; /* 9 */ 49 uint64_t NextFieldEnable : 1; /* 10 */ 50 uint64_t NextNrFieldEnable : 1; /* 11 */ 51 uint64_t CurMotionFieldEnable : 1; /* 12 */ 52 uint64_t PrevMotionFieldEnable : 1; /* 13 */ 53 uint64_t PpMotionFieldEnable : 1; /* 14 */ 54 uint64_t CombMotionFieldEnable : 1; /* 15 */ 55 uint64_t FrameFormat : 4; /* 19..16 */ 56 uint64_t FilterLengthY : 2; /* 21..20 */ 57 uint64_t FilterLengthX : 2; /* 23..22 */ 58 uint64_t Panoramic : 12; /* 35..24 */ 59 uint64_t reserved1 : 22; /* 57..36 */ 60 uint64_t DetailFltClamp : 6; /* 63..58 */ 61 uint64_t FilterNoise : 10; /* 73..64 */ 62 uint64_t FilterDetail : 10; /* 83..74 */ 63 uint64_t ChromaNoise : 10; /* 93..84 */ 64 uint64_t ChromaDetail : 10; /* 103..94 */ 65 uint64_t DeinterlaceMode : 4; /* 107..104 */ 66 uint64_t MotionAccumWeight : 3; /* 110..108 */ 67 uint64_t NoiseIir : 11; /* 121..111 */ 68 uint64_t LightLevel : 4; /* 125..122 */ 69 uint64_t reserved4 : 2; /* 127..126 */ 70 /* 128 */ 71 uint64_t SoftClampLow : 10; /* 9..0 */ 72 uint64_t SoftClampHigh : 10; /* 19..10 */ 73 uint64_t reserved5 : 3; /* 22..20 */ 74 uint64_t reserved6 : 9; /* 31..23 */ 75 uint64_t PlanarAlpha : 10; /* 41..32 */ 76 uint64_t ConstantAlpha : 1; /* 42 */ 77 uint64_t StereoInterleave : 3; /* 45..43 */ 78 uint64_t ClipEnabled : 1; /* 46 */ 79 uint64_t ClearRectMask : 8; /* 54..47 */ 80 uint64_t DegammaMode : 2; /* 56..55 */ 81 uint64_t reserved7 : 1; /* 57 */ 82 uint64_t DecompressEnable : 1; /* 58 */ 83 uint64_t reserved9 : 5; /* 63..59 */ 84 uint64_t DecompressCtbCount : 8; /* 71..64 */ 85 uint64_t DecompressZbcColor : 32; /* 103..72 */ 86 uint64_t reserved12 : 24; /* 127..104 */ 87 /* 256 */ 88 uint64_t SourceRectLeft : 30; /* 29..0 */ 89 uint64_t reserved14 : 2; /* 31..30 */ 90 uint64_t SourceRectRight : 30; /* 61..32 */ 91 uint64_t reserved15 : 2; /* 63..62 */ 92 uint64_t SourceRectTop : 30; /* 93..64 */ 93 uint64_t reserved16 : 2; /* 95..94 */ 94 uint64_t SourceRectBottom : 30; /* 125..96 */ 95 uint64_t reserved17 : 2; /* 127..126 */ 96 /* 384 */ 97 uint64_t DestRectLeft : 14; /* 13..0 */ 98 uint64_t reserved18 : 2; /* 15..14 */ 99 uint64_t DestRectRight : 14; /* 29..16 */ 100 uint64_t reserved19 : 2; /* 31..30 */ 101 uint64_t DestRectTop : 14; /* 45..32 */ 102 uint64_t reserved20 : 2; /* 47..46 */ 103 uint64_t DestRectBottom : 14; /* 61..48 */ 104 uint64_t reserved21 : 2; /* 63..62 */ 105 uint64_t reserved22 : 32; /* 95..64 */ 106 uint64_t reserved23 : 32; /* 127..96 */ 107 } SlotConfig; 108 109 typedef struct { 110 uint64_t SlotPixelFormat : 7; /* 6..0 */ 111 uint64_t SlotChromaLocHoriz : 2; /* 8..7 */ 112 uint64_t SlotChromaLocVert : 2; /* 10..9 */ 113 uint64_t SlotBlkKind : 4; /* 14..11 */ 114 uint64_t SlotBlkHeight : 4; /* 18..15 */ 115 uint64_t SlotCacheWidth : 3; /* 21..19 */ 116 uint64_t reserved0 : 10; /* 31..22 */ 117 uint64_t SlotSurfaceWidth : 14; /* 45..32 */ 118 uint64_t SlotSurfaceHeight : 14; /* 59..46 */ 119 uint64_t reserved1 : 4; /* 63..60 */ 120 uint64_t SlotLumaWidth : 14; /* 77..64 */ 121 uint64_t SlotLumaHeight : 14; /* 91..78 */ 122 uint64_t reserved2 : 4; /* 95..92 */ 123 uint64_t SlotChromaWidth : 14; /* 109..96 */ 124 uint64_t SlotChromaHeight : 14; /* 123..110 */ 125 uint64_t reserved3 : 4; /* 127..124 */ 126 } SlotSurfaceConfig; 127 128 typedef struct { 129 uint64_t luma_coeff0 : 20; /* 19..0 */ 130 uint64_t luma_coeff1 : 20; /* 39..20 */ 131 uint64_t luma_coeff2 : 20; /* 59..40 */ 132 uint64_t luma_r_shift : 4; /* 63..60 */ 133 uint64_t luma_coeff3 : 20; /* 83..64 */ 134 uint64_t LumaKeyLower : 10; /* 93..84 */ 135 uint64_t LumaKeyUpper : 10; /* 103..94 */ 136 uint64_t LumaKeyEnabled : 1; /* 104 */ 137 uint64_t reserved0 : 2; /* 106..105 */ 138 uint64_t reserved1 : 21; /* 127..107 */ 139 } LumaKeyStruct; 140 141 typedef struct { 142 uint64_t matrix_coeff00 : 20; /* 19..0 */ 143 uint64_t matrix_coeff10 : 20; /* 39..20 */ 144 uint64_t matrix_coeff20 : 20; /* 59..40 */ 145 uint64_t matrix_r_shift : 4; /* 63..60 */ 146 uint64_t matrix_coeff01 : 20; /* 83..64 */ 147 uint64_t matrix_coeff11 : 20; /* 103..84 */ 148 uint64_t matrix_coeff21 : 20; /* 123..104 */ 149 uint64_t reserved0 : 3; /* 126..124 */ 150 uint64_t matrix_enable : 1; /* 127 */ 151 /* 128 */ 152 uint64_t matrix_coeff02 : 20; /* 19..0 */ 153 uint64_t matrix_coeff12 : 20; /* 39..20 */ 154 uint64_t matrix_coeff22 : 20; /* 59..40 */ 155 uint64_t reserved1 : 4; /* 63..60 */ 156 uint64_t matrix_coeff03 : 20; /* 83..64 */ 157 uint64_t matrix_coeff13 : 20; /* 103..84 */ 158 uint64_t matrix_coeff23 : 20; /* 123..104 */ 159 uint64_t reserved2 : 4; /* 127..124 */ 160 } MatrixStruct; 161 162 typedef struct { 163 uint64_t ClearRect0Left : 14; /* 13..0 */ 164 uint64_t reserved0 : 2; /* 15..14 */ 165 uint64_t ClearRect0Right : 14; /* 29..16 */ 166 uint64_t reserved1 : 2; /* 31..30 */ 167 uint64_t ClearRect0Top : 14; /* 45..32 */ 168 uint64_t reserved2 : 2; /* 47..46 */ 169 uint64_t ClearRect0Bottom : 14; /* 61..48 */ 170 uint64_t reserved3 : 2; /* 63..62 */ 171 uint64_t ClearRect1Left : 14; /* 77..64 */ 172 uint64_t reserved4 : 2; /* 79..78 */ 173 uint64_t ClearRect1Right : 14; /* 93..80 */ 174 uint64_t reserved5 : 2; /* 95..94 */ 175 uint64_t ClearRect1Top : 14; /* 109..96 */ 176 uint64_t reserved6 : 2; /* 111..110 */ 177 uint64_t ClearRect1Bottom : 14; /* 125..112 */ 178 uint64_t reserved7 : 2; /* 127..126 */ 179 } ClearRectStruct; 180 181 typedef struct { 182 uint64_t AlphaK1 : 10; /* 9..0 */ 183 uint64_t reserved0 : 6; /* 15..10 */ 184 uint64_t AlphaK2 : 10; /* 25..16 */ 185 uint64_t reserved1 : 6; /* 31..26 */ 186 uint64_t SrcFactCMatchSelect : 3; /* 34..32 */ 187 uint64_t reserved2 : 1; /* 35 */ 188 uint64_t DstFactCMatchSelect : 3; /* 38..36 */ 189 uint64_t reserved3 : 1; /* 39 */ 190 uint64_t SrcFactAMatchSelect : 3; /* 42..40 */ 191 uint64_t reserved4 : 1; /* 43 */ 192 uint64_t DstFactAMatchSelect : 3; /* 46..44 */ 193 uint64_t reserved5 : 1; /* 47 */ 194 uint64_t reserved6 : 4; /* 51..48 */ 195 uint64_t reserved7 : 4; /* 55..52 */ 196 uint64_t reserved8 : 4; /* 59..56 */ 197 uint64_t reserved9 : 4; /* 63..60 */ 198 uint64_t reserved10 : 2; /* 65..64 */ 199 uint64_t OverrideR : 10; /* 75..66 */ 200 uint64_t OverrideG : 10; /* 85..76 */ 201 uint64_t OverrideB : 10; /* 95..86 */ 202 uint64_t OverrideA : 10; /* 105..96 */ 203 uint64_t reserved11 : 2; /* 107..106 */ 204 uint64_t UseOverrideR : 1; /* 108 */ 205 uint64_t UseOverrideG : 1; /* 109 */ 206 uint64_t UseOverrideB : 1; /* 110 */ 207 uint64_t UseOverrideA : 1; /* 111 */ 208 uint64_t MaskR : 1; /* 112 */ 209 uint64_t MaskG : 1; /* 113 */ 210 uint64_t MaskB : 1; /* 114 */ 211 uint64_t MaskA : 1; /* 115 */ 212 uint64_t reserved12 : 12; /* 127..116 */ 213 } BlendingSlotStruct; 214 215 typedef struct { 216 uint64_t AlphaFillMode : 3; /* 2..0 */ 217 uint64_t AlphaFillSlot : 3; /* 5..3 */ 218 uint64_t BackgroundAlpha : 10; /* 15..6 */ 219 uint64_t BackgroundR : 10; /* 25..16 */ 220 uint64_t BackgroundG : 10; /* 35..26 */ 221 uint64_t BackgroundB : 10; /* 45..36 */ 222 uint64_t RegammaMode : 2; /* 47..46 */ 223 uint64_t OutputFlipX : 1; /* 48 */ 224 uint64_t OutputFlipY : 1; /* 49 */ 225 uint64_t OutputTranspose : 1; /* 50 */ 226 uint64_t reserved1 : 1; /* 51 */ 227 uint64_t reserved2 : 12; /* 63..52 */ 228 uint64_t TargetRectLeft : 14; /* 77..64 */ 229 uint64_t reserved3 : 2; /* 79..78 */ 230 uint64_t TargetRectRight : 14; /* 93..80 */ 231 uint64_t reserved4 : 2; /* 95..94 */ 232 uint64_t TargetRectTop : 14; /* 109..96 */ 233 uint64_t reserved5 : 2; /* 111..110 */ 234 uint64_t TargetRectBottom : 14; /* 125..112 */ 235 uint64_t reserved6 : 2; /* 127..126 */ 236 } OutputConfig; 237 238 typedef struct { 239 uint64_t OutPixelFormat : 7; /* 6..0 */ 240 uint64_t OutChromaLocHoriz : 2; /* 8..7 */ 241 uint64_t OutChromaLocVert : 2; /* 10..9 */ 242 uint64_t OutBlkKind : 4; /* 14..11 */ 243 uint64_t OutBlkHeight : 4; /* 18..15 */ 244 uint64_t reserved0 : 3; /* 21..19 */ 245 uint64_t reserved1 : 10; /* 31..22 */ 246 uint64_t OutSurfaceWidth : 14; /* 45..32 */ 247 uint64_t OutSurfaceHeight : 14; /* 59..46 */ 248 uint64_t reserved2 : 4; /* 63..60 */ 249 uint64_t OutLumaWidth : 14; /* 77..64 */ 250 uint64_t OutLumaHeight : 14; /* 91..78 */ 251 uint64_t reserved3 : 4; /* 95..92 */ 252 uint64_t OutChromaWidth : 14; /* 109..96 */ 253 uint64_t OutChromaHeight : 14; /* 123..110 */ 254 uint64_t reserved4 : 4; /* 127..124 */ 255 } OutputSurfaceConfig; 256 257 typedef struct { 258 uint64_t DownsampleHoriz : 11; /* 10..0 */ 259 uint64_t reserved0 : 5; /* 15..11 */ 260 uint64_t DownsampleVert : 11; /* 26..16 */ 261 uint64_t reserved1 : 5; /* 31..27 */ 262 uint64_t reserved2 : 32; /* 63..32 */ 263 uint64_t reserved3 : 32; /* 95..64 */ 264 uint64_t reserved4 : 32; /* 127..96 */ 265 } PipeConfig; 266 267 typedef struct { 268 SlotConfig slotConfig; 269 SlotSurfaceConfig slotSurfaceConfig; 270 LumaKeyStruct lumaKeyStruct; 271 MatrixStruct colorMatrixStruct; 272 MatrixStruct gamutMatrixStruct; 273 BlendingSlotStruct blendingSlotStruct; 274 } SlotStruct; 275 276 typedef struct { 277 PipeConfig pipeConfig; 278 OutputConfig outputConfig; 279 OutputSurfaceConfig outputSurfaceConfig; 280 MatrixStruct outColorMatrixStruct; 281 ClearRectStruct clearRectStruct[4]; 282 SlotStruct slotStruct[8]; 283 } ConfigStruct; 284 285 #endif 286