A GPU driver has two core jobs: managing the memory the GPU can access, and handing the GPU commands that use that memory. In Linux, the DRM subsystem provides the shared machinery for both. GEM and TTM manage buffer objects (BOs) and their backing storage. dma-buf and dma-fence handle sharing and synchronization. The GPU scheduler and drm_gpuvm handle job scheduling and GPU virtual address spaces.

This book explains that machinery as one system. It follows a buffer object through its life, from allocation and placement to sharing, synchronization, scheduling, mapping into GPU address spaces, command submission and shared virtual memory. Each mechanism is presented in the same order: the problem it solves and the hardware behind it, the design trade-offs, the kernel implementation, and how the amdgpu, Xe and panthor drivers use it. The code baseline is Linux 7.1.

Contents

  • 1. Overview of the DRM Subsystem
  • 2. The DRM Framework
  • 3. The GEM Object Model
  • 4. Lightweight Backing Storage
  • 5. TTM Backing Storage
  • 6. Sharing Buffer Objects
  • 7. Synchronizing Asynchronous Access
  • 8. The GPU Scheduler Framework
  • 9. GPU Virtual Address Spaces
  • 10. Command Submission and Scheduling
  • 11. Shared Virtual Memory
  • Appendix A. Debugging DRM in the Kernel
  • Appendix B. Kernel Foundations

Who it is for

  • Kernel and driver engineers working on GPUs, NPUs and other accelerators.
  • Engineers debugging VRAM leaks, eviction thrashing, fence deadlocks or submission timeouts in a DRM driver.
  • Developers of user-space graphics and compute stacks (Mesa, ROCm, oneAPI) who want to know what the kernel does with their buffers and jobs.

Readers are expected to know C and basic operating-system concepts. Background on Linux memory management and locking is introduced where it is needed.