From 4fc1e44f624c1c6f3b5b5d4470cb88ef3eaf4f7f Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Wed, 22 Feb 2017 19:36:52 +0100 Subject: [PATCH] shm: detail what SHM is --- src/shm/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shm/mod.rs b/src/shm/mod.rs index 74be8c6..61d1ef9 100644 --- a/src/shm/mod.rs +++ b/src/shm/mod.rs @@ -2,6 +2,15 @@ //! //! This module provides helpers to handle SHM-based buffers from wayland clients. //! +//! SHM (Shared Memory) is the most basic way wayland clients can send content to +//! the compositor: by sending a file descriptor to some (likely RAM-backed) storage +//! containing the actual data. This helper handles for you most of the logic for +//! handling these file descriptor and accessing their contents as simple `&[u8]` slices. +//! +//! This module is heavily inspired from +//! [the similar helpers](https://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-shm.c) +//! of the wayland C libraries. +//! //! To use it, first add a `ShmGlobal` to your event loop, specifying the formats //! you want to support (ARGB8888 and XRGB8888 are always considered as supported, //! as specified by the wayland protocol) and obtain its `ShmGlobalToken`. @@ -47,7 +56,7 @@ //! //! **Note** //! -//! This handler makes itself safe regading the client providing a wring size for the memory pool +//! This handler makes itself safe regading the client providing a wrong size for the memory pool //! by using a SIGBUS handler. //! //! If you are already using an handler for this signal, you probably don't want to use this handler.