Raspberry PI 4 Model B and hardware graphics acceleration - Page 1
Forum section: electronics / general

author: radiolistener
author_rank: Super Contributor
timestamp: July 27, 2023, 12:08:17 am
content: Just got Raspberry PI 4 Model B 4 GB. But hdmi cable and hdmi/dvi converter is still in transit. So I'm using VNC connection through WiFi.I'm using latest Raspberry PI OS x64 2023-05-03-raspios-bullseye-arm64.imgJust stuck with graphics hardware acceleration, I'm trying to run OpenGL app which needs hardware acceleration. But it seems that Open GL works with software renederer, so the app performance is very-very slow (0.1 fps).I read that Open GL acceleration can be enabled with raspi-config from Advanced Options -> A2 GL driver. But that option is missing from my raspi-config. Some peoples wrote that there is some major changes in Raspberry PI 4, but it's not clear how to enable Open GL acceleration now. Can anybody help?Here isinxi -Gxoutput:Code:Graphics:Device-1: bcm2711-hdmi0 driver: vc4_hdmi v: N/A bus ID: N/ADevice-2: bcm2711-hdmi1 driver: vc4_hdmi v: N/A bus ID: N/ADevice-3: bcm2711-vc5 driver: vc4_drm v: N/A bus ID: N/ADisplay: x11 server: X.Org 1.20.11 driver: loaded: modesettingunloaded: fbdev s-res: 1280x1024OpenGL: renderer: V3D 4.2 v: 2.1 Mesa 20.3.5 direct render: YesIn my app glGetString(GL_RENDERER) returns "V3D 4.2".I'm not sure if it means that it uses hardware renderer or software one, but performance of my app is definitely too slow, also glxgears shows just 1 fps and youtube in firefox is too slow, so I suspect it uses software renderer.Probably it may be slow because there is no display connected to HDMI outputs. But I'm not sure, because I cannot check it, currently I don't have HDMI cable and display and using it through SSH and VNC connection. Can somebody help to solve it?This is my first raspberry pi, so I'm not familiar with their details. How to enable hardware acceleration for graphics on Raspberry PI 4?

author: radiolistener
author_rank: Super Contributor
timestamp: July 28, 2023, 04:02:04 am
content: found that opengl acceleration exists. The problem with low frame rate is probably beacuse I connect through VNC and it works for 1 fps. I can check it when I get hdmi cable with DVI converter.But found another two strange issues:1) Chromium works with extreme high lags, but CPU load is almost zero... Any idea how to fix it?2) cat /proc/cpuinfo shows the following:Code:pi@raspi:~ $ cat /proc/cpuinfoprocessor : 0BogoMIPS : 108.00Features : fp asimd evtstrm crc32 cpuidCPU implementer : 0x41CPU architecture: 8CPU variant : 0x0CPU part : 0xd08CPU revision : 3processor : 1BogoMIPS : 108.00Features : fp asimd evtstrm crc32 cpuidCPU implementer : 0x41CPU architecture: 8CPU variant : 0x0CPU part : 0xd08CPU revision : 3processor : 2BogoMIPS : 108.00Features : fp asimd evtstrm crc32 cpuidCPU implementer : 0x41CPU architecture: 8CPU variant : 0x0CPU part : 0xd08CPU revision : 3processor : 3BogoMIPS : 108.00Features : fp asimd evtstrm crc32 cpuidCPU implementer : 0x41CPU architecture: 8CPU variant : 0x0CPU part : 0xd08CPU revision : 3Hardware : BCM2835Revision : c03115Serial : 10000000********Model : Raspberry Pi 4 Model B Rev 1.5Note that it shows BCM2835 CPU, but this is old single core CPU used in raspberry pi 1. Actual chip marking on my board is Broadcom 2711. WTF?

author: Whales
author_rank: Super Contributor
timestamp: July 28, 2023, 04:16:43 am
content: Hardware accelerated OpenGL will probably only work with full Xorg. Default vncserver doesn't do that on my (desktop Radeon) computer, but I think there are workarounds like X0vnc which run a full Xorg server + vnc watching it.QuoteCould be related to the above, not sure. Test with a real monitor as a comparison.QuoteIt's wrong. It looks like it's a hardcoded string in your kernel, not actually from the CPU.https://github.com/raspberrypi/linux/issues/3022

author: thermistor-guy
author_rank: Frequent Contributor
timestamp: July 28, 2023, 05:18:47 am
content: Quote from: radiolistener on July 27, 2023, 12:08:17 amI tried PiOS and Ubuntu on an rpi4 with 8GB, without much success. So now I'm running Debian server (Bookworm) 64-bit,XFCE desktop, and tightvnc server on it. Works for me. The rpi4 is running headless, wifi off, gigabit ethernet on.Just now I connected to it from a Win7+Cygwin PC, using Tigervnc viewer over an ssh tunnel. Started firefox on the rpi,used it to watch a Tom and Jerry cartoon on YT, 720p quality, for research purposes of course. Works well enough.So if you can't get PiOS to work, give Debian + XFCE a try.

