Skip to content

Commit

Permalink
docs: added drm/legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Dec 2, 2018
1 parent 2c35836 commit b5782d9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
16 changes: 13 additions & 3 deletions src/backend/drm/legacy/mod.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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<A: AsRawFd + 'static> {
dev: Rc<Dev<A>>,
dev_id: dev_t,
Expand Down
7 changes: 6 additions & 1 deletion src/backend/drm/legacy/session.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
use drm::control::{connector, crtc};
//!
//! Support to register 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;
Expand Down
10 changes: 1 addition & 9 deletions src/backend/drm/legacy/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,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>>);

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> {
type CursorFormat = &'a Buffer;
type Error = Error;
Expand Down

0 comments on commit b5782d9

Please sign in to comment.