/
gc_hal_base.h
5999 lines (5296 loc) · 141 KB
/
gc_hal_base.h
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
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/****************************************************************************
*
* The MIT License (MIT)
*
* Copyright (c) 2014 - 2017 Vivante Corporation
*
* 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.
*
* 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. 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.
*
*****************************************************************************
*
* The GPL License (GPL)
*
* Copyright (C) 2014 - 2017 Vivante Corporation
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*****************************************************************************
*
* Note: This software is released under dual MIT and GPL licenses. A
* recipient may use this file under the terms of either the MIT license or
* GPL License. If you wish to use only one license not the other, you can
* indicate your decision by deleting one of the above license notices in your
* version of this file.
*
*****************************************************************************/
#ifndef __gc_hal_base_h_
#define __gc_hal_base_h_
#include "gc_hal_enum.h"
#include "gc_hal_types.h"
#include "gc_hal_dump.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
****************************** Object Declarations *****************************
\******************************************************************************/
typedef struct _gckOS * gckOS;
typedef struct _gcoHAL * gcoHAL;
typedef struct _gcoOS * gcoOS;
typedef struct _gco2D * gco2D;
typedef struct gcsATOM * gcsATOM_PTR;
typedef struct _gco3D * gco3D;
typedef struct _gcoCL * gcoCL;
typedef struct _gcsFAST_FLUSH * gcsFAST_FLUSH_PTR;
typedef struct _gcoSURF * gcoSURF;
typedef struct _gcsSURF_NODE * gcsSURF_NODE_PTR;
typedef struct _gcsSURF_FORMAT_INFO * gcsSURF_FORMAT_INFO_PTR;
typedef struct _gcsPOINT * gcsPOINT_PTR;
typedef struct _gcsSIZE * gcsSIZE_PTR;
typedef struct _gcsRECT * gcsRECT_PTR;
typedef struct _gcsBOUNDARY * gcsBOUNDARY_PTR;
typedef struct _gcoDUMP * gcoDUMP;
typedef struct _gcoHARDWARE * gcoHARDWARE;
typedef union _gcuVIDMEM_NODE * gcuVIDMEM_NODE_PTR;
typedef struct _gcsVIDMEM_NODE * gckVIDMEM_NODE;
#if gcdENABLE_VG
typedef struct _gcoVG * gcoVG;
typedef struct _gcsCOMPLETION_SIGNAL * gcsCOMPLETION_SIGNAL_PTR;
typedef struct _gcsCONTEXT_MAP * gcsCONTEXT_MAP_PTR;
#else
typedef void * gcoVG;
#endif
typedef struct _gcoFENCE * gcoFENCE;
typedef struct _gcsSYNC_CONTEXT * gcsSYNC_CONTEXT_PTR;
typedef enum {
gcvFENCE_TYPE_READ = 0x1,
gcvFENCE_TYPE_WRITE = 0x2,
gcvFENCE_TYPE_ALL = gcvFENCE_TYPE_READ | gcvFENCE_TYPE_WRITE,
}
gceFENCE_TYPE;
typedef struct _gcsUSER_MEMORY_DESC * gcsUSER_MEMORY_DESC_PTR;
/******************************************************************************\
********************* Share obj lock/unlock macros. ****************************
\******************************************************************************/
#define gcmLOCK_SHARE_OBJ(Obj) \
{ \
if(Obj->sharedLock != gcvNULL)\
{\
(gcoOS_AcquireMutex( \
gcvNULL, Obj->sharedLock, gcvINFINITE));\
}\
}
#define gcmUNLOCK_SHARE_OBJ(Obj)\
{\
if(Obj->sharedLock != gcvNULL)\
{\
(gcoOS_ReleaseMutex(gcvNULL, Obj->sharedLock));\
}\
}
typedef struct _gcsSystemInfo
{
/* memory latency number for SH data fetch, in SH cycle*/
gctUINT32 memoryLatencySH;
}
gcsSystemInfo;
#if gcdENABLE_3D
#define gcPLS_INITIALIZER \
{ \
gcvNULL, /* gcoOS object. */ \
gcvNULL, /* gcoHAL object. */ \
0, /* internalSize */ \
gcvNULL, /* internalPhysical */ \
gcvNULL, /* internalLogical */ \
0, /* externalSize */ \
gcvNULL, /* externalPhysical */ \
gcvNULL, /* externalLogical */ \
0, /* contiguousSize */ \
gcvNULL, /* contiguousPhysical */ \
gcvNULL, /* contiguousLogical */ \
gcvNULL, /* eglDisplayInfo */ \
gcvNULL, /* eglSurfaceInfo */ \
gcvSURF_A8R8G8B8,/* eglConfigFormat */ \
gcvNULL, /* reference */ \
0, /* processID */ \
0, /* threadID */ \
gcvFALSE, /* exiting */ \
gcvFALSE, /* Special flag for NP2 texture. */ \
gcvNULL, /* destructor */ \
gcvNULL, /* accessLock */ \
gcvNULL, /* GL FE compiler lock*/ \
gcvPATCH_NOTINIT,/* global patchID */ \
}
#else
#define gcPLS_INITIALIZER \
{ \
gcvNULL, /* gcoOS object. */ \
gcvNULL, /* gcoHAL object. */ \
0, /* internalSize */ \
gcvNULL, /* internalPhysical */ \
gcvNULL, /* internalLogical */ \
0, /* externalSize */ \
gcvNULL, /* externalPhysical */ \
gcvNULL, /* externalLogical */ \
0, /* contiguousSize */ \
gcvNULL, /* contiguousPhysical */ \
gcvNULL, /* contiguousLogical */ \
gcvNULL, /* eglDisplayInfo */ \
gcvNULL, /* eglSurfaceInfo */ \
gcvSURF_A8R8G8B8,/* eglConfigFormat */ \
gcvNULL, /* reference */ \
0, /* processID */ \
0, /* threadID */ \
gcvFALSE, /* exiting */ \
gcvFALSE, /* Special flag for NP2 texture. */ \
gcvNULL, /* destructor */ \
gcvNULL, /* accessLock */ \
}
#endif
/******************************************************************************\
******************************* Thread local storage *************************
\******************************************************************************/
typedef struct _gcsDRIVER_TLS * gcsDRIVER_TLS_PTR;
typedef struct _gcsDRIVER_TLS
{
void (* destructor)(gcsDRIVER_TLS_PTR Tls);
}
gcsDRIVER_TLS;
typedef enum _gceTLS_KEY
{
gcvTLS_KEY_EGL,
gcvTLS_KEY_OPENGL_ES,
gcvTLS_KEY_OPENVG,
gcvTLS_KEY_OPENGL,
gcvTLS_KEY_OPENCL,
gcvTLS_KEY_OPENVX,
gcvTLS_KEY_COUNT
}
gceTLS_KEY;
typedef struct _gcsTLS * gcsTLS_PTR;
typedef struct _gcsTLS
{
gceHARDWARE_TYPE currentType;
/* To which core device control is called,
* it is index in a hardware type.
*/
gctUINT32 currentCoreIndex;
/* Current 3D hardwre of this thread */
gcoHARDWARE currentHardware;
/* Default 3D hardware of this thread */
gcoHARDWARE defaultHardware;
/* Only for separated 3D and 2D */
gcoHARDWARE hardware2D;
#if gcdENABLE_VG
gcoVGHARDWARE vg;
gcoVG engineVG;
#endif /* gcdENABLE_VG */
#if gcdENABLE_3D
gco3D engine3D;
#endif
#if gcdENABLE_2D
gco2D engine2D;
#if gcdDUMP_2D
gctUINT32 newDump2DFlag;
#endif
#endif
gctBOOL copied;
/* libGAL.so handle */
gctHANDLE handle;
/* If true, do not releas 2d engine and hardware in hal layer */
gctBOOL release2DUpper;
/* Driver tls. */
gcsDRIVER_TLS_PTR driverTLS[gcvTLS_KEY_COUNT];
}
gcsTLS;
/******************************************************************************\
********************************* Enumerations *********************************
\******************************************************************************/
typedef enum _gcePLS_VALUE
{
gcePLS_VALUE_EGL_DISPLAY_INFO,
gcePLS_VALUE_EGL_CONFIG_FORMAT_INFO,
gcePLS_VALUE_EGL_DESTRUCTOR_INFO,
}
gcePLS_VALUE;
/* Video memory pool type. */
typedef enum _gcePOOL
{
gcvPOOL_UNKNOWN = 0,
gcvPOOL_DEFAULT,
gcvPOOL_LOCAL,
gcvPOOL_LOCAL_INTERNAL,
gcvPOOL_LOCAL_EXTERNAL,
gcvPOOL_UNIFIED,
gcvPOOL_SYSTEM,
gcvPOOL_VIRTUAL,
gcvPOOL_USER,
gcvPOOL_CONTIGUOUS,
gcvPOOL_NUMBER_OF_POOLS
}
gcePOOL;
#if gcdENABLE_3D
/* Blending functions. */
typedef enum _gceBLEND_FUNCTION
{
gcvBLEND_ZERO,
gcvBLEND_ONE,
gcvBLEND_SOURCE_COLOR,
gcvBLEND_INV_SOURCE_COLOR,
gcvBLEND_SOURCE_ALPHA,
gcvBLEND_INV_SOURCE_ALPHA,
gcvBLEND_TARGET_COLOR,
gcvBLEND_INV_TARGET_COLOR,
gcvBLEND_TARGET_ALPHA,
gcvBLEND_INV_TARGET_ALPHA,
gcvBLEND_SOURCE_ALPHA_SATURATE,
gcvBLEND_CONST_COLOR,
gcvBLEND_INV_CONST_COLOR,
gcvBLEND_CONST_ALPHA,
gcvBLEND_INV_CONST_ALPHA,
}
gceBLEND_FUNCTION;
/* Blending modes. */
typedef enum _gceBLEND_MODE
{
gcvBLEND_ADD = 0,
gcvBLEND_SUBTRACT,
gcvBLEND_REVERSE_SUBTRACT,
gcvBLEND_MIN,
gcvBLEND_MAX,
gcvBLEND_MULTIPLY,
gcvBLEND_SCREEN,
gcvBLEND_OVERLAY,
gcvBLEND_DARKEN,
gcvBLEND_LIGHTEN,
gcvBLEND_COLORDODGE,
gcvBLEND_COLORBURN,
gcvBLEND_HARDLIGHT,
gcvBLEND_SOFTLIGHT,
gcvBLEND_DIFFERENCE,
gcvBLEND_EXCLUSION,
gcvBLEND_HSL_HUE,
gcvBLEND_HSL_SATURATION,
gcvBLEND_HSL_COLOR,
gcvBLEND_HSL_LUMINOSITY,
gcvBLEND_TOTAL
}
gceBLEND_MODE;
/* Depth modes. */
typedef enum _gceDEPTH_MODE
{
gcvDEPTH_NONE,
gcvDEPTH_Z,
gcvDEPTH_W,
}
gceDEPTH_MODE;
#endif /* gcdENABLE_3D */
/* API flags. */
typedef enum _gceAPI
{
gcvAPI_D3D = 1,
gcvAPI_OPENGL_ES11,
gcvAPI_OPENGL_ES20,
gcvAPI_OPENGL_ES30,
gcvAPI_OPENGL_ES31,
gcvAPI_OPENGL_ES32,
gcvAPI_OPENGL,
gcvAPI_OPENVG,
gcvAPI_OPENCL,
gcvAPI_OPENVK,
}
gceAPI;
typedef enum _gceWHERE
{
gcvWHERE_COMMAND_PREFETCH = 0,
gcvWHERE_COMMAND,
gcvWHERE_RASTER,
gcvWHERE_PIXEL,
gcvWHERE_BLT,
}
gceWHERE;
typedef enum _gceHOW
{
gcvHOW_SEMAPHORE = 0x1,
gcvHOW_STALL = 0x2,
gcvHOW_SEMAPHORE_STALL = 0x3,
}
gceHOW;
typedef enum _gceSignalHandlerType
{
gcvHANDLE_SIGFPE_WHEN_SIGNAL_CODE_IS_0 = 0x1,
}
gceSignalHandlerType;
typedef struct _gcsSURF_VIEW
{
gcoSURF surf;
gctUINT firstSlice;
gctUINT numSlices;
}gcsSURF_VIEW;
/* gcsHAL_Limits*/
typedef struct _gcsHAL_LIMITS
{
/* chip info */
gceCHIPMODEL chipModel;
gctUINT32 chipRevision;
gctUINT32 featureCount;
gctUINT32 *chipFeatures;
/* target caps */
gctUINT32 maxWidth;
gctUINT32 maxHeight;
gctUINT32 multiTargetCount;
gctUINT32 maxSamples;
}gcsHAL_LIMITS;
#define gcdEXTERNAL_MEMORY_NAME_MAX 32
#define gcdEXTERNAL_MEMORY_DATA_MAX 8
typedef struct _gcsEXTERNAL_MEMORY_INFO
{
/* Name of allocator used to attach this memory. */
gctCHAR allocatorName[gcdEXTERNAL_MEMORY_NAME_MAX];
/* User defined data which will be passed to allocator. */
gctUINT32 userData[gcdEXTERNAL_MEMORY_DATA_MAX];
}
gcsEXTERNAL_MEMORY_INFO;
/******************************************************************************\
*********** Generic Memory Allocation Optimization Using Containers ************
\******************************************************************************/
/* Generic container definition. */
typedef struct _gcsCONTAINER_LINK * gcsCONTAINER_LINK_PTR;
typedef struct _gcsCONTAINER_LINK
{
/* Points to the next container. */
gcsCONTAINER_LINK_PTR next;
}
gcsCONTAINER_LINK;
typedef struct _gcsCONTAINER_RECORD * gcsCONTAINER_RECORD_PTR;
typedef struct _gcsCONTAINER_RECORD
{
gcsCONTAINER_RECORD_PTR prev;
gcsCONTAINER_RECORD_PTR next;
}
gcsCONTAINER_RECORD;
typedef struct _gcsCONTAINER * gcsCONTAINER_PTR;
typedef struct _gcsCONTAINER
{
gctUINT containerSize;
gctUINT recordSize;
gctUINT recordCount;
gcsCONTAINER_LINK_PTR containers;
gcsCONTAINER_RECORD freeList;
gcsCONTAINER_RECORD allocList;
}
gcsCONTAINER;
gceSTATUS
gcsCONTAINER_Construct(
IN gcsCONTAINER_PTR Container,
gctUINT RecordsPerContainer,
gctUINT RecordSize
);
gceSTATUS
gcsCONTAINER_Destroy(
IN gcsCONTAINER_PTR Container
);
gceSTATUS
gcsCONTAINER_AllocateRecord(
IN gcsCONTAINER_PTR Container,
OUT gctPOINTER * Record
);
gceSTATUS
gcsCONTAINER_FreeRecord(
IN gcsCONTAINER_PTR Container,
IN gctPOINTER Record
);
gceSTATUS
gcsCONTAINER_FreeAll(
IN gcsCONTAINER_PTR Container
);
/******************************************************************************\
********************************* gcoHAL Object *********************************
\******************************************************************************/
/* Construct a new gcoHAL object. */
gceSTATUS
gcoHAL_ConstructEx(
IN gctPOINTER Context,
IN gcoOS Os,
OUT gcoHAL * Hal
);
/* Destroy an gcoHAL object. */
gceSTATUS
gcoHAL_DestroyEx(
IN gcoHAL Hal
);
/* Empty function for compatibility. */
gceSTATUS
gcoHAL_Construct(
IN gctPOINTER Context,
IN gcoOS Os,
OUT gcoHAL * Hal
);
/* Empty function for compatibility. */
gceSTATUS
gcoHAL_Destroy(
IN gcoHAL Hal
);
/* Get HAL options */
gceSTATUS
gcoHAL_GetOption(
IN gcoHAL Hal,
IN gceOPTION Option
);
gceSTATUS
gcoHAL_FrameInfoOps(
IN gcoHAL Hal,
IN gceFRAMEINFO FrameInfo,
IN gceFRAMEINFO_OP Op,
IN OUT gctUINT * Val
);
/* Set HAL options */
gceSTATUS
gcoHAL_SetOption(
IN gcoHAL Hal,
IN gceOPTION Option,
IN gctBOOL Value
);
gceSTATUS
gcoHAL_GetHardware(
IN gcoHAL Hal,
OUT gcoHARDWARE* Hw
);
#if gcdENABLE_2D
/* Get pointer to gco2D object. */
gceSTATUS
gcoHAL_Get2DEngine(
IN gcoHAL Hal,
OUT gco2D * Engine
);
#endif
#if gcdENABLE_3D
gceSTATUS
gcoHAL_GetSpecialHintData(
IN gcoHAL Hal,
OUT gctINT * Hint
);
/*
** Deprecated(Don't use it), keep it here for external library(libgcu.so)
*/
gceSTATUS
gcoHAL_Get3DEngine(
IN gcoHAL Hal,
OUT gco3D * Engine
);
#endif /* gcdENABLE_3D */
gceSTATUS
gcoHAL_GetProductName(
IN gcoHAL Hal,
OUT gctSTRING *ProductName
);
gceSTATUS
gcoHAL_SetFscaleValue(
IN gctUINT FscaleValue
);
gceSTATUS
gcoHAL_GetFscaleValue(
OUT gctUINT * FscaleValue,
OUT gctUINT * MinFscaleValue,
OUT gctUINT * MaxFscaleValue
);
gceSTATUS
gcoHAL_SetBltNP2Texture(
gctBOOL enable
);
gceSTATUS
gcoHAL_NameVideoMemory(
IN gctUINT32 Handle,
OUT gctUINT32 * Name
);
gceSTATUS
gcoHAL_ImportVideoMemory(
IN gctUINT32 Name,
OUT gctUINT32 * Handle
);
gceSTATUS
gcoHAL_GetVideoMemoryFd(
IN gctUINT32 Handle,
OUT gctINT * Fd
);
/* Verify whether the specified feature is available in hardware. */
gceSTATUS
gcoHAL_IsFeatureAvailable(
IN gcoHAL Hal,
IN gceFEATURE Feature
);
gceSTATUS
gcoHAL_IsSwwaNeeded(
IN gcoHAL Hal,
IN gceSWWA Swwa
);
gceSTATUS
gcoHAL_IsFeatureAvailable1(
IN gcoHAL Hal,
IN gceFEATURE Feature
);
/* Query the identity of the hardware. */
gceSTATUS
gcoHAL_QueryChipIdentity(
IN gcoHAL Hal,
OUT gceCHIPMODEL* ChipModel,
OUT gctUINT32* ChipRevision,
OUT gctUINT32* ChipFeatures,
OUT gctUINT32* ChipMinorFeatures
);
gceSTATUS
gcoHAL_QuerySuperTileMode(
OUT gctUINT32_PTR SuperTileMode
);
gceSTATUS
gcoHAL_QueryMultiGPUAffinityConfig(
IN gceHARDWARE_TYPE Type,
OUT gceMULTI_GPU_MODE *Mode,
OUT gctUINT32_PTR CoreIndex
);
#ifdef LINUX
gctINT32
gcoOS_EndRecordAllocation(void);
void
gcoOS_RecordAllocation(void);
void
gcoOS_AddRecordAllocation(gctSIZE_T Size);
#endif
/* Query the amount of video memory. */
gceSTATUS
gcoHAL_QueryVideoMemory(
IN gcoHAL Hal,
OUT gctPHYS_ADDR * InternalAddress,
OUT gctSIZE_T * InternalSize,
OUT gctPHYS_ADDR * ExternalAddress,
OUT gctSIZE_T * ExternalSize,
OUT gctPHYS_ADDR * ContiguousAddress,
OUT gctSIZE_T * ContiguousSize
);
/* Map video memory. */
gceSTATUS
gcoHAL_MapMemory(
IN gcoHAL Hal,
IN gctPHYS_ADDR Physical,
IN gctSIZE_T NumberOfBytes,
OUT gctPOINTER * Logical
);
/* Unmap video memory. */
gceSTATUS
gcoHAL_UnmapMemory(
IN gcoHAL Hal,
IN gctPHYS_ADDR Physical,
IN gctSIZE_T NumberOfBytes,
IN gctPOINTER Logical
);
/* Schedule an unmap of a buffer mapped through its physical address. */
gceSTATUS
gcoHAL_ScheduleUnmapMemory(
IN gcoHAL Hal,
IN gctPHYS_ADDR Physical,
IN gctSIZE_T NumberOfBytes,
IN gctPOINTER Logical
);
/* Allocate video memory. */
gceSTATUS
gcoOS_AllocateVideoMemory(
IN gcoOS Os,
IN gctBOOL InUserSpace,
IN gctBOOL InCacheable,
IN OUT gctSIZE_T * Bytes,
OUT gctUINT32 * Physical,
OUT gctPOINTER * Logical,
OUT gctPOINTER * Handle
);
/* Free video memory. */
gceSTATUS
gcoOS_FreeVideoMemory(
IN gcoOS Os,
IN gctPOINTER Handle
);
/* Lock video memory. */
gceSTATUS
gcoOS_LockVideoMemory(
IN gcoOS Os,
IN gctPOINTER Handle,
IN gctBOOL InUserSpace,
IN gctBOOL InCacheable,
OUT gctUINT32 * Physical,
OUT gctPOINTER * Logical
);
/* Map user memory. */
gceSTATUS
gcoHAL_MapUserMemory(
IN gctPOINTER Logical,
IN gctUINT32 Physical,
IN gctSIZE_T Size,
OUT gctPOINTER * Info,
OUT gctUINT32_PTR GPUAddress
);
/* Unmap user memory. */
gceSTATUS
gcoHAL_UnmapUserMemory(
IN gctPOINTER Logical,
IN gctSIZE_T Size,
IN gctPOINTER Info,
IN gctUINT32 GPUAddress
);
/* Schedule an unmap of a user buffer using event mechanism. */
gceSTATUS
gcoHAL_ScheduleUnmapUserMemory(
IN gcoHAL Hal,
IN gctPOINTER Info,
IN gctSIZE_T Size,
IN gctUINT32 Address,
IN gctPOINTER Memory
);
/* Commit the current command buffer. */
gceSTATUS
gcoHAL_Commit(
IN gcoHAL Hal,
IN gctBOOL Stall
);
#if gcdENABLE_3D
/* Sencd fence command. */
gceSTATUS
gcoHAL_SendFence(
IN gcoHAL Hal
);
#endif /* gcdENABLE_3D */
/* Query the tile capabilities. */
gceSTATUS
gcoHAL_QueryTiled(
IN gcoHAL Hal,
OUT gctINT32 * TileWidth2D,
OUT gctINT32 * TileHeight2D,
OUT gctINT32 * TileWidth3D,
OUT gctINT32 * TileHeight3D
);
gceSTATUS
gcoHAL_Compact(
IN gcoHAL Hal
);
#if VIVANTE_PROFILER
gceSTATUS
gcoHAL_ProfileStart(
IN gcoHAL Hal
);
gceSTATUS
gcoHAL_ProfileEnd(
IN gcoHAL Hal,
IN gctCONST_STRING Title
);
#endif
/* Power Management */
gceSTATUS
gcoHAL_SetPowerManagementState(
IN gcoHAL Hal,
IN gceCHIPPOWERSTATE State
);
gceSTATUS
gcoHAL_QueryPowerManagementState(
IN gcoHAL Hal,
OUT gceCHIPPOWERSTATE *State
);
/* Set the filter type for filter blit. */
gceSTATUS
gcoHAL_SetFilterType(
IN gcoHAL Hal,
IN gceFILTER_TYPE FilterType
);
gceSTATUS
gcoHAL_GetDump(
IN gcoHAL Hal,
OUT gcoDUMP * Dump
);
/* Call the kernel HAL layer. */
gceSTATUS
gcoHAL_Call(
IN gcoHAL Hal,
IN OUT gcsHAL_INTERFACE_PTR Interface
);
/* Schedule an event. */
gceSTATUS
gcoHAL_ScheduleEvent(
IN gcoHAL Hal,
IN OUT gcsHAL_INTERFACE_PTR Interface
);
/* Request a start/stop timestamp. */
gceSTATUS
gcoHAL_SetTimer(
IN gcoHAL Hal,
IN gctUINT32 Index,
IN gctBOOL Start
);
/* Get Time delta from a Timer in microseconds. */
gceSTATUS
gcoHAL_GetTimerTime(
IN gcoHAL Hal,
IN gctUINT32 Timer,
OUT gctINT32_PTR TimeDelta
);
/* set timeout value. */
gceSTATUS
gcoHAL_SetTimeOut(
IN gcoHAL Hal,
IN gctUINT32 timeOut
);
gceSTATUS
gcoHAL_SetHardwareType(
IN gcoHAL Hal,
IN gceHARDWARE_TYPE HardwardType
);
gceSTATUS
gcoHAL_GetHardwareType(
IN gcoHAL Hal,
OUT gceHARDWARE_TYPE * HardwardType
);
gceSTATUS
gcoHAL_QueryChipCount(
IN gcoHAL Hal,
OUT gctINT32 * Count
);
gceSTATUS
gcoHAL_Query3DCoreCount(
IN gcoHAL Hal,
OUT gctUINT32 *Count
);
gceSTATUS
gcoHAL_QueryCoreCount(
IN gcoHAL Hal,
IN gceHARDWARE_TYPE Type,
OUT gctUINT *Count,
OUT gctUINT_PTR ChipIDs
);
gceSTATUS
gcoHAL_QuerySeparated2D(
IN gcoHAL Hal
);
gceSTATUS
gcoHAL_QueryHybrid2D(
IN gcoHAL Hal
);
gceSTATUS
gcoHAL_Is3DAvailable(
IN gcoHAL Hal
);
/* Get pointer to gcoVG object. */
gceSTATUS
gcoHAL_GetVGEngine(
IN gcoHAL Hal,
OUT gcoVG * Engine
);
gceSTATUS
gcoHAL_QueryChipLimits(
IN gcoHAL Hal,
IN gctINT32 Chip,
OUT gcsHAL_LIMITS *Limits);
gceSTATUS
gcoHAL_QueryChipFeature(
IN gcoHAL Hal,
IN gctINT32 Chip,
IN gceFEATURE Feature);
gceSTATUS
gcoHAL_SetCoreIndex(
IN gcoHAL Hal,
IN gctUINT32 Core
);
gceSTATUS
gcoHAL_GetCurrentCoreIndex(
IN gcoHAL Hal,
OUT gctUINT32 *Core
);
/*----------------------------------------------------------------------------*/
/*----- Shared Buffer --------------------------------------------------------*/
/* Create shared buffer. */
gceSTATUS
gcoHAL_CreateShBuffer(
IN gctUINT32 Size,
OUT gctSHBUF * ShBuf
);
/* Destroy shared buffer. */
gceSTATUS
gcoHAL_DestroyShBuffer(
IN gctSHBUF ShBuf
);
/* Map shared buffer to current process. */
gceSTATUS
gcoHAL_MapShBuffer(
IN gctSHBUF ShBuf
);
/* Write user data to shared buffer. */
gceSTATUS
gcoHAL_WriteShBuffer(
IN gctSHBUF ShBuf,
IN gctCONST_POINTER Data,
IN gctUINT32 ByteCount
);
/* Read user data from shared buffer. */
gceSTATUS
gcoHAL_ReadShBuffer(
IN gctSHBUF ShBuf,
IN gctPOINTER Data,
IN gctUINT32 BytesCount,
OUT gctUINT32 * BytesRead
);
/* Config power management to be enabled or disabled. */
gceSTATUS