]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
ENGR00303820 [#887] refine physical address check for external memory
[karo-tx-linux.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_driver.h
1 /****************************************************************************
2 *
3 *    Copyright (C) 2005 - 2013 by Vivante Corp.
4 *
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.
9 *
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.
14 *
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.
18 *
19 *****************************************************************************/
20
21
22 #ifndef __gc_hal_driver_h_
23 #define __gc_hal_driver_h_
24
25 #include "gc_hal_enum.h"
26 #include "gc_hal_types.h"
27
28 #if gcdENABLE_VG
29 #include "gc_hal_driver_vg.h"
30 #endif
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /******************************************************************************\
37 ******************************* I/O Control Codes ******************************
38 \******************************************************************************/
39
40 #define gcvHAL_CLASS                    "galcore"
41 #define IOCTL_GCHAL_INTERFACE           30000
42 #define IOCTL_GCHAL_KERNEL_INTERFACE    30001
43 #define IOCTL_GCHAL_TERMINATE           30002
44
45 /******************************************************************************\
46 ********************************* Command Codes ********************************
47 \******************************************************************************/
48
49 typedef enum _gceHAL_COMMAND_CODES
50 {
51     /* Generic query. */
52     gcvHAL_QUERY_VIDEO_MEMORY,
53     gcvHAL_QUERY_CHIP_IDENTITY,
54
55     /* Contiguous memory. */
56     gcvHAL_ALLOCATE_NON_PAGED_MEMORY,
57     gcvHAL_FREE_NON_PAGED_MEMORY,
58     gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY,
59     gcvHAL_FREE_CONTIGUOUS_MEMORY,
60
61     /* Video memory allocation. */
62     gcvHAL_ALLOCATE_VIDEO_MEMORY,           /* Enforced alignment. */
63     gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY,    /* No alignment. */
64     gcvHAL_FREE_VIDEO_MEMORY,
65
66     /* Physical-to-logical mapping. */
67     gcvHAL_MAP_MEMORY,
68     gcvHAL_UNMAP_MEMORY,
69
70     /* Logical-to-physical mapping. */
71     gcvHAL_MAP_USER_MEMORY,
72     gcvHAL_UNMAP_USER_MEMORY,
73
74     /* Surface lock/unlock. */
75     gcvHAL_LOCK_VIDEO_MEMORY,
76     gcvHAL_UNLOCK_VIDEO_MEMORY,
77
78     /* Event queue. */
79     gcvHAL_EVENT_COMMIT,
80
81     gcvHAL_USER_SIGNAL,
82     gcvHAL_SIGNAL,
83     gcvHAL_WRITE_DATA,
84
85     gcvHAL_COMMIT,
86     gcvHAL_STALL,
87
88     gcvHAL_READ_REGISTER,
89     gcvHAL_WRITE_REGISTER,
90
91     gcvHAL_GET_PROFILE_SETTING,
92     gcvHAL_SET_PROFILE_SETTING,
93
94     gcvHAL_READ_ALL_PROFILE_REGISTERS,
95     gcvHAL_PROFILE_REGISTERS_2D,
96 #if VIVANTE_PROFILER_PERDRAW
97     gcvHAL_READ_PROFILER_REGISTER_SETTING,
98 #endif
99
100     /* Power management. */
101     gcvHAL_SET_POWER_MANAGEMENT_STATE,
102     gcvHAL_QUERY_POWER_MANAGEMENT_STATE,
103
104     gcvHAL_GET_BASE_ADDRESS,
105
106     gcvHAL_SET_IDLE, /* reserved */
107
108     /* Queries. */
109     gcvHAL_QUERY_KERNEL_SETTINGS,
110
111     /* Reset. */
112     gcvHAL_RESET,
113
114     /* Map physical address into handle. */
115     gcvHAL_MAP_PHYSICAL,
116
117     /* Debugger stuff. */
118     gcvHAL_DEBUG,
119
120     /* Cache stuff. */
121     gcvHAL_CACHE,
122
123     /* TimeStamp */
124     gcvHAL_TIMESTAMP,
125
126     /* Database. */
127     gcvHAL_DATABASE,
128
129     /* Version. */
130     gcvHAL_VERSION,
131
132     /* Chip info */
133     gcvHAL_CHIP_INFO,
134
135     /* Process attaching/detaching. */
136     gcvHAL_ATTACH,
137     gcvHAL_DETACH,
138
139     /* Composition. */
140     gcvHAL_COMPOSE,
141
142     /* Set timeOut value */
143     gcvHAL_SET_TIMEOUT,
144
145     /* Frame database. */
146     gcvHAL_GET_FRAME_INFO,
147
148     /* Shared info for each process */
149     gcvHAL_GET_SHARED_INFO,
150     gcvHAL_SET_SHARED_INFO,
151     gcvHAL_QUERY_COMMAND_BUFFER,
152
153     gcvHAL_COMMIT_DONE,
154
155     /* GPU and event dump */
156     gcvHAL_DUMP_GPU_STATE,
157     gcvHAL_DUMP_EVENT,
158
159     /* Virtual command buffer. */
160     gcvHAL_ALLOCATE_VIRTUAL_COMMAND_BUFFER,
161     gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER,
162
163     /* FSCALE_VAL. */
164     gcvHAL_SET_FSCALE_VALUE,
165     gcvHAL_GET_FSCALE_VALUE,
166
167     /* Reset time stamp. */
168     gcvHAL_QUERY_RESET_TIME_STAMP,
169
170     /* Sync point operations. */
171     gcvHAL_SYNC_POINT,
172
173     /* Create native fence and return its fd. */
174     gcvHAL_CREATE_NATIVE_FENCE,
175
176     /* Video memory database */
177     gcvHAL_VIDMEM_DATABASE,
178 }
179 gceHAL_COMMAND_CODES;
180
181 /******************************************************************************\
182 ****************************** Interface Structure *****************************
183 \******************************************************************************/
184
185 #define gcdMAX_PROFILE_FILE_NAME    128
186
187 /* Kernel settings. */
188 typedef struct _gcsKERNEL_SETTINGS
189 {
190     /* Used RealTime signal between kernel and user. */
191     gctINT signal;
192 }
193 gcsKERNEL_SETTINGS;
194
195
196 /* gcvHAL_QUERY_CHIP_IDENTITY */
197 typedef struct _gcsHAL_QUERY_CHIP_IDENTITY * gcsHAL_QUERY_CHIP_IDENTITY_PTR;
198 typedef struct _gcsHAL_QUERY_CHIP_IDENTITY
199 {
200
201     /* Chip model. */
202     gceCHIPMODEL                chipModel;
203
204     /* Revision value.*/
205     gctUINT32                   chipRevision;
206
207     /* Supported feature fields. */
208     gctUINT32                   chipFeatures;
209
210     /* Supported minor feature fields. */
211     gctUINT32                   chipMinorFeatures;
212
213     /* Supported minor feature 1 fields. */
214     gctUINT32                   chipMinorFeatures1;
215
216     /* Supported minor feature 2 fields. */
217     gctUINT32                   chipMinorFeatures2;
218
219     /* Supported minor feature 3 fields. */
220     gctUINT32                   chipMinorFeatures3;
221
222     /* Supported minor feature 4 fields. */
223     gctUINT32                   chipMinorFeatures4;
224
225     /* Number of streams supported. */
226     gctUINT32                   streamCount;
227
228     /* Total number of temporary registers per thread. */
229     gctUINT32                   registerMax;
230
231     /* Maximum number of threads. */
232     gctUINT32                   threadCount;
233
234     /* Number of shader cores. */
235     gctUINT32                   shaderCoreCount;
236
237     /* Size of the vertex cache. */
238     gctUINT32                   vertexCacheSize;
239
240     /* Number of entries in the vertex output buffer. */
241     gctUINT32                   vertexOutputBufferSize;
242
243     /* Number of pixel pipes. */
244     gctUINT32                   pixelPipes;
245
246     /* Number of instructions. */
247     gctUINT32                   instructionCount;
248
249     /* Number of constants. */
250     gctUINT32                   numConstants;
251
252     /* Buffer size */
253     gctUINT32                   bufferSize;
254
255     /* Number of varyings */
256     gctUINT32                   varyingsCount;
257
258     /* Supertile layout style in hardware */
259     gctUINT32                   superTileMode;
260 }
261 gcsHAL_QUERY_CHIP_IDENTITY;
262
263 /* gcvHAL_COMPOSE. */
264 typedef struct _gcsHAL_COMPOSE * gcsHAL_COMPOSE_PTR;
265 typedef struct _gcsHAL_COMPOSE
266 {
267     /* Composition state buffer. */
268     gctUINT64                   physical;
269     gctUINT64                   logical;
270     gctUINT                     offset;
271     gctUINT                     size;
272
273     /* Composition end signal. */
274     gctUINT64                   process;
275     gctUINT64                   signal;
276
277     /* User signals. */
278     gctUINT64                   userProcess;
279     gctUINT64                   userSignal1;
280     gctUINT64                   userSignal2;
281
282 #if defined(__QNXNTO__)
283     /* Client pulse side-channel connection ID. */
284     gctINT32                    coid;
285
286     /* Set by server. */
287     gctINT32                    rcvid;
288 #endif
289 }
290 gcsHAL_COMPOSE;
291
292
293 typedef struct _gcsHAL_INTERFACE
294 {
295     /* Command code. */
296     gceHAL_COMMAND_CODES        command;
297
298     /* Hardware type. */
299     gceHARDWARE_TYPE            hardwareType;
300
301     /* Status value. */
302     gceSTATUS                   status;
303
304     /* Handle to this interface channel. */
305     gctUINT64                   handle;
306
307     /* Pid of the client. */
308     gctUINT32                   pid;
309
310     /* Union of command structures. */
311     union _u
312     {
313         /* gcvHAL_GET_BASE_ADDRESS */
314         struct _gcsHAL_GET_BASE_ADDRESS
315         {
316             /* Physical memory address of internal memory. */
317             OUT gctUINT32               baseAddress;
318         }
319         GetBaseAddress;
320
321         /* gcvHAL_QUERY_VIDEO_MEMORY */
322         struct _gcsHAL_QUERY_VIDEO_MEMORY
323         {
324             /* Physical memory address of internal memory. Just a name. */
325             OUT gctUINT32               internalPhysical;
326
327             /* Size in bytes of internal memory. */
328             OUT gctUINT64               internalSize;
329
330             /* Physical memory address of external memory. Just a name. */
331             OUT gctUINT32               externalPhysical;
332
333             /* Size in bytes of external memory.*/
334             OUT gctUINT64               externalSize;
335
336             /* Physical memory address of contiguous memory. Just a name. */
337             OUT gctUINT32               contiguousPhysical;
338
339             /* Size in bytes of contiguous memory.*/
340             OUT gctUINT64               contiguousSize;
341         }
342         QueryVideoMemory;
343
344         /* gcvHAL_QUERY_CHIP_IDENTITY */
345         gcsHAL_QUERY_CHIP_IDENTITY      QueryChipIdentity;
346
347         /* gcvHAL_MAP_MEMORY */
348         struct _gcsHAL_MAP_MEMORY
349         {
350             /* Physical memory address to map. Just a name on Linux/Qnx. */
351             IN gctUINT32                physical;
352
353             /* Number of bytes in physical memory to map. */
354             IN gctUINT64                bytes;
355
356             /* Address of mapped memory. */
357             OUT gctUINT64               logical;
358         }
359         MapMemory;
360
361         /* gcvHAL_UNMAP_MEMORY */
362         struct _gcsHAL_UNMAP_MEMORY
363         {
364             /* Physical memory address to unmap. Just a name on Linux/Qnx. */
365             IN gctUINT32                physical;
366
367             /* Number of bytes in physical memory to unmap. */
368             IN gctUINT64                bytes;
369
370             /* Address of mapped memory to unmap. */
371             IN gctUINT64                logical;
372         }
373         UnmapMemory;
374
375         /* gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY */
376         struct _gcsHAL_ALLOCATE_LINEAR_VIDEO_MEMORY
377         {
378             /* Number of bytes to allocate. */
379             IN OUT gctUINT              bytes;
380
381             /* Buffer alignment. */
382             IN gctUINT                  alignment;
383
384             /* Type of allocation. */
385             IN gceSURF_TYPE             type;
386
387             /* Memory pool to allocate from. */
388             IN OUT gcePOOL              pool;
389
390             /* Allocated video memory in gcuVIDMEM_NODE. */
391             OUT gctUINT64               node;
392         }
393         AllocateLinearVideoMemory;
394
395         /* gcvHAL_ALLOCATE_VIDEO_MEMORY */
396         struct _gcsHAL_ALLOCATE_VIDEO_MEMORY
397         {
398             /* Width of rectangle to allocate. */
399             IN OUT gctUINT              width;
400
401             /* Height of rectangle to allocate. */
402             IN OUT gctUINT              height;
403
404             /* Depth of rectangle to allocate. */
405             IN gctUINT                  depth;
406
407             /* Format rectangle to allocate in gceSURF_FORMAT. */
408             IN gceSURF_FORMAT           format;
409
410             /* Type of allocation. */
411             IN gceSURF_TYPE             type;
412
413             /* Memory pool to allocate from. */
414             IN OUT gcePOOL              pool;
415
416             /* Allocated video memory in gcuVIDMEM_NODE. */
417             OUT gctUINT64               node;
418         }
419         AllocateVideoMemory;
420
421         /* gcvHAL_FREE_VIDEO_MEMORY */
422         struct _gcsHAL_FREE_VIDEO_MEMORY
423         {
424             /* Allocated video memory in gcuVIDMEM_NODE. */
425             IN gctUINT64        node;
426
427 #ifdef __QNXNTO__
428 /* TODO: This is part of the unlock - why is it here? */
429             /* Mapped logical address to unmap in user space. */
430             OUT gctUINT64       memory;
431
432             /* Number of bytes to allocated. */
433             OUT gctUINT64       bytes;
434 #endif
435         }
436         FreeVideoMemory;
437
438         /* gcvHAL_LOCK_VIDEO_MEMORY */
439         struct _gcsHAL_LOCK_VIDEO_MEMORY
440         {
441             /* Allocated video memory gcuVIDMEM_NODE gcuVIDMEM_NODE. */
442             IN gctUINT64            node;
443
444             /* Cache configuration. */
445             /* Only gcvPOOL_CONTIGUOUS and gcvPOOL_VIRUTAL
446             ** can be configured */
447             IN gctBOOL              cacheable;
448
449             /* Hardware specific address. */
450             OUT gctUINT32           address;
451
452             /* Mapped logical address. */
453             OUT gctUINT64           memory;
454         }
455         LockVideoMemory;
456
457         /* gcvHAL_UNLOCK_VIDEO_MEMORY */
458         struct _gcsHAL_UNLOCK_VIDEO_MEMORY
459         {
460             /* Allocated video memory in gcuVIDMEM_NODE. */
461             IN gctUINT64            node;
462
463             /* Type of surface. */
464             IN gceSURF_TYPE         type;
465
466             /* Flag to unlock surface asynchroneously. */
467             IN OUT gctBOOL          asynchroneous;
468         }
469         UnlockVideoMemory;
470
471         /* gcvHAL_ALLOCATE_NON_PAGED_MEMORY */
472         struct _gcsHAL_ALLOCATE_NON_PAGED_MEMORY
473         {
474             /* Number of bytes to allocate. */
475             IN OUT gctUINT64        bytes;
476
477             /* Physical address of allocation. Just a name. */
478             OUT gctUINT32           physical;
479
480             /* Logical address of allocation. */
481             OUT gctUINT64           logical;
482         }
483         AllocateNonPagedMemory;
484
485         /* gcvHAL_FREE_NON_PAGED_MEMORY */
486         struct _gcsHAL_FREE_NON_PAGED_MEMORY
487         {
488             /* Number of bytes allocated. */
489             IN gctUINT64            bytes;
490
491             /* Physical address of allocation. Just a name. */
492             IN gctUINT32            physical;
493
494             /* Logical address of allocation. */
495             IN gctUINT64            logical;
496         }
497         FreeNonPagedMemory;
498
499         /* gcvHAL_ALLOCATE_NON_PAGED_MEMORY */
500         struct _gcsHAL_ALLOCATE_VIRTUAL_COMMAND_BUFFER
501         {
502             /* Number of bytes to allocate. */
503             IN OUT gctUINT64        bytes;
504
505             /* Physical address of allocation. Just a name. */
506             OUT gctUINT32           physical;
507
508             /* Logical address of allocation. */
509             OUT gctUINT64           logical;
510         }
511         AllocateVirtualCommandBuffer;
512
513         /* gcvHAL_FREE_NON_PAGED_MEMORY */
514         struct _gcsHAL_FREE_VIRTUAL_COMMAND_BUFFER
515         {
516             /* Number of bytes allocated. */
517             IN gctUINT64            bytes;
518
519             /* Physical address of allocation. Just a name. */
520             IN gctUINT32            physical;
521
522             /* Logical address of allocation. */
523             IN gctUINT64            logical;
524         }
525         FreeVirtualCommandBuffer;
526
527         /* gcvHAL_EVENT_COMMIT. */
528         struct _gcsHAL_EVENT_COMMIT
529         {
530             /* Event queue in gcsQUEUE. */
531             IN gctUINT64             queue;
532         }
533         Event;
534
535         /* gcvHAL_COMMIT */
536         struct _gcsHAL_COMMIT
537         {
538             /* Context buffer object gckCONTEXT. */
539             IN gctUINT64            context;
540
541             /* Command buffer gcoCMDBUF. */
542             IN gctUINT64            commandBuffer;
543
544             /* State delta buffer in gcsSTATE_DELTA. */
545             gctUINT64               delta;
546
547             /* Event queue in gcsQUEUE. */
548             IN gctUINT64            queue;
549         }
550         Commit;
551
552         /* gcvHAL_MAP_USER_MEMORY */
553         struct _gcsHAL_MAP_USER_MEMORY
554         {
555             /* Base address of user memory to map. */
556             IN gctUINT64                memory;
557
558             /* Physical address of user memory to map. */
559             IN gctUINT32                physical;
560
561             /* Size of user memory in bytes to map. */
562             IN gctUINT64                size;
563
564             /* Info record required by gcvHAL_UNMAP_USER_MEMORY. Just a name. */
565             OUT gctUINT32               info;
566
567             /* Physical address of mapped memory. */
568             OUT gctUINT32               address;
569         }
570         MapUserMemory;
571
572         /* gcvHAL_UNMAP_USER_MEMORY */
573         struct _gcsHAL_UNMAP_USER_MEMORY
574         {
575             /* Base address of user memory to unmap. */
576             IN gctUINT64                memory;
577
578             /* Size of user memory in bytes to unmap. */
579             IN gctUINT64                size;
580
581             /* Info record returned by gcvHAL_MAP_USER_MEMORY. Just a name. */
582             IN gctUINT32                info;
583
584             /* Physical address of mapped memory as returned by
585                gcvHAL_MAP_USER_MEMORY. */
586             IN gctUINT32                address;
587         }
588         UnmapUserMemory;
589 #if !USE_NEW_LINUX_SIGNAL
590         /* gcsHAL_USER_SIGNAL  */
591         struct _gcsHAL_USER_SIGNAL
592         {
593             /* Command. */
594             gceUSER_SIGNAL_COMMAND_CODES command;
595
596             /* Signal ID. */
597             IN OUT gctINT               id;
598
599             /* Reset mode. */
600             IN gctBOOL                  manualReset;
601
602             /* Wait timedout. */
603             IN gctUINT32                wait;
604
605             /* State. */
606             IN gctBOOL                  state;
607         }
608         UserSignal;
609 #endif
610
611         /* gcvHAL_SIGNAL. */
612         struct _gcsHAL_SIGNAL
613         {
614             /* Signal handle to signal gctSIGNAL. */
615             IN gctUINT64                signal;
616
617             /* Reserved gctSIGNAL. */
618             IN gctUINT64                auxSignal;
619
620             /* Process owning the signal gctHANDLE. */
621             IN gctUINT64                process;
622
623 #if defined(__QNXNTO__)
624             /* Client pulse side-channel connection ID. Set by client in gcoOS_CreateSignal. */
625             IN gctINT32                 coid;
626
627             /* Set by server. */
628             IN gctINT32                 rcvid;
629 #endif
630             /* Event generated from where of pipeline */
631             IN gceKERNEL_WHERE          fromWhere;
632         }
633         Signal;
634
635         /* gcvHAL_WRITE_DATA. */
636         struct _gcsHAL_WRITE_DATA
637         {
638             /* Address to write data to. */
639             IN gctUINT32                address;
640
641             /* Data to write. */
642             IN gctUINT32                data;
643         }
644         WriteData;
645
646         /* gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY */
647         struct _gcsHAL_ALLOCATE_CONTIGUOUS_MEMORY
648         {
649             /* Number of bytes to allocate. */
650             IN OUT gctUINT64            bytes;
651
652             /* Hardware address of allocation. */
653             OUT gctUINT32               address;
654
655             /* Physical address of allocation. Just a name. */
656             OUT gctUINT32               physical;
657
658             /* Logical address of allocation. */
659             OUT gctUINT64               logical;
660         }
661         AllocateContiguousMemory;
662
663         /* gcvHAL_FREE_CONTIGUOUS_MEMORY */
664         struct _gcsHAL_FREE_CONTIGUOUS_MEMORY
665         {
666             /* Number of bytes allocated. */
667             IN gctUINT64                bytes;
668
669             /* Physical address of allocation. Just a name. */
670             IN gctUINT32                physical;
671
672             /* Logical address of allocation. */
673             IN gctUINT64                logical;
674         }
675         FreeContiguousMemory;
676
677         /* gcvHAL_READ_REGISTER */
678         struct _gcsHAL_READ_REGISTER
679         {
680             /* Logical address of memory to write data to. */
681             IN gctUINT32            address;
682
683             /* Data read. */
684             OUT gctUINT32           data;
685         }
686         ReadRegisterData;
687
688         /* gcvHAL_WRITE_REGISTER */
689         struct _gcsHAL_WRITE_REGISTER
690         {
691             /* Logical address of memory to write data to. */
692             IN gctUINT32            address;
693
694             /* Data read. */
695             IN gctUINT32            data;
696         }
697         WriteRegisterData;
698
699 #if VIVANTE_PROFILER
700         /* gcvHAL_GET_PROFILE_SETTING */
701         struct _gcsHAL_GET_PROFILE_SETTING
702         {
703             /* Enable profiling */
704             OUT gctBOOL             enable;
705
706             /* The profile file name */
707             OUT gctCHAR             fileName[gcdMAX_PROFILE_FILE_NAME];
708         }
709         GetProfileSetting;
710
711         /* gcvHAL_SET_PROFILE_SETTING */
712         struct _gcsHAL_SET_PROFILE_SETTING
713         {
714             /* Enable profiling */
715             IN gctBOOL              enable;
716
717             /* The profile file name */
718             IN gctCHAR              fileName[gcdMAX_PROFILE_FILE_NAME];
719         }
720         SetProfileSetting;
721
722 #if VIVANTE_PROFILER_PERDRAW
723         /* gcvHAL_READ_PROFILER_REGISTER_SETTING */
724         struct _gcsHAL_READ_PROFILER_REGISTER_SETTING
725          {
726             /*Should Clear Register*/
727             IN gctBOOL               bclear;
728          }
729         SetProfilerRegisterClear;
730 #endif
731
732         /* gcvHAL_READ_ALL_PROFILE_REGISTERS */
733         struct _gcsHAL_READ_ALL_PROFILE_REGISTERS
734         {
735 #if VIVANTE_PROFILER_CONTEXT
736             /* Context buffer object gckCONTEXT. Just a name. */
737             IN gctUINT32                context;
738 #endif
739             /* Data read. */
740             OUT gcsPROFILER_COUNTERS    counters;
741         }
742         RegisterProfileData;
743
744         /* gcvHAL_PROFILE_REGISTERS_2D */
745         struct _gcsHAL_PROFILE_REGISTERS_2D
746         {
747             /* Data read in gcs2D_PROFILE. */
748             OUT gctUINT64       hwProfile2D;
749         }
750         RegisterProfileData2D;
751 #endif
752         /* Power management. */
753         /* gcvHAL_SET_POWER_MANAGEMENT_STATE */
754         struct _gcsHAL_SET_POWER_MANAGEMENT
755         {
756             /* Data read. */
757             IN gceCHIPPOWERSTATE        state;
758         }
759         SetPowerManagement;
760
761         /* gcvHAL_QUERY_POWER_MANAGEMENT_STATE */
762         struct _gcsHAL_QUERY_POWER_MANAGEMENT
763         {
764             /* Data read. */
765             OUT gceCHIPPOWERSTATE       state;
766
767             /* Idle query. */
768             OUT gctBOOL                 isIdle;
769         }
770         QueryPowerManagement;
771
772         /* gcvHAL_QUERY_KERNEL_SETTINGS */
773         struct _gcsHAL_QUERY_KERNEL_SETTINGS
774         {
775             /* Settings.*/
776             OUT gcsKERNEL_SETTINGS      settings;
777         }
778         QueryKernelSettings;
779
780         /* gcvHAL_MAP_PHYSICAL */
781         struct _gcsHAL_MAP_PHYSICAL
782         {
783             /* gcvTRUE to map, gcvFALSE to unmap. */
784             IN gctBOOL                  map;
785
786             /* Physical address. */
787             IN OUT gctUINT64            physical;
788         }
789         MapPhysical;
790
791         /* gcvHAL_DEBUG */
792         struct _gcsHAL_DEBUG
793         {
794             /* If gcvTRUE, set the debug information. */
795             IN gctBOOL                  set;
796             IN gctUINT32                level;
797             IN gctUINT32                zones;
798             IN gctBOOL                  enable;
799
800             IN gceDEBUG_MESSAGE_TYPE    type;
801             IN gctUINT32                messageSize;
802
803             /* Message to print if not empty. */
804             IN gctCHAR                  message[80];
805         }
806         Debug;
807
808         /* gcvHAL_CACHE */
809         struct _gcsHAL_CACHE
810         {
811             IN gceCACHEOPERATION        operation;
812             /* gctHANDLE */
813             IN gctUINT64                process;
814             IN gctUINT64                logical;
815             IN gctUINT64                bytes;
816             /* gcuVIDMEM_NODE_PTR */
817             IN gctUINT64                node;
818         }
819         Cache;
820
821         /* gcvHAL_TIMESTAMP */
822         struct _gcsHAL_TIMESTAMP
823         {
824             /* Timer select. */
825             IN gctUINT32                timer;
826
827             /* Timer request type (0-stop, 1-start, 2-send delta). */
828             IN gctUINT32                request;
829
830             /* Result of delta time in microseconds. */
831             OUT gctINT32                timeDelta;
832         }
833         TimeStamp;
834
835         /* gcvHAL_DATABASE */
836         struct _gcsHAL_DATABASE
837         {
838             /* Set to gcvTRUE if you want to query a particular process ID.
839             ** Set to gcvFALSE to query the last detached process. */
840             IN gctBOOL                  validProcessID;
841
842             /* Process ID to query. */
843             IN gctUINT32                processID;
844
845             /* Information. */
846             OUT gcuDATABASE_INFO        vidMem;
847             OUT gcuDATABASE_INFO        nonPaged;
848             OUT gcuDATABASE_INFO        contiguous;
849             OUT gcuDATABASE_INFO        gpuIdle;
850         }
851         Database;
852
853         /* gcvHAL_VIDMEM_DATABASE */
854         struct _gcsHAL_VIDMEM_DATABASE
855         {
856             /* Set to gcvTRUE if you want to query a particular process ID.
857             ** Set to gcvFALSE to query the last detached process. */
858             IN gctBOOL                  validProcessID;
859
860             /* Process ID to query. */
861             IN gctUINT32                processID;
862
863             /* Information. */
864             OUT gcuDATABASE_INFO        vidMemResv;
865             OUT gcuDATABASE_INFO        vidMemCont;
866             OUT gcuDATABASE_INFO        vidMemVirt;
867         }
868         VidMemDatabase;
869
870         /* gcvHAL_VERSION */
871         struct _gcsHAL_VERSION
872         {
873             /* Major version: N.n.n. */
874             OUT gctINT32                major;
875
876             /* Minor version: n.N.n. */
877             OUT gctINT32                minor;
878
879             /* Patch version: n.n.N. */
880             OUT gctINT32                patch;
881
882             /* Build version. */
883             OUT gctUINT32               build;
884         }
885         Version;
886
887         /* gcvHAL_CHIP_INFO */
888         struct _gcsHAL_CHIP_INFO
889         {
890             /* Chip count. */
891             OUT gctINT32                count;
892
893             /* Chip types. */
894             OUT gceHARDWARE_TYPE        types[gcdCHIP_COUNT];
895         }
896         ChipInfo;
897
898         /* gcvHAL_ATTACH */
899         struct _gcsHAL_ATTACH
900         {
901             /* Context buffer object gckCONTEXT. Just a name. */
902             OUT gctUINT32               context;
903
904             /* Number of states in the buffer. */
905             OUT gctUINT64               stateCount;
906         }
907         Attach;
908
909         /* gcvHAL_DETACH */
910         struct _gcsHAL_DETACH
911         {
912             /* Context buffer object gckCONTEXT. Just a name. */
913             IN gctUINT32                context;
914         }
915         Detach;
916
917         /* gcvHAL_COMPOSE. */
918         gcsHAL_COMPOSE            Compose;
919
920         /* gcvHAL_GET_FRAME_INFO. */
921         struct _gcsHAL_GET_FRAME_INFO
922         {
923             /* gcsHAL_FRAME_INFO* */
924             OUT gctUINT64     frameInfo;
925         }
926         GetFrameInfo;
927
928         /* gcvHAL_SET_TIME_OUT. */
929         struct _gcsHAL_SET_TIMEOUT
930         {
931             gctUINT32                   timeOut;
932         }
933         SetTimeOut;
934
935 #if gcdENABLE_VG
936                 /* gcvHAL_COMMIT */
937                 struct _gcsHAL_VGCOMMIT
938                 {
939                         /* Context buffer in gcsVGCONTEXT. */
940                         IN gctUINT64                    context;
941
942                         /* Command queue in gcsVGCMDQUEUE. */
943                         IN gctUINT64                    queue;
944
945                         /* Number of entries in the queue. */
946                         IN gctUINT                      entryCount;
947
948                         /* Task table in gcsTASK_MASTER_TABLE. */
949                         IN gctUINT64                    taskTable;
950                 }
951                 VGCommit;
952
953                 /* gcvHAL_QUERY_COMMAND_BUFFER */
954                 struct _gcsHAL_QUERY_COMMAND_BUFFER
955                 {
956                         /* Command buffer attributes. */
957                         OUT gcsCOMMAND_BUFFER_INFO      information;
958                 }
959                 QueryCommandBuffer;
960
961 #endif
962
963         struct _gcsHAL_GET_SHARED_INFO
964         {
965             /* Process id. */
966             IN gctUINT32            pid;
967
968             /* Data id. */
969             IN gctUINT32            dataId;
970
971             /* Data size. */
972             IN gctSIZE_T            bytes;
973
974             /* Pointer to save the shared data. */
975             OUT gctPOINTER          data;
976         }
977         GetSharedInfo;
978
979         struct _gcsHAL_SET_SHARED_INFO
980         {
981             /* Data id. */
982             IN gctUINT32            dataId;
983
984             /* Data to be shared. */
985             IN gctPOINTER           data;
986
987             /* Data size. */
988             IN gctSIZE_T            bytes;
989         }
990         SetSharedInfo;
991
992         struct _gcsHAL_SET_FSCALE_VALUE
993         {
994             IN gctUINT              value;
995         }
996         SetFscaleValue;
997
998         struct _gcsHAL_GET_FSCALE_VALUE
999         {
1000             OUT gctUINT             value;
1001             OUT gctUINT             minValue;
1002             OUT gctUINT             maxValue;
1003         }
1004         GetFscaleValue;
1005
1006         struct _gcsHAL_QUERY_RESET_TIME_STAMP
1007         {
1008             OUT gctUINT64           timeStamp;
1009         }
1010         QueryResetTimeStamp;
1011
1012         struct _gcsHAL_SYNC_POINT
1013         {
1014             /* Command. */
1015             gceSYNC_POINT_COMMAND_CODES command;
1016
1017             /* Sync point. */
1018             IN OUT gctUINT64            syncPoint;
1019
1020             /* From where. */
1021             IN gceKERNEL_WHERE          fromWhere;
1022
1023             /* Signaled state. */
1024             OUT gctBOOL                 state;
1025         }
1026         SyncPoint;
1027
1028         struct _gcsHAL_CREATE_NATIVE_FENCE
1029         {
1030             /* Signal id to dup. */
1031             IN gctUINT64                syncPoint;
1032
1033             /* Native fence file descriptor. */
1034             OUT gctINT                  fenceFD;
1035
1036         }
1037         CreateNativeFence;
1038     }
1039     u;
1040 }
1041 gcsHAL_INTERFACE;
1042
1043
1044 #ifdef __cplusplus
1045 }
1046 #endif
1047
1048 #endif /* __gc_hal_driver_h_ */