1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #if !defined(__SGX_BRIDGE_H__)
28 #define __SGX_BRIDGE_H__
30 #include "sgxapi_km.h"
32 #include "pvr_bridge.h"
34 #define PVRSRV_BRIDGE_SGX_CMD_BASE (PVRSRV_BRIDGE_LAST_NON_DEVICE_CMD+1)
35 #define PVRSRV_BRIDGE_SGX_GETCLIENTINFO \
36 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+0)
37 #define PVRSRV_BRIDGE_SGX_RELEASECLIENTINFO \
38 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+1)
39 #define PVRSRV_BRIDGE_SGX_GETINTERNALDEVINFO \
40 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+2)
41 #define PVRSRV_BRIDGE_SGX_DOKICK \
42 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+3)
43 #define PVRSRV_BRIDGE_SGX_GETPHYSPAGEADDR \
44 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+4)
45 #define PVRSRV_BRIDGE_SGX_READREGISTRYDWORD \
46 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+5)
47 #define PVRSRV_BRIDGE_SGX_SCHEDULECOMMAND \
48 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+6)
50 #define PVRSRV_BRIDGE_SGX_2DQUERYBLTSCOMPLETE \
51 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+9)
53 #define PVRSRV_BRIDGE_SGX_GETMMUPDADDR \
54 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+10)
56 #define PVRSRV_BRIDGE_SGX_SUBMITTRANSFER \
57 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+13)
58 #define PVRSRV_BRIDGE_SGX_GETMISCINFO \
59 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+14)
60 #define PVRSRV_BRIDGE_SGXINFO_FOR_SRVINIT \
61 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+15)
62 #define PVRSRV_BRIDGE_SGX_DEVINITPART2 \
63 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+16)
65 #define PVRSRV_BRIDGE_SGX_FINDSHAREDPBDESC \
66 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+17)
67 #define PVRSRV_BRIDGE_SGX_UNREFSHAREDPBDESC \
68 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+18)
69 #define PVRSRV_BRIDGE_SGX_ADDSHAREDPBDESC \
70 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+19)
71 #define PVRSRV_BRIDGE_SGX_REGISTER_HW_RENDER_CONTEXT \
72 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+20)
73 #define PVRSRV_BRIDGE_SGX_FLUSH_HW_RENDER_TARGET \
74 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+21)
75 #define PVRSRV_BRIDGE_SGX_UNREGISTER_HW_RENDER_CONTEXT \
76 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+22)
77 #define PVRSRV_BRIDGE_SGX_REGISTER_HW_TRANSFER_CONTEXT \
78 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+26)
79 #define PVRSRV_BRIDGE_SGX_UNREGISTER_HW_TRANSFER_CONTEXT \
80 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+27)
82 #define PVRSRV_BRIDGE_SGX_SCHEDULE_PROCESS_QUEUES \
83 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+28)
85 #define PVRSRV_BRIDGE_SGX_READ_DIFF_COUNTERS \
86 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+29)
87 #define PVRSRV_BRIDGE_SGX_READ_HWPERF_CB \
88 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+30)
90 #define PVRSRV_BRIDGE_LAST_SGX_CMD (PVRSRV_BRIDGE_SGX_CMD_BASE+30)
94 #define PVRSRV_BRIDGE_SGX_PDUMP_CMD_BASE \
95 (PVRSRV_BRIDGE_PDUMP_CMD_LAST+1)
97 #define PVRSRV_BRIDGE_SGX_PDUMP_BUFFER_ARRAY \
98 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_PDUMP_CMD_BASE+0)
99 #define PVRSRV_BRIDGE_SGX_PDUMP_3D_SIGNATURE_REGISTERS \
100 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_PDUMP_CMD_BASE+1)
101 #define PVRSRV_BRIDGE_SGX_PDUMP_COUNTER_REGISTERS \
102 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_PDUMP_CMD_BASE+2)
103 #define PVRSRV_BRIDGE_SGX_PDUMP_TA_SIGNATURE_REGISTERS \
104 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_PDUMP_CMD_BASE+3)
105 #define PVRSRV_BRIDGE_SGX_PDUMP_HWPERFCB \
106 PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_PDUMP_CMD_BASE+4)
111 #if PVRSRV_BRIDGE_PDUMP_CMD_FIRST <= PVRSRV_BRIDGE_LAST_SGX_CMD
112 # error Standard and PDUMP IOCTLs overlap!!!
116 struct PVRSRV_BRIDGE_IN_GETPHYSPAGEADDR {
119 struct IMG_DEV_VIRTADDR sDevVAddr;
122 struct PVRSRV_BRIDGE_OUT_GETPHYSPAGEADDR {
123 enum PVRSRV_ERROR eError;
124 struct IMG_DEV_PHYADDR DevPAddr;
125 struct IMG_CPU_PHYADDR CpuPAddr;
128 struct PVRSRV_BRIDGE_IN_SGX_GETMMU_PDADDR {
131 void *hDevMemContext;
134 struct PVRSRV_BRIDGE_OUT_SGX_GETMMU_PDADDR {
135 struct IMG_DEV_PHYADDR sPDDevPAddr;
136 enum PVRSRV_ERROR eError;
139 struct PVRSRV_BRIDGE_IN_GETCLIENTINFO {
144 struct PVRSRV_BRIDGE_OUT_GETINTERNALDEVINFO {
145 struct SGX_INTERNAL_DEVINFO sSGXInternalDevInfo;
146 enum PVRSRV_ERROR eError;
149 struct PVRSRV_BRIDGE_IN_GETINTERNALDEVINFO {
154 struct PVRSRV_BRIDGE_OUT_GETCLIENTINFO {
155 struct SGX_CLIENT_INFO sClientInfo;
156 enum PVRSRV_ERROR eError;
159 struct PVRSRV_BRIDGE_IN_RELEASECLIENTINFO {
162 struct SGX_CLIENT_INFO sClientInfo;
165 struct PVRSRV_BRIDGE_IN_ISPBREAKPOLL {
170 struct PVRSRV_BRIDGE_IN_DOKICK {
173 struct SGX_CCB_KICK sCCBKick;
176 struct PVRSRV_BRIDGE_IN_SGX_SCHEDULE_PROCESS_QUEUES {
181 struct PVRSRV_BRIDGE_IN_SUBMITTRANSFER {
184 struct PVRSRV_TRANSFER_SGX_KICK sKick;
188 struct PVRSRV_BRIDGE_IN_READREGDWORD {
195 struct PVRSRV_BRIDGE_OUT_READREGDWORD {
196 enum PVRSRV_ERROR eError;
200 struct PVRSRV_BRIDGE_IN_SCHEDULECOMMAND {
203 enum SGXMKIF_COMMAND_TYPE eCommandType;
204 struct SGXMKIF_COMMAND *psCommandData;
208 struct PVRSRV_BRIDGE_IN_SGXGETMISCINFO {
211 struct SGX_MISC_INFO __user *psMiscInfo;
214 struct PVRSRV_BRIDGE_IN_SGXINFO_FOR_SRVINIT {
219 struct PVRSRV_BRIDGE_OUT_SGXINFO_FOR_SRVINIT {
220 enum PVRSRV_ERROR eError;
221 struct SGX_BRIDGE_INFO_FOR_SRVINIT sInitInfo;
224 struct PVRSRV_BRIDGE_IN_SGXDEVINITPART2 {
227 struct SGX_BRIDGE_INIT_INFO sInitInfo;
230 enum pvr_sync_wait_seq_type {
231 _PVR_SYNC_WAIT_BLOCK,
232 _PVR_SYNC_WAIT_NONBLOCK,
233 _PVR_SYNC_WAIT_EVENT,
235 _PVR_SYNC_WAIT_UPDATE,
238 struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE {
243 enum pvr_sync_wait_seq_type type;
246 #define PVRSRV_BRIDGE_SGX_SHAREDPBDESC_MAX_SUBMEMINFOS 10
248 struct PVRSRV_BRIDGE_IN_SGXFINDSHAREDPBDESC {
251 IMG_BOOL bLockOnFailure;
255 struct PVRSRV_BRIDGE_OUT_SGXFINDSHAREDPBDESC {
256 void *hKernelMemInfo;
258 void *hSharedPBDescKernelMemInfoHandle;
259 void *hHWPBDescKernelMemInfoHandle;
260 void *hBlockKernelMemInfoHandle;
261 void *ahSharedPBDescSubKernelMemInfoHandles
262 [PVRSRV_BRIDGE_SGX_SHAREDPBDESC_MAX_SUBMEMINFOS];
263 u32 ui32SharedPBDescSubKernelMemInfoHandlesCount;
264 enum PVRSRV_ERROR eError;
267 struct PVRSRV_BRIDGE_IN_SGXUNREFSHAREDPBDESC {
272 struct PVRSRV_BRIDGE_OUT_SGXUNREFSHAREDPBDESC {
273 enum PVRSRV_ERROR eError;
276 struct PVRSRV_BRIDGE_IN_SGXADDSHAREDPBDESC {
279 void *hSharedPBDescKernelMemInfo;
280 void *hHWPBDescKernelMemInfo;
281 void *hBlockKernelMemInfo;
283 void * __user *phKernelMemInfoHandles;
284 u32 ui32KernelMemInfoHandlesCount;
287 struct PVRSRV_BRIDGE_OUT_SGXADDSHAREDPBDESC {
288 enum PVRSRV_ERROR eError;
293 struct PVRSRV_BRIDGE_IN_PDUMP_BUFFER_ARRAY {
295 struct SGX_KICKTA_DUMP_BUFFER __user *psBufferArray;
296 u32 ui32BufferArrayLength;
300 struct PVRSRV_BRIDGE_IN_PDUMP_3D_SIGNATURE_REGISTERS {
302 u32 ui32DumpFrameNum;
304 u32 __user *pui32Registers;
305 u32 ui32NumRegisters;
308 struct PVRSRV_BRIDGE_IN_PDUMP_COUNTER_REGISTERS {
310 u32 ui32DumpFrameNum;
312 u32 __user *pui32Registers;
313 u32 ui32NumRegisters;
316 struct PVRSRV_BRIDGE_IN_PDUMP_TA_SIGNATURE_REGISTERS {
318 u32 ui32DumpFrameNum;
321 u32 __user *pui32Registers;
322 u32 ui32NumRegisters;
325 struct PVRSRV_BRIDGE_IN_PDUMP_HWPERFCB {
328 char szFileName[PVRSRV_PDUMP_MAX_FILENAME_SIZE];
336 struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_RENDER_CONTEXT {
339 struct IMG_DEV_VIRTADDR sHWRenderContextDevVAddr;
342 struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_RENDER_CONTEXT {
343 enum PVRSRV_ERROR eError;
344 void *hHWRenderContext;
347 struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_RENDER_CONTEXT {
350 void *hHWRenderContext;
353 struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_TRANSFER_CONTEXT {
356 struct IMG_DEV_VIRTADDR sHWTransferContextDevVAddr;
359 struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_TRANSFER_CONTEXT {
360 enum PVRSRV_ERROR eError;
361 void *hHWTransferContext;
364 struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_TRANSFER_CONTEXT {
367 void *hHWTransferContext;
370 struct PVRSRV_BRIDGE_IN_SGX_FLUSH_HW_RENDER_TARGET {
373 struct IMG_DEV_VIRTADDR sHWRTDataSetDevVAddr;
376 struct PVRSRV_BRIDGE_IN_SGX_READ_DIFF_COUNTERS {
386 struct PVRSRV_BRIDGE_OUT_SGX_READ_DIFF_COUNTERS {
387 enum PVRSRV_ERROR eError;
391 struct PVRSRV_SGXDEV_DIFF_INFO sDiffs;
394 struct PVRSRV_BRIDGE_IN_SGX_READ_HWPERF_CB {
398 struct PVRSRV_SGX_HWPERF_CB_ENTRY __user *psHWPerfCBData;
401 struct PVRSRV_BRIDGE_OUT_SGX_READ_HWPERF_CB {
402 enum PVRSRV_ERROR eError;
405 u32 ui32HostTimeStamp;