| 1 | /* |
| 2 | * Copyright (c) 2022, 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 ddi_vp_tools.h |
| 24 | //! \brief ddi vp tool functions implementation |
| 25 | //! |
| 26 | |
| 27 | #ifndef __DDI_VP_TOOLS_H__ |
| 28 | #define __DDI_VP_TOOLS_H__ |
| 29 | |
| 30 | #include <va/va.h> |
| 31 | #include <va/va_vpp.h> |
| 32 | #include "ddi_vp_functions.h" |
| 33 | |
| 34 | #define LIBVA_VP_CONFIG_NOT_REPORTED 0xffffffff |
| 35 | |
| 36 | class DdiVpTools |
| 37 | { |
| 38 | public: |
| 39 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 40 | //! |
| 41 | //! \brief Allocate and initialize DDI dump parameters |
| 42 | //! |
| 43 | //! \param [in] vpCtx |
| 44 | //! VP context |
| 45 | //! |
| 46 | //! \return VAStatus |
| 47 | //! VA_STATUS_SUCCESS if DDI Params is initialized |
| 48 | static VAStatus InitDumpConfig(PDDI_VP_CONTEXT vpCtx); |
| 49 | |
| 50 | //! |
| 51 | //! \brief Destory DDI dump parameters |
| 52 | //! |
| 53 | //! \param [in] vpCtx |
| 54 | //! VP context |
| 55 | //! |
| 56 | //! \return |
| 57 | //! |
| 58 | static void DestoryDumpConfig(PDDI_VP_CONTEXT vpCtx); |
| 59 | |
| 60 | //! |
| 61 | //! \brief compare current dump parameters with the previous |
| 62 | //! |
| 63 | //! \param [in] curParams |
| 64 | //! current dump parameters |
| 65 | //! \param [in] preParams |
| 66 | //! previous dump parameters |
| 67 | //! \return bool |
| 68 | //! return true, if current parameters and previous are same |
| 69 | //! return false, if current parameters and previous are different |
| 70 | //! |
| 71 | static bool VpCmpDDIDumpParam( |
| 72 | PDDI_VP_DUMP_PARAM curParams, |
| 73 | PDDI_VP_DUMP_PARAM preParams); |
| 74 | |
| 75 | //! |
| 76 | //! \brief read a config "env" for vpddi.conf or from environment setting |
| 77 | //! |
| 78 | //! \param env |
| 79 | //! [in] Pipeline parameters from application (VAProcPipelineParameterBuffer) |
| 80 | //! \param envValue |
| 81 | //! [out] |
| 82 | //! \return int |
| 83 | //! return 0, if the "env" is set, and the value is copied into envValue |
| 84 | //! return 1, if the env is not set |
| 85 | //! |
| 86 | static int VpParseLogConfig( |
| 87 | const char *env, |
| 88 | char *envValue); |
| 89 | |
| 90 | //! |
| 91 | //! \brief dump deinterlacing parameter |
| 92 | //! |
| 93 | //! \param fpLog |
| 94 | //! [in] file pointer pointed to dumpped file |
| 95 | //! \param deint |
| 96 | //! [in] pointed to deinterlacing parameter |
| 97 | //! |
| 98 | static void VpDumpDeinterlacingParameterBuffer( |
| 99 | FILE *fpLog, |
| 100 | VAProcFilterParameterBufferDeinterlacing *deint); |
| 101 | |
| 102 | //! |
| 103 | //! \brief dump color balance parameter |
| 104 | //! |
| 105 | //! \param fpLog |
| 106 | //! [in] file pointer pointed to dumpped file |
| 107 | //! \param colorbalance |
| 108 | //! [in] pointed to colorbalance parameter |
| 109 | //! \param elementNum |
| 110 | //! [in] number of elements |
| 111 | //! |
| 112 | static void VpDumpColorBalanceParameterBuffer( |
| 113 | FILE *fpLog, |
| 114 | VAProcFilterParameterBufferColorBalance *colorbalance, |
| 115 | uint32_t elementNum); |
| 116 | |
| 117 | //! |
| 118 | //! \brief dump TCC parameter |
| 119 | //! |
| 120 | //! \param fpLog |
| 121 | //! [in] file pointer pointed to dumpped file |
| 122 | //! \param filterParam |
| 123 | //! [in] pointed to TCC parameter |
| 124 | //! \param elementNum |
| 125 | //! [in] number of elements |
| 126 | //! |
| 127 | static void VpDumpTotalColorCorrectionParameterBuffer( |
| 128 | FILE *fpLog, |
| 129 | VAProcFilterParameterBufferTotalColorCorrection *filterParam, |
| 130 | uint32_t elementNum); |
| 131 | |
| 132 | //! |
| 133 | //! \brief dump filter parameter |
| 134 | //! |
| 135 | //! \param fpLog |
| 136 | //! [in] file pointer pointed to dumpped file |
| 137 | //! \param buffer |
| 138 | //! [in] pointed to filter parameter |
| 139 | //! |
| 140 | static void VpDumpFilterParameterBuffer( |
| 141 | FILE *fpLog, |
| 142 | VAProcFilterParameterBuffer *buffer); |
| 143 | |
| 144 | //! \brief dump filters parameter of surface parameters |
| 145 | //! |
| 146 | //! \param [in] fpLog |
| 147 | //! file pointer pointed to dumpped file |
| 148 | //! \param [in] pipelineParameterBuffer |
| 149 | //! VAProcPipelineParameterBuffer |
| 150 | //! \param [in] srcFormat |
| 151 | //! MOS_FORMAT |
| 152 | //! |
| 153 | static void VpDumpProcFiltersParameterBufferSurface( |
| 154 | FILE *fpLog, |
| 155 | VAProcPipelineParameterBuffer *pipelineParameterBuffer, |
| 156 | MOS_FORMAT srcFormat); |
| 157 | |
| 158 | //! \brief dump filters parameter |
| 159 | //! |
| 160 | //! \param [in] fpLog |
| 161 | //! file pointer pointed to dumpped file |
| 162 | //! \param [in] vaDrvCtx |
| 163 | //! driver context |
| 164 | //! \param [in] filters |
| 165 | //! pointed to filters |
| 166 | //! \param [in] filtersNum |
| 167 | //! number of filters |
| 168 | //! |
| 169 | static void VpDumpProcFiltersParameterBuffer( |
| 170 | FILE *fpLog, |
| 171 | VADriverContextP vaDrvCtx, |
| 172 | VABufferID *filters, |
| 173 | unsigned int filtersNum); |
| 174 | |
| 175 | //! \brief dump filters parameter of Forward References |
| 176 | //! |
| 177 | //! \param [in] fpLog |
| 178 | //! file pointer pointed to dumpped file |
| 179 | //! \param [in] forwardReferences |
| 180 | //! pointed to forward References |
| 181 | //! \param [in] forwardReferencesNum |
| 182 | //! number of forward References |
| 183 | //! |
| 184 | static void VpDumpProcFiltersParameterBufferFWDReference( |
| 185 | FILE *fpLog, |
| 186 | VASurfaceID *forwardReferences, |
| 187 | uint32_t forwardReferencesNum); |
| 188 | |
| 189 | //! \brief dump filters parameter of Backward References |
| 190 | //! |
| 191 | //! \param [in] fpLog |
| 192 | //! file pointer pointed to dumpped file |
| 193 | //! \param [in] backwardReferences |
| 194 | //! pointed to backward References |
| 195 | //! \param [in] filtersNum |
| 196 | //! number of backward References |
| 197 | //! |
| 198 | static void VpDumpProcFiltersParameterBufferBKWReference( |
| 199 | FILE *fpLog, |
| 200 | VASurfaceID *backwardReferences, |
| 201 | uint32_t backwardReferencesNum); |
| 202 | |
| 203 | //! |
| 204 | //! \brief dump procpipeline parameters |
| 205 | //! |
| 206 | //! \param [in] vaDrvCtx |
| 207 | //! driver context |
| 208 | //! \param [in] vpCtx |
| 209 | //! vp context |
| 210 | //! \return VAStatus |
| 211 | //! return VA_STATUS_SUCCESS, if params is dumped to file. |
| 212 | //! |
| 213 | static VAStatus VpDumpProcPipelineParams( |
| 214 | VADriverContextP vaDrvCtx, |
| 215 | PDDI_VP_CONTEXT vpCtx); |
| 216 | |
| 217 | #endif //#if (_DEBUG || _RELEASE_INTERNAL) |
| 218 | |
| 219 | MEDIA_CLASS_DEFINE_END(DdiVpTools) |
| 220 | }; |
| 221 | |
| 222 | #endif //__DDI_VP_TOOLS_H__ |