author: radiolistener
author_rank: Super Contributor
timestamp: July 28, 2023, 08:22:02 am
content: Quote from: Whales on July 28, 2023, 04:16:43 amit worksIt seems that the problem is that I don't have display, so it don't know refresh rate and limit it for 1 fps for some unknown reason.I tried to disable vblank sync mode for process with vblank_mode=0 in command line and it works. See screenshot.Well, speed is much slower than I was expected, but almost usable. And it even provides 4x hardware multisample filtering.Any idea on how to improve Open GL hardware acceleration performance on raspberry pi 4? I want a little faster graphics...Quote from: Whales on July 28, 2023, 04:16:43 amYes, it seems that this problem is due to frame rate is 1 Hz for VNC. I tried to run it with manual vblank sync mode override and lags almost disappears, now chromium is usable and I'm writing this post from my raspberry pi 4 in chromiumI run it in the following way:Code:vblank_mode=0 chromium-browserBut before this I was installed the following packages:Code:sudo apt-get install libgles2-mesa libgles2-mesa-dev xorg-dev mesa-utils freeglut3-devand also enabled flag "Out-of-process 2D canvas rasterization." on chrome://flags page. It really helps to enable hw acceleration for out-of-process rasterization (can be checked on chrome://gpu page). So these tweaks may have effect.Some people wrote that replace this string in /boot/config.txt:Code:dtoverlay=vc4-kms-v3d-pi4,cma-256with this oneCode:dtoverlay=vc4-fkms-v3d-pi4,cma-256And it helps on some older version of raspi os. This change leads to switch from Full KMS video driver to a so called Fake KMS video driver. But I didn't tried it because it already works with Full KMS driver which is more fresh and supports more features.Quote from: Whales on July 28, 2023, 04:16:43 amProbably you're right. But it also displays info about cores and part of that info is correct.I run a little code to read info directly from CPU registers and it shows the following on my rpi 4:Code:MIDR_EL1:0x410fd083: 0x0Implementer: 0x41Variant: 0x0Architecture: 0xfPartNum: 0xd08Revision: 0x3VPIDR_EL2:SIGILLREVIDR_EL1:0ID_AA64ISAR0_EL1:0x10000ID_AA64ISAR1_EL1:0MVFR0_EL1:0x200MVFR1_EL1:0x10011100MVFR2_EL1:0So, my rpi 4B CPU has MIDR_EL1=0x410fd083. I read that other people also seen such code for rpi 4.But first rpi 4 models had MIDR_EL1 with different last two digits and cpuinfo.Any other idea on how to identify actual CPU are welcome.PS: posted this message from my rpi 4

