bluerobotics / bluerobotics/BlueOS

No need for 128mb for GPU

Open
#1,759 1 comment 1 reaction 0 assignees View on GitHub
enhancement investigate
Dominant language
Vue
Stars
453
Forks
151
Avg merge
1d 3h
Merged PRs (30d)
174

Description

Today we are setting GPU mem to 128Mb, but as we are only using the camera features, we could set the GPU memory to some value as low as 32Mb without any harm. [From the docs](https://www.raspberrypi.com/documentation/computers/config_txt.html#gpu_mem):

> Important
> Unlike GPUs found on x86 machines, where increasing memory can improve 3D performance, the architecture of the VideoCore means there is no performance advantage from specifying values larger than is necessary, and in fact it can harm performance.
>
> To ensure the best performance of Linux, you should set gpu_mem to the lowest possible value. If a particular graphics feature is not working correctly, try increasing the value of gpu_mem, being mindful of the recommended maximums shown below.
>
> 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 Raspberry Pi 4, compared to previous models.
>
> On legacy kernels, 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 should be used.
>
> The recommended maximum values are as follows:
>
> total RAM | gpu_mem recommended maximum
> -- | --
> 256MB | 128
> 512MB | 384
> 1GB or greater | 512, 76 on the Raspberry Pi 4
>
> Important
> The default camera stack (libcamera2) on Raspberry Pi OS - Bullseye uses Linux CMA memory to allocate buffers instead of GPU memory so there is no benefit in increasing the GPU memory size.
>
> It is possible to set gpu_mem to larger values, however this should be avoided since it can cause problems, such as preventing Linux from booting. The minimum value is 16, however this disables certain GPU features.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the configuration that sets GPU memory to 128 MB and read how the Raspberry Pi camera features are enabled. Check the Raspberry Pi GPU memory guidance in the linked documentation, then reduce the setting to the lowest suitable value. Done means the camera features continue working with the smaller allocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
raspberry-pi
Domain
embedded-iot, robotics
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.