Skip to content

Commit

Permalink
[docs] document WayshotConnection dmabuf constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
CheerfulPianissimo committed Aug 16, 2024
1 parent 3601ce1 commit 797ec9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libwayshot/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 5 additions & 0 deletions libwayshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
let (globals, evq) = registry_queue_init::<WayshotState>(&conn)?;
let linux_dmabuf =
Expand Down

0 comments on commit 797ec9f

Please sign in to comment.