kario
Posts: 2
Joined: Sat Aug 17, 2019 8:54 pm

RPi 4 2GB - Cant set gpu mem above 600 / black screen

Sat Aug 17, 2019 9:00 pm

Hey all,
Im trying to setup my pi to run videos off my server as reasonably fast as possible, having a collection of 720 to 1080p to 4k files on there. I did some research and found that more memory would help that along, as the default would stutter and lag like crazy on default.

As the title says as soon as I try to increase the gpu memory on my 2gb pi somewhere above 600meg (768 didnt work, for example), the desktop does not boot up. Currently set at 600 and it everything boots up fine, videos have less stutter, etc..

According to the manual I should be able to set a max of 944 for my specific pi, so.. am I missing something or is this just broken right now?

Current res: 1920x1080 Current Memory: 600, everything else default

andrum99
Posts: 826
Joined: Fri Jul 20, 2012 2:41 pm

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Sun Aug 18, 2019 7:00 am

Timg236 (a Raspberry Pi engineer) said this:
There's no guarantee that anything > 512MB will work and is completely untested.
(At https://www.raspberrypi.org/forums/view ... 0#p1518230)

The documentation is wrong - there is a PR open to fix it - see https://github.com/raspberrypi/documentation/pull/1240.

Which values of gpu_mem have you tried? The recommendation (currently pending on that PR to the documentation) is to use a gpu_mem setting as low as possible that still allows everything to work as you expect it. Does gpu_mem=512 work OK for you?

The reason setting gpu_mem too high causes a problem is that gpu_mem gets allocated from the first 1GB of physical RAM, and there are other things that must be within that first 1GB of RAM.

The Pi 4B has two new pieces of graphics hardware compared to previous models - a Raspberry Pi-developed H.265 decoder, and the VideoCore 6 3D engine. Neither of these use the gpu_mem allocation - instead memory is allocated dynamically within Linux.

The gpu_mem block is used for:

- VPU - "Vector" processing unit - the VideoCore IV CPU basically, which is what runs the firmware "blob"
- HVS - Hardware Video Scaler
- "legacy" codecs - including H.264
- ISP - Image Sensor Pipeline - used by the camera

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Sun Aug 18, 2019 1:13 pm

kario wrote:
Sat Aug 17, 2019 9:00 pm
Hey all,
Im trying to setup my pi to run videos off my server as reasonably fast as possible, having a collection of 720 to 1080p to 4k files on there. I did some research and found that more memory would help that along, as the default would stutter and lag like crazy on default.

As the title says as soon as I try to increase the gpu memory on my 2gb pi somewhere above 600meg (768 didnt work, for example), the desktop does not boot up. Currently set at 600 and it everything boots up fine, videos have less stutter, etc..

According to the manual I should be able to set a max of 944 for my specific pi, so.. am I missing something or is this just broken right now?

Current res: 1920x1080 Current Memory: 600, everything else default
For your use case I would expect 256 would be more than adequate. But if you want 512 that would be the max I would use.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Sun Aug 18, 2019 10:34 pm

Just some anecdotal evidence, I set mine to 640MB when I first got it and haven't had an issue with it.
55:55:44:44:4C
52:4C:52:42:41

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Sun Aug 18, 2019 10:40 pm

Imperf3kt wrote:
Sun Aug 18, 2019 10:34 pm
Just some anecdotal evidence, I set mine to 640MB when I first got it and haven't had an issue with it.
Why? It won't improve performance over 256 or even 128, and just takes memory away from Linux.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

kario
Posts: 2
Joined: Sat Aug 17, 2019 8:54 pm

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Thu Aug 29, 2019 6:48 am

Good to know all the above. Ill set it down to 512 and see how else i can boost my vlc performance.
Thanks

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Thu Aug 29, 2019 8:20 am

jamesh wrote:
Sun Aug 18, 2019 10:40 pm
Imperf3kt wrote:
Sun Aug 18, 2019 10:34 pm
Just some anecdotal evidence, I set mine to 640MB when I first got it and haven't had an issue with it.
Why? It won't improve performance over 256 or even 128, and just takes memory away from Linux.
Because at the time I thought it worked the same way as a Pi3.

I've since reduced it to 64MB after reading some of your comments on the matter.
55:55:44:44:4C
52:4C:52:42:41

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Thu Aug 29, 2019 8:47 am

Imperf3kt wrote:
Thu Aug 29, 2019 8:20 am
jamesh wrote:
Sun Aug 18, 2019 10:40 pm
Imperf3kt wrote:
Sun Aug 18, 2019 10:34 pm
Just some anecdotal evidence, I set mine to 640MB when I first got it and haven't had an issue with it.
Why? It won't improve performance over 256 or even 128, and just takes memory away from Linux.
Because at the time I thought it worked the same way as a Pi3.

I've since reduced it to 64MB after reading some of your comments on the matter.
And presumably it still works fine? Why did you set it so high in the first place, I'm wondering whether we need to change some docs somewhere.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Thu Aug 29, 2019 11:07 am

I set it that high because in my use of the Pi3, I required better graphical performance, mostly hardware acceleration. Since the GPU shares its ram with the system ram, I couldn't give it much more than 256MB - I found diminishing returns beyond 224MB and it actually hurt performance if I pushed it beyond about 320MB.

So when migrating to a Pi4b, 320MB or 480MB would probably have been sufficient, and since I had extra ram available I assumed it wouldn't hurt to leave some extra dedicated to the GPU.

Alas, as you say, it doesn't work that way and is pointless.

Yes the Pi still works fine with less gpu_mem set, but I haven't yet used it for the same purposes. Mostly because it takes three hours to install.
55:55:44:44:4C
52:4C:52:42:41

navy1978
Posts: 1
Joined: Wed Sep 11, 2019 3:52 pm

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Wed Sep 11, 2019 3:54 pm

I just received a new Raspberry 4 with 4GB and I have the same problem, any suggestion?

User avatar
davidcoton
Posts: 4153
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Wed Sep 11, 2019 4:17 pm

navy1978 wrote:
Wed Sep 11, 2019 3:54 pm
I just received a new Raspberry 4 with 4GB and I have the same problem, any suggestion?
Leave gpu_mem at the default setting. This setting isn't used for display RAM on the Pi4B, instead memory is allocated directly in the main RAM area.
Signature retired

User avatar
PeterO
Posts: 5028
Joined: Sun Jul 22, 2012 4:14 pm

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Wed Sep 11, 2019 4:40 pm

navy1978 wrote:
Wed Sep 11, 2019 3:54 pm
I just received a new Raspberry 4 with 4GB and I have the same problem, any suggestion?
Yes, read the whole thread as the problem has been explained/solved already !
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Wed Sep 11, 2019 8:05 pm

navy1978 wrote:
Wed Sep 11, 2019 3:54 pm
I just received a new Raspberry 4 with 4GB and I have the same problem, any suggestion?
https://starecat.com/content/wp-content ... o-that.jpg

Don't set it to more than 512, and TBH, 256 is probably more than enough for most use cases.

Here is the newest docs on gpu_men - waiting for copy edit before being pushed to main docs site.
## gpu_mem


GPU memory in megabytes, sets the memory split between the CPU and GPU; the CPU gets the remaining memory. The minimum value is `16`; the maximum value is `192`, `448`, or `944`, depending on whether you are using a 256MB, 512MB, or 1024MB Pi. The default value is `64`. For the Raspberry Pi 4, which is available in 1GB, 2GB and 4GB versions, the minimum and maximum value are the same as for a 1GB device. GPU memory in megabytes, sets the memory split between the CPU and GPU; the CPU gets the remaining memory. The minimum value is `16`; the maximum value is `192`, `448`, or `944`, depending on whether you are using a 256MB, 512MB, or 1024MB Pi. The default value is `64`. For the Raspberry Pi 4, which is available in 1GB, 2GB and 4GB versions, the minimum and maximum values are the same as for a 1GB device.


Setting `gpu_mem` to low values may automatically disable certain firmware features, as there are some things the GPU cannot do if it has access to too little memory. So if a feature you are trying to use isn't working, try setting a larger GPU memory split. `gpu_mem` refers to memory that is addressable from the GPU, which includes the VPU, HVS, legacy codecs (e.g. H264), and camera, and on devices before the Raspberry Pi 4, the 3D system. The Raspberry Pi 4 3D system has it's own Memory Mangement Unit (MMU) so textures and other GL resources are not allocated from the `gpu_mem` but Linux system memory instead. This means that `gpu_mem` can be set to a lower value, so even if you are using the H264 and camera then 128MB will probably be enough. On earlier models without the 3D MMU, you may need up to 256 or 512 in some more unusual cases.

For performance reasons, you should set `gpu_mem` as low as possible to give the Linux system as much memory as possible. However, setting `gpu_mem` to too low values may automatically disable certain firmware features, as there are some things the GPU cannot do if it has access to too little memory. So if a feature you are trying to use isn't working, try setting a larger GPU memory split.

Values of `gpu_mem` over 512 are not recommended, will provide no performance improvements, and are untested.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
PeterO
Posts: 5028
Joined: Sun Jul 22, 2012 4:14 pm

Re: RPi 4 2GB - Cant set gpu mem above 600 / black screen

Wed Sep 11, 2019 8:45 pm

## gpu_mem


GPU memory in megabytes, sets the memory split between the CPU and GPU; the CPU gets the remaining memory. The minimum value is `16`; the maximum value is `192`, `448`, or `944`, depending on whether you are using a 256MB, 512MB, or 1024MB Pi. The default value is `64`. For the Raspberry Pi 4, which is available in 1GB, 2GB and 4GB versions, the minimum and maximum value are the same as for a 1GB device. GPU memory in megabytes, sets the memory split between the CPU and GPU; the CPU gets the remaining memory. The minimum value is `16`; the maximum value is `192`, `448`, or `944`, depending on whether you are using a 256MB, 512MB, or 1024MB Pi. The default value is `64`. For the Raspberry Pi 4, which is available in 1GB, 2GB and 4GB versions, the minimum and maximum values are the same as for a 1GB device.
Sure does need editing... That paragraph is repeated twice ! And even if it was not repeated it's not easy to read. A table would be far better !
Setting `gpu_mem` to low values may automatically disable certain firmware features, as there are some things the GPU cannot do if it has access to too little memory. So if a feature you are trying to use isn't working, try setting a larger GPU memory split. `gpu_mem` refers to memory that is addressable from the GPU, which includes the VPU, HVS, legacy codecs (e.g. H264), and camera, and on devices before the Raspberry Pi 4, the 3D system. The Raspberry Pi 4 3D system has it's own Memory Mangement Unit (MMU) so textures and other GL resources are not allocated from the `gpu_mem` but Linux system memory instead. This means that `gpu_mem` can be set to a lower value, so even if you are using the H264 and camera then 128MB will probably be enough. On earlier models without the 3D MMU, you may need up to 256 or 512 in some more unusual cases.
It would be much easier to understand if you had separate paragraphs for PrePi4 and PostPi4 information. Mixing it up like that makes it harder to find the info you are looking for.


For performance reasons, you should set `gpu_mem` as low as possible to give the Linux system as much memory as possible. However, setting `gpu_mem` to too low values may automatically disable certain firmware features, as there are some things the GPU cannot do if it has access to too little memory. So if a feature you are trying to use isn't working, try setting a larger GPU memory split.
Again, that's a repeat of what was written earlier
Values of `gpu_mem` over 512 are not recommended, will provide no performance improvements, and are untested.
HTH

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Troubleshooting”