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_copy_xe_lpm_plus_base.h
24 //! \brief    Common interface and structure used in media copy
25 //! \details  Common interface and structure used in media copy which are platform independent
26 //!
27 
28 #ifndef __MEDIA_COPY_XE_LPM_PLUS_BASE_H__
29 #define __MEDIA_COPY_XE_LPM_PLUS_BASE_H__
30 
31 #include "media_copy.h"
32 #include "media_blt_copy_xe_lpm_plus_base.h"
33 #include "media_vebox_copy_xe_lpm_plus_base.h"
34 #include "media_render_copy_xe_lpm_plus_base.h"
35 
36 class MediaCopyStateXe_Lpm_Plus_Base: public MediaCopyBaseState
37 {
38 public:
39     //!
40     //! \brief    MediaCopyStateXe_Xpm_Plus constructor
41     //! \details  Initialize the MediaCopy members.
42     //! \param    osInterface
43     //!           [in] Pointer to MOS_INTERFACE.
44     //!
45     MediaCopyStateXe_Lpm_Plus_Base();
46     virtual ~MediaCopyStateXe_Lpm_Plus_Base();
47 
48     //!
49     //! \brief    init function.
50     virtual MOS_STATUS Initialize(PMOS_INTERFACE osInterface, MhwInterfacesNext *mhwInterfaces);
51     using MediaCopyBaseState::Initialize;
52 
53     //!
54     //! \brief    render format support.
55     //! \details  surface format support.
56     //! \param    src
57     //!           [in] Pointer to source surface
58     //! \param    dst
59     //!           [in] Pointer to destination surface
60     //! \return   bool
61     //!           Return true if support, otherwise return false.
62     //!
63     virtual bool RenderFormatSupportCheck(PMOS_RESOURCE src, PMOS_RESOURCE dst);
64 
65     //!
66     //! \brief    feature support check on specific check.
67     //! \details  media copy feature support.
68     //! \param    src
69     //!           [in] Pointer to source surface
70     //! \param    dst
71     //!           [in] Pointer to destination surface
72     //! \param    caps
73     //!           [in] reference of featue supported engine
74     //! \return   MOS_STATUS
75     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
76     //!
77     virtual MOS_STATUS FeatureSupport(PMOS_RESOURCE src, PMOS_RESOURCE dst, MCPY_ENGINE_CAPS& caps);
78 
79 protected:
80 
81     //!
82     //! \brief    use blt engie to do surface copy.
83     //! \details  implementation media blt copy.
84     //! \param    src
85     //!           [in] Pointer to source surface
86     //! \param    dst
87     //!           [in] Pointer to destination surface
88     //! \return   MOS_STATUS
89     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
90     //!
91     virtual MOS_STATUS MediaBltCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst);
92 
93     //!
94     //! \brief    use Render engie to do surface copy.
95     //! \details  implementation media Render copy.
96     //! \param    src
97     //!           [in] Pointer to source surface
98     //! \param    dst
99     //!           [in] Pointer to destination surface
100     //! \return   MOS_STATUS
101     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
102     //!
103     virtual MOS_STATUS MediaRenderCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst);
104 
105     //!
106     //! \brief    use vebox engie to do surface copy.
107     //! \details  implementation media vebox copy.
108     //! \param    src
109     //!           [in] Pointer to source surface
110     //! \param    dst
111     //!           [in] Pointer to destination surface
112     //! \return   MOS_STATUS
113     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
114     //!    //!
115     //! \brief    use vebox engie to do surface copy.
116     //! \details  implementation media vebox copy.
117     //! \param    src
118     //!           [in] Pointer to source surface
119     //! \param    dst
120     //!           [in] Pointer to destination surface
121     //! \return   MOS_STATUS
122     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
123     //!
124     virtual MOS_STATUS MediaVeboxCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst);
125 
126     //!
127     //! \brief    vebox format support.
128     //! \details  surface format support.
129     //! \param    src
130     //!           [in] Pointer to source surface
131     //! \param    dst
132     //!           [in] Pointer to destination surface
133     //! \return   bool
134     //!           Return true if support, otherwise return false.
135     //!
136     virtual bool IsVeboxCopySupported(PMOS_RESOURCE src, PMOS_RESOURCE dst);
137     //!
138     //! \brief    select copy enigne
139     //! \details  media copy select copy enigne.
140     //! \param    preferMethod
141     //!           [in] copy method
142     //! \param    mcpyEngine
143     //!           [in] copy engine
144     //! \param    caps
145     //!           [in] reference of featue supported engine
146     //! \return   MOS_STATUS
147     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
148     //!
149     virtual MOS_STATUS CopyEnigneSelect(MCPY_METHOD &preferMethod, MCPY_ENGINE &mcpyEngine, MCPY_ENGINE_CAPS &caps);
150 
151     MhwInterfacesNext                  *m_mhwInterfaces  = nullptr;
152     RenderCopyXe_LPM_Plus_Base         *m_renderCopy     = nullptr;
153     BltStateXe_Lpm_Plus_Base           *m_bltState       = nullptr;
154     VeboxCopyStateXe_Lpm_Plus_Base     *m_veboxCopyState = nullptr;
155 
156 MEDIA_CLASS_DEFINE_END(MediaCopyStateXe_Lpm_Plus_Base)
157 };
158 
159 #endif // __MEDIA_COPY_XE_LPM_PLUS_BASE_H__
160