backend.drm: update doc examples

This commit is contained in:
Victor Berger 2018-04-18 09:44:22 +02:00
parent 7f6af94733
commit 31a3d40589
1 changed files with 6 additions and 7 deletions

View File

@ -66,8 +66,6 @@
//! impl ControlDevice for Card {} //! impl ControlDevice for Card {}
//! //!
//! # fn main() { //! # fn main() {
//! let (_display, mut event_loop) = wayland_server::create_display();
//!
//! // Open the drm device //! // Open the drm device
//! let mut options = OpenOptions::new(); //! let mut options = OpenOptions::new();
//! options.read(true); //! options.read(true);
@ -139,7 +137,6 @@
//! # use std::time::Duration; //! # use std::time::Duration;
//! use smithay::backend::drm::{DrmDevice, DrmBackend, DrmHandler, drm_device_bind}; //! use smithay::backend::drm::{DrmDevice, DrmBackend, DrmHandler, drm_device_bind};
//! use smithay::backend::graphics::egl::EGLGraphicsBackend; //! use smithay::backend::graphics::egl::EGLGraphicsBackend;
//! use wayland_server::EventLoopHandle;
//! # //! #
//! # #[derive(Debug)] //! # #[derive(Debug)]
//! # pub struct Card(File); //! # pub struct Card(File);
@ -153,7 +150,7 @@
//! # //! #
//! # fn main() { //! # fn main() {
//! # //! #
//! # let (_display, mut event_loop) = wayland_server::create_display(); //! # let (_display, mut event_loop) = wayland_server::Display::new();
//! # //! #
//! # let mut options = OpenOptions::new(); //! # let mut options = OpenOptions::new();
//! # options.read(true); //! # options.read(true);
@ -181,7 +178,6 @@
//! impl DrmHandler<Card> for MyDrmHandler { //! impl DrmHandler<Card> for MyDrmHandler {
//! fn ready( //! fn ready(
//! &mut self, //! &mut self,
//! _evlh: &mut EventLoopHandle,
//! _device: &mut DrmDevice<Card>, //! _device: &mut DrmDevice<Card>,
//! _crtc: CrtcHandle, //! _crtc: CrtcHandle,
//! _frame: u32, //! _frame: u32,
@ -192,7 +188,6 @@
//! } //! }
//! fn error( //! fn error(
//! &mut self, //! &mut self,
//! _evlh: &mut EventLoopHandle,
//! device: &mut DrmDevice<Card>, //! device: &mut DrmDevice<Card>,
//! error: DrmError) //! error: DrmError)
//! { //! {
@ -203,7 +198,11 @@
//! // render something (like clear_color) //! // render something (like clear_color)
//! backend.swap_buffers().unwrap(); //! backend.swap_buffers().unwrap();
//! //!
//! let _source = drm_device_bind(&mut event_loop, device, MyDrmHandler(backend)).map_err(|(err, _)| err).unwrap(); //! let (_source, _device_rc) = drm_device_bind(
//! &event_loop.token(),
//! device,
//! MyDrmHandler(backend)
//! ).map_err(|(err, _)| err).unwrap();
//! //!
//! event_loop.run().unwrap(); //! event_loop.run().unwrap();
//! # } //! # }