diff --git a/src/backend/drm/legacy/mod.rs b/src/backend/drm/legacy/mod.rs index 5a0d221..0309e73 100644 --- a/src/backend/drm/legacy/mod.rs +++ b/src/backend/drm/legacy/mod.rs @@ -1,13 +1,22 @@ -use super::{DevPath, Device, DeviceHandler, RawDevice, Surface}; +//! +//! [`RawDevice`](../trait.RawDevice.html) and [`RawSurface`](../trait.RawSurface.html) +//! implementations using the legacy mode-setting infrastructure. +//! +//! Usually this implementation will be wrapped into a [`GbmDevice`](../gbm/struct.GbmDevice.html). +//! Take a look at `anvil`s source code for an example of this. +//! +//! For an example how to use this standalone, take a look at the `raw_drm` example. +//! -use drm::control::{connector, crtc, encoder, Device as ControlDevice, Mode, ResourceHandles, ResourceInfo}; +use super::{DevPath, Device, DeviceHandler, RawDevice}; + +use drm::control::{connector, crtc, encoder, Device as ControlDevice, ResourceHandles, ResourceInfo}; use drm::Device as BasicDevice; use nix::libc::dev_t; use nix::sys::stat::fstat; use std::cell::RefCell; use std::collections::{HashMap, HashSet}; -use std::iter::FromIterator; use std::os::unix::io::{AsRawFd, RawFd}; use std::rc::{Rc, Weak}; use std::sync::atomic::{AtomicBool, Ordering}; @@ -23,6 +32,7 @@ use self::error::*; #[cfg(feature = "backend_session")] pub mod session; +/// Open raw drm device utilizing legacy mode-setting pub struct LegacyDrmDevice { dev: Rc>, dev_id: dev_t, diff --git a/src/backend/drm/legacy/session.rs b/src/backend/drm/legacy/session.rs index 3f75a13..0d86145 100644 --- a/src/backend/drm/legacy/session.rs +++ b/src/backend/drm/legacy/session.rs @@ -1,4 +1,9 @@ -use drm::control::{connector, crtc}; +//! +//! Support to register an open [`LegacyDrmDevice`](../struct.LegacyDrmDevice.html) +//! to an open [`Session`](../../session/trait.Session.html). +//! + +use drm::control::{crtc}; use drm::Device as BasicDevice; use nix::libc::dev_t; use nix::sys::stat; @@ -12,7 +17,9 @@ use std::sync::Arc; use super::{Dev, LegacyDrmDevice, LegacyDrmSurfaceInternal}; use backend::session::{AsSessionObserver, SessionObserver}; -/// `SessionObserver` linked to the `DrmDevice` it was created from. +/// [`SessionObserver`](../../session/trait.SessionObserver.html) +/// linked to the [`LegacyDrmDevice`](../struct.LegacyDrmDevice.html) +/// it was created from. pub struct LegacyDrmDeviceObserver { dev: Weak>, dev_id: dev_t, diff --git a/src/backend/drm/legacy/surface.rs b/src/backend/drm/legacy/surface.rs index e1ebbd4..3a20d4d 100644 --- a/src/backend/drm/legacy/surface.rs +++ b/src/backend/drm/legacy/surface.rs @@ -233,17 +233,9 @@ impl Drop for LegacyDrmSurfaceInternal { } } +/// Open raw crtc utilizing legacy mode-setting pub struct LegacyDrmSurface(pub(super) Rc>); -impl AsRawFd for LegacyDrmSurface { - fn as_raw_fd(&self) -> RawFd { - self.0.as_raw_fd() - } -} - -impl BasicDevice for LegacyDrmSurface {} -impl ControlDevice for LegacyDrmSurface {} - impl<'a, A: AsRawFd + 'static> CursorBackend<'a> for LegacyDrmSurface { type CursorFormat = &'a Buffer; type Error = Error;