| 1 | /* |
| 2 | * Copyright (c) 2022-2023, Intel 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 |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS 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 | //! \file vp_common_tools.h |
| 24 | //! \brief vphal tools interface clarification |
| 25 | //! \details vphal tools interface clarification inlcuding: |
| 26 | //! some marcro, enum, structure, function |
| 27 | //! |
| 28 | #ifndef __VP_COMMON_TOOLS_H__ |
| 29 | #define __VP_COMMON_TOOLS_H__ |
| 30 | |
| 31 | // max size of status table, this value must be power of 2 such as 256, 512, 1024, etc. |
| 32 | // so VPHAL_STATUS_TABLE_MAX_SIZE-1 can form a one-filled mask to wind back a VPHAL_STATUS_TABLE ring table. |
| 33 | #define VPHAL_STATUS_TABLE_MAX_SIZE 512 |
| 34 | |
| 35 | //! |
| 36 | //! Structure VPHAL_STATUS_ENTRY |
| 37 | //! \brief Pre-Processing - Query status struct |
| 38 | //! |
| 39 | typedef struct _VPHAL_STATUS_ENTRY |
| 40 | { |
| 41 | uint32_t StatusFeedBackID; |
| 42 | MOS_GPU_CONTEXT GpuContextOrdinal; |
| 43 | uint32_t dwTag; // software tag, updated by driver for every command submit. |
| 44 | uint32_t dwStatus; // 0:OK; 1:Not Ready; 2:Not Available; 3:Error; |
| 45 | uint16_t streamIndex; // stream index corresponding to the gpucontext |
| 46 | bool isStreamIndexSet; |
| 47 | } VPHAL_STATUS_ENTRY, *PVPHAL_STATUS_ENTRY; |
| 48 | |
| 49 | //! |
| 50 | //! \brief Structure to VPHAL Status table |
| 51 | //! |
| 52 | typedef struct _VPHAL_STATUS_TABLE |
| 53 | { |
| 54 | VPHAL_STATUS_ENTRY aTableEntries[VPHAL_STATUS_TABLE_MAX_SIZE]; |
| 55 | uint32_t uiHead; |
| 56 | uint32_t uiCurrent; |
| 57 | } VPHAL_STATUS_TABLE, *PVPHAL_STATUS_TABLE; |
| 58 | |
| 59 | //! |
| 60 | //! Structure STATUS_TABLE_UPDATE_PARAMS |
| 61 | //! \brief Pre-Processing - params for updating status report table |
| 62 | //! |
| 63 | typedef struct _STATUS_TABLE_UPDATE_PARAMS |
| 64 | { |
| 65 | bool bReportStatus; |
| 66 | bool bSurfIsRenderTarget; |
| 67 | PVPHAL_STATUS_TABLE pStatusTable; |
| 68 | uint32_t StatusFeedBackID; |
| 69 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 70 | bool bTriggerGPUHang; |
| 71 | #endif |
| 72 | bool bUpdateStreamIndex; |
| 73 | } STATUS_TABLE_UPDATE_PARAMS, *PSTATUS_TABLE_UPDATE_PARAMS; |
| 74 | |
| 75 | //! |
| 76 | //! \brief Structure to query status params from application |
| 77 | //! be noted that the structure is defined by app (msdk) so we cannot reorder its entries or size |
| 78 | //! |
| 79 | typedef struct _QUERY_STATUS_REPORT_APP |
| 80 | { |
| 81 | uint32_t StatusFeedBackID; |
| 82 | uint32_t dwStatus : 8; //!< 0: OK; 1: Not Ready; 2: Not Available; 3: Error; |
| 83 | uint32_t : 24; //!< Reserved |
| 84 | uint32_t dwReserved[4]; //!< keep this to align what application (msdk lib) defined |
| 85 | } QUERY_STATUS_REPORT_APP, *PQUERY_STATUS_REPORT_APP; |
| 86 | |
| 87 | //! |
| 88 | //! \brief VPreP status |
| 89 | //! |
| 90 | typedef enum _VPREP_STATUS |
| 91 | { |
| 92 | VPREP_OK = 0, |
| 93 | VPREP_NOTREADY = 1, |
| 94 | VPREP_NOTAVAILABLE = 2, |
| 95 | VPREP_ERROR = 3 |
| 96 | } VPREP_STATUS; |
| 97 | |
| 98 | //! |
| 99 | //! \brief Internal Override/Reporting Video Processing Configuration Values |
| 100 | //! |
| 101 | typedef struct _VP_CONFIG |
| 102 | { |
| 103 | bool featureReportInitialized; // feature report has been initialized |
| 104 | bool bVpComponentReported; // Vp Component has been reported |
| 105 | uint32_t dwVpPath; // Video Processing path |
| 106 | uint32_t dwVpComponent; // Video Processing Component |
| 107 | uint32_t dwCreatedDeinterlaceMode; // Created Deinterlace mode |
| 108 | uint32_t dwCurrentDeinterlaceMode; // Current Deinterlace mode |
| 109 | uint32_t dwReportedDeinterlaceMode; // Reported Deinterlace mode |
| 110 | uint32_t dwCreatedScalingMode; // Created Scaling mode |
| 111 | uint32_t dwCurrentScalingMode; // Current Scaling mode |
| 112 | uint32_t dwReportedScalingMode; // Reported Scaling mode |
| 113 | uint32_t dwReportedFastCopyMode; // Reported FastCopy mode |
| 114 | uint32_t dwCurrentXVYCCState; // Current xvYCC State |
| 115 | uint32_t dwReportedXVYCCState; // Reported xvYCC state |
| 116 | uint32_t dwCurrentOutputPipeMode; // Current Output Pipe Mode |
| 117 | uint32_t dwReportedOutputPipeMode; // Reported Ouput Pipe Mode |
| 118 | uint32_t dwCurrentVEFeatureInUse; // Current VEFeatureInUse |
| 119 | uint32_t dwReportedVEFeatureInUse; // Reported VEFeatureInUse |
| 120 | uint32_t dwCurrentFrcMode; // Current Frame Rate Conversion Mode |
| 121 | uint32_t dwReportedFrcMode; // Reported Frame Rate Conversion Mode |
| 122 | uint32_t dwVPMMCInUse; // Memory compression enable flag |
| 123 | uint32_t dwVPMMCInUseReported; // Reported Memory compression enable flag |
| 124 | uint32_t dwRTCompressible; // RT MMC Compressible flag |
| 125 | uint32_t dwRTCompressibleReported; // RT MMC Reported compressible flag |
| 126 | uint32_t dwRTCompressMode; // RT MMC Compression Mode |
| 127 | uint32_t dwRTCompressModeReported; // RT MMC Reported Compression Mode |
| 128 | uint32_t dwRTCacheSetting; // RT cache usage |
| 129 | uint32_t dwRTCacheSettingReported; // RT cache Reported usage |
| 130 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 131 | uint32_t dwRTOldCacheSetting; |
| 132 | uint32_t dwRTOldCacheSettingReported; |
| 133 | uint32_t dw3DLutInterpolationMethod; // 3DLut Interpolation Method |
| 134 | uint32_t dw3DLutInterpolationMethodReported; // 3DLut Interpolation Reported Method |
| 135 | #endif |
| 136 | uint32_t dwFFDICompressible; // FFDI Compressible flag |
| 137 | uint32_t dwFFDICompressMode; // FFDI Compression mode |
| 138 | uint32_t dwFFDNCompressible; // FFDN Compressible flag |
| 139 | uint32_t dwFFDNCompressMode; // FFDN Compression mode |
| 140 | uint32_t dwSTMMCompressible; // STMM Compressible flag |
| 141 | uint32_t dwSTMMCompressMode; // STMM Compression mode |
| 142 | uint32_t dwScalerCompressible; // Scaler Compressible flag for Gen10 |
| 143 | uint32_t dwScalerCompressMode; // Scaler Compression mode for Gen10 |
| 144 | uint32_t dwPrimaryCompressible; // Input Primary Surface Compressible flag |
| 145 | uint32_t dwPrimaryCompressMode; // Input Primary Surface Compression mode |
| 146 | uint32_t dwFFDICompressibleReported; // FFDI Reported Compressible flag |
| 147 | uint32_t dwFFDICompressModeReported; // FFDI Reported Compression mode |
| 148 | uint32_t dwFFDNCompressibleReported; // FFDN Reported Compressible flag |
| 149 | uint32_t dwFFDNCompressModeReported; // FFDN Reported Compression mode |
| 150 | uint32_t dwSTMMCompressibleReported; // STMM Reported Compressible flag |
| 151 | uint32_t dwSTMMCompressModeReported; // STMM Reported Compression mode |
| 152 | uint32_t dwScalerCompressibleReported; // Scaler Reported Compressible flag for Gen10 |
| 153 | uint32_t dwScalerCompressModeReported; // Scaler Reported Compression mode for Gen10 |
| 154 | uint32_t dwPrimaryCompressibleReported; // Input Primary Surface Reported Compressible flag |
| 155 | uint32_t dwPrimaryCompressModeReported; // Input Primary Surface Reported Compression mode |
| 156 | uint32_t dwCapturePipeInUse; // Capture pipe |
| 157 | uint32_t dwCapturePipeInUseReported; // Reported Capture pipe |
| 158 | uint32_t dwCurrentCompositionMode; // In Place or Legacy Composition |
| 159 | uint32_t dwReportedCompositionMode; // Reported Composition Mode |
| 160 | uint32_t dwCurrentHdrMode; // Current Hdr Mode |
| 161 | uint32_t dwReportedHdrMode; // Reported Hdr Mode |
| 162 | uint32_t dwCurrentScdMode; // Current Scd Mode |
| 163 | uint32_t dwReportedScdMode; // Reported Scd Mode |
| 164 | uint32_t dwTCCPreprocessInUse; // Vebox TCC Pre-process for HDR |
| 165 | uint32_t dwTCCPreprocessInUseReported; // Reported Vebox TCC Pre-process for HDR |
| 166 | uint32_t dwIEFPreprocessInUse; // Vebox IEF Pre-process for HDR |
| 167 | uint32_t dwIEFPreprocessInUseReported; // Reported Vebox IEF Pre-process for HDR |
| 168 | bool bAdvancedScalingInUse; // Advanced Scaling Enabled |
| 169 | bool bAdvancedScalingInUseReported; // Reported Advanced Scaling Enabled |
| 170 | bool isPacketReused; // true if vp packet reused. |
| 171 | bool isPacketReusedReported; // Reported vp packet reused. |
| 172 | bool isDnEnabled; // true if vp Dn enabled. |
| 173 | bool isDnEnabledReported; // Reported vp Dn reported |
| 174 | uint32_t dwCurrentVeboxScalability; // Current Vebox Scalability |
| 175 | uint32_t dwReportedVeboxScalability; // Reported Vebox Scalability |
| 176 | uint32_t dwCurrentVPApogeios; // Current VP Apogieos |
| 177 | uint32_t dwReportedVPApogeios; // Reported VP Apogieos |
| 178 | uint32_t dwCurrentSFCLinearOutputByTileConvert; // Current enableSFCLinearOutputByTileConvert |
| 179 | uint32_t dwReportedSFCLinearOutputByTileConvert; // Reported enableSFCLinearOutputByTileConvert |
| 180 | |
| 181 | // Configurations for cache control |
| 182 | uint32_t dwDndiReferenceBuffer; |
| 183 | uint32_t dwDndiOutputBuffer; |
| 184 | uint32_t dwIecpOutputBuffer; |
| 185 | uint32_t dwDnOutputBuffer; |
| 186 | uint32_t dwStmmBuffer; |
| 187 | uint32_t dwPhase2RenderTarget; |
| 188 | uint32_t dwPhase2Source; |
| 189 | uint32_t dwPhase1Source; |
| 190 | |
| 191 | // For Deinterlace Mode - the flags reflect the content size and SKU, |
| 192 | // should not be changed after initialized. |
| 193 | bool bFFDI; |
| 194 | |
| 195 | //Debug enhancement to force color fill |
| 196 | //FALSE(0): no force color fill, TRUE(1): force color fill with default color, |
| 197 | //ELSE(other non-zero value): force color fill with color info from dwForceColorFill |
| 198 | uint32_t dwForceColorFill; |
| 199 | |
| 200 | //VEBOX perf is not enough for 8K@60fps processing |
| 201 | //add config to switch 8K resolution on VEBOX or render |
| 202 | //default is use render for 8k |
| 203 | uint32_t dwUseVeboxFor8K; |
| 204 | |
| 205 | // Optimize Cpu timing for VEBOX/SFC |
| 206 | bool bOptimizeCpuTiming; |
| 207 | |
| 208 | // Output Regkey for whitelist |
| 209 | bool bOutputRegkey; |
| 210 | } VP_CONFIG, *PVP_CONFIG; |
| 211 | |
| 212 | //! |
| 213 | //! \brief status query param |
| 214 | //! |
| 215 | typedef struct _VPHAL_STATUS_PARAM |
| 216 | { |
| 217 | uint32_t FrameId; |
| 218 | VPREP_STATUS BltStatus; |
| 219 | } VPHAL_STATUS_PARAM, *PVPHAL_STATUS_PARAM; |
| 220 | |
| 221 | //! |
| 222 | //! Structure VPHAL_QUERYVARIANCE_PARAMS |
| 223 | //! \brief Query Variance Parameters |
| 224 | //! |
| 225 | typedef struct _VPHAL_QUERYVARIANCE_PARAMS |
| 226 | { |
| 227 | uint32_t dwFrameNumber; |
| 228 | void* pVariances; |
| 229 | } VPHAL_QUERYVARIANCE_PARAMS, *PVPHAL_QUERYVARIANCE_PARAMS; |
| 230 | |
| 231 | //! |
| 232 | //! \brief Query Multiple Variance Parameters |
| 233 | //! |
| 234 | typedef struct _VPHAL_BATCHQUERYVARIANCE_PARAMS |
| 235 | { |
| 236 | uint32_t FrameCount; |
| 237 | uint32_t BufferSize; |
| 238 | void *pBuffer; |
| 239 | } VPHAL_BATCHQUERYVARIANCE_PARAMS, *PVPHAL_BATCHQUERYVARIANCE_PARAMS; |
| 240 | |
| 241 | |
| 242 | #endif // __VP_COMMON_TOOLS_H__ |