longo92
Posts: 115
Joined: Mon Sep 03, 2018 3:45 pm
Location: Pisa-Italy
Contact: Website Skype

Full KMS vs Fake KMS vs Legacy driver

Mon Oct 28, 2019 3:13 pm

Hi,
i don't understand the differences between those drivers. Can you explain to me?
AFAIK the Legacy driver is the one enabled by default. In https://github.com/raspberrypi/userland ... ronos/glxx there is the implementation of Opengl ES, the opengl commands are sent by the client (the user-app) to the server. Is the server the actual opengl driver?

Thanks,
Alessandro

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6340
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Full KMS vs Fake KMS vs Legacy driver

Mon Oct 28, 2019 3:48 pm

Legacy - ARM side is a shim that passes commands to the firmware, which has a proprietary gles implementation. Requires some extra calls in the source code to work properly and is missing a lot of extensions.
KMS (currently doesn't work) - Everything happens ARM-side through the a Mesa driver and the kernel. Everything is standard and open.Software built against Mesa should 'just work'.
FKMS (Fake/Firmware KMS) - as above, but instead of relying on KMS support, it's using DispmanX.

What KMS is is a bit complicated to explain and not necessary for the user to understand. I certainly don't.

Right now, the pi 3 and earlier models use the legacy driver. In Raspbian, config.txt turns on FKMS for pi 4.

Pi 4 does not support the legacy driver, so FKMS is the only option right now if you want HW accelerated 3D support.

The long term plan is to move to KMS, but that will take a lot of work.

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

Re: Full KMS vs Fake KMS vs Legacy driver

Mon Oct 28, 2019 4:55 pm

Only thing i would add, the legacy driver will run on the Pi4, but you lose 3D acceleration/OpenGL. But sometimes it can be useful if running headless, or you want separate framebuffers on multiple displays.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

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

Re: Full KMS vs Fake KMS vs Legacy driver

Mon Oct 28, 2019 5:41 pm

ShiftPlusOne wrote:
Mon Oct 28, 2019 3:48 pm
KMS (currently doesn't work)
On pi4.
It works fine on pi2&3 (and possibly 0&1, but 3d performance will be low on those due to lack of arm cpu power).
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.

longo92
Posts: 115
Joined: Mon Sep 03, 2018 3:45 pm
Location: Pisa-Italy
Contact: Website Skype

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 11:00 am

Ok, thanks for your explanation.
can i found the source code of KMS drivers (both Fake and Full) here https://github.com/raspberrypi/linux/tr ... pu/drm/vc4, right? Instead is the legacy driver propetary closed-source (i.e., impossible to find the source code)?

Thank you,
Alessandro

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

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 11:10 am

Mostly correct.

For legacy, there are some Linux side shim libraries that talk to the GPU (the frame buffer driver for example) which are open, but the firmware side that runs on the GPU is closed.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

User avatar
Imperf3kt
Posts: 4654
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia
Contact: Twitter

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 11:43 am

6by9 wrote:
Mon Oct 28, 2019 5:41 pm
ShiftPlusOne wrote:
Mon Oct 28, 2019 3:48 pm
KMS (currently doesn't work)
On pi4.
It works fine on pi2&3 (and possibly 0&1, but 3d performance will be low on those due to lack of arm cpu power).
Not in my experience.
Last I used it my (one) screen displayed two screens one on top of the other, the top screen was static filled and stretched. The bottom, was fine, but stretched.

I've used FKMS ever since though, and my last experience with KMS was in 2016, so...
55:55:44:44:4C
52:4C:52:42:41

Rose tinted glasses are difficult to see through.

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

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 1:17 pm

Imperf3kt wrote:
Tue Oct 29, 2019 11:43 am
6by9 wrote:
Mon Oct 28, 2019 5:41 pm
ShiftPlusOne wrote:
Mon Oct 28, 2019 3:48 pm
KMS (currently doesn't work)
On pi4.
It works fine on pi2&3 (and possibly 0&1, but 3d performance will be low on those due to lack of arm cpu power).
Not in my experience.
Last I used it my (one) screen displayed two screens one on top of the other, the top screen was static filled and stretched. The bottom, was fine, but stretched.

I've used FKMS ever since though, and my last experience with KMS was in 2016, so...
Is data from 2016 likely to be relevant on code that has been in constant development since then????
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

longo92
Posts: 115
Joined: Mon Sep 03, 2018 3:45 pm
Location: Pisa-Italy
Contact: Website Skype

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 1:55 pm

I have two more questions about developing opengl application:
1) Regarding performance and power consumption: is better to use legacy or KMS?
2) Are those drivers transparent to the programmer (i.e., the executable is the same)? Or i must compile using different OpengGl library (instead of brcmGLESv2) or change the source code?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6340
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 2:06 pm

longo92 wrote: 2) Are those drivers transparent to the programmer (i.e., the executable is the same)? Or i must compile using different OpengGl library (instead of brcmGLESv2) or change the source code?
No. Legacy stuff is linked against brcm*.so files, uses headers from /opt/vc, typically uses dispmanx to create a surface, must call bcm_host_init and probably do other stuff that I'm not aware of. FKMS will work if you build against Mesa libraries, you can use SDL, GLUT or a whatever else you want to create the surface, you must not use the headers in /opt/vc/. This is how 99% of software that uses GL on Linux is built. There's no shortage of example code and tutorials on this.

In other words, you need to do special stuff to use the legacy libraries, but with FKMS things will 'just work' if you do things the way you'd normally do them on any PC.

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

Re: Full KMS vs Fake KMS vs Legacy driver

Tue Oct 29, 2019 2:13 pm

And just to add there should be very little difference in power consumption - they both use the same HW, just via different routes.

So the KMS is the better option.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

alanbork
Posts: 212
Joined: Thu Apr 23, 2020 11:18 pm

Re: Full KMS vs Fake KMS vs Legacy driver

Wed Jul 01, 2020 8:24 pm

Just to be clear: FKMS is no longer the preferred option for the Pi4. Only KMS is being developed with any real energy, and FKMS has some significant bugs relating to vsync.
retired neuroscientist. raspberry pi hacking and monitor input lag methods: https://alantechreview.blogspot.com/

tombsar
Posts: 46
Joined: Wed May 13, 2020 12:40 am

Re: Full KMS vs Fake KMS vs Legacy driver

Wed Jul 01, 2020 8:34 pm

alanbork wrote:
Wed Jul 01, 2020 8:24 pm
Just to be clear: FKMS is no longer the preferred option for the Pi4.
FKMS is the only realistic option on the Pi4 right now. The full kms driver is still experimental, and not ready for general use (hence why it is not given as an option in raspi-config).

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

Re: Full KMS vs Fake KMS vs Legacy driver

Wed Jul 01, 2020 8:42 pm

FKMS covers the majority of use cases already, but yoyu are right that the main ongoing development effort is now on full KMS.
Other than the issue over vsync timing, we will investigate any major issues within FKMS still.
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.

shal
Posts: 2
Joined: Fri Jul 03, 2020 7:59 am

Re: Full KMS vs Fake KMS vs Legacy driver

Fri Jul 03, 2020 8:12 am

I have 2 problems on Rpi3
1. Full KMS : does not work with the official DSI display.
2. Full KMS / Fake KMS : does not turn off vsync.
Are these problems resolved for Rpi4?

ELCouz
Posts: 4
Joined: Fri Jul 31, 2020 9:31 pm

Re: Full KMS vs Fake KMS vs Legacy driver

Wed Sep 02, 2020 10:50 pm

Full KMS = vc4-kms-v3d-pi4
Fake KMS = vc4-fkms-v3d
Legacy = ???


Just curious, I have some issue with FKMS on the PI4 ...I'd like to try the legacy driver (I don't care for 3d accel)... how?

