Module smithay::backend::egl [−][src]
Expand description
Common traits and types for egl rendering
This module has multiple responsibilities related to functionality provided by libEGL: Initializing EGL objects to:
- initialize usage of EGL based
WlBuffer
s viawl_drm
. - initialize OpenGL contexts from.
- Import/Export external resources to/from OpenGL
To use this module, you first need to create a EGLDisplay
through a supported EGL platform
as indicated by an implementation of the native::EGLNativeDisplay
trait.
You may bind the EGLDisplay
, that shall be used by clients for rendering (so pick one initialized by a fast platform)
to the wayland_server::Display
of your compositor. Note only one backend may be bound to any Display
at any time.
You may then use the resulting display::EGLBufferReader
to receive EGLBuffer
of an EGL-based WlBuffer
for rendering.
Renderers implementing the ImportEgl
-trait can manage the buffer reader for you.
Note: The support for binding the EGLDisplay
for use by clients requires the use_system_lib
cargo feature on Smithay.
To create OpenGL contexts you may create EGLContext
s from the display and if the context is initialized with a config
it may also be used to initialize an EGLSurface
, which can be bound to some renderers.
Alternatively you may import dmabuf
s using the display, which result
in an EGLImage
, which can be rendered into by OpenGL. This is preferable to using surfaces as the dmabuf can be
passed around freely making resource-management and more complex use-cases like Multi-GPU rendering easier to manage.
Renderers based on EGL may support doing this for you by allowing you to Bind
a dmabuf directly.
Re-exports
pub use self::context::EGLContext;
pub use self::display::EGLDisplay;
pub use self::surface::EGLSurface;
Modules
EGL context related structs
Type safe native types for safe egl initialisation
Type safe native types for safe context/surface creation
EGL surface related structs
Structs
Images of the EGL-based WlBuffer
.
Error that can happen on optional EGL features
Error that can happen when making a context (and surface) current on the active thread.
Enums
Error that can occur when accessing an EGL buffer
Raw EGL error
EGL errors
Texture format types
Error that can happen when swapping buffers.
Functions
Returns the address of an OpenGL function.
Wraps a raw egl call and returns error codes from eglGetError
, if it fails.