egl: Pass clonable display handle to native-impls
This commit is contained in:
parent
cc6e3569f0
commit
73447bd668
|
@ -17,6 +17,7 @@ use drm::control::{connector, crtc, Device as ControlDevice, Mode};
|
|||
use gbm::AsRaw;
|
||||
use nix::libc::{c_int, c_void};
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Egl Gbm backend type
|
||||
///
|
||||
|
@ -89,7 +90,7 @@ unsafe impl<D: RawDevice + 'static> NativeSurface for GbmSurface<D> {
|
|||
|
||||
unsafe fn create(
|
||||
&self,
|
||||
display: &EGLDisplayHandle,
|
||||
display: &Arc<EGLDisplayHandle>,
|
||||
config_id: ffi::egl::types::EGLConfig,
|
||||
surface_attributes: &[c_int],
|
||||
) -> Result<*const c_void, SurfaceCreationError<Self::Error>> {
|
||||
|
|
|
@ -4,6 +4,7 @@ use super::{
|
|||
display::EGLDisplayHandle, ffi, wrap_egl_call, EGLError, Error, SurfaceCreationError, SwapBuffersError,
|
||||
};
|
||||
use nix::libc::{c_int, c_void};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(feature = "backend_winit")]
|
||||
use wayland_egl as wegl;
|
||||
|
@ -211,7 +212,7 @@ pub unsafe trait NativeSurface {
|
|||
/// This is usually an unsafe operation returning a raw pointer.
|
||||
unsafe fn create(
|
||||
&self,
|
||||
display: &EGLDisplayHandle,
|
||||
display: &Arc<EGLDisplayHandle>,
|
||||
config_id: ffi::egl::types::EGLConfig,
|
||||
surface_attributes: &[c_int],
|
||||
) -> Result<*const c_void, SurfaceCreationError<Self::Error>>;
|
||||
|
@ -248,7 +249,7 @@ unsafe impl NativeSurface for XlibWindow {
|
|||
|
||||
unsafe fn create(
|
||||
&self,
|
||||
display: &EGLDisplayHandle,
|
||||
display: &Arc<EGLDisplayHandle>,
|
||||
config_id: ffi::egl::types::EGLConfig,
|
||||
surface_attributes: &[c_int],
|
||||
) -> Result<*const c_void, SurfaceCreationError<Error>> {
|
||||
|
@ -270,7 +271,7 @@ unsafe impl NativeSurface for wegl::WlEglSurface {
|
|||
|
||||
unsafe fn create(
|
||||
&self,
|
||||
display: &EGLDisplayHandle,
|
||||
display: &Arc<EGLDisplayHandle>,
|
||||
config_id: ffi::egl::types::EGLConfig,
|
||||
surface_attributes: &[c_int],
|
||||
) -> Result<*const c_void, SurfaceCreationError<Error>> {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl<N: native::NativeSurface> EGLSurface<N> {
|
|||
out
|
||||
};
|
||||
|
||||
let surface = unsafe { native.create(&*display, config, &surface_attributes)? };
|
||||
let surface = unsafe { native.create(&display, config, &surface_attributes)? };
|
||||
|
||||
if surface == ffi::egl::NO_SURFACE {
|
||||
return Err(SurfaceCreationError::EGLSurfaceCreationFailed(
|
||||
|
@ -111,7 +111,7 @@ impl<N: native::NativeSurface> EGLSurface<N> {
|
|||
}
|
||||
self.surface.set(unsafe {
|
||||
self.native
|
||||
.create(&*self.display, self.config_id, &self.surface_attributes)
|
||||
.create(&self.display, self.config_id, &self.surface_attributes)
|
||||
.map_err(|err| match err {
|
||||
SurfaceCreationError::EGLSurfaceCreationFailed(err) => {
|
||||
SwapBuffersError::EGLCreateWindowSurface(err)
|
||||
|
|
Loading…
Reference in New Issue