author: radiolistener
author_rank: Super Contributor
timestamp: July 28, 2023, 09:05:09 am
content: I can say rpi 4 is very hot when running firefox. I added a small heatsink on CPU from a high power motor controller, but it still heating above 70 °C under load.I found that you can monitor it's cpu temperature and throttlling state with the following commands:Code:vcgencmd measure_tempvcgencmd get_throttledget_throttled also shows low voltage state. I don't know what is the bit meaning, just found this info about bit flags:Code:0: under-voltage1: arm frequency capped2: currently throttled16: under-voltage has occurred17: arm frequency capped has occurred18: throttling has occurredmy rpi 4 showsCode:throttled=0x80000which probably means "arm frequency capped has occurred". It happens above 81 °C, probably it triggers at 82 °C and above, because at 80 and 81 °C it was still keep 0x0. Interesingly that PiOS shows red area on temperature chart (see attachment) when it reach 81 °C.It needs to put rpi 4 into paper box to prevent ventialtion and run heavy load app in order to get trottled, but it definitely needs active heatsink to sit on youtube in firefox.Regarding to a power consumption, I was pleasantly surprised that RPI 4 eats max 6 W from mains under heavy load and usual power consumption is just 2-5 W (I'm using original raspberry pi 15W power supply which provides 5 V @ 3 A according to specification).I tried to measure current consumption, but it seems that it is very sensitive to voltage drop on cheap USB cable or USB-C adapter. It consume about 300-400 mA most of the time, sometime it can rise to 600-700 mA for a second. Unfortunately I don't have good high power USB-USB-C cable to measure full max power consumption, because it shows low voltage event even when I use high power cable with 5 A power supply and no voltage drop on the input of cable, this voltage drop definitely happens on a cheap USB-micro to USB-C adapter. Because I'm using good 3 A cable.Probably 3 A PSU requirement is due to high sensitivity to voltage drop, but not because it really eats 3 AmpsDoes anybody knows which voltage drop leads to low voltage warning on rpi 4 with a new power management chip?Tried Raspberry Pi OS arm64 and armhf on my rpi 4 and found that arm64 is more stable and gives almost 30% less CPU load for firefox on youtube.

author: radiolistener
author_rank: Super Contributor
timestamp: July 28, 2023, 09:14:32 am
content: Does anybody know how to setup some usable display refresh rate for VNC connection in Raspberry Pi OS instead of 1 Hz?Currently it requires to run apps with vblank_mode=0 override, otherwise it is almost non usable. This is not comfortable.

author: Lindley
author_rank: Regular Contributor
timestamp: July 28, 2023, 07:53:53 pm
content: Web pages like this show the typical cpu temperatures before and after fitting a small fan /heatsink/case , almost any small fan will make a dramatic difference and improve its life.https://www.jeffgeerling.com/blog/2019/best-way-keep-your-cool-running-raspberry-pi-4

author: radiolistener
author_rank: Super Contributor
timestamp: July 28, 2023, 10:55:41 pm
content: Just notice that RPI 4 connects to my old WiFi router with 802.11n (2.4GHz) at 65 MBps rate. For comparison, my 10 years tablet nexus 10 connects to the same router at 130 MBps. So, I'm not sure is there some software limitation? Can I improve WiFi speed of my RPI 4?RPI 4 shows about 20 Mbit download speed and about 40 Mbit upload speed on speedtest.net. This is also strange why down speed is smaller than up speed? The router has 100 Mbit internet connection, so there is some limitation on RPI 4 side.Quote from: Lindley on July 28, 2023, 07:53:53 pmS2Pi ICE Tower looks coolJust wonder what max temperature it keeps without fan on RPI 4?

author: radiolistener
author_rank: Super Contributor
timestamp: July 30, 2023, 01:55:35 am
content: just installed mono and tried my OpenGL projects, it's incredible, it can run pretty heavy opengl game client for online game which uses a lot of shape drawing and it is almost playable (it have some lags, but I'm not sure if it happens due to VNC connection, needs to test it with real display).Here is the test of multisample antialiasing filtering, the max multisample level is x4, it is not the best, but still better than missing at all

author: Lindley
author_rank: Regular Contributor
timestamp: July 30, 2023, 09:39:13 am
content: Have you seen these free online magazines all about using and getting the most from the RPI ..https://magpi.raspberrypi.org/articles/how-to-overclock-raspberry-pi-4

author: radiolistener
author_rank: Super Contributor
timestamp: July 31, 2023, 09:03:23 am
content: I know about overclocking, but I don't want to do it, because it requires overvoltage and as result it may lead to chip damage or quick degradation. And of course it will increase heating, but it is already too hot.Regarding to heating, I tried to add 12 mm silent fan from PC case, it easily cool down CPU below 40 °C even under heavy load. But its preferred for me to keep it fan less and noise free...As I read, the BCM2711 CPU doesn't have hardware cryptographic acceleration, it seems that they forgot to add license for hardware AES instruction when designed chip. So all cryptography eats a lot of CPU and add heating, and since these days TLS cryptography is everywhere (any HTTPS connection requires it, SSH and VNC, disk encryption and many other things), it leads to additional significant CPU load and heating.It looks that they tried to improve situation by enable NEON acceleartion support in openssl, but it just improve performance for a little, it can't replace hardware cryptography acceleration instructions which give 10-20x speed improvement.Since VNC uses AES encryption, it seems that it may affect CPU load. So, I'm waiting for hdmi cable and adapter to test it on real display...

author: radiolistener
author_rank: Super Contributor
timestamp: August 04, 2023, 04:55:02 am
content: Just got hdmi adapter and connected my RPI4 to displayIt works much more smoothly than through VNC. But I found another issue related with vblank sync. All video playback and OpenGL app shows image tearing due to delayed frame swap from vblank event. It looks terrible. But I found it can be fixed with disable Compositor (xcompmgr) from raspi-config (on Advanced menu). With disabled xcompmgr image tearing disappears and vblank sync works as expected.glxgears test shows about 990-1000 fps with enabled xcompmgr and about 1450 fps with disabled xcompmgr, so disable xcompmgr also improves OpenGL performance:Code:$ vblank_mode=0 glxgearsATTENTION: default value of option vblank_mode overridden by environment.7029 frames in 5.0 seconds = 1405.637 FPS7296 frames in 5.0 seconds = 1459.048 FPS7317 frames in 5.0 seconds = 1463.390 FPS7357 frames in 5.0 seconds = 1471.392 FPS7302 frames in 5.0 seconds = 1460.214 FPS7287 frames in 5.0 seconds = 1457.341 FPS7261 frames in 5.0 seconds = 1452.113 FPSAny further ideas to improve OpenGL performance are welcome. I want to see for at least 2000-3000 fps in glxgears