| 1 |
/* |
| 2 |
* Copyright (c) 2021, 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 vp_pipeline_adapter_base.h |
| 24 |
//! \brief vp pipeline adapter base clarification |
| 25 |
//! \details vp pipeline adapter base clarification inlcuding: |
| 26 |
//! some marcro, enum, structure, function |
| 27 |
//! |
| 28 |
#ifndef __VP_PIPELINE_ADAPTER_BASE_H__ |
| 29 |
#define __VP_PIPELINE_ADAPTER_BASE_H__ |
| 30 |
#include "vp_base.h" |
| 31 |
#include "mhw_vebox_itf.h" |
| 32 |
#include "vp_utils.h" |
| 33 |
#include "mhw_sfc_itf.h" |
| 34 |
#include "mhw_render_itf.h" |
| 35 |
|
| 36 |
//! |
| 37 |
//! \brief Deinterlace Mode enum |
| 38 |
//! |
| 39 |
typedef enum |
| 40 |
{ |
| 41 |
VPDDI_PROGRESSIVE = 0, //!< Progressive mode |
| 42 |
VPDDI_BOB = 1, //!< BOB DI mode |
| 43 |
VPDDI_ADI = 2 //!< ADI mode |
| 44 |
} DI_MODE; |
| 45 |
|
| 46 |
//! |
| 47 |
//! \brief Scaling Mode enum |
| 48 |
//! |
| 49 |
typedef enum |
| 50 |
{ |
| 51 |
VPDDI_SCALING = 0, //!< Bilinear scaling |
| 52 |
VPDDI_ADVANCEDSCALING = 1, //!< AVS scaling |
| 53 |
VPDDI_SUPERRESOLUTIONSCALING = 2 //!< Super scaling |
| 54 |
} SCALING_MODE; |
| 55 |
|
| 56 |
//! |
| 57 |
//! Class VpPipelineAdapterBase |
| 58 |
//! \brief VP_INTERFACE class definition |
| 59 |
//! |
| 60 |
class VpPipelineAdapterBase : public VpBase |
| 61 |
{ |
| 62 |
public: |
| 63 |
//! |
| 64 |
//! \brief VpPipelineAdapterBase Constructor |
| 65 |
//! \details Creates instance of VpPipelineAdapterBase |
| 66 |
//! - Caller must call Allocate to allocate all VPHAL states and objects. |
| 67 |
//! \param [in] pOsInterface |
| 68 |
//! OS interface, if provided externally - may be nullptr |
| 69 |
//! \param [in] pOsDriverContext |
| 70 |
//! OS driver context (UMD context, pShared, ...) |
| 71 |
//! \param [in,out] peStatus |
| 72 |
//! Pointer to the MOS_STATUS flag. |
| 73 |
//! Will assign this flag to MOS_STATUS_SUCCESS if successful, otherwise failed |
| 74 |
//! |
| 75 |
VpPipelineAdapterBase( |
| 76 |
vp::VpPlatformInterface &vpPlatformInterface, |
| 77 |
MOS_STATUS &eStatus, |
| 78 |
bool clearViewMode = false); |
| 79 |
|
| 80 |
virtual MOS_STATUS GetVpMhwInterface( |
| 81 |
VP_MHWINTERFACE &vpMhwinterface); |
| 82 |
|
| 83 |
//! |
| 84 |
//! \brief Allocate VpPipelineAdapterBase Resources |
| 85 |
//! \details Allocate VpPipelineAdapterBase Resources |
| 86 |
//! - Allocate and initialize HW states |
| 87 |
//! - Allocate and initialize renderer states |
| 88 |
//! \param [in] pVpHalSettings |
| 89 |
//! Pointer to VPHAL Settings |
| 90 |
//! \return MOS_STATUS |
| 91 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 92 |
//! |
| 93 |
virtual MOS_STATUS Allocate( |
| 94 |
const VpSettings *pVpSettings) = 0; |
| 95 |
|
| 96 |
//! |
| 97 |
//! \brief Performs VP Rendering |
| 98 |
//! \details Performs VP Rendering |
| 99 |
//! - call default render of video |
| 100 |
//! \param [in] pcRenderParams |
| 101 |
//! Pointer to Render Params |
| 102 |
//! \return MOS_STATUS |
| 103 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 104 |
//! |
| 105 |
virtual MOS_STATUS Render( |
| 106 |
PCVPHAL_RENDER_PARAMS pcRenderParams) = 0; |
| 107 |
|
| 108 |
virtual MOS_STATUS RegisterCacheSettings() |
| 109 |
{ |
| 110 |
return MOS_STATUS_SUCCESS; |
| 111 |
}; |
| 112 |
|
| 113 |
//! |
| 114 |
//! \brief Get Status Report |
| 115 |
//! \details Get Status Report, will return back to app indicating if related frame id is done by gpu |
| 116 |
//! \param [out] pQueryReport |
| 117 |
//! Pointer to pQueryReport, the status query report array. |
| 118 |
//! \param [in] wStatusNum |
| 119 |
//! The size of array pQueryReport. |
| 120 |
//! \return MOS_STATUS |
| 121 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 122 |
virtual MOS_STATUS GetStatusReport( |
| 123 |
PQUERY_STATUS_REPORT_APP pQueryReport, |
| 124 |
uint16_t numStatus); |
| 125 |
|
| 126 |
virtual MOS_STATUS GetStatusReportEntryLength( |
| 127 |
uint32_t *puiLength); |
| 128 |
|
| 129 |
virtual VphalFeatureReport *GetRenderFeatureReport() = 0; |
| 130 |
|
| 131 |
//! |
| 132 |
//! \brief VpPipelineAdapterBase Destuctor |
| 133 |
//! \details Destroys VpPipelineAdapterBase and all internal states and objects |
| 134 |
//! \return void |
| 135 |
//! |
| 136 |
virtual ~VpPipelineAdapterBase(); |
| 137 |
|
| 138 |
virtual PMOS_INTERFACE GetOsInterface() |
| 139 |
{ |
| 140 |
return m_osInterface; |
| 141 |
} |
| 142 |
|
| 143 |
virtual MEDIA_FEATURE_TABLE *GetSkuTable() |
| 144 |
{ |
| 145 |
return m_skuTable; |
| 146 |
} |
| 147 |
|
| 148 |
virtual PLATFORM &GetPlatform() |
| 149 |
{ |
| 150 |
return m_platform; |
| 151 |
} |
| 152 |
|
| 153 |
virtual PRENDERHAL_INTERFACE GetRenderHal() |
| 154 |
{ |
| 155 |
return m_vprenderHal; |
| 156 |
} |
| 157 |
|
| 158 |
void SetMhwVeboxItf(std::shared_ptr<mhw::vebox::Itf> veboxItf) |
| 159 |
{ |
| 160 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 161 |
if (veboxItf == nullptr) |
| 162 |
{ |
| 163 |
return; |
| 164 |
} |
| 165 |
|
| 166 |
if (m_veboxItf != nullptr) |
| 167 |
{ |
| 168 |
eStatus = m_veboxItf->DestroyHeap(); |
| 169 |
|
| 170 |
m_veboxItf = nullptr; |
| 171 |
if (MOS_FAILED(eStatus)) |
| 172 |
{ |
| 173 |
VP_PUBLIC_ASSERTMESSAGE("Failed to destroy Vebox Interface, eStatus:%d.\n", eStatus); |
| 174 |
} |
| 175 |
} |
| 176 |
|
| 177 |
m_veboxItf = veboxItf; |
| 178 |
} |
| 179 |
|
| 180 |
void SetMhwSfcItf(std::shared_ptr<mhw::sfc::Itf> sfcItf) |
| 181 |
{ |
| 182 |
if (sfcItf == nullptr) |
| 183 |
{ |
| 184 |
return; |
| 185 |
} |
| 186 |
|
| 187 |
if (m_sfcItf != nullptr) |
| 188 |
{ |
| 189 |
m_sfcItf = nullptr; |
| 190 |
} |
| 191 |
|
| 192 |
m_sfcItf = sfcItf; |
| 193 |
} |
| 194 |
|
| 195 |
void SetMhwMiItf(std::shared_ptr<mhw::mi::Itf> miItf) |
| 196 |
{ |
| 197 |
if (miItf == nullptr) |
| 198 |
{ |
| 199 |
return; |
| 200 |
} |
| 201 |
if (m_miItf != nullptr) |
| 202 |
{ |
| 203 |
m_miItf = nullptr; |
| 204 |
} |
| 205 |
|
| 206 |
m_miItf = miItf; |
| 207 |
} |
| 208 |
|
| 209 |
void SetMhwRenderItf(std::shared_ptr<mhw::render::Itf> renderItf) |
| 210 |
{ |
| 211 |
if (renderItf == nullptr) |
| 212 |
{ |
| 213 |
return; |
| 214 |
} |
| 215 |
|
| 216 |
if (m_renderItf != nullptr) |
| 217 |
{ |
| 218 |
m_renderItf = nullptr; |
| 219 |
} |
| 220 |
|
| 221 |
m_renderItf = renderItf; |
| 222 |
} |
| 223 |
|
| 224 |
protected: |
| 225 |
// Internals |
| 226 |
PLATFORM m_platform = {}; |
| 227 |
MEDIA_FEATURE_TABLE *m_skuTable = nullptr; |
| 228 |
MEDIA_WA_TABLE * m_waTable = nullptr; |
| 229 |
|
| 230 |
// States |
| 231 |
PMOS_INTERFACE m_osInterface = nullptr; |
| 232 |
PRENDERHAL_INTERFACE m_vprenderHal = nullptr; |
| 233 |
MhwCpInterface * m_cpInterface = nullptr; |
| 234 |
std::shared_ptr<mhw::vebox::Itf> m_veboxItf = nullptr; |
| 235 |
std::shared_ptr<mhw::sfc::Itf> m_sfcItf = nullptr; |
| 236 |
std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr; |
| 237 |
std::shared_ptr<mhw::render::Itf> m_renderItf = nullptr; |
| 238 |
|
| 239 |
// StatusTable indicating if command is done by gpu or not |
| 240 |
VPHAL_STATUS_TABLE m_statusTable = {}; |
| 241 |
vp::VpPlatformInterface &m_vpPlatformInterface; //!< vp platform interface. Should be destroyed during deconstruction. |
| 242 |
MediaUserSettingSharedPtr m_userSettingPtr = nullptr; //!< usersettingInstance |
| 243 |
|
| 244 |
// Perf Optimize for ClearVideoView DDI |
| 245 |
bool m_clearVideoViewMode = false; |
| 246 |
MEDIA_CLASS_DEFINE_END(VpPipelineAdapterBase) |
| 247 |
}; |
| 248 |
|
| 249 |
#endif // __VP_PIPELINE_ADAPTER_BASE_H__ |