How to activate the Gcnano GPU debug mode

Revision as of 19:23, 5 January 2021 by Registered User




1. Activation of traces in the Gcnano kernel driver[edit source]


Kernel driver sources are available.

In order to activate traces, 2 steps are required :

  • activation of trace
  • selection of the debugZone & setting of the trace level (depending on what traces are expected)
  • regeneration of the module : galcore.ko

1.1. Step 1 : trace activation[edit source]

In the file hal/kernel/inc/gc_hal_types.h, define gcdDEBUG

#define gcdDEBUG   gcdDEBUG_TRACE

1.2. Step 2 : selection of the debugZone & trace level setting[edit source]

In the file gcnano-driver/hal/kernel/gc_hal_kernel_debug.c

  • search and update the init value of _debugZones variable.(default value is gcvZONE_NONE)

Possible values are listed below. OR should be done in order to activate several traces.

_debugZones Values activated trace
gcvZONE_NONE None
gcvZONE_ALL All
gcvZONE_OS OS
gcvZONE_HARDWARE HARDWARE
gcvZONE_HEAP HEAP
gcvZONE_SIGNAL SIGNAL
gcvZONE_KERNEL KERNEL
gcvZONE_VIDMEM VIDMEM
gcvZONE_COMMAND COMMAND
gcvZONE_DRIVER DRIVER
gcvZONE_CMODEL CMODEL
gcvZONE_MMU MMU
gcvZONE_EVENT EVENT
gcvZONE_DEVICE DEVICE
gcvZONE_DATABASE DATABASE
gcvZONE_INTERRUPT INTERRUPT
gcvZONE_POWER POWER


List of define available here : gcnano-driver/hal/inc/gc_hal_base.h

  • search and update the init value of _debugLevel variable.

possible values are :

gcvLEVEL_NONE
gcvLEVEL_ERROR
gcvLEVEL_WARNING
gcvLEVEL_INFO
gcvLEVEL_VERBOSE

1.3. Step 3 : regeneration of the module[edit source]

bitbake gcnano-driver

copy the generated module galcore.ko on the target


2. Activation of traces in the Gcnano userland libraries[edit source]

First of all, redefine the symbolic links of the Gcnano libs in order to point on the debug version of the libs.

export GC_VERSION=6.2.4
cd /usr/lib
rm libEGL.so
ln -s libEGL.${GC_VERSION}.multi.debug.so libEGL.so
rm libGAL.so
ln -s libGAL.${GC_VERSION}.multi.debug.so libGAL.so
rm libgbm.so
ln -s libgbm.${GC_VERSION}.multi.debug.so libgbm.so
rm libGLESv1_CM.so
ln -s libGLESv1_CM.${GC_VERSION}.multi.debug.so libGLESv1_CM.so
rm libGLESv2.so
ln -s libGLESv2.${GC_VERSION}.multi.debug.so libGLESv2.so
rm libGLSLC.so
ln -s libGLSLC.${GC_VERSION}.multi.debug.so libGLSLC.so
rm libOpenVG.so
ln -s libOpenVG.${GC_VERSION}.multi.debug.so libOpenVG.so
rm libVDK.so
ln -s libVDK.${GC_VERSION}.multi.debug.so libVDK.so
rm libVSC.so
ln -s libVSC.${GC_VERSION}.multi.debug.so libVSC.so


Then, there are 2 methods to activate traces :

  • Dynamic activation by usage of dedicated Vivante debug API
  • Activation by setting of dedicated env variables (more complete) (not yet available in current BL)


2.1. Usage of dedicated Vivante debug API[edit source]

Primitive Usage
gcoOS_SetDebugFile open or close the debug dump file
gcoOS_ReplaceDebugFile replace the debug dump file to a new FILE pointer
gcoOS_SetDebugLevel sets the debug level
gcoOS_GetDebugLevel Retrieve the debug level
gcoOS_SetDebugZone Sets a single debug zone.

A define is provided for each debug zone :

  • debug zones for EGL module :

cf. driver/Khronos/libEGL/source/gc_egl.h
ex. : #define gcdZONE_EGL_API

  • debug zones for ES11 module :

cf. driver/Khronos/libGLESv11/gc_glff_basic_defines.h
ex. : #define glvZONE_BUFFER

  • debug zones for ES20 module :

cf. driver/Khronos/libGLESv2/driver/gc_glsh.h (not available)

  • debug zones for ES30 module :

cf. driver/Khronos/libglesv3/include/chip/chip_base.h
ex. : #define glvZONE_BUFFER

  • debug zones for VG11 module :

cf. driver/hronos/libOpenVG_3D/vg11/driver/gc_vgsh_defs.h
ex. : #define vgdZONE_TRACE

gcoOS_GetDebugZone Retrieve the debug zone
gcoOS_SetDebugZones Enable or disable debug of multiple zones
gcoOS_SetDebugLevelZone Sets both the debug level and zone.

Detailed description of this API is provided in the documentation : VIVANTE Debug API and Guide.


2.2. Setting of dedicated env variables[edit source]

2.2.1. Setting of debug level[edit source]

export LIBGAL_DEBUG_LEVEL=value

Possible value are :

