Bug 1405

Summary: DRM/GBM Feezes on Raspberry Pi 3 Model B+
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: embeddedAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: blocker CC: xerxes
Priority: P4    
Version: 2.4.0   
Hardware: embedded_arm   
OS: linux   
Type: DEFECT SCM Refs:
22ee0cfa7dc3f3a7ac5e30322537196dcab8b310 0094f906b423ea4ad21da5de34076e066b9122b9 43dd50a8545f8fde8198091b136aece6f062cb38 54d34cb749dd877fffcbb2d33cc3707763b94b7e 4665875ac4689885da3b4a4c45cde7c6886322e3
Workaround: ---
Bug Depends on: 1156, 1408    
Bug Blocks:    
Attachments: Log-02 (Inflated w/ Launcher0)
JStack-02 (Inflated w/ Launcher0)

Description Sven Gothel 2019-12-04 04:33:29 CET
Using a vanilla Raspberry Pi 3 Model B+ 
and 2019-09-26-raspbian-buster-lite.img
without updates, having installed:
<---
apt update
apt install openjdk-11-jre-headless openjdk-11-jdk-headless ant libdrm2 libgbm1 libgles2 libgles1 libegl1 libgl1-mesa-dri libxrandr2 libxcursor1 mesa-utils-extra
--->

DRM/GBM initialization has been passed, as well as OpenGL:
<----
GearsES2 init 0x968a59 on Thread[main-Animator#00,5,main]
Chosen GLCapabilities: GLCaps[egl cfg 0x8, vid 0x34325258: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GLES2/GLES2.hw], on-scr[.], [0xd: GL, GLES1, GLES2, VG]]
INIT GL IS: jogamp.opengl.es3.GLES3Impl
Swap Interval  1
GL Profile     GLProfile[GLES2/GLES2.hw]
GL Version     2.0 (ES profile, arb, compat[ES2], FBO, hardware) - OpenGL ES 2.0 Mesa 19.2.0-rc1 [GL 2.0.0, vendor 19.2.0 (Mesa 19.2.0-rc1)]
Quirks         [No10BitColorCompOffscreen]
Impl. class    jogamp.opengl.es3.GLES3Impl
GL_VENDOR      Broadcom
GL_RENDERER    VC4 V3D 2.1
GL_VERSION     OpenGL ES 2.0 Mesa 19.2.0-rc1
GLSL           true, has-compiler-func: true, version: OpenGL ES GLSL ES 1.0.16 / 1.0.0
GL FBO: basic true, full false
GL_EXTENSIONS  50
GLX_EXTENSIONS 28
--->
(See log-02)

Freeze occurs either:

(a) Animator thread while inflating classes (TODO: attach logs)
- Run the normal unit test
  'com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT'

(b) Animator thread within native 'glGetBooleanv(..)' (see log jstack-02)
- Run the new standalone demo 
  'com.jogamp.opengl.demos.Launcher0'
- Here we inflated all classes and native libraries upfront 

It makes no difference whether we enable or disable the mouse/key tracker.

With said animator thread, we see no picture on screen.

Disabling the animator thread shows the picture, but the freezes occurs at a later time.

To be investigates in detail.
Comment 1 Sven Gothel 2019-12-04 04:35:45 CET
22ee0cfa7dc3f3a7ac5e30322537196dcab8b310
    Bug 1405: Provide stand alone demo launcher reducing complexity
    
    The launcher script also allows inflating classes and native libs to test impact on Raspberry Pi 3 Model B+.
Comment 2 Sven Gothel 2019-12-04 04:38:29 CET
Created attachment 828 [details]
Log-02 (Inflated w/ Launcher0)
Comment 3 Sven Gothel 2019-12-04 04:39:13 CET
Created attachment 829 [details]
JStack-02 (Inflated w/ Launcher0)
Comment 4 Sven Gothel 2019-12-04 05:26:27 CET
Vanilla 2019-09-26-raspbian-buster-lite.img installation,
see Bug 1406 comment 7
Comment 5 Sven Gothel 2019-12-04 19:54:02 CET
0094f906b423ea4ad21da5de34076e066b9122b9
Bug 1406: demos.Launcher0: More tests ..
    
    Misc:
    - Remove unused SysExit..
    - showFPS=true default
    - allow setting 'useDoubleBuffer' via '-single'
    - demos.es2.GearsES2: Don't be verbose on display even w/o animator
    
    IF '-noanim', issue glWindow.display() from main thread
    instead of using the animator thread otherwise.
    This shall test the swap buffering code in single threaded mode!

