From 797ec9ff8a7cc99fef6b74697cb6978e15b6147c Mon Sep 17 00:00:00 2001 From: CheerfulPianissimo Date: Fri, 16 Aug 2024 23:39:31 +0530 Subject: [PATCH] [docs] document WayshotConnection dmabuf constructor --- libwayshot/src/error.rs | 2 +- libwayshot/src/lib.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libwayshot/src/error.rs b/libwayshot/src/error.rs index f01c42c8..49fc5633 100644 --- a/libwayshot/src/error.rs +++ b/libwayshot/src/error.rs @@ -36,7 +36,7 @@ pub enum Error { ProtocolNotFound(String), #[error("error occurred in freeze callback")] FreezeCallbackError, - #[error("dmabuf configuration not initialized")] + #[error("dmabuf configuration not initialized. Did you not use Wayshot::from_connection_with_dmabuf()?")] NoDMAStateError, #[error("dmabuf color format provided by compositor is invalid")] UnrecognizedColorCode(#[from] UnrecognizedFourcc), diff --git a/libwayshot/src/lib.rs b/libwayshot/src/lib.rs index e76bf770..bc056c6f 100644 --- a/libwayshot/src/lib.rs +++ b/libwayshot/src/lib.rs @@ -109,6 +109,11 @@ impl WayshotConnection { Ok(initial_state) } + ///Create a WayshotConnection struct having DMA-BUF support + /// Using this connection is required to make use of the dmabuf functions + ///# Parameters + /// - conn: a Wayland connection + /// - device_path: string pointing to the DRI device that is to be used for creating the DMA-BUFs on. For example: "/dev/dri/renderD128" pub fn from_connection_with_dmabuf(conn: Connection, device_path: &str) -> Result { let (globals, evq) = registry_queue_init::(&conn)?; let linux_dmabuf =