1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
/****************************************************************************
*
* Copyright (C) 2005 - 2011 by Vivante Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the license, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_user_cl_h_
#define __gc_hal_user_cl_h_
#ifdef __cplusplus
extern "C" {
#endif
#define USE_NEW_MEMORY_ALLOCATION 0
/******************************************************************************\
****************************** Object Declarations *****************************
\******************************************************************************/
/* gcoCL_DEVICE_INFO object. */
typedef struct _gcoCL_DEVICE_INFO
{
gctUINT maxComputeUnits;
gctUINT maxWorkItemDimensions;
gctUINT maxWorkItemSizes[3];
gctUINT maxWorkGroupSize;
gctUINT maxGlobalWorkSize ;
gctUINT clockFrequency;
gctUINT addrBits;
gctUINT64 maxMemAllocSize;
gctUINT64 globalMemSize;
gctUINT64 localMemSize;
gctUINT localMemType; /* cl_device_local_mem_type */
gctUINT globalMemCacheType; /* cl_device_mem_cache_type */
gctUINT globalMemCachelineSize;
gctUINT64 globalMemCacheSize;
gctUINT maxConstantArgs;
gctUINT64 maxConstantBufferSize;
gctUINT maxParameterSize;
gctUINT memBaseAddrAlign;
gctUINT minDataTypeAlignSize;
gctBOOL imageSupport;
gctUINT maxReadImageArgs;
gctUINT maxWriteImageArgs;
gctUINT vectorWidthChar;
gctUINT vectorWidthShort;
gctUINT vectorWidthInt;
gctUINT vectorWidthLong;
gctUINT vectorWidthFloat;
gctUINT vectorWidthDouble;
gctUINT vectorWidthHalf;
gctUINT image2DMaxWidth;
gctUINT image2DMaxHeight;
gctUINT image3DMaxWidth;
gctUINT image3DMaxHeight;
gctUINT image3DMaxDepth;
gctUINT maxSamplers;
gctUINT64 queueProperties; /* cl_command_queue_properties */
gctBOOL hostUnifiedMemory;
gctBOOL errorCorrectionSupport;
gctUINT64 singleFpConfig; /* cl_device_fp_config */
gctUINT64 doubleFpConfig; /* cl_device_fp_config */
gctUINT profilingTimingRes;
gctBOOL endianLittle;
gctBOOL deviceAvail;
gctBOOL compilerAvail;
gctUINT64 execCapability; /* cl_device_exec_capabilities */
} gcoCL_DEVICE_INFO;
typedef gcoCL_DEVICE_INFO * gcoCL_DEVICE_INFO_PTR;
/*******************************************************************************
**
** gcoCL_InitializeHardware
**
** Initialize hardware. This is required for each thread.
**
** INPUT:
**
** Nothing
**
** OUTPUT:
**
** Nothing
*/
gceSTATUS
gcoCL_InitializeHardware(
);
/*******************************************************************************
**
** gcoCL_AllocateMemory
**
** Allocate contiguous memory from the kernel.
**
** INPUT:
**
** gctSIZE_T * Bytes
** Pointer to the number of bytes to allocate.
**
** OUTPUT:
**
** gctSIZE_T * Bytes
** Pointer to a variable that will receive the aligned number of bytes
** allocated.
**
** gctPHYS_ADDR * Physical
** Pointer to a variable that will receive the physical addresses of
** the allocated memory.
**
** gctPOINTER * Logical
** Pointer to a variable that will receive the logical address of the
** allocation.
**
** gcsSURF_NODE_PTR * Node
** Pointer to a variable that will receive the gcsSURF_NODE structure
** pointer that describes the video memory to lock.
*/
gceSTATUS
gcoCL_AllocateMemory(
IN OUT gctSIZE_T * Bytes,
OUT gctPHYS_ADDR * Physical,
OUT gctPOINTER * Logical,
OUT gcsSURF_NODE_PTR * Node
);
/*******************************************************************************
**
** gcoCL_FreeMemory
**
** Free contiguous memeory to the kernel.
**
** INPUT:
**
** gctPHYS_ADDR Physical
** The physical addresses of the allocated pages.
**
** gctPOINTER Logical
** The logical address of the allocation.
**
** gctSIZE_T Bytes
** Number of bytes allocated.
**
** gcsSURF_NODE_PTR Node
** Pointer to a gcsSURF_NODE structure
** that describes the video memory to unlock.
**
** OUTPUT:
**
** Nothing
*/
gceSTATUS
gcoCL_FreeMemory(
IN gctPHYS_ADDR Physical,
IN gctPOINTER Logical,
IN gctSIZE_T Bytes,
IN gcsSURF_NODE_PTR Node
);
/*******************************************************************************
**
** gcoCL_CreateTexture
**
** Create texture for image.
**
** INPUT:
**
** gctUINT Width
** Width of the image.
**
** gctUINT Heighth
** Heighth of the image.
**
** gctUINT Depth
** Depth of the image.
**
** gctCONST_POINTER Memory
** Pointer to the data of the input image.
**
** gctUINT Stride
** Size of one row.
**
** gctUINT Slice
** Size of one plane.
**
** gceSURF_FORMAT FORMAT
** Format of the image.
**
** gceENDIAN_HINT EndianHint
** Endian needed to handle the image data.
**
** OUTPUT:
**
** gcoTEXTURE * Texture
** Pointer to a variable that will receive the gcoTEXTURE structure.
**
** gcoSURF * Surface
** Pointer to a variable that will receive the gcoSURF structure.
**
** gctPHYS_ADDR * Physical
** Pointer to a variable that will receive the physical addresses of
** the allocated memory.
**
** gctPOINTER * Logical
** Pointer to a variable that will receive the logical address of the
** allocation.
*/
gceSTATUS
gcoCL_CreateTexture(
IN gctUINT Width,
IN gctUINT Height,
IN gctUINT Depth,
IN gctCONST_POINTER Memory,
IN gctUINT Stride,
IN gctUINT Slice,
IN gceSURF_FORMAT Format,
IN gceENDIAN_HINT EndianHint,
OUT gcoTEXTURE * Texture,
OUT gcoSURF * Surface,
OUT gctPHYS_ADDR * Physical,
OUT gctPOINTER * Logical
);
/*******************************************************************************
**
** gcoCL_QueryDeviceInfo
**
** Query the OpenCL capabilities of the device.
**
** INPUT:
**
** Nothing
**
** OUTPUT:
**
** gcoCL_DEVICE_INFO_PTR DeviceInfo
** Pointer to the device information
*/
gceSTATUS
gcoCL_QueryDeviceInfo(
OUT gcoCL_DEVICE_INFO_PTR DeviceInfo
);
gceSTATUS
gcoCL_SubmitSignal(
IN gctSIGNAL Signal,
IN gctHANDLE Process
);
gceSTATUS
gcoCL_Flush(
IN gctBOOL Stall
);
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_user_cl_h_ */
|