| 1 |
/* |
| 2 |
* Copyright (c) 2015-2020, 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 media_libva_cp_interface.cpp |
| 24 |
//! \brief The class implementation of DdiCpInterface |
| 25 |
//! |
| 26 |
|
| 27 |
#include "media_libva_util.h" |
| 28 |
#include "media_libva_decoder.h" |
| 29 |
#include "media_libva_encoder.h" |
| 30 |
#include "media_libva_cp_interface.h" |
| 31 |
#include "media_libva_vp.h" |
| 32 |
#include "cp_interfaces.h" |
| 33 |
#include <typeinfo> |
| 34 |
|
| 35 |
static void DdiStubMessage() |
| 36 |
{ |
| 37 |
MOS_NORMALMESSAGE( |
| 38 |
MOS_COMPONENT_CP, |
| 39 |
MOS_CP_SUBCOMP_DDI, |
| 40 |
"This function is stubbed as CP is not enabled."); |
| 41 |
} |
| 42 |
|
| 43 |
DdiCpInterface* Create_DdiCpInterface(MOS_CONTEXT& mosCtx) |
| 44 |
{ |
| 45 |
DdiCpInterface* pInterface = nullptr; |
| 46 |
CpInterfaces *cp_interface = CpInterfacesFactory::Create(CP_INTERFACE); |
| 47 |
if (cp_interface) |
| 48 |
{ |
| 49 |
pInterface = cp_interface->Create_DdiCpInterface(mosCtx); |
| 50 |
MOS_Delete(cp_interface); |
| 51 |
} |
| 52 |
|
| 53 |
if (nullptr == pInterface) DdiStubMessage(); |
| 54 |
|
| 55 |
return nullptr == pInterface ? MOS_New(DdiCpInterface, mosCtx) : pInterface; |
| 56 |
} |
| 57 |
|
| 58 |
void Delete_DdiCpInterface(DdiCpInterface* pInterface) |
| 59 |
{ |
| 60 |
CpInterfaces *cp_interface = CpInterfacesFactory::Create(CP_INTERFACE); |
| 61 |
if (pInterface != nullptr && cp_interface != nullptr) |
| 62 |
{ |
| 63 |
cp_interface->Delete_DdiCpInterface(pInterface); |
| 64 |
pInterface = nullptr; |
| 65 |
} |
| 66 |
MOS_Delete(pInterface); |
| 67 |
MOS_Delete(cp_interface); |
| 68 |
} |
| 69 |
|
| 70 |
void DdiCpInterface::SetCpParams(uint32_t encryptionType, CodechalSetting *setting) |
| 71 |
{ |
| 72 |
DdiStubMessage(); |
| 73 |
} |
| 74 |
|
| 75 |
VAStatus DdiCpInterface::RenderCencPicture( |
| 76 |
VADriverContextP vaDrvctx, |
| 77 |
VAContextID contextId, |
| 78 |
DDI_MEDIA_BUFFER *buf, |
| 79 |
void *data) |
| 80 |
{ |
| 81 |
DdiStubMessage(); |
| 82 |
return VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE; |
| 83 |
} |
| 84 |
|
| 85 |
VAStatus DdiCpInterface::CreateBuffer( |
| 86 |
VABufferType type, |
| 87 |
DDI_MEDIA_BUFFER* buffer, |
| 88 |
uint32_t size, |
| 89 |
uint32_t num_elements |
| 90 |
) |
| 91 |
{ |
| 92 |
DdiStubMessage(); |
| 93 |
return VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE; |
| 94 |
} |
| 95 |
|
| 96 |
VAStatus DdiCpInterface::InitHdcp2Buffer(DDI_CODEC_COM_BUFFER_MGR* bufMgr) |
| 97 |
{ |
| 98 |
DdiStubMessage(); |
| 99 |
return VA_STATUS_SUCCESS; |
| 100 |
} |
| 101 |
|
| 102 |
VAStatus DdiCpInterface::StatusReportForHdcp2Buffer( |
| 103 |
DDI_CODEC_COM_BUFFER_MGR* bufMgr, |
| 104 |
void* encodeStatusReport) |
| 105 |
{ |
| 106 |
DdiStubMessage(); |
| 107 |
return VA_STATUS_SUCCESS; |
| 108 |
} |
| 109 |
|
| 110 |
void DdiCpInterface::FreeHdcp2Buffer(DDI_CODEC_COM_BUFFER_MGR* bufMgr) |
| 111 |
{ |
| 112 |
DdiStubMessage(); |
| 113 |
return ; |
| 114 |
} |
| 115 |
|
| 116 |
MOS_STATUS DdiCpInterface::StoreCounterToStatusReport( |
| 117 |
PDDI_ENCODE_STATUS_REPORT_INFO info) |
| 118 |
{ |
| 119 |
DdiStubMessage(); |
| 120 |
return MOS_STATUS_SUCCESS; |
| 121 |
} |
| 122 |
|
| 123 |
void DdiCpInterface::SetInputResourceEncryption(PMOS_INTERFACE osInterface, PMOS_RESOURCE resource) |
| 124 |
{ |
| 125 |
DdiStubMessage(); |
| 126 |
} |
| 127 |
|
| 128 |
VAStatus DdiCpInterface::ParseCpParamsForEncode() |
| 129 |
{ |
| 130 |
DdiStubMessage(); |
| 131 |
return VA_STATUS_SUCCESS; |
| 132 |
} |
| 133 |
|
| 134 |
void DdiCpInterface::SetCpFlags(int32_t flag) |
| 135 |
{ |
| 136 |
DdiStubMessage(); |
| 137 |
} |
| 138 |
|
| 139 |
bool DdiCpInterface::IsHdcp2Enabled() |
| 140 |
{ |
| 141 |
DdiStubMessage(); |
| 142 |
return false; |
| 143 |
} |
| 144 |
|
| 145 |
VAStatus DdiCpInterface::CreateCencDecode( |
| 146 |
CodechalDebugInterface *debugInterface, |
| 147 |
PMOS_CONTEXT osContext, |
| 148 |
CodechalSetting * settings) |
| 149 |
{ |
| 150 |
DdiStubMessage(); |
| 151 |
return VA_STATUS_SUCCESS; |
| 152 |
} |
| 153 |
|
| 154 |
VAStatus DdiCpInterface::SetDecodeParams( |
| 155 |
DDI_DECODE_CONTEXT *ddiDecodeContext, |
| 156 |
CodechalSetting *setting) |
| 157 |
{ |
| 158 |
DdiStubMessage(); |
| 159 |
return VA_STATUS_SUCCESS; |
| 160 |
} |
| 161 |
|
| 162 |
bool DdiCpInterface::IsCencProcessing() |
| 163 |
{ |
| 164 |
DdiStubMessage(); |
| 165 |
return false; |
| 166 |
} |
| 167 |
|
| 168 |
VAStatus DdiCpInterface::EndPicture( |
| 169 |
VADriverContextP ctx, |
| 170 |
VAContextID context |
| 171 |
) |
| 172 |
{ |
| 173 |
DdiStubMessage(); |
| 174 |
return VA_STATUS_SUCCESS; |
| 175 |
} |
| 176 |
|
| 177 |
VAStatus DdiCpInterface::IsAttachedSessionAlive() |
| 178 |
{ |
| 179 |
DdiStubMessage(); |
| 180 |
return VA_STATUS_SUCCESS; |
| 181 |
} |