pub struct EGLDisplay { /* private fields */ }
backend_egl
only.Expand description
EGLDisplay
represents an initialised EGL environment
Implementations§
Source§impl EGLDisplay
impl EGLDisplay
Sourcepub unsafe fn new<N>(native: N) -> Result<EGLDisplay, Error>where
N: EGLNativeDisplay + 'static,
pub unsafe fn new<N>(native: N) -> Result<EGLDisplay, Error>where
N: EGLNativeDisplay + 'static,
Create a new EGLDisplay
from a given EGLNativeDisplay
.
§Safety
smithay internally tracks EGLDisplay instances as
calls with the same parameters to eglGetPlatformDisplay
will return
references to the same underlying display.
You don’t have to worry about this, when using just smithay,
but if other code calls eglGetPlatformDisplay
it is possible to close the resulting
EGLDisplay via eglTerminate
without invalidating smithay’s instances.
If you are using other code creating EGLDisplay
s, don’t use this method,
but use the external code to create the display and use EGLDisplay::from_raw
to make it usable in smithay. This way eglTerminate
will be skipped and you
can clean up the display externally.
Sourcepub unsafe fn from_raw(
display: *const c_void,
config_id: *const c_void,
) -> Result<EGLDisplay, Error>
pub unsafe fn from_raw( display: *const c_void, config_id: *const c_void, ) -> Result<EGLDisplay, Error>
Create a new EGLDisplay
from an already initialized EGLDisplay and EGLConfig handle
§Safety
- The display must be created from the system default EGL library (
dlopen("libEGL.so")
) - The
display
andconfig
must be valid for the lifetime of the returned display and any handles created by this display (usingEGLDisplay::get_display_handle
) - smithay can’t track the parameters used to create this display, which may cause two Displays to point to the same underlying instance. For this reason displays created
using this method will not call
eglTerminate
on destruction. You will have to cleanup manually.
Sourcepub fn choose_config(
&self,
attributes: GlAttributes,
reqs: PixelFormatRequirements,
) -> Result<(PixelFormat, EGLConfig), Error>
pub fn choose_config( &self, attributes: GlAttributes, reqs: PixelFormatRequirements, ) -> Result<(PixelFormat, EGLConfig), Error>
Finds a compatible EGLConfig for a given set of requirements
Sourcepub fn get_display_handle(&self) -> Arc<EGLDisplayHandle>
pub fn get_display_handle(&self) -> Arc<EGLDisplayHandle>
Get a handle to the underlying raw EGLDisplay handle
Sourcepub fn get_egl_version(&self) -> (i32, i32)
pub fn get_egl_version(&self) -> (i32, i32)
Returns the runtime egl version of this display
Sourcepub fn extensions(&self) -> &[String]
pub fn extensions(&self) -> &[String]
Returns the supported extensions of this display
Sourcepub fn dmabuf_render_formats(&self) -> &FormatSet
pub fn dmabuf_render_formats(&self) -> &FormatSet
Returns a list of formats for dmabufs that can be rendered to.
Sourcepub fn dmabuf_texture_formats(&self) -> &FormatSet
pub fn dmabuf_texture_formats(&self) -> &FormatSet
Returns a list of formats for dmabufs that can be used as textures.
Sourcepub fn supports_damage(&self) -> bool
pub fn supports_damage(&self) -> bool
Returns when the display supports extensions required for smithays damage tracking helpers.
Sourcepub fn create_dmabuf_from_image(
&self,
image: EGLImage,
size: Size<i32, BufferCoords>,
y_inverted: bool,
) -> Result<Dmabuf, Error>
pub fn create_dmabuf_from_image( &self, image: EGLImage, size: Size<i32, BufferCoords>, y_inverted: bool, ) -> Result<Dmabuf, Error>
Sourcepub fn bind_wl_display(
&self,
display: &DisplayHandle,
) -> Result<EGLBufferReader, Error>
Available on crate features use_system_lib
and wayland_frontend
only.
pub fn bind_wl_display( &self, display: &DisplayHandle, ) -> Result<EGLBufferReader, Error>
use_system_lib
and wayland_frontend
only.Binds this EGL display to the given Wayland display.
This will allow clients to utilize EGL to create hardware-accelerated
surfaces. The server will need to be able to handle EGL-WlBuffer
s.
§Errors
This might return EglExtensionNotSupported
if binding is not supported by the EGL implementation.
This might return OtherEGLDisplayAlreadyBound
if called for the same DisplayHandle
multiple times, as only one egl display may be bound at any given time.
Trait Implementations§
Source§impl Clone for EGLDisplay
impl Clone for EGLDisplay
Source§fn clone(&self) -> EGLDisplay
fn clone(&self) -> EGLDisplay
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for EGLDisplay
impl !RefUnwindSafe for EGLDisplay
impl Send for EGLDisplay
impl Sync for EGLDisplay
impl Unpin for EGLDisplay
impl !UnwindSafe for EGLDisplay
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.