Draw on the GPU: the desktop with OpenGL ES, apps through linux-dmabuf

The host's rasteriser has a GPU half (raster_gpu.c): the same primitives, drawn the same way, on
machines with a real GPU and OpenGL ES 3, straight into the display's buffers in a login session.
EGL and GLES are loaded at run time; without them everything is drawn on the CPU as before
(CHANDRA_GPU=0 does that too). zwp_linux_dmabuf_v1 lets apps draw on the GPU as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-30 16:42:22 -08:00
1 parent d81003f176
commit cfb25fe699
26 files changed
+2485 -105

No files matched your search

+15
View File
@@ -55,6 +55,21 @@ interface raster {
/// host surface. `format` is the wl_shm format (0 ARGB8888, 1 XRGB8888). 0 on failure.
capture: func(fd: s32, offset: s32, stride: s32, width: s32, height: s32, format: s32) -> u32;
release: func(id: u32);
/// Client buffers that live on the GPU (linux-dmabuf). A pixel format (DRM fourcc) and layout
/// (DRM modifier) the GPU reads.
record dmabuf-format { fourcc: u32, modifier: u64 }
/// `device`: the `dev_t` of the GPU clients should draw on. No formats: the host draws on the
/// CPU and takes no such buffers.
record dmabuf-support { device: u64, formats: list<dmabuf-format> }
dmabufs: func() -> dmabuf-support;
record dmabuf-plane { fd: s32, offset: u32, stride: u32 }
/// Import a buffer (the fds stay the caller's to close). 0 when the GPU can't read it.
import-dmabuf: func(planes: list<dmabuf-plane>, modifier: u64, width: s32, height: s32, fourcc: u32, y-invert: bool) -> u32;
/// What the buffer holds now as a surface, like `capture` (a copy on the GPU: the client may
/// draw into its buffer again at once). 0 on failure.
capture-dmabuf: func(id: u32) -> u32;
release-dmabuf: func(id: u32);
/// Decode the PNG or SVG file at `path` into a host image (an app icon), for `draw-image`.
/// Loading the same path again returns the same handle. 0 when it can't be read or decoded.
load-image: func(path: string) -> u32;