1 /* 2 * Copyright (c) 2020-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_tcc_filter.h 24 //! \brief Defines the common interface for tcc 25 //! this file is for the base interface which is shared by all tcc in driver. 26 //! 27 #ifndef __VP_TCC_FILTER_H__ 28 #define __VP_TCC_FILTER_H__ 29 #include "vp_filter.h" 30 #include "sw_filter.h" 31 32 namespace vp { 33 class VpTccFilter : public VpFilter 34 { 35 public: 36 37 VpTccFilter( 38 PVP_MHWINTERFACE vpMhwInterface); 39 ~VpTccFilter()40 ~VpTccFilter() 41 { 42 Destroy(); 43 }; 44 45 virtual MOS_STATUS Init() override; 46 47 virtual MOS_STATUS Prepare() override; 48 49 virtual MOS_STATUS Destroy() override; 50 51 virtual MOS_STATUS SetExecuteEngineCaps( 52 FeatureParamTcc &tccParams, 53 VP_EXECUTE_CAPS vpExecuteCaps); 54 55 MOS_STATUS CalculateEngineParams(); GetVeboxParams()56 PVEBOX_TCC_PARAMS GetVeboxParams() 57 { 58 return m_pVeboxTccParams; 59 } 60 61 protected: 62 FeatureParamTcc m_tccParams = {}; 63 PVEBOX_TCC_PARAMS m_pVeboxTccParams = nullptr; 64 65 MEDIA_CLASS_DEFINE_END(vp__VpTccFilter) 66 }; 67 68 struct HW_FILTER_TCC_PARAM : public HW_FILTER_PARAM 69 { 70 FeatureParamTcc tccParams; 71 }; 72 73 class HwFilterTccParameter : public HwFilterParameter 74 { 75 public: 76 static HwFilterParameter *Create(HW_FILTER_TCC_PARAM ¶m, FeatureType featureType); 77 HwFilterTccParameter(FeatureType featureType); 78 virtual ~HwFilterTccParameter(); 79 virtual MOS_STATUS ConfigParams(HwFilter &hwFilter); 80 81 MOS_STATUS Initialize(HW_FILTER_TCC_PARAM¶m); 82 83 private: 84 HW_FILTER_TCC_PARAM m_Params = {}; 85 86 MEDIA_CLASS_DEFINE_END(vp__HwFilterTccParameter) 87 }; 88 89 class VpVeboxTccParameter : public VpPacketParameter 90 { 91 public: 92 static VpPacketParameter *Create(HW_FILTER_TCC_PARAM ¶m); 93 VpVeboxTccParameter(PVP_MHWINTERFACE pHwInterface, PacketParamFactoryBase *packetParamFactory); 94 virtual ~VpVeboxTccParameter(); 95 96 virtual bool SetPacketParam(VpCmdPacket *pPacket); 97 98 private: 99 MOS_STATUS Initialize(HW_FILTER_TCC_PARAM¶ms); 100 101 VpTccFilter m_tccFilter; 102 103 MEDIA_CLASS_DEFINE_END(vp__VpVeboxTccParameter) 104 }; 105 106 class PolicyVeboxTccHandler : public PolicyFeatureHandler 107 { 108 public: 109 PolicyVeboxTccHandler(VP_HW_CAPS &hwCaps); 110 virtual ~PolicyVeboxTccHandler(); 111 virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps); 112 virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface); 113 CreatePacketParam(HW_FILTER_PARAM & param)114 static VpPacketParameter* CreatePacketParam(HW_FILTER_PARAM& param) 115 { 116 if (param.type != FeatureTypeTccOnVebox) 117 { 118 VP_PUBLIC_ASSERTMESSAGE("Invalid parameter for Vebox TCC!"); 119 return nullptr; 120 } 121 122 HW_FILTER_TCC_PARAM* tccParam = (HW_FILTER_TCC_PARAM*)(¶m); 123 return VpVeboxTccParameter::Create(*tccParam); 124 } 125 126 private: 127 PacketParamFactory<VpVeboxTccParameter> m_PacketParamFactory; 128 129 MEDIA_CLASS_DEFINE_END(vp__PolicyVeboxTccHandler) 130 }; 131 } 132 #endif 133