summaryrefslogtreecommitdiffstats
path: root/pvr-source/services4/include/sgx_bridge.h
blob: 33b27e3f250c54e1d03069cb70d493600302259d (plain)
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
/*************************************************************************/ /*!
@Title          SGX Bridge Functionality
@Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description    Header for the sgx Brdige code
@License        Dual MIT/GPLv2

The contents of this file are subject to the MIT license as set out below.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.

If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.

This License is also included in this distribution in the file called
"MIT-COPYING".

EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/

#if !defined(__SGX_BRIDGE_H__)
#define __SGX_BRIDGE_H__

#if defined (SUPPORT_SID_INTERFACE)
#include "sgxapi.h"
#else
#include "sgxapi_km.h"
#endif
#include "sgxinfo.h"
#include "pvr_bridge.h"

#if defined (__cplusplus)
extern "C" {
#endif


/* 
 * Bridge Cmd Ids
 */

/* *REMEMBER* to update PVRSRV_BRIDGE_LAST_SGX_CMD if you add/remove a command! 
 * Also you need to ensure all PVRSRV_BRIDGE_SGX_CMD_BASE+ offsets are sequential!
 */

#define PVRSRV_BRIDGE_SGX_CMD_BASE (PVRSRV_BRIDGE_LAST_NON_DEVICE_CMD+1)
#define PVRSRV_BRIDGE_SGX_GETCLIENTINFO			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+0)
#define PVRSRV_BRIDGE_SGX_RELEASECLIENTINFO		PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+1)
#define PVRSRV_BRIDGE_SGX_GETINTERNALDEVINFO	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+2)
#define PVRSRV_BRIDGE_SGX_DOKICK				PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+3)
#define PVRSRV_BRIDGE_SGX_GETPHYSPAGEADDR		PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+4)
#define PVRSRV_BRIDGE_SGX_READREGISTRYDWORD		PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+5)

#define PVRSRV_BRIDGE_SGX_2DQUERYBLTSCOMPLETE   PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+9)

#if defined(TRANSFER_QUEUE)
#define PVRSRV_BRIDGE_SGX_SUBMITTRANSFER			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+13)
#endif
#define PVRSRV_BRIDGE_SGX_GETMISCINFO				PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+14)
#define PVRSRV_BRIDGE_SGXINFO_FOR_SRVINIT			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+15)
#define PVRSRV_BRIDGE_SGX_DEVINITPART2				PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+16)

#define PVRSRV_BRIDGE_SGX_FINDSHAREDPBDESC			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+17)
#define PVRSRV_BRIDGE_SGX_UNREFSHAREDPBDESC			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+18)
#define PVRSRV_BRIDGE_SGX_ADDSHAREDPBDESC			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+19)
#define PVRSRV_BRIDGE_SGX_REGISTER_HW_RENDER_CONTEXT	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+20)
#define PVRSRV_BRIDGE_SGX_FLUSH_HW_RENDER_TARGET	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+21)
#define PVRSRV_BRIDGE_SGX_UNREGISTER_HW_RENDER_CONTEXT	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+22)
#if defined(SGX_FEATURE_2D_HARDWARE)
#define PVRSRV_BRIDGE_SGX_SUBMIT2D					PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+23)
#define PVRSRV_BRIDGE_SGX_REGISTER_HW_2D_CONTEXT	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+24)
#define PVRSRV_BRIDGE_SGX_UNREGISTER_HW_2D_CONTEXT	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+25)
#endif
#define PVRSRV_BRIDGE_SGX_REGISTER_HW_TRANSFER_CONTEXT	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+26)
#define PVRSRV_BRIDGE_SGX_UNREGISTER_HW_TRANSFER_CONTEXT	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+27)

#define PVRSRV_BRIDGE_SGX_SCHEDULE_PROCESS_QUEUES		PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+28)

#define PVRSRV_BRIDGE_SGX_READ_HWPERF_CB			PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+29)
#define PVRSRV_BRIDGE_SGX_SET_RENDER_CONTEXT_PRIORITY      PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+30)
#define PVRSRV_BRIDGE_SGX_SET_TRANSFER_CONTEXT_PRIORITY      PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+31)

