Debian Codegraph @

media_softlet/agnostic/common/shared/mediacopy/media_copy_common.h

raw
1 /*
2 * Copyright (c) 2022-2025, 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_common.h
24 //! \brief Common defination and structure used in media copy
25 //! \details Common defination and structure used in media copy, header file only.
26
27 #ifndef __MEDIA_COPY_COMMON_H__
28 #define __MEDIA_COPY_COMMON_H__
29
30 #define RENDERCOPY_SRC_INDEX 0
31 #define RENDERCOPY_DST_INDEX 3
32 #define RENDER_COPY_THREADS_MAX 0
33 #define RENDER_COPY_NUM 9
34
35 #define MCPY_CHK_STATUS(_stmt) MOS_CHK_STATUS(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _stmt)
36 #define MCPY_CHK_STATUS_RETURN(_stmt) MOS_CHK_STATUS_RETURN(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _stmt)
37 #define MCPY_CHK_NULL(_ptr) MOS_CHK_NULL(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _ptr)
38 #define MCPY_CHK_NULL_RETURN(_ptr) MOS_CHK_NULL_RETURN(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _ptr)
39 #define MCPY_ASSERTMESSAGE(_message, ...) MOS_ASSERTMESSAGE(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _message, ##__VA_ARGS__)
40 #define MCPY_WARNINGMESSAGE(_message, ...) MOS_WARNINGMESSAGE(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _message, ##__VA_ARGS__)
41 #define MCPY_NORMALMESSAGE(_message, ...) MOS_NORMALMESSAGE(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_SELF, _message, ##__VA_ARGS__)
42
43 #define BLT_CHK_STATUS(_stmt) MOS_CHK_STATUS(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_BLT, _stmt)
44 #define BLT_CHK_STATUS_RETURN(_stmt) MOS_CHK_STATUS_RETURN(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_BLT, _stmt)
45 #define BLT_CHK_NULL(_ptr) MOS_CHK_NULL(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_BLT, _ptr)
46 #define BLT_CHK_NULL_RETURN(_ptr) MOS_CHK_NULL_RETURN(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_BLT, _ptr)
47 #define BLT_ASSERTMESSAGE(_message, ...) MOS_ASSERTMESSAGE(MOS_COMPONENT_MCPY, MOS_MCPY_SUBCOMP_BLT, _message, ##__VA_ARGS__)
48 #define BLT_BITS_PER_BYTE 8
49
50 #define VEBOX_COPY ((uint32_t)(VPHAL_MCP_VEBOX_COPY))
51 #define RENDER_COPY ((uint32_t)(VPHAL_MCP_RENDER_COPY))
52 #define BLT_COPY ((uint32_t)(VPHAL_MCP_BLT_COPY))
53
54 #define SINGLE_PLANE 0x1
55 #define TWO_PLANES 0x2
56 #define THREE_PLANES 0x3
57
58 typedef enum YUVANDRGB_PLANE_INDEX_ENUM
59 {
60 MCPY_PLANE_Y = 0,
61 MCPY_PLANE_U = 1,
62 MCPY_PLANE_V = 2,
63 } YUVANDRGB_PLANE_INDEX;
64
65 //!
66 //! \brief Enum for CCS read/write flag
67 //!
68 enum CCS_FLAG
69 {
70 CCS_READ = 0,
71 CCS_WRITE,
72 };
73
74 //!
75 //! \brief Structure for BLT parameter
76 //!
77 typedef struct _BLT_STATE_PARAM
78 {
79 bool bCopyMainSurface;
80 PMOS_RESOURCE pSrcSurface;
81 PMOS_RESOURCE pDstSurface;
82 bool bCopyCCS;
83 CCS_FLAG ccsFlag;
84 PMOS_SURFACE pSrcCCS;
85 PMOS_SURFACE pDstCCS;
86 }BLT_STATE_PARAM, * PBLT_STATE_PARAM;
87
88 //!
89 //! \brief Kernel IDs
90 //!
91 typedef enum _RENDERCOPY_KERNELID
92 {
93 KERNEL_CopyKernel_1D_to_2D_NV12 = 0,
94 KERNEL_CopyKernel_2D_to_1D_NV12,
95 KERNEL_CopyKernel_2D_to_2D_NV12,
96 KERNEL_CopyKernel_1D_to_2D_Planar,
97 KERNEL_CopyKernel_2D_to_1D_Planar,
98 KERNEL_CopyKernel_2D_to_2D_Planar,
99 KERNEL_CopyKernel_1D_to_2D_Packed,
100 KERNEL_CopyKernel_2D_to_1D_Packed,
101 KERNEL_CopyKernel_2D_to_2D_Packed,
102 KERNEL_CopyKernel_MAX
103 } RENDERCOPY_KERNELID, * PRENDERCOPY_KERNELID;
104
105 typedef struct _DP_RENDERCOPY_NV12_STATIC_DATA
106 {
107 // DWORD 0 - GRF R1.0
108 union
109 {
110 uint32_t Inputsurfaceindex; // Input buffer surface index
111 } DW0;
112
113 // DWORD 1 - GRF R1.1
114 union
115 {
116 uint32_t Outputsurfaceindex; // Output buffer surface Index
117 } DW1;
118
119 // DWORD 2 - GRF R1.2
120 union
121 {
122 uint32_t Widthdword; // Image width in pxels divided by 4
123 } DW2;
124
125 // DWORD 3 - GRF R1.3
126 union
127 {
128 uint32_t Height; // Image height in pixels
129 } DW3;
130
131 // DWORD 4 - GRF R1.4
132 union
133 {
134 uint32_t ShiftLeftOffsetInBytes; // Byte offset of first pixel in input buffer
135 } DW4;
136
137 // DWORD 5 - GRF R1.5
138 union
139 {
140 uint32_t Widthstride; // Stride of 1 line of pixels in input buffer
141 } DW5;
142
143 // DWORD 6 - GRF R1.6
144 union
145 {
146 uint32_t Heightstride; // Stride of number of lines of Y pixels before start of UV pixels
147 } DW6;
148
149 }DP_RENDERCOPY_NV12_STATIC_DATA, *PDP_RENDERCOPY_NV12_STATIC_DATA;
150
151 typedef struct _DP_RENDERCOPY_RGBP_STATIC_DATA
152 {
153 // DWORD 0 - GRF R1.0
154 union
155 {
156 uint32_t InputsurfaceRindex; // Input buffer surface R plane index
157 } DW0;
158
159 // DWORD 1 - GRF R1.1
160 union
161 {
162 uint32_t InputsurfaceGindex; // Input buffer surface G plane index
163 } DW1;
164
165 // DWORD 2 - GRF R1.2
166 union
167 {
168 uint32_t InputsurfaceBindex; // Input buffer surface B plane index
169 } DW2;
170
171 // DWORD 3 - GRF R1.3
172 union
173 {
174 uint32_t OutputsurfaceRindex; // Output buffer surface R plane index
175 } DW3;
176
177 // DWORD 4 - GRF R1.4
178 union
179 {
180 uint32_t OutputsurfaceGindex; // Output buffer surface G plane index
181 } DW4;
182
183 // DWORD 5 - GRF R1.5
184 union
185 {
186 uint32_t OutputsurfaceBindex; // Output buffer surface B plane Index
187 } DW5;
188
189 // DWORD 6 - GRF R1.6
190 union
191 {
192 uint32_t Widthdword; // Image width in pxels divided by 4
193 } DW6;
194
195 // DWORD 7 - GRF R1.7
196 union
197 {
198 uint32_t Height; // Image height in pixels
199 } DW7;
200
201 // DWORD 8 - GRF R2.0
202 union
203 {
204 uint32_t ShiftLeftOffsetInBytes; // Byte offset of first pixel in input buffer
205 } DW8;
206
207 // DWORD 9 - GRF R2.1
208 union
209 {
210 uint32_t WidthdwordNoPadding; // excluding output padding
211 } DW9;
212
213 // DWORD 10 - GRF R2.2
214 union
215 {
216 uint32_t Dst2DStartX; // X-coordinate of top-left pixel in output 2D surface
217 } DW10;
218
219 // DWORD 12 - GRF R2.3
220 union
221 {
222 uint32_t Dst2DStartY; //Y-coordinate of top-left pixel in output 2D surface
223 } DW11;
224
225 }DP_RENDERCOPY_RGBP_STATIC_DATA, *PDP_RENDERCOPY_RGBP_STATIC_DATA;
226
227 typedef struct _DP_RENDERCOPY_PACKED_STATIC_DATA
228 {
229 // DWORD 0 - GRF R1.0
230 union
231 {
232 uint32_t InputSurfaceIndex; // Input buffer surface index
233 } DW0;
234
235 // DWORD 1 - GRF R1.1
236 union
237 {
238 uint32_t OutputSurfaceIndex; // Output buffer surface Index
239 } DW1;
240
241 // DWORD 2 - GRF R1.2
242 union
243 {
244 uint32_t WidthDWord; // Image width in pixels * bytes_per_pixel / 4
245 } DW2;
246
247 // DWORD 3 - GRF R1.3
248 union
249 {
250 uint32_t Height; // Image height in pixels
251 } DW3;
252
253 // DWORD 4 - GRF R1.4
254 union
255 {
256 uint32_t ShiftLeftOffsetInBytes; // Byte offset of first pixel in input buffer
257 } DW4;
258
259 // DWORD 5 - GRF R1.5
260 union
261 {
262 uint32_t ThreadHeight; // Height in pixels / 32
263 } DW5;
264
265 // DWORD 6 - GRF R1.6
266 union
267 {
268 uint32_t WidthdwordNoPadding; // Input image width in pixels divided by 4
269 } DW6;
270
271 // DWORD 6 - GRF R1.7
272 union
273 {
274 uint32_t Dst2DStartX; // X-coordinate of top-left pixel in output 2D surface
275 } DW7;
276
277 // DWORD 6 - GRF R2.0
278 union
279 {
280 uint32_t Dst2DStartY; // Y-coordinate of top-left pixel in output 2D surface
281 } DW8;
282
283 }DP_RENDERCOPY_PACKED_STATIC_DATA, *PDP_RENDERCOPY_PACKED_STATIC_DATA;
284
285 #endif