<NME> mod.rs
<BEF> //! Backend (rendering/input) helpers
//!
//! This module provides helpers for interaction with the operating system.
//!
//! ## Module structure
//!
//! The module is largely structured around three main aspects of interaction with the OS:
//! session management, input handling, and graphics.
//!
//! ### Session management
//!
//! Session management relates to mechanisms allowing the compositor to access the resources
//! it needs to function. It contains interaction with the login manager if any ((e)logind or
//! - winit
//! - libinput

pub mod graphics;
pub mod input;

#[cfg(feature = "backend_drm")]
pub mod drm;
//! [`input`] module. An input provider following this API based on `libinput` is given in the
//! [`libinput`] module, gated by the `backend_libinput` cargo feature. The winit backend
//! (see below) also provides an input provider.
//!
//! ### Graphics
pub mod session;
#[cfg(feature = "backend_udev")]
pub mod udev;
#[cfg(feature = "backend_winit")]
pub mod winit;
//!
//! Alongside this infrastructure, Smithay also provides an alternative backend based on
//! [winit](https://crates.io/crates/winit), which makes it possible to run your compositor as
//! a Wayland or X11 client. You are encouraged to use the X11 backend where possible since winit
//! does not integrate into calloop too well. This backend is generally quite helpful for
//! development and debugging. That backend is both a renderer and an input provider, and is
//! accessible in the [`winit`] module, gated by the `backend_winit` cargo feature.
//!

pub mod allocator;
pub mod input;
pub mod renderer;

#[cfg(feature = "backend_drm")]
pub mod drm;
#[cfg(feature = "backend_egl")]
pub mod egl;
#[cfg(feature = "backend_libinput")]
pub mod libinput;
#[cfg(feature = "backend_session")]
pub mod session;
#[cfg(feature = "backend_udev")]
pub mod udev;

#[cfg(feature = "backend_vulkan")]
pub mod vulkan;

#[cfg(feature = "backend_winit")]
pub mod winit;

#[cfg(feature = "backend_x11")]
pub mod x11;

/// Error that can happen when swapping buffers.
#[derive(Debug, thiserror::Error)]
pub enum SwapBuffersError {
    /// The buffers have already been swapped.
    ///
    /// This error can be returned when `swap_buffers` has been called multiple times
    /// without any modification in between.
    #[error("Buffers are already swapped, swap_buffers was called too many times")]
    AlreadySwapped,
    /// The corresponding context has been lost and needs to be recreated.
    ///
    /// All the objects associated to it (textures, buffers, programs, etc.)
    /// need to be recreated from scratch. Underlying resources like native surfaces
    /// might also need to be recreated.
    ///
    /// Operations will have no effect. Functions that read textures, buffers, etc.
    /// will return uninitialized data instead.
    #[error("The context has been lost, it needs to be recreated: {0}")]
    ContextLost(Box<dyn std::error::Error + Send + Sync>),
    /// A temporary condition caused to rendering to fail.
    ///
    /// Depending on the underlying error this *might* require fixing internal state of the rendering backend,
    /// but failures mapped to `TemporaryFailure` are always recoverable without re-creating the entire stack,
    /// as is represented by `ContextLost`.
    ///
    /// Proceed after investigating the source to reschedule another full rendering step or just this page_flip at a later time.
    /// If the root cause cannot be discovered and subsequent renderings also fail, it is advised to fallback to
    /// recreation.
    #[error("A temporary condition caused the page flip to fail: {0}")]
    TemporaryFailure(Box<dyn std::error::Error + Send + Sync>),
}

<MSG> Remove the generic "graphics" module.

- Cursor is not necessary anymore as rendering hardware vs software
  cursors just depends on "where" you render the cursor.
- Format is replaced by drm-fourcc and more related to buffers and
  therefor the allocator module anyway.
- GL/Glium are replaced by the renderer module.
- Software was unused and very small anyway and can be implemented
  with the new renderer api.
- SwapBuffersError is (for now) just moved into the top-level backend module.

<DFF> @@ -14,8 +14,13 @@
 //! - winit
 //! - libinput
 
-pub mod graphics;
+// TODO TEMPORARY
+#![allow(missing_docs)]
+
+//pub mod graphics;
 pub mod input;
+pub mod allocator;
+pub mod renderer;
 
 #[cfg(feature = "backend_drm")]
 pub mod drm;
@@ -27,5 +32,38 @@ pub mod libinput;
 pub mod session;
 #[cfg(feature = "backend_udev")]
 pub mod udev;
+
 #[cfg(feature = "backend_winit")]
 pub mod winit;
+
+/// Error that can happen when swapping buffers.
+#[derive(Debug, thiserror::Error)]
+pub enum SwapBuffersError {
+    /// The buffers have already been swapped.
+    ///
+    /// This error can be returned when `swap_buffers` has been called multiple times
+    /// without any modification in between.
+    #[error("Buffers are already swapped, swap_buffers was called too many times")]
+    AlreadySwapped,
+    /// The corresponding context has been lost and needs to be recreated.
+    ///
+    /// All the objects associated to it (textures, buffers, programs, etc.)
+    /// need to be recreated from scratch. Underlying resources like native surfaces
+    /// might also need to be recreated.
+    ///
+    /// Operations will have no effect. Functions that read textures, buffers, etc.
+    /// will return uninitialized data instead.
+    #[error("The context has been lost, it needs to be recreated: {0}")]
+    ContextLost(Box<dyn std::error::Error>),
+    /// A temporary condition caused to rendering to fail.
+    ///
+    /// Depending on the underlying error this *might* require fixing internal state of the rendering backend,
+    /// but failures mapped to `TemporaryFailure` are always recoverable without re-creating the entire stack,
+    /// as is represented by `ContextLost`.
+    ///
+    /// Proceed after investigating the source to reschedule another full rendering step or just this page_flip at a later time.
+    /// If the root cause cannot be discovered and subsequent renderings also fail, it is advised to fallback to
+    /// recreation.
+    #[error("A temporary condition caused the page flip to fail: {0}")]
+    TemporaryFailure(Box<dyn std::error::Error>),
+}
\ No newline at end of file

Remove the generic "graphics" module.