| 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 codechal_decode_singlepipe_virtualengine.h |
| 24 |
//! \brief Defines the decode interface extension for single pipe virtual engine. |
| 25 |
//! \details Defines all types, macros, and functions required by CodecHal for single pipe virtual engine decoding. Definitions are not externally facing. |
| 26 |
//! |
| 27 |
|
| 28 |
#ifndef __CODECHAL_DECODER_SINGLEPIPE_VIRTUALENGINE_H__ |
| 29 |
#define __CODECHAL_DECODER_SINGLEPIPE_VIRTUALENGINE_H__ |
| 30 |
|
| 31 |
#include "codechal_decoder.h" |
| 32 |
#include "mos_os_virtualengine_singlepipe.h" |
| 33 |
|
| 34 |
typedef struct _CODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE |
| 35 |
{ |
| 36 |
PMOS_VIRTUALENGINE_INTERFACE pVEInterface; |
| 37 |
PMOS_VIRTUALENGINE_HINT_PARAMS pHintParms; |
| 38 |
}CODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE, *PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE; |
| 39 |
|
| 40 |
//! |
| 41 |
//! \brief Set hint parameter for virtual engine interface in single pipe mode |
| 42 |
//! \details Set hint prameter for virtual engine interface, shared by all single pipe codechal decode formats. |
| 43 |
//! \param [in] pVEState |
| 44 |
//! ponter to virtual engine state data structure |
| 45 |
//! \param [in] pVESetParams |
| 46 |
//! ponter to MOS_VIRTUALENGINE_SET_PARAMS data structure including parameters related to set hint parameters |
| 47 |
//! \return MOS_STATUS |
| 48 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 49 |
//! |
| 50 |
static __inline MOS_STATUS CodecHalDecodeSinglePipeVE_SetHintParams( |
| 51 |
PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState, |
| 52 |
PMOS_VIRTUALENGINE_SET_PARAMS pVESetParams) |
| 53 |
{ |
| 54 |
PMOS_VIRTUALENGINE_INTERFACE pVEInterface; |
| 55 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 56 |
|
| 57 |
// this function can be removed after transiting to VE2.0 |
| 58 |
CODECHAL_DECODE_CHK_NULL_RETURN(pVEState); |
| 59 |
CODECHAL_DECODE_CHK_NULL_RETURN(pVEState->pVEInterface); |
| 60 |
pVEInterface = pVEState->pVEInterface; |
| 61 |
|
| 62 |
if(!MOS_VE_CTXBASEDSCHEDULING_SUPPORTED(pVEInterface->pOsInterface)) |
| 63 |
{ |
| 64 |
if(pVEInterface->pfnVESetHintParams) |
| 65 |
{ |
| 66 |
CODECHAL_DECODE_CHK_STATUS_RETURN(pVEInterface->pfnVESetHintParams(pVEInterface, pVESetParams)); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
return eStatus; |
| 71 |
} |
| 72 |
|
| 73 |
//! |
| 74 |
//! \brief Populate hint parameter for virtual engine interface in single pipe mode |
| 75 |
//! \details Populate hint prameter to primary cmd buffer attributes, this is for virtual engine interface, shared by all single pipe codechal decode formats. |
| 76 |
//! \param [in] pVEState |
| 77 |
//! ponter to virtual engine state data structure |
| 78 |
//! \param [in] pPrimCmdBuf |
| 79 |
//! ponter to primary cmd buffer |
| 80 |
//! \param [in] bUseVirtualEngineHint |
| 81 |
//! true if CmdBuf need to use VE hint params, else false |
| 82 |
//! \return PMOS_VIRTUALENGINE_HINT_PARAMS |
| 83 |
//! return address of the single pipe hint parameter variable defined in MOS Virtual engine interface |
| 84 |
//! |
| 85 |
static __inline MOS_STATUS CodecHalDecodeSinglePipeVE_PopulateHintParams( |
| 86 |
PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState, |
| 87 |
PMOS_COMMAND_BUFFER pPrimCmdBuf, |
| 88 |
bool bUseVirtualEngineHint) |
| 89 |
{ |
| 90 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 91 |
PMOS_CMD_BUF_ATTRI_VE pAttriVe; |
| 92 |
|
| 93 |
CODECHAL_DECODE_CHK_NULL_RETURN(pPrimCmdBuf); |
| 94 |
|
| 95 |
if (pPrimCmdBuf->Attributes.pAttriVe) |
| 96 |
{ |
| 97 |
|
| 98 |
pAttriVe = (PMOS_CMD_BUF_ATTRI_VE)(pPrimCmdBuf->Attributes.pAttriVe); |
| 99 |
|
| 100 |
if (bUseVirtualEngineHint) |
| 101 |
{ |
| 102 |
CODECHAL_DECODE_CHK_NULL_RETURN(pVEState); |
| 103 |
if(pVEState->pHintParms) |
| 104 |
{ |
| 105 |
pAttriVe->VEngineHintParams = *(pVEState->pHintParms); |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
pAttriVe->bUseVirtualEngineHint = bUseVirtualEngineHint; |
| 110 |
} |
| 111 |
|
| 112 |
return eStatus; |
| 113 |
} |
| 114 |
|
| 115 |
//! |
| 116 |
//! \brief construct gpu context creation params. |
| 117 |
//! \param [in] pVEState |
| 118 |
//! ponter to virtual engine state data structure |
| 119 |
//! \param [in] gpucontxCreatOpts |
| 120 |
//! ponter to gpu context creation option data structure |
| 121 |
//! \param [in] SFCInuse |
| 122 |
//! flag to indicate if SFC is in use |
| 123 |
//! \return MOS_STATUS |
| 124 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 125 |
//! |
| 126 |
MOS_STATUS CodecHalDecodeSinglePipeVE_ConstructParmsForGpuCtxCreation( |
| 127 |
PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState, |
| 128 |
PMOS_GPUCTX_CREATOPTIONS_ENHANCED gpuCtxCreatOpts, |
| 129 |
bool SFCInuse); |
| 130 |
|
| 131 |
//! |
| 132 |
//! \brief initialize virtual engine interface for single pipe decode |
| 133 |
//! \details initialize virtual engine interface for single pipe decode shared by all codechal decode formats |
| 134 |
//! \param [in] pOsInterface |
| 135 |
//! poiner to os interface |
| 136 |
//! \param [in] pVEState |
| 137 |
//! pointer to virtual engine state data structure |
| 138 |
//! \return MOS_STATUS |
| 139 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 140 |
//! |
| 141 |
MOS_STATUS CodecHalDecodeSinglePipeVE_InitInterface( |
| 142 |
PMOS_INTERFACE pOsInterface, |
| 143 |
PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE pVEState); |
| 144 |
|
| 145 |
#endif //__CODECHAL_DECODER_SINGLEPIPE_VIRTUALENGINE_H__ |
| 146 |
|