This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to increase CMA memory for OpenGL ?
#1
I am using OpenPlotter on a Rpi3B+ with all the latest updates.
Kernal Version 4.19.30-v7+
OpenCPN V5.0
OpenPlotter is an access point for all on-board WiFi devices.

OpenGL driver with Fake KMS (real kms caused some problems with resolution if started headless).
I have the memory split set to it's lowest value since it makes no difference to the OpenGL driver.

Everything is working very well EXCEPT I get the occasional hang of the display system.

The system can run for days and then one user input like changing scale or changing to/from north/course up sometimes causes the display to hang up.
In this case the cursor still works, everything else is still running but the display is mostly frozen.
If I connect with VNC from another machine a window pops up saying a user is connected.
I can also use PUTTY to connect and view the log.
In every case there is an error from the VC4 driver stating that it can not allocate memory from CMA.

Quote:pi@openplotter:~ $ dmesg
[21965.710804] [drm:vc4_bo_create [vc4]] *ERROR* Failed to allocate from CMA:
[21965.710817] [drm]                            V3D: 176852kb BOs (345)
[21965.710821] [drm]                     V3D shader:    412kb BOs (100)
[21965.710824] [drm]                           dumb:   3088kb BOs (2)
[21965.710833] vc4_v3d 3fc00000.v3d: Failed to allocate memory for tile binning: -12. You may need to enable CMA or give it more memory.
pi@openplotter:~ $

It looks like OpenPlotter is configured with 256M of CMA memory.

I'd like to test this with a larger amount of CMA memory and see if it resolves the problem, but I am not sure how to configure that ?

There is a lot of conflicting information about this. Perhaps someone who knows can explain it to me.
Can I configure a dynamic memory split as described here:https://elinux.org/RPiconfig ?
  Reply
#2
I think you are not running the latest kernel. Please try with a fresh latest raspbian.

Have you played with "GPU Memory" in raspberry pi configuration-performance?
  Reply
#3
I am at Kernal Version 4.19.30-v7+
Is there a "Next" branch that I should be trying ?

Yes, I have tested the GPU memory from max to min with no effect.
I see some posts by Eric Arnholt saying that this parameter is ignored by the New driver ?

I wrote to Eric Arnholt asking for his input, will post here if he answers.

Cheers,
JM.
  Reply
#4
ops sorry, I guess you are running the beta kernel. The stable is 4.14.98
  Reply
#5
(04-03-2019, 03:41 PM)Sailoog Wrote: ops sorry, I guess you are running the beta kernel. The stable is 4.14.98

I'm trying to figure out how to change the CMA memory size to see if that makes any difference.
I still have memory available.

Perhaps you might know ?

When I look at 
Code:
/boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

I see something different from what gets reported at boot in dmesg:

Code:
[    0.000000] Kernel command line: 8250.nr_uarts=0 cma=256M bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[

Where is that coming from ?
Thanks,
JM.
  Reply
#6
Eric Arnholt responded:

Hi Eric,

I am getting an error message from your VC4 code.
It happens infrequently but approximately once a day if the system is in
use.
The distribution is specific for marine navigation: OpenPlotter
http://sailoog.com/openplotter
The application that I think is causing the problem is a marine charting
program called OpenCPN.
It displays a moving map display and other information, sometimes quilting
together several charts to create the display. There is also rotation for
course up modes and display of other information such as routes and tracks.

The error that I see is:

pi@openplotter:~ $ dmesg

[21965.710804] [drm:vc4_bo_create [vc4]] *ERROR* Failed to allocate from
CMA:
[21965.710817] [drm] V3D: 176852kb BOs (345)
[21965.710821] [drm] V3D shader: 412kb BOs (100)
[21965.710824] [drm] dumb: 3088kb BOs (2)
[21965.710833] vc4_v3d 3fc00000.v3d: Failed to allocate memory for tile
binning: -12. You may need to enable CMA or give it more memory.
pi@openplotter:~ $

I am not suggesting that this is an error in your code, I may simply be
running out of Graphics memory.
It appears that the memory is already set at 256M.


pi@openplotter:~ $ dmesg | grep cma

[ 0.000000] cma: Reserved 256 MiB at 0x1ec00000

[ 0.000000] Kernel command line: 8250.nr_uarts=0 cma=256M
bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2708_fb.fbswap=1
vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0
console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4
elevator=deadline fsck.repair=yes rootwait

[ 0.000000] Memory: 685600K/970752K available (8192K kernel code, 612K
rwdata, 2148K rodata, 1024K init, 821K bss, 23008K reserved, 262144K
cma-reserved)

[ 3.600272] vc_sm_cma: module is from the staging directory, the
quality is unknown, you have been warned.

[ 3.602447] bcm2835_vc_sm_cma_probe: Videocore shared memory driver

pi@openplotter:~ $



I see that you have implemented a patch to allow more than 256M, but I'm
not sure if that is in the Kernel version I am using ( 4.19.30-v7+) ?

Response:
It's already in. You can hack your kernel build to increase the value
in the overlay, but honestly if you're running out at 256, another 128
or so (you can't go too high or linux will just fail) likely isn't going
to help you, and you probably need to work on slimming down your
application.

So, CMA memory can be increased at Kernal buid time, but, probably not worth it.

I will persue this on the OpenCPN fourm.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)