| 1 |
/* |
| 2 |
* Copyright (c) 2019, 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 |
//! |
| 24 |
//! \file vp_feature_manager.h |
| 25 |
//! \brief Defines the common interface for vp features manager |
| 26 |
//! \details The vp manager is further sub-divided by vp type |
| 27 |
//! this file is for the base interface which is shared by all components. |
| 28 |
//! |
| 29 |
#ifndef __VP_FEATURE_MANAGER_H__ |
| 30 |
#define __VP_FEATURE_MANAGER_H__ |
| 31 |
|
| 32 |
#include "media_feature_manager.h" |
| 33 |
#include "vp_utils.h" |
| 34 |
#include "vp_pipeline_common.h" |
| 35 |
#include "vp_allocator.h" |
| 36 |
#include "vp_obj_factories.h" |
| 37 |
#include "vp_user_feature_control.h" |
| 38 |
|
| 39 |
namespace vp |
| 40 |
{ |
| 41 |
class SwFilterFeatureHandler; |
| 42 |
class VpResourceManager; |
| 43 |
|
| 44 |
class VPFeatureManager : public MediaFeatureManager |
| 45 |
{ |
| 46 |
public: |
| 47 |
//! |
| 48 |
//! \brief VPFeatureManager constructor |
| 49 |
//! \param [in] hwInterface |
| 50 |
//! Pointer to VP_MHWINTERFACE |
| 51 |
//! \param [in] pOsInterface |
| 52 |
//! Pointer to MOS INTERFACE |
| 53 |
//! |
| 54 |
VPFeatureManager(PVP_MHWINTERFACE hwInterface); |
| 55 |
|
| 56 |
//! |
| 57 |
//! \brief VPFeatureManager deconstructor |
| 58 |
//! |
| 59 |
virtual ~VPFeatureManager() {} |
| 60 |
|
| 61 |
//! |
| 62 |
//! \brief Check the conflict between features |
| 63 |
//! \param [in] params |
| 64 |
//! encode parameters |
| 65 |
//! \return MOS_STATUS |
| 66 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 67 |
//! |
| 68 |
virtual MOS_STATUS CheckFeatures(void *params, bool &bapgFuncSupported); |
| 69 |
|
| 70 |
//! |
| 71 |
//! \brief Check the conflict between features |
| 72 |
//! \param [in] params |
| 73 |
//! encode parameters |
| 74 |
//! \return MOS_STATUS |
| 75 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 76 |
//! |
| 77 |
virtual MOS_STATUS CheckFeatures(void *params); |
| 78 |
|
| 79 |
protected: |
| 80 |
//! |
| 81 |
//! \brief Check if HDR are needed |
| 82 |
//! \param [in] pSrc |
| 83 |
//! Pointer to input surface of Vebox |
| 84 |
//! \param [in] pRenderTarget |
| 85 |
//! Pointer to Render targe surface of VPP BLT |
| 86 |
//! \return bool |
| 87 |
//! return true if 2 Passes CSC is needed, otherwise false |
| 88 |
//! |
| 89 |
virtual bool IsHdrNeeded( |
| 90 |
PVPHAL_SURFACE pSrc, |
| 91 |
PVPHAL_SURFACE pRenderTarget); |
| 92 |
|
| 93 |
virtual bool IsCroppingNeeded(PVPHAL_SURFACE pSrc); |
| 94 |
//! |
| 95 |
//! \brief Check if 2 passes CSC are needed |
| 96 |
//! \param [in] pSrc |
| 97 |
//! Pointer to input surface of Vebox |
| 98 |
//! \param [in] pRenderTarget |
| 99 |
//! Pointer to Render targe surface of VPP BLT |
| 100 |
//! \return bool |
| 101 |
//! return true if 2 Passes CSC is needed, otherwise false |
| 102 |
//! |
| 103 |
virtual bool Is2PassesCSCNeeded( |
| 104 |
PVPHAL_SURFACE pSrc, |
| 105 |
PVPHAL_SURFACE pRenderTarget); |
| 106 |
|
| 107 |
virtual bool IsVeboxOutFeasible(PVP_PIPELINE_PARAMS params); |
| 108 |
|
| 109 |
virtual bool IsVeboxInputFormatSupport(PVPHAL_SURFACE pSrcSurface); |
| 110 |
|
| 111 |
virtual bool IsVeboxRTFormatSupport( |
| 112 |
PVPHAL_SURFACE pSrcSurface, |
| 113 |
PVPHAL_SURFACE pRTSurface); |
| 114 |
|
| 115 |
virtual bool IsVeboxSupported(PVP_PIPELINE_PARAMS params); |
| 116 |
|
| 117 |
virtual bool IsSfcOutputFeasible(PVP_PIPELINE_PARAMS params); |
| 118 |
|
| 119 |
virtual bool IsOutputFormatSupported( |
| 120 |
PVPHAL_SURFACE outSurface); |
| 121 |
|
| 122 |
virtual bool IsRGBOutputFormatSupported( |
| 123 |
PVPHAL_SURFACE outSurface); |
| 124 |
|
| 125 |
virtual bool IsNV12P010OutputFormatSupported( |
| 126 |
PVPHAL_SURFACE outSurface); |
| 127 |
|
| 128 |
//! |
| 129 |
//! \brief Get the aligned the surface height and width unit |
| 130 |
//! \details According to the format of the surface, get the aligned unit for the surface |
| 131 |
//! width and height |
| 132 |
//! \param [in,out] pwWidthAlignUnit |
| 133 |
//! Pointer to the surface width alignment unit |
| 134 |
//! \param [in,out] pwHeightAlignUnit |
| 135 |
//! Pointer to the surface height alignment unit |
| 136 |
//! \param [in] format |
| 137 |
//! The format of the surface |
| 138 |
//! \return void |
| 139 |
//! |
| 140 |
virtual void GetAlignUnit( |
| 141 |
uint16_t &wWidthAlignUnit, |
| 142 |
uint16_t &wHeightAlignUnit, |
| 143 |
MOS_FORMAT format); |
| 144 |
|
| 145 |
//! |
| 146 |
//! \brief Align the src/dst surface rectangle and surface width/height |
| 147 |
//! \details The surface rects and width/height need to be aligned according to the surface format |
| 148 |
//! \param [in,out] pSurface |
| 149 |
//! Pointer to the surface |
| 150 |
//! \param [in] formatForDstRect |
| 151 |
//! Format for Dst Rect |
| 152 |
//! \return MOS_STATUS |
| 153 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 154 |
//! |
| 155 |
virtual MOS_STATUS RectSurfaceAlignment( |
| 156 |
PVPHAL_SURFACE pSurface, |
| 157 |
MOS_FORMAT formatForDstRect); |
| 158 |
|
| 159 |
virtual bool IsSfcInterlacedScalingSupported() |
| 160 |
{ |
| 161 |
return false; |
| 162 |
} |
| 163 |
|
| 164 |
virtual bool IsDiFormatSupported(MOS_FORMAT format); |
| 165 |
virtual bool IsVeboxSurfaceHeightAligned(VPHAL_SURFACE &surf); |
| 166 |
|
| 167 |
protected: |
| 168 |
PVP_MHWINTERFACE m_hwInterface = nullptr; |
| 169 |
PMOS_INTERFACE m_pOsInterface = nullptr; |
| 170 |
vp::VpUserFeatureControl *m_vpUserFeatureControl = nullptr; |
| 171 |
|
| 172 |
MEDIA_CLASS_DEFINE_END(vp__VPFeatureManager) |
| 173 |
}; |
| 174 |
|
| 175 |
class VpFeatureManagerNext : public MediaFeatureManager |
| 176 |
{ |
| 177 |
public: |
| 178 |
VpFeatureManagerNext(VpInterface& vpInterface); |
| 179 |
virtual ~VpFeatureManagerNext(); |
| 180 |
|
| 181 |
virtual MOS_STATUS Init(void* settings) override; |
| 182 |
virtual MOS_STATUS InitPacketPipe(SwFilterPipe& swFilterPipe, |
| 183 |
PacketPipe& packetPipe); |
| 184 |
|
| 185 |
//! |
| 186 |
//! \brief Check whether VEBOX-SFC Format Supported |
| 187 |
//! \details Check whether VEBOX-SFC Format Supported. |
| 188 |
//! \param inputFormat |
| 189 |
//! [in] Format of Input Frame |
| 190 |
//! \param outputFormat |
| 191 |
//! [in] Format of Output Frame |
| 192 |
//! \return bool |
| 193 |
//! Return true if supported, otherwise failed |
| 194 |
//! |
| 195 |
bool IsVeboxSfcFormatSupported(MOS_FORMAT formatInput, MOS_FORMAT formatOutput); |
| 196 |
|
| 197 |
Policy *GetPolicy() |
| 198 |
{ |
| 199 |
return m_policy; |
| 200 |
} |
| 201 |
|
| 202 |
protected: |
| 203 |
MOS_STATUS CreateHwFilterPipe(SwFilterPipe& swFilterPipe, HwFilterPipe*& pHwFilterPipe); |
| 204 |
MOS_STATUS UpdateResources(HwFilterPipe& hwFilterPipe); |
| 205 |
|
| 206 |
virtual MOS_STATUS RegisterFeatures(); |
| 207 |
MOS_STATUS UnregisterFeatures(); |
| 208 |
|
| 209 |
VpInterface &m_vpInterface; |
| 210 |
Policy *m_policy = nullptr; |
| 211 |
std::map<FeatureType, SwFilterFeatureHandler*> m_featureHandler; |
| 212 |
uint32_t m_isFeatureRegistered = false; |
| 213 |
|
| 214 |
MEDIA_CLASS_DEFINE_END(vp__VpFeatureManagerNext) |
| 215 |
}; |
| 216 |
} |
| 217 |
#endif // !__VP_FEATURE_MANAGER_H__ |