From dbbc9f5657c5140739f0dbe03899627a5c81bfda Mon Sep 17 00:00:00 2001 From: Cyril LEVIS Date: Sun, 30 Jul 2023 17:52:28 +0200 Subject: [PATCH 1/8] chore: update libs inotify watches had to be update --- Cargo.lock | 671 +++++++++++++++++------------------- Cargo.toml | 12 +- src/brightness/backlight.rs | 8 +- 3 files changed, 333 insertions(+), 358 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cd4150..80543b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,36 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr 2.5.0", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -22,26 +43,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "ash" -version = "0.37.2+1.3.238" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28bf19c1f0a470be5fbf7522a308a05df06610252c5bcf5143e1b23f629a9a03" - -[[package]] -name = "atty" -version = "0.2.14" +version = "0.37.3+1.3.251" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] +checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" [[package]] name = "autocfg" @@ -49,13 +59,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "bindgen" version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -68,7 +93,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.22", + "syn 2.0.28", "which", ] @@ -78,11 +103,17 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -92,9 +123,12 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0" +dependencies = [ + "libc", +] [[package]] name = "cexpr" @@ -113,13 +147,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "time", "wasm-bindgen", @@ -128,32 +162,22 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.4.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", "libloading", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.8.3", + "core-foundation-sys 0.8.4", "libc", ] @@ -165,9 +189,9 @@ checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-graphics" @@ -175,7 +199,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -184,60 +208,15 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", - "foreign-types", "libc", ] -[[package]] -name = "cxx" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 1.0.109", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "dbus" version = "0.9.7" @@ -279,9 +258,9 @@ dependencies = [ [[package]] name = "ddc-i2c" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66503057bd41fc21b532b3ebe33b2ec57e5d4971fcfc3844306ebcb499b6c8c2" +checksum = "1ef18fac9fd5c11d0c7b85a80887b01f7361b49edb2b4627243928b90ce2691b" dependencies = [ "ddc", "i2c", @@ -296,7 +275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cbaf316c113cfc30da8856c8104dfb4168b73fdd78562d1542e358fe8299dea" dependencies = [ "core-foundation", - "core-foundation-sys 0.8.3", + "core-foundation-sys 0.8.4", "core-graphics", "ddc", "io-kit-sys", @@ -306,9 +285,9 @@ dependencies = [ [[package]] name = "ddc-winapi" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3238e71b65c870e236de529546a689202fca64a2eaeec43995d28f6920d7fc9e" +checksum = "015df0d6d814ea948e012977760324da6d103ec8d67c971c75a6daa3b4fc943f" dependencies = [ "ddc", "widestring", @@ -321,35 +300,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dlib" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" -dependencies = [ - "libloading", -] - [[package]] name = "downcast" version = "0.11.0" @@ -379,18 +329,18 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "env_logger" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ - "atty", "humantime", + "is-terminal", "log", "regex", "termcolor", @@ -402,6 +352,27 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +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 = "float-cmp" version = "0.9.0" @@ -434,20 +405,15 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] -name = "getrandom" -version = "0.2.8" +name = "gimli" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glob" @@ -455,12 +421,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.0" @@ -469,12 +429,9 @@ checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "humantime" @@ -488,7 +445,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60c7b7bdd7b3a985fdcf94a0d7d98e7a47fde8b7f22fb55ce1a91cc104a2ce9a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -497,7 +454,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0268a871aaa071221d6c2875ebedcf64710e59b0d87c68c8faf5e98b87dd2a4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "i2c", "i2c-linux-sys", "resize-slice", @@ -510,43 +467,32 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55cd060ed0016621d3da4ed3a23b0158084de90d1f3a8e59f3d391aacd3bbcf8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "libc", ] [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", - "core-foundation-sys 0.8.3", + "core-foundation-sys 0.8.4", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "indexmap" -version = "1.9.2" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "cc", ] [[package]] @@ -556,16 +502,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown", ] [[package]] name = "inotify" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf888f9575c290197b2c948dc9e9ff10bd1a39ad1ea8585f734585fa6b9d3f9" +checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-core", "inotify-sys", "libc", @@ -591,6 +537,17 @@ dependencies = [ "mach 0.2.3", ] +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys", +] + [[package]] name = "itertools" version = "0.10.5" @@ -600,17 +557,26 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -629,9 +595,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.141" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libdbus-sys" @@ -662,29 +628,23 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "mach" @@ -706,18 +666,18 @@ dependencies = [ [[package]] name = "mccs" -version = "0.1.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74366c6da4179141e0d4551a46799a7e667a68eda60561690d5048bd8e0f8422" +checksum = "6090d6b3ded42fed158b660a6b9cdaa1924f3eef6c6598e82a9ca9b70a1988cd" dependencies = [ "void", ] [[package]] name = "mccs-caps" -version = "0.1.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9766b1345aec53f3f1781797e31f7367a8c53871a0e30214d8372fe2ccbe3ce" +checksum = "8eb961d01a3bb07969cfa276be2ab88c31d0fefa77a872696832732d6e9ec094" dependencies = [ "mccs", "nom 3.2.1", @@ -725,9 +685,9 @@ dependencies = [ [[package]] name = "mccs-db" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99726fbbe1e11e2908c461e8fab6c9106a5cb13338cc4feb68a01cced38026d0" +checksum = "3cdaa8fe19a1a1918becc1b8cbbbdc1058bc71411dff4de0a6ec6b5269f49d38" dependencies = [ "mccs", "nom 3.2.1", @@ -766,14 +726,22 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -811,7 +779,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset", @@ -842,21 +810,11 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] @@ -879,15 +837,24 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b29e9a9393c69ee856bfcf5f76ed1ef32d2c0dd6f58558fd43334278fc1e7ea7" dependencies = [ - "bitflags", + "bitflags 1.3.2", "winapi", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr 2.5.0", +] + [[package]] name = "once_cell" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "peeking_take_while" @@ -897,15 +864,15 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "predicates" @@ -915,7 +882,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -923,15 +890,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" [[package]] name = "predicates-tree" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" dependencies = [ "predicates-core", "termtree", @@ -939,57 +906,49 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282" +checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" dependencies = [ "proc-macro2", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] name = "proc-macro2" -version = "1.0.62" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe8df9bd9fe9d1742a9e17f8129712801b428f6d4c6059d79bacea58f0b0142d" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] [[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" +name = "regex" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", + "aho-corasick", + "memchr 2.5.0", + "regex-automata", + "regex-syntax", ] [[package]] -name = "regex" -version = "1.7.3" +name = "regex-automata" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ "aho-corasick", "memchr 2.5.0", @@ -998,9 +957,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.29" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "resize-slice" @@ -1012,47 +971,54 @@ dependencies = [ ] [[package]] -name = "rustc-hash" -version = "1.1.0" +name = "rustc-demangle" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "ryu" -version = "1.0.12" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "scoped-tls" -version = "1.0.1" +name = "rustix" +version = "0.38.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" +checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] [[package]] -name = "scratch" -version = "1.0.3" +name = "ryu" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "bdb30a74471f5b7a1fa299f40b4bf1be93af61116df95465b2b5fc419331e430" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "6f4c2c6ea4bc09b5c419012eafcdb0fcef1d9119d626c8f3a0708a5b92d38a70" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", ] [[package]] @@ -1078,11 +1044,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.16" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834" +checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" dependencies = [ - "indexmap 1.9.2", + "indexmap", "itoa", "ryu", "serde", @@ -1097,15 +1063,15 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -1124,9 +1090,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.22" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -1144,28 +1110,28 @@ dependencies = [ [[package]] name = "termtree" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", ] [[package]] @@ -1181,11 +1147,12 @@ dependencies = [ [[package]] name = "tokio" -version = "1.24.1" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "libc", "mio", "pin-project-lite", @@ -1220,7 +1187,7 @@ version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap 2.0.0", + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -1239,15 +1206,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "uninitialized" @@ -1257,9 +1218,9 @@ checksum = "74c1aa4511c38276c548406f0b1f5f8b793f000cfb51e18f278a102abd057e81" [[package]] name = "unsafe-libyaml" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "v4l" @@ -1267,7 +1228,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8fbfea44a46799d62c55323f3c55d06df722fbe577851d848d328a1041c3403" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "v4l-sys", ] @@ -1301,9 +1262,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1311,24 +1272,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1336,22 +1297,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wayland-client" @@ -1359,11 +1320,10 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "libc", "nix", - "scoped-tls", "wayland-commons", "wayland-scanner", "wayland-sys", @@ -1387,7 +1347,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-client", "wayland-commons", "wayland-scanner", @@ -1410,8 +1370,6 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" dependencies = [ - "dlib", - "lazy_static", "pkg-config", ] @@ -1428,9 +1386,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.3.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a212922ea58fbf5044f83663aa4fc6281ff890f1fd7546c0c3f52f5290831781" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" @@ -1463,11 +1421,29 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1480,51 +1456,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd122eb777186e60c3fdf765a58ac76e41c582f1f535fbf3314434c6b58f3f7" +checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64" dependencies = [ "memchr 2.5.0", ] @@ -1539,12 +1515,12 @@ dependencies = [ "ddc-hi", "env_logger", "inotify", - "itertools", + "itertools 0.11.0", "lazy_static", "log", "mockall", "serde", - "serde_yaml 0.9.16", + "serde_yaml 0.9.25", "toml", "v4l", "wayland-client", @@ -1554,18 +1530,15 @@ dependencies = [ [[package]] name = "xdg" -version = "2.4.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" -dependencies = [ - "dirs", -] +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" [[package]] name = "xml-rs" -version = "0.8.4" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" +checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" [[package]] name = "yaml-rust" diff --git a/Cargo.toml b/Cargo.toml index 7e2da87..28941b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,21 +5,21 @@ authors = ["Maxim Baz", "Cyril Levis"] edition = "2021" [dependencies] -wayland-client = { version = "0.29.5", features = ["dlopen"] } -wayland-protocols = { version = "0.29.5", features = ["client", "unstable_protocols"] } +wayland-client = { version = "0.29" } +wayland-protocols = { version = "0.29", features = ["client", "unstable_protocols"] } serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9" toml = "0.7.6" chrono = "0.4" -ash = { version = "0.37.2", features = ["linked"], default-features = false } -itertools = "0.10" +ash = { version = "0.37.3", features = ["linked"], default-features = false } +itertools = "0.11" v4l = { version = "0.14.0", features = ["libv4l"], default-features = false } ddc-hi = "0.4" log = "0.4" -env_logger = "0.9" +env_logger = "0.10" inotify = "0.10" lazy_static = "1.4" -xdg = "2.4.1" +xdg = "2.5.2" dbus = "0.9.7" [dev-dependencies] diff --git a/src/brightness/backlight.rs b/src/brightness/backlight.rs index e6b110d..3f44745 100644 --- a/src/brightness/backlight.rs +++ b/src/brightness/backlight.rs @@ -62,12 +62,14 @@ impl Backlight { .trim() .parse()?; - let mut inotify = Inotify::init()?; - inotify.add_watch(&brightness_path, WatchMask::MODIFY)?; + let inotify = Inotify::init()?; + inotify.watches().add(&brightness_path, WatchMask::MODIFY)?; let brightness_hw_changed_path = Path::new(path).join("brightness_hw_changed"); if Path::new(&brightness_hw_changed_path).exists() { - inotify.add_watch(&brightness_hw_changed_path, WatchMask::MODIFY)?; + inotify + .watches() + .add(&brightness_hw_changed_path, WatchMask::MODIFY)?; } Ok(Self { From a940f0e8431a51df0038b759fa18b372efc66348 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Mon, 31 Jul 2023 15:29:41 +0200 Subject: [PATCH 2/8] Update wayland lib and rewrite wlroots code --- Cargo.lock | 279 ++++++++++++++++++++++++++--- Cargo.toml | 7 +- src/frame/capturer/mod.rs | 4 +- src/frame/capturer/none.rs | 15 +- src/frame/capturer/wlroots.rs | 327 ++++++++++++++++++++++------------ src/main.rs | 26 +-- 6 files changed, 497 insertions(+), 161 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80543b9..c776dbe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,6 +121,20 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "calloop" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +dependencies = [ + "bitflags 1.3.2", + "log", + "nix 0.25.1", + "slotmap", + "thiserror", + "vec_map", +] + [[package]] name = "cc" version = "1.0.81" @@ -168,7 +182,7 @@ checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.7.4", ] [[package]] @@ -300,6 +314,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" +[[package]] +name = "dlib" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +dependencies = [ + "libloading 0.8.0", +] + [[package]] name = "downcast" version = "0.11.0" @@ -537,6 +560,17 @@ dependencies = [ "mach 0.2.3", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + [[package]] name = "is-terminal" version = "0.4.9" @@ -618,6 +652,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if", + "windows-sys", +] + [[package]] name = "libudev-sys" version = "0.1.4" @@ -711,6 +755,24 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memmap2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.6.5" @@ -720,6 +782,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -775,14 +846,28 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.6.5", +] + +[[package]] +name = "nix" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset", + "memoffset 0.7.1", + "static_assertions", ] [[package]] @@ -923,6 +1008,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-xml" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +dependencies = [ + "memchr 2.5.0", +] + [[package]] name = "quote" version = "1.0.32" @@ -1001,6 +1095,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "serde" version = "1.0.182" @@ -1061,12 +1161,45 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + [[package]] name = "smallvec" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +[[package]] +name = "smithay-client-toolkit" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1476c3d89bb67079264b88aaf4f14358353318397e083b7c4e8c14517f55de7" +dependencies = [ + "bitflags 1.3.2", + "calloop", + "dlib", + "lazy_static", + "log", + "memmap2 0.5.10", + "nix 0.26.2", + "pkg-config", + "thiserror", + "wayland-backend 0.1.2", + "wayland-client", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkbcommon", +] + [[package]] name = "socket2" version = "0.4.9" @@ -1077,6 +1210,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "syn" version = "1.0.109" @@ -1242,6 +1381,18 @@ dependencies = [ "bindgen", ] +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "void" version = "1.0.2" @@ -1314,62 +1465,116 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "wayland-backend" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8" +dependencies = [ + "cc", + "downcast-rs", + "io-lifetimes", + "nix 0.26.2", + "scoped-tls", + "smallvec", + "wayland-sys 0.30.1", +] + +[[package]] +name = "wayland-backend" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8978b1aa3ab65bfcef1b50b4ae2400be3a78315e5e7a92fe636f01ac8426d46" +dependencies = [ + "cc", + "downcast-rs", + "io-lifetimes", + "nix 0.26.2", + "scoped-tls", + "smallvec", + "wayland-sys 0.31.1", +] + [[package]] name = "wayland-client" -version = "0.29.5" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" dependencies = [ "bitflags 1.3.2", - "downcast-rs", - "libc", - "nix", - "wayland-commons", + "calloop", + "nix 0.26.2", + "wayland-backend 0.1.2", "wayland-scanner", - "wayland-sys", ] [[package]] -name = "wayland-commons" -version = "0.29.5" +name = "wayland-cursor" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +checksum = "2d0c3a0d5b4b688b07b0442362d3ed6bf04724fcc16cd69ab6285b90dbc487aa" dependencies = [ - "nix", - "once_cell", - "smallvec", - "wayland-sys", + "nix 0.26.2", + "wayland-client", + "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.29.5" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +checksum = "3b28101e5ca94f70461a6c2d610f76d85ad223d042dd76585ab23d3422dd9b4d" dependencies = [ "bitflags 1.3.2", + "wayland-backend 0.1.2", "wayland-client", - "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce991093320e4a6a525876e6b629ab24da25f9baef0c2e0080ad173ec89588a" +dependencies = [ + "bitflags 1.3.2", + "wayland-backend 0.1.2", + "wayland-client", + "wayland-protocols", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.29.5" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e" dependencies = [ "proc-macro2", + "quick-xml", "quote", - "xml-rs", ] [[package]] name = "wayland-sys" -version = "0.29.5" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" +dependencies = [ + "dlib", + "log", + "pkg-config", +] + +[[package]] +name = "wayland-sys" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ + "dlib", + "log", + "once_cell", "pkg-config", ] @@ -1521,13 +1726,25 @@ dependencies = [ "mockall", "serde", "serde_yaml 0.9.25", + "smithay-client-toolkit", "toml", "v4l", + "wayland-backend 0.2.0", "wayland-client", "wayland-protocols", + "wayland-protocols-wlr", "xdg", ] +[[package]] +name = "xcursor" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" +dependencies = [ + "nom 7.1.3", +] + [[package]] name = "xdg" version = "2.5.2" @@ -1535,10 +1752,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" [[package]] -name = "xml-rs" -version = "0.8.16" +name = "xkbcommon" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" +checksum = "52db25b599e92bf6e3904134618728eeb7b49a5a4f38f107f92399bb9c496b88" +dependencies = [ + "libc", + "memmap2 0.7.1", +] [[package]] name = "yaml-rust" diff --git a/Cargo.toml b/Cargo.toml index 28941b5..7347fd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,11 @@ authors = ["Maxim Baz", "Cyril Levis"] edition = "2021" [dependencies] -wayland-client = { version = "0.29" } -wayland-protocols = { version = "0.29", features = ["client", "unstable_protocols"] } +wayland-client = { version = "0.30" } +wayland-backend = { version = "0.2", features = ["dlopen"] } +wayland-protocols = { version = "0.30", features = ["client", "unstable"] } +wayland-protocols-wlr = { version = "0.1", features = ["client"] } +smithay-client-toolkit = "0.17.0" serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9" toml = "0.7.6" diff --git a/src/frame/capturer/mod.rs b/src/frame/capturer/mod.rs index 0d3de2d..a84f588 100644 --- a/src/frame/capturer/mod.rs +++ b/src/frame/capturer/mod.rs @@ -1,8 +1,6 @@ -use crate::predictor::Controller; - pub mod none; pub mod wlroots; pub trait Capturer { - fn run(&self, output_name: &str, controller: Controller); + fn run(&mut self); } diff --git a/src/frame/capturer/none.rs b/src/frame/capturer/none.rs index 28793e1..ea2991c 100644 --- a/src/frame/capturer/none.rs +++ b/src/frame/capturer/none.rs @@ -1,13 +1,20 @@ use crate::predictor::Controller; use std::{thread, time::Duration}; -#[derive(Default)] -pub struct Capturer {} +pub struct Capturer { + controller: Controller, +} + +impl Capturer { + pub fn new(controller: Controller) -> Self { + Self { controller } + } +} impl super::Capturer for Capturer { - fn run(&self, _output_name: &str, mut controller: Controller) { + fn run(&mut self) { loop { - controller.adjust(0); + self.controller.adjust(0); thread::sleep(Duration::from_millis(200)); } } diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 90d5e58..30d2cb2 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -1,153 +1,256 @@ -use crate::frame::{object::Object, vulkan::Vulkan}; +use crate::frame::object::Object; +use crate::frame::vulkan::Vulkan; use crate::predictor::Controller; -use std::{cell::RefCell, rc::Rc, thread, time::Duration}; +use itertools::Itertools; +use smithay_client_toolkit::delegate_simple; +use smithay_client_toolkit::{ + delegate_output, delegate_registry, + output::{OutputHandler, OutputState}, + registry::{ProvidesRegistryState, RegistryState}, + registry_handlers, +}; +use std::os::fd::AsRawFd; +use std::{thread, time::Duration}; +use wayland_client::globals::GlobalListContents; +use wayland_client::protocol::wl_output::WlOutput; use wayland_client::{ - protocol::{wl_output::WlOutput, wl_registry::WlRegistry}, - Display, EventQueue, GlobalManager, Main, + globals::registry_queue_init, + protocol::{wl_output, wl_registry}, + Connection, Dispatch, EventQueue, }; -use wayland_protocols::wlr::unstable::export_dmabuf::v1::client::{ - zwlr_export_dmabuf_frame_v1::{CancelReason, Event}, - zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1, +use wayland_client::{QueueHandle, WEnum}; +use wayland_protocols_wlr::export_dmabuf::v1::client::{ + zwlr_export_dmabuf_frame_v1, zwlr_export_dmabuf_manager_v1, }; -use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_manager_v1::ZxdgOutputManagerV1; -use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_v1::Event::Description; - const DELAY_SUCCESS: Duration = Duration::from_millis(100); const DELAY_FAILURE: Duration = Duration::from_millis(1000); -#[derive(Clone)] pub struct Capturer { - event_queue: Rc>, - globals: GlobalManager, - dmabuf_manager: Main, - vulkan: Rc, - registry: Main, - xdg_output_manager: Main, + vulkan: Vulkan, + connection: Connection, + output: wl_output::WlOutput, + controller: Controller, + pending_frame: Option, +} + +impl Capturer { + pub fn new(output_name: &str, controller: Controller) -> Self { + let connection = Connection::connect_to_env().unwrap(); + + Self { + vulkan: Vulkan::new().expect("Unable to initialize Vulkan"), + output: find_output(&connection, output_name), + connection, + controller, + pending_frame: None, + } + } } impl super::Capturer for Capturer { - fn run(&self, output_name: &str, controller: Controller) { - let controller = Rc::new(RefCell::new(controller)); - - self.globals - .list() - .iter() - .filter(|(_, interface, _)| interface == "wl_output") - .for_each(|(id, _, _)| { - let output = Rc::new(self.registry.bind::(1, *id)); - let capturer = Rc::new(self.clone()); - let controller = controller.clone(); - let desired_output = output_name.to_string(); - self.xdg_output_manager - .get_xdg_output(&output) - .quick_assign(move |_, event, _| match event { - Description { description } if description.contains(&desired_output) => { - log::debug!( - "Using output '{}' for config '{}'", - description, - desired_output, - ); - capturer - .clone() - .capture_frame(controller.clone(), output.clone()); - } - _ => {} - }); - }); + fn run(&mut self) { + let (mut event_queue, dmabuf_manager) = init_dmabuf(&self.connection); loop { - self.event_queue - .borrow_mut() - .dispatch(&mut (), |_, _, _| {}) + if self.pending_frame.is_none() { + self.pending_frame = Some(Object::default()); + dmabuf_manager.capture_output(0, &self.output, &event_queue.handle(), ()); + } + + event_queue + .roundtrip(self) .expect("Error running wlroots capturer main loop"); } } } -impl Default for Capturer { - fn default() -> Self { - let display = Display::connect_to_env().unwrap(); - let mut event_queue = display.create_event_queue(); - let attached_display = display.attach(event_queue.token()); - let registry = attached_display.get_registry(); - let globals = GlobalManager::new(&attached_display); - - event_queue.sync_roundtrip(&mut (), |_, _, _| {}).unwrap(); +fn find_output(connection: &Connection, output_name: &str) -> WlOutput { + let (globals, mut event_queue) = registry_queue_init(&connection).unwrap(); - let dmabuf_manager = globals - .instantiate_exact::(1) - .expect("Unable to init export_dmabuf_manager"); + let mut list_outputs = ListOutputs { + registry_state: RegistryState::new(&globals), + output_state: OutputState::new(&globals, &event_queue.handle()), + }; - let xdg_output_manager = globals - .instantiate_exact::(3) - .expect("Unable to init xdg_output_manager"); + event_queue.roundtrip(&mut list_outputs).unwrap(); - let vulkan = Rc::new(Vulkan::new().expect("Unable to initialize Vulkan")); + let mut outputs = list_outputs + .output_state + .outputs() + .filter(|o| { + list_outputs + .output_state + .info(&o) + .and_then(|i| { + i.description.map(|d| { + d.contains(output_name) + .then(|| { + log::debug!( + "Discovered output '{d}' that matches config '{output_name}'" + ) + }) + .is_some() + }) + }) + .unwrap_or(false) + }) + .collect_vec(); - Self { - event_queue: Rc::new(RefCell::new(event_queue)), - globals, - registry, - dmabuf_manager, - vulkan, - xdg_output_manager, - } + match outputs.len() { + 0 => panic!("Unable to find output that matches config '{output_name}'"), + 1 => outputs.pop().unwrap(), + _ => panic!("More than one output matches config '{output_name}', this is not supported!"), } } -impl Capturer { - fn capture_frame( - self: Rc, - controller: Rc>, - output: Rc>, +fn init_dmabuf( + connection: &Connection, +) -> ( + EventQueue, + zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1, +) { + let (global_list, event_queue) = registry_queue_init::(connection).unwrap(); + let dmabuf_manager: zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1 = global_list + .bind(&event_queue.handle(), 1..=1, ()) + .expect("Unable to init export_dmabuf_manager"); + (event_queue, dmabuf_manager) +} + +impl Dispatch for Capturer { + fn event( + state: &mut Self, + frame: &zwlr_export_dmabuf_frame_v1::ZwlrExportDmabufFrameV1, + event: zwlr_export_dmabuf_frame_v1::Event, + _: &(), + _: &Connection, + _: &QueueHandle, ) { - let mut frame = Object::default(); - self.dmabuf_manager - .capture_output(0, &output) - .quick_assign(move |data, event, _| match event { - Event::Frame { - width, - height, - num_objects, - .. - } => { - frame.set_metadata(width, height, num_objects); - } + match event { + zwlr_export_dmabuf_frame_v1::Event::Frame { + width, + height, + num_objects, + .. + } => { + state + .pending_frame + .as_mut() + .expect("Unable to acquire lock on frame object") + .set_metadata(width, height, num_objects); + } - Event::Object { - index, fd, size, .. - } => { - frame.set_object(index, fd, size); - } + zwlr_export_dmabuf_frame_v1::Event::Object { + index, fd, size, .. + } => { + state + .pending_frame + .as_mut() + .expect("Unable to acquire lock on frame object") + .set_object(index, fd.as_raw_fd(), size); + } - Event::Ready { .. } => { - let luma = self - .vulkan - .luma_percent(&frame) - .expect("Unable to compute luma percent"); + zwlr_export_dmabuf_frame_v1::Event::Ready { .. } => { + let luma = state + .vulkan + .luma_percent(state.pending_frame.as_ref().unwrap()) + .expect("Unable to compute luma percent"); - controller.borrow_mut().adjust(luma); + state.controller.adjust(luma); - data.destroy(); + frame.destroy(); - thread::sleep(DELAY_SUCCESS); - self.clone().capture_frame(controller.clone(), output.clone()); - } + thread::sleep(DELAY_SUCCESS); + state.pending_frame = None; + } - Event::Cancel { reason } => { - data.destroy(); + zwlr_export_dmabuf_frame_v1::Event::Cancel { reason } => { + frame.destroy(); - if reason == CancelReason::Permanent { + match reason { + WEnum::Value(reason) + if reason == zwlr_export_dmabuf_frame_v1::CancelReason::Permanent => + { panic!("Frame was cancelled due to a permanent error. If you just disconnected screen, this is not implemented yet."); - } else { - log::error!("Frame was cancelled due to a temporary error, will try again."); + } + _ => { + log::error!( + "Frame was cancelled due to a temporary error, will try again." + ); thread::sleep(DELAY_FAILURE); - self.clone().capture_frame(controller.clone(), output.clone()); + state.pending_frame = None; } } + } + + _ => unreachable!(), + } + } +} + +struct ListOutputs { + registry_state: RegistryState, + output_state: OutputState, +} + +impl OutputHandler for ListOutputs { + fn output_state(&mut self) -> &mut OutputState { + &mut self.output_state + } + + fn new_output( + &mut self, + _conn: &Connection, + _qh: &QueueHandle, + _output: wl_output::WlOutput, + ) { + } + + fn update_output( + &mut self, + _conn: &Connection, + _qh: &QueueHandle, + _output: wl_output::WlOutput, + ) { + } + + fn output_destroyed( + &mut self, + _conn: &Connection, + _qh: &QueueHandle, + _output: wl_output::WlOutput, + ) { + } +} + +delegate_output!(ListOutputs); + +delegate_registry!(ListOutputs); + +delegate_simple!( + Capturer, + zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1, + 1 +); + +impl Dispatch for Capturer { + fn event( + _: &mut Self, + _: &wl_registry::WlRegistry, + _: wl_registry::Event, + _: &GlobalListContents, + _: &Connection, + _: &QueueHandle, + ) { + } +} + +impl ProvidesRegistryState for ListOutputs { + fn registry(&mut self) -> &mut RegistryState { + &mut self.registry_state + } - _ => unreachable!(), - }); + registry_handlers! { + OutputState, } } diff --git a/src/main.rs b/src/main.rs index 8b011ce..67a15d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,16 +67,6 @@ fn main() { std::thread::Builder::new() .name(thread_name.clone()) .spawn(move || { - let frame_capturer: Box = - match output_capturer { - config::Capturer::Wlroots => { - Box::::default() - } - config::Capturer::None => { - Box::::default() - } - }; - let controller = predictor::Controller::new( prediction_tx, user_rx, @@ -84,7 +74,21 @@ fn main() { true, &output_name, ); - frame_capturer.run(&output_name, controller) + + let mut frame_capturer: Box = + match output_capturer { + config::Capturer::Wlroots => { + Box::new(frame::capturer::wlroots::Capturer::new( + &output_name, + controller, + )) + } + config::Capturer::None => { + Box::new(frame::capturer::none::Capturer::new(controller)) + } + }; + + frame_capturer.run(); }) .unwrap_or_else(|_| panic!("Unable to start thread: {}", thread_name)); From 3bdc973a7f7ad50b4cda32c0b2d4bdcfcc144d10 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sun, 6 Aug 2023 14:35:58 +0200 Subject: [PATCH 3/8] Update error handling --- src/frame/capturer/wlroots.rs | 55 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 30d2cb2..3221800 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -9,6 +9,7 @@ use smithay_client_toolkit::{ registry::{ProvidesRegistryState, RegistryState}, registry_handlers, }; +use std::error::Error; use std::os::fd::AsRawFd; use std::{thread, time::Duration}; use wayland_client::globals::GlobalListContents; @@ -36,11 +37,11 @@ pub struct Capturer { impl Capturer { pub fn new(output_name: &str, controller: Controller) -> Self { - let connection = Connection::connect_to_env().unwrap(); + let connection = Connection::connect_to_env().expect("Unable to connect to Wayland"); Self { vulkan: Vulkan::new().expect("Unable to initialize Vulkan"), - output: find_output(&connection, output_name), + output: find_output(&connection, output_name).expect("Unable to find output"), connection, controller, pending_frame: None, @@ -50,7 +51,8 @@ impl Capturer { impl super::Capturer for Capturer { fn run(&mut self) { - let (mut event_queue, dmabuf_manager) = init_dmabuf(&self.connection); + let (mut event_queue, dmabuf_manager) = + init_dmabuf(&self.connection).expect("Unable to init dmabuf_manager"); loop { if self.pending_frame.is_none() { @@ -65,15 +67,15 @@ impl super::Capturer for Capturer { } } -fn find_output(connection: &Connection, output_name: &str) -> WlOutput { - let (globals, mut event_queue) = registry_queue_init(&connection).unwrap(); +fn find_output(connection: &Connection, output_name: &str) -> Result> { + let (globals, mut event_queue) = registry_queue_init(&connection)?; let mut list_outputs = ListOutputs { registry_state: RegistryState::new(&globals), output_state: OutputState::new(&globals, &event_queue.handle()), }; - event_queue.roundtrip(&mut list_outputs).unwrap(); + event_queue.roundtrip(&mut list_outputs)?; let mut outputs = list_outputs .output_state @@ -99,22 +101,24 @@ fn find_output(connection: &Connection, output_name: &str) -> WlOutput { match outputs.len() { 0 => panic!("Unable to find output that matches config '{output_name}'"), - 1 => outputs.pop().unwrap(), + 1 => Ok(outputs.pop().unwrap()), _ => panic!("More than one output matches config '{output_name}', this is not supported!"), } } fn init_dmabuf( connection: &Connection, -) -> ( - EventQueue, - zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1, -) { - let (global_list, event_queue) = registry_queue_init::(connection).unwrap(); - let dmabuf_manager: zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1 = global_list - .bind(&event_queue.handle(), 1..=1, ()) - .expect("Unable to init export_dmabuf_manager"); - (event_queue, dmabuf_manager) +) -> Result< + ( + EventQueue, + zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1, + ), + Box, +> { + let (global_list, event_queue) = registry_queue_init::(connection)?; + let dmabuf_manager: zwlr_export_dmabuf_manager_v1::ZwlrExportDmabufManagerV1 = + global_list.bind(&event_queue.handle(), 1..=1, ())?; + Ok((event_queue, dmabuf_manager)) } impl Dispatch for Capturer { @@ -126,6 +130,11 @@ impl Dispatch for Capt _: &Connection, _: &QueueHandle, ) { + let pending_frame = state + .pending_frame + .as_mut() + .expect("Unable to access pending frame"); + match event { zwlr_export_dmabuf_frame_v1::Event::Frame { width, @@ -133,27 +142,19 @@ impl Dispatch for Capt num_objects, .. } => { - state - .pending_frame - .as_mut() - .expect("Unable to acquire lock on frame object") - .set_metadata(width, height, num_objects); + pending_frame.set_metadata(width, height, num_objects); } zwlr_export_dmabuf_frame_v1::Event::Object { index, fd, size, .. } => { - state - .pending_frame - .as_mut() - .expect("Unable to acquire lock on frame object") - .set_object(index, fd.as_raw_fd(), size); + pending_frame.set_object(index, fd.as_raw_fd(), size); } zwlr_export_dmabuf_frame_v1::Event::Ready { .. } => { let luma = state .vulkan - .luma_percent(state.pending_frame.as_ref().unwrap()) + .luma_percent(pending_frame) .expect("Unable to compute luma percent"); state.controller.adjust(luma); From 9549889fcf8f320b5478729653c719ec319e2ef3 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sun, 6 Aug 2023 21:48:16 +0200 Subject: [PATCH 4/8] Add missing dep for client-toolkit --- .github/workflows/ci.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9c9e0b..f755105 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt-get update - - run: sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev + - run: sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev libxkbcommon-dev - run: make test lint: @@ -21,5 +21,5 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt-get update - - run: sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev + - run: sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev libxkbcommon-dev - run: make lint diff --git a/README.md b/README.md index 53f6bf2..3763487 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Use one of the available packages and methods below: [![CI](https://github.com/maximbaz/wluma/actions/workflows/ci.yml/badge.svg)](https://github.com/maximbaz/wluma/actions/workflows/ci.yml) -If you want to build the app yourself, make sure you use latest stable Rust, otherwise you might get compilation errors! Using `rustup` is perhaps the easiest. Ubuntu needs the following dependencies: `sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev`. +If you want to build the app yourself, make sure you use latest stable Rust, otherwise you might get compilation errors! Using `rustup` is perhaps the easiest. Ubuntu needs the following dependencies: `sudo apt-get -y install v4l-utils libv4l-dev libudev-dev libvulkan-dev libdbus-1-dev libxkbcommon-dev`. Then simply run `make build`. From 0038d820cc834a1f33db7527491a915d290f6e47 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sun, 6 Aug 2023 21:57:03 +0200 Subject: [PATCH 5/8] Fix lint --- src/frame/capturer/wlroots.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 3221800..1f94bbd 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -68,7 +68,7 @@ impl super::Capturer for Capturer { } fn find_output(connection: &Connection, output_name: &str) -> Result> { - let (globals, mut event_queue) = registry_queue_init(&connection)?; + let (globals, mut event_queue) = registry_queue_init(connection)?; let mut list_outputs = ListOutputs { registry_state: RegistryState::new(&globals), @@ -83,7 +83,7 @@ fn find_output(connection: &Connection, output_name: &str) -> Result Date: Mon, 7 Aug 2023 11:41:25 +0200 Subject: [PATCH 6/8] Refactor skipping disconnected outputs --- src/brightness/mod.rs | 2 +- src/config/app.rs | 16 +++ src/frame/capturer/mod.rs | 2 +- src/frame/capturer/wlroots.rs | 8 +- src/main.rs | 192 +++++++++++++++++----------------- 5 files changed, 116 insertions(+), 104 deletions(-) diff --git a/src/brightness/mod.rs b/src/brightness/mod.rs index 4c8bc07..63f3d70 100644 --- a/src/brightness/mod.rs +++ b/src/brightness/mod.rs @@ -12,7 +12,7 @@ pub use controller::Controller; pub use ddcutil::DdcUtil; #[cfg_attr(test, automock)] -pub trait Brightness { +pub trait Brightness: Send { fn get(&mut self) -> Result>; fn set(&mut self, value: u64) -> Result>; } diff --git a/src/config/app.rs b/src/config/app.rs index ce61290..0923140 100644 --- a/src/config/app.rs +++ b/src/config/app.rs @@ -48,3 +48,19 @@ pub struct Config { pub als: Als, pub output: Vec, } + +impl Output { + pub fn name(&self) -> &str { + match self { + self::Output::Backlight(cfg) => &cfg.name, + self::Output::DdcUtil(cfg) => &cfg.name, + } + } + + pub fn capturer(&self) -> &Capturer { + match self { + self::Output::Backlight(cfg) => &cfg.capturer, + self::Output::DdcUtil(cfg) => &cfg.capturer, + } + } +} diff --git a/src/frame/capturer/mod.rs b/src/frame/capturer/mod.rs index a84f588..a817e5a 100644 --- a/src/frame/capturer/mod.rs +++ b/src/frame/capturer/mod.rs @@ -1,6 +1,6 @@ pub mod none; pub mod wlroots; -pub trait Capturer { +pub trait Capturer: Send { fn run(&mut self); } diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 1f94bbd..6a80d35 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -36,16 +36,16 @@ pub struct Capturer { } impl Capturer { - pub fn new(output_name: &str, controller: Controller) -> Self { + pub fn new(output_name: &str, controller: Controller) -> Result> { let connection = Connection::connect_to_env().expect("Unable to connect to Wayland"); - Self { + Ok(Self { vulkan: Vulkan::new().expect("Unable to initialize Vulkan"), - output: find_output(&connection, output_name).expect("Unable to find output"), + output: find_output(&connection, output_name)?, connection, controller, pending_frame: None, - } + }) } } diff --git a/src/main.rs b/src/main.rs index 67a15d3..f031ad1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,6 @@ +use config::Output; use itertools::Itertools; +use std::error::Error; use std::sync::mpsc; mod als; @@ -30,109 +32,103 @@ fn main() { let als_txs = config .output .iter() - .filter_map(|output| { - let output = output.clone(); - - let (als_tx, als_rx) = mpsc::channel(); - let (user_tx, user_rx) = mpsc::channel(); - let (prediction_tx, prediction_rx) = mpsc::channel(); - - let (output_name, output_capturer) = match output.clone() { - config::Output::Backlight(cfg) => (cfg.name, cfg.capturer), - config::Output::DdcUtil(cfg) => (cfg.name, cfg.capturer), - }; - - let brightness = match output { - config::Output::Backlight(cfg) => { - brightness::Backlight::new(&cfg.path, cfg.min_brightness) - .map(|b| Box::new(b) as Box) - } - config::Output::DdcUtil(cfg) => { - brightness::DdcUtil::new(&cfg.name, cfg.min_brightness) - .map(|b| Box::new(b) as Box) - } - }; - - match brightness { - Ok(b) => { - let thread_name = format!("backlight-{}", output_name); - std::thread::Builder::new() - .name(thread_name.clone()) - .spawn(move || { - brightness::Controller::new(b, user_tx, prediction_rx).run(); - }) - .unwrap_or_else(|_| panic!("Unable to start thread: {}", thread_name)); - - let thread_name = format!("predictor-{}", output_name); - std::thread::Builder::new() - .name(thread_name.clone()) - .spawn(move || { - let controller = predictor::Controller::new( - prediction_tx, - user_rx, - als_rx, - true, - &output_name, - ); - - let mut frame_capturer: Box = - match output_capturer { - config::Capturer::Wlroots => { - Box::new(frame::capturer::wlroots::Capturer::new( - &output_name, - controller, - )) - } - config::Capturer::None => { - Box::new(frame::capturer::none::Capturer::new(controller)) - } - }; - - frame_capturer.run(); - }) - .unwrap_or_else(|_| panic!("Unable to start thread: {}", thread_name)); - - Some(als_tx) - } - Err(err) => { - log::warn!( - "Skipping '{}' as it might be disconnected: {}", - output_name, - err - ); - - None - } + .filter_map(|output| match init_output(output) { + Ok((mut brightness_controller, mut frame_capturer, als_tx)) => { + spawn(format!("backlight-{}", output.name()), move || { + brightness_controller.run() + }); + spawn(format!("predictor-{}", output.name()), move || { + frame_capturer.run(); + }); + + Some(als_tx) + } + Err(err) => { + log::warn!( + "Skipping '{}' as it might be disconnected: {}", + output.name(), + err + ); + + None } }) .collect_vec(); - std::thread::Builder::new() - .name("als".to_string()) - .spawn(move || { - let als: Box = match config.als { - config::Als::Iio { path, thresholds } => Box::new( - als::iio::Als::new(&path, thresholds) - .expect("Unable to initialize ALS IIO sensor"), - ), - config::Als::Time { thresholds } => Box::new(als::time::Als::new(thresholds)), - config::Als::Webcam { video, thresholds } => Box::new({ - let (webcam_tx, webcam_rx) = mpsc::channel(); - std::thread::Builder::new() - .name("als-webcam".to_string()) - .spawn(move || { - als::webcam::Webcam::new(webcam_tx, video).run(); - }) - .expect("Unable to start thread: als-webcam"); - als::webcam::Als::new(webcam_rx, thresholds) - }), - config::Als::None => Box::::default(), - }; - - als::controller::Controller::new(als, als_txs).run(); - }) - .expect("Unable to start thread: als"); + spawn("als".to_string(), move || { + let als: Box = match config.als { + config::Als::Iio { path, thresholds } => Box::new( + als::iio::Als::new(&path, thresholds).expect("Unable to initialize ALS IIO sensor"), + ), + config::Als::Time { thresholds } => Box::new(als::time::Als::new(thresholds)), + config::Als::Webcam { video, thresholds } => Box::new({ + let (webcam_tx, webcam_rx) = mpsc::channel(); + std::thread::Builder::new() + .name("als-webcam".to_string()) + .spawn(move || { + als::webcam::Webcam::new(webcam_tx, video).run(); + }) + .expect("Unable to start thread: als-webcam"); + als::webcam::Als::new(webcam_rx, thresholds) + }), + config::Als::None => Box::::default(), + }; + + als::controller::Controller::new(als, als_txs).run(); + }); log::info!("Continue adjusting brightness and wluma will learn your preference over time."); std::thread::park(); } + +fn spawn(thread_name: String, handler: F) +where + F: FnOnce() -> T, + F: Send + 'static, + T: Send + 'static, +{ + std::thread::Builder::new() + .name(thread_name.clone()) + .spawn(handler) + .unwrap_or_else(|_| panic!("Unable to start thread: {}", thread_name)); +} + +type OutputHandler = ( + brightness::Controller, + Box, + std::sync::mpsc::Sender, +); + +fn init_output(output: &Output) -> Result> { + let output = output.clone(); + + let (als_tx, als_rx) = mpsc::channel(); + let (user_tx, user_rx) = mpsc::channel(); + let (prediction_tx, prediction_rx) = mpsc::channel(); + + let brightness = match &output { + config::Output::Backlight(cfg) => { + brightness::Backlight::new(&cfg.path, cfg.min_brightness).map(|b| Box::new(b) as Box<_>) + } + config::Output::DdcUtil(cfg) => { + brightness::DdcUtil::new(&cfg.name, cfg.min_brightness).map(|b| Box::new(b) as Box<_>) + } + }?; + + let brightness_controller = brightness::Controller::new(brightness, user_tx, prediction_rx); + + let predictor_controller = + predictor::Controller::new(prediction_tx, user_rx, als_rx, true, output.name()); + + let frame_capturer: Box = match output.capturer() { + config::Capturer::Wlroots => { + frame::capturer::wlroots::Capturer::new(output.name(), predictor_controller) + .map(|b| Box::new(b) as Box<_>)? + } + config::Capturer::None => { + Box::new(frame::capturer::none::Capturer::new(predictor_controller)) + } + }; + + Ok((brightness_controller, frame_capturer, als_tx)) +} From 0b8abfd4961c0a661dd445b9f250ebc007c91d2b Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Mon, 7 Aug 2023 11:59:20 +0200 Subject: [PATCH 7/8] Try to fix ownership of frame fds --- src/frame/capturer/wlroots.rs | 3 +-- src/frame/object.rs | 17 +++++++++-------- src/frame/vulkan.rs | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 6a80d35..688f7c1 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -10,7 +10,6 @@ use smithay_client_toolkit::{ registry_handlers, }; use std::error::Error; -use std::os::fd::AsRawFd; use std::{thread, time::Duration}; use wayland_client::globals::GlobalListContents; use wayland_client::protocol::wl_output::WlOutput; @@ -148,7 +147,7 @@ impl Dispatch for Capt zwlr_export_dmabuf_frame_v1::Event::Object { index, fd, size, .. } => { - pending_frame.set_object(index, fd.as_raw_fd(), size); + pending_frame.set_object(index, fd, size); } zwlr_export_dmabuf_frame_v1::Event::Ready { .. } => { diff --git a/src/frame/object.rs b/src/frame/object.rs index a0a71d8..4c54a7d 100644 --- a/src/frame/object.rs +++ b/src/frame/object.rs @@ -1,12 +1,13 @@ -use std::os::unix::io::RawFd; +use std::collections::HashMap; +use wayland_backend::io_lifetimes::OwnedFd; #[derive(Default)] pub struct Object { pub width: u32, pub height: u32, pub num_objects: u32, - pub fds: Vec, - pub sizes: Vec, + pub fds: HashMap, + pub sizes: HashMap, } impl Object { @@ -14,12 +15,12 @@ impl Object { self.width = width; self.height = height; self.num_objects = num_objects; - self.fds.resize(num_objects as usize, 0); - self.sizes.resize(num_objects as usize, 0); + self.fds = HashMap::new(); + self.sizes = HashMap::new(); } - pub fn set_object(&mut self, index: u32, fd: RawFd, size: u32) { - self.fds[index as usize] = fd; - self.sizes[index as usize] = size; + pub fn set_object(&mut self, index: u32, fd: OwnedFd, size: u32) { + self.fds.insert(index, fd); + self.sizes.insert(index, size); } } diff --git a/src/frame/vulkan.rs b/src/frame/vulkan.rs index a7f2335..c05f702 100644 --- a/src/frame/vulkan.rs +++ b/src/frame/vulkan.rs @@ -6,6 +6,7 @@ use std::default::Default; use std::error::Error; use std::ffi::CString; use std::ops::Drop; +use std::os::fd::AsRawFd; const WLUMA_VERSION: u32 = vk::make_api_version(0, 4, 3, 0); const VULKAN_VERSION: u32 = vk::make_api_version(0, 1, 2, 0); @@ -288,7 +289,7 @@ impl Vulkan { // If the image needs dedicated memory, add MemoryDedicatedAllocateInfo to the info chain let mut frame_import_memory_info = vk::ImportMemoryFdInfoKHR::builder() .handle_type(vk::ExternalMemoryHandleTypeFlags::DMA_BUF_EXT) - .fd(frame.fds[0]); + .fd(frame.fds[&0].as_raw_fd()); let mut frame_image_memory_dedicated_info = vk::MemoryDedicatedAllocateInfo::builder().image(frame_image); From d24c4c2508b9201abeac32854ce655fd5adaa86d Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Mon, 7 Aug 2023 13:27:39 +0200 Subject: [PATCH 8/8] Fix panic on no output --- src/frame/capturer/wlroots.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frame/capturer/wlroots.rs b/src/frame/capturer/wlroots.rs index 688f7c1..796c8f7 100644 --- a/src/frame/capturer/wlroots.rs +++ b/src/frame/capturer/wlroots.rs @@ -99,7 +99,7 @@ fn find_output(connection: &Connection, output_name: &str) -> Result panic!("Unable to find output that matches config '{output_name}'"), + 0 => Err("Unable to find output that matches config '{output_name}'".into()), 1 => Ok(outputs.pop().unwrap()), _ => panic!("More than one output matches config '{output_name}', this is not supported!"), }