#if defined(PDUMP)
#define PVRSRV_BRIDGE_SGX_PDUMP_BUFFER_ARRAY		PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+32)
#define PVRSRV_BRIDGE_SGX_PDUMP_3D_SIGNATURE_REGISTERS	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+33)
#define PVRSRV_BRIDGE_SGX_PDUMP_COUNTER_REGISTERS	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+34)
#define PVRSRV_BRIDGE_SGX_PDUMP_TA_SIGNATURE_REGISTERS	PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+35)
#define PVRSRV_BRIDGE_SGX_PDUMP_HWPERFCB				PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+36)
#define PVRSRV_BRIDGE_SGX_PDUMP_SAVEMEM					PVRSRV_IOWR(PVRSRV_BRIDGE_SGX_CMD_BASE+37)
#endif



/* *REMEMBER* to update PVRSRV_BRIDGE_LAST_SGX_CMD if you add/remove a command! 
 * You need to ensure all PVRSRV_BRIDGE_SGX_CMD_BASE+ offsets are sequential!
 */
#define PVRSRV_BRIDGE_LAST_SGX_CMD (PVRSRV_BRIDGE_SGX_CMD_BASE+37)

/*****************************************************************************
 * Input structures for IOCTL/DRVESC 
 *****************************************************************************/

