libfunnel
Loading...
Searching...
No Matches
funnel-gbm.h File Reference

libfunnel low-level GBM API integration More...

#include "funnel.h"
#include <gbm.h>

Go to the source code of this file.

Functions

int funnel_stream_init_gbm (struct funnel_stream *stream, int gbm_fd)
 Set up a stream for GBM integration.
int funnel_stream_gbm_add_format (struct funnel_stream *stream, uint32_t format, uint64_t *modifiers, size_t num_modifiers)
 Add a supported GBM format.
int funnel_stream_gbm_set_flags (struct funnel_stream *stream, uint32_t flags)
 Set the GBM BO allocation flags.
int funnel_buffer_get_gbm_bo (struct funnel_buffer *buf, struct gbm_bo **pbo)
 Get the GBM buffer object for a Funnel buffer.
int funnel_buffer_get_acquire_sync_object (struct funnel_buffer *buf, uint32_t *phandle, uint64_t *ppoint)
 Get the sync object and point for acquiring the buffer.
int funnel_buffer_get_release_sync_object (struct funnel_buffer *buf, uint32_t *phandle, uint64_t *ppoint)
 Get the sync object and point for releasing the buffer.
int funnel_buffer_get_acquire_sync_file (struct funnel_buffer *buf, int *pfd)
 Get the sync object and point for acquiring the buffer.
int funnel_buffer_set_release_sync_file (struct funnel_buffer *buf, int fd)
 Set the sync file for releasing the buffer.

Detailed Description

libfunnel low-level GBM API integration

See test-egl.c for a usage example.

Function Documentation

◆ funnel_stream_init_gbm()

int funnel_stream_init_gbm ( struct funnel_stream * stream,
int gbm_fd )

Set up a stream for GBM integration.

[Synchronization: external]

Parameters
streamStream [Lifetime: borrowed]
gbm_fdFile descriptor of the GBM device [Lifetime: borrowed]
Returns
0 on success, or a negative error number on error.
Return values
-EEXISTThe API was already initialized once
-EINVALFailed to create GBM device
-EPROTONOSUPPORTGPU driver not supported (PipeWire version too old)
-EOPNOTSUPPThe GBM device does not have the required features

◆ funnel_stream_gbm_add_format()

int funnel_stream_gbm_add_format ( struct funnel_stream * stream,
uint32_t format,
uint64_t * modifiers,
size_t num_modifiers )

Add a supported GBM format.

Must be called in preference order (highest to lowest).

[Synchronization: external]

Parameters
streamStream [Lifetime: borrowed]
formatDRM format (FOURCC)
modifiersPointer to a list of modifiers [Lifetime: borrowed]
num_modifiersNumber of modifiers passed
Returns
0 on success, or a negative error number on error.
Return values
-EINVALInvalid argument
-EOPNOTSUPPFormat is not supported by libfunnel

◆ funnel_stream_gbm_set_flags()

int funnel_stream_gbm_set_flags ( struct funnel_stream * stream,
uint32_t flags )

Set the GBM BO allocation flags.

Parameters
streamStream [Lifetime: borrowed]
flagsBO flags
Returns
0 on success, or a negative error number on error.
Return values
-EINVALInvalid argument

◆ funnel_buffer_get_gbm_bo()

int funnel_buffer_get_gbm_bo ( struct funnel_buffer * buf,
struct gbm_bo ** pbo )

Get the GBM buffer object for a Funnel buffer.

The BO will only be valid until buf is returned or enqueued, or the stream is destroyed.

NOTE: To ensure cross-GPU compatibility, LINEAR buffers might have a width that does not correspond to the user-configured size. Use funnel_buffer_get_size() to retrieve the intended texture dimensions, instead of gbm_bo_get_width() and gbm_bo_get_height().

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]pboGBM BO for the buffer [Lifetime: borrowed-from buf]
Returns
0 on success, or a negative error number on error.

◆ funnel_buffer_get_acquire_sync_object()

int funnel_buffer_get_acquire_sync_object ( struct funnel_buffer * buf,
uint32_t * phandle,
uint64_t * ppoint )

Get the sync object and point for acquiring the buffer.

The user must wait on this timeline sync object point before accessing the buffer.

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]phandleAcquire DRM sync object handle [Lifetime: borrowed-from buf]
[out]ppointAcquire DRM sync object point
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Buffer does not require sync
  • Sync file APIs were already already used

◆ funnel_buffer_get_release_sync_object()

int funnel_buffer_get_release_sync_object ( struct funnel_buffer * buf,
uint32_t * phandle,
uint64_t * ppoint )

Get the sync object and point for releasing the buffer.

The user must signal this timeline sync object after access to the buffer is complete.

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]phandleRelease DRM sync object handle [Lifetime: borrowed-from buf]
[out]ppointRelease DRM sync object point
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Buffer does not require sync
  • Sync file APIs were already already used

◆ funnel_buffer_get_acquire_sync_file()

int funnel_buffer_get_acquire_sync_file ( struct funnel_buffer * buf,
int * pfd )

Get the sync object and point for acquiring the buffer.

The user must wait on this sync file before accessing the buffer.

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]pfdSync file fd for buffer acquisition [Lifetime: owned]
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • Buffer does not require sync
  • Sync object APIs were already already used

◆ funnel_buffer_set_release_sync_file()

int funnel_buffer_set_release_sync_file ( struct funnel_buffer * buf,
int fd )

Set the sync file for releasing the buffer.

This sync file must be signaled when access to the buffer is complete.

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
fdDRM sync file signaled on release [Lifetime: borrowed]
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • Buffer does not require sync
  • Sync object APIs were already already used