James Jones - Unix Device Memory Allocation

Slides, Video

Linux and Unix in general have been plagued by lack of a standardized way to allocate graphics and other accelerated device memory in userspace for quite some time. The DRM kernel interfaces expose only vendor-specific allocation methods not suitable for direct use in applications. DMA-BUF enables sharing of DMA-capable memory buffers between multiple kernel drivers, but lacks a standardized allocation interface that can guarantee optimal or even compatible memory parameters for all desired devices, and is limited to system memory, limiting its usefulness for GPUs with separate local device memory. GBM is a de-factor standard supported by many drivers for allocating memory that can be scanned out, but is not expressive enough to enable ideal memory allocation behavior on all devices. Gralloc is a system component similar in nature to GBM used in Android to allocate graphics memory, but it shares similar limitations to GBM when used outside of a fixed-configuration system such as a system-on-a-chip.

We should take the time to discuss vendor and application developer requirements as well as design proposals for a unified device memory allocation API. This would enable one interface that the following classes of applications could use:

  • non-X11 window systems and compositors.

  • Embedded devices with no window system

  • Applications sharing memory between graphics engines and related engines on the same device, such as video encoders and decoders.

Ideally the outcome would be a consensus design proposal, or at a minimum, a consensus set of requirements from which a design proposal could be formed in the future.