/*!
 *****************************************************************************
 *	`bridge in' SGX Get Phys Page Addr
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_GETPHYSPAGEADDR
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
	IMG_HANDLE hDevMemHeap;
	IMG_DEV_VIRTADDR sDevVAddr;
}PVRSRV_BRIDGE_IN_GETPHYSPAGEADDR;

/*!
 *****************************************************************************
 *	`bridge out' SGX Get Phys Page Addr
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_OUT_GETPHYSPAGEADDR
{
	PVRSRV_ERROR		eError;
	IMG_DEV_PHYADDR		DevPAddr;
	IMG_CPU_PHYADDR		CpuPAddr;
}PVRSRV_BRIDGE_OUT_GETPHYSPAGEADDR;

/*!
 *****************************************************************************
 *	`bridge in' set transfer context priority
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_SGX_SET_TRANSFER_CONTEXT_PRIORITY_TAG
 {
 	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
 #if defined (SUPPORT_SID_INTERFACE)
 	IMG_SID					hDevCookie;
	IMG_SID					hHWTransferContext;
 #else
 	IMG_HANDLE				hDevCookie;
	IMG_HANDLE				hHWTransferContext;
 #endif
    IMG_UINT32              ui32Priority;
    IMG_UINT32              ui32OffsetOfPriorityField;
}PVRSRV_BRIDGE_IN_SGX_SET_TRANSFER_CONTEXT_PRIORITY;

/*!
 *****************************************************************************
 *	`bridge in' set render context priority
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_SGX_SET_RENDER_CONTEXT_PRIORITY_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
	IMG_SID					hHWRenderContext;
#else
	IMG_HANDLE				hDevCookie;
	IMG_HANDLE				hHWRenderContext;
#endif
    IMG_UINT32              ui32Priority;
    IMG_UINT32              ui32OffsetOfPriorityField;
}PVRSRV_BRIDGE_IN_SGX_SET_RENDER_CONTEXT_PRIORITY;

/*!
 *****************************************************************************
 *	`bridge in' Get Client Info
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_GETCLIENTINFO_TAG
{
	IMG_UINT32					ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID						hDevCookie;
#else
	IMG_HANDLE					hDevCookie;
#endif
}PVRSRV_BRIDGE_IN_GETCLIENTINFO;

/*!
 *****************************************************************************
 *	`bridge out' Get internal device info
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_OUT_GETINTERNALDEVINFO_TAG
{
	SGX_INTERNAL_DEVINFO	sSGXInternalDevInfo;
	PVRSRV_ERROR				eError;
}PVRSRV_BRIDGE_OUT_GETINTERNALDEVINFO;

/*!
 *****************************************************************************
 *	`bridge in' Get internal device info
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_GETINTERNALDEVINFO_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
}PVRSRV_BRIDGE_IN_GETINTERNALDEVINFO;

/*!
 *****************************************************************************
 *	`bridge out' Get Client Info
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_OUT_GETCLIENTINFO_TAG
{
	SGX_CLIENT_INFO  	sClientInfo;
	PVRSRV_ERROR			eError;
}PVRSRV_BRIDGE_OUT_GETCLIENTINFO;

/*!
 *****************************************************************************
 *	`bridge in' Release Client Info
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_RELEASECLIENTINFO_TAG
{
	IMG_UINT32			ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID				hDevCookie;
#else
	IMG_HANDLE			hDevCookie;
#endif
	SGX_CLIENT_INFO  	sClientInfo;
}PVRSRV_BRIDGE_IN_RELEASECLIENTINFO;

/*!
 *****************************************************************************
 *	`bridge in' Pdump ISP mem Pol
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_ISPBREAKPOLL_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
}PVRSRV_BRIDGE_IN_ISPBREAKPOLL;

/*!
 *****************************************************************************
 *	`bridge in' KickTA
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_DOKICK_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
	SGX_CCB_KICK			sCCBKick;
}PVRSRV_BRIDGE_IN_DOKICK;

/*!
 *****************************************************************************
 *	`bridge in' SGXScheduleProcessQueues
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_SGX_SCHEDULE_PROCESS_QUEUES_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
}PVRSRV_BRIDGE_IN_SGX_SCHEDULE_PROCESS_QUEUES;


#if defined(TRANSFER_QUEUE)
/*!
 *****************************************************************************
 *	`bridge in' SubmitTransfer
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_SUBMITTRANSFER_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
	PVRSRV_TRANSFER_SGX_KICK 			sKick;
}PVRSRV_BRIDGE_IN_SUBMITTRANSFER;

#if defined(SGX_FEATURE_2D_HARDWARE)
/*!
 *****************************************************************************
 *	`bridge in' Submit2D
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_SUBMIT2D_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
	PVRSRV_2D_SGX_KICK 		sKick;
} PVRSRV_BRIDGE_IN_SUBMIT2D;
#endif
#endif

/*!
 *****************************************************************************
 *	`bridge in' ReadRegistryString
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_READREGDWORD_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
#else
	IMG_HANDLE				hDevCookie;
#endif
    IMG_PCHAR				pszKey;
    IMG_PCHAR				pszValue;
}PVRSRV_BRIDGE_IN_READREGDWORD;

/*!
 *****************************************************************************
 *	`bridge out' ReadRegistryString
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_OUT_READREGDWORD_TAG
{
	PVRSRV_ERROR	eError;
	IMG_UINT32		ui32Data;
}PVRSRV_BRIDGE_OUT_READREGDWORD;


/*!
 *****************************************************************************
 *	`bridge in' SGXGetMiscInfo
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_IN_SGXGETMISCINFO_TAG
{
	IMG_UINT32		ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID			hDevCookie;
#else
	IMG_HANDLE		hDevCookie;
#endif
	SGX_MISC_INFO	*psMiscInfo;
}PVRSRV_BRIDGE_IN_SGXGETMISCINFO;

/*!
 *****************************************************************************
 *	`bridge in' SGXGetInfoForSrvInit
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_IN_SGXINFO_FOR_SRVINIT_TAG
{
	IMG_UINT32		ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID			hDevCookie;
#else
	IMG_HANDLE		hDevCookie;
#endif
}PVRSRV_BRIDGE_IN_SGXINFO_FOR_SRVINIT;

/*!
 *****************************************************************************
 *	`bridge out' SGXGetInfoForSrvInit
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_OUT_SGXINFO_FOR_SRVINIT_TAG
{
	PVRSRV_ERROR			eError;
	SGX_BRIDGE_INFO_FOR_SRVINIT	sInitInfo;
}PVRSRV_BRIDGE_OUT_SGXINFO_FOR_SRVINIT;

/*!
 *****************************************************************************
 *	`bridge in' SGXDevInitPart2
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_IN_SGXDEVINITPART2_TAG
{
	IMG_UINT32		ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID			hDevCookie;
#else
	IMG_HANDLE		hDevCookie;
#endif
	SGX_BRIDGE_INIT_INFO	sInitInfo;
}PVRSRV_BRIDGE_IN_SGXDEVINITPART2;

/*!
 *****************************************************************************
 *	`bridge out' SGXDevInitPart2
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_OUT_SGXDEVINITPART2_TAG
{
	PVRSRV_ERROR 	eError;
	IMG_UINT32 		ui32KMBuildOptions;

}PVRSRV_BRIDGE_OUT_SGXDEVINITPART2;

/*!
 *****************************************************************************
 *	`bridge in' 2D query blits complete
 *****************************************************************************/ 
