1 /* 2 * Copyright (c) 2016-2018, 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 mos_os_virtualengine.h 24 //! \brief Common interface and structure used in MOS OS VirtualEngine 25 //! \details Common interface and structure used in MOS OS VirtualEngine, and only necessary when KMD supports virtual engine 26 //! 27 #ifndef __MOS_OS_VIRTUALENGINE_H__ 28 #define __MOS_OS_VIRTUALENGINE_H__ 29 30 #include "mos_os_virtualengine_specific.h" 31 #include "mos_os_virtualengine_next.h" 32 33 class MosVeInterface; 34 typedef struct _MOS_VIRTUALENGINE_INTERFACE 35 { 36 MosVeInterface *veInterface; 37 38 bool bScalabilitySupported; 39 PMOS_INTERFACE pOsInterface; 40 #if (_DEBUG || _RELEASE_INTERNAL) 41 uint8_t EngineLogicId[MOS_MAX_ENGINE_INSTANCE_PER_CLASS]; 42 uint8_t ucEngineCount; 43 #endif 44 uint8_t ucMaxNumPipesInUse; 45 uint8_t ucNumOfSdryCmdBufInCurFrm; //!< number of secondary cmd buffers for current frame 46 uint32_t dwSdryCmdBufSize; //!< secondary cmd buffer size for current frame 47 uint8_t ucMaxNumOfSdryCmdBufInOneFrame; 48 uint32_t dwTotalNumOfSdryCmdBufs; 49 uint8_t ucNumOfSdryCmdBufSets; 50 uint8_t ucSdryCmdbufPoolIndx; 51 bool *pbSdryCmdBufPrepared; 52 PMOS_COMMAND_BUFFER pSecondryCmdBufPool; 53 MOS_VIRTUALENGINE_HINT_PARAMS ScalabilityHintParams; 54 MOS_VIRTUALENGINE_HINT_PARAMS SinglePipeHintParams; 55 56 //! 57 //! \brief check if scalability is supported 58 //! \param [in] pVEInterface 59 //! virtual engine interface 60 //! \param [out] pbScalabilitySupported 61 //! pointer to a bool value 62 //! \return MOS_STATUS 63 //! MOS_STATUS_SUCCESS if success, else fail reason 64 //! 65 MOS_STATUS (*pfnVEIsScalabilitySupported)( 66 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 67 bool *pbScalabilitySupported); 68 69 //! 70 //! \brief Reset secondary cmd buffer state 71 //! \details Reset secondary cmd buffer state in scalability virtual engine interface 72 //! \param [in] pVEInterface 73 //! virtual engine interface 74 //! \return void 75 //! 76 void (*pfnVEResetSecdryCmdBufStates)( 77 PMOS_VIRTUALENGINE_INTERFACE pVEInterface); 78 79 //! 80 //! \brief Verify secondary cmd buffer size 81 //! \param [in] pVEInterface 82 //! virtual engine interface 83 //! \param [in] dwNewRequestSize 84 //! new request cmd buffer size 85 //! \return MOS_STATUS 86 //! MOS_STATUS_SUCCESS if success, else fail reason 87 //! 88 MOS_STATUS (*pfnVEVerifySecdryCmdBufSize)( 89 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 90 uint32_t dwNewRequestSize); 91 92 //! 93 //! \brief resize secondary cmd buffer 94 //! \param [in] pVEInterface 95 //! virtual engine interface 96 //! \param [in] dwNewRequestSize 97 //! new request cmd buffer size 98 //! \return MOS_STATUS 99 //! MOS_STATUS_SUCCESS if success, else fail reason 100 //! 101 MOS_STATUS (*pfnVEResizeSecdryCmdBuf)( 102 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 103 uint32_t dwNewRequestSize); 104 105 //! 106 //! \brief get secondary cmd buffer 107 //! \param [in] pVEInterface 108 //! virtual engine interface 109 //! \param [in] pScdryCmdBuf 110 //! pointer to secondry cmd buffer 111 //! \param [in] dwBufIdxPlus1 112 //! secondary cmd buffer index plus 1 113 //! \return MOS_STATUS 114 //! MOS_STATUS_SUCCESS if success, else fail reason 115 //! 116 MOS_STATUS (*pfnVEGetSecdryCmdBuf)( 117 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 118 PMOS_COMMAND_BUFFER pScdryCmdBuf, 119 uint32_t dwBufIdxPlus1); 120 121 //! 122 //! \brief return secondary cmd buffer 123 //! \param [in] pVEInterface 124 //! virtual engine interface 125 //! \param [in] pScdryCmdBuf 126 //! pointer to secondry cmd buffer address 127 //! \param [in] dwBufIdxPlus1 128 //! secondary cmd buffer index plus 1 129 //! \return MOS_STATUS 130 //! MOS_STATUS_SUCCESS if success, else fail reason 131 //! 132 MOS_STATUS (*pfnVEReturnSecdryCmdBuf)( 133 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 134 PMOS_COMMAND_BUFFER pScdryCmdBuf, 135 uint32_t dwBufIdxPlus1); 136 137 //! 138 //! \brief done virtual engine secondary command buffers 139 //! \details UnLock virtual engine secondary command buffers 140 //! \param [in] pVEInterface 141 //! virtual engine interface 142 //! \return MOS_STATUS 143 //! MOS_STATUS_SUCCESS if success, else fail reason 144 //! 145 MOS_STATUS (*pfnVEDoneSecdryCmdBuf)( 146 PMOS_VIRTUALENGINE_INTERFACE pVEInterface); 147 148 //! 149 //! \brief set hint parameters 150 //! \details set hint parameters for virtual engine scalability or single pipe mode 151 //! \param [in] pVEInterface 152 //! virtual engine interface 153 //! \param [in] pVEParams 154 //! pointer to VE parameter data structure 155 //! \return MOS_STATUS 156 //! MOS_STATUS_SUCCESS if success, else fail reason 157 //! 158 MOS_STATUS (*pfnVESetHintParams) ( 159 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 160 PMOS_VIRTUALENGINE_SET_PARAMS pVEParams); 161 162 //! 163 //! \brief get hint parameters 164 //! \details get hint parameters for virtual engine scalability or single pipe mode 165 //! \param [in] pVEInterface 166 //! virtual engine interface 167 //! \param [in] bScalableMode 168 //! flag to indicate if scalability mode 169 //! \param [in] ppHintParams 170 //! pointer to VE hint parameter address 171 //! \return MOS_STATUS 172 //! MOS_STATUS_SUCCESS if success, else fail reason 173 //! 174 MOS_STATUS (*pfnVEGetHintParams)( 175 PMOS_VIRTUALENGINE_INTERFACE pVEInterface, 176 bool bScalableMode, 177 PMOS_VIRTUALENGINE_HINT_PARAMS *ppHintParams); 178 179 //! 180 //! \brief check hint parameters 181 //! \details check hint parameters for virtual engine scalability or single pipe mode 182 //! \param [in] pVEInterface 183 //! virtual engine interface 184 //! \param [in] ppHintParams 185 //! pointer to VE hint parameter address 186 //! \return MOS_STATUS 187 //! MOS_STATUS_SUCCESS if success, else fail reason 188 //! 189 MOS_STATUS (*pfnVECheckHintParamsValidity) ( 190 PMOS_VIRTUALENGINE_INTERFACE pVEInterface); 191 192 //! 193 //! \brief Destroy resources for virtual engine scalability 194 //! \param [in] pVEInterface 195 //! virtual engine interface 196 //! \return void 197 //! 198 void (* pfnVEDestroy)( 199 PMOS_VIRTUALENGINE_INTERFACE pVEInterface); 200 }MOS_VIRTUALENGINE_INTERFACE, *PMOS_VIRTUALENGINE_INTERFACE; 201 202 //! 203 //! \brief initialize virtual engine interface 204 //! \details initialize virtual engine interface 205 //! \param [in] PMOS_INTERFACE 206 //! pointer to mos interface 207 //! \param [in] PMOS_VIRTUALENGINE_INIT_PARAMS pVEInitParms 208 //! pointer to VE init parameters 209 //! \return MOS_STATUS 210 //! MOS_STATUS_SUCCESS if success, else fail reason 211 //! 212 MOS_STATUS Mos_VirtualEngineInterface_Initialize( 213 PMOS_INTERFACE pOsInterface, 214 PMOS_VIRTUALENGINE_INIT_PARAMS pVEInitParms); 215 216 #endif //__MOS_OS_VIRTUALENGINE_SCALABILITY_H__ 217 218