User avatar
Emanuele
Posts: 177
Joined: Wed Aug 03, 2011 5:28 pm
Contact: Website

V3D/VC4 detection and legacy driver.

Tue Jun 25, 2019 6:42 am

Congratulations for the new Raspberry Pi 4.

I don't expect to get mine for a little bit yet. Basically, I am waiting to be able to buy the model I want (most likely the 4GB version) on amazon at standard price. Off-topic: based on previous experience, anyone knows when that is likely to happen (in Italy)?

I have downloaded the Buster-based Raspbian, but I might not be able to test it until this weekend.

Maybe someone can help me with a couple of doubts I have.

Based on the description, the new driver is enabled on the Raspberry Pi 4. What about the old models? Is the legacy driver still supported? Is it still the default on the official Raspbian distro? Any inside hints on when this is likely to change?

I dynamically load the legacy or the new (standard X11 code-path) OpenGL ES libraries based on the kernel module "vc4" being loaded. Will I have something similar on the Raspberry Pi 4? Is the new kernel module called "v3d"? For details, here is the code that I'm using for detection now: https://github.com/efornara/frt/blob/ma ... vprobe.cpp

Thanks

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23307
Joined: Sat Jul 30, 2011 7:41 pm

Re: V3D/VC4 detection and legacy driver.

Tue Jun 25, 2019 7:15 am

You should be able to run both the Pi3 and Pi4 in either V3D or legacy mode. The driver *should* work on both, it's just the defaults are different.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7124
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: V3D/VC4 detection and legacy driver.

Tue Jun 25, 2019 7:59 am

You'll have both "v3d" and "vc4" loaded.
"v3d" is providing the newer 3D driver.
"vc4" is providing the DRM/KMS compositing support. (It does also include the older 3D driver, but that is disabled on Pi4).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
Emanuele
Posts: 177
Joined: Wed Aug 03, 2011 5:28 pm
Contact: Website

Re: V3D/VC4 detection and legacy driver.

Tue Jun 25, 2019 10:57 am

6by9:
You'll have both "v3d" and "vc4" loaded.
Thanks, it should work as it is then, since I already detect "vc4" (but I might add "v3d" too for future-proofing it, just in case in the future vc4 won't be needed any more on the Pi4).

jamesh:
You should be able to run both the Pi3 and Pi4 in either V3D or legacy mode. The driver *should* work on both, it's just the defaults are different.
Thanks, I take "the defaults are different" as: just like before, with the new Raspbian on a Pi 0/1/2/3 out of the box you will not have accelerated Desktop OpenGL, instead you will have the old accelerated legacy OpenGL ES driver (libbrcmGLESv2.so) as default. To use the new driver (vc4) on an old Raspberry Pi, you will still have to manually enable it. Did I get this right?

User avatar
bensimmo
Posts: 4150
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: V3D/VC4 detection and legacy driver.

Tue Jun 25, 2019 11:04 am

Emanuele wrote:
Tue Jun 25, 2019 10:57 am
6by9:
You'll have both "v3d" and "vc4" loaded.
Thanks, it should work as it is then, since I already detect "vc4" (but I might add "v3d" too for future-proofing it, just in case in the future vc4 won't be needed any more on the Pi4).

jamesh:
You should be able to run both the Pi3 and Pi4 in either V3D or legacy mode. The driver *should* work on both, it's just the defaults are different.
Thanks, I take "the defaults are different" as: just like before, with the new Raspbian on a Pi 0/1/2/3 out of the box you will not have accelerated Desktop OpenGL, instead you will have the old accelerated legacy OpenGL ES driver (libbrcmGLESv2.so) as default. To use the new driver (vc4) on an old Raspberry Pi, you will still have to manually enable it. Did I get this right?
If that is true and if that is what we need to enable to get Chromium working nicely with say Scratch3 etc, then it would be nice to have that in Raspberry Configuration and Initial Boot Setup so it is easy to enable.

I was assuming it was enable for Pi2/3's by default with this 'new stack'
That and I'm getting confused what is what now.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7124
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: V3D/VC4 detection and legacy driver.

Tue Jun 25, 2019 11:16 am

bensimmo wrote:
Tue Jun 25, 2019 11:04 am
If that is true and if that is what we need to enable to get Chromium working nicely with say Scratch3 etc, then it would be nice to have that in Raspberry Configuration and Initial Boot Setup so it is easy to enable.

I was assuming it was enable for Pi2/3's by default with this 'new stack'
That and I'm getting confused what is what now.
The configuration options for the GL driver have been in the CLI raspi-config app for many years. You are right that they are not on the GUI as it still has limitations.

The GL driver is not viable on Pi0/1 as there is a significantly greater load on RAM and the ARM.
Pi 2/3 have the issue that all the textures and frame buffers have to be allocated from the CMA heap, and that can then get fragmented. On Pi4 the 3D block has an IOMMU, therefore textures do not have to be contiguous, and the CMA heap contention is vastly reduced.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Brian Beuken
Posts: 177
Joined: Fri Jan 29, 2016 12:51 pm

Re: V3D/VC4 detection and legacy driver.

Thu Jun 27, 2019 5:19 pm

ok so finally got my Pi4 up and running and tried out a my standard OpenGLES2.0 project with
brcmEGL
bcm_host
pthread
brcmGLESv2
vchiq_arm
vcos khrn_static

and they build fine, but fall down pretty quickly when trying to run things either creating EGLcontexts or eglSwapBuffers
its not very consistant it can be one or the the other or some other EGL or OpenGL command

Can someone tell me what I need to do out of the box, Buster installed, mesa libs installed to get an old OpenGLES2.0 project to run (I realise the legacy drivers are not there, or don't work the same way)

and also once I have that, how do I get OpenGLES3.0?
Very old computer game programmer, now teaching very young computer game programmers, some very bad habits.
Wrote some book about coding Pi's and SBC's, it's out now...go get it!
http://www.scratchpadgames.net/

Brian Beuken
Posts: 177
Joined: Fri Jan 29, 2016 12:51 pm

Re: V3D/VC4 detection and legacy driver.

Mon Jul 01, 2019 7:09 am

Can you be a little clearer on how to activate v3D, on raspi-config advanced options it provides 2 options
Legacy (which we don't have)
and
...something I forgot as I'm not near my pi at the moment

to get GLES2.0/3.0 acceleration do I need to set the 2nd option?
Very old computer game programmer, now teaching very young computer game programmers, some very bad habits.
Wrote some book about coding Pi's and SBC's, it's out now...go get it!
http://www.scratchpadgames.net/

jdonald
Posts: 379
Joined: Fri Nov 03, 2017 4:36 pm

Re: V3D/VC4 detection and legacy driver.

Sat Jul 27, 2019 5:29 am

Brian Beuken wrote:
Mon Jul 01, 2019 7:09 am
to get GLES2.0/3.0 acceleration do I need to set the 2nd option?
Right, GL/GLES with fake KMS.
Can someone tell me what I need to do out of the box, Buster installed, mesa libs installed to get an old OpenGLES2.0 project to run (I realise the legacy drivers are not there, or don't work the same way)
Remove all references to -lbrcmEGL and -lbrcmGLESv2 from your program and replace with -lEGL or -lGLESv2. When you #include EGL or GLES headers, make sure you're reading from /usr/include before /opt/vc/include. The other four libraries you listed are fine.
and also once I have that, how do I get OpenGLES3.0?
Use the GLES3 headers found in /usr/include/GLES3, while their implementations remain in libGLESv2.so. Except when they aren't and you bizarrely end up having to link libGL.so too.

Return to “Graphics programming”