smithay::backend::renderer

Trait ImportDma

Source
pub trait ImportDma: Renderer {
    // Required method
    fn import_dmabuf(
        &mut self,
        dmabuf: &Dmabuf,
    ) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error>;

    // Provided methods
    fn dmabuf_formats<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Format> + 'a> { ... }
    fn import_dma_buffer(
        &mut self,
        buffer: &WlBuffer,
    ) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error> { ... }
}
Expand description

Trait for Renderers supporting importing dmabuf-based buffers.

Required Methods§

Source

fn import_dmabuf( &mut self, dmabuf: &Dmabuf, ) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error>

Import a given raw dmabuf into the renderer.

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.

Provided Methods§

Source

fn dmabuf_formats<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Format> + 'a>

Returns supported formats for dmabufs.

Source

fn import_dma_buffer( &mut self, buffer: &WlBuffer, ) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error>

Import a given dmabuf-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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§