| 1 |
/* |
| 2 |
* Copyright (c) 2019-2025, 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 decodecp_interface.h |
| 24 |
//! \brief Impelements the public interface for CodecHal Secure Decode |
| 25 |
//! |
| 26 |
#ifndef __DECODE_CP_INTERFACE_H__ |
| 27 |
#define __DECODE_CP_INTERFACE_H__ |
| 28 |
|
| 29 |
#include "mos_util_debug.h" |
| 30 |
#include "codechal_setting.h" |
| 31 |
#include "mos_os_specific.h" |
| 32 |
#include "codec_hw_next.h" |
| 33 |
#include "mos_utilities.h" |
| 34 |
|
| 35 |
#define DECODE_CP_ASSERT(_ptr) \ |
| 36 |
MOS_ASSERT(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _ptr) |
| 37 |
|
| 38 |
#define DECODE_CP_ASSERTMESSAGE(_message, ...) \ |
| 39 |
MOS_ASSERTMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _message, ##__VA_ARGS__) |
| 40 |
|
| 41 |
#define DECODE_CP_WARNINGMESSAGE(_message, ...) \ |
| 42 |
MOS_WARNINGMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _message, ##__VA_ARGS__) |
| 43 |
|
| 44 |
#define DECODE_CP_NORMALMESSAGE(_message, ...) \ |
| 45 |
MOS_NORMALMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _message, ##__VA_ARGS__) |
| 46 |
|
| 47 |
#define DECODE_CP_VERBOSEMESSAGE(_message, ...) \ |
| 48 |
MOS_VERBOSEMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _message, ##__VA_ARGS__) |
| 49 |
|
| 50 |
#define DECODE_CP_CHK_STATUS(_stmt) \ |
| 51 |
MOS_CHK_STATUS_RETURN(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _stmt) |
| 52 |
|
| 53 |
#define DECODE_CP_CHK_STATUS_MESSAGE(_stmt, _message, ...) \ |
| 54 |
MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _stmt, _message, ##__VA_ARGS__) |
| 55 |
|
| 56 |
#define DECODE_CP_CHK_NULL_RETURN(_ptr) \ |
| 57 |
MOS_CHK_NULL_RETURN(MOS_COMPONENT_CODEC, MOS_CODEC_SUBCOMP_DECODE, _ptr) |
| 58 |
|
| 59 |
#define DECODE_CP_CHK_NULL_NO_STATUS_RETURN(_ptr) \ |
| 60 |
MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _ptr) |
| 61 |
|
| 62 |
#define DECODE_CP_CHK_COND(_condition, retVal, _message, ...) \ |
| 63 |
MOS_CHK_COND_RETURN_VALUE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, (_condition), (retVal), (_message), ##__VA_ARGS__) |
| 64 |
#define DECODE_CP_CHK_COND_RETURN(_expr, _message, ...) \ |
| 65 |
MOS_CHK_COND_RETURN(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, _expr, _message, ##__VA_ARGS__) |
| 66 |
#define DECODE_CP_FUNCTION_ENTER \ |
| 67 |
MOS_FUNCTION_ENTER(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC) |
| 68 |
|
| 69 |
#define DECODE_CP_FUNCTION_EXIT(eStatus) \ |
| 70 |
MOS_FUNCTION_EXIT(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, eStatus) |
| 71 |
|
| 72 |
namespace decode |
| 73 |
{ |
| 74 |
class DecodePipeline; |
| 75 |
class DecodeSubPacket; |
| 76 |
} |
| 77 |
|
| 78 |
class DecodeCpInterface |
| 79 |
{ |
| 80 |
public: |
| 81 |
virtual ~DecodeCpInterface(){}; |
| 82 |
//! |
| 83 |
//! \brief Add Hcp SecureState |
| 84 |
//! \return MOS_STATUS |
| 85 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 86 |
//! |
| 87 |
|
| 88 |
virtual MOS_STATUS AddHcpState( |
| 89 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 90 |
PMOS_RESOURCE presDataBuffer, |
| 91 |
uint32_t length, |
| 92 |
uint32_t startoffset, |
| 93 |
uint32_t dwsliceIndex) = 0; |
| 94 |
|
| 95 |
//! |
| 96 |
//! \brief Add Huc State |
| 97 |
//! \return MOS_STATUS |
| 98 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 99 |
//! |
| 100 |
virtual MOS_STATUS AddHucState( |
| 101 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 102 |
PMOS_RESOURCE presDataBuffer, |
| 103 |
uint32_t length, |
| 104 |
uint32_t startoffset, |
| 105 |
uint32_t dwsliceIndex) = 0; |
| 106 |
|
| 107 |
virtual MOS_STATUS AddHucIndState( |
| 108 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 109 |
PMOS_RESOURCE presIndState) = 0; |
| 110 |
|
| 111 |
virtual MOS_STATUS SetHucDmemS2LPicBss( |
| 112 |
void * hucS2LPicBss, |
| 113 |
PMOS_RESOURCE presDataBuffer) = 0; |
| 114 |
|
| 115 |
virtual MOS_STATUS SetHucDmemS2LSliceBss( |
| 116 |
void * hucS2LSliceBss, |
| 117 |
uint32_t index, |
| 118 |
uint32_t dataSize, |
| 119 |
uint32_t dataOffset) = 0; |
| 120 |
|
| 121 |
virtual MOS_STATUS RegisterParams(void *settings) = 0; |
| 122 |
virtual MOS_STATUS UpdateParams(bool input) = 0; |
| 123 |
virtual MOS_STATUS SetHucPipeModeSelectParameter(bool& param) = 0; |
| 124 |
virtual bool IsStreamOutNeeded() = 0; |
| 125 |
virtual bool IsStreamOutEnabled() = 0; |
| 126 |
virtual bool IsCpEnabled() = 0; |
| 127 |
virtual void SetCpEnabled(bool isCpInUse) = 0; |
| 128 |
|
| 129 |
//! |
| 130 |
//! \brief CreateDecodeCpIndSubPkt |
| 131 |
//! \return DecodeSubPacket pointer, return nullptr if failed. |
| 132 |
//! |
| 133 |
//! |
| 134 |
virtual decode::DecodeSubPacket* CreateDecodeCpIndSubPkt( |
| 135 |
decode::DecodePipeline *pipeline, |
| 136 |
CODECHAL_MODE mode, |
| 137 |
CodechalHwInterfaceNext *hwInterface) |
| 138 |
{ |
| 139 |
MOS_UNUSED(pipeline); |
| 140 |
MOS_UNUSED(mode); |
| 141 |
MOS_UNUSED(hwInterface); |
| 142 |
MOS_ASSERTMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, "This function is not implemented."); |
| 143 |
return nullptr; |
| 144 |
}; |
| 145 |
|
| 146 |
//! |
| 147 |
//! \brief ExecuteDecodeCpIndSubPkt |
| 148 |
//! \return MOS_STATUS_SUCCESS if success, else fail reason |
| 149 |
//! |
| 150 |
//! |
| 151 |
virtual MOS_STATUS ExecuteDecodeCpIndSubPkt( |
| 152 |
decode::DecodeSubPacket *packet, |
| 153 |
CODECHAL_MODE mode, |
| 154 |
MOS_COMMAND_BUFFER &cmdBuffer, |
| 155 |
uint32_t sliceIndex) |
| 156 |
{ |
| 157 |
MOS_UNUSED(packet); |
| 158 |
MOS_UNUSED(mode); |
| 159 |
MOS_UNUSED(cmdBuffer); |
| 160 |
MOS_UNUSED(sliceIndex); |
| 161 |
MOS_ASSERTMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CODEC, "This function is not implemented."); |
| 162 |
return MOS_STATUS_UNIMPLEMENTED; |
| 163 |
}; |
| 164 |
|
| 165 |
MEDIA_CLASS_DEFINE_END(DecodeCpInterface) |
| 166 |
}; |
| 167 |
|
| 168 |
//! |
| 169 |
//! \brief Create DecodeCpInterface Object |
| 170 |
//! Must use Delete_DecodeCpInterface to delete created Object to avoid ULT Memory Leak errors |
| 171 |
//! |
| 172 |
//! \return Return CP Wrapper Object if CPLIB not loaded |
| 173 |
// |
| 174 |
DecodeCpInterface *Create_DecodeCpInterface( |
| 175 |
CodechalSetting * codechalSettings, |
| 176 |
MhwCpInterface * cpInterface, |
| 177 |
PMOS_INTERFACE osInterface); |
| 178 |
|
| 179 |
//! |
| 180 |
//! \brief Delete the DecodeCpInterface Object |
| 181 |
//! |
| 182 |
//! \param [in] *pMhwCpInterface |
| 183 |
//! MhwCpInterface |
| 184 |
//! |
| 185 |
void Delete_DecodeCpInterface(DecodeCpInterface *pDecodeCpInterface); |
| 186 |
|
| 187 |
#endif // __DECODE_CP_INTERFACE_H__ |