xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/cm/cm_vebox.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2017, 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      cm_vebox.h
24 //! \brief     Contains CmVebox declarations.
25 //!
26 
27 #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMVEBOX_H_
28 #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMVEBOX_H_
29 
30 #include "cm_def.h"
31 
32 #define VEBOX_MAX_SURFACE_COUNT  (16)
33 
34 namespace CMRT_UMD
35 {
36 class CmSurface2D;
37 class CmBufferUP;
38 
39 //! \brief      CmVebox is an abstraction of the vebox hardware,
40 //! \details    Details of vebox hardware be found at
41 //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
42 //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
43 
44 class CmVebox
45 {
46 public:
47     //! \brief      Set state for the vebox object
48     //! \param      [in] veboxState
49     //!             CM_VEBOX_STATE
50     //! \returns    CM_SUCCESS
51     CM_RT_API virtual int32_t SetState(CM_VEBOX_STATE &veboxState) = 0;
52 
53     //! \brief      Set the current frame input surface for the vebox object
54     //! \param      [in] surface
55     //!             CmSurface2D
56     //! \retval     CM_SUCCESS
57     CM_RT_API virtual int32_t SetCurFrameInputSurface(CmSurface2D *surface) = 0;
58 
59     //! \brief      Set the control bits for the current frame input surface
60     //! \details    Details of the control bits can be found at
61     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
62     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
63     //! \param      [in] ctrlBits
64     //!             control bit value
65     //! \retval     CM_SUCCESS
66     CM_RT_API virtual int32_t
67     SetCurFrameInputSurfaceControlBits(const uint16_t ctrlBits) = 0;
68 
69     //! \brief      Set the previous frame input surface for the vebox object
70     //! \param      [in] surface
71     //!             CmSurface2D
72     //! \retval     CM_SUCCESS
73     CM_RT_API virtual int32_t SetPrevFrameInputSurface(CmSurface2D *surface) = 0;
74 
75     //! \brief      Set the control bits for the previous frame input surface
76     //! \details    Details of the control bits can be found at
77     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
78     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
79     //! \param      [in] ctrlBits
80     //!             control bit value
81     //! \retval     CM_SUCCESS
82     CM_RT_API virtual int32_t
83     SetPrevFrameInputSurfaceControlBits(const uint16_t ctrlBits) = 0;
84 
85     //! \brief      Set the STMM input surface for the vebox object
86     //! \param      [in] surface
87     //!             CmSurface2D
88     //! \retval     CM_SUCCESS
89     CM_RT_API virtual int32_t SetSTMMInputSurface(CmSurface2D *surface) = 0;
90 
91     //! \brief      Set the control bits the for STMM input surface
92     //! \details    Details of the control bits can be found at
93     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
94     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
95     //! \param      [in] ctrlBits
96     //!             control bit value
97     //! \retval     CM_SUCCESS
98     CM_RT_API virtual int32_t
99     SetSTMMInputSurfaceControlBits(const uint16_t ctrlBits) = 0;
100 
101     //! \brief      Set the STMM output surface for the vebox object
102     //! \param      [in] surface
103     //!             CmSurface2D
104     //! \retval     CM_SUCCESS
105     CM_RT_API virtual int32_t SetSTMMOutputSurface(CmSurface2D *surface) = 0;
106 
107     //! \brief      Set the control bits the for STMM output surface
108     //! \details    Details of the control bits can be found at
109     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
110     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
111     //! \param      [in] ctrlBits
112     //!             control bit value
113     //! \retval     CM_SUCCESS
114     CM_RT_API virtual int32_t
115     SetSTMMOutputSurfaceControlBits(const uint16_t ctrlBits) = 0;
116 
117     //! \brief      Set the denoised current frame output surface for the vebox object
118     //! \param      [in] surface
119     //!             CmSurface2D
120     //! \retval     CM_SUCCESS
121     CM_RT_API virtual int32_t
122     SetDenoisedCurFrameOutputSurface(CmSurface2D *surface) = 0;
123 
124     //! \brief      Set the control bits for the denoised current frame output surface
125     //! \details    Details of the control bits can be found at
126     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
127     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
128     //! \param      [in] ctrlBits
129     //!             control bit value
130     //! \retval     CM_SUCCESS
131     CM_RT_API virtual int32_t
132     SetDenoisedCurOutputSurfaceControlBits(const uint16_t ctrlBits) = 0;
133 
134     //! \brief      Set the current frame output surface for the vebox object
135     //! \param      [in] surface
136     //!             CmSurface2D
137     //! \retval     CM_SUCCESS
138     CM_RT_API virtual int32_t SetCurFrameOutputSurface(CmSurface2D *surface) = 0;
139 
140     //! \brief      Set the control bits for the current frame output surface
141     //! \details    Details of the control bits can be found at
142     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
143     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
144     //! \param      [in] ctrlBits
145     //!             control bit value
146     //! \retval     CM_SUCCESS
147     CM_RT_API virtual int32_t
148     SetCurFrameOutputSurfaceControlBits(const uint16_t ctrlBits) = 0;
149 
150     //! \brief      Set the previous frame output surface for the vebox object
151     //! \param      [in] surface
152     //!             CmSurface2D
153     //! \retval     CM_SUCCESS
154     CM_RT_API virtual int32_t SetPrevFrameOutputSurface(CmSurface2D *surface) = 0;
155 
156     //! \brief      Set the control bits for the previous frame output surface
157     //! \details    Details of the control bits can be found at
158     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
159     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
160     //! \param      [in] ctrlBits
161     //!             control bit value
162     //! \retval     CM_SUCCESS
163     CM_RT_API virtual int32_t
164     SetPrevFrameOutputSurfaceControlBits(const uint16_t ctrlBits) = 0;
165 
166     //! \brief      Set the statistics output surface for the vebox object
167     //! \param      [in] surface
168     //!             CmSurface2D
169     //! \retval     CM_SUCCESS
170     CM_RT_API virtual int32_t
171     SetStatisticsOutputSurface(CmSurface2D *surface) = 0;
172 
173     //! \brief      Set the control bits for the statistics output surface
174     //! \details    Details of the control bits can be found at
175     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
176     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
177     //! \param      [in] ctrlBits
178     //!             control bit value
179     //! \retval     CM_SUCCESS
180     CM_RT_API virtual int32_t
181     SetStatisticsOutputSurfaceControlBits(const uint16_t ctrlBits) = 0;
182 
183     //! \brief      Set vebox parameters through a CmBufferUP.
184     //! \details    The size of this  CmBufferUp is 4K. It contains VEBOX_DNDI_STATE,
185     //!             VEBOX_IECP_STATE, VEBOX_GAMUT_STATE, VEBOX_VERTEX_TABLE, and
186     //!             VEBOX_CAPTURE_PIPE_STATE. Each state is 1K. The details of each state
187     //!             can be found at
188     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol09-media_vebox.pdf, or
189     //!             https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol09-media_vebox.pdf
190     //! \param      [in] paramBuffer
191     //!             CmBufferUP which contains all the vebox parameter.
192     //! \returns    CM_SUCCESS.
193     CM_RT_API virtual int32_t SetParam(CmBufferUP *paramBuffer) = 0;
194 };
195 };//namespace
196 
197 #endif  // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMVEBOX_H_
198