Fix a bunch of warnings

This commit is contained in:
Drakulix 2018-01-07 20:24:40 +01:00
parent b2ee62bebf
commit efaadb8882
8 changed files with 36 additions and 46 deletions

View File

@ -1,10 +1,10 @@
use super::error::*; use super::error::*;
use super::DevPath; use super::DevPath;
use backend::graphics::GraphicsBackend; use backend::graphics::GraphicsBackend;
use backend::graphics::egl::{EGLGraphicsBackend, EGLContext, EGLSurface, PixelFormat, SwapBuffersError, EglExtensionNotSupportedError}; use backend::graphics::egl::{EGLGraphicsBackend, EGLContext, EGLSurface, PixelFormat, SwapBuffersError};
use backend::graphics::egl::error::Result as EGLResult; use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::native::{Gbm, GbmSurfaceArguments}; use backend::graphics::egl::native::{Gbm, GbmSurfaceArguments};
use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLDisplay, BufferAccessError, EGLImages}; use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLDisplay};
use drm::control::{Device, ResourceInfo}; use drm::control::{Device, ResourceInfo};
use drm::control::{connector, crtc, encoder, framebuffer, Mode}; use drm::control::{connector, crtc, encoder, framebuffer, Mode};
use gbm::{Device as GbmDevice, BufferObject, BufferObjectFlags, Format as GbmFormat, Surface as GbmSurface, SurfaceBufferHandle}; use gbm::{Device as GbmDevice, BufferObject, BufferObjectFlags, Format as GbmFormat, Surface as GbmSurface, SurfaceBufferHandle};
@ -13,7 +13,6 @@ use nix::libc::c_void;
use std::cell::Cell; use std::cell::Cell;
use std::rc::{Rc, Weak}; use std::rc::{Rc, Weak};
use wayland_server::Display; use wayland_server::Display;
use wayland_server::protocol::wl_buffer::WlBuffer;
pub struct DrmBackend<A: Device + 'static> { pub struct DrmBackend<A: Device + 'static> {
backend: Rc<DrmBackendInternal<A>>, backend: Rc<DrmBackendInternal<A>>,

View File

@ -188,11 +188,10 @@
//! ``` //! ```
#[cfg(feature = "backend_session")] #[cfg(feature = "backend_session")]
use backend::graphics::egl::EglExtensionNotSupportedError; use backend::graphics::egl::context::{EGLContext, GlAttributes};
use backend::graphics::egl::context::{EGLContext, GlAttributes, PixelFormatRequirements};
use backend::graphics::egl::error::Result as EGLResult; use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::native::Gbm; use backend::graphics::egl::native::Gbm;
use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLDisplay, BufferAccessError, EGLImages}; use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLDisplay};
#[cfg(feature = "backend_session")] #[cfg(feature = "backend_session")]
use backend::session::SessionObserver; use backend::session::SessionObserver;
use drm::Device as BasicDevice; use drm::Device as BasicDevice;
@ -215,7 +214,6 @@ use wayland_server::{EventLoopHandle, StateToken};
use wayland_server::sources::{FdEventSource, FdEventSourceImpl, FdInterest}; use wayland_server::sources::{FdEventSource, FdEventSourceImpl, FdInterest};
#[cfg(feature = "backend_session")] #[cfg(feature = "backend_session")]
use wayland_server::{Display, StateProxy}; use wayland_server::{Display, StateProxy};
use wayland_server::protocol::wl_buffer::WlBuffer;
mod backend; mod backend;
pub mod error; pub mod error;
@ -569,34 +567,33 @@ impl<A: ControlDevice + 'static> SessionObserver for StateToken<DrmDevice<A>> {
} }
fn activate<'a>(&mut self, state: &mut StateProxy<'a>) { fn activate<'a>(&mut self, state: &mut StateProxy<'a>) {
state.with_value(self, |state, device| { let mut device = state.get_mut(self);
device.active = true; device.active = true;
if let Err(err) = device.set_master() { if let Err(err) = device.set_master() {
crit!( crit!(
device.logger, device.logger,
"Failed to acquire drm master again. Error: {}", "Failed to acquire drm master again. Error: {}",
err err
); );
} }
let mut crtcs = Vec::new(); let mut crtcs = Vec::new();
for (crtc, backend) in device.backends.iter() { for (crtc, backend) in device.backends.iter() {
if let Some(backend) = backend.upgrade() { if let Some(backend) = backend.upgrade() {
backend.unlock_buffer(); backend.unlock_buffer();
if let Err(err) = backend.page_flip(None) { if let Err(err) = backend.page_flip(None) {
error!( error!(
device.logger, device.logger,
"Failed to activate crtc ({:?}) again. Error: {}", "Failed to activate crtc ({:?}) again. Error: {}",
crtc, crtc,
err err
); );
}
} else {
crtcs.push(*crtc);
} }
} else {
crtcs.push(*crtc);
} }
for crtc in crtcs { }
device.backends.remove(&crtc); for crtc in crtcs {
} device.backends.remove(&crtc);
}) }
} }
} }

View File

@ -8,8 +8,6 @@
use super::GraphicsBackend; use super::GraphicsBackend;
use nix::libc::c_void; use nix::libc::c_void;
use std::fmt; use std::fmt;
use wayland_server::Display;
use wayland_server::protocol::wl_buffer::WlBuffer;
pub mod context; pub mod context;
pub use self::context::EGLContext; pub use self::context::EGLContext;

