Debian Codegraph @

media_softlet/agnostic/common/shared/media_sfc_interface/media_sfc_render.h

raw
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 media_sfc_render.h
24 //! \brief Common interface and structure used in sfc interface
25 //! \details Common interface and structure used in sfc interface which are platform independent
26 //!
27 #ifndef __MEDIA_SFC_RENDER_H__
28 #define __MEDIA_SFC_RENDER_H__
29
30 #include "mos_os_specific.h"
31 #include "mhw_vebox_itf.h"
32 #include "mhw_sfc_itf.h"
33 #include "mhw_mi_itf.h"
34
35 namespace vp
36 {
37 class VpPlatformInterface;
38 class VpPipeline;
39 struct FeatureParamScaling;
40 };
41 struct _VP_MHWINTERFACE;
42 class MhwCpInterface;
43 class MhwMiInterface;
44 class MhwSfcInterface;
45 class MhwVeboxInterface;
46 struct _VPHAL_STATUS_TABLE;
47 class MediaVdboxSfcRender;
48 struct VEBOX_SFC_PARAMS;
49 struct VDBOX_SFC_PARAMS;
50 struct _RENDERHAL_INTERFACE;
51
52 class MediaSfcRender
53 {
54 public:
55 //!
56 //! \brief MediaSfcRender constructor
57 //! \details Initialize the MediaSfcRender members.
58 //! \param osInterface
59 //! [in] Pointer to MOS_INTERFACE.
60 //! \param mode
61 //! [in] 1: VEBOX-SFC only, 2: VDBOX-SFC only, 3: Both VEBOX-SFC and VDBOX-SFC.
62 //!
63 MediaSfcRender(PMOS_INTERFACE osInterface, MEDIA_SFC_INTERFACE_MODE mode, MediaMemComp *mmc);
64
65 virtual ~MediaSfcRender();
66
67 virtual void Destroy();
68
69 //!
70 //! \brief Check whether the Parameter for VDBOX-SFC supported
71 //! \details Only valid when MEDIA_SFC_INTERFACE_MODE::vdboxSfcEnabled being 1.
72 //! \param param
73 //! [in] Pointer to VDBOX_SFC_PARAMS.
74 //! \return MOS_STATUS
75 //! Return MOS_STATUS_SUCCESS if supported, otherwise failed
76 //!
77 virtual MOS_STATUS IsParameterSupported(VDBOX_SFC_PARAMS &param);
78
79 //!
80 //! \brief Check whether the Parameter for VEBOX-SFC supported
81 //! \details Only valid when MEDIA_SFC_INTERFACE_MODE::veboxSfcEnabled being 1.
82 //! \param param
83 //! [in] Pointer to VEBOX_SFC_PARAMS.
84 //! \return MOS_STATUS
85 //! Return MOS_STATUS_SUCCESS if supported, otherwise failed
86 //!
87 virtual MOS_STATUS IsParameterSupported(VEBOX_SFC_PARAMS &param);
88
89 //!
90 //! \brief Render Vdbox-SFC States
91 //! \details Only valid when MEDIA_SFC_INTERFACE_MODE::vdboxSfcEnabled being 1.
92 //! \param cmdBuffer
93 //! [in/out] Command Buffer to be Filled.
94 //! \param param
95 //! [in] Pointer to VDBOX_SFC_PARAMS.
96 //! \return MOS_STATUS
97 //! Return MOS_STATUS_SUCCESS if supported, otherwise failed
98 //!
99 MOS_STATUS Render(MOS_COMMAND_BUFFER *cmdBuffer, VDBOX_SFC_PARAMS &param);
100
101 //!
102 //! \brief Render Vebox-SFC States
103 //! \details Only valid when MEDIA_SFC_INTERFACE_MODE::veboxSfcEnabled being 1.
104 //! \param param
105 //! [in] Pointer to VEBOX_SFC_PARAMS.
106 //! \return MOS_STATUS
107 //! Return MOS_STATUS_SUCCESS if supported, otherwise failed
108 //!
109 MOS_STATUS Render(VEBOX_SFC_PARAMS &param);
110
111 //!
112 //! \brief Sfc Command Size
113 //! \details Calculate Command size of SFC commands.
114 //! \return uint32_t
115 //! Return calculated size
116 //!
117 uint32_t GetSfcCommandSize()
118 {
119 return m_sfcItf->MHW_GETSIZE_F(SFC_LOCK)() +
120 m_sfcItf->MHW_GETSIZE_F(SFC_STATE)() +
121 m_sfcItf->MHW_GETSIZE_F(SFC_AVS_STATE)() +
122 m_sfcItf->MHW_GETSIZE_F(SFC_AVS_LUMA_Coeff_Table)() +
123 m_sfcItf->MHW_GETSIZE_F(SFC_AVS_CHROMA_Coeff_Table)() +
124 m_sfcItf->MHW_GETSIZE_F(SFC_IEF_STATE)() +
125 m_sfcItf->MHW_GETSIZE_F(SFC_FRAME_START)();
126 }
127
128 //!
129 //! \brief MediaSfcInterface initialize
130 //! \details Initialize the MediaSfcInterface.
131 //! \return MOS_STATUS
132 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
133 //!
134 virtual MOS_STATUS Initialize();
135
136 bool IsInitialized() { return m_initialized; }
137
138 protected:
139 MOS_STATUS InitScalingParams(vp::FeatureParamScaling &scalingParams, VDBOX_SFC_PARAMS &sfcParam);
140 MOS_STATUS InitScalingParams(vp::FeatureParamScaling &scalingParams, VEBOX_SFC_PARAMS &sfcParam);
141
142 _VP_MHWINTERFACE *m_vpMhwinterface = nullptr;
143 vp::VpPlatformInterface *m_vpPlatformInterface = nullptr;
144 vp::VpPipeline *m_vpPipeline = nullptr;
145 _RENDERHAL_INTERFACE *m_renderHal = nullptr;
146 MhwCpInterface *m_cpInterface = nullptr;
147 _VPHAL_STATUS_TABLE *m_statusTable = nullptr;
148 PMOS_INTERFACE m_osInterface = nullptr;
149 MediaVdboxSfcRender *m_vdboxSfcRender = nullptr;
150 bool m_initialized = false;
151 MEDIA_SFC_INTERFACE_MODE m_mode = {};
152 MediaMemComp *m_mmc = nullptr;
153 std::shared_ptr<mhw::vebox::Itf> m_veboxItf = nullptr;
154 std::shared_ptr<mhw::sfc::Itf> m_sfcItf = nullptr;
155 std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr;
156 MEDIA_CLASS_DEFINE_END(MediaSfcRender)
157 };
158
159 #endif // __MEDIA_SFC_RENDER_H__