JOGL support for VideoCore 6 with Raspberry PI 4

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL support for VideoCore 6 with Raspberry PI 4

katzii
Hello,

I've been using JOGL in the past on a Raspberry PI 2 using the VideoCore drivers, without X-Server by relying on NEWT.
I am looking to upgrade my PI to the latest PI 4 -- Does JOGL support this use case with the newest PI model?

Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Sven Gothel
Administrator
I myself only test the xorg driver lately,
also have no RaspPi 4 avail (only one RaspPi 3).

I understand the desire to run slim w/o xorg.
As long the BCM libraries etc have still the same name
and filesystem layout and are somewhat compatible
it should just work IMHO.

Best to try it :)

Long writing, short answer: We don't support it officially,
but patches and sharing experience is welcome.

~Sven

On 9/6/19 11:33 PM, katzii [via jogamp] wrote:
> Hello,
>
> I've been using JOGL in the past on a Raspberry PI 2 using the VideoCore
> drivers, without X-Server by relying on NEWT.
> I am looking to upgrade my PI to the latest PI 4 -- Does JOGL support this use
> case with the newest PI model?
>
> Thanks in advance!
>
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

katzii
Thank you for your answer, Sven. I will just go for the newer PI and try this out. If this doesn't work, I will do my best to fix this, since I really enjoy this particular use case :) So if patches are generally accepted, I would love to put the work into this.

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Sven Gothel
Administrator
On 9/7/19 5:29 AM, katzii [via jogamp] wrote:
> Thank you for your answer, Sven. I will just go for the newer PI and try this
> out. If this doesn't work, I will do my best to fix this, since I really enjoy
> this particular use case :)
There is surely also a good biz case for it as well: Less resources.
However, the use input, mouse pointer etc is rarely tested and would
need ones attention for a product. Current code base is more a
POC (proof of concept).

Shameless sadly necessary advertising:

If there are companies out there wanting this use case
or others fully supported, see
<https://jogamp.org/wiki/index.php?title=Maintainer_and_Contacts#Commercial_Support>

Other potential use cases:
<https://jogamp.org/wiki/index.php?title=SW_Tracking_Report_Feature_Objectives_Overview>

> So if patches are generally accepted, I would love
> to put the work into this.

Patches are not only generally accepted, but desired.
Go for it - thank you.

See my last posts, where you see what it takes:
- Bugzilla bug report.
  Send me or Julien a private email (see wiki maintainer) to get an account)

- the git stuff
- and so forth + patience

All or most important commits should be referenced via a bug-report,
which then also cross-references the git commits.

>
> Cheers

Cheers, Sven

Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Xerxes Rånby
In reply to this post by katzii
katzii wrote
Thank you for your answer, Sven. I will just go for the newer PI and try this out. If this doesn't work, I will do my best to fix this, since I really enjoy this particular use case :) So if patches are generally accepted, I would love to put the work into this.

Cheers
* VideoCore 6 on the Raspberry Pi 4 is only supported by the Mesa 3D drivers.
If you try to force use of the Broadcom driver then the Broadcom driver will issue an error statement that raspberry pi 4 is not supported and quit your application.

* Running OpenGL or OpenGL ES initialized using EGL without X11 on Raspberry Pi 4 is possible using the Linux Kernel Modesetting driver (KMS) API in combination with the Mesa Generic Buffer Management (GBM) API.

* KMS Cube is Mesa 3D example application that initialized EGL using GBM and KMS https://gitlab.freedesktop.org/mesa/kmscube/ This application work directly from console if you compile it and run it on a Raspberry Pi 4.

* JOGL needs to be extended in order to  support initialization of EGL using GBM/KMS. However some attempts have already been made to implement support for GBM/KMS for other linux systems:

https://jogamp.org/bugzilla/show_bug.cgi?id=1156 - Newt EGL/GBM (KMS) driver
* https://github.com/Zubnix/jogl/commits/master <- proof of concept implementation of NEWT GBM/KMS driver, try this


Cheers
Xerxes
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Xerxes Rånby
Xerxes Rånby wrote
katzii wrote
Thank you for your answer, Sven. I will just go for the newer PI and try this out. If this doesn't work, I will do my best to fix this, since I really enjoy this particular use case :) So if patches are generally accepted, I would love to put the work into this.

Cheers
* VideoCore 6 on the Raspberry Pi 4 is only supported by the Mesa 3D drivers.
If you try to force use of the Broadcom driver then the Broadcom driver will issue an error statement that raspberry pi 4 is not supported and quit your application.

* Running OpenGL or OpenGL ES initialized using EGL without X11 on Raspberry Pi 4 is possible using the Linux Kernel Modesetting driver (KMS) API in combination with the Mesa Generic Buffer Management (GBM) API.

