cruster
Posts: 119
Joined: Mon Sep 01, 2014 7:56 pm

Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 12:34 pm

If possible, I'd like to set aside 1024Mb of the 4Gb memory available for GPU memory use.

I've tried adding the 'gpu_mem_1024' command in config.txt which then sees me with 64Mb on reboot.
I've tried setting the maximum setting in Raspberry Pi Configuration for GPU memory, which is "896"
which doesn't work either. On a couple of occassions I have had the system lock on reboot which required me to take the SD card out and edit config.txt externally.

Can some helpful person advise me how to go about this, as I don't know why either of these methods don't appear to work?

User avatar
rpiMike
Posts: 975
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 12:43 pm

I believe the Pi4 allocates memory to the GPU as necessary.

cruster
Posts: 119
Joined: Mon Sep 01, 2014 7:56 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 12:56 pm

Thanks Mike.

If that's the case, is there an upper bound? If so, what sets it? and what should the settings be in the Raspberry Pi Configuration for GPU memory and the entry (if any) in config.txt?

Running 'vcgetcmd get_mem gpu' returns gpu=256M when GPU mem is set to 256 in Raspberry Pi configuration. But setting anything larger does not work.

jodesi
Posts: 10
Joined: Mon Feb 29, 2016 2:48 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 1:18 pm

I'm not sure if it's a fault but I set mine to max and Raspian failed to boot. I edited the config.txt via a Windows PC back to 64 and the Pi booted ok again.

Maybe it's a thing on the "to do" list but my Pi 4 (4GB) didn't play nice with high settings.

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

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 1:54 pm

You don't need to allocate that much to the GPU, 512 at the very most I would have thought.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

cruster
Posts: 119
Joined: Mon Sep 01, 2014 7:56 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 2:03 pm

Hi Jamesh

How do I go about allocating 512Mb?

Neither altering the GPU memory setting (above 256Mb) in Raspberry Pi Configuration or editing config.txt appear to work for me.
What's the correct procedure?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7523
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 2:12 pm

You need to distinguish between what resources you actually mean:

- gpu_mem in config.txt sets up the memory reserved for the VideoCore VPU. This is used for the camera and H264 video codec only. Some camera modes require 160MB, or if you try doing lots of simultaneous video decodes you'll want more, but generally you shouldn't need to increase this from defaults (64MB without the camera, or 128MB with it).
- cma= in /boot/cmdline.txt or via device tree sets up the Contiguous Memory Allocator (CMA) heap within the Linux kernel. This is used for framebuffer objects as the display rendering hardware requires contiguous memory blocks
- The new V3D hardware has an IOMMU, therefore textures are allocated from the general system memory and mapped as required.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

cruster
Posts: 119
Joined: Mon Sep 01, 2014 7:56 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 3:06 pm

Ah

Thank you for the explanation 6by9. I'd thought it was a simple split between "GPU ram" and "CPU ram"

What I'm after is as smooth playback as I can achieve in Youtube @ 1080p (actually 1280 x 800) as this Pi4 is pretty much going to be used as a media center. So whatever I can tweak to help the playback, I'd like to do!

Am I right in assuming it will make no difference to video playback what I set GPU mem to in Raspberry Pi configuration?
-and ditto-
in config.txt - as that effects the amount of memory used only by the camera? (there isn't one)

Are there any other settings that would benefit from a little manual intervention? If so, could you point me in the rght direction?

Many thanks for all the help guys !

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

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 3:11 pm

If you use LibreElec you get all this optimally set up for you. And get a funky UI as well.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7523
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 3:16 pm

cruster wrote:
Wed Jul 03, 2019 3:06 pm
Thank you for the explanation 6by9. I'd thought it was a simple split between "GPU ram" and "CPU ram"

What I'm after is as smooth playback as I can achieve in Youtube @ 1080p (actually 1280 x 800) as this Pi4 is pretty much going to be used as a media center. So whatever I can tweak to help the playback, I'd like to do!

Am I right in assuming it will make no difference to video playback what I set GPU mem to in Raspberry Pi configuration?
-and ditto-
in config.txt - as that effects the amount of memory used only by the camera? (there isn't one)

Are there any other settings that would benefit from a little manual intervention? If so, could you point me in the rght direction?
Chromium as packaged in Raspbian has patches to use the hardware video decoder where possible.
Rendering performance at the moment has a slight hiccup, but should be fixed very soon. Chromium always renders through X which isn't double buffered, therefore tearing is almost always unavoidable.
None of the settings should really require any tweaking.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

cruster
Posts: 119
Joined: Mon Sep 01, 2014 7:56 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 3:30 pm

Thank you all for the answers and suggestions

:)

jodesi
Posts: 10
Joined: Mon Feb 29, 2016 2:48 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 4:16 pm

Thanks for the information.

When I set it to max, it was via the Pi settings in Raspian. The highest was 800 plus. I'll just leave it at stock going by the above explinations. A bit curious what you meant by "codecs" are these the same codecs used for playing/enconding types of video/audio?

Thanks

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7523
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 4:25 pm

jodesi wrote:
Wed Jul 03, 2019 4:16 pm
When I set it to max, it was via the Pi settings in Raspian. The highest was 800 plus. I'll just leave it at stock going by the above explinations. A bit curious what you meant by "codecs" are these the same codecs used for playing/enconding types of video/audio?
Edited my post above to clarify that it is the H264 video codec only (both encode and decode).
Audio codecs run almost solely on the ARM.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jodesi
Posts: 10
Joined: Mon Feb 29, 2016 2:48 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 4:37 pm

6by9 wrote:
Wed Jul 03, 2019 4:25 pm
jodesi wrote:
Wed Jul 03, 2019 4:16 pm
When I set it to max, it was via the Pi settings in Raspian. The highest was 800 plus. I'll just leave it at stock going by the above explinations. A bit curious what you meant by "codecs" are these the same codecs used for playing/enconding types of video/audio?
Edited my post above to clarify that it is the H264 video codec only (both encode and decode).
Audio codecs run almost solely on the ARM.
Thanks for clearing that up.

It seems as though the software options at the moment need to catch up a bit, it's understandable given how new the Pi4 is.

User avatar
hardwaremack-orginal
Posts: 55
Joined: Fri Jun 28, 2019 7:52 pm

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 5:35 pm

Tearing is unavoidable huh.... darn.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7523
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Pi4 with 4Gb Ram. Setting max mem for GPU ?

Wed Jul 03, 2019 6:36 pm

hardwaremack-orginal wrote:
Wed Jul 03, 2019 5:35 pm
Tearing is unavoidable huh.... darn.
If x is rendering the main desktop, then yes as it doesn't double buffer. Run something like neverball full screen and that does double or triple buffer. Whether you can convince chromium to do that is a very different question. Possibly in kiosk mode, but I don't know.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.


Return to “General discussion”