typedef struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE_TAG
{
	IMG_UINT32				ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID					hDevCookie;
	IMG_SID					hKernSyncInfo;
#else
	IMG_HANDLE				hDevCookie;
	IMG_HANDLE				hKernSyncInfo;
#endif
	IMG_BOOL				bWaitForComplete;
}PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE;


#define PVRSRV_BRIDGE_SGX_SHAREDPBDESC_MAX_SUBMEMINFOS 10

typedef struct PVRSRV_BRIDGE_IN_SGXFINDSHAREDPBDESC_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
	IMG_BOOL   bLockOnFailure;
	IMG_UINT32 ui32TotalPBSize;
}PVRSRV_BRIDGE_IN_SGXFINDSHAREDPBDESC;

typedef struct PVRSRV_BRIDGE_OUT_SGXFINDSHAREDPBDESC_TAG
{
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID hKernelMemInfo;
	IMG_SID hSharedPBDesc;
	IMG_SID hSharedPBDescKernelMemInfoHandle;
	IMG_SID hHWPBDescKernelMemInfoHandle;
	IMG_SID hBlockKernelMemInfoHandle;
	IMG_SID hHWBlockKernelMemInfoHandle;
	IMG_SID ahSharedPBDescSubKernelMemInfoHandles[PVRSRV_BRIDGE_SGX_SHAREDPBDESC_MAX_SUBMEMINFOS];
#else
	IMG_HANDLE hKernelMemInfo;
	IMG_HANDLE hSharedPBDesc;
	IMG_HANDLE hSharedPBDescKernelMemInfoHandle;
	IMG_HANDLE hHWPBDescKernelMemInfoHandle;
	IMG_HANDLE hBlockKernelMemInfoHandle;
	IMG_HANDLE hHWBlockKernelMemInfoHandle;
	IMG_HANDLE ahSharedPBDescSubKernelMemInfoHandles[PVRSRV_BRIDGE_SGX_SHAREDPBDESC_MAX_SUBMEMINFOS];
#endif
	IMG_UINT32 ui32SharedPBDescSubKernelMemInfoHandlesCount;
	PVRSRV_ERROR eError;
}PVRSRV_BRIDGE_OUT_SGXFINDSHAREDPBDESC;

typedef struct PVRSRV_BRIDGE_IN_SGXUNREFSHAREDPBDESC_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hSharedPBDesc;
#else
	IMG_HANDLE hSharedPBDesc;
#endif
}PVRSRV_BRIDGE_IN_SGXUNREFSHAREDPBDESC;

typedef struct PVRSRV_BRIDGE_OUT_SGXUNREFSHAREDPBDESC_TAG
{
	PVRSRV_ERROR eError;
}PVRSRV_BRIDGE_OUT_SGXUNREFSHAREDPBDESC;


typedef struct PVRSRV_BRIDGE_IN_SGXADDSHAREDPBDESC_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
	IMG_UINT32 ui32TotalPBSize;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
	IMG_SID    hSharedPBDescKernelMemInfo;
	IMG_SID    hHWPBDescKernelMemInfo;
	IMG_SID    hBlockKernelMemInfo;
	IMG_SID    hHWBlockKernelMemInfo;
	IMG_SID    *phKernelMemInfoHandles;
#else
	IMG_HANDLE hDevCookie;
	IMG_HANDLE hSharedPBDescKernelMemInfo;
	IMG_HANDLE hHWPBDescKernelMemInfo;
	IMG_HANDLE hBlockKernelMemInfo;
	IMG_HANDLE hHWBlockKernelMemInfo;
	IMG_HANDLE *phKernelMemInfoHandles;
#endif
	IMG_UINT32 ui32KernelMemInfoHandlesCount;
	IMG_DEV_VIRTADDR sHWPBDescDevVAddr;
}PVRSRV_BRIDGE_IN_SGXADDSHAREDPBDESC;

typedef struct PVRSRV_BRIDGE_OUT_SGXADDSHAREDPBDESC_TAG
{
	PVRSRV_ERROR eError;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID      hSharedPBDesc;
#else
	IMG_HANDLE hSharedPBDesc;
#endif
}PVRSRV_BRIDGE_OUT_SGXADDSHAREDPBDESC;


