-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rpi4] 5.10.52-v7l+ Cma allocation issues after kernel upgrade (“[drm:vc4_bo_create [vc4]] *ERROR* Failed to allocate from CMA”) #1603
Comments
Do you have a gpu_mem setting? Does removing it help?
to
help? |
gpu_mem is used, as it was necessary for performance reasons in certain emulators and also (at least at some point) for Kodi for 4K playback. The fake KMS (fkms) driver is used for dispmanx support. Appended 'cma-256' to the dtoverlay parameter. The problem still persists. /proc/meminfo now reports 8192kB total, with only 1320kB available
I find no documentation for the "cma" setting to dtoverlay. Does it perhaps need a unit parameter appended to it (e.g "m") ? Excerpt from dmesg–
Again, reverting to the previous kernel restores functionality (with the same change to dtoverlay). Note the log entry for cma.
As a side-note: is it possible to now convert the /boot part to proper ext4 (in order to avoid 'Adding diversion of ') which takes forever to process (since kernels have to be shuffled around). |
I can't imagine any way emulators will benefit from gpu memory on pi4 (the opengl is on arm side and uses arm memory). LibreELEC 10 (kodi matrix) ships with gpu_mem set to default (76M) and handles 4K playback fine. |
This was for DreamCast / Redream. Several sources mentioned increasing the gpu_mem value–https://www.reddit.com/r/RetroPie/comments/cjcrnk/pi4_overclock_vs_stock_dreamcast/ For Kodi (just a quick search); https://forum.libreelec.tv/thread/23739-no-4k-playback-via-sony-str-dn1050-on-4k-beamer/ Whether that is still accurate I do not know. In any case, I have 8Gb available on the Pi, so it also made sense to reserve some of it for GPU usage. |
Note, both cma and gpu_mem must come from bottom 1GB of sdram. Having 8GB doesn't help that. The LE thread is valid for LE 9/kodi 18 (Leia) which still uses the 5.4 kernel (where hevc allocates from gpu_mem). And don't trust every random reddit user's settings. I'm sure that gpu_mem setting is hurting more than helping. |
To clarify, those sources were not the basis for using this setting. I simply provided those as I don't have the other sources immediately available. Many were from YouTube, and I did do testing at the time which revealed better performance on DreamCast. Since cma and gpu_mem are correctly allocated with the previous kernel, should't the focus be on why the newer kernel impacts core functionality due to this setting? I can't be the only one who has increased gpu_mem from 76M. |
The reason is simple. The default cma has been increased, because that gives some actual benefits (like being able to decode 4K hevc video, or getting smoother desktop performance). We are looking to add a workaround, so you don't get the higher cma default if you have an unnecessarily large gpu_mem, but that is not the best solution to the problem. |
How about giving the gpu_mem value what is left after you take away all the important stuff (up to a certain limit) i.e. gpu_mem = min(total - kernel - cma, min(gpu_mem, 256)) |
I see, thanks for the clarification. Perhaps the Wiki page (https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md) should also be updated to better specify this, as it still appears that 512 is a supported gpu_mem size– “The memory allocated to the GPU is used for display, 3D, Codec and camera purposes as well as some basic firmware housekeeping. The maximums specified below assume you are using all these features. If you are not, then smaller values of gpu_mem can be used.” The recommended maximum values are as follows:
I have not tested with 256. I also notice further below, which is in line with what you write above: “On the Raspberry Pi 4 the 3D component of the GPU has its own memory management unit (MMU), and does not use memory from the gpu_mem allocation. Instead memory is allocated dynamically within Linux. This allows a smaller value to be specified for gpu_mem on the Pi 4, compared to previous models.” This change has been present on my Pi4 for basically its entire lifetime, as Redream was one of the earliest emulators I tested. |
The docs repo is locked at the moment, but will be updated once whatever is decided here is fixed. |
i would extremely disregard reddit and youtube for retropie/emulation information, and stick to the official forums/docs. eg: https://retropie.org.uk/docs/Memory-Split/#raspberry-pi-4 (i am not sure about kodi's relationship with |
I think retropie is out of date with this comment:
if they have switched to 5.10 kernel. That is no longer true and hevc buffers are allocated from CMA. They are completely correct with:
|
kernel: dtoverlays: Add orientation (and rotation) parameter to sensor overlays See: raspberrypi/linux#4501 kernel: Adding Ablic S35390A to i2c-rtc-common.dtsi See: raspberrypi/linux#4492 kernel: configs: Add RANDOM_TRUST_BOOTLOADER=y See: #1595 kernel: char: vc_mem: Delete dead code firmware: arm_dt: Limit CMA to 256MB if total_mem < 2GB or gpu_mem > 256MB See: #1603
kernel: dtoverlays: Add orientation (and rotation) parameter to sensor overlays See: raspberrypi/linux#4501 kernel: Adding Ablic S35390A to i2c-rtc-common.dtsi See: raspberrypi/linux#4492 kernel: configs: Add RANDOM_TRUST_BOOTLOADER=y See: raspberrypi/firmware#1595 kernel: char: vc_mem: Delete dead code firmware: arm_dt: Limit CMA to 256MB if total_mem < 2GB or gpu_mem > 256MB See: raspberrypi/firmware#1603
After upgrading to kernel 5.10.52-v7l+ (w/ no other changes performed) the system no longer functions. It is able to boot, display output/splashscreen on HDMI and then subsequently the screen goes black (but still with an active signal)
Looking at the kernel log it is being flooded with:
It appears that the CmaFree is now set to zero kB available, causing all kinds of gfx issues:
Downgrading to the previously-used kernel 5.10.17-v7l+ (again, without any other changes), restores functionality. Emulationstation starts as usual, with no errors from vc4-drm logged, and CmaFree set to 212880kB.
The text was updated successfully, but these errors were encountered: