Skip to content

Commit

Permalink
[fix] remove hardcoded GPU path from libwayshot constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
CheerfulPianissimo committed Aug 16, 2024
1 parent 4adb349 commit e204fb8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion libwayshot/examples/waymirror-egl/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ impl WaylandEGLState {
xdg_surface: None,
xdg_toplevel: None,
wl_compositor: None,
wayshot: WayshotConnection::from_connection_with_dmabuf(server_connection).unwrap(),
wayshot: WayshotConnection::from_connection_with_dmabuf(
server_connection,
"/dev/dri/renderD128",
)
.unwrap(),
})
}

Expand Down
3 changes: 2 additions & 1 deletion libwayshot/examples/waymirror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ fn main() {

let display = conn.display();
display.get_registry(&qhandle, ());
let wayshot = WayshotConnection::from_connection_with_dmabuf(conn).unwrap();
let wayshot =
WayshotConnection::from_connection_with_dmabuf(conn, "/dev/dri/renderD128").unwrap();

let mut state = State {
wayshot,
Expand Down
4 changes: 2 additions & 2 deletions libwayshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ impl WayshotConnection {
Ok(initial_state)
}

pub fn from_connection_with_dmabuf(conn: Connection) -> Result<Self> {
pub fn from_connection_with_dmabuf(conn: Connection, device_path: &str) -> Result<Self> {
let (globals, evq) = registry_queue_init::<WayshotState>(&conn)?;
let linux_dmabuf =
globals.bind(&evq.handle(), 4..=ZwpLinuxDmabufV1::interface().version, ())?;
let gpu = dispatch::Card::open("/dev/dri/renderD128");
let gpu = dispatch::Card::open(device_path);
// init a GBM device
let gbm = GBMDevice::new(gpu).unwrap();
let mut initial_state = Self {
Expand Down

0 comments on commit e204fb8

Please sign in to comment.