Difference between revisions of "How to activate the Gcnano GPU debug mode"

[quality revision] [pending revision]
m (Replaced content with "<noinclude> {{ArticleMainWriter|VincentA}} {{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved version | Automatic approval (article under construc...")
(Tag: Replaced)
m
 



Under construction.png Coming soon

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


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]

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]

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]

bitbake gcnano-driver

copy the generated module galcore.ko on the target


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

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]

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]

2.2.1 Setting of debug level[edit]

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]

export LIBGAL_DEBUG_FILE=debug_trace.txt

2.2.3 Activation of the debug zone tracing[edit]

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]

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]

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]

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]

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]

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]
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]

In order to increase stack trace depth :

export LIBGAL_DUMP_API_DEPTH=2

Default value is 1.


2.3 Log redirection to terminal[edit]

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]

To activate traces :

export VIV_TRACE=1

To deactivate traces :

export VIV_TRACE=0

<noinclude>

{{ArticleMainWriter|VincentA}}
{{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved version | Automatic approval (article under construction) | 19Feb’19}}{{ReviewsComments|PCO (W803) : "gcnano" in the article name and in the article (we have to be homogeneous), to be discussed together with NSA}}
{{ReviewsComments|PCO (W803) : Please clarify with NSA if the category STM32MP1 should be use or not}}
{{ReviewsComments|PCO (W803) : Please avoid using class="wikitable" as this is not required and may impact the overall style in the future}}

==Activation of traces in the Gcnano kernel driver==
{{ReviewsComments|PCO (W803) : Please be more explicit: '''GPU''' Kernel driver sources are available, please follow this article... (devtool...)}}

Kernel driver sources are available.

In order to activate traces, 2 steps are required : 
{{ReviewsComments|PCO (W803) : but you listed 3 steps ;-)}}
* activation of trace 
* selection of the debugZone & setting of the trace level (depending on what traces are expected)
* regeneration of the module : galcore.ko
===Step 1 : trace activation ===
{{ReviewsComments|PCO (W803) : please use instead a code template highligting the important line}}
In the file '''hal/kernel/inc/gc_hal_types.h''', define ''gcdDEBUG''

 #define gcdDEBUG   gcdDEBUG_TRACE

===Step 2 : selection of the debugZone & trace level setting===
{{ReviewsComments|PCO (W803) : please use instead a code template highligting the important line}}
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)<br />

Possible values are listed below. '''OR''' should be done in order to activate several traces.<br />


