1 /* 2 * Copyright (c) 2022, 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_vebox_copy_next.h 24 //! \brief Common Copy interface and structure used in Vebox Engine 25 //! \details Common Copy interface and structure used in Vebox Engine 26 27 #ifndef __MEDIA_VEBOX_COPY_NEXT_H__ 28 #define __MEDIA_VEBOX_COPY_NEXT_H__ 29 30 #include "mos_interface.h" 31 #include "media_interfaces_mhw_next.h" 32 #include "mhw_vebox.h" 33 #include "mhw_vebox_itf.h" 34 35 #define VEBOX_COPY_CHK_STATUS(_stmt) MOS_CHK_STATUS(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_VEBOX, _stmt) 36 #define VEBOX_COPY_CHK_STATUS_RETURN(_stmt) MOS_CHK_STATUS_RETURN(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_VEBOX, _stmt) 37 #define VEBOX_COPY_CHK_NULL(_ptr) MOS_CHK_NULL(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_VEBOX, _ptr) 38 #define VEBOX_COPY_CHK_NULL_RETURN(_ptr) MOS_CHK_NULL_RETURN(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_VEBOX, _ptr) 39 #define VEBOX_COPY_ASSERTMESSAGE(_message, ...) MOS_ASSERTMESSAGE(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_VEBOX, _message, ##__VA_ARGS__) 40 #define VEBOX_COPY_NORMALMESSAGE(_message, ...) MOS_NORMALMESSAGE(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_VEBOX, _message, ##__VA_ARGS__) 41 42 class VeboxCopyStateNext 43 { 44 public: 45 //! 46 //! \brief Vebox Copy State constructor 47 //! \details Initialize the VeboxCopyStateNext members. 48 //! \param osInterface 49 //! [in] Pointer to MOS_INTERFACE. 50 //! 51 VeboxCopyStateNext(PMOS_INTERFACE osInterface); 52 VeboxCopyStateNext(PMOS_INTERFACE osInterface, MhwInterfacesNext* mhwInterfaces); 53 54 virtual ~VeboxCopyStateNext(); 55 //! 56 //! \brief Vebox Copy State initialize 57 //! \details Initialize the Vebox Copy State, create Vebox Copy State context. 58 //! \return MOS_STATUS 59 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 60 //! 61 virtual MOS_STATUS Initialize(); 62 63 //! 64 //! \brief Copy main surface 65 //! \details Vebox Copy State engine will copy source surface to destination surface 66 //! \param src 67 //! [in] Pointer to source surface 68 //! \param dst 69 //! [in] Pointer to destination surface 70 //! \return MOS_STATUS 71 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 72 //! 73 virtual MOS_STATUS CopyMainSurface( 74 PMOS_SURFACE src, 75 PMOS_SURFACE dst); 76 77 //! 78 //! \brief Copy main surface 79 //! \details Vebox Copy State engine will copy source surface to destination surface 80 //! \param src 81 //! [in] Pointer to source resource 82 //! \param dst 83 //! [in] Pointer to destination resource 84 //! \return MOS_STATUS 85 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 86 //! 87 virtual MOS_STATUS CopyMainSurface( 88 PMOS_RESOURCE src, 89 PMOS_RESOURCE dst); 90 91 //! 92 //! Is ve copy supported surface 93 //! \param [in/out] surface 94 //! Pointer to Output Surface parameters 95 //! \return true if supported, else false. 96 //! 97 bool IsSurfaceSupported(PMOS_RESOURCE surface); 98 99 //! 100 //! \brief Setup Vebox_Surface_State Command parameter 101 //! \param [in/out] mhwVeboxSurfaceStateCmdParams 102 //! Pointer to VEBOX_SURFACE_STATE command parameters 103 //! \param [in] surface 104 //! Input surface pointer 105 //! \param [in] surface 106 //! output surface pointer 107 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 108 //! 109 virtual MOS_STATUS SetupVeboxSurfaceState( 110 PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS mhwVeboxSurfaceStateCmdParams, 111 PMOS_SURFACE inputSurface, 112 PMOS_SURFACE outputSurface); 113 114 protected: 115 116 //! \brief Get resource information 117 //! \details Get resource information for the specifc surface 118 //! \param [in] pSurface 119 //! Surface pointer 120 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 121 //! 122 MOS_STATUS GetResourceInfo( 123 PMOS_SURFACE surface); 124 125 //! 126 //! \brief Get resource information 127 //! \details Get resource information for the specifc surface 128 //! \param [in] cmdBuffer 129 //! CmdBuffer pointer 130 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 131 //! 132 MOS_STATUS InitCommandBuffer( 133 PMOS_COMMAND_BUFFER cmdBuffer); 134 135 //! 136 //! Is ve copy supported format 137 //! \param [in/out] surface mos format 138 //! 139 //! \return true if supported, else false. 140 //! 141 virtual bool IsVeCopySupportedFormat(MOS_FORMAT format); 142 143 //! 144 //! \brief change vebox surface format. 145 //! \details change vebox surface format 146 //! \param [in] surface 147 //! mos surface 148 //! \return void 149 virtual void AdjustSurfaceFormat(MOS_SURFACE &surface); 150 151 //! 152 //! \brief Create Gpu Context for Vebox 153 //! \details Create Gpu Context for Vebox 154 //! \param [in] pOsInterface 155 //! OS interface 156 //! \param [in] VeboxGpuContext 157 //! Vebox Gpu Context 158 //! \param [in] VeboxGpuNode 159 //! Vebox Gpu Node 160 //! \return MOS_STATUS 161 //! MOS_STATUS_SUCCESS if success, else fail reason 162 //! 163 virtual MOS_STATUS CreateGpuContext( 164 PMOS_INTERFACE pOsInterface, 165 MOS_GPU_CONTEXT VeboxGpuContext, 166 MOS_GPU_NODE VeboxGpuNode); 167 168 protected: 169 PMOS_INTERFACE m_osInterface = nullptr; 170 MhwInterfacesNext *m_mhwInterfaces = nullptr; 171 MhwCpInterface *m_cpInterface = nullptr; 172 MhwInterfacesNext::CreateParams params; 173 174 std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr; 175 std::shared_ptr<mhw::vebox::Itf> m_veboxItf = nullptr; 176 177 MEDIA_CLASS_DEFINE_END(VeboxCopyStateNext) 178 }; 179 180 #endif //__MEDIA_VEBOX_COPY_NEXT_H__ 181