Skip to main content

Crate drmkit_scene_gbm

Crate drmkit_scene_gbm 

Source
Expand description

A scene source backed by a GBM surface.

Port of src/scene/gbm_surface_source.{hpp,cpp}.

§Surface, not buffer

drmkit-scene-sources’s GbmBufferSource hands out one allocation the caller renders into. A surface is a swap chain: EGL or Vulkan renders into it, eglSwapBuffers rotates it, and this source locks whichever buffer came to the front. That is the shape a GL compositor needs, and the reason both exist.

§What this crate does not do

It creates no GL context and issues no draw calls. The producer owns the rendering; drmkit owns getting the result on screen. native_surface is what a producer passes to eglCreateWindowSurface.

§Bind before the first acquire

A gbm_surface is an EGL native window. Mesa routes lock_front_buffer, has_free_buffers and release_buffer into the window surface EGL (or Vulkan) creates on it, and until one exists each of them is a SIGSEGV, not an error, on every Mesa device. GBM has no safe query for this, so the producer has to say it happened. Either bind the surface and render a frame before adding the layer to a scene, or set SurfaceConfig::require_bind and call mark_bound once the window surface exists: until then acquire reports SourceError::WouldBlock instead of touching the surface.

Structs§

GbmSurfaceSource
A GBM swap chain the scene can scan out of.
SurfaceConfig
How to create the surface.

Enums§

SurfaceError
Why a surface source could not be built or resumed.