I have a Raspberry Pi 4 8GB running Raspberry Pi OS and Lakka, installed on separate SD cards.
I'm trying to set the optimal value for the GPU Memory allocation gpu_mem for improved 2D game performance.
The Raspberry Pi OS gpu_mem default is 76, I'm wondering if I should increase it to 256 or higher.
I've seen that the Lakka Linux distribution sets the default at 384.
Official Documentation says:
gpu_mem
Specifies how much memory, in megabytes, to reserve for the exclusive use of the GPU: the remaining memory is allocated to the ARM CPU for use by the OS. For Pis with less than 1GB of memory, the default is 64; for Pis with 1GB or more of memory the default is 76.
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 can be used.
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.
Question
I'm getting conflicting information. The Documentation says to set gpu_mem as low as possible, which Raspberry Pi OS does. But Lakka sets it high. If you set it high, it's taking memory away from the CPU, which may not be necessary.
That makes me think that 2D games use the gpu_mem value and 3D games use the MMU.
What does Linux consider 2D or 3D graphics? Is any game running on OpenGL or Vulkan treated as 3D and uses the MMU, even if it's 2D sprite or flat png/jpg graphics? or do only true 3D games use the MMU?