From fe84611c506573b05ffbfe300d130adc5d3aeed1 Mon Sep 17 00:00:00 2001 From: Nova Date: Fri, 17 Nov 2023 08:59:10 -0500 Subject: [PATCH] feat: upgrade smithay --- Cargo.lock | 155 ++++++++++++++----------------------------- Cargo.toml | 3 +- src/main.rs | 1 - src/wayland/mod.rs | 9 ++- src/wayland/state.rs | 14 ++-- 5 files changed, 65 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a361a219..fede8be1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -540,6 +540,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "cursor-icon" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" + [[package]] name = "directories" version = "5.0.1" @@ -576,7 +582,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.0", + "libloading 0.7.4", ] [[package]] @@ -587,25 +593,25 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "drm" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb1b703ffbc7ebd216eba7900008049a56ace55580ecb2ee7fa801e8d8be87" +checksum = "e58eefd79f5173683872c0c82d0f05c2dc3c583d631259f60bb7a323756b7ff2" dependencies = [ "bitflags 2.4.0", "bytemuck", "drm-ffi", "drm-fourcc", - "nix 0.27.1", + "rustix", ] [[package]] name = "drm-ffi" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7d1c19c4b6270e89d59fb27dc6d02a317c658a8a54e54781e1db9b5947595d" +checksum = "220dd8c12ebf2b0cbaffa19e00de02f5f090d363fb900f16ea012c077eea1174" dependencies = [ "drm-sys", - "nix 0.27.1", + "rustix", ] [[package]] @@ -616,9 +622,13 @@ checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" [[package]] name = "drm-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4f1c0468062a56cd5705f1e3b5409eb286d5596a2028ec8e947595d7e715ae" +checksum = "5115283ec60c99da8a9e5dc3c55f27680211e974c948cb6f3b51f0373190503b" +dependencies = [ + "libc", + "linux-raw-sys 0.6.1", +] [[package]] name = "either" @@ -627,69 +637,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] -name = "encoding" -version = "0.2.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" -dependencies = [ - "encoding-index-japanese", - "encoding-index-korean", - "encoding-index-simpchinese", - "encoding-index-singlebyte", - "encoding-index-tradchinese", -] - -[[package]] -name = "encoding-index-japanese" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-korean" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-simpchinese" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-singlebyte" -version = "1.20141219.5" +name = "encoding_rs" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-tradchinese" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" -dependencies = [ - "encoding_index_tests", + "cfg-if", ] -[[package]] -name = "encoding_index_tests" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" - [[package]] name = "equivalent" version = "1.0.1" @@ -698,25 +653,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eyre" version = "0.6.8" @@ -1166,9 +1110,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -1192,9 +1136,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" + +[[package]] +name = "linux-raw-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4a7ec558fa3b65e4c69b6af8df01fb9ad51ac69262335e1505276bc091935d" [[package]] name = "lock_api" @@ -1260,9 +1210,9 @@ checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memmap2" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +checksum = "43a5a03cefb0d953ec0be133036f14e109412fa594edc2f77227249db66cc3ed" dependencies = [ "libc", ] @@ -1276,15 +1226,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.17" @@ -1350,7 +1291,7 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset 0.7.1", + "memoffset", "pin-utils", ] @@ -1363,7 +1304,6 @@ dependencies = [ "bitflags 2.4.0", "cfg-if", "libc", - "memoffset 0.9.0", ] [[package]] @@ -1878,14 +1818,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.14" +version = "0.38.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" +checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" dependencies = [ "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.11", "windows-sys", ] @@ -2015,26 +1955,28 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay/smithay.git#298a3ec08bf6ea6da8dc6e1e4c6d29d821fc040f" +source = "git+https://github.com/smithay/smithay.git#5c688b89fc97ade8c60c45d4a319311b7ec5292f" dependencies = [ "appendlist", "bitflags 2.4.0", "calloop", "cgmath", + "cursor-icon", "downcast-rs", "drm", "drm-ffi", "drm-fourcc", - "encoding", + "encoding_rs", + "errno", "gl_generator", "indexmap 2.0.0", "lazy_static", "libc", "libloading 0.8.0", - "nix 0.27.1", "once_cell", "profiling", "rand", + "rustix", "scan_fmt", "scopeguard", "smallvec", @@ -2122,6 +2064,7 @@ dependencies = [ "libc", "mint", "nanoid", + "nix 0.27.1", "once_cell", "parking_lot 0.12.1", "portable-atomic", @@ -2772,9 +2715,9 @@ dependencies = [ [[package]] name = "xkbcommon" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c286371c44b3572d19b09196c129a8fff47d7704d6494daefb44fec10f0278ab" +checksum = "13867d259930edc7091a6c41b4ce6eee464328c6ff9659b7e4c668ca20d4c91e" dependencies = [ "libc", "memmap2", diff --git a/Cargo.toml b/Cargo.toml index db999acf..03e611bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,10 +58,11 @@ tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } global_counter = "0.2.2" rand = "0.8.5" atty = "0.2.14" -xkbcommon = { version = "0.6.0", default-features = false, optional = true } +xkbcommon = { version = "0.7.0", default-features = false, optional = true } ctrlc = "3.4.1" libc = "0.2.148" input-event-codes = "5.16.8" +nix = "0.27.1" [dependencies.smithay] # git = "https://github.com/technobaboo/smithay.git" # Until we get stereokit to understand OES samplers and external textures diff --git a/src/main.rs b/src/main.rs index a2e991b2..4cf8a0ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,6 @@ use self::core::eventloop::EventLoop; use clap::Parser; use directories::ProjectDirs; use once_cell::sync::OnceCell; -use smithay::reexports::nix; use stardust_xr::server; use std::os::unix::process::CommandExt; use std::path::PathBuf; diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index 81e11770..50f1b5ca 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -24,6 +24,7 @@ use smithay::backend::renderer::ImportDma; use smithay::reexports::wayland_server::backend::ClientId; use smithay::reexports::wayland_server::DisplayHandle; use smithay::reexports::wayland_server::{Display, ListeningSocket}; +use smithay::wayland::dmabuf; use std::ffi::OsStr; use std::os::fd::OwnedFd; use std::os::unix::prelude::AsRawFd; @@ -86,7 +87,7 @@ pub struct Wayland { pub socket_name: Option, join_handle: JoinHandle>, renderer: GlesRenderer, - dmabuf_rx: UnboundedReceiver, + dmabuf_rx: UnboundedReceiver<(Dmabuf, dmabuf::ImportNotifier)>, wayland_state: Arc>, #[cfg(feature = "xwayland")] pub xwayland_state: xwayland::XWaylandState, @@ -180,8 +181,10 @@ impl Wayland { #[instrument(level = "debug", name = "Wayland frame", skip(self, sk))] pub fn update(&mut self, sk: &impl StereoKitDraw) { - while let Ok(dmabuf) = self.dmabuf_rx.try_recv() { - let _ = self.renderer.import_dmabuf(&dmabuf, None); + while let Ok((dmabuf, notifier)) = self.dmabuf_rx.try_recv() { + if self.renderer.import_dmabuf(&dmabuf, None).is_err() { + notifier.failed(); + } } for core_surface in CORE_SURFACES.get_valid_contents() { core_surface.process(sk, &mut self.renderer); diff --git a/src/wayland/state.rs b/src/wayland/state.rs index 1ece4e77..b2a82538 100644 --- a/src/wayland/state.rs +++ b/src/wayland/state.rs @@ -23,7 +23,6 @@ use smithay::{ compositor::{CompositorClientState, CompositorState}, dmabuf::{ self, DmabufFeedback, DmabufFeedbackBuilder, DmabufGlobal, DmabufHandler, DmabufState, - ImportError, }, shell::kde::decoration::KdeDecorationState, shm::{ShmHandler, ShmState}, @@ -43,7 +42,9 @@ pub struct ClientState { } impl ClientState { pub fn flush(&self) { - let Some(display) = self.display.upgrade() else {return}; + let Some(display) = self.display.upgrade() else { + return; + }; let _ = display.flush_clients(self.id.get().cloned()); } } @@ -70,7 +71,7 @@ pub struct WaylandState { pub kde_decoration_state: KdeDecorationState, pub shm_state: ShmState, dmabuf_state: (DmabufState, DmabufGlobal, Option), - dmabuf_tx: UnboundedSender, + dmabuf_tx: UnboundedSender<(Dmabuf, dmabuf::ImportNotifier)>, pub output: Output, } @@ -78,7 +79,7 @@ impl WaylandState { pub fn new( display_handle: DisplayHandle, renderer: &GlesRenderer, - dmabuf_tx: UnboundedSender, + dmabuf_tx: UnboundedSender<(Dmabuf, dmabuf::ImportNotifier)>, ) -> Arc> { let compositor_state = CompositorState::new::(&display_handle); // let xdg_activation_state = XdgActivationState::new::(&display_handle); @@ -188,8 +189,9 @@ impl DmabufHandler for WaylandState { &mut self, _global: &DmabufGlobal, dmabuf: Dmabuf, - ) -> Result<(), dmabuf::ImportError> { - self.dmabuf_tx.send(dmabuf).map_err(|_| ImportError::Failed) + notifier: dmabuf::ImportNotifier, + ) { + self.dmabuf_tx.send((dmabuf, notifier)).unwrap(); } } delegate_dmabuf!(WaylandState);