Gustavo Padovan - Bringing Android Explicit Fencing to Mainline

Slides, Video

The talk will cover the current state of Explicit Fencing on Graphics and present use cases that can benefit from it. It first appeared on Linux as the Android Sync Framework to improve buffer handling between Kernel Drivers and the HWComposer. With explicit fencing userspace is responsible for synchronize between drivers sharing the same DMA buffer. It gets the buffers’ fence from the Producer driver(GPU or Camera) and send it to the Consumer one (DRM) and vice-versa. The Consumer then wait the fence to signal before using the buffer. The fence signal when the buffer is ready for use, eg: When the GPU finishes processing it, the fence signals and the DRM driver can show it on screen.

Before only Implicit Fencing existed, where the kernel handles fencing between drivers internally with no userspace interference. There was no generic code, as each driver hacked its own implicit fencing mechanism, leading to hard to debug bugs.

Explicit fencing also enables the compositor to do a smart scheduling of buffers to display instead of dumb waiting all buffers to complete before continuing with an scanout, which could block the entire desktop if some buffer takes more time to process. With smart scheduling the compositor is aware of the state of each buffer through explicit fencing and can proceed with the scanout without waiting for all buffers. Explicit fencing is required by new APIs such as Vulkan as it allows sub-buffer processing, where fences can be assigned to different parts of the same buffer and processed in parallel.

This talk is aimed at anyone interested in Graphics in Linux, or anyone that wants to learn more about the Graphics and what the Linux Kernel Developers have been doing to further improve Graphics on Linux.


Gustavo Padovan holds a BSc. Computer Science from the University of Campinas, Brazil. He is Linux Kernel Developer and works at the open-source consultancy Collabora Ltd. In the Kernel he worked in a few different areas, in the past he was Maintainer of Bluetooth Subsystem and in the last two years has been focusing on the Graphics side of the Kernel. Gustavo lives in Brazil.