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_hpm.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_HPM_H__
29 #define __MEDIA_COPY_XE_HPM_H__
30 
31 #include "media_copy.h"
32 #include "mos_defs.h"
33 #include "mos_os_specific.h"
34 class BltState_Xe_Hpm;
35 class MhwInterfaces;
36 class RenderCopy_Xe_Hpm;
37 class VeboxCopyState;
38 class MediaCopyState_Xe_Hpm: public MediaCopyBaseState
39 {
40 public:
41     //!
42     //! \brief    MediaCopyState_Xe_Hpm constructor
43     //! \details  Initialize the MediaCopy members.
44     //! \param    osInterface
45     //!           [in] Pointer to MOS_INTERFACE.
46     //!
47     MediaCopyState_Xe_Hpm();
48     virtual ~MediaCopyState_Xe_Hpm();
49 
50     //!
51     //! \brief    init function.
52     virtual MOS_STATUS Initialize(  PMOS_INTERFACE  osInterface, MhwInterfaces *mhwInterfaces);
53     using MediaCopyBaseState::Initialize;
54 
55     //!
56     //! \brief    render format support.
57     //! \details  surface format support.
58     //! \param    src
59     //!           [in] Pointer to source surface
60     //! \param    dst
61     //!           [in] Pointer to destination surface
62     //! \return   bool
63     //!           Return true if support, otherwise return false.
64     //!
65     virtual bool RenderFormatSupportCheck(PMOS_RESOURCE src, PMOS_RESOURCE dst);
66 
67     //!
68     //! \brief    feature support check on specific check.
69     //! \details  media copy feature support.
70     //! \param    src
71     //!           [in] Pointer to source surface
72     //! \param    dst
73     //!           [in] Pointer to destination surface
74     //! \param    caps
75     //!           [in] reference of featue supported engine
76     //! \return   MOS_STATUS
77     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
78     //!
79     virtual MOS_STATUS FeatureSupport(PMOS_RESOURCE src, PMOS_RESOURCE dst, MCPY_ENGINE_CAPS& caps);
80 
81     //!
82     //! \brief    surface copy pre process.
83     //! \details  pre process before doing surface copy.
84     //! \param    src
85     //!          [in]Media copy state's input parmaters
86     //! \param    dest
87     //!          [in]Media copy state's output parmaters
88     //! \param    preferMethod
89     //!          [in]Media copy Method
90     //! \return   MOS_STATUS
91     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
92     //!
93     virtual MOS_STATUS PreCheckCpCopy(
94         MCPY_STATE_PARAMS src, MCPY_STATE_PARAMS dest, MCPY_METHOD preferMethod);
95 
96     //!
97     //! \brief    Is AIL force opition.
98     //! \details  Is AIL force opition.
99     //! \return   bool
100     //!           Return true if support, otherwise return false.
IsAILForceOption()101     bool IsAILForceOption()
102     {
103         return true;
104     }
105 
106 protected:
107     //!
108     //! \brief    use blt engie to do surface copy.
109     //! \details  implementation media blt copy.
110     //! \param    src
111     //!           [in] Pointer to source surface
112     //! \param    dst
113     //!           [in] Pointer to destination surface
114     //! \return   MOS_STATUS
115     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
116     //!
117     virtual MOS_STATUS MediaBltCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst);
118 
119     //!
120     //! \brief    use Render engie to do surface copy.
121     //! \details  implementation media Render copy.
122     //! \param    src
123     //!           [in] Pointer to source surface
124     //! \param    dst
125     //!           [in] Pointer to destination surface
126     //! \return   MOS_STATUS
127     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
128     //!
129     virtual MOS_STATUS MediaRenderCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst);
130 
131     //!
132     //! \brief    use vebox engie to do surface copy.
133     //! \details  implementation media vebox copy.
134     //! \param    src
135     //!           [in] Pointer to source surface
136     //! \param    dst
137     //!           [in] Pointer to destination surface
138     //! \return   MOS_STATUS
139     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
140     //!
141     virtual MOS_STATUS MediaVeboxCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst);
142 
143     //!
144     //! \brief    vebox format support.
145     //! \details  surface format support.
146     //! \param    src
147     //!           [in] Pointer to source surface
148     //! \param    dst
149     //!           [in] Pointer to destination surface
150     //! \return   bool
151     //!           Return true if support, otherwise return false.
152     //!
153     virtual bool IsVeboxCopySupported(PMOS_RESOURCE src, PMOS_RESOURCE dst);
154     //!
155     //! \brief    select copy enigne
156     //! \details  media copy select copy enigne.
157     //! \param    preferMethod
158     //!           [in] copy method
159     //! \param    mcpyEngine
160     //!           [in] copy engine
161     //! \param    caps
162     //!           [in] reference of featue supported engine
163     //! \return   MOS_STATUS
164     //!           Return MOS_STATUS_SUCCESS if support, otherwise return unspoort.
165     //!
166     virtual MOS_STATUS CopyEnigneSelect(MCPY_METHOD &preferMethod, MCPY_ENGINE &mcpyEngine, MCPY_ENGINE_CAPS &caps);
167 
168 protected:
169     MhwInterfaces      *m_mhwInterfacesXeHpm  = nullptr;
170     BltState_Xe_Hpm    *m_bltState       = nullptr;
171     VeboxCopyState     *m_veboxCopyState = nullptr;
172     RenderCopy_Xe_Hpm  *m_renderCopy     = nullptr;
173 
174 MEDIA_CLASS_DEFINE_END(MediaCopyState_Xe_Hpm)
175 };
176 #endif // __MEDIA_COPY_XE_HPM_H__
177 
178