## Background

Fuchsia is a new open source, microkernel-like operating system from Google. Drivers do not execute inside the Zircon kernel, instead they are privileged user-space processes.
Drivers are built using a stable [FDF](https://fuchsia.dev/docs/development/drivers/concepts/fdf).

Magma is the gpu driver architecture for Fuchsia. There are two driver components: a gpu-specific library loaded into each application's address space; and the magma system driver that manages the hardware.

## Hardware requirements

### Vulkan conformant gpu

Magma is designed to support [Vulkan](https://fuchsia.dev/docs/development/graphics/magma/concepts/vulkan), though it could be used to implement OpenGL or other graphics APIs. Fuchsia intends to support software consuming OpenGL APIs via translation to Vulkan using ANGLE.

### MMU

A memory management unit that allows arbitrary mapping of system memory pages into the GPU address space is needed for DMA to/from non-contiguous buffers.

### Per-client independent address space

For system security it's important to maintain address space isolation in the gpu domain as well as in the cpu domain.

### Unified memory architecture (UMA)

The CPU and GPU access the same physical system memory.
This may be relaxed in the future.

## Architecture

Similar to the direct rendering model on Linux, there are two driver components: a gpu-specific library loaded into each application's address space; and the magma system driver that manages the hardware.

### Magma system driver

Responsibilities:

- Initializing hardware
- Setting up memory spaces
- Setting up hardware contexts
- Mapping buffers
- Scheduling command buffers
- Handling faults
- Managing power

### Client library driver

Responsibilities:

- Implementing Vulkan 1.0/1.1/1.2 entry points
- Implementing Fuchsia extensions for import and export of external memory and semaphores
- Implementing VK_KHR_display and/or VK_KHR_swapchain for direct display access

Whereas a traditional client driver makes ioctl syscalls to communicate with a kernel driver; magma provides an interface for client drivers to communicate over IPC with the Magma system driver.

Details on the Magma interface are given in [Magma: Design](https://fuchsia.dev/docs/development/graphics/magma/concepts/design).
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/development/graphics/magma/README.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/development/graphics/magma/README.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/development/graphics/magma/README.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/development/graphics/magma/README.md "Edit the source code of this page")