Update dependencies

This commit is contained in:
Ottatop 2024-06-22 13:08:25 -05:00
parent b655a17547
commit 36434806a5
13 changed files with 318 additions and 150 deletions

270
Cargo.lock generated
View file

@ -75,9 +75,30 @@ dependencies = [
"jni-sys",
"libc",
"log",
"ndk",
"ndk 0.8.0",
"ndk-context",
"ndk-sys",
"ndk-sys 0.5.0+25.2.9519653",
"num_enum",
"thiserror",
]
[[package]]
name = "android-activity"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046"
dependencies = [
"android-properties",
"bitflags 2.5.0",
"cc",
"cesu8",
"jni",
"jni-sys",
"libc",
"log",
"ndk 0.9.0",
"ndk-context",
"ndk-sys 0.6.0+11769913",
"num_enum",
"thiserror",
]
@ -409,9 +430,9 @@ checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
[[package]]
name = "bytemuck"
version = "1.16.0"
version = "1.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5"
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
dependencies = [
"bytemuck_derive",
]
@ -467,6 +488,19 @@ dependencies = [
"thiserror",
]
[[package]]
name = "calloop"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c58a38167d6fba8c67cce63c4a91f2a73ca42cbdaf6fb9ba164f1e07b43ecc10"
dependencies = [
"bitflags 2.5.0",
"log",
"polling",
"rustix",
"slab",
]
[[package]]
name = "calloop-wayland-source"
version = "0.2.0"
@ -624,13 +658,14 @@ checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]]
name = "cliclack"
version = "0.2.5"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4febf49beeedc40528e4956995631f1bbdb4d8804ef940b44351f393a996c739"
checksum = "ac20862449f338d814085d6d025790896eb6ad8c7bb6f4e0633502796a16d49f"
dependencies = [
"console",
"indicatif",
"once_cell",
"strsim 0.11.1",
"textwrap",
"zeroize",
]
@ -1034,6 +1069,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "dpi"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53"
[[package]]
name = "drm"
version = "0.12.0"
@ -1737,7 +1778,7 @@ dependencies = [
"raw-window-handle",
"smol_str",
"thiserror",
"web-time",
"web-time 0.2.4",
"xxhash-rust",
]
@ -1876,7 +1917,7 @@ dependencies = [
"web-sys",
"winapi",
"window_clipboard",
"winit",
"winit 0.29.15",
]
[[package]]
@ -2117,7 +2158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if",
"windows-targets 0.48.5",
"windows-targets 0.52.5",
]
[[package]]
@ -2357,7 +2398,22 @@ dependencies = [
"bitflags 2.5.0",
"jni-sys",
"log",
"ndk-sys",
"ndk-sys 0.5.0+25.2.9519653",
"num_enum",
"raw-window-handle",
"thiserror",
]
[[package]]
name = "ndk"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
dependencies = [
"bitflags 2.5.0",
"jni-sys",
"log",
"ndk-sys 0.6.0+11769913",
"num_enum",
"raw-window-handle",
"thiserror",
@ -2378,6 +2434,15 @@ dependencies = [
"jni-sys",
]
[[package]]
name = "ndk-sys"
version = "0.6.0+11769913"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"
dependencies = [
"jni-sys",
]
[[package]]
name = "nix"
version = "0.27.1"
@ -2532,6 +2597,30 @@ dependencies = [
"objc2-quartz-core",
]
[[package]]
name = "objc2-cloud-kit"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
dependencies = [
"bitflags 2.5.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-core-location",
"objc2-foundation",
]
[[package]]
name = "objc2-contacts"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
dependencies = [
"block2 0.5.1",
"objc2 0.5.2",
"objc2-foundation",
]
[[package]]
name = "objc2-core-data"
version = "0.2.2"
@ -2556,6 +2645,18 @@ dependencies = [
"objc2-metal",
]
[[package]]
name = "objc2-core-location"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
dependencies = [
"block2 0.5.1",
"objc2 0.5.2",
"objc2-contacts",
"objc2-foundation",
]
[[package]]
name = "objc2-encode"
version = "3.0.0"
@ -2581,6 +2682,18 @@ dependencies = [
"objc2 0.5.2",
]
[[package]]
name = "objc2-link-presentation"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
dependencies = [
"block2 0.5.1",
"objc2 0.5.2",
"objc2-app-kit",
"objc2-foundation",
]
[[package]]
name = "objc2-metal"
version = "0.2.2"
@ -2606,6 +2719,61 @@ dependencies = [
"objc2-metal",
]
[[package]]
name = "objc2-symbols"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
dependencies = [
"objc2 0.5.2",
"objc2-foundation",
]
[[package]]
name = "objc2-ui-kit"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
dependencies = [
"bitflags 2.5.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-cloud-kit",
"objc2-core-data",
"objc2-core-image",
"objc2-core-location",
"objc2-foundation",
"objc2-link-presentation",
"objc2-quartz-core",
"objc2-symbols",
"objc2-uniform-type-identifiers",
"objc2-user-notifications",
]
[[package]]
name = "objc2-uniform-type-identifiers"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
dependencies = [
"block2 0.5.1",
"objc2 0.5.2",
"objc2-foundation",
]
[[package]]
name = "objc2-user-notifications"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
dependencies = [
"bitflags 2.5.0",
"block2 0.5.1",
"objc2 0.5.2",
"objc2-core-location",
"objc2-foundation",
]
[[package]]
name = "objc_exception"
version = "0.1.2"
@ -3519,12 +3687,11 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/Smithay/smithay?rev=b4f8120#b4f8120be0fb9b7f038d041efa7f6549e26cd2bc"
source = "git+https://github.com/Smithay/smithay?rev=69b379d#69b379d00af9e1bcc98dac2d452bfd86eafdaf34"
dependencies = [
"appendlist",
"ash",
"bitflags 2.5.0",
"calloop 0.13.0",
"calloop 0.14.0",
"cc",
"cgmath",
"cursor-icon",
@ -3555,13 +3722,15 @@ dependencies = [
"tracing",
"udev",
"wayland-backend",
"wayland-client",
"wayland-cursor",
"wayland-egl",
"wayland-protocols 0.32.1",
"wayland-protocols-misc",
"wayland-protocols-wlr 0.3.1",
"wayland-server",
"wayland-sys",
"winit",
"winit 0.30.3",
"x11rb",
"xkbcommon",
]
@ -3633,7 +3802,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
version = "0.1.0"
source = "git+https://github.com/Smithay/smithay?rev=b4f8120#b4f8120be0fb9b7f038d041efa7f6549e26cd2bc"
source = "git+https://github.com/Smithay/smithay?rev=69b379d#69b379d00af9e1bcc98dac2d452bfd86eafdaf34"
dependencies = [
"drm",
"edid-rs",
@ -4720,6 +4889,16 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "web-time"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "wgpu"
version = "0.19.4"
@ -4799,7 +4978,7 @@ dependencies = [
"log",
"metal",
"naga",
"ndk-sys",
"ndk-sys 0.5.0+25.2.9519653",
"objc",
"once_cell",
"parking_lot 0.12.3",
@ -5109,7 +5288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca"
dependencies = [
"ahash",
"android-activity",
"android-activity 0.5.2",
"atomic-waker",
"bitflags 2.5.0",
"bytemuck",
@ -5123,8 +5302,8 @@ dependencies = [
"libc",
"log",
"memmap2 0.9.4",
"ndk",
"ndk-sys",
"ndk 0.8.0",
"ndk-sys 0.5.0+25.2.9519653",
"objc2 0.4.1",
"once_cell",
"orbclient",
@ -5143,13 +5322,64 @@ dependencies = [
"wayland-protocols 0.31.2",
"wayland-protocols-plasma",
"web-sys",
"web-time",
"web-time 0.2.4",
"windows-sys 0.48.0",
"x11-dl",
"x11rb",
"xkbcommon-dl",
]
[[package]]
name = "winit"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f45a7b7e2de6af35448d7718dab6d95acec466eb3bb7a56f4d31d1af754004"
dependencies = [
"ahash",
"android-activity 0.6.0",
"atomic-waker",
"bitflags 2.5.0",
"block2 0.5.1",
"bytemuck",
"calloop 0.12.4",
"cfg_aliases 0.2.1",
"concurrent-queue",
"core-foundation",
"core-graphics",
"cursor-icon",
"dpi",
"js-sys",
"libc",
"memmap2 0.9.4",
"ndk 0.9.0",
"objc2 0.5.2",
"objc2-app-kit",
"objc2-foundation",
"objc2-ui-kit",
"orbclient",
"percent-encoding",
"pin-project",
"raw-window-handle",
"redox_syscall 0.4.1",
"rustix",
"smithay-client-toolkit 0.18.1",
"smol_str",
"tracing",
"unicode-segmentation",
"wasm-bindgen",
"wasm-bindgen-futures",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.31.2",
"wayland-protocols-plasma",
"web-sys",
"web-time 1.1.0",
"windows-sys 0.52.0",
"x11-dl",
"x11rb",
"xkbcommon-dl",
]
[[package]]
name = "winnow"
version = "0.5.40"

View file

@ -17,7 +17,7 @@ repository = "https://github.com/pinnacle-comp/pinnacle/"
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"]}
tokio-stream = { version = "0.1.15", features = ["net"] }
# gRPC
prost = "0.12.4"
prost = "0.12.6"
tonic = "0.11.0"
tonic-reflection = "0.11.0"
tonic-build = "0.11.0"
@ -30,14 +30,14 @@ pinnacle-api-defs = { path = "./pinnacle-api-defs" }
xkbcommon = "0.7.0"
xdg = "2.5.2"
bitflags = "2.5.0"
clap = { version = "4.5.4", features = ["derive"] }
clap = { version = "4.5.7", features = ["derive"] }
dircpy = "0.3.16"
tempfile = "3.10.1"
indexmap = "2.2.6"
[workspace.dependencies.smithay]
git = "https://github.com/Smithay/smithay"
rev = "b4f8120"
rev = "69b379d"
# path = "../../git/smithay"
default-features = false
features = [
@ -48,7 +48,6 @@ features = [
"backend_udev",
"backend_drm",
"backend_gbm",
"backend_vulkan",
"backend_egl",
"backend_session_libseat",
"renderer_gl",
@ -86,14 +85,14 @@ keywords = ["wayland", "compositor", "smithay", "lua"]
[dependencies]
# Smithay
smithay = { workspace = true }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "b4f8120" }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "69b379d" }
# Tracing
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tracing-appender = "0.2.3"
# Errors
anyhow = { version = "1.0.83", features = ["backtrace"] }
thiserror = "1.0.60"
anyhow = { version = "1.0.86", features = ["backtrace"] }
thiserror = "1.0.61"
# xcursor stuff
xcursor = { version = "0.3.5" }
image = { version = "0.25.1", default-features = false }
@ -106,11 +105,11 @@ tokio = { workspace = true, features = ["process", "io-util", "signal"] }
tokio-stream = { workspace = true }
# CLI
clap = { workspace = true }
cliclack = "0.2.5"
cliclack = "0.3.1"
# Misc.
bitflags = { workspace = true }
serde = { version = "1.0.202", features = ["derive"] }
toml = "0.8.13"
serde = { version = "1.0.203", features = ["derive"] }
toml = "0.8.14"
shellexpand = { version = "3.1.0", features = ["path"] }
x11rb = { version = "0.13.1", default-features = false, features = ["composite"] }
xkbcommon = { workspace = true }
@ -120,7 +119,7 @@ sysinfo = "0.30.12"
pinnacle-api-defs = { workspace = true }
dircpy = { workspace = true }
chrono = "0.4.38"
bytemuck = "1.16.0"
bytemuck = "1.16.1"
pinnacle-api = { path = "./api/rust", default-features = false }
gag = "1.0.0"
drm-sys = "0.7.0"

@ -1 +1 @@
Subproject commit 7191c245cb247f1935accb3357dd2ef9a8e35e73
Subproject commit ab730d249f28e7c83377ca391bb13edeb22c48c9

View file

@ -4,12 +4,9 @@ mod drm;
mod gamma;
pub use drm::util::drm_mode_from_api_modeline;
use indexmap::IndexSet;
use std::{
collections::{HashMap, HashSet},
path::Path,
time::Duration,
};
use std::{collections::HashMap, path::Path, time::Duration};
use anyhow::{anyhow, ensure, Context};
use drm::{set_crtc_active, util::create_drm_mode};
@ -17,10 +14,8 @@ use pinnacle_api_defs::pinnacle::signal::v0alpha1::OutputConnectResponse;
use smithay::{
backend::{
allocator::{
dmabuf::{AnyError, Dmabuf, DmabufAllocator},
gbm::{GbmAllocator, GbmBuffer, GbmBufferFlags, GbmDevice},
vulkan::{ImageUsageFlags, VulkanAllocator},
Allocator, Buffer, Fourcc,
Buffer, Fourcc,
},
drm::{
compositor::{DrmCompositor, PrimaryPlaneElement, RenderFrameResult},
@ -46,14 +41,12 @@ use smithay::{
Session,
},
udev::{self, UdevBackend, UdevEvent},
vulkan::{self, version::Version, PhysicalDevice},
SwapBuffersError,
},
desktop::utils::OutputPresentationFeedback,
input::pointer::CursorImageStatus,
output::{Output, PhysicalProperties, Subpixel},
reexports::{
ash::vk::ExtPhysicalDeviceDrmFn,
calloop::{
self, generic::Generic, timer::Timer, Dispatcher, Idle, Interest, LoopHandle,
PostAction, RegistrationToken,
@ -129,7 +122,6 @@ pub struct Udev {
display_handle: DisplayHandle,
pub(super) dmabuf_state: Option<(DmabufState, DmabufGlobal)>,
pub(super) primary_gpu: DrmNode,
allocator: Option<Box<dyn Allocator<Buffer = Dmabuf, Error = AnyError>>>,
pub(super) gpu_manager: GpuManager<GbmGlesBackend<GlesRenderer, DrmDeviceFd>>,
backends: HashMap<DrmNode, UdevBackendData>,
@ -218,7 +210,6 @@ impl Udev {
session,
primary_gpu,
gpu_manager,
allocator: None,
backends: HashMap::new(),
upscale_filter: TextureFilter::Linear,
@ -416,56 +407,6 @@ impl Udev {
.shm_formats(),
);
// Create the Vulkan allocator
if let Ok(instance) = vulkan::Instance::new(Version::VERSION_1_2, None) {
if let Some(physical_device) = PhysicalDevice::enumerate(&instance)
.ok()
.and_then(|devices| {
devices
.filter(|phd| {
phd.has_device_extension(ExtPhysicalDeviceDrmFn::name())
})
.find(|phd| {
phd.primary_node()
.is_ok_and(|node| node == Some(primary_gpu))
|| phd
.render_node()
.is_ok_and(|node| node == Some(primary_gpu))
})
})
{
match VulkanAllocator::new(
&physical_device,
ImageUsageFlags::COLOR_ATTACHMENT | ImageUsageFlags::SAMPLED,
) {
Ok(allocator) => {
udev.allocator = Some(Box::new(DmabufAllocator(allocator))
as Box<dyn Allocator<Buffer = Dmabuf, Error = AnyError>>);
}
Err(err) => {
warn!("Failed to create vulkan allocator: {}", err);
}
}
}
}
if udev.allocator.is_none() {
info!("No vulkan allocator found, using GBM.");
let gbm = udev
.backends
.get(&primary_gpu)
// If the primary_gpu failed to initialize, we likely have a kmsro device
.or_else(|| udev.backends.values().next())
// Don't fail, if there is no allocator. There is a chance, that this a single gpu system and we don't need one.
.map(|backend| backend.gbm.clone());
udev.allocator = gbm.map(|gbm| {
Box::new(DmabufAllocator(GbmAllocator::new(
gbm,
GbmBufferFlags::RENDERING,
))) as Box<_>
});
}
let mut renderer = udev.gpu_manager.single_renderer(&primary_gpu)?;
info!(
@ -479,7 +420,7 @@ impl Udev {
}
// init dmabuf support with format list from our primary gpu
let dmabuf_formats = renderer.dmabuf_formats().collect::<Vec<_>>();
let dmabuf_formats = renderer.dmabuf_formats();
let default_feedback =
DmabufFeedbackBuilder::new(primary_gpu.dev_id(), dmabuf_formats)
.build()
@ -747,20 +688,18 @@ fn get_surface_dmabuf_feedback(
let primary_formats = gpu_manager
.single_renderer(&primary_gpu)
.ok()?
.dmabuf_formats()
.collect::<HashSet<_>>();
.dmabuf_formats();
let render_formats = gpu_manager
.single_renderer(&render_node)
.ok()?
.dmabuf_formats()
.collect::<HashSet<_>>();
.dmabuf_formats();
let all_render_formats = primary_formats
.iter()
.chain(render_formats.iter())
.copied()
.collect::<HashSet<_>>();
.collect::<IndexSet<_>>();
let surface = composition.surface();
let planes = surface.planes().clone();
@ -772,7 +711,7 @@ fn get_surface_dmabuf_feedback(
.formats
.into_iter()
.chain(planes.overlay.into_iter().flat_map(|p| p.formats))
.collect::<HashSet<_>>()
.collect::<IndexSet<_>>()
.intersection(&all_render_formats)
.copied()
.collect::<Vec<_>>();

View file

@ -26,8 +26,8 @@ use smithay::{
DisplayHandle,
},
winit::{
platform::wayland::WindowBuilderExtWayland,
window::{Icon, WindowBuilder},
platform::wayland::WindowAttributesExtWayland,
window::{Icon, WindowAttributes},
},
},
utils::{IsAlive, Point, Rectangle, Transform},
@ -82,13 +82,13 @@ impl Backend {
impl Winit {
pub(crate) fn try_new(display_handle: DisplayHandle) -> anyhow::Result<UninitBackend<Winit>> {
let window_builder = WindowBuilder::new()
let window_attrs = WindowAttributes::default()
.with_title("Pinnacle")
.with_name("pinnacle", "pinnacle")
.with_window_icon(Icon::from_rgba(LOGO_BYTES.to_vec(), 64, 64).ok());
let (mut winit_backend, winit_evt_loop) =
match winit::init_from_builder::<GlesRenderer>(window_builder) {
match winit::init_from_attributes::<GlesRenderer>(window_attrs) {
Ok(ret) => ret,
Err(err) => anyhow::bail!("Failed to init winit backend: {err}"),
};
@ -123,10 +123,7 @@ impl Winit {
let dmabuf_default_feedback = match render_node {
Ok(Some(node)) => {
let dmabuf_formats = winit_backend
.renderer()
.dmabuf_formats()
.collect::<Vec<_>>();
let dmabuf_formats = winit_backend.renderer().dmabuf_formats();
let dmabuf_default_feedback =
DmabufFeedbackBuilder::new(node.dev_id(), dmabuf_formats)
.build()
@ -153,10 +150,7 @@ impl Winit {
(dmabuf_state, dmabuf_global, Some(default_feedback))
}
None => {
let dmabuf_formats = winit_backend
.renderer()
.dmabuf_formats()
.collect::<Vec<_>>();
let dmabuf_formats = winit_backend.renderer().dmabuf_formats();
let mut dmabuf_state = DmabufState::new();
let dmabuf_global =
dmabuf_state.create_global::<State>(&display_handle, dmabuf_formats);

View file

@ -202,7 +202,8 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
let (min_size, max_size) = match self.window.wl_surface() {
Some(wl_surface) => compositor::with_states(&wl_surface, |states| {
let data = states.cached_state.current::<SurfaceCachedState>();
let mut guard = states.cached_state.get::<SurfaceCachedState>();
let data = guard.current();
(data.min_size, data.max_size)
}),
None => (Size::default(), Size::default()),

View file

@ -109,7 +109,8 @@ impl CompositorHandler for State {
let maybe_dmabuf = compositor::with_states(surface, |surface_data| {
surface_data
.cached_state
.pending::<SurfaceAttributes>()
.get::<SurfaceAttributes>()
.pending()
.buffer
.as_ref()
.and_then(|assignment| match assignment {

View file

@ -286,7 +286,8 @@ pub fn snapshot_pre_commit_hook(
};
let got_unmapped = compositor::with_states(surface, |states| {
let buffer = &states.cached_state.pending::<SurfaceAttributes>().buffer;
let mut guard = states.cached_state.get::<SurfaceAttributes>();
let buffer = &guard.pending().buffer;
matches!(buffer, Some(BufferAssignment::Removed))
});

View file

@ -440,7 +440,10 @@ impl State {
// Focus the topmost exclusive layer, if any
for layer in self.pinnacle.layer_shell_state.layer_surfaces().rev() {
let data = compositor::with_states(layer.wl_surface(), |states| {
*states.cached_state.current::<LayerSurfaceCachedState>()
*states
.cached_state
.get::<LayerSurfaceCachedState>()
.current()
});
if data.keyboard_interactivity == KeyboardInteractivity::Exclusive
&& matches!(
@ -868,7 +871,8 @@ impl State {
compositor::with_states(&*focus.wl_surface()?, |states| {
states
.cached_state
.current::<SurfaceAttributes>()
.get::<SurfaceAttributes>()
.current()
.input_region
.clone()
})

View file

@ -24,6 +24,7 @@ use pinnacle::{
util::increase_nofile_rlimit,
};
use smithay::reexports::{calloop::EventLoop, rustix::process::geteuid};
use tokio::sync::oneshot::error::TryRecvError;
use tracing::{error, info, warn};
use tracing_appender::rolling::Rotation;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer};
@ -176,30 +177,28 @@ async fn main() -> anyhow::Result<()> {
#[cfg(feature = "snowcap")]
{
use smithay::reexports::calloop;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
info!("Starting Snowcap");
let (ping, source) = calloop::ping::make_ping()?;
let ready_flag = Arc::new(AtomicBool::new(false));
let ready_clone = ready_flag.clone();
let (sender, mut recv) = tokio::sync::oneshot::channel();
let join_handle = tokio::task::spawn_blocking(move || {
let _span = tracing::error_span!("snowcap");
let _span = _span.enter();
snowcap::start(Some(source), ready_clone);
snowcap::start(Some(sender));
});
while !ready_flag.load(Ordering::SeqCst) {
let stop_signal = loop {
if join_handle.is_finished() {
panic!("snowcap failed to start");
}
event_loop.dispatch(Duration::from_secs(1), &mut state)?;
state.on_event_loop_cycle_completion();
}
state.pinnacle.snowcap_shutdown_ping = Some(ping);
match recv.try_recv() {
Ok(stop_signal) => break stop_signal,
Err(TryRecvError::Empty) => {
event_loop.dispatch(Duration::from_secs(1), &mut state)?;
state.on_event_loop_cycle_completion();
}
Err(TryRecvError::Closed) => panic!("snowcap failed to start"),
}
};
state.pinnacle.snowcap_stop_signal = Some(stop_signal);
state.pinnacle.snowcap_join_handle = Some(join_handle);
}

View file

@ -62,14 +62,14 @@ where
// which is why these associated types exist.
//
// From https://github.com/YaLTeR/niri/blob/ae7fb4c4f405aa0ff49930040d414581a812d938/src/render_helpers/renderer.rs#L10
type PTextureId: Texture + Clone + 'static;
type PTextureId: Texture + Clone + Send + 'static;
type PError: std::error::Error + Send + Sync + 'static;
}
impl<R> PRenderer for R
where
R: ImportAll + ImportMem,
R::TextureId: Texture + Clone + 'static,
R::TextureId: Texture + Clone + Send + 'static,
R::Error: std::error::Error + Send + Sync + 'static,
{
type PTextureId = R::TextureId;

View file

@ -38,7 +38,7 @@ pub fn texture_render_elements_from_surface_tree(
let data = states.data_map.get::<RendererSurfaceStateUserData>();
if let Some(data) = data {
let data = &*data.borrow();
let data = data.lock().unwrap();
if let Some(view) = data.view() {
location += view.offset.to_f64().to_physical(scale);
@ -55,11 +55,14 @@ pub fn texture_render_elements_from_surface_tree(
let data = states.data_map.get::<RendererSurfaceStateUserData>();
if let Some(data) = data {
let has_view = if let Some(view) = data.borrow().view() {
location += view.offset.to_f64().to_physical(scale);
true
} else {
false
let has_view = {
let data = data.lock().unwrap();
if let Some(view) = data.view() {
location += view.offset.to_f64().to_physical(scale);
true
} else {
false
}
};
if has_view {
@ -74,12 +77,9 @@ pub fn texture_render_elements_from_surface_tree(
Ok(Some(surface)) => {
// Reconstruct the element as a TextureRenderElement
let data = data.borrow();
let data = data.lock().unwrap();
let view = data.view().unwrap();
// TODO: figure out what is making the WaylandSurfaceRenderElement
// not drop and release the shm buffer for wleird
let texture_buffer = TextureBuffer::from_texture(
renderer,
surface.texture().clone(),

View file

@ -160,7 +160,7 @@ pub struct Pinnacle {
pub outputs: IndexMap<Output, Option<GlobalId>>,
#[cfg(feature = "snowcap")]
pub snowcap_shutdown_ping: Option<smithay::reexports::calloop::ping::Ping>,
pub snowcap_stop_signal: Option<snowcap::StopSignal>,
#[cfg(feature = "snowcap")]
pub snowcap_join_handle: Option<tokio::task::JoinHandle<()>>,
@ -381,7 +381,7 @@ impl Pinnacle {
outputs: IndexMap::new(),
#[cfg(feature = "snowcap")]
snowcap_shutdown_ping: None,
snowcap_stop_signal: None,
#[cfg(feature = "snowcap")]
snowcap_join_handle: None,
@ -423,8 +423,8 @@ impl Pinnacle {
}
#[cfg(feature = "snowcap")]
if let Some(snowcap_shutdown_ping) = self.snowcap_shutdown_ping.take() {
snowcap_shutdown_ping.ping();
if let Some(stop_signal) = self.snowcap_stop_signal.take() {
stop_signal.stop();
}
}
}