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 #ifndef CMRTLIB_AGNOSTIC_HARDWARE_CM_DEF_HW_H_
23 #define CMRTLIB_AGNOSTIC_HARDWARE_CM_DEF_HW_H_
24 
25 #include "cm_def.h"
26 #include "cm_device_base.h"
27 #include "cm_l3_cache_config.h"
28 
29 class SamplerIndex;
30 
31 struct CM_CONFIGVMESURFACEDIMENSION_PARAM
32 {
33     void *cmVmeSurfHandle;                    // [in]
34     CM_VME_SURFACE_STATE_PARAM *surfDimPara;  // [in]
35     int32_t returnValue;                      // [out]
36 };
37 
38 struct CM_CREATESAMPLER_PARAM
39 {
40     CM_SAMPLER_STATE samplerState;        // [in]
41     void *cmSamplerHandle;               // [out]
42     SamplerIndex *cmSamplerIndexHandle;  // [out]
43     int32_t returnValue;                 // [out]
44 };
45 
46 struct CM_CREATESAMPLER_PARAM_EX
47 {
48     CM_SAMPLER_STATE_EX samplerState;     // [in]
49     void *cmSamplerHandle;               // [out]
50     SamplerIndex *cmSamplerIndexHandle;  // [out]
51     int32_t returnValue;                 // [out]
52 };
53 
54 struct CM_GETCAPS_PARAM
55 {
56     CM_DEVICE_CAP_NAME capName;  //[in]
57     uint32_t capValueSize;       //[in]
58     void *capValue;              //[in/out]
59     uint32_t returnValue;        //[out] Return value
60 };
61 
62 struct CM_CREATESAMPLER8x8_PARAM
63 {
64     CM_SAMPLER_8X8_DESCR sampler8x8Desc;  // [in]
65     void *cmSampler8x8Handle;            // [out]
66     SamplerIndex *cmSamplerIndexHandle;  // [out]
67     int32_t returnValue;                 // [out]
68 };
69 
70 struct CM_DESTROYSAMPLER8x8_PARAM
71 {
72     void *cmSampler8x8Handle;  // [in]
73     int32_t returnValue;       // [out]
74 };
75 
76 struct CM_CREATESAMPLER8x8SURF_PARAM
77 {
78     void *cmSurf2DHandle;                           // [in]
79     CM_SAMPLER8x8_SURFACE cmSampler8x8Type;         // [in]
80     CM_SURFACE_ADDRESS_CONTROL_MODE sampler8x8Mode; // [in]
81     SurfaceIndex *cmSurfIndexHandle;                // [out]
82     int32_t returnValue;                            // [out]
83 };
84 
85 struct CM_CREATESAMPLER8x8SURFEX_PARAM
86 {
87     void *cmSurf2DHandle;                           // [in]
88     CM_SAMPLER8x8_SURFACE cmSampler8x8Type;         // [in]
89     CM_SURFACE_ADDRESS_CONTROL_MODE sampler8x8Mode; // [in]
90     CM_FLAG* flag;                                  // [in]
91     SurfaceIndex* cmSurfIndexHandle;                // [out]
92     int32_t returnValue;                            // [out]
93 };
94 
95 struct CM_CREATESAMPLER2DEX_PARAM
96 {
97     void *cmSurface2DHandle;       // [in]
98     CM_FLAG *flag;                 // [in]
99     void *samplerSurfIndexHandle;  // [out]
100     int32_t returnValue;           // [out]
101 };
102 
103 struct CM_DESTROYSAMPLER8x8SURF_PARAM
104 {
105     SurfaceIndex *cmSurfIndexHandle;  // [in]
106     int32_t returnValue;              // [out]
107 };
108 
109 struct CM_DEVICE_SETSUGGESTEDL3_PARAM
110 {
111     L3_SUGGEST_CONFIG l3SuggestConfig;  // [in] Cap Type
112     int32_t returnValue;      // [out] the return value from CMRT@UMD
113 };
114 
115 struct CM_DEVICE_SETCAP_PARAM
116 {
117     CM_DEVICE_CAP_NAME capName;  // [in] Cap Type
118     size_t  capValueSize;         // [in] Value Size
119     void    *capValue;            // [in] Pointer to value
120     int32_t returnValue;         // [out] the return value from CMRT@UMD
121 };
122 
123 struct CM_DEVICE_GET_VISA_VERSION_PARAM
124 {
125   uint32_t majorVersion;  // [OUT] the major version of jitter
126   uint32_t minorVersion;  // [OUT] the minor version of jitter
127   int32_t  returnValue;   // [OUT] return value
128 };
129 
130 enum CM_BUFFER_TYPE
131 {
132     CM_BUFFER_N   = 0,
133     CM_BUFFER_UP  = 1,
134     CM_BUFFER_SVM = 2,
135     CM_BUFFER_STATELESS = 5
136 };
137 
138 struct CM_CREATEBUFFER_PARAM
139 {
140     size_t size;              // [in]  buffer size in byte
141     CM_BUFFER_TYPE bufferType;  // [in]  Buffer type (Buffer, BufferUP, Buffer SVM, Buffer Stateless)
142     void *sysMem;               // [in]  Address of system memory
143     void *cmBufferHandle;       // [out] pointer to CmBuffer object in CMRT@UMD
144     int32_t returnValue;        // [out] the return value from CMRT@UMD
145     uint32_t option;
146 };
147 
148 struct CM_DESTROYCMDEVICE_PARAM
149 {
150     void *cmDeviceHandle;  // [in/out] pointer to CmDevice object
151     int32_t returnValue;   // [out] the return value from CMRT@UMD
152 };
153 
154 struct CM_LOADPROGRAM_PARAM
155 {
156     void *cisaCode;          // [in] pointer to the CISA code buffer
157     uint32_t cisaCodeSize;   // [in] size of CISA code
158     char *options;           // [in] additonal options for LoadProgram
159     void *cmProgramHandle;   // [out] pointer to CmProgram object used by CMRT@UMD
160     uint32_t indexInArray;   // [out] index in m_ProgramArray of CMRT@UMD
161     int32_t returnValue;     // [out] the return value from CMRT@UMD
162 };
163 
164 struct CM_DESTROYPROGRAM_PARAM
165 {
166     void *cmProgramHandle;  // [IN] pointer to CmProgram object used by CMRT@UMD
167     int32_t returnValue;    // [out] the return value from CMRT@UMD
168 };
169 
170 struct CM_CREATEKERNEL_PARAM
171 {
172     void *cmProgramHandle;     // [in] pointer to CmProgram used in driver
173     char *kernelName;          // [in] pointer to the kernel name string
174     char *options;             // [in] pointer to the kernel creation options
175     void *cmKernelHandle;      // [out] pointer to new created CmKernel used in driver
176     uint32_t indexKernelArray; // [out] index in m_KernelArray of CMRT@UMD
177     int32_t  returnValue;      // [out] the return value from driver
178 };
179 
180 struct CM_DESTROYKERNEL_PARAM
181 {
182     void *cmKernelHandle;  // [in/out] pointer to new created CmKernel used in driver
183     int32_t returnValue;   // [out] the return value from driver
184 };
185 
186 struct CM_CREATETASK_PARAM
187 {
188     void *cmTaskHandle;   // [out] pointer to new created CmTask used in driver
189     uint32_t taskIndex;   // [out] index of task in task array
190     int32_t returnValue;  // [out] the return value from driver
191 };
192 
193 struct CM_DESTROYTASK_PARAM
194 {
195     void *cmTaskHandle;   // [in/out] pointer to CmTask used in driver
196     int32_t returnValue;  // [out] the return value from driver
197 };
198 
199 struct CM_CREATETHREADSPACE_PARAM
200 {
201     uint32_t tsWidth;         // [in]
202     uint32_t tsHeight;        // [in]
203     void *cmTsHandle;         // [out]
204     uint32_t indexInTSArray;  // [out]
205     int32_t returnValue;      // [out]
206 };
207 
208 struct CM_DESTROYTHREADSPACE_PARAM
209 {
210     void *cmTsHandle;     // [in]
211     int32_t returnValue;  // [out]
212 };
213 
214 struct CM_DESTROYVMESURFACE_PARAM
215 {
216     void *cmVmeSurfIndexHandle;  // [in]
217     int32_t returnValue;         // [out]
218 };
219 
220 struct CM_CREATEVMESURFACE_PARAM
221 {
222     void *cmCurSurfHandle;       // [in]
223     void *cmForwardSurfArray;    // [in]
224     void *cmBackwardSurfArray;   // [in]
225     uint32_t forwardSurfCount;   // [in]
226     uint32_t backwardSurfCount;  // [in]
227     void *cmVmeSurfIndexHandle;  // [out]
228     int32_t returnValue;         // [out]
229 };
230 
231 struct CM_DESTROYSAMPLER_PARAM
232 {
233     void *cmSamplerHandle;  // [in]
234     int32_t returnValue;    // [out]
235 };
236 
237 struct CM_CREATETGROUPSPACE_PARAM
238 {
239     uint32_t thrdSpaceWidth;   // [in]
240     uint32_t thrdSpaceHeight;  // [in]
241     uint32_t thrdSpaceDepth;   // [in]
242     uint32_t grpSpaceWidth;    // [in]
243     uint32_t grpSpaceHeight;   // [in]
244     uint32_t grpSpaceDepth;    // [in]
245     void     *cmGrpSpaceHandle;    // [out]
246     uint32_t tgsIndex;         // [out]
247     int32_t  returnValue;       // [out]
248 };
249 
250 struct CM_DESTROYTGROPUSPACE_PARAM
251 {
252     void *cmGrpSpaceHandle;  // [in]
253     int32_t returnValue;     // [out]
254 };
255 
256 struct CM_GETSURFACE2DINFO_PARAM
257 {
258     uint32_t width;           // [in] Surface Width
259     uint32_t height;          // [in] Surface Height
260     CM_SURFACE_FORMAT format; // [in] Surface Format
261     uint32_t pitch;           // [out] Pitch
262     uint32_t physicalSize;    // [out] Physical size
263     uint32_t returnValue;     // [out] Return value
264 };
265 
266 struct CM_CREATESAMPLER2D_PARAM
267 {
268     void *cmSurface2DHandle;       // [in] pointer to CmSurface2D object used by CMRT@UMD
269     void *samplerSurfIndexHandle;  // [out] pointer of SurfaceIndex used in driver
270     int32_t returnValue;           // [out] the return value from CMRT@UMD
271 };
272 
273 struct CM_CREATESAMPLER2DUP_PARAM
274 {
275     void *cmSurface2DHandle;       // [in] pointer to CmSurface2DUP object used by CMRT@UMD
276     void *samplerSurfIndexHandle;  // [out] pointer of SurfaceIndex used in driver
277     int32_t returnValue;           // [out] the return value from CMRT@UMD
278 };
279 
280 struct CM_CREATESAMPLER3D_PARAM
281 {
282     void *cmSurface3DHandle;       // [in] pointer to CmSurface3D object used by CMRT@UMD
283     void *samplerSurfIndexHandle;  // [out] pointer of SurfaceIndex used in driver
284     int32_t returnValue;           // [out] the return value from CMRT@UMD
285 };
286 
287 struct CM_DESTROYSAMPLERSURF_PARAM
288 {
289     void *samplerSurfIndexHandle;  // [in] pointer of SamplerSurfaceIndex used in driver
290     int32_t returnValue;           // [out] the return value from CMRT@UMD
291 };
292 
293 struct CM_DEVICE_INIT_PRINT_BUFFER_PARAM
294 {
295     uint32_t printBufferSize;   // [in] print buffer's size
296     void *printBufferMem;       // [out] print buffer's memory
297     int32_t returnValue;        //[out] return value
298 };
299 
300 struct CM_DEVICE_FLUSH_PRINT_BUFFER_PARAM
301 {
302     const char          *fileName;                //[in] target file name
303     int32_t             returnValue;              //[out] return value
304 };
305 
306 struct CM_CREATEVEBOX_PARAM
307 {
308     void *cmVeboxHandle;         // [out] CmVeboxG75's handle
309     uint32_t indexInVeboxArray;  // [out] index in m_VeboxArray
310     int32_t returnValue;         // [out] return value
311 };
312 
313 struct CM_DESTROYVEBOX_PARAM
314 {
315     void *cmVeboxHandle;  // [IN] CmVeboxG75's handle
316     int32_t returnValue;  // [out] return value
317 };
318 
319 struct CM_CLONE_KERNEL_PARAM
320 {
321     void *cmKernelHandleSrc;   // [IN] source kernel
322     void *cmKernelHandleDest;  // [IN] dest kernel
323     int32_t returnValue;       // [out] return value
324 };
325 
326 struct CM_DEVICE_CREATE_SURF2D_ALIAS_PARAM
327 {
328     void *cmSurface2DHandle;   // [IN] pointer to CmSurface2D object used by CMRT@UMD
329     void *surfaceIndexHandle;  // [OUT] ponter of SurfaceIndex
330     int32_t returnValue;       // [OUT] return value
331 };
332 
333 struct CM_DEVICE_CREATE_BUFFER_ALIAS_PARAM
334 {
335     void *cmBufferHandle;      // [IN] pointer to CmBuffer object used by CMRT@UMD
336     void *surfaceIndexHandle;  // [OUT] ponter of SurfaceIndex
337     int32_t returnValue;       // [OUT] return value
338 };
339 
340 #ifdef _DEBUG
341 #define MDF_PROFILER_ENABLED 1
342 #endif
343 
344 #if MDF_PROFILER_ENABLED
345 #define INSERT_PROFILER_RECORD()     CmTimer Time(__FUNCTION__ )
346 #else
347 #define INSERT_PROFILER_RECORD()
348 #endif
349 
350 #endif  // #ifndef CMRTLIB_AGNOSTIC_HARDWARE_CM_DEF_HW_H_
351