1 /* 2 * Copyright (c) 2018-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_rot_mir_filter.h 24 //! \brief Defines the common interface for rotation/mirror 25 //! this file is for the base interface which is shared by rotation/mirror in driver. 26 //! 27 28 #ifndef __VP_ROT_MIR_FILTER_H__ 29 #define __VP_ROT_MIR_FILTER_H__ 30 31 #include "vp_filter.h" 32 #include "sw_filter.h" 33 34 namespace vp { 35 36 class VpRotMirFilter : public VpFilter 37 { 38 public: 39 40 VpRotMirFilter( 41 PVP_MHWINTERFACE vpMhwInterface); 42 ~VpRotMirFilter()43 virtual ~VpRotMirFilter() 44 { 45 Destroy(); 46 }; 47 48 virtual MOS_STATUS Init() override; 49 50 virtual MOS_STATUS Prepare() override; 51 52 virtual MOS_STATUS Destroy() override; 53 54 virtual MOS_STATUS SetExecuteEngineCaps( 55 FeatureParamRotMir &rotMirParams, 56 VP_EXECUTE_CAPS vpExecuteCaps); 57 58 MOS_STATUS CalculateEngineParams(); GetSfcParams()59 SFC_ROT_MIR_PARAMS *GetSfcParams() 60 { 61 return m_sfcRotMirParams; 62 } 63 protected: 64 65 //! 66 //! \brief Setup Rotation and Mirrow params 67 //! \details Setup Rotation and Mirrow params 68 //! \param [in] Rotation 69 //! Pointer to surface rotation params 70 //! \return MOS_STATUS 71 //! 72 MOS_STATUS SetRotationAndMirrowParams( 73 VPHAL_ROTATION Rotation); 74 75 //! 76 //! \brief Setup Rotation and Mirrow params 77 //! \details Setup Rotation and Mirrow params 78 //! \param [in] Rotation 79 //! surface rotation params 80 //! \return VPHAL_ROTATION 81 //! 82 VPHAL_ROTATION GetRotationParam( 83 VPHAL_ROTATION Rotation); 84 85 protected: 86 FeatureParamRotMir m_rotMirParams = {}; 87 PSFC_ROT_MIR_PARAMS m_sfcRotMirParams = nullptr; 88 89 MEDIA_CLASS_DEFINE_END(vp__VpRotMirFilter) 90 }; 91 92 struct HW_FILTER_ROT_MIR_PARAM : public HW_FILTER_PARAM 93 { 94 FeatureParamRotMir rotMirParams; 95 }; 96 97 class HwFilterRotMirParameter : public HwFilterParameter 98 { 99 public: 100 static HwFilterParameter *Create(HW_FILTER_ROT_MIR_PARAM ¶m, FeatureType featureType); 101 HwFilterRotMirParameter(FeatureType featureType); 102 virtual ~HwFilterRotMirParameter(); 103 virtual MOS_STATUS ConfigParams(HwFilter &hwFilter); 104 MOS_STATUS Initialize(HW_FILTER_ROT_MIR_PARAM ¶m); 105 106 private: 107 HW_FILTER_ROT_MIR_PARAM m_Params = {}; 108 109 MEDIA_CLASS_DEFINE_END(vp__HwFilterRotMirParameter) 110 }; 111 112 class VpSfcRotMirParameter : public VpPacketParameter 113 { 114 public: 115 static VpPacketParameter *Create(HW_FILTER_ROT_MIR_PARAM ¶m); 116 VpSfcRotMirParameter(PVP_MHWINTERFACE pHwInterface, PacketParamFactoryBase *packetParamFactory); 117 virtual ~VpSfcRotMirParameter(); 118 119 virtual bool SetPacketParam(VpCmdPacket *pPacket); 120 121 private: 122 MOS_STATUS Initialize(HW_FILTER_ROT_MIR_PARAM & params); 123 124 VpRotMirFilter m_RotMirFilter; 125 126 MEDIA_CLASS_DEFINE_END(vp__VpSfcRotMirParameter) 127 }; 128 129 class PolicySfcRotMirHandler : public PolicyFeatureHandler 130 { 131 public: 132 PolicySfcRotMirHandler(VP_HW_CAPS &hwCaps); 133 virtual ~PolicySfcRotMirHandler(); 134 virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps); 135 virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface); 136 virtual MOS_STATUS UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index); 137 CreatePacketParam(HW_FILTER_PARAM & param)138 static VpPacketParameter* CreatePacketParam(HW_FILTER_PARAM& param) 139 { 140 if (param.type != FeatureTypeRotMirOnSfc) 141 { 142 VP_PUBLIC_ASSERTMESSAGE("Invalid parameter for SFC Rotation-Mirror!"); 143 return nullptr; 144 } 145 146 HW_FILTER_ROT_MIR_PARAM* rotationParam = (HW_FILTER_ROT_MIR_PARAM*)(¶m); 147 return VpSfcRotMirParameter::Create(*rotationParam); 148 } 149 private: 150 PacketParamFactory<VpSfcRotMirParameter> m_PacketParamFactory; 151 152 MEDIA_CLASS_DEFINE_END(vp__PolicySfcRotMirHandler) 153 }; 154 } 155 #endif//__VP_ROT_MIR_FILTER_H__