Login  Register

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Posted by Xerxes Rånby on Sep 11, 2019; 10:10pm
URL: https://forum.jogamp.org/JOGL-support-for-VideoCore-6-with-Raspberry-PI-4-tp4040046p4040066.html

I quickly merging the two EGL console mode, Linux kms/gbm, newt implementaion attempts on top of the current jogl tree, so that they both compile and can be tested/debugged:
https://github.com/xranby/jogl/commits/gbm-kms

The way I test this code while it is in development is by first compiling gluegen and jogl.
cd gluegen/make
ant
cd ../../jogl/make
ant
cd ../..

and then I test the two implementations by running:

java -Dnativewindow.ws.name=".gbm" -cp gluegen/build/gluegen-rt.jar:jogl/build/jar/jogl-all.jar com.jogamp.newt.opengl.GLWindow

java -Dnativewindow.ws.name=".linux.kms" -cp gluegen/build/gluegen-rt.jar:jogl/build/jar/jogl-all.jar com.jogamp.newt.opengl.GLWindow



make sure that kmscube work, from console without X11, on your test machine, it is precompiled and included in some distributions
sudo apt install kmscube
kmscube

To run kmscube on the Raspberry Pi 3 you need to enable Fake KMS (work with 7" TFT) or Full KMS OpenGL Driver ( only work with HDMI) using raspi-config.
sudo raspi-config -> Advanced -> Open Gl -> select Fake KMS or Full KMS -> reboot
kmscube

To run kmscube on the Raspberry Pi 4 I need to start it like this:
kmscube -D /dev/dri/card1

If i try to use the default  /dev/dri/card0 on the Pi 4 i get the exception drmModeGetResources failed: Invalid argument
/dev/dri/card1 on the other hand work.


Documentation of the Linux Kernel Mode Setting and Linux DRM API:
https://dri.freedesktop.org/docs/drm/gpu/index.html - Linux GPU Driver Developer's Guide

https://events.static.linuxfound.org/sites/events/files/slides/brezillon-drm-kms.pdf - The DRM/KMS subsystem from anewbie’s point of view

https://landley.net/kdocs/htmldocs/drm.html - Linux DRM Developer's Guide

https://dvdhrm.wordpress.com/2013/09/01/splitting-drm-and-kms-device-nodes/ - describes the difference between /dev/dri/card0 and /dev/dri/rendererD128

Code examples:
https://gitlab.freedesktop.org/mesa/kmscube/ OpenGL (ES) fullscreen cube example : this example connects and uses /dev/dri/card0

https://gist.github.com/Miouyouyou/89e9fe56a2c59bce7d4a18a858f389ef - An example, inspired by Rob Clark "kmscube.c" that uses Linux Direct Rendering Manager ( DRM ) and EGL to create an OpenGL ES 2 context. This is a standalone example, that just clears the screen with a blueish color.

https://blogs.igalia.com/elima/2016/10/06/example-run-an-opengl-es-compute-shader-on-a-drm-render-node/ - Example: Run a headless OpenGL (ES) compute shader via DRM render-nodes : this example connects and uses /dev/dri/renderD128
https://github.com/elima/gpu-playground/tree/master/render-nodes-minimal

https://waynewolf.github.io/2012/09/05/libdrm-samples/
https://waynewolf.github.io/code/post/kms-pageflip.c

https://web.archive.org/web/20140921020650/https://jan.newmarch.name/Wayland/DRM/
https://github.com/dvdhrm/docs/tree/master/drm-howto