docs: added drm/legacy

This commit is contained in:
Victor Brekenfeld 2018-12-02 21:58:08 +01:00
parent 174c150887
commit 3b92e351b1
3 changed files with 23 additions and 14 deletions

View File

@ -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 drm::Device as BasicDevice;
use nix::libc::dev_t; use nix::libc::dev_t;
use nix::sys::stat::fstat; use nix::sys::stat::fstat;
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::iter::FromIterator;
use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::io::{AsRawFd, RawFd};
use std::rc::{Rc, Weak}; use std::rc::{Rc, Weak};
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
@ -23,6 +32,7 @@ use self::error::*;
#[cfg(feature = "backend_session")] #[cfg(feature = "backend_session")]
pub mod session; pub mod session;
/// Open raw drm device utilizing legacy mode-setting
pub struct LegacyDrmDevice<A: AsRawFd + 'static> { pub struct LegacyDrmDevice<A: AsRawFd + 'static> {
dev: Rc<Dev<A>>, dev: Rc<Dev<A>>,
dev_id: dev_t, dev_id: dev_t,

View File

@ -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 drm::Device as BasicDevice;
use nix::libc::dev_t; use nix::libc::dev_t;
use nix::sys::stat; use nix::sys::stat;
@ -12,7 +17,9 @@ use std::sync::Arc;
use super::{Dev, LegacyDrmDevice, LegacyDrmSurfaceInternal}; use super::{Dev, LegacyDrmDevice, LegacyDrmSurfaceInternal};
use backend::session::{AsSessionObserver, SessionObserver}; 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<A: AsRawFd + 'static> { pub struct LegacyDrmDeviceObserver<A: AsRawFd + 'static> {
dev: Weak<Dev<A>>, dev: Weak<Dev<A>>,
dev_id: dev_t, dev_id: dev_t,

View File

@ -233,17 +233,9 @@ impl<A: AsRawFd + 'static> Drop for LegacyDrmSurfaceInternal<A> {
} }
} }
/// Open raw crtc utilizing legacy mode-setting
pub struct LegacyDrmSurface<A: AsRawFd + 'static>(pub(super) Rc<LegacyDrmSurfaceInternal<A>>); pub struct LegacyDrmSurface<A: AsRawFd + 'static>(pub(super) Rc<LegacyDrmSurfaceInternal<A>>);
impl<A: AsRawFd + 'static> AsRawFd for LegacyDrmSurface<A> {
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
}
impl<A: AsRawFd + 'static> BasicDevice for LegacyDrmSurface<A> {}
impl<A: AsRawFd + 'static> ControlDevice for LegacyDrmSurface<A> {}
impl<'a, A: AsRawFd + 'static> CursorBackend<'a> for LegacyDrmSurface<A> { impl<'a, A: AsRawFd + 'static> CursorBackend<'a> for LegacyDrmSurface<A> {
type CursorFormat = &'a Buffer; type CursorFormat = &'a Buffer;
type Error = Error; type Error = Error;