Method

MaplibreNativeFfiMapattach_dma_buf_ring

Declaration [src]

MaplibreNativeFfiRenderSession*
maplibre_native_ffi_map_attach_dma_buf_ring (
  MaplibreNativeFfiMap* self,
  MaplibreNativeFfiDmaBufRingDescriptor* descriptor,
  MaplibreNativeFfiVulkanDevice* device,
  MaplibreNativeFfiRenderSessionAttachOptions* options,
  GError** error
)

Description [src]

Creates a session that renders the map into a ring of dmabufs that the library allocates.

Acquire each frame with maplibre_native_ffi_render_session_acquire_frame(), and get its buffer with maplibre_native_ffi_acquired_frame_get_dma_buf(). maplibre_native_ffi_render_session_resize_async() gives the ring new buffers of the new size.

A Vulkan build renders with device, or, when device is null, with a device that the library creates. An OpenGL build uses an EGL context of its own, and device must be null. Attach with MAPLIBRE_NATIVE_FFI_RENDER_DRIVER_CORE_WORKER.

For a reader that waits on no sync file, such as a Wayland compositor without explicit synchronization, attach without MAPLIBRE_NATIVE_FFI_GPU_SYNC_KIND_FLAG_SYNC_FD in MaplibreNativeFfiRenderSessionAttachOptions:producer-sync-kinds, so that each frame finishes before you acquire it. Keep each frame acquired until its reader is done with the buffer. Give the ring 3 buffers, so the session can render while you hold two frames.

The object is ready once maplibre_native_ffi_render_session_ready_async finishes, which fails with the errors that the completion reports.

See mln_map_attach_dma_buf_ring in the C API reference.

It fails with these errors:

  • MAPLIBRE_NATIVE_FFI_ERROR_UNSUPPORTED when the graphics context can’t render into a dmabuf of any of formats.
  • MAPLIBRE_NATIVE_FFI_ERROR_NATIVE_ERROR when the library can’t create its Vulkan device or initialize an EGL display.

Parameters

descriptor

Type: MaplibreNativeFfiDmaBufRingDescriptor

No description available.

The data is owned by the caller of the method.
device

Type: MaplibreNativeFfiVulkanDevice

The handle, or NULL.

The argument can be NULL.
The data is owned by the caller of the method.
options

Type: MaplibreNativeFfiRenderSessionAttachOptions

No description available.

The data is owned by the caller of the method.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: MaplibreNativeFfiRenderSession

The new object, or NULL with error set.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.