#ifdef	PDUMP
typedef struct PVRSRV_BRIDGE_IN_PDUMP_BUFFER_ARRAY_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
	SGX_KICKTA_DUMP_BUFFER *psBufferArray;
	IMG_UINT32 ui32BufferArrayLength;
	IMG_BOOL bDumpPolls;
} PVRSRV_BRIDGE_IN_PDUMP_BUFFER_ARRAY;

typedef struct PVRSRV_BRIDGE_IN_PDUMP_3D_SIGNATURE_REGISTERS_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
	IMG_SID    hDevMemContext;
#else
	IMG_HANDLE hDevCookie;
	IMG_HANDLE hDevMemContext;
#endif
	IMG_UINT32 ui32DumpFrameNum;
	IMG_BOOL   bLastFrame;
	IMG_UINT32 *pui32Registers;
	IMG_UINT32 ui32NumRegisters;
}PVRSRV_BRIDGE_IN_PDUMP_3D_SIGNATURE_REGISTERS;

typedef struct PVRSRV_BRIDGE_IN_PDUMPCOUNTER_REGISTERS_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
	IMG_UINT32 ui32DumpFrameNum;
	IMG_BOOL bLastFrame;
	IMG_UINT32 *pui32Registers;
	IMG_UINT32 ui32NumRegisters;
}PVRSRV_BRIDGE_IN_PDUMP_COUNTER_REGISTERS;

typedef struct PVRSRV_BRIDGE_IN_PDUMP_TA_SIGNATURE_REGISTERS_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
	IMG_UINT32 ui32DumpFrameNum;
	IMG_UINT32 ui32TAKickCount;
	IMG_BOOL bLastFrame;
	IMG_UINT32 *pui32Registers;
	IMG_UINT32 ui32NumRegisters;
}PVRSRV_BRIDGE_IN_PDUMP_TA_SIGNATURE_REGISTERS;

typedef struct PVRSRV_BRIDGE_IN_PDUMP_HWPERFCB_TAG
{
	IMG_UINT32			ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID				hDevCookie;
	IMG_SID				hDevMemContext;
#else
	IMG_HANDLE			hDevCookie;
	IMG_HANDLE			hDevMemContext;
#endif
	IMG_CHAR			szFileName[PVRSRV_PDUMP_MAX_FILENAME_SIZE];
	IMG_UINT32			ui32FileOffset;
	IMG_UINT32			ui32PDumpFlags;

}PVRSRV_BRIDGE_IN_PDUMP_HWPERFCB;

typedef struct PVRSRV_BRIDGE_IN_PDUMP_SAVEMEM
{
	IMG_UINT32			ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID				hDevCookie;
	IMG_SID				hDevMemContext;
#else
	IMG_HANDLE			hDevCookie;
#endif
	IMG_CHAR			szFileName[PVRSRV_PDUMP_MAX_FILENAME_SIZE];
	IMG_UINT32			ui32FileOffset;
	IMG_DEV_VIRTADDR 	sDevVAddr;
	IMG_UINT32			ui32Size;
#if !defined (SUPPORT_SID_INTERFACE)
	IMG_HANDLE			hDevMemContext;
#endif
	IMG_UINT32			ui32PDumpFlags;

}PVRSRV_BRIDGE_IN_PDUMP_SAVEMEM;

#endif

typedef struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_RENDER_CONTEXT_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
    IMG_CPU_VIRTADDR pHWRenderContextCpuVAddr;
    IMG_UINT32       ui32HWRenderContextSize;
    IMG_UINT32       ui32OffsetToPDDevPAddr;
    IMG_HANDLE       hDevMemContext;
}PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_RENDER_CONTEXT;

typedef struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_RENDER_CONTEXT_TAG
{
	PVRSRV_ERROR eError;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hHWRenderContext;
#else
	IMG_HANDLE hHWRenderContext;
#endif
    IMG_DEV_VIRTADDR sHWRenderContextDevVAddr;
}PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_RENDER_CONTEXT;

typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_RENDER_CONTEXT_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
	IMG_BOOL   bForceCleanup;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
	IMG_SID    hHWRenderContext;
