cairo/boilerplate
Alberto Ruiz 543c14a8b1 Add GBM surface backend for zero-copy GPU buffer sharing
Add a new surface backend that allocates pixel buffers through GBM
(Generic Buffer Manager), allowing Cairo-rendered content to be
imported directly by GPU compositors via DMA-BUF file descriptors
without an intermediate memory copy.

The backend renders on the CPU via pixman (like the image backend)
but allocates its buffer through GBM with a linear modifier, making
it suitable for zero-copy handoff to GPU-based compositors such as
Mutter/Clutter (GNOME) or GSK (GTK 4).

New public API (cairo-gbm.h):
  - cairo_gbm_surface_create()         — allocate a new GBM-backed surface
  - cairo_gbm_surface_create_for_bo()  — wrap an existing gbm_bo
  - cairo_gbm_surface_get_bo()         — retrieve the underlying gbm_bo
  - cairo_gbm_surface_get_dma_buf_fd() — export a DMA-BUF fd for the buffer

Build integration:
  - New 'gbm' meson option (auto-detected via libgbm + libdrm)
  - CAIRO_HAS_GBM_SURFACE feature flag

Test coverage:
  - Dedicated API + error-path tests (test/gbm-surface.c)
  - Surface-as-source pattern test (test/gbm-surface-source.c)
  - GBM boilerplate target for the full test suite
  - Entries in api-special-cases.c and error-setters.c
2026-03-23 23:00:26 +00:00
..
.gitignore gitignore: Ignore .trs (test results) 2015-07-31 17:56:54 -07:00
cairo-boilerplate-gbm.c Add GBM surface backend for zero-copy GPU buffer sharing 2026-03-23 23:00:26 +00:00
cairo-boilerplate-getopt.c whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/. 2010-06-24 15:02:53 +03:00
cairo-boilerplate-getopt.h [cairo-boilerplate] Silence compiler warning. 2008-06-13 21:34:43 +01:00
cairo-boilerplate-pdf.c Boilerplate: Use backward slashes for system / popen commands on Windows 2026-01-08 15:27:09 +01:00
cairo-boilerplate-private.h Refactor ARRAY_LENGTH macro definitions in test code 2014-11-20 12:22:06 -08:00
cairo-boilerplate-ps.c Fix PS test crash 2021-07-18 18:13:10 +09:30
cairo-boilerplate-quartz.c Add surface-to-png in the quartz boilerplate 2023-08-16 16:33:04 +01:00
cairo-boilerplate-scaled-font.h whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/. 2010-06-24 15:02:53 +03:00
cairo-boilerplate-script.c boilerplate: Remove unused thread id parameter 2011-11-12 20:49:08 +01:00
cairo-boilerplate-svg.c Boilerplate: Use backward slashes for system / popen commands on Windows 2026-01-08 15:27:09 +01:00
cairo-boilerplate-system.c Remove stray _GNU_SOURCE definitions 2021-05-01 16:58:15 +01:00
cairo-boilerplate-system.h whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/. 2010-06-24 15:02:53 +03:00
cairo-boilerplate-test-surfaces.c Retire dummy cairo-version.h header to fix meson subproject build 2020-09-29 15:50:53 +00:00
cairo-boilerplate-win32-printing.c Win32: Avoid checking the last error for GDI functions that don't set it 2025-01-21 11:06:48 +01:00
cairo-boilerplate-win32.c Boilerplate/Win32: Switch to a DIB section 2026-01-08 15:32:24 +01:00
cairo-boilerplate-xcb.c boilerplate: Use _cairo_malloc instead of malloc 2021-07-23 18:33:19 +09:30
cairo-boilerplate-xlib.c boilerplate: Use _cairo_malloc instead of malloc 2021-07-23 18:33:19 +09:30
cairo-boilerplate-xlib.h [boilerplate] Add missing headers. Oops! 2007-04-21 07:23:30 -04:00
cairo-boilerplate.c Boilerplate: Use backward slashes for system / popen commands on Windows 2026-01-08 15:27:09 +01:00
cairo-boilerplate.h Drop support for very old GCC versions 2025-06-16 18:52:39 +02:00
make-cairo-boilerplate-constructors.py Remove leftover scripts from the autotools build 2025-07-15 14:28:18 +02:00
meson.build Add GBM surface backend for zero-copy GPU buffer sharing 2026-03-23 23:00:26 +00:00
README Add boilerplate/README explaining its purpose 2006-08-30 22:33:53 -07:00

This directory provides code that is common to both of cairo's tests
suites:

 * The test suite for correctness in test/
 * The test suite for performance in perf/

We call it boilerplate as it consists primarily of the boilerplate
code necessary for initializing a backend in order to create a surface
for that backend.

The code here just might be useful for someone looking to get started
writing cairo code to use a particular backend, (but there are no
promises that the boilerplate code found here for any particular
backend is exemplary).