Add reexports module
This commit is contained in:
parent
b379f1d7ed
commit
dc97e0ad03
|
@ -19,7 +19,7 @@ use smithay::backend::egl::{EGLDisplay, EGLGraphicsBackend};
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::{
|
||||
dev_t, device_bind,
|
||||
device_bind,
|
||||
egl::{EglDevice, EglSurface},
|
||||
gbm::{egl::Gbm as EglGbmBackend, GbmDevice},
|
||||
legacy::LegacyDrmDevice,
|
||||
|
@ -30,17 +30,28 @@ use smithay::{
|
|||
libinput::{libinput_bind, LibinputInputBackend, LibinputSessionInterface},
|
||||
session::{
|
||||
auto::{auto_session_bind, AutoSession},
|
||||
notify_multiplexer, AsSessionObserver, OFlag, Session, SessionNotifier,
|
||||
notify_multiplexer, AsSessionObserver, Session, SessionNotifier,
|
||||
},
|
||||
udev::{primary_gpu, udev_backend_bind, UdevBackend, UdevHandler},
|
||||
},
|
||||
drm::control::{
|
||||
connector::{Info as ConnectorInfo, State as ConnectorState},
|
||||
crtc,
|
||||
encoder::Info as EncoderInfo,
|
||||
reexports::{
|
||||
drm::control::{
|
||||
connector::{Info as ConnectorInfo, State as ConnectorState},
|
||||
crtc,
|
||||
encoder::Info as EncoderInfo,
|
||||
},
|
||||
image::{ImageBuffer, Rgba},
|
||||
input::Libinput,
|
||||
nix::{fcntl::OFlag, sys::stat::dev_t},
|
||||
wayland_server::{
|
||||
calloop::{
|
||||
generic::{EventedFd, Generic},
|
||||
EventLoop, LoopHandle, Source,
|
||||
},
|
||||
protocol::{wl_output, wl_surface},
|
||||
Display, Resource,
|
||||
},
|
||||
},
|
||||
image::{ImageBuffer, Rgba},
|
||||
input::Libinput,
|
||||
wayland::{
|
||||
compositor::CompositorToken,
|
||||
data_device::{default_action_chooser, init_data_device, set_data_device_focus, DataDeviceEvent},
|
||||
|
@ -48,14 +59,6 @@ use smithay::{
|
|||
seat::{CursorImageStatus, Seat, XkbConfig},
|
||||
shm::init_shm_global,
|
||||
},
|
||||
wayland_server::{
|
||||
calloop::{
|
||||
generic::{EventedFd, Generic},
|
||||
EventLoop, LoopHandle, Source,
|
||||
},
|
||||
protocol::{wl_output, wl_surface},
|
||||
Display, Resource,
|
||||
},
|
||||
};
|
||||
|
||||
use glium_drawer::GliumDrawer;
|
||||
|
|
|
@ -8,12 +8,17 @@ use drm::{buffer::PixelFormat, control::dumbbuffer::DumbBuffer};
|
|||
use slog::Drain;
|
||||
use smithay::{
|
||||
backend::drm::{
|
||||
connector::{self, State as ConnectorState},
|
||||
crtc, device_bind, encoder, framebuffer,
|
||||
device_bind,
|
||||
legacy::{error::Error, LegacyDrmDevice, LegacyDrmSurface},
|
||||
ControlDevice, Device, DeviceHandler, RawSurface, ResourceInfo, Surface,
|
||||
Device, DeviceHandler, RawSurface, Surface,
|
||||
},
|
||||
reexports::{
|
||||
drm::control::{
|
||||
connector::{self, State as ConnectorState},
|
||||
crtc, encoder, framebuffer, Device as ControlDevice, ResourceInfo,
|
||||
},
|
||||
wayland_server::calloop::EventLoop,
|
||||
},
|
||||
wayland_server::calloop::EventLoop,
|
||||
};
|
||||
use std::{
|
||||
fs::{File, OpenOptions},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub use drm::buffer::Buffer;
|
||||
use drm::buffer::Buffer;
|
||||
use drm::control::{connector, crtc, encoder, framebuffer, Device as ControlDevice, Mode, ResourceInfo};
|
||||
use drm::Device as BasicDevice;
|
||||
|
||||
|
|
|
@ -11,38 +11,35 @@
|
|||
//! ---
|
||||
//!
|
||||
//! Initialization of surfaces happens through the types provided by
|
||||
//! [`drm-rs`](https://docs.rs/drm/0.3.4/drm/).
|
||||
//! [`drm-rs`](drm).
|
||||
//!
|
||||
//! Four entities are relevant for the initialization procedure.
|
||||
//!
|
||||
//! [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html)s represent scanout engines
|
||||
//! [`crtc`](drm::control::crtc)s represent scanout engines
|
||||
//! of the device pointer to one framebuffer.
|
||||
//! Their responsibility is to read the data of the framebuffer and export it into an "Encoder".
|
||||
//! The number of crtc's represent the number of independant output devices the hardware may handle.
|
||||
//!
|
||||
//! An [`encoder`](https://docs.rs/drm/0.3.4/drm/control/encoder/index.html) encodes the data of
|
||||
//! An [`encoder`](drm::control::encoder) encodes the data of
|
||||
//! connected crtcs into a video signal for a fixed set of connectors.
|
||||
//! E.g. you might have an analog encoder based on a DAG for VGA ports, but another one for digital ones.
|
||||
//! Also not every encoder might be connected to every crtc.
|
||||
//!
|
||||
//! A [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html) represents a port
|
||||
//! A [`connector`](drm::control::connector) represents a port
|
||||
//! on your computer, possibly with a connected monitor, TV, capture card, etc.
|
||||
//!
|
||||
//! On surface creation a matching encoder for your `encoder`-`connector` is automatically selected,
|
||||
//! if it exists, which means you still need to check your configuration.
|
||||
//!
|
||||
//! At last a [`Mode`](https://docs.rs/drm/0.3.4/drm/control/struct.Mode.html) needs to be selected,
|
||||
//! At last a [`Mode`](drm::control::Mode) needs to be selected,
|
||||
//! supported by the `crtc` in question.
|
||||
//!
|
||||
|
||||
pub use drm::{
|
||||
buffer::Buffer,
|
||||
control::{
|
||||
connector, crtc, encoder, framebuffer, Device as ControlDevice, Mode, ResourceHandles, ResourceInfo,
|
||||
},
|
||||
use drm::{
|
||||
control::{connector, crtc, framebuffer, Device as ControlDevice, Mode, ResourceHandles, ResourceInfo},
|
||||
Device as BasicDevice,
|
||||
};
|
||||
pub use nix::libc::dev_t;
|
||||
use nix::libc::dev_t;
|
||||
|
||||
use std::error::Error;
|
||||
use std::iter::IntoIterator;
|
||||
|
@ -51,7 +48,7 @@ use std::path::PathBuf;
|
|||
|
||||
use wayland_server::calloop::generic::{EventedFd, Generic};
|
||||
use wayland_server::calloop::mio::Ready;
|
||||
pub use wayland_server::calloop::InsertError;
|
||||
use wayland_server::calloop::InsertError;
|
||||
use wayland_server::calloop::{LoopHandle, Source};
|
||||
|
||||
use super::graphics::SwapBuffersError;
|
||||
|
@ -94,9 +91,9 @@ pub trait Device: AsRawFd + DevPath {
|
|||
/// Creates a new rendering surface.
|
||||
///
|
||||
/// Initialization of surfaces happens through the types provided by
|
||||
/// [`drm-rs`](https://docs.rs/drm/0.3.4/drm/).
|
||||
/// [`drm-rs`](drm).
|
||||
///
|
||||
/// [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html)s represent scanout engines
|
||||
/// [`crtc`](drm::control::crtc)s represent scanout engines
|
||||
/// of the device pointer to one framebuffer.
|
||||
/// Their responsibility is to read the data of the framebuffer and export it into an "Encoder".
|
||||
/// The number of crtc's represent the number of independant output devices the hardware may handle.
|
||||
|
@ -109,19 +106,19 @@ pub trait Device: AsRawFd + DevPath {
|
|||
///
|
||||
/// You should not call this function manually, but rather use
|
||||
/// [`device_bind`] to register the device
|
||||
/// to an [`EventLoop`](https://docs.rs/calloop/0.4.2/calloop/struct.EventLoop.html)
|
||||
/// to an [`EventLoop`](wayland_server::calloop::EventLoop)
|
||||
/// to synchronize your rendering to the vblank events of the open crtc's
|
||||
fn process_events(&mut self);
|
||||
|
||||
/// Load the resource from a [`Device`] given its
|
||||
/// [`ResourceHandle`](https://docs.rs/drm/0.3.4/drm/control/trait.ResourceHandle.html)
|
||||
/// [`ResourceHandle`](drm::control::ResourceHandle)
|
||||
fn resource_info<T: ResourceInfo>(
|
||||
&self,
|
||||
handle: T::Handle,
|
||||
) -> Result<T, <Self::Surface as Surface>::Error>;
|
||||
|
||||
/// Attempts to acquire a copy of the [`Device`]'s
|
||||
/// [`ResourceHandles`](https://docs.rs/drm/0.3.4/drm/control/struct.ResourceHandles.html)
|
||||
/// [`ResourceHandle`](drm::control::ResourceHandle)
|
||||
fn resource_handles(&self) -> Result<ResourceHandles, <Self::Surface as Surface>::Error>;
|
||||
}
|
||||
|
||||
|
@ -134,48 +131,48 @@ pub trait RawDevice: Device<Surface = <Self as RawDevice>::Surface> {
|
|||
/// An open crtc that can be used for rendering
|
||||
pub trait Surface {
|
||||
/// Type repesenting a collection of
|
||||
/// [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html)s
|
||||
/// [`connector`](drm::control::connector)s
|
||||
/// returned by [`current_connectors`](Surface::current_connectors) and
|
||||
/// [`pending_connectors`](Surface::pending_connectors)
|
||||
type Connectors: IntoIterator<Item = connector::Handle>;
|
||||
/// Error type returned by methods of this trait
|
||||
type Error: Error + Send;
|
||||
|
||||
/// Returns the underlying [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html) of this surface
|
||||
/// Returns the underlying [`crtc`](drm::control::crtc) of this surface
|
||||
fn crtc(&self) -> crtc::Handle;
|
||||
/// Currently used [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html)s of this `Surface`
|
||||
/// Currently used [`connector`](drm::control::connector)s of this `Surface`
|
||||
fn current_connectors(&self) -> Self::Connectors;
|
||||
/// Returns the pending [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html)s
|
||||
/// Returns the pending [`connector`](drm::control::connector)s
|
||||
/// used after the next [`commit`](RawSurface::commit) of this [`Surface`]
|
||||
///
|
||||
/// *Note*: Only on a [`RawSurface`] you may directly trigger
|
||||
/// a [`commit`](RawSurface::commit). Other `Surface`s provide their
|
||||
/// own methods that *may* trigger a commit, you will need to read their docs.
|
||||
fn pending_connectors(&self) -> Self::Connectors;
|
||||
/// Tries to add a new [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html)
|
||||
/// Tries to add a new [`connector`](drm::control::connector)
|
||||
/// to be used after the next commit.
|
||||
///
|
||||
/// Fails if the `connector` is not compatible with the underlying [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html)
|
||||
/// (e.g. no suitable [`encoder`](https://docs.rs/drm/0.3.4/drm/control/encoder/index.html) may be found)
|
||||
/// Fails if the `connector` is not compatible with the underlying [`crtc`](drm::control::crtc)
|
||||
/// (e.g. no suitable [`encoder`](drm::control::encoder) may be found)
|
||||
/// or is not compatible with the currently pending
|
||||
/// [`Mode`](https://docs.rs/drm/0.3.4/drm/control/struct.Mode.html).
|
||||
/// [`Mode`](drm::control::Mode).
|
||||
fn add_connector(&self, connector: connector::Handle) -> Result<(), Self::Error>;
|
||||
/// Tries to mark a [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html)
|
||||
/// Tries to mark a [`connector`](drm::control::connector)
|
||||
/// for removal on the next commit.
|
||||
fn remove_connector(&self, connector: connector::Handle) -> Result<(), Self::Error>;
|
||||
/// Returns the currently active [`Mode`](https://docs.rs/drm/0.3.4/drm/control/struct.Mode.html)
|
||||
/// of the underlying [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html)
|
||||
/// Returns the currently active [`Mode`](drm::control::Mode)
|
||||
/// of the underlying [`crtc`](drm::control::crtc)
|
||||
/// if any.
|
||||
fn current_mode(&self) -> Option<Mode>;
|
||||
/// Returns the currently pending [`Mode`](https://docs.rs/drm/0.3.4/drm/control/struct.Mode.html)
|
||||
/// Returns the currently pending [`Mode`](drm::control::Mode)
|
||||
/// to be used after the next commit, if any.
|
||||
fn pending_mode(&self) -> Option<Mode>;
|
||||
/// Tries to set a new [`Mode`](https://docs.rs/drm/0.3.4/drm/control/struct.Mode.html)
|
||||
/// Tries to set a new [`Mode`](drm::control::Mode)
|
||||
/// to be used after the next commit.
|
||||
///
|
||||
/// Fails if the mode is not compatible with the underlying
|
||||
/// [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html) or any of the
|
||||
/// pending [`connector`](https://docs.rs/drm/0.3.4/drm/control/connector/index.html)s.
|
||||
/// [`crtc`](drm::control::crtc) or any of the
|
||||
/// pending [`connector`](drm::control::connector)s.
|
||||
///
|
||||
/// *Note*: Only on a [`RawSurface`] you may directly trigger
|
||||
/// a [`commit`](RawSurface::commit). Other [`Surface`]s provide their
|
||||
|
@ -200,7 +197,7 @@ pub trait RawSurface: Surface + ControlDevice + BasicDevice {
|
|||
///
|
||||
/// This operation is blocking until the crtc is in the desired state.
|
||||
fn commit(&self, framebuffer: framebuffer::Handle) -> Result<(), <Self as Surface>::Error>;
|
||||
/// Page-flip the underlying [`crtc`](https://docs.rs/drm/0.3.4/drm/control/crtc/index.html)
|
||||
/// Page-flip the underlying [`crtc`](drm::control::crtc)
|
||||
/// to a new given [`framebuffer`].
|
||||
///
|
||||
/// This will not cause the crtc to modeset.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(missing_docs)]
|
||||
|
||||
pub use nix::libc::{c_long, c_uint, c_void, int32_t, uint64_t};
|
||||
use nix::libc::{c_long, c_uint, c_void, int32_t, uint64_t};
|
||||
|
||||
pub type khronos_utime_nanoseconds_t = khronos_uint64_t;
|
||||
pub type khronos_uint64_t = uint64_t;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//! The following mechanisms are currently provided:
|
||||
//! - direct - legacy tty / virtual terminal kernel API
|
||||
//!
|
||||
pub use nix::fcntl::OFlag;
|
||||
use nix::fcntl::OFlag;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
os::unix::io::RawFd,
|
||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -7,28 +7,40 @@
|
|||
// `error_chain!` can recurse deeply
|
||||
#![recursion_limit = "1024"]
|
||||
|
||||
#[cfg(feature = "backend_drm_gbm")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate image;
|
||||
#[cfg_attr(feature = "backend_session", macro_use)]
|
||||
extern crate nix;
|
||||
#[doc(hidden)]
|
||||
pub extern crate nix;
|
||||
extern crate tempfile;
|
||||
#[doc(hidden)]
|
||||
pub extern crate wayland_commons;
|
||||
#[doc(hidden)]
|
||||
pub extern crate wayland_protocols;
|
||||
#[doc(hidden)]
|
||||
pub extern crate wayland_server;
|
||||
#[cfg(feature = "native_lib")]
|
||||
extern crate wayland_sys;
|
||||
extern crate xkbcommon;
|
||||
|
||||
#[cfg(feature = "dbus")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate dbus;
|
||||
#[cfg(feature = "backend_drm")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate drm;
|
||||
#[cfg(feature = "backend_drm_gbm")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate gbm;
|
||||
#[cfg(feature = "backend_libinput")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate input;
|
||||
#[cfg(feature = "backend_session_logind")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate systemd;
|
||||
#[cfg(feature = "backend_udev")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate udev;
|
||||
#[cfg(feature = "backend_winit")]
|
||||
extern crate wayland_client;
|
||||
|
@ -57,6 +69,8 @@ pub mod wayland;
|
|||
#[cfg(feature = "xwayland")]
|
||||
pub mod xwayland;
|
||||
|
||||
pub mod reexports;
|
||||
|
||||
fn slog_or_stdlog<L>(logger: L) -> ::slog::Logger
|
||||
where
|
||||
L: Into<Option<::slog::Logger>>,
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
//! Reexports of crates, that are part of the public api, for convenience
|
||||
|
||||
#[cfg(feature = "dbus")]
|
||||
pub use dbus;
|
||||
#[cfg(feature = "backend_drm")]
|
||||
pub use drm;
|
||||
#[cfg(feature = "backend_drm_gbm")]
|
||||
pub use gbm;
|
||||
#[cfg(feature = "backend_drm_gbm")]
|
||||
pub use image;
|
||||
#[cfg(feature = "backend_libinput")]
|
||||
pub use input;
|
||||
#[cfg(any(feature = "backend_udev", feature = "backend_drm"))]
|
||||
pub use nix;
|
||||
#[cfg(feature = "backend_session_logind")]
|
||||
pub use systemd;
|
||||
#[cfg(feature = "backend_udev")]
|
||||
pub use udev;
|
||||
pub use wayland_commons;
|
||||
pub use wayland_protocols;
|
||||
pub use wayland_server;
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub use wayland_server::protocol::wl_output::{Subpixel, Transform};
|
||||
use wayland_server::protocol::wl_output::{Subpixel, Transform};
|
||||
use wayland_server::{
|
||||
protocol::wl_output::{Event, Mode as WMode, Request, WlOutput},
|
||||
Display, Global, NewResource, Resource,
|
||||
|
|
Loading…
Reference in New Issue