plugwash
Forum Moderator
Forum Moderator
Posts: 3751
Joined: Wed Dec 28, 2011 11:45 pm

Re: Full KMS vs Fake KMS vs Legacy driver

Thu Sep 03, 2020 1:23 am

Pretty sure for legacy you don't enable any overlays at all.

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

Re: Full KMS vs Fake KMS vs Legacy driver

Thu Sep 03, 2020 6:12 am

plugwash wrote:
Thu Sep 03, 2020 1:23 am
Pretty sure for legacy you don't enable any overlays at all.
Correct.
And you can always use raspi-config to choose the mode of you don't want to mess with config.txt.
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.

jhollandaise
Posts: 3
Joined: Sun Jun 28, 2020 5:00 pm

Re: Full KMS vs Fake KMS vs Legacy driver

Thu Sep 03, 2020 9:12 am

Hi there,

First off, I have been reading various forums for a little while since getting into some lowish level RPi development and I am so grateful for your (Raspberry Pi Staff team) commitment here. This is a core part of the success of the little raspberry, committed open source open community development!

Okay so just a quick Q: I am hoping to implement some GPGPU functionality through the newly supported OPENGL|ES 3.1 compute shaders, and will be running a distributed compute setup with potentially 10s of Pis and so they will be running headless for practical reasons.
Now at this point, headless GL is not possible but it appears that it will be when the full KMS is released, am I correct in this thinking?
As a ref, I am hoping to use the headless CS technique described here:https://blogs.igalia.com/elima/2016/10/ ... nder-node/ to get started. This uses a GBM render node, which is where I believe the Pi is currently getting stuck (with just FKMS).

Cheers

anewbee
Posts: 11
Joined: Thu Jan 21, 2021 6:19 am

Re: Full KMS vs Fake KMS vs Legacy driver

Sat Jan 23, 2021 8:51 am

6by9 wrote:
Thu Sep 03, 2020 6:12 am
plugwash wrote:
Thu Sep 03, 2020 1:23 am
Pretty sure for legacy you don't enable any overlays at all.
Correct.
And you can always use raspi-config to choose the mode of you don't want to mess with config.txt.
hi,when i use the full kms ,but the vlc does not show the video on the hdmi screen which it works well by using fake kms ,is there some config else except config.txt

Return to “Graphics, sound and multimedia”