From 928886563def6b127fe261dfb8e3c79a4cd3b073 Mon Sep 17 00:00:00 2001 From: Nova Date: Sat, 20 Sep 2025 14:32:13 -0700 Subject: [PATCH] update: rust version and cargo.toml --- Cargo.lock | 168 ++++++++++++++++------------------- Cargo.toml | 19 ++-- src/core/registry.rs | 2 +- src/wayland/core/shm_pool.rs | 2 +- src/wayland/mod.rs | 23 ++--- 5 files changed, 93 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c726076..cb753b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -829,7 +829,7 @@ dependencies = [ "derive_more", "disqualified", "fixedbitset 0.5.7", - "indexmap 2.10.0", + "indexmap 2.11.4", "log", "nonmax", "serde", @@ -949,9 +949,7 @@ dependencies = [ "guillotiere", "half 2.6.0", "image", - "ktx2", "rectangle-pack", - "ruzstd", "serde", "thiserror 2.0.16", "tracing", @@ -1312,9 +1310,8 @@ dependencies = [ "fixedbitset 0.5.7", "futures-lite", "image", - "indexmap 2.10.0", + "indexmap 2.11.4", "js-sys", - "ktx2", "naga", "naga_oil", "nonmax", @@ -2976,7 +2973,7 @@ dependencies = [ "log", "presser", "thiserror 1.0.69", - "windows 0.54.0", + "windows 0.58.0", ] [[package]] @@ -3027,7 +3024,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.10.0", + "indexmap 2.11.4", "slab", "tokio", "tokio-util", @@ -3303,13 +3300,14 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.10.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", "hashbrown 0.15.4", "serde", + "serde_core", ] [[package]] @@ -3458,15 +3456,6 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" -[[package]] -name = "ktx2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d65e08a9ec02e409d27a0139eaa6b9756b4d81fe7cde71f6941a83730ce838" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "lalrpop" version = "0.20.2" @@ -3517,7 +3506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.53.2", ] [[package]] @@ -3838,7 +3827,7 @@ dependencies = [ "cfg_aliases 0.2.1", "codespan-reporting", "hexf-parse", - "indexmap 2.10.0", + "indexmap 2.11.4", "log", "pp-rs", "rustc-hash 1.1.0", @@ -3858,7 +3847,7 @@ dependencies = [ "bit-set 0.5.3", "codespan-reporting", "data-encoding", - "indexmap 2.10.0", + "indexmap 2.11.4", "naga", "once_cell", "regex", @@ -4058,7 +4047,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.104", @@ -4536,7 +4525,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset 0.4.2", - "indexmap 2.10.0", + "indexmap 2.11.4", ] [[package]] @@ -5129,15 +5118,6 @@ dependencies = [ "unicode-script", ] -[[package]] -name = "ruzstd" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c" -dependencies = [ - "twox-hash", -] - [[package]] name = "ryu" version = "1.0.20" @@ -5198,18 +5178,28 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.225" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.225" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.225" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" dependencies = [ "proc-macro2", "quote", @@ -5241,11 +5231,11 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.9" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -5487,7 +5477,6 @@ dependencies = [ "bevy_mod_xr", "bevy_sk", "clap", - "cluFlock", "color-eyre", "console-subscriber", "cosmic-text 0.14.2", @@ -5880,9 +5869,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" dependencies = [ "bytes", "futures-core", @@ -5893,14 +5882,17 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.23" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" dependencies = [ - "serde", + "indexmap 2.11.4", + "serde_core", "serde_spanned", - "toml_datetime", - "toml_edit 0.22.27", + "toml_datetime 0.7.2", + "toml_parser", + "toml_writer", + "winnow 0.7.13", ] [[package]] @@ -5908,8 +5900,14 @@ name = "toml_datetime" version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + +[[package]] +name = "toml_datetime" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -5918,8 +5916,8 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.10.0", - "toml_datetime", + "indexmap 2.11.4", + "toml_datetime 0.6.11", "winnow 0.5.40", ] @@ -5929,19 +5927,25 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.10.0", - "serde", - "serde_spanned", - "toml_datetime", - "toml_write", - "winnow 0.7.12", + "indexmap 2.11.4", + "toml_datetime 0.6.11", + "winnow 0.7.13", ] [[package]] -name = "toml_write" -version = "0.1.2" +name = "toml_parser" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" +dependencies = [ + "winnow 0.7.13", +] + +[[package]] +name = "toml_writer" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" [[package]] name = "tonic" @@ -6145,7 +6149,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fff37da548239c3bf9e64a12193d261e8b22b660991c6fd2df057c168f435f" dependencies = [ "cc", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -6172,12 +6176,6 @@ version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" -[[package]] -name = "twox-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56" - [[package]] name = "typeid" version = "1.0.3" @@ -6322,7 +6320,7 @@ dependencies = [ "foldhash", "half 2.6.0", "heck 0.4.1", - "indexmap 2.10.0", + "indexmap 2.11.4", "libloading", "nom", "once_cell", @@ -6337,20 +6335,6 @@ dependencies = [ "smallvec", "thread_local", "vk-parse", - "vulkano-macros", - "x11-dl", - "x11rb", -] - -[[package]] -name = "vulkano-macros" -version = "0.35.0" -source = "git+https://github.com/Schmarni-Dev/vulkano?branch=0_35_dmabuf_fixes#1fd43557d3acb3ddd2721f61b6939ab636ecd17a" -dependencies = [ - "proc-macro-crate 3.3.0", - "proc-macro2", - "quote", - "syn 2.0.104", ] [[package]] @@ -6569,7 +6553,7 @@ dependencies = [ [[package]] name = "waynest" version = "0.0.26" -source = "git+https://github.com/technobaboo/waynest.git?branch=fix%2Ffd_clear#a1c926599feb6d17178c77a4a809ecd98971d20c" +source = "git+https://github.com/technobaboo/waynest.git?branch=fix%2Ffd_clear#d3a1a9d849107f12f26991b327b8d3769381a3cb" dependencies = [ "async-trait", "bitflags 2.9.4", @@ -6587,7 +6571,7 @@ dependencies = [ [[package]] name = "waynest-macros" version = "0.0.26" -source = "git+https://github.com/technobaboo/waynest.git?branch=fix%2Ffd_clear#a1c926599feb6d17178c77a4a809ecd98971d20c" +source = "git+https://github.com/technobaboo/waynest.git?branch=fix%2Ffd_clear#d3a1a9d849107f12f26991b327b8d3769381a3cb" dependencies = [ "quote", "syn 2.0.104", @@ -6648,7 +6632,7 @@ dependencies = [ "bitflags 2.9.4", "cfg_aliases 0.2.1", "document-features", - "indexmap 2.10.0", + "indexmap 2.11.4", "log", "naga", "once_cell", @@ -6741,7 +6725,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -7304,9 +7288,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] @@ -7378,7 +7362,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88e7409adab994ba3fb241b9d7f71335ccc2216525b990be568064e1ae2e3705" dependencies = [ "bitflags 2.9.4", - "indexmap 2.10.0", + "indexmap 2.11.4", "lalrpop", "lalrpop-util", "log", @@ -7453,7 +7437,7 @@ dependencies = [ "tracing", "uds_windows", "windows-sys 0.59.0", - "winnow 0.7.12", + "winnow 0.7.13", "zbus_macros", "zbus_names", "zvariant", @@ -7482,7 +7466,7 @@ checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" dependencies = [ "serde", "static_assertions", - "winnow 0.7.12", + "winnow 0.7.13", "zvariant", ] @@ -7536,7 +7520,7 @@ dependencies = [ "endi", "enumflags2", "serde", - "winnow 0.7.12", + "winnow 0.7.13", "zvariant_derive", "zvariant_utils", ] @@ -7565,5 +7549,5 @@ dependencies = [ "serde", "static_assertions", "syn 2.0.104", - "winnow 0.7.12", + "winnow 0.7.13", ] diff --git a/Cargo.toml b/Cargo.toml index b78e917..91b4968 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] edition = "2024" -rust-version = "1.88" +rust-version = "1.89" name = "stardust-xr-server" version = "0.45.0" authors = ["Nova King "] @@ -23,7 +23,6 @@ path = "src/main.rs" [features] default = ["wayland"] wayland = [ - "dep:cluFlock", "dep:waynest", "dep:tokio-stream", "dep:memmap2", @@ -48,9 +47,11 @@ auto_link_exclude_list = ["libc*", "libdl*", "libpthread*", "ld-linux*"] [profile.release] +opt-level = "s" lto = true -strip = true -opt-level = 3 +codegen-units = 1 +panic = "abort" +strip = "symbols" [profile.dev.package."*"] opt-level = 3 @@ -92,7 +93,7 @@ tracy-client = { version = "=0.18.0", optional = true } # (de)serialization serde = { version = "1.0.205", features = ["derive"] } serde_repr = "0.1.19" -toml = "0.8.19" +toml = "0.9.7" # mathy stuffs glam = { version = "0.29.0", features = ["mint", "serde"] } @@ -113,7 +114,6 @@ bevy = { version = "0.16", default-features = false, features = [ "bevy_window", "bevy_winit", "std", - "x11", "wayland", "mp3", "wav", @@ -121,7 +121,6 @@ bevy = { version = "0.16", default-features = false, features = [ "png", "hdr", "jpeg", - "tonemapping_luts", "multi_threaded", ] } bevy_mod_xr = "0.3" @@ -146,10 +145,10 @@ xkbcommon-rs = "0.1.0" cosmic-text = "0.14.2" # Wayland -cluFlock = { version = "1.2.7", optional = true } # for the lockfile checking -# waynest = { git = "https://github.com/verdiwm/waynest.git", features = [ +# waynest = { git = "https://github.com/verdiwm/waynest.git", branch="codec-test", features = [ # "server", # "stable", +# "mesa", # "tracing", # ], default-features = false, optional = true } waynest = { git = "https://github.com/technobaboo/waynest.git", branch = "fix/fd_clear", features = [ @@ -162,7 +161,7 @@ tokio-stream = { version = "0.1.17", optional = true } memmap2 = { version = "0.9.5", optional = true } drm-fourcc = { version = "2.2.0", optional = true } memfd = { version = "0.6.4", optional = true } -vulkano = { git = "https://github.com/Schmarni-Dev/vulkano", branch = "0_35_dmabuf_fixes", optional = true } +vulkano = { git = "https://github.com/Schmarni-Dev/vulkano", branch = "0_35_dmabuf_fixes", default-features = false, optional = true } wgpu-hal = { version = "24", optional = true, features = ["vulkan"] } ash = { version = "0.38.0", optional = true, default-features = false } rustix = { version = "1.0.8", features = ["time"] } diff --git a/src/core/registry.rs b/src/core/registry.rs index 22556e8..360bfec 100644 --- a/src/core/registry.rs +++ b/src/core/registry.rs @@ -143,7 +143,7 @@ impl OwnedRegistry { pub const fn new() -> Self { OwnedRegistry(const_mutex(None)) } - fn lock(&self) -> MappedMutexGuard>> { + fn lock(&self) -> MappedMutexGuard<'_, FxHashMap>> { MutexGuard::map(self.0.lock(), |r| r.get_or_insert_with(FxHashMap::default)) } pub fn add(&self, t: T) -> Arc diff --git a/src/wayland/core/shm_pool.rs b/src/wayland/core/shm_pool.rs index 72040eb..69a4234 100644 --- a/src/wayland/core/shm_pool.rs +++ b/src/wayland/core/shm_pool.rs @@ -32,7 +32,7 @@ impl ShmPool { } #[tracing::instrument(level = "debug", skip_all)] - pub fn data_lock(&self) -> MappedMutexGuard { + pub fn data_lock(&self) -> MappedMutexGuard<'_, RawMutex, [u8]> { MutexGuard::map(self.inner.lock(), |i| i.as_mut()) } } diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index 6fd3fee..78b296b 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -32,7 +32,6 @@ use bevy_dmabuf::import::ImportedDmatexs; use bevy_mod_openxr::render::end_frame; use bevy_mod_openxr::resources::{OxrFrameState, OxrInstance}; use bevy_mod_xr::session::XrRenderSet; -use cluFlock::{FlockLock, ToFlock}; use core::buffer::BufferUsage; use core::{buffer::Buffer, callback::Callback, surface::WL_SURFACE_REGISTRY}; use display::Display; @@ -41,9 +40,8 @@ use std::fs::File; use std::mem::MaybeUninit; use std::time::Duration; use std::{ - fs::{self, OpenOptions}, + fs, io::{self, ErrorKind}, - os::unix::fs::OpenOptionsExt, path::PathBuf, sync::{Arc, OnceLock}, }; @@ -71,7 +69,7 @@ impl From for ServerError { } } -pub fn get_free_wayland_socket_path() -> Option<(PathBuf, FlockLock)> { +pub fn get_free_wayland_socket_path() -> Option<(PathBuf, File)> { // Use XDG runtime directory for secure, user-specific sockets let base_dirs = directories::BaseDirs::new()?; let runtime_dir = base_dirs.runtime_dir()?; @@ -81,21 +79,12 @@ pub fn get_free_wayland_socket_path() -> Option<(PathBuf, FlockLock)> { let socket_path = runtime_dir.join(format!("wayland-{display}")); let socket_lock_path = runtime_dir.join(format!("wayland-{display}.lock")); - // Open lock file without truncation to preserve existing locks - let Ok(lock) = OpenOptions::new() - .create(true) - .truncate(false) // Prevent destroying other processes' locks - .read(true) - .write(true) - .mode(0o660) // Match Wayland-compositor permissions - .open(&socket_lock_path) - else { + let Ok(lock) = File::create(&socket_lock_path) else { continue; }; - // Atomic mutual exclusion: fail if another process holds the lock\ - let Ok(lock) = lock.try_exclusive_lock() else { - continue; // Lock held by active compositor + if lock.try_lock().is_err() { + continue; }; // Check for zombie sockets (file exists but nothing listening) @@ -273,7 +262,7 @@ impl Drop for WaylandClient { #[derive(Debug, Resource)] pub struct Wayland { - _lockfile: FlockLock, + _lockfile: File, abort_handle: AbortHandle, } impl Wayland {