1 /****************************************************************************
3 * Copyright (C) 2005 - 2013 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
22 #ifndef __gc_hal_options_h_
23 #define __gc_hal_options_h_
30 #ifndef gcdPRINT_VERSION
31 # define gcdPRINT_VERSION 0
37 This define enables the Linux kernel signaling between kernel and user.
39 #ifndef USE_NEW_LINUX_SIGNAL
40 # define USE_NEW_LINUX_SIGNAL 0
46 This define enables the profiler.
48 #ifndef VIVANTE_PROFILER
49 # define VIVANTE_PROFILER 1
52 #ifndef VIVANTE_PROFILER_PERDRAW
53 # define VIVANTE_PROFILER_PERDRAW 0
57 VIVANTE_PROFILER_CONTEXT
59 This define enables the profiler according to each hw context.
61 #ifndef VIVANTE_PROFILER_CONTEXT
62 # define VIVANTE_PROFILER_CONTEXT 1
68 Enable VG HAL layer (only for GC350).
77 Set to 1 if the frame buffer memory cannot be accessed by the GPU.
86 This define enables super-sampling support.
88 #define USE_SUPER_SAMPLING 0
93 This define enables HAL counter profiling support. HW and SHADER
94 counter profiling depends on this.
96 #ifndef PROFILE_HAL_COUNTERS
97 # define PROFILE_HAL_COUNTERS 1
103 This define enables HW counter profiling support.
105 #ifndef PROFILE_HW_COUNTERS
106 # define PROFILE_HW_COUNTERS 1
110 PROFILE_SHADER_COUNTERS
112 This define enables SHADER counter profiling support.
114 #ifndef PROFILE_SHADER_COUNTERS
115 # define PROFILE_SHADER_COUNTERS 1
119 COMMAND_PROCESSOR_VERSION
121 The version of the command buffer and task manager.
123 #define COMMAND_PROCESSOR_VERSION 1
128 Set this to a string that appears in 'cat /proc/<pid>/cmdline'. E.g. 'camera'.
129 HAL will create dumps for the processes matching this key.
132 # define gcdDUMP_KEY "process"
138 The dump file location. Some processes cannot write to the sdcard.
139 Try apps' data dir, e.g. /data/data/com.android.launcher
143 # define gcdDUMP_PATH "/mnt/sdcard/"
145 # define gcdDUMP_PATH "./"
152 When set to 1, a dump of all states and memory uploads, as well as other
153 hardware related execution will be printed to the debug console. This
154 data can be used for playing back applications.
163 When set to 1, a high level dump of the EGL and GL/VG APs's are
167 # define gcdDUMP_API 0
172 When set to a value other than zero, averaqe frame rate will be dumped.
173 The value set is the starting frame that the average will be calculated.
174 This is needed because sometimes first few frames are too slow to be included
175 in the average. Frame count starts from 1.
177 #ifndef gcdDUMP_FRAMERATE
178 # define gcdDUMP_FRAMERATE 0
182 gcdVIRTUAL_COMMAND_BUFFER
183 When set to 1, user command buffer and context buffer will be allocated
184 from gcvPOOL_VIRTUAL.
186 #ifndef gcdVIRTUAL_COMMAND_BUFFER
187 # define gcdVIRTUAL_COMMAND_BUFFER 0
191 gcdENABLE_FSCALE_VAL_ADJUST
192 When non-zero, FSCALE_VAL when gcvPOWER_ON can be adjusted externally.
194 #ifndef gcdENABLE_FSCALE_VAL_ADJUST
195 # define gcdENABLE_FSCALE_VAL_ADJUST 1
201 When set to 1, all dumps will happen in the kernel. This is handy if
202 you want the kernel to dump its command buffers as well and the data
205 #ifndef gcdDUMP_IN_KERNEL
206 # define gcdDUMP_IN_KERNEL 0
212 When set to non-zero, the command queue will dump all incoming command
213 and context buffers as well as all other modifications to the command
216 #ifndef gcdDUMP_COMMAND
217 # define gcdDUMP_COMMAND 0
223 When set to a value other than 0, a dump of the frame specified by the value,
224 will be done into frame.tga. Frame count starts from 1.
226 #ifndef gcdDUMP_FRAME_TGA
227 #define gcdDUMP_FRAME_TGA 0
232 Set to 1 for infinite speed hardware.
233 Set to 2 for bypassing the HAL.
234 Set to 3 for bypassing the drivers.
236 #ifndef gcdNULL_DRIVER
237 # define gcdNULL_DRIVER 0
241 gcdENABLE_TIMEOUT_DETECTION
243 Enable timeout detection.
245 #ifndef gcdENABLE_TIMEOUT_DETECTION
246 # define gcdENABLE_TIMEOUT_DETECTION 0
252 Number of bytes in a command buffer.
254 #ifndef gcdCMD_BUFFER_SIZE
255 # define gcdCMD_BUFFER_SIZE (128 << 10)
261 Number of command buffers to use per client.
263 #ifndef gcdCMD_BUFFERS
264 # define gcdCMD_BUFFERS 2
270 Maximum number of command buffers to use per client.
272 #ifndef gcdMAX_CMD_BUFFERS
273 # define gcdMAX_CMD_BUFFERS 8
279 Number of command queues in the kernel.
281 #ifndef gcdCOMMAND_QUEUES
282 # define gcdCOMMAND_QUEUES 2
286 gcdPOWER_CONTROL_DELAY
288 The delay in milliseconds required to wait until the GPU has woke up
289 from a suspend or power-down state. This is system dependent because
290 the bus clock also needs to stabalize.
292 #ifndef gcdPOWER_CONTROL_DELAY
293 # define gcdPOWER_CONTROL_DELAY 0
299 Enable it when GPUs with old MMU and new MMU exist at same SoC. It makes
300 each GPU use same virtual address to access same physical memory.
302 #ifndef gcdMIRROR_PAGETABLE
303 # define gcdMIRROR_PAGETABLE 0
309 Size of the MMU page table in bytes. Each 4 bytes can hold 4kB worth of
313 #if gcdMIRROR_PAGETABLE
314 # define gcdMMU_SIZE 0x200000
316 # define gcdMMU_SIZE (2048 << 10)
323 Use logical addresses instead of physical addresses in user land. In
324 this case a hint table is created for both command buffers and context
325 buffers, and that hint table will be used to patch up those buffers in
326 the kernel when they are ready to submit.
328 #ifndef gcdSECURE_USER
329 # define gcdSECURE_USER 0
333 gcdSECURE_CACHE_SLOTS
335 Number of slots in the logical to DMA address cache table. Each time a
336 logical address needs to be translated into a DMA address for the GPU,
337 this cache will be walked. The replacement scheme is LRU.
339 #ifndef gcdSECURE_CACHE_SLOTS
340 # define gcdSECURE_CACHE_SLOTS 1024
344 gcdSECURE_CACHE_METHOD
346 Replacement scheme used for Secure Cache. The following options are
350 A standard LRU cache.
352 gcdSECURE_CACHE_LINEAR
353 A linear walker with the idea that an application will always
354 render the scene in a similar way, so the next entry in the
355 cache should be a hit most of the time.
358 A 256-entry hash table.
360 gcdSECURE_CACHE_TABLE
361 A simple cache but with potential of a lot of cache replacement.
363 #ifndef gcdSECURE_CACHE_METHOD
364 # define gcdSECURE_CACHE_METHOD gcdSECURE_CACHE_HASH
368 gcdREGISTER_ACCESS_FROM_USER
370 Set to 1 to allow IOCTL calls to get through from user land. This
371 should only be in debug or development drops.
373 #ifndef gcdREGISTER_ACCESS_FROM_USER
374 # define gcdREGISTER_ACCESS_FROM_USER 1
378 gcdUSER_HEAP_ALLOCATOR
380 Set to 1 to enable user mode heap allocator for fast memory allocation
381 and destroying. Otherwise, memory allocation/destroying in user mode
382 will be directly managed by system. Only for linux for now.
384 #ifndef gcdUSER_HEAP_ALLOCATOR
385 # define gcdUSER_HEAP_ALLOCATOR 1
391 Set the allocation size for the internal heaps. Each time a heap is
392 full, a new heap will be allocated with this minmimum amount of bytes.
393 The bigger this size, the fewer heaps there are to allocate, the better
394 the performance. However, heaps won't be freed until they are
395 completely free, so there might be some more memory waste if the size is
399 # define gcdHEAP_SIZE (64 << 10)
403 gcdPOWER_SUSNPEND_WHEN_IDLE
405 Set to 1 to make GPU enter gcvPOWER_SUSPEND when idle detected,
406 otherwise GPU will enter gcvPOWER_IDLE.
408 #ifndef gcdPOWER_SUSNPEND_WHEN_IDLE
409 # define gcdPOWER_SUSNPEND_WHEN_IDLE 1
415 This define enables work arounds for FPGA images.
417 #ifndef gcdFPGA_BUILD
418 # define gcdFPGA_BUILD 0
424 This define specified the number of milliseconds the system will wait
425 before it broadcasts the GPU is stuck. In other words, it will define
426 the timeout of any operation that needs to wait for the GPU.
428 If the value is 0, no timeout will be checked for.
430 #ifndef gcdGPU_TIMEOUT
432 # define gcdGPU_TIMEOUT 0
434 # define gcdGPU_TIMEOUT 20000
443 #ifndef gcdGPU_ADVANCETIMER
444 # define gcdGPU_ADVANCETIMER 250
450 This define disalbes static linking;
452 #ifndef gcdSTATIC_LINK
453 # define gcdSTATIC_LINK 0
459 Setting this define to 1 enables new heap.
461 #ifndef gcdUSE_NEW_HEAP
462 # define gcdUSE_NEW_HEAP 0
468 This define enables no-context 2D command buffer.
470 #ifndef gcdCMD_NO_2D_CONTEXT
471 # define gcdCMD_NO_2D_CONTEXT 1
475 gcdENABLE_BANK_ALIGNMENT
477 When enabled, video memory is allocated bank aligned. The vendor can modify
478 _GetSurfaceBankAlignment() and gcoSURF_GetBankOffsetBytes() to define how
479 different types of allocations are bank and channel aligned.
480 When disabled (default), no bank alignment is done.
482 #ifndef gcdENABLE_BANK_ALIGNMENT
483 # define gcdENABLE_BANK_ALIGNMENT 0
489 Specifies the start bit of the bank (inclusive).
491 #ifndef gcdBANK_BIT_START
492 # define gcdBANK_BIT_START 12
498 Specifies the end bit of the bank (inclusive).
500 #ifndef gcdBANK_BIT_END
501 # define gcdBANK_BIT_END 14
507 When set, video memory when allocated bank aligned is allocated such that
508 render and depth buffer addresses alternate on the channel bit specified.
509 This option has an effect only when gcdENABLE_BANK_ALIGNMENT is enabled.
510 When disabled (default), no alteration is done.
512 #ifndef gcdBANK_CHANNEL_BIT
513 # define gcdBANK_CHANNEL_BIT 7
519 When non-zero, it informs the kernel driver to use the speed throttling
520 broadcasting functions to inform the system the GPU should be spet up or
521 slowed down. It will send a broadcast for slowdown each "interval"
522 specified by this define in milliseconds
523 (gckOS_BroadcastCalibrateSpeed).
525 #ifndef gcdDYNAMIC_SPEED
526 # define gcdDYNAMIC_SPEED 2000
530 gcdDYNAMIC_EVENT_THRESHOLD
532 When non-zero, it specifies the maximum number of available events at
533 which the kernel driver will issue a broadcast to speed up the GPU
534 (gckOS_BroadcastHurry).
536 #ifndef gcdDYNAMIC_EVENT_THRESHOLD
537 # define gcdDYNAMIC_EVENT_THRESHOLD 5
543 Enable profiling macros.
545 #ifndef gcdENABLE_PROFILING
546 # define gcdENABLE_PROFILING 0
552 Enable 128B merge for the BUS control.
554 #ifndef gcdENABLE_128B_MERGE
555 # define gcdENABLE_128B_MERGE 0
561 When non-zero, it specified the number of frames inside the frame
562 database. The frame DB will collect per-frame timestamps and hardware
566 # define gcdFRAME_DB 0
567 # define gcdFRAME_DB_RESET 0
568 # define gcdFRAME_DB_NAME "/var/log/frameDB.log"
577 # define gcdENABLE_VG 0
581 gcdDYNAMIC_MAP_RESERVED_MEMORY
583 When gcvPOOL_SYSTEM is constructed from RESERVED memory,
584 driver can map the whole reserved memory to kernel space
585 at the beginning, or just map a piece of memory when need
589 - It's only for the 2D openVG. For other cores, there is
590 _NO_ need to map reserved memory to kernel.
591 - It's meaningless when memory is allocated by
592 gckOS_AllocateContiguous, in that case, memory is always
593 mapped by system when allocated.
595 #ifndef gcdDYNAMIC_MAP_RESERVED_MEMORY
596 # define gcdDYNAMIC_MAP_RESERVED_MEMORY 1
600 gcdPAGED_MEMORY_CACHEABLE
602 When non-zero, paged memory will be cacheable.
604 Normally, driver will detemines whether a video memory
605 is cacheable or not. When cacheable is not neccessary,
606 it will be writecombine.
608 This option is only for those SOC which can't enable
609 writecombine without enabling cacheable.
612 #ifndef gcdPAGED_MEMORY_CACHEABLE
613 # define gcdPAGED_MEMORY_CACHEABLE 0
617 gcdNONPAGED_MEMORY_CACHEABLE
619 When non-zero, non paged memory will be cacheable.
622 #ifndef gcdNONPAGED_MEMORY_CACHEABLE
623 # define gcdNONPAGED_MEMORY_CACHEABLE 0
627 gcdNONPAGED_MEMORY_BUFFERABLE
629 When non-zero, non paged memory will be bufferable.
630 gcdNONPAGED_MEMORY_BUFFERABLE and gcdNONPAGED_MEMORY_CACHEABLE
631 can't be set 1 at same time
634 #ifndef gcdNONPAGED_MEMORY_BUFFERABLE
635 # define gcdNONPAGED_MEMORY_BUFFERABLE 1
639 gcdENABLE_INFINITE_SPEED_HW
640 enable the Infinte HW , this is for 2D openVG
643 #ifndef gcdENABLE_INFINITE_SPEED_HW
644 # define gcdENABLE_INFINITE_SPEED_HW 0
648 gcdENABLE_TS_DOUBLE_BUFFER
649 enable the TS double buffer, this is for 2D openVG
652 #ifndef gcdENABLE_TS_DOUBLE_BUFFER
653 # define gcdENABLE_TS_DOUBLE_BUFFER 1
659 Temporary define to enable/disable 6000 support.
661 #ifndef gcd6000_SUPPORT
662 # define gcd6000_SUPPORT 0
668 When non-zero, GPU will power off automatically from
669 idle state, and gcdPOWEROFF_TIMEOUT is also the default
670 timeout in milliseconds.
673 #ifndef gcdPOWEROFF_TIMEOUT
674 # define gcdPOWEROFF_TIMEOUT 300
678 gcdUSE_VIDMEM_PER_PID
680 #ifndef gcdUSE_VIDMEM_PER_PID
681 # define gcdUSE_VIDMEM_PER_PID 0
685 QNX_SINGLE_THREADED_DEBUGGING
687 #ifndef QNX_SINGLE_THREADED_DEBUGGING
688 # define QNX_SINGLE_THREADED_DEBUGGING 0
694 This define enables the recovery code.
696 #ifndef gcdENABLE_RECOVERY
697 # define gcdENABLE_RECOVERY 1
703 Number of render threads. Make it zero, and there will be no render
706 #ifndef gcdRENDER_THREADS
707 # define gcdRENDER_THREADS 0
713 This define enables SMP support.
715 Currently, it only works on Linux/Android,
716 Kbuild will config it according to whether
725 gcdSUPPORT_SWAP_RECTANGLE
727 Support swap with a specific rectangle.
729 Set the rectangle with eglSetSwapRectangleANDROID api.
731 #ifndef gcdSUPPORT_SWAP_RECTANGLE
732 # define gcdSUPPORT_SWAP_RECTANGLE 0
736 gcdGPU_LINEAR_BUFFER_ENABLED
738 Use linear buffer for GPU apps so HWC can do 2D composition.
740 #ifndef gcdGPU_LINEAR_BUFFER_ENABLED
741 # define gcdGPU_LINEAR_BUFFER_ENABLED 1
745 gcdENABLE_RENDER_INTO_WINDOW
747 Enable Render-Into-Window (ie, No-Resolve) feature on android.
748 NOTE that even if enabled, it still depends on hardware feature and
749 android application behavior. When hardware feature or application
750 behavior can not support render into window mode, it will fail back
752 When Render-Into-Window is finally used, window back buffer of android
753 applications will be allocated matching render target tiling format.
754 Otherwise buffer tiling is decided by the above option
755 'gcdGPU_LINEAR_BUFFER_ENABLED'.
757 #ifndef gcdENABLE_RENDER_INTO_WINDOW
758 # define gcdENABLE_RENDER_INTO_WINDOW 1
762 gcdSHARED_RESOLVE_BUFFER_ENABLED
764 Use shared resolve buffer for all app buffers.
766 #ifndef gcdSHARED_RESOLVE_BUFFER_ENABLED
767 # define gcdSHARED_RESOLVE_BUFFER_ENABLED 0
771 gcdUSE_TRIANGLE_STRIP_PATCH
773 #ifndef gcdUSE_TRIANGLE_STRIP_PATCH
774 # define gcdUSE_TRIANGLE_STRIP_PATCH 1
778 gcdENABLE_OUTER_CACHE_PATCH
780 Enable the outer cache patch.
782 #ifndef gcdENABLE_OUTER_CACHE_PATCH
783 # define gcdENABLE_OUTER_CACHE_PATCH 0
786 #ifndef gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST
788 # define gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST 1
790 # define gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST 0
794 #ifndef gcdENABLE_PE_DITHER_FIX
795 # define gcdENABLE_PE_DITHER_FIX 1
798 #ifndef gcdSHARED_PAGETABLE
799 # define gcdSHARED_PAGETABLE 1
802 # define gcdUSE_PVR 1
808 When non-zero, a part of VIDMEM will be reserved for requests
809 whose requesting size is less than gcdSMALL_BLOCK_SIZE.
811 For Linux, it's the size of a page. If this requeset fallbacks
812 to gcvPOOL_CONTIGUOUS or gcvPOOL_VIRTUAL, memory will be wasted
813 because they allocate a page at least.
815 #ifndef gcdSMALL_BLOCK_SIZE
816 # define gcdSMALL_BLOCK_SIZE 4096
817 # define gcdRATIO_FOR_SMALL_MEMORY 32
821 gcdCONTIGUOUS_SIZE_LIMIT
822 When non-zero, size of video node from gcvPOOL_CONTIGUOUS is
823 limited by gcdCONTIGUOUS_SIZE_LIMIT.
825 #ifndef gcdCONTIGUOUS_SIZE_LIMIT
826 # define gcdCONTIGUOUS_SIZE_LIMIT 0
829 #ifndef gcdDISALBE_EARLY_EARLY_Z
830 # define gcdDISALBE_EARLY_EARLY_Z 1
833 #ifndef gcdSHADER_SRC_BY_MACHINECODE
834 # define gcdSHADER_SRC_BY_MACHINECODE 1
840 When non-zero, driver maintains a queue to record information of
841 latest lined context buffer and command buffer. Data in this queue
844 #ifndef gcdLINK_QUEUE_SIZE
845 # define gcdLINK_QUEUE_SIZE 0
848 /* gcdALPHA_KILL_IN_SHADER
850 * Enable alpha kill inside the shader. This will be set automatically by the
851 * HAL if certain states match a criteria.
853 #ifndef gcdALPHA_KILL_IN_SHADER
854 # define gcdALPHA_KILL_IN_SHADER 1
857 /* gcdHIGH_PRECISION_DELAY_ENABLE
859 * Enable high precision schedule delay with 1ms unit. otherwise schedule delay up to 10ms.
860 * Browser app performance will have obvious drop without this enablement
862 #ifndef gcdHIGH_PRECISION_DELAY_ENABLE
863 # define gcdHIGH_PRECISION_DELAY_ENABLE 1
866 #ifndef gcdUSE_WCLIP_PATCH
867 # define gcdUSE_WCLIP_PATCH 1
870 #ifndef gcdHZ_L2_DISALBE
871 # define gcdHZ_L2_DISALBE 1
874 #ifndef gcdBUGFIX15_DISABLE
875 # define gcdBUGFIX15_DISABLE 1
878 #ifndef gcdDISABLE_HZ_FAST_CLEAR
879 # define gcdDISABLE_HZ_FAST_CLEAR 1
882 #ifndef gcdUSE_NPOT_PATCH
883 #define gcdUSE_NPOT_PATCH 1
890 #ifndef gcdENABLE_SPECIAL_HINT3
891 # define gcdENABLE_SPECIAL_HINT3 1
895 #ifndef gcdPRE_ROTATION
896 # define gcdPRE_ROTATION 1
903 When non-zero, software will make use of dynamic voltage and
908 # define gcdDVFS_ANAYLSE_WINDOW 4
909 # define gcdDVFS_POLLING_TIME (gcdDVFS_ANAYLSE_WINDOW * 4)
913 gcdANDROID_NATIVE_FENCE_SYNC
915 Enable android native fence sync. It is introduced since jellybean-4.2.
916 Depends on linux kernel option: CONFIG_SYNC.
919 1: Build framework for native fence sync feature, and EGL extension
920 2: Enable async swap buffers for client
921 * Native fence sync for client 'queueBuffer' in EGL, which is
922 'acquireFenceFd' for layer in compositor side.
923 3. Enable async hwcomposer composition.
924 * 'releaseFenceFd' for layer in compositor side, which is native
925 fence sync when client 'dequeueBuffer'
926 * Native fence sync for compositor 'queueBuffer' in EGL, which is
927 'acquireFenceFd' for framebuffer target for DC
929 #ifndef gcdANDROID_NATIVE_FENCE_SYNC
930 # define gcdANDROID_NATIVE_FENCE_SYNC 0
933 #ifndef gcdFORCE_MIPMAP
934 # define gcdFORCE_MIPMAP 0
938 gcdFORCE_GAL_LOAD_TWICE
940 When non-zero, each thread except the main one will load libGAL.so twice to avoid potential segmetantion fault when app using dlopen/dlclose.
941 If threads exit arbitrarily, libGAL.so may not unload until the process quit.
943 #ifndef gcdFORCE_GAL_LOAD_TWICE
944 # define gcdFORCE_GAL_LOAD_TWICE 0
947 #endif /* __gc_hal_options_h_ */