Trait smithay::backend::renderer::ImportEgl [−][src]
pub trait ImportEgl: Renderer { fn bind_wl_display(&mut self, display: &Display) -> Result<(), EglError>; fn unbind_wl_display(&mut self); fn egl_reader(&self) -> Option<&EGLBufferReader>; fn import_egl_buffer(
&mut self,
buffer: &WlBuffer
) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error>; }
Expand description
Trait for Renderers supporting importing wl_drm-based buffers.
Required methods
Binds the underlying EGL display to the given Wayland display.
This will allow clients to utilize EGL to create hardware-accelerated surfaces. This renderer will thus be able to handle wl_drm-based buffers.
Errors
This might return EglExtensionNotSupported
if binding is not supported by the EGL implementation.
This might return OtherEGLDisplayAlreadyBound
if called for the same Display
multiple times, as only one egl
display may be bound at any given time.
fn unbind_wl_display(&mut self)
fn unbind_wl_display(&mut self)
Unbinds a previously bound egl display, if existing.
Note: As a result any previously created egl-based WlBuffers will not be readable anymore. Your compositor will have to deal with existing buffers of unknown type.
fn egl_reader(&self) -> Option<&EGLBufferReader>
fn egl_reader(&self) -> Option<&EGLBufferReader>
Returns the underlying EGLBufferReader
.
The primary use for this is calling buffer_dimensions
or buffer_type
.
Returns None
if no Display
was previously bound to the underlying
EGLDisplay
(see ImportEgl::bind_wl_display
).
Import a given wl_drm-based buffer into the renderer (see buffer_type
).
Returns a texture_id, which can be used with Frame::render_texture
(or Frame::render_texture_at
)
or implementation-specific functions.
If not otherwise defined by the implementation, this texture id is only valid for the renderer, that created it.
This operation needs no bound or default rendering target.
The implementation defines, if the id keeps being valid, if the buffer is released, to avoid relying on implementation details, keep the buffer alive, until you destroyed this texture again.