43dd50a8545f8fde8198091b136aece6f062cb38
    Bug 1406: demos.Launcher0: More code path reduction: useMultiplePointerIcon must be enabled via -pointerIcon

54d34cb749dd877fffcbb2d33cc3707763b94b7e
Bug 1156, Bug 1406: NEWT DRM/GBM WindowDriver.surfaceSwap(): Pass swapInterval to optionally skip VSYNC if 0
Comment 6 Sven Gothel 2019-12-04 20:07:47 CET
(In reply to Sven Gothel from comment #5)
The demos.Launcher0 can be kicked off:

<---
cd projects/JogAmp/jogl/make
bash scripts/test-demo-launcher0.sh `which java` ../build-linux-armv6hf -time 10000 
-->

Additional test arguments to reduce code path are:
'- noanim' Disables Animator thread 'display()' calls, use main-thread instead
'-vsync 0' Disable VSYNC, i.e. no DRM page flip and select wait loop
'-mappedBuffers' Use a GPU storage mapped VBO, instead of host data to be copied to the VBO

Notable: All fails, but adding '-mappedBuffers' to the test
suddenly makes the wheel spin w/o immediate freeze!

<---
cd projects/JogAmp/jogl/make
bash scripts/test-demo-launcher0.sh `which java` ../build-linux-armv6hf -time 10000 -noanim -vsync 0 -mappedBuffers
-->
Comment 7 Sven Gothel 2019-12-04 20:13:15 CET
(In reply to Sven Gothel from comment #6)
> Notable: All fails, but adding '-mappedBuffers' to the test
> suddenly makes the wheel spin w/o immediate freeze!
> 
> <---
> cd projects/JogAmp/jogl/make
> bash scripts/test-demo-launcher0.sh `which java` ../build-linux-armv6hf
> -time 10000 -noanim -vsync 0 -mappedBuffers
> -->

False alarm, it is more like every 1/3 tests launches w/o freeze :-(
Comment 8 Sven Gothel 2019-12-04 20:19:43 CET
(In reply to Sven Gothel from comment #7)
> (In reply to Sven Gothel from comment #6)
> > Notable: All fails, but adding '-mappedBuffers' to the test
> > suddenly makes the wheel spin w/o immediate freeze!
> > 
> > <---
> > cd projects/JogAmp/jogl/make
> > bash scripts/test-demo-launcher0.sh `which java` ../build-linux-armv6hf
> > -time 10000 -noanim -vsync 0 -mappedBuffers
> > -->
> 
> False alarm, it is more like every 1/3 tests launches w/o freeze :-(

Yeah, sometimes more often it goes through .. sometimes not.
This even w/ '-vsync 1' and no '-mappedBuffers'.

Tough freeze/instability issue ..
Comment 9 Sven Gothel 2019-12-04 20:33:39 CET
4665875ac4689885da3b4a4c45cde7c6886322e3
Bug 1406, Bug 1405: demos.Launcher0: No sleep w/o animator. VSYNC setting rules (launch script w/ key tracker)

+++

Further testing including Raspi 4 (Bug 1406) 
shows that the earlier change of reducing the PointerIcon setup
commit 43dd50a8545f8fde8198091b136aece6f062cb38
increased stability.

On Raspi 4, we also see that modifying the pointer-icon
using DRM via key press 'i' (visibility) may cause a freeze
while rotation keys '<-' etc do not.
Maybe we have found one more reliable culprit here..
Comment 10 Sven Gothel 2019-12-04 21:03:24 CET
(In reply to Sven Gothel from comment #9)
> Further testing including Raspi 4 (Bug 1406) 
> shows that the earlier change of reducing the PointerIcon setup
> commit 43dd50a8545f8fde8198091b136aece6f062cb38
> increased stability.
> 
> On Raspi 4, we also see that modifying the pointer-icon
> using DRM via key press 'i' (visibility) may cause a freeze
> while rotation keys '<-' etc do not.
> Maybe we have found one more reliable culprit here..

Reproduced the freeze on a GNU/Linux x86_64 Intel Broadwell device.
See Bug 1408 comment 0.
Comment 11 Sven Gothel 2019-12-05 07:52:45 CET
Fixed, see Bug 1408 comment 7