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

libfunnel EGL API integration More...

#include "funnel.h"
#include <EGL/egl.h>

Go to the source code of this file.

Enumerations

enum  funnel_egl_format { FUNNEL_EGL_FORMAT_UNKNOWN = 0 , FUNNEL_EGL_FORMAT_RGB888 , FUNNEL_EGL_FORMAT_RGBA8888 }
 Formats available for EGL integration. More...

Functions

int funnel_stream_init_egl (struct funnel_stream *stream, EGLDisplay display)
 Set up a stream for EGL integration.
int funnel_stream_egl_add_format (struct funnel_stream *stream, enum funnel_egl_format format)
 Add a supported EGL format.
int funnel_buffer_get_egl_image (struct funnel_buffer *buf, EGLImage *pimage)
 Get the EGLImage for a Funnel buffer.
int funnel_buffer_get_egl_format (struct funnel_buffer *buf, enum funnel_egl_format *pformat)
 Get the EGL format for a Funnel buffer.
int funnel_buffer_get_acquire_egl_sync (struct funnel_buffer *buf, EGLSync *psync)
 Get the EGLSync for acquiring the buffer.
int funnel_buffer_set_release_egl_sync (struct funnel_buffer *buf, EGLSync sync)
 Set the EGLSync for releasing the buffer.

Detailed Description

libfunnel EGL API integration

See test-egl.c for a usage example.

Enumeration Type Documentation

◆ funnel_egl_format

Formats available for EGL integration.

Enumerator
FUNNEL_EGL_FORMAT_UNKNOWN 

Unknown format.

FUNNEL_EGL_FORMAT_RGB888 

8-bit RGB without alpha, sRGB (32bpp with padding)

FUNNEL_EGL_FORMAT_RGBA8888 

8-bit RGBA with premultiplied alpha, sRGB (32bpp)

Function Documentation

◆ funnel_stream_init_egl()

int funnel_stream_init_egl ( struct funnel_stream * stream,
EGLDisplay display )

Set up a stream for EGL integration.

[Synchronization: external]

Parameters
streamStream [Lifetime: borrowed]
displayEGLDisplay to attach to the stream [Lifetime: borrowed-by stream]
Returns
0 on success, or a negative error number on error.
Return values
-EEXISTThe API was already initialized once
-EOPNOTSUPPMissing EGL extensions
-EPROTONOSUPPORTGPU driver not supported (PipeWire version too old)
-ENODEV
  • Could not locate DRM render node
  • GBM or EGL initialization failed
Examples
test-egl.c.

◆ funnel_stream_egl_add_format()

int funnel_stream_egl_add_format ( struct funnel_stream * stream,
enum funnel_egl_format format )

Add a supported EGL format.

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

[Synchronization: external]

Parameters
streamStream [Lifetime: borrowed]
formatenum funnel_egl_format format
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • API is not EGL
-ENOENTFormat is not supported by the device or not usable
Examples
test-egl.c.

◆ funnel_buffer_get_egl_image()

int funnel_buffer_get_egl_image ( struct funnel_buffer * buf,
EGLImage * pimage )

Get the EGLImage for a Funnel buffer.

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

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]pimageEGLImage for the buffer [Lifetime: borrowed-from buf]
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • API is not EGL
Examples
test-egl.c.

◆ funnel_buffer_get_egl_format()

int funnel_buffer_get_egl_format ( struct funnel_buffer * buf,
enum funnel_egl_format * pformat )

Get the EGL format for a Funnel buffer.

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]pformatEGL format
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • API is not EGL

◆ funnel_buffer_get_acquire_egl_sync()

int funnel_buffer_get_acquire_egl_sync ( struct funnel_buffer * buf,
EGLSync * psync )

Get the EGLSync for acquiring the buffer.

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

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
[out]psyncEGLSync [Lifetime: owned]
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • API is not EGL
-EIOUnable to create an acquire EGLSync
Examples
test-egl.c.

◆ funnel_buffer_set_release_egl_sync()

int funnel_buffer_set_release_egl_sync ( struct funnel_buffer * buf,
EGLSync sync )

Set the EGLSync for releasing the buffer.

This sync object must be signaled when access to the buffer is complete. The sync type must be EGL_SYNC_NATIVE_FENCE_ANDROID.

[Synchronization: external]

Parameters
bufBuffer [Lifetime: borrowed]
syncEGLSync [Lifetime: borrowed]
Returns
0 on success, or a negative error number on error.
Return values
-EINVAL
  • Invalid argument
  • API is not EGL
-EIOUnable to set the release EGLSync (is the sync type correct?)
Examples
test-egl.c.