#else
	IMG_HANDLE hDevCookie;
	IMG_HANDLE hHWRenderContext;
#endif
}PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_RENDER_CONTEXT;

typedef struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_TRANSFER_CONTEXT_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
    IMG_CPU_VIRTADDR pHWTransferContextCpuVAddr;
    IMG_UINT32       ui32HWTransferContextSize;
    IMG_UINT32       ui32OffsetToPDDevPAddr;
    IMG_HANDLE       hDevMemContext;
}PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_TRANSFER_CONTEXT;

typedef struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_TRANSFER_CONTEXT_TAG
{
	PVRSRV_ERROR eError;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID      hHWTransferContext;
#else
	IMG_HANDLE hHWTransferContext;
#endif
    IMG_DEV_VIRTADDR sHWTransferContextDevVAddr;
}PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_TRANSFER_CONTEXT;

typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_TRANSFER_CONTEXT_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
	IMG_BOOL   bForceCleanup;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
	IMG_SID    hHWTransferContext;
#else
	IMG_HANDLE hDevCookie;
	IMG_HANDLE hHWTransferContext;
#endif
}PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_TRANSFER_CONTEXT;

typedef struct PVRSRV_BRIDGE_IN_SGX_FLUSH_HW_RENDER_TARGET_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
	IMG_DEV_VIRTADDR sHWRTDataSetDevVAddr;
}PVRSRV_BRIDGE_IN_SGX_FLUSH_HW_RENDER_TARGET;

/*!
 *****************************************************************************
 *	SGX 2D specific defines
 *****************************************************************************/ 
#if defined(SGX_FEATURE_2D_HARDWARE)
typedef struct PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_2D_CONTEXT_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
#else
	IMG_HANDLE hDevCookie;
#endif
    IMG_CPU_VIRTADDR pHW2DContextCpuVAddr;
    IMG_UINT32       ui32HW2DContextSize;
    IMG_UINT32       ui32OffsetToPDDevPAddr;
    IMG_HANDLE       hDevMemContext;
}PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_2D_CONTEXT;

typedef struct PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_2D_CONTEXT_TAG
{
	PVRSRV_ERROR eError;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hHW2DContext;
#else
	IMG_HANDLE hHW2DContext;
#endif
    IMG_DEV_VIRTADDR sHW2DContextDevVAddr;
}PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_2D_CONTEXT;

typedef struct PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_2D_CONTEXT_TAG
{
	IMG_UINT32 ui32BridgeFlags; /* Must be first member of structure */
	IMG_BOOL   bForceCleanup;
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID    hDevCookie;
	IMG_SID    hHW2DContext;
#else
	IMG_HANDLE hDevCookie;
	IMG_HANDLE hHW2DContext;
#endif
}PVRSRV_BRIDGE_IN_SGX_UNREGISTER_HW_2D_CONTEXT;

#define	SGX2D_MAX_BLT_CMD_SIZ		256	/* Maximum size of a blit command, in bytes */
#endif /* SGX_FEATURE_2D_HARDWARE */


/*!
 *****************************************************************************
 *	`bridge in' SGXReadHWPerfCB
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_IN_SGX_READ_HWPERF_CB_TAG
{
	IMG_UINT32					ui32BridgeFlags; /* Must be first member of structure */
#if defined (SUPPORT_SID_INTERFACE)
	IMG_SID						hDevCookie;
#else
	IMG_HANDLE					hDevCookie;
#endif
	IMG_UINT32					ui32ArraySize;
	PVRSRV_SGX_HWPERF_CB_ENTRY	*psHWPerfCBData;
} PVRSRV_BRIDGE_IN_SGX_READ_HWPERF_CB;

/*!
 *****************************************************************************
 *	`bridge out' SGXReadHWPerfCB
 *****************************************************************************/
typedef struct PVRSRV_BRIDGE_OUT_SGX_READ_HWPERF_CB_TAG
{
	PVRSRV_ERROR		eError;
	IMG_UINT32			ui32DataCount;
	IMG_UINT32			ui32ClockSpeed;
	IMG_UINT32			ui32HostTimeStamp;
} PVRSRV_BRIDGE_OUT_SGX_READ_HWPERF_CB;

#if defined (__cplusplus)
}
#endif

#endif /* __SGX_BRIDGE_H__ */