Update Smithay, use device changed session resume code
Browse files at this commitcbbb7a26fc0bff426d67bb2804167f01ade5fbe4Parent: 18566e33 changed files +28 -73
- Cargo.lock +20 -34
- src/backend/tty.rs +7 -39
- src/input.rs +1 -0
Cargo.lockmodified+20 -34
| @@ -1406,25 +1406,22 @@ dependencies = [ | |||
| 1406 | 1406 | ||
| 1407 | [[package]] | 1407 | [[package]] |
| 1408 | name = "input" | 1408 | name = "input" |
| 1409 | -version = "0.8.3" | 1409 | +version = "0.9.0" |
| 1410 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1410 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1411 | -checksum = "e6e74cd82cedcd66db78742a8337bdc48f188c4d2c12742cbc5cd85113f0b059" | 1411 | +checksum = "7911ce3db9c10c5ab4a35c49af778a5f9a827bd0f7371d9be56175d8dd2740d0" |
| 1412 | dependencies = [ | 1412 | dependencies = [ |
| 1413 | - "bitflags 1.3.2", | 1413 | + "bitflags 2.4.2", |
| 1414 | "input-sys", | 1414 | "input-sys", |
| 1415 | "io-lifetimes 1.0.11", | 1415 | "io-lifetimes 1.0.11", |
| 1416 | "libc", | 1416 | "libc", |
| 1417 | - "udev 0.7.0", | 1417 | + "udev", |
| 1418 | ] | 1418 | ] |
| 1419 | 1419 | ||
| 1420 | [[package]] | 1420 | [[package]] |
| 1421 | name = "input-sys" | 1421 | name = "input-sys" |
| 1422 | -version = "1.17.0" | 1422 | +version = "1.18.0" |
| 1423 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1423 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1424 | -checksum = "05f6c2a17e8aba7217660e32863af87b0febad811d4b8620ef76b386603fddc2" | 1424 | +checksum = "bd4f5b4d1c00331c5245163aacfe5f20be75b564c7112d45893d4ae038119eb0" |
| 1425 | -dependencies = [ | ||
| 1426 | - "libc", | ||
| 1427 | -] | ||
| 1428 | 1425 | ||
| 1429 | [[package]] | 1426 | [[package]] |
| 1430 | name = "instant" | 1427 | name = "instant" |
| @@ -2301,9 +2298,9 @@ dependencies = [ | |||
| 2301 | 2298 | ||
| 2302 | [[package]] | 2299 | [[package]] |
| 2303 | name = "proc-macro2" | 2300 | name = "proc-macro2" |
| 2304 | -version = "1.0.76" | 2301 | +version = "1.0.78" |
| 2305 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2302 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2306 | -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" | 2303 | +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" |
| 2307 | dependencies = [ | 2304 | dependencies = [ |
| 2308 | "unicode-ident", | 2305 | "unicode-ident", |
| 2309 | ] | 2306 | ] |
| @@ -2459,13 +2456,13 @@ dependencies = [ | |||
| 2459 | 2456 | ||
| 2460 | [[package]] | 2457 | [[package]] |
| 2461 | name = "regex" | 2458 | name = "regex" |
| 2462 | -version = "1.10.2" | 2459 | +version = "1.10.3" |
| 2463 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2460 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2464 | -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" | 2461 | +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" |
| 2465 | dependencies = [ | 2462 | dependencies = [ |
| 2466 | "aho-corasick", | 2463 | "aho-corasick", |
| 2467 | "memchr", | 2464 | "memchr", |
| 2468 | - "regex-automata 0.4.3", | 2465 | + "regex-automata 0.4.4", |
| 2469 | "regex-syntax 0.8.2", | 2466 | "regex-syntax 0.8.2", |
| 2470 | ] | 2467 | ] |
| 2471 | 2468 | ||
| @@ -2480,9 +2477,9 @@ dependencies = [ | |||
| 2480 | 2477 | ||
| 2481 | [[package]] | 2478 | [[package]] |
| 2482 | name = "regex-automata" | 2479 | name = "regex-automata" |
| 2483 | -version = "0.4.3" | 2480 | +version = "0.4.4" |
| 2484 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2481 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2485 | -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" | 2482 | +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" |
| 2486 | dependencies = [ | 2483 | dependencies = [ |
| 2487 | "aho-corasick", | 2484 | "aho-corasick", |
| 2488 | "memchr", | 2485 | "memchr", |
| @@ -2658,9 +2655,9 @@ dependencies = [ | |||
| 2658 | 2655 | ||
| 2659 | [[package]] | 2656 | [[package]] |
| 2660 | name = "shlex" | 2657 | name = "shlex" |
| 2661 | -version = "1.2.0" | 2658 | +version = "1.3.0" |
| 2662 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2659 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2663 | -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" | 2660 | +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" |
| 2664 | 2661 | ||
| 2665 | [[package]] | 2662 | [[package]] |
| 2666 | name = "signal-hook-registry" | 2663 | name = "signal-hook-registry" |
| @@ -2688,14 +2685,14 @@ dependencies = [ | |||
| 2688 | 2685 | ||
| 2689 | [[package]] | 2686 | [[package]] |
| 2690 | name = "smallvec" | 2687 | name = "smallvec" |
| 2691 | -version = "1.13.0" | 2688 | +version = "1.13.1" |
| 2692 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2689 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2693 | -checksum = "3b187f0231d56fe41bfb12034819dd2bf336422a5866de41bc3fec4b2e3883e8" | 2690 | +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" |
| 2694 | 2691 | ||
| 2695 | [[package]] | 2692 | [[package]] |
| 2696 | name = "smithay" | 2693 | name = "smithay" |
| 2697 | version = "0.3.0" | 2694 | version = "0.3.0" |
| 2698 | -source = "git+https://github.com/Smithay/smithay.git#b7284bc6ca6afc782bd55a5c34ef3f902005951f" | 2695 | +source = "git+https://github.com/Smithay/smithay.git#810df8986f9e76a1a5ffa728e70574abcf191263" |
| 2699 | dependencies = [ | 2696 | dependencies = [ |
| 2700 | "appendlist", | 2697 | "appendlist", |
| 2701 | "bitflags 2.4.2", | 2698 | "bitflags 2.4.2", |
| @@ -2726,7 +2723,7 @@ dependencies = [ | |||
| 2726 | "tempfile", | 2723 | "tempfile", |
| 2727 | "thiserror", | 2724 | "thiserror", |
| 2728 | "tracing", | 2725 | "tracing", |
| 2729 | - "udev 0.8.0", | 2726 | + "udev", |
| 2730 | "wayland-backend", | 2727 | "wayland-backend", |
| 2731 | "wayland-egl", | 2728 | "wayland-egl", |
| 2732 | "wayland-protocols", | 2729 | "wayland-protocols", |
| @@ -2766,7 +2763,7 @@ dependencies = [ | |||
| 2766 | [[package]] | 2763 | [[package]] |
| 2767 | name = "smithay-drm-extras" | 2764 | name = "smithay-drm-extras" |
| 2768 | version = "0.1.0" | 2765 | version = "0.1.0" |
| 2769 | -source = "git+https://github.com/Smithay/smithay.git#b7284bc6ca6afc782bd55a5c34ef3f902005951f" | 2766 | +source = "git+https://github.com/Smithay/smithay.git#810df8986f9e76a1a5ffa728e70574abcf191263" |
| 2770 | dependencies = [ | 2767 | dependencies = [ |
| 2771 | "drm", | 2768 | "drm", |
| 2772 | "edid-rs", | 2769 | "edid-rs", |
| @@ -3062,17 +3059,6 @@ version = "1.17.0" | |||
| 3062 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3059 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3063 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" | 3060 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" |
| 3064 | 3061 | ||
| 3065 | -[[package]] | ||
| 3066 | -name = "udev" | ||
| 3067 | -version = "0.7.0" | ||
| 3068 | -source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3069 | -checksum = "4ebdbbd670373442a12fe9ef7aeb53aec4147a5a27a00bbc3ab639f08f48191a" | ||
| 3070 | -dependencies = [ | ||
| 3071 | - "libc", | ||
| 3072 | - "libudev-sys", | ||
| 3073 | - "pkg-config", | ||
| 3074 | -] | ||
| 3075 | - | ||
| 3076 | [[package]] | 3062 | [[package]] |
| 3077 | name = "udev" | 3063 | name = "udev" |
| 3078 | version = "0.8.0" | 3064 | version = "0.8.0" |
src/backend/tty.rsmodified+7 -39
| @@ -280,7 +280,7 @@ impl Tty { | |||
| 280 | 280 | ||
| 281 | self.libinput.suspend(); | 281 | self.libinput.suspend(); |
| 282 | 282 | ||
| 283 | - for device in self.devices.values() { | 283 | + for device in self.devices.values_mut() { |
| 284 | device.drm.pause(); | 284 | device.drm.pause(); |
| 285 | } | 285 | } |
| 286 | } | 286 | } |
| @@ -323,47 +323,13 @@ impl Tty { | |||
| 323 | device_list.remove(&node.dev_id()); | 323 | device_list.remove(&node.dev_id()); |
| 324 | 324 | ||
| 325 | // It hasn't been removed, update its state as usual. | 325 | // It hasn't been removed, update its state as usual. |
| 326 | - let device = &self.devices[&node]; | ||
| 327 | - device.drm.activate(); | ||
| 328 | - | ||
| 329 | - // HACK: force reset the connectors to make resuming work across sleep. | ||
| 330 | - let device = &self.devices[&node]; | ||
| 331 | - let crtcs: Vec<_> = device | ||
| 332 | - .drm_scanner | ||
| 333 | - .crtcs() | ||
| 334 | - .map(|(_conn, crtc)| crtc) | ||
| 335 | - .collect(); | ||
| 336 | - for crtc in crtcs { | ||
| 337 | - self.connector_disconnected(niri, node, crtc); | ||
| 338 | - } | ||
| 339 | - | ||
| 340 | let device = self.devices.get_mut(&node).unwrap(); | 326 | let device = self.devices.get_mut(&node).unwrap(); |
| 341 | - let _ = device.drm_scanner.scan_connectors(&device.drm); | 327 | + if let Err(err) = device.drm.activate(true) { |
| 342 | - let crtcs: Vec<_> = device | 328 | + warn!("error activating DRM device: {err:?}"); |
| 343 | - .drm_scanner | ||
| 344 | - .crtcs() | ||
| 345 | - .map(|(conn, crtc)| (conn.clone(), crtc)) | ||
| 346 | - .collect(); | ||
| 347 | - for (conn, crtc) in crtcs { | ||
| 348 | - if let Err(err) = self.connector_connected(niri, node, conn, crtc) { | ||
| 349 | - warn!("error connecting connector: {err:?}"); | ||
| 350 | - } | ||
| 351 | } | 329 | } |
| 352 | 330 | ||
| 353 | - // // Refresh the connectors. | 331 | + // Refresh the connectors. |
| 354 | - // self.device_changed(node.dev_id(), niri); | 332 | + self.device_changed(node.dev_id(), niri); |
| 355 | - | ||
| 356 | - // // Refresh the state on unchanged connectors. | ||
| 357 | - // let device = self.devices.get_mut(&node).unwrap(); | ||
| 358 | - // for surface in device.surfaces.values_mut() { | ||
| 359 | - // let compositor = &mut surface.compositor; | ||
| 360 | - // if let Err(err) = compositor.surface().reset_state() { | ||
| 361 | - // warn!("error resetting DRM surface state: {err}"); | ||
| 362 | - // } | ||
| 363 | - // compositor.reset_buffers(); | ||
| 364 | - // } | ||
| 365 | - | ||
| 366 | - // niri.queue_redraw_all(); | ||
| 367 | } | 333 | } |
| 368 | 334 | ||
| 369 | // Add new devices. | 335 | // Add new devices. |
| @@ -378,6 +344,8 @@ impl Tty { | |||
| 378 | } | 344 | } |
| 379 | 345 | ||
| 380 | self.refresh_ipc_outputs(); | 346 | self.refresh_ipc_outputs(); |
| 347 | + | ||
| 348 | + niri.queue_redraw_all(); | ||
| 381 | } | 349 | } |
| 382 | } | 350 | } |
| 383 | } | 351 | } |
src/input.rsmodified+1 -0
| @@ -90,6 +90,7 @@ impl State { | |||
| 90 | TouchUp { .. } => (), | 90 | TouchUp { .. } => (), |
| 91 | TouchCancel { .. } => (), | 91 | TouchCancel { .. } => (), |
| 92 | TouchFrame { .. } => (), | 92 | TouchFrame { .. } => (), |
| 93 | + SwitchToggle { .. } => (), | ||
| 93 | Special(_) => (), | 94 | Special(_) => (), |
| 94 | } | 95 | } |
| 95 | 96 | ||