* KMS Cube is Mesa 3D example application that initialized EGL using GBM and KMS https://gitlab.freedesktop.org/mesa/kmscube/ This application work directly from console if you compile it and run it on a Raspberry Pi 4.

* JOGL needs to be extended in order to  support initialization of EGL using GBM/KMS. However some attempts have already been made to implement support for GBM/KMS for other linux systems:

https://jogamp.org/bugzilla/show_bug.cgi?id=1156 - Newt EGL/GBM (KMS) driver
* https://github.com/Zubnix/jogl/commits/master <- proof of concept implementation of NEWT GBM/KMS driver, try this


Cheers
Xerxes
Back in 2018, i tried to make a GBM/KMS implementation: my failed attempt is now archived here: https://github.com/xranby/jogl/commits/KMS
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Sven Gothel
Administrator
In reply to this post by Xerxes Rånby
thank you Xerxes

I have added a few remarks https://jogamp.org/bugzilla/show_bug.cgi?id=1156

and love to add EGL console mode of course
as it is a very valuable use case.

~Sven

On 9/10/19 4:54 PM, Xerxes Rånby [via jogamp] wrote:

>     katzii wrote
>     Thank you for your answer, Sven. I will just go for the newer PI and try
>     this out. If this doesn't work, I will do my best to fix this, since I
>     really enjoy this particular use case :) So if patches are generally
>     accepted, I would love to put the work into this.
>
>     Cheers
>
> * VideoCore 6 on the Raspberry Pi 4 is only supported by the Mesa 3D drivers.
> If you try to force use of the Broadcom driver then the Broadcom driver will
> issue an error statement that raspberry pi 4 is not supported and quit your
> application.
>
> * Running OpenGL or OpenGL ES initialized using EGL without X11 on Raspberry
> Pi 4 is possible using the Linux Kernel Modesetting driver (KMS) API in
> combination with the Mesa Generic Buffer Management (GBM) API.
>
> * KMS Cube is Mesa 3D example application that initialized EGL using GBM and
> KMS https://gitlab.freedesktop.org/mesa/kmscube/ This application work
> directly from console if you compile it and run it on a Raspberry Pi 4.
>
> * JOGL do NOT contain support to initialize EGL using GBM/KMS, however some
> attempts have already been made to implement support for GBM/KMS for other
> linux systems:
>
> https://jogamp.org/bugzilla/show_bug.cgi?id=1156 - Newt EGL/GBM (KMS) driver
> * https://github.com/Zubnix/jogl/commits/master <- proof of concept
> implementation of NEWT GBM/KMS driver, try this
>
>
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Xerxes Rånby
This post was updated on .
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
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

katzii
Thank you very much for the wealth of information Xerxes, I will try this out as soon as my RPi4 arrives.

Cheers,
Katharina
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Xerxes Rånby
Support for starting JOGL rendering directly from console have been added to the 2.4.0 feature list and is implemented.

Jogamp 2.4.0 has now entered feature freeze: https://jausoft.com/blog/2019/11/30/jogamp-2-4-0-release-feature-freeze-complete/
Implementation details for DRM/GBM Support for JOGL(EGL) and NEWT: https://jogamp.org/bugzilla/show_bug.cgi?id=1156

The success video of a Raspberry Pi 4 starting JogAmp from console with monitor attached to HDMI 0.
Raspberry Pi 4, Raspbian buster armv6hf, video: http://www.zafena.se/support/jogamp/2.4.0-test-armv6hf-gbm/RaspberryPi4-JogAmp-2.4.0-HDMI0-console-test.mp4

armv6hf on Raspberry Pi 3b+ using Raspbian and internal 7" TFT
video: http://www.zafena.se/support/jogamp/2.4.0-test-armv6hf-gbm/armv6hf-raspbian-VC4-V3D-2.1-gbm.mp4
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

gouessej
Administrator
Great job Xerxes :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Xerxes Rånby
Great Job Sven who did all the hard work getting the initialisation stable, working around undocumented pitfalls and enabling proper mouse pointer support.

Den mån 2 dec. 2019 10:26gouessej [via jogamp] <[hidden email]> skrev:
Great job Xerxes :)
Julien Gouesse | Personal blog | Website



If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/JOGL-support-for-VideoCore-6-with-Raspberry-PI-4-tp4040046p4040160.html
To start a new topic under general, email [hidden email]
To unsubscribe from jogamp, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

gouessej
Administrator
Yes you're right but your videos can be used to tell other developers that JOGL supports the Raspberry Pi 4, it helps.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL support for VideoCore 6 with Raspberry PI 4

Xerxes Rånby
I am adding notes to the JogAmp wiki about supported Raspberry Pi configurations:
https://jogamp.org/wiki/index.php?title=Raspberry_Pi

This wikipage will also contain some troubleshooting for common Raspberry Pi pitfalls.