View File

@ -16,8 +16,6 @@ use winit::Window as WinitWindow;
#[cfg(feature = "backend_winit")] #[cfg(feature = "backend_winit")]
use winit::os::unix::WindowExt; use winit::os::unix::WindowExt;
#[cfg(feature = "backend_winit")] #[cfg(feature = "backend_winit")]
use nix::libc::c_void;
#[cfg(feature = "backend_winit")]
use wayland_client::egl as wegl; use wayland_client::egl as wegl;
pub trait Backend { pub trait Backend {

View File

@ -4,7 +4,7 @@ use backend::graphics::egl::ffi::egl::types::EGLImage;
use nix::libc::{c_uint}; use nix::libc::{c_uint};
use std::rc::{Rc, Weak}; use std::rc::{Rc, Weak};
use std::fmt; use std::fmt;
use wayland_server::{Display, Resource, StateToken, StateProxy}; use wayland_server::{Display, Resource};
use wayland_server::protocol::wl_buffer::WlBuffer; use wayland_server::protocol::wl_buffer::WlBuffer;
use wayland_sys::server::wl_display; use wayland_sys::server::wl_display;

View File

@ -1,7 +1,7 @@
//! Glium compatibility module //! Glium compatibility module
use backend::graphics::egl::{EGLGraphicsBackend, SwapBuffersError, EglExtensionNotSupportedError}; use backend::graphics::egl::{EGLGraphicsBackend, SwapBuffersError};
use backend::graphics::egl::wayland::{BufferAccessError, EGLImages, EGLWaylandExtensions, EGLDisplay}; use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLDisplay};
use backend::graphics::egl::error::Result as EGLResult; use backend::graphics::egl::error::Result as EGLResult;
use glium::Frame; use glium::Frame;
use glium::SwapBuffersError as GliumSwapBuffersError; use glium::SwapBuffersError as GliumSwapBuffersError;
@ -11,7 +11,6 @@ use std::borrow::Borrow;
use std::os::raw::c_void; use std::os::raw::c_void;
use std::rc::Rc; use std::rc::Rc;
use wayland_server::Display; use wayland_server::Display;
use wayland_server::protocol::wl_buffer::WlBuffer;
impl From<SwapBuffersError> for GliumSwapBuffersError { impl From<SwapBuffersError> for GliumSwapBuffersError {
fn from(error: SwapBuffersError) -> Self { fn from(error: SwapBuffersError) -> Self {

View File

@ -14,7 +14,7 @@ use drm::control::Device as ControlDevice;
use backend::drm::{drm_device_bind, DrmDevice, DrmHandler}; use backend::drm::{drm_device_bind, DrmDevice, DrmHandler};
use backend::session::{Session, SessionObserver}; use backend::session::{Session, SessionObserver};
use nix::fcntl; use nix::fcntl;
use nix::sys::stat::{dev_t, fstat}; use nix::sys::stat::dev_t;
use std::collections::HashMap; use std::collections::HashMap;
use std::ffi::OsString; use std::ffi::OsString;
use std::io::{Error as IoError, Result as IoResult}; use std::io::{Error as IoError, Result as IoResult};

View File

@ -1,12 +1,12 @@
//! Implementation of backend traits for types provided by `winit` //! Implementation of backend traits for types provided by `winit`
use backend::graphics::GraphicsBackend; use backend::graphics::GraphicsBackend;
use backend::graphics::egl::{EGLGraphicsBackend, EGLContext, EGLSurface, PixelFormat, SwapBuffersError, EglExtensionNotSupportedError}; use backend::graphics::egl::{EGLGraphicsBackend, EGLContext, EGLSurface, PixelFormat, SwapBuffersError};
use backend::graphics::egl::error as egl_error; use backend::graphics::egl::error as egl_error;
use backend::graphics::egl::error::Result as EGLResult; use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::native; use backend::graphics::egl::native;
use backend::graphics::egl::context::GlAttributes; use backend::graphics::egl::context::GlAttributes;
use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLImages, Format, BufferAccessError, EGLDisplay}; use backend::graphics::egl::wayland::{EGLWaylandExtensions, EGLDisplay};
use backend::input::{Axis, AxisSource, Event as BackendEvent, InputBackend, InputHandler, KeyState, use backend::input::{Axis, AxisSource, Event as BackendEvent, InputBackend, InputHandler, KeyState,
KeyboardKeyEvent, MouseButton, MouseButtonState, PointerAxisEvent, PointerButtonEvent, KeyboardKeyEvent, MouseButton, MouseButtonState, PointerAxisEvent, PointerButtonEvent,
PointerMotionAbsoluteEvent, Seat, SeatCapabilities, TouchCancelEvent, TouchDownEvent, PointerMotionAbsoluteEvent, Seat, SeatCapabilities, TouchCancelEvent, TouchDownEvent,
@ -20,7 +20,6 @@ use winit::{ElementState, Event, EventsLoop, KeyboardInput, MouseButton as Winit
MouseScrollDelta, Touch, TouchPhase, WindowBuilder, WindowEvent, Window as WinitWindow}; MouseScrollDelta, Touch, TouchPhase, WindowBuilder, WindowEvent, Window as WinitWindow};
use wayland_client::egl as wegl; use wayland_client::egl as wegl;
use wayland_server::Display; use wayland_server::Display;
use wayland_server::protocol::wl_buffer::WlBuffer;
error_chain! { error_chain! {
errors { errors {