Hardware Reference
In-Depth Information
The Raspberry Pi firmware sets
gpu_mem=64
as the default. But just how much memory
should
you allocate to the GPU? The answer depends on what your Raspberry Pi will
be used for.
If you're using it in a headless mode (see
Hack #11
), you can set
gpu_mem
to the minimum
value of
16
. If you do this, you will need to be sure that
start_cd.elf
and
fix
up_cd.elf
are present, because they will be used instead. Be careful with this, because
video will not work at all at this minimal setting, but on the upside, it will leave 496 MiB
for the ARM CPU (this gets used by Linux userspace).
For an only slightly video-friendly option, at
gpu_mem=32
, the Linux kernel can drive the
framebuffer at 1080p, but 3D and video processing will not work properly. At
gpu_mem=128
, you will get excellent 3D and video decoding performance, but you will
leave the Linux userspace with only 384 MiB.
In the middle of the road with a 256 MiB/256 MiB split, you will give the GPU enough
memory to handle big textures, but the Linux userspace will really struggle. It is pos-
sible to increase this value up to 448 MiB, but we don't recommend exceeding 128
MiB unless you have an exceptionally GPU-intensive use case.
While the core Linux kernel is capable of running in memory-starved environments,
most userspace applications (especially graphical ones) rely on the availability of tens
of MiB of memory to run properly. The Raspberry Pi contains less memory than most
popular smartphones (for example, the Galaxy Nexus and iPhone 5 have 1 GiB, and
the Nexus 4 has 2 GiB).
Also keep in mind that Linux aggressively pre-caches available memory that is not
currently being used by applications to improve system performance. This means that
the more memory you can allocate to the ARM CPU, the better performance you'll get
from Linux.
Make a config.txt Compatible with 256 or 512 MiB
Models
It is possible to make a
config.txt
that works on both 256 MiB and 512 MiB
Raspberry Pi Model B units. To set the GPU memory to be compatible with
both units, you need to use the
gpu_mem_256
and
gpu_mem_512
parameters.
The
gpu_mem_256
parameter is used on the 256 MiB Raspberry Pi Model B,
overrides any value set in
gpu_mem=
, and is ignored entirely on the 512 MiB
Raspberry Pi Model B.
The same is true of the
gpu_mem_512
setting, except that it is used on the 512
MiB unit and ignored on the 256 MiB unit.
gpu_mem_256
has a max value of
192
, and
gpu_mem_512
has a max value of
448
.