Fix wl_drm on winit backend
This commit is contained in:
parent
ad55ab71c9
commit
eb5e4bcf92
|
@ -1,7 +1,10 @@
|
|||
use std::{cell::RefCell, rc::Rc, sync::atomic::Ordering, time::Duration};
|
||||
|
||||
#[cfg(feature = "egl")]
|
||||
use smithay::{backend::renderer::ImportDma, wayland::dmabuf::init_dmabuf_global};
|
||||
use smithay::{
|
||||
backend::renderer::{ImportDma, ImportEgl},
|
||||
wayland::dmabuf::init_dmabuf_global,
|
||||
};
|
||||
use smithay::{
|
||||
backend::{input::InputBackend, renderer::Frame, winit, SwapBuffersError},
|
||||
reexports::{
|
||||
|
@ -38,7 +41,12 @@ pub fn run_winit(
|
|||
let renderer = Rc::new(RefCell::new(renderer));
|
||||
|
||||
#[cfg(feature = "egl")]
|
||||
if renderer.borrow().bind_wl_display(&display.borrow()).is_ok() {
|
||||
if renderer
|
||||
.borrow_mut()
|
||||
.renderer()
|
||||
.bind_wl_display(&display.borrow())
|
||||
.is_ok()
|
||||
{
|
||||
info!(log, "EGL hardware-acceleration enabled");
|
||||
let dmabuf_formats = renderer
|
||||
.borrow_mut()
|
||||
|
|
|
@ -28,11 +28,6 @@ use winit::{
|
|||
window::{Window as WinitWindow, WindowBuilder},
|
||||
};
|
||||
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
use crate::backend::egl::display::EGLBufferReader;
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
use wayland_server::Display;
|
||||
|
||||
/// Errors thrown by the `winit` backends
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
|
@ -235,16 +230,6 @@ pub enum WinitEvent {
|
|||
}
|
||||
|
||||
impl WinitGraphicsBackend {
|
||||
/// Bind a `wl_display` to allow hardware-accelerated clients using `wl_drm`.
|
||||
///
|
||||
/// Returns an `EGLBufferReader` used to access the contents of these buffers.
|
||||
///
|
||||
/// *Note*: Only on implementation of `wl_drm` can be bound by a single wayland display.
|
||||
#[cfg(feature = "use_system_lib")]
|
||||
pub fn bind_wl_display(&self, wl_display: &Display) -> Result<EGLBufferReader, EGLError> {
|
||||
self.display.bind_wl_display(wl_display)
|
||||
}
|
||||
|
||||
/// Window size of the underlying window
|
||||
pub fn window_size(&self) -> WindowSize {
|
||||
self.size.borrow().clone()
|
||||
|
|
Loading…
Reference in New Issue