-1 No message
0 error debug info message
1 warning & error message
2 info, warning & error message
3 all debug info


2.2.2. Filename definition of the debug file[edit source]

export LIBGAL_DEBUG_FILE=debug_trace.txt

2.2.3. Activation of the debug zone tracing[edit source]

Debug zone tracing can be activated for the following modules :

  • EGL module
  • ES11 module
  • ES30 module (ES20 in also handled here)
  • VG11


2.2.3.1. EGL module debug zones[edit source]

Activation of debug zones :

export LIBGAL_DEBUG_ZONE_EGL=value

value is OR result of the zone IDs listed below :

Zone ID
API (1 << 0)
SURFACE (1 << 1)
CONTEXT (1 << 2)
CONFIG (1 << 3)
OS (1 << 4)
IMAGE (1 << 5)
SWAP (1 << 6)
INIT (1 << 7)
SYNC (1 << 8)
COMPOSE (1 << 9)
RENDER_THREAD (1 << 10)

Deactivation of all debug zones :

export LIBGAL_DEBUG_ZONE_EGL=
2.2.3.2. ES11 module debug zones[edit source]

Activation of debug zones :

export LIBGAL_DEBUG_ZONE_ES11=value

value is OR result of the zone IDs listed below :

Zone ID
BUFFER (1 << 0)
CLEAR (1 << 1)
CLIP (1 << 2)
CONTEXT (1 << 3)
DRAW (1 << 4)
ENABLE (1 << 5)
EXTENTION (1 << 6)
FOG (1 << 7)
FRAGMENT (1 << 8)
LIGHT (1 << 9)
MATRIX (1 << 10)
PIXEL (1 << 11)
POLIGON (1 << 12)
LINE (1 << 13)
QUERY (1 << 14)
TEXTURE (1 << 15)
STATES (1 << 16)
STREAM (1 << 17)
VIEWPORT (1 << 18)
SHADER (1 << 19)
HASH (1 << 20)
TRACE (1 << 21)

Deactivation of all debug zones :

export LIBGAL_DEBUG_ZONE_ES11=
2.2.3.3. ES30 module debug zones[edit source]

Activation of debug zones :

export LIBGAL_DEBUG_ZONE_ES30=value

value is OR result of the zone IDs listed below :

Zone ID
BUFFER (1 << 0)
CLEAR (1 << 1)
CLIP (1 << 2)
CONTEXT (1 << 3)
DRAW (1 << 4)
ENABLE (1 << 5)
EXTENTION (1 << 6)
FOG (1 << 7)
FRAGMENT (1 << 8)
LIGHT (1 << 9)
MATRIX (1 << 10)
PIXEL (1 << 11)
POLIGON (1 << 12)
LINE (1 << 13)
QUERY (1 << 14)
TEXTURE (1 << 15)
STATES (1 << 16)
STREAM (1 << 17)
VIEWPORT (1 << 18)
SHADER (1 << 19)
HASH (1 << 20)
TRACE (1 << 21)

Deactivation of all debug zones :

export LIBGAL_DEBUG_ZONE_ES30=
2.2.3.4. VG11 module debug zones[edit source]

Activation of debug zones :

export LIBGAL_DEBUG_ZONE_VG11=value

value is OR result of the zone IDs listed below :

Zone ID
TRACE (1 << 0)
STATE (1 << 1)
FONT (1 << 2)
HARDWARE (1 << 3)
IMAGE (1 << 4)
MASK (1 << 5)
MATRIX (1 << 7)
PATH (1 << 8)
PAINT (1 << 9)
TESSELLATOR (1 << 10)
VGU (1 << 11)

Deactivation of all debug zones :

export LIBGAL_DEBUG_ZONE_VG11=

2.2.4. Debug by call stack[edit source]

2 parameters should be set :

  • specification of modules that should be traces : dump API zones
  • specification of call stack depth : dump API depth

Debug level should be also be set accordingly :

export LIBGAL_DEBUG_LEVEL=3
2.2.4.1. Setting of API dump zone[edit source]
export LIBGAL_DUMP_API_ZONES=value

value is the OR result of the following value :

Module ID
Others (1 << 0)
HAL (1 << 1)
EGL (1 << 2)
ES11 (1 << 3)
ES20 (1 << 4)
VG11 (1 << 5)
GL (1 << 6)
DFB (1 << 7)
GDI (1 << 8)
D3D (1 << 9)
CL (1 << 10)
VX (1 << 11)
2.2.4.2. Setting of dump API depth[edit source]

In order to increase stack trace depth :

export LIBGAL_DUMP_API_DEPTH=2

Default value is 1.


2.3. Log redirection to terminal[edit source]

In order to see log in terminal, start weston with tty enabled:

weston --tty=1

Add before the wanted trace levels :

LIBGAL_DEBUG_LEVEL=3 LIBGAL_DEBUG_ZONE_EGL=255 LIBGAL_DUMP_API_ZONES=255 VIV_TRACE=1 weston --tty=1 &

Then launch your use-case

weston-simple-egl 

When done kill weston which run in background:

kill %1

3. Activation of GLES API traces[edit source]

To activate traces :

export VIV_TRACE=1

To deactivate traces :

export VIV_TRACE=0