{| class="wikitable"
|-
! _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.<br />

possible values are : 

{| class="wikitable"
|-
|gcvLEVEL_NONE   
|-
|gcvLEVEL_ERROR 
|-
|gcvLEVEL_WARNING      
|-
|gcvLEVEL_INFO   
|-
|gcvLEVEL_VERBOSE  
|}

===Step 3 : regeneration of the module===
{{ReviewsComments|PCO (W803) : we may refer to the page how to rebuild a single module...}}
 bitbake gcnano-driver

copy the generated module '''galcore.ko''' on the target
{{ReviewsComments|PCO (W803) : could be nice to tell where, how... or to refer to the article how to rebuild a single module...}}

==Activation of traces in the Gcnano userland libraries==
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)'''

{{ReviewsComments|PCO (W803) : we should use something different than "(not yet available in current BL)...}}

===Usage of dedicated Vivante debug API===

{|
|-
! 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.<br />

A define is provided for each debug zone : 
* debug zones for EGL module :<br />

cf. driver/Khronos/libEGL/source/gc_egl.h<br />

ex. : #define gcdZONE_EGL_API
* debug zones for ES11 module : <br />

cf. driver/Khronos/libGLESv11/gc_glff_basic_defines.h<br />

ex. : #define glvZONE_BUFFER
* debug zones for ES20 module : <br />

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

* debug zones for ES30 module : <br />

cf. driver/Khronos/libglesv3/include/chip/chip_base.h<br />

ex. : #define glvZONE_BUFFER
* debug zones for VG11 module : <br />

cf. driver/hronos/libOpenVG_3D/vg11/driver/gc_vgsh_defs.h<br />

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'''.
{{ReviewsComments|PCO (W803) : we need to find a way to point directly to the documentation : (}}

===Setting of dedicated '''env variables'''===

==== Setting of debug level ====
 export LIBGAL_DEBUG_LEVEL=''value''
Possible ''value'' are : 
{| class="wikitable"
|-
| -1 || No message
|-
| 0 || error debug info message
|-
| 1 || warning & error message
|-
| 2 || info, warning & error message
|-
| 3 || all debug info
|}

==== Filename definition of the debug file ====

 export LIBGAL_DEBUG_FILE=debug_trace.txt

====Activation of the debug zone tracing====
Debug zone tracing can be activated for the following modules : 
* EGL module
* ES11 module
* ES30 module (ES20 in also handled here)
* VG11<br />


===== EGL module debug zones=====

Activation of debug zones : 
 export LIBGAL_DEBUG_ZONE_EGL=''value''

''value'' is OR result of the zone IDs listed below :
{| class="wikitable"
|-
! 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=

===== ES11 module debug zones=====

Activation of debug zones :
 export LIBGAL_DEBUG_ZONE_ES11=''value''

''value'' is OR result of the zone IDs listed below :
{| class="wikitable"
|-
! 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=

===== ES30 module debug zones =====

Activation of debug zones :
 export LIBGAL_DEBUG_ZONE_ES30=''value''

''value'' is OR result of the zone IDs listed below :
{| class="wikitable"
|-
! 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=

===== VG11 module debug zones =====

Activation of debug zones : 
 export LIBGAL_DEBUG_ZONE_VG11=''value''

''value'' is OR result of the zone IDs listed below :
{| class="wikitable"
|-
! 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=

==== Debug by call stack ====

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

===== Setting of API dump zone =====

 export LIBGAL_DUMP_API_ZONES=''value''

''value'' is the OR result of the following value :

{| class="wikitable"
|-
! 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)           
|-                                        
|}

===== Setting of dump API depth =====

In order to increase stack trace depth : 

 export LIBGAL_DUMP_API_DEPTH=2

Default value is 1.

=== Log redirection to terminal ===
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

==Activation of GLES API traces==
To '''activate''' traces :
 export VIV_TRACE=1
To '''deactivate''' traces : 
 export VIV_TRACE=0
<noinclude>
[[Category:How to trace and debug]]</noinclude>

{{UnderConstruction}}
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  +
{{ReviewsComments|PCO (W803) : "gcnano" in the article name and in the article (we have to be homogeneous), to be discussed together with NSA}}
  +
{{ReviewsComments|PCO (W803) : Please clarify with NSA if the category STM32MP1 should be use or not}}
  +
{{ReviewsComments|PCO (W803) : Please avoid using class="wikitable" as this is not required and may impact the overall style in the future}}
  +
  +
==Activation of traces in the Gcnano kernel driver==
  +
{{ReviewsComments|PCO (W803) : Please be more explicit: '''GPU''' Kernel driver sources are available, please follow this article... (devtool...)}}
  +
  +
Kernel driver sources are available.
  +
  +
In order to activate traces, 2 steps are required :
  +
{{ReviewsComments|PCO (W803) : but you listed 3 steps ;-)}}
  +
* activation of trace
  +
* selection of the debugZone & setting of the trace level (depending on what traces are expected)
  +
* regeneration of the module : galcore.ko
  +
===Step 1 : trace activation ===
  +
{{ReviewsComments|PCO (W803) : please use instead a code template highligting the important line}}
  +
In the file '''hal/kernel/inc/gc_hal_types.h''', define ''gcdDEBUG''
  +
  +
#define gcdDEBUG  gcdDEBUG_TRACE
  +
  +
===Step 2 : selection of the debugZone & trace level setting===
  +
{{ReviewsComments|PCO (W803) : please use instead a code template highligting the important line}}
  +
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)<br />
  +
Possible values are listed below. '''OR''' should be done in order to activate several traces.<br />
  +
  +
{| class="wikitable"
  +
|-
  +
! _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.<br />
  +
possible values are :
  +
  +
{| class="wikitable"
  +
|-
  +
|gcvLEVEL_NONE 
  +
|-
  +
|gcvLEVEL_ERROR
  +
|-
  +
|gcvLEVEL_WARNING     
  +
|-
  +
|gcvLEVEL_INFO 
  +
|-
  +
|gcvLEVEL_VERBOSE 
  +
|}
  +
  +
===Step 3 : regeneration of the module===
  +
{{ReviewsComments|PCO (W803) : we may refer to the page how to rebuild a single module...}}
  +
bitbake gcnano-driver
  +
  +
copy the generated module '''galcore.ko''' on the target
  +
{{ReviewsComments|PCO (W803) : could be nice to tell where, how... or to refer to the article how to rebuild a single module...}}
  +
  +
==Activation of traces in the Gcnano userland libraries==
  +
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)'''
  +
  +
{{ReviewsComments|PCO (W803) : we should use something different than "(not yet available in current BL)...}}
  +
  +
===Usage of dedicated Vivante debug API===
  +
  +
{|
  +
|-
  +
! 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.<br />
  +
A define is provided for each debug zone :
  +
* debug zones for EGL module :<br />
  +
cf. driver/Khronos/libEGL/source/gc_egl.h<br />
  +
ex. : #define gcdZONE_EGL_API
  +
* debug zones for ES11 module : <br />
  +
cf. driver/Khronos/libGLESv11/gc_glff_basic_defines.h<br />
  +
ex. : #define glvZONE_BUFFER
  +
* debug zones for ES20 module : <br />
  +
cf. driver/Khronos/libGLESv2/driver/gc_glsh.h (not available)<br />
  +
* debug zones for ES30 module : <br />
  +
cf. driver/Khronos/libglesv3/include/chip/chip_base.h<br />
  +
ex. : #define glvZONE_BUFFER
  +
* debug zones for VG11 module : <br />
  +
cf. driver/hronos/libOpenVG_3D/vg11/driver/gc_vgsh_defs.h<br />
  +
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'''.
  +
{{ReviewsComments|PCO (W803) : we need to find a way to point directly to the documentation : (}}
  +
  +
===Setting of dedicated '''env variables'''===
  +
  +
  +
==== Setting of debug level ====
  +
export LIBGAL_DEBUG_LEVEL=''value''
  +
Possible ''value'' are :
  +
{| class="wikitable"
  +
|-
  +
| -1 || No message
  +
|-
  +
| 0 || error debug info message
  +
|-
  +
| 1 || warning & error message
  +
|-
  +
| 2 || info, warning & error message
  +
|-
  +
| 3 || all debug info
  +
|}
  +
  +
  +
==== Filename definition of the debug file ====
  +
  +
export LIBGAL_DEBUG_FILE=debug_trace.txt
  +
  +
====Activation of the debug zone tracing====
  +
Debug zone tracing can be activated for the following modules :
  +
* EGL module
  +
* ES11 module
  +
* ES30 module (ES20 in also handled here)
  +
* VG11
  +
<br />
  +
  +
===== EGL module debug zones=====
  +
  +
Activation of debug zones :
  +
export LIBGAL_DEBUG_ZONE_EGL=''value''
  +
  +
''value'' is OR result of the zone IDs listed below :
  +
{| class="wikitable"
  +
|-
  +
! 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=
  +
  +
===== ES11 module debug zones=====
  +
  +
Activation of debug zones :
  +
export LIBGAL_DEBUG_ZONE_ES11=''value''
  +
  +
''value'' is OR result of the zone IDs listed below :
  +
{| class="wikitable"
  +
|-
  +
! 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=
  +
  +
===== ES30 module debug zones =====
  +
  +
Activation of debug zones :
  +
export LIBGAL_DEBUG_ZONE_ES30=''value''
  +
  +
''value'' is OR result of the zone IDs listed below :
  +
{| class="wikitable"
  +
|-
  +
! 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=
  +
  +
===== VG11 module debug zones =====
  +
  +
Activation of debug zones :
  +
export LIBGAL_DEBUG_ZONE_VG11=''value''
  +
  +
''value'' is OR result of the zone IDs listed below :
  +
{| class="wikitable"
  +
|-
  +
! 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=
  +
  +
==== Debug by call stack ====
  +
  +
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
  +
  +
===== Setting of API dump zone =====
  +
  +
export LIBGAL_DUMP_API_ZONES=''value''
  +
  +
''value'' is the OR result of the following value :
  +
  +
{| class="wikitable"
  +
|-
  +
! 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)         
  +
|-                                       
  +
|}
  +
  +
===== Setting of dump API depth =====
  +
  +
In order to increase stack trace depth :
  +
  +
export LIBGAL_DUMP_API_DEPTH=2
  +
  +
Default value is 1.
  +
  +
  +
=== Log redirection to terminal ===
  +
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
  +
  +
==Activation of GLES API traces==
  +
To '''activate''' traces :
  +
export VIV_TRACE=1
  +
To '''deactivate''' traces :
  +
export VIV_TRACE=0
  +
 
<noinclude>
 
<noinclude>
{{ArticleMainWriter|VincentA}}
 
{{ArticleApprovedVersion | Jean-ChristopheT | Nobody | No previous approved version | Automatic approval (article under construction) | 19Feb’19}}
 
 
[[Category:How to trace and debug]]
 
[[Category:How to trace and debug]]
 
</noinclude>
 
</noinclude>
{{UnderConstruction}}
 

Attachments

Discussions