Fix all CI warnings
This commit is contained in:
parent
3623947939
commit
053bc98faa
|
@ -9,7 +9,7 @@ use crate::AnvilState;
|
||||||
use smithay::{
|
use smithay::{
|
||||||
backend::input::{
|
backend::input::{
|
||||||
self, Event, InputBackend, InputEvent, KeyState, KeyboardKeyEvent, PointerAxisEvent,
|
self, Event, InputBackend, InputEvent, KeyState, KeyboardKeyEvent, PointerAxisEvent,
|
||||||
PointerButtonEvent, PointerMotionAbsoluteEvent, PointerMotionEvent,
|
PointerButtonEvent,
|
||||||
},
|
},
|
||||||
reexports::wayland_server::protocol::wl_pointer,
|
reexports::wayland_server::protocol::wl_pointer,
|
||||||
wayland::{
|
wayland::{
|
||||||
|
@ -18,8 +18,11 @@ use smithay::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "winit")]
|
||||||
|
use smithay::backend::input::PointerMotionAbsoluteEvent;
|
||||||
|
|
||||||
#[cfg(feature = "udev")]
|
#[cfg(feature = "udev")]
|
||||||
use smithay::backend::session::Session;
|
use smithay::backend::{input::PointerMotionEvent, session::Session};
|
||||||
|
|
||||||
impl<Backend> AnvilState<Backend> {
|
impl<Backend> AnvilState<Backend> {
|
||||||
fn keyboard_key_to_action<B: InputBackend>(&mut self, evt: B::KeyboardKeyEvent) -> KeyAction {
|
fn keyboard_key_to_action<B: InputBackend>(&mut self, evt: B::KeyboardKeyEvent) -> KeyAction {
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
|
// If no backend is enabled, a large portion of the codebase is unused.
|
||||||
|
// So silence this useless warning for the CI.
|
||||||
|
#![cfg_attr(
|
||||||
|
not(any(feature = "winit", feature = "udev")),
|
||||||
|
allow(dead_code, unused_imports)
|
||||||
|
)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate slog;
|
extern crate slog;
|
||||||
|
@ -57,7 +63,10 @@ fn main() {
|
||||||
crit!(log, "Failed to initialize tty backend.");
|
crit!(log, "Failed to initialize tty backend.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
Some(other) => {
|
||||||
|
crit!(log, "Unknown backend: {}", other);
|
||||||
|
}
|
||||||
|
None => {
|
||||||
println!("USAGE: anvil --backend");
|
println!("USAGE: anvil --backend");
|
||||||
println!();
|
println!();
|
||||||
println!("Possible backends are:");
|
println!("Possible backends are:");
|
||||||
|
|
|
@ -33,6 +33,7 @@ impl Kind {
|
||||||
Kind::X11(ref t) => t.alive(),
|
Kind::X11(ref t) => t.alive(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_surface(&self) -> Option<&wl_surface::WlSurface> {
|
pub fn get_surface(&self) -> Option<&wl_surface::WlSurface> {
|
||||||
match *self {
|
match *self {
|
||||||
Kind::Xdg(ref t) => t.get_surface(),
|
Kind::Xdg(ref t) => t.get_surface(),
|
||||||
|
@ -84,6 +85,7 @@ impl PopupKind {
|
||||||
PopupKind::Xdg(ref t) => t.alive(),
|
PopupKind::Xdg(ref t) => t.alive(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_surface(&self) -> Option<&wl_surface::WlSurface> {
|
pub fn get_surface(&self) -> Option<&wl_surface::WlSurface> {
|
||||||
match *self {
|
match *self {
|
||||||
PopupKind::Xdg(ref t) => t.get_surface(),
|
PopupKind::Xdg(ref t) => t.get_surface(),
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl Drop for Plane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bitflags! {
|
bitflags::bitflags! {
|
||||||
/// Possible flags for a DMA buffer
|
/// Possible flags for a DMA buffer
|
||||||
pub struct DmabufFlags: u32 {
|
pub struct DmabufFlags: u32 {
|
||||||
/// The buffer content is Y-inverted
|
/// The buffer content is Y-inverted
|
||||||
|
|
|
@ -14,6 +14,8 @@ use drm::control::{
|
||||||
use super::{DevPath, FdWrapper};
|
use super::{DevPath, FdWrapper};
|
||||||
use crate::backend::drm::error::Error;
|
use crate::backend::drm::error::Error;
|
||||||
|
|
||||||
|
use slog::{error, o, trace};
|
||||||
|
|
||||||
type OldState = (
|
type OldState = (
|
||||||
Vec<(connector::Handle, PropertyValueSet)>,
|
Vec<(connector::Handle, PropertyValueSet)>,
|
||||||
Vec<(crtc::Handle, PropertyValueSet)>,
|
Vec<(crtc::Handle, PropertyValueSet)>,
|
||||||
|
|
|
@ -10,6 +10,8 @@ use drm::control::{connector, crtc, Device as ControlDevice};
|
||||||
use super::{DevPath, FdWrapper};
|
use super::{DevPath, FdWrapper};
|
||||||
use crate::backend::drm::error::Error;
|
use crate::backend::drm::error::Error;
|
||||||
|
|
||||||
|
use slog::{error, info, o};
|
||||||
|
|
||||||
pub struct LegacyDrmDevice<A: AsRawFd + 'static> {
|
pub struct LegacyDrmDevice<A: AsRawFd + 'static> {
|
||||||
pub(crate) fd: Arc<FdWrapper<A>>,
|
pub(crate) fd: Arc<FdWrapper<A>>,
|
||||||
pub(crate) active: Arc<AtomicBool>,
|
pub(crate) active: Arc<AtomicBool>,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[cfg(feature = "backend_session")]
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::os::unix::io::{AsRawFd, RawFd};
|
use std::os::unix::io::{AsRawFd, RawFd};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -16,6 +17,8 @@ use super::{error::Error, planes, Planes};
|
||||||
use atomic::AtomicDrmDevice;
|
use atomic::AtomicDrmDevice;
|
||||||
use legacy::LegacyDrmDevice;
|
use legacy::LegacyDrmDevice;
|
||||||
|
|
||||||
|
use slog::{error, info, o, trace, warn};
|
||||||
|
|
||||||
/// An open drm device
|
/// An open drm device
|
||||||
pub struct DrmDevice<A: AsRawFd + 'static> {
|
pub struct DrmDevice<A: AsRawFd + 'static> {
|
||||||
pub(super) dev_id: dev_t,
|
pub(super) dev_id: dev_t,
|
||||||
|
|
|
@ -18,6 +18,8 @@ use crate::{
|
||||||
signaling::{Linkable, Signaler},
|
signaling::{Linkable, Signaler},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{crit, error, info, o, warn};
|
||||||
|
|
||||||
struct DrmDeviceObserver<A: AsRawFd + 'static> {
|
struct DrmDeviceObserver<A: AsRawFd + 'static> {
|
||||||
dev_id: dev_t,
|
dev_id: dev_t,
|
||||||
dev: Weak<DrmDeviceInternal<A>>,
|
dev: Weak<DrmDeviceInternal<A>>,
|
||||||
|
|
|
@ -17,6 +17,8 @@ use crate::backend::drm::{
|
||||||
error::Error,
|
error::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, info, o, trace, warn};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
|
|
|
@ -14,6 +14,8 @@ use crate::backend::allocator::{
|
||||||
use crate::backend::drm::{device::DevPath, surface::DrmSurfaceInternal, DrmError, DrmSurface};
|
use crate::backend::drm::{device::DevPath, surface::DrmSurfaceInternal, DrmError, DrmSurface};
|
||||||
use crate::backend::SwapBuffersError;
|
use crate::backend::SwapBuffersError;
|
||||||
|
|
||||||
|
use slog::{debug, error, o, trace, warn};
|
||||||
|
|
||||||
/// Simplified by limited abstraction to link single [`DrmSurface`]s to renderers.
|
/// Simplified by limited abstraction to link single [`DrmSurface`]s to renderers.
|
||||||
///
|
///
|
||||||
/// # Use-case
|
/// # Use-case
|
||||||
|
|
|
@ -13,6 +13,8 @@ use crate::backend::drm::{
|
||||||
error::Error,
|
error::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, info, o, trace};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[cfg(feature = "backend_session")]
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
@ -18,8 +19,12 @@ use crate::backend::allocator::{Format, Fourcc, Modifier};
|
||||||
use atomic::AtomicDrmSurface;
|
use atomic::AtomicDrmSurface;
|
||||||
use legacy::LegacyDrmSurface;
|
use legacy::LegacyDrmSurface;
|
||||||
|
|
||||||
|
use slog::trace;
|
||||||
|
|
||||||
/// An open crtc + plane combination that can be used for scan-out
|
/// An open crtc + plane combination that can be used for scan-out
|
||||||
pub struct DrmSurface<A: AsRawFd + 'static> {
|
pub struct DrmSurface<A: AsRawFd + 'static> {
|
||||||
|
// This field is only read when 'backend_session' is enabled
|
||||||
|
#[allow(dead_code)]
|
||||||
pub(super) dev_id: dev_t,
|
pub(super) dev_id: dev_t,
|
||||||
pub(super) crtc: crtc::Handle,
|
pub(super) crtc: crtc::Handle,
|
||||||
pub(super) primary: plane::Handle,
|
pub(super) primary: plane::Handle,
|
||||||
|
|
|
@ -8,6 +8,8 @@ use crate::backend::allocator::Format as DrmFormat;
|
||||||
use crate::backend::egl::display::{EGLDisplay, PixelFormat};
|
use crate::backend::egl::display::{EGLDisplay, PixelFormat};
|
||||||
use crate::backend::egl::EGLSurface;
|
use crate::backend::egl::EGLSurface;
|
||||||
|
|
||||||
|
use slog::{info, o, trace};
|
||||||
|
|
||||||
/// EGL context for rendering
|
/// EGL context for rendering
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct EGLContext {
|
pub struct EGLContext {
|
||||||
|
|
|
@ -26,8 +26,10 @@ use crate::backend::egl::{
|
||||||
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
||||||
use crate::backend::egl::{BufferAccessError, EGLBuffer, Format};
|
use crate::backend::egl::{BufferAccessError, EGLBuffer, Format};
|
||||||
|
|
||||||
|
use slog::{debug, error, info, o, trace, warn};
|
||||||
|
|
||||||
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
||||||
lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
pub(crate) static ref BUFFER_READER: Mutex<Option<WeakBufferReader>> = Mutex::new(None);
|
pub(crate) static ref BUFFER_READER: Mutex<Option<WeakBufferReader>> = Mutex::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub mod egl {
|
||||||
use libloading::Library;
|
use libloading::Library;
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
pub static ref LIB: Library = unsafe { Library::new("libEGL.so.1") }.expect("Failed to load LibEGL");
|
pub static ref LIB: Library = unsafe { Library::new("libEGL.so.1") }.expect("Failed to load LibEGL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ use nix::libc::c_void;
|
||||||
|
|
||||||
#[allow(non_camel_case_types, dead_code, unused_mut, non_upper_case_globals)]
|
#[allow(non_camel_case_types, dead_code, unused_mut, non_upper_case_globals)]
|
||||||
pub mod ffi;
|
pub mod ffi;
|
||||||
use self::ffi::egl::types::EGLImage;
|
#[cfg(feature = "wayland_frontend")]
|
||||||
|
use self::{display::EGLDisplayHandle, ffi::egl::types::EGLImage};
|
||||||
|
|
||||||
pub mod display;
|
pub mod display;
|
||||||
pub mod native;
|
pub mod native;
|
||||||
|
@ -45,8 +46,8 @@ pub mod surface;
|
||||||
pub use self::display::EGLDisplay;
|
pub use self::display::EGLDisplay;
|
||||||
pub use self::surface::EGLSurface;
|
pub use self::surface::EGLSurface;
|
||||||
|
|
||||||
use self::display::EGLDisplayHandle;
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
#[cfg(feature = "wayland_frontend")]
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Error that can happen on optional EGL features
|
/// Error that can happen on optional EGL features
|
||||||
|
|
|
@ -15,6 +15,8 @@ use crate::backend::egl::{
|
||||||
EGLError, SwapBuffersError,
|
EGLError, SwapBuffersError,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, o, trace};
|
||||||
|
|
||||||
/// EGL surface of a given EGL context for rendering
|
/// EGL surface of a given EGL context for rendering
|
||||||
pub struct EGLSurface {
|
pub struct EGLSurface {
|
||||||
pub(crate) display: Arc<EGLDisplayHandle>,
|
pub(crate) display: Arc<EGLDisplayHandle>,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Common traits for input backends to receive input from.
|
//! Common traits for input backends to receive input from.
|
||||||
|
|
||||||
use std::{error::Error, string::ToString};
|
use std::error::Error;
|
||||||
|
|
||||||
/// A seat describes a group of input devices and at least one
|
/// A seat describes a group of input devices and at least one
|
||||||
/// graphics device belonging together.
|
/// graphics device belonging together.
|
||||||
|
@ -21,7 +21,8 @@ pub struct Seat {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Seat {
|
impl Seat {
|
||||||
pub(crate) fn new<S: ToString>(id: u64, name: S, capabilities: SeatCapabilities) -> Seat {
|
#[cfg(any(feature = "backend_winit", feature = "backend_libinput"))]
|
||||||
|
pub(crate) fn new<S: std::string::ToString>(id: u64, name: S, capabilities: SeatCapabilities) -> Seat {
|
||||||
Seat {
|
Seat {
|
||||||
id,
|
id,
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
|
@ -29,6 +30,7 @@ impl Seat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "backend_libinput")]
|
||||||
pub(crate) fn capabilities_mut(&mut self) -> &mut SeatCapabilities {
|
pub(crate) fn capabilities_mut(&mut self) -> &mut SeatCapabilities {
|
||||||
&mut self.capabilities
|
&mut self.capabilities
|
||||||
}
|
}
|
||||||
|
@ -329,6 +331,7 @@ pub struct TouchSlot {
|
||||||
id: u64,
|
id: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "backend_winit", feature = "backend_libinput"))]
|
||||||
impl TouchSlot {
|
impl TouchSlot {
|
||||||
pub(crate) fn new(id: u64) -> Self {
|
pub(crate) fn new(id: u64) -> Self {
|
||||||
TouchSlot { id }
|
TouchSlot { id }
|
||||||
|
|
|
@ -11,6 +11,8 @@ use std::{
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{info, warn};
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn on_device_event<F>(
|
pub fn on_device_event<F>(
|
||||||
callback: &mut F,
|
callback: &mut F,
|
||||||
|
|
|
@ -22,6 +22,8 @@ use std::{
|
||||||
|
|
||||||
use calloop::{EventSource, Interest, Mode, Poll, Readiness, Token};
|
use calloop::{EventSource, Interest, Mode, Poll, Readiness, Token};
|
||||||
|
|
||||||
|
use slog::{info, o};
|
||||||
|
|
||||||
// No idea if this is the same across unix platforms
|
// No idea if this is the same across unix platforms
|
||||||
// Lets make this linux exclusive for now, once someone tries to build it for
|
// Lets make this linux exclusive for now, once someone tries to build it for
|
||||||
// any BSD-like system, they can verify if this is right and make a PR to change this.
|
// any BSD-like system, they can verify if this is right and make a PR to change this.
|
||||||
|
@ -76,7 +78,7 @@ impl Linkable<SessionSignal> for LibinputInputBackend {
|
||||||
}
|
}
|
||||||
SessionSignal::ActivateSession | SessionSignal::ActivateDevice { .. } => {
|
SessionSignal::ActivateSession | SessionSignal::ActivateDevice { .. } => {
|
||||||
if input.resume().is_err() {
|
if input.resume().is_err() {
|
||||||
error!(log, "Failed to resume libinput context");
|
slog::error!(log, "Failed to resume libinput context");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//! Implementation of the rendering traits using OpenGL ES 2
|
//! Implementation of the rendering traits using OpenGL ES 2
|
||||||
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -20,7 +19,7 @@ mod version;
|
||||||
use super::{Bind, Frame, Renderer, Texture, Transform, Unbind};
|
use super::{Bind, Frame, Renderer, Texture, Transform, Unbind};
|
||||||
use crate::backend::allocator::{
|
use crate::backend::allocator::{
|
||||||
dmabuf::{Dmabuf, WeakDmabuf},
|
dmabuf::{Dmabuf, WeakDmabuf},
|
||||||
Buffer, Format,
|
Format,
|
||||||
};
|
};
|
||||||
use crate::backend::egl::{
|
use crate::backend::egl::{
|
||||||
ffi::egl::{self as ffi_egl, types::EGLImage},
|
ffi::egl::{self as ffi_egl, types::EGLImage},
|
||||||
|
@ -39,6 +38,8 @@ use crate::utils::Rectangle;
|
||||||
#[cfg(feature = "wayland_frontend")]
|
#[cfg(feature = "wayland_frontend")]
|
||||||
use wayland_server::protocol::{wl_buffer, wl_shm};
|
use wayland_server::protocol::{wl_buffer, wl_shm};
|
||||||
|
|
||||||
|
use slog::{debug, error, info, o, trace, warn};
|
||||||
|
|
||||||
#[allow(clippy::all, missing_docs)]
|
#[allow(clippy::all, missing_docs)]
|
||||||
pub mod ffi {
|
pub mod ffi {
|
||||||
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
|
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
|
||||||
|
@ -150,12 +151,14 @@ pub struct Gles2Renderer {
|
||||||
extensions: Vec<String>,
|
extensions: Vec<String>,
|
||||||
programs: [Gles2Program; shaders::FRAGMENT_COUNT],
|
programs: [Gles2Program; shaders::FRAGMENT_COUNT],
|
||||||
#[cfg(feature = "wayland_frontend")]
|
#[cfg(feature = "wayland_frontend")]
|
||||||
dmabuf_cache: HashMap<WeakDmabuf, Gles2Texture>,
|
dmabuf_cache: std::collections::HashMap<WeakDmabuf, Gles2Texture>,
|
||||||
egl: EGLContext,
|
egl: EGLContext,
|
||||||
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
#[cfg(all(feature = "wayland_frontend", feature = "use_system_lib"))]
|
||||||
egl_reader: Option<EGLBufferReader>,
|
egl_reader: Option<EGLBufferReader>,
|
||||||
gl: ffi::Gles2,
|
gl: ffi::Gles2,
|
||||||
destruction_callback: Receiver<CleanupResource>,
|
destruction_callback: Receiver<CleanupResource>,
|
||||||
|
// This field is only accessed if the image or wayland_frontend features are active
|
||||||
|
#[allow(dead_code)]
|
||||||
destruction_callback_sender: Sender<CleanupResource>,
|
destruction_callback_sender: Sender<CleanupResource>,
|
||||||
logger_ptr: Option<*mut ::slog::Logger>,
|
logger_ptr: Option<*mut ::slog::Logger>,
|
||||||
logger: ::slog::Logger,
|
logger: ::slog::Logger,
|
||||||
|
@ -456,7 +459,7 @@ impl Gles2Renderer {
|
||||||
target_surface: None,
|
target_surface: None,
|
||||||
buffers: Vec::new(),
|
buffers: Vec::new(),
|
||||||
#[cfg(feature = "wayland_frontend")]
|
#[cfg(feature = "wayland_frontend")]
|
||||||
dmabuf_cache: HashMap::new(),
|
dmabuf_cache: std::collections::HashMap::new(),
|
||||||
destruction_callback: rx,
|
destruction_callback: rx,
|
||||||
destruction_callback_sender: tx,
|
destruction_callback_sender: tx,
|
||||||
logger_ptr,
|
logger_ptr,
|
||||||
|
@ -689,6 +692,7 @@ impl ImportEgl for Gles2Renderer {
|
||||||
#[cfg(feature = "wayland_frontend")]
|
#[cfg(feature = "wayland_frontend")]
|
||||||
impl ImportDma for Gles2Renderer {
|
impl ImportDma for Gles2Renderer {
|
||||||
fn import_dmabuf(&mut self, buffer: &Dmabuf) -> Result<Gles2Texture, Gles2Error> {
|
fn import_dmabuf(&mut self, buffer: &Dmabuf) -> Result<Gles2Texture, Gles2Error> {
|
||||||
|
use crate::backend::allocator::Buffer;
|
||||||
if !self.extensions.iter().any(|ext| ext == "GL_OES_EGL_image") {
|
if !self.extensions.iter().any(|ext| ext == "GL_OES_EGL_image") {
|
||||||
return Err(Gles2Error::GLExtensionNotSupported(&["GL_OES_EGL_image"]));
|
return Err(Gles2Error::GLExtensionNotSupported(&["GL_OES_EGL_image"]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ use std::{cell::RefCell, io, os::unix::io::RawFd, path::Path, rc::Rc};
|
||||||
|
|
||||||
use calloop::{EventSource, Poll, Readiness, Token};
|
use calloop::{EventSource, Poll, Readiness, Token};
|
||||||
|
|
||||||
|
use slog::{error, info, o, warn};
|
||||||
|
|
||||||
/// [`Session`] using the best available interface
|
/// [`Session`] using the best available interface
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum AutoSession {
|
pub enum AutoSession {
|
||||||
|
|
|
@ -59,6 +59,8 @@ use std::{
|
||||||
|
|
||||||
use calloop::{EventSource, Poll, Readiness, Token};
|
use calloop::{EventSource, Poll, Readiness, Token};
|
||||||
|
|
||||||
|
use slog::{debug, error, info, o, warn};
|
||||||
|
|
||||||
use super::DBusConnection;
|
use super::DBusConnection;
|
||||||
|
|
||||||
struct LogindSessionImpl {
|
struct LogindSessionImpl {
|
||||||
|
|
|
@ -70,6 +70,8 @@ use std::{
|
||||||
#[cfg(feature = "backend_udev")]
|
#[cfg(feature = "backend_udev")]
|
||||||
use udev::Device as UdevDevice;
|
use udev::Device as UdevDevice;
|
||||||
|
|
||||||
|
use slog::{debug, error, info, o, trace, warn};
|
||||||
|
|
||||||
/// This environment variable can be used to specify a tty path
|
/// This environment variable can be used to specify a tty path
|
||||||
/// that will be used in [DirectSession::new] in case no explicit
|
/// that will be used in [DirectSession::new] in case no explicit
|
||||||
/// tty path has been provided.
|
/// tty path has been provided.
|
||||||
|
@ -77,23 +79,23 @@ pub const SMITHAY_DIRECT_TTY_ENV: &str = "SMITHAY_DIRECT_TTY";
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
mod tty {
|
mod tty {
|
||||||
ioctl_read_bad!(kd_get_mode, 0x4B3B, i16);
|
nix::ioctl_read_bad!(kd_get_mode, 0x4B3B, i16);
|
||||||
ioctl_write_int_bad!(kd_set_mode, 0x4B3A);
|
nix::ioctl_write_int_bad!(kd_set_mode, 0x4B3A);
|
||||||
pub const KD_TEXT: i16 = 0x00;
|
pub const KD_TEXT: i16 = 0x00;
|
||||||
pub const KD_GRAPHICS: i16 = 0x00;
|
pub const KD_GRAPHICS: i16 = 0x00;
|
||||||
|
|
||||||
ioctl_read_bad!(kd_get_kb_mode, 0x4B44, i32);
|
nix::ioctl_read_bad!(kd_get_kb_mode, 0x4B44, i32);
|
||||||
ioctl_write_int_bad!(kd_set_kb_mode, 0x4B45);
|
nix::ioctl_write_int_bad!(kd_set_kb_mode, 0x4B45);
|
||||||
pub const K_RAW: i32 = 0x00;
|
pub const K_RAW: i32 = 0x00;
|
||||||
pub const K_XLATE: i32 = 0x01;
|
pub const K_XLATE: i32 = 0x01;
|
||||||
pub const K_MEDIUMRAW: i32 = 0x02;
|
pub const K_MEDIUMRAW: i32 = 0x02;
|
||||||
pub const K_UNICODE: i32 = 0x03;
|
pub const K_UNICODE: i32 = 0x03;
|
||||||
pub const K_OFF: i32 = 0x04;
|
pub const K_OFF: i32 = 0x04;
|
||||||
|
|
||||||
ioctl_write_int_bad!(vt_activate, 0x5606);
|
nix::ioctl_write_int_bad!(vt_activate, 0x5606);
|
||||||
ioctl_write_int_bad!(vt_wait_active, 0x5607);
|
nix::ioctl_write_int_bad!(vt_wait_active, 0x5607);
|
||||||
ioctl_write_ptr_bad!(vt_set_mode, 0x5602, VtMode);
|
nix::ioctl_write_ptr_bad!(vt_set_mode, 0x5602, VtMode);
|
||||||
ioctl_write_int_bad!(vt_rel_disp, 0x5605);
|
nix::ioctl_write_int_bad!(vt_rel_disp, 0x5605);
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub struct VtMode {
|
pub struct VtMode {
|
||||||
|
|
|
@ -52,6 +52,8 @@ use udev::{Enumerator, EventType, MonitorBuilder, MonitorSocket};
|
||||||
|
|
||||||
use calloop::{EventSource, Interest, Mode, Poll, Readiness, Token};
|
use calloop::{EventSource, Interest, Mode, Poll, Readiness, Token};
|
||||||
|
|
||||||
|
use slog::{debug, info, o, warn};
|
||||||
|
|
||||||
/// Backend to monitor available drm devices.
|
/// Backend to monitor available drm devices.
|
||||||
///
|
///
|
||||||
/// Provides a way to automatically scan for available gpus and notifies the
|
/// Provides a way to automatically scan for available gpus and notifies the
|
||||||
|
|
|
@ -28,6 +28,8 @@ use winit::{
|
||||||
window::{Window as WinitWindow, WindowBuilder},
|
window::{Window as WinitWindow, WindowBuilder},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, error, info, o, trace, warn};
|
||||||
|
|
||||||
/// Errors thrown by the `winit` backends
|
/// Errors thrown by the `winit` backends
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -10,15 +10,8 @@
|
||||||
//! `log` crate. If not, the logs will discarded. This cargo feature is part of the default set of
|
//! `log` crate. If not, the logs will discarded. This cargo feature is part of the default set of
|
||||||
//! features of Smithay.
|
//! features of Smithay.
|
||||||
|
|
||||||
#[cfg_attr(feature = "backend_session", macro_use)]
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub extern crate nix;
|
pub extern crate nix;
|
||||||
#[macro_use]
|
|
||||||
extern crate slog;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate bitflags;
|
|
||||||
|
|
||||||
pub mod backend;
|
pub mod backend;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
@ -33,6 +26,7 @@ pub mod xwayland;
|
||||||
pub mod reexports;
|
pub mod reexports;
|
||||||
|
|
||||||
#[cfg(feature = "slog-stdlog")]
|
#[cfg(feature = "slog-stdlog")]
|
||||||
|
#[allow(dead_code)]
|
||||||
fn slog_or_fallback<L>(logger: L) -> ::slog::Logger
|
fn slog_or_fallback<L>(logger: L) -> ::slog::Logger
|
||||||
where
|
where
|
||||||
L: Into<Option<::slog::Logger>>,
|
L: Into<Option<::slog::Logger>>,
|
||||||
|
@ -40,15 +34,16 @@ where
|
||||||
use slog::Drain;
|
use slog::Drain;
|
||||||
logger
|
logger
|
||||||
.into()
|
.into()
|
||||||
.unwrap_or_else(|| ::slog::Logger::root(::slog_stdlog::StdLog.fuse(), o!()))
|
.unwrap_or_else(|| ::slog::Logger::root(::slog_stdlog::StdLog.fuse(), slog::o!()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "slog-stdlog"))]
|
#[cfg(not(feature = "slog-stdlog"))]
|
||||||
|
#[allow(dead_code)]
|
||||||
fn slog_or_fallback<L>(logger: L) -> ::slog::Logger
|
fn slog_or_fallback<L>(logger: L) -> ::slog::Logger
|
||||||
where
|
where
|
||||||
L: Into<Option<::slog::Logger>>,
|
L: Into<Option<::slog::Logger>>,
|
||||||
{
|
{
|
||||||
logger
|
logger
|
||||||
.into()
|
.into()
|
||||||
.unwrap_or_else(|| ::slog::Logger::root(::slog::Discard, o!()))
|
.unwrap_or_else(|| ::slog::Logger::root(::slog::Discard, slog::o!()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ use super::{
|
||||||
AlreadyHasRole, BufferAssignment, Damage, Rectangle, RectangleKind, RegionAttributes, SurfaceAttributes,
|
AlreadyHasRole, BufferAssignment, Damage, Rectangle, RectangleKind, RegionAttributes, SurfaceAttributes,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::trace;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wl_compositor
|
* wl_compositor
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -449,7 +449,7 @@ where
|
||||||
L: Into<Option<::slog::Logger>>,
|
L: Into<Option<::slog::Logger>>,
|
||||||
Impl: for<'a> FnMut(WlSurface, DispatchData<'a>) + 'static,
|
Impl: for<'a> FnMut(WlSurface, DispatchData<'a>) + 'static,
|
||||||
{
|
{
|
||||||
let log = crate::slog_or_fallback(logger).new(o!("smithay_module" => "compositor_handler"));
|
let log = crate::slog_or_fallback(logger).new(slog::o!("smithay_module" => "compositor_handler"));
|
||||||
let implem = Rc::new(RefCell::new(implem));
|
let implem = Rc::new(RefCell::new(implem));
|
||||||
|
|
||||||
let compositor = display.create_global(
|
let compositor = display.create_global(
|
||||||
|
|
|
@ -56,6 +56,8 @@ use wayland_server::{
|
||||||
Client, Display, Filter, Global, Main,
|
Client, Display, Filter, Global, Main,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, error, o};
|
||||||
|
|
||||||
use crate::wayland::{
|
use crate::wayland::{
|
||||||
compositor,
|
compositor,
|
||||||
seat::{GrabStartData, Seat},
|
seat::{GrabStartData, Seat},
|
||||||
|
|
|
@ -56,6 +56,8 @@ use wayland_protocols::unstable::linux_dmabuf::v1::server::{
|
||||||
};
|
};
|
||||||
use wayland_server::{protocol::wl_buffer, DispatchData, Display, Filter, Global, Main};
|
use wayland_server::{protocol::wl_buffer, DispatchData, Display, Filter, Global, Main};
|
||||||
|
|
||||||
|
use slog::{o, trace};
|
||||||
|
|
||||||
use crate::backend::allocator::{
|
use crate::backend::allocator::{
|
||||||
dmabuf::{Dmabuf, DmabufFlags, Plane},
|
dmabuf::{Dmabuf, DmabufFlags, Plane},
|
||||||
Format, Fourcc, Modifier,
|
Format, Fourcc, Modifier,
|
||||||
|
|
|
@ -190,7 +190,7 @@ where
|
||||||
L: Into<Option<::slog::Logger>>,
|
L: Into<Option<::slog::Logger>>,
|
||||||
{
|
{
|
||||||
let _log =
|
let _log =
|
||||||
crate::slog_or_fallback(logger).new(o!("smithay_module" => "wayland_explicit_synchronization"));
|
crate::slog_or_fallback(logger).new(slog::o!("smithay_module" => "wayland_explicit_synchronization"));
|
||||||
|
|
||||||
display.create_global::<ZwpLinuxExplicitSynchronizationV1, _>(
|
display.create_global::<ZwpLinuxExplicitSynchronizationV1, _>(
|
||||||
2,
|
2,
|
||||||
|
|
|
@ -59,6 +59,8 @@ use wayland_server::{
|
||||||
Display, Filter, Global, Main,
|
Display, Filter, Global, Main,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{info, o, trace, warn};
|
||||||
|
|
||||||
/// An output mode
|
/// An output mode
|
||||||
///
|
///
|
||||||
/// A possible combination of dimensions and refresh rate for an output.
|
/// A possible combination of dimensions and refresh rate for an output.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::backend::input::KeyState;
|
use crate::backend::input::KeyState;
|
||||||
use crate::wayland::Serial;
|
use crate::wayland::Serial;
|
||||||
|
use slog::{debug, info, o, trace, warn};
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
default::Default,
|
default::Default,
|
||||||
|
|
|
@ -133,7 +133,7 @@ impl Seat {
|
||||||
keyboard: None,
|
keyboard: None,
|
||||||
known_seats: Vec::new(),
|
known_seats: Vec::new(),
|
||||||
}),
|
}),
|
||||||
log: log.new(o!("smithay_module" => "seat_handler", "seat_name" => name.clone())),
|
log: log.new(slog::o!("smithay_module" => "seat_handler", "seat_name" => name.clone())),
|
||||||
name,
|
name,
|
||||||
user_data: UserDataMap::new(),
|
user_data: UserDataMap::new(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -679,7 +679,7 @@ where
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let shell_data = ShellData {
|
let shell_data = ShellData {
|
||||||
log: log.new(o!("smithay_module" => "xdg_shell_handler")),
|
log: log.new(slog::o!("smithay_module" => "xdg_shell_handler")),
|
||||||
user_impl: Rc::new(RefCell::new(implementation)),
|
user_impl: Rc::new(RefCell::new(implementation)),
|
||||||
shell_state: shell_state.clone(),
|
shell_state: shell_state.clone(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,7 +116,7 @@ where
|
||||||
formats.push(wl_shm::Format::Xrgb8888);
|
formats.push(wl_shm::Format::Xrgb8888);
|
||||||
let data = ShmGlobalData {
|
let data = ShmGlobalData {
|
||||||
formats: formats.into(),
|
formats: formats.into(),
|
||||||
log: log.new(o!("smithay_module" => "shm_handler")),
|
log: log.new(slog::o!("smithay_module" => "shm_handler")),
|
||||||
};
|
};
|
||||||
|
|
||||||
display.create_global::<wl_shm::WlShm, _>(
|
display.create_global::<wl_shm::WlShm, _>(
|
||||||
|
|
|
@ -13,6 +13,8 @@ use std::{
|
||||||
sync::{Once, RwLock},
|
sync::{Once, RwLock},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, trace};
|
||||||
|
|
||||||
thread_local!(static SIGBUS_GUARD: Cell<(*const MemMap, bool)> = Cell::new((ptr::null_mut(), false)));
|
thread_local!(static SIGBUS_GUARD: Cell<(*const MemMap, bool)> = Cell::new((ptr::null_mut(), false)));
|
||||||
|
|
||||||
static SIGBUS_INIT: Once = Once::new();
|
static SIGBUS_INIT: Once = Once::new();
|
||||||
|
|
|
@ -3,6 +3,8 @@ use std::{
|
||||||
os::unix::{io::FromRawFd, net::UnixStream},
|
os::unix::{io::FromRawFd, net::UnixStream},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{debug, info, warn};
|
||||||
|
|
||||||
use nix::{errno::Errno, sys::socket, Error as NixError, Result as NixResult};
|
use nix::{errno::Errno, sys::socket, Error as NixError, Result as NixResult};
|
||||||
|
|
||||||
/// Find a free X11 display slot and setup
|
/// Find a free X11 display slot and setup
|
||||||
|
|
|
@ -59,6 +59,8 @@ use calloop::{
|
||||||
Interest, LoopHandle, Mode, RegistrationToken,
|
Interest, LoopHandle, Mode, RegistrationToken,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use slog::{error, info, o};
|
||||||
|
|
||||||
use nix::Error as NixError;
|
use nix::Error as NixError;
|
||||||
|
|
||||||
use wayland_server::{Client, Display, Filter};
|
use wayland_server::{Client, Display, Filter};
|
||||||
|
|
Loading…
Reference in New Issue