Linux DRM (Raspberry Pi4b)

The fbdev_flush mechanism works great for targeting a single display. I would like to take advantage of the hardware stack on the RPi 4 and use both HDMI outputs. Currently when I write to /dev/fb0 both of my displays show the program output. I went looking to see if there was a secondary frame buffer (/dev/fb1) but there is not.

In doing research on this topic it seems that DRM is being used on the RPi4, and that to choose a display for my app, I will need to target the display through DRM (/sys/class/drm/card0 , card1 etc.)

Has anyone written a port for displaying selectively on the RPi4 yet? If so, could you help me get started? There doesn’t seem to be a lot of resources on how to use DRM to choose the output.

Please feel free to correct my assumptions. I’m still learning this framework.

Thanks!

/dev/fb0 on the Raspberry Pi 4 appears to simply emulate a framebuffer for compatibility. I think you would have to write a new driver that operates using the DRM kernel APIs and not the fbdev ones.

I found a site that appears to have a tutorial on how to get started with the DRM APIs. They do appear significantly more cumbersome to use than fbdev.

Perhaps there is another way to get fb1 to show up without needing to use the DRM APIs. This forum thread looks relevant.

@embeddedt Thank you very much for your reply.
I was able to get 2 frame buffers to be available in /dev/ with the following configuation in /boot/config.txt
I think the key was commenting out: dtoverlay=vc4-fkms-v3d

hdmi_pixel_encoding:0=2
hdmi_group:0=2
hdmi_mode:0=27
hdmi_ignore_edid:0=0xa5000080

hdmi_pixel_encoding:1=2
hdmi_group:1=2
hdmi_mode:1=27
hdmi_ignore_edid:1=0xa5000080

[all]
#dtoverlay=vc4-fkms-v3d
max_framebuffers=2
gpu_mem=512

Hopefully this will help someone else in the future.

Thanks!

2 Likes

@itcohorts
would you please help me to run LVGL demo on the Pi4b?
I have downloaded lvgl_linux_fb and lvgl_demo
and able to compile them to generated bin of demo, but after running demo there is nothing show on my LCD screen with no errors.

would you please give me some supports?

Thanks & Best Regards
Sui

sudo ./demo only messages as below:
The framebuffer device was opened successfully.
720x576, 16bpp
The framebuffer device was mapped to memory successfully.

@embeddedt
would you please give me an example to write Framebuffer on the RPi4B?

Thanks & Best Regards
Sui