1 /****************************************************************************
3 * Copyright (C) 2005 - 2011 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
24 #ifndef __gc_hal_user_cl_h_
25 #define __gc_hal_user_cl_h_
32 #define USE_NEW_MEMORY_ALLOCATION 0
34 /******************************************************************************\
35 ****************************** Object Declarations *****************************
36 \******************************************************************************/
38 /* gcoCL_DEVICE_INFO object. */
39 typedef struct _gcoCL_DEVICE_INFO
41 gctUINT maxComputeUnits
;
42 gctUINT maxWorkItemDimensions
;
43 gctUINT maxWorkItemSizes
[3];
44 gctUINT maxWorkGroupSize
;
45 gctUINT maxGlobalWorkSize
;
46 gctUINT clockFrequency
;
49 gctUINT64 maxMemAllocSize
;
50 gctUINT64 globalMemSize
;
51 gctUINT64 localMemSize
;
52 gctUINT localMemType
; /* cl_device_local_mem_type */
53 gctUINT globalMemCacheType
; /* cl_device_mem_cache_type */
54 gctUINT globalMemCachelineSize
;
55 gctUINT64 globalMemCacheSize
;
56 gctUINT maxConstantArgs
;
57 gctUINT64 maxConstantBufferSize
;
58 gctUINT maxParameterSize
;
59 gctUINT memBaseAddrAlign
;
60 gctUINT minDataTypeAlignSize
;
63 gctUINT maxReadImageArgs
;
64 gctUINT maxWriteImageArgs
;
65 gctUINT vectorWidthChar
;
66 gctUINT vectorWidthShort
;
67 gctUINT vectorWidthInt
;
68 gctUINT vectorWidthLong
;
69 gctUINT vectorWidthFloat
;
70 gctUINT vectorWidthDouble
;
71 gctUINT vectorWidthHalf
;
72 gctUINT image2DMaxWidth
;
73 gctUINT image2DMaxHeight
;
74 gctUINT image3DMaxWidth
;
75 gctUINT image3DMaxHeight
;
76 gctUINT image3DMaxDepth
;
79 gctUINT64 queueProperties
; /* cl_command_queue_properties */
80 gctBOOL hostUnifiedMemory
;
81 gctBOOL errorCorrectionSupport
;
82 gctUINT64 singleFpConfig
; /* cl_device_fp_config */
83 gctUINT64 doubleFpConfig
; /* cl_device_fp_config */
84 gctUINT profilingTimingRes
;
87 gctBOOL compilerAvail
;
88 gctUINT64 execCapability
; /* cl_device_exec_capabilities */
91 typedef gcoCL_DEVICE_INFO
* gcoCL_DEVICE_INFO_PTR
;
94 /*******************************************************************************
96 ** gcoCL_InitializeHardware
98 ** Initialize hardware. This is required for each thread.
109 gcoCL_InitializeHardware(
112 /*******************************************************************************
114 ** gcoCL_AllocateMemory
116 ** Allocate contiguous memory from the kernel.
121 ** Pointer to the number of bytes to allocate.
126 ** Pointer to a variable that will receive the aligned number of bytes
129 ** gctPHYS_ADDR * Physical
130 ** Pointer to a variable that will receive the physical addresses of
131 ** the allocated memory.
133 ** gctPOINTER * Logical
134 ** Pointer to a variable that will receive the logical address of the
137 ** gcsSURF_NODE_PTR * Node
138 ** Pointer to a variable that will receive the gcsSURF_NODE structure
139 ** pointer that describes the video memory to lock.
142 gcoCL_AllocateMemory(
143 IN OUT gctSIZE_T
* Bytes
,
144 OUT gctPHYS_ADDR
* Physical
,
145 OUT gctPOINTER
* Logical
,
146 OUT gcsSURF_NODE_PTR
* Node
149 /*******************************************************************************
153 ** Free contiguous memeory to the kernel.
157 ** gctPHYS_ADDR Physical
158 ** The physical addresses of the allocated pages.
160 ** gctPOINTER Logical
161 ** The logical address of the allocation.
164 ** Number of bytes allocated.
166 ** gcsSURF_NODE_PTR Node
167 ** Pointer to a gcsSURF_NODE structure
168 ** that describes the video memory to unlock.
176 IN gctPHYS_ADDR Physical
,
177 IN gctPOINTER Logical
,
179 IN gcsSURF_NODE_PTR Node
182 /*******************************************************************************
184 ** gcoCL_CreateTexture
186 ** Create texture for image.
191 ** Width of the image.
194 ** Heighth of the image.
197 ** Depth of the image.
199 ** gctCONST_POINTER Memory
200 ** Pointer to the data of the input image.
206 ** Size of one plane.
208 ** gceSURF_FORMAT FORMAT
209 ** Format of the image.
211 ** gceENDIAN_HINT EndianHint
212 ** Endian needed to handle the image data.
216 ** gcoTEXTURE * Texture
217 ** Pointer to a variable that will receive the gcoTEXTURE structure.
220 ** Pointer to a variable that will receive the gcoSURF structure.
222 ** gctPHYS_ADDR * Physical
223 ** Pointer to a variable that will receive the physical addresses of
224 ** the allocated memory.
226 ** gctPOINTER * Logical
227 ** Pointer to a variable that will receive the logical address of the
235 IN gctCONST_POINTER Memory
,
238 IN gceSURF_FORMAT Format
,
239 IN gceENDIAN_HINT EndianHint
,
240 OUT gcoTEXTURE
* Texture
,
241 OUT gcoSURF
* Surface
,
242 OUT gctPHYS_ADDR
* Physical
,
243 OUT gctPOINTER
* Logical
246 /*******************************************************************************
248 ** gcoCL_QueryDeviceInfo
250 ** Query the OpenCL capabilities of the device.
258 ** gcoCL_DEVICE_INFO_PTR DeviceInfo
259 ** Pointer to the device information
262 gcoCL_QueryDeviceInfo(
263 OUT gcoCL_DEVICE_INFO_PTR DeviceInfo
281 #endif /* __gc_hal_user_cl_h_ */