Merge pull request #163 from rust-windowing/update-deps

Update `drm`, `nix`, and `criterion` dependencies
This commit is contained in:
Ian Douglas Scott 2023-10-13 13:54:00 -07:00 committed by GitHub
commit ea81ff2078
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 18 deletions

View file

@ -18,7 +18,7 @@ harness = false
[features] [features]
default = ["kms", "x11", "x11-dlopen", "wayland", "wayland-dlopen"] default = ["kms", "x11", "x11-dlopen", "wayland", "wayland-dlopen"]
kms = ["bytemuck", "drm", "drm-sys", "nix"] kms = ["bytemuck", "drm", "nix"]
wayland = ["wayland-backend", "wayland-client", "memmap2", "nix", "fastrand"] wayland = ["wayland-backend", "wayland-client", "memmap2", "nix", "fastrand"]
wayland-dlopen = ["wayland-sys/dlopen"] wayland-dlopen = ["wayland-sys/dlopen"]
x11 = ["as-raw-xcb-connection", "bytemuck", "nix", "tiny-xlib", "x11rb"] x11 = ["as-raw-xcb-connection", "bytemuck", "nix", "tiny-xlib", "x11rb"]
@ -31,10 +31,9 @@ raw-window-handle = "0.5.0"
[target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dependencies] [target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dependencies]
as-raw-xcb-connection = { version = "1.0.0", optional = true } as-raw-xcb-connection = { version = "1.0.0", optional = true }
bytemuck = { version = "1.12.3", optional = true } bytemuck = { version = "1.12.3", optional = true }
drm = { version = "0.9.0", default-features = false, optional = true } drm = { version = "0.10.0", default-features = false, optional = true }
drm-sys = { version = "0.4.0", default-features = false, optional = true }
memmap2 = { version = "0.9.0", optional = true } memmap2 = { version = "0.9.0", optional = true }
nix = { version = "0.26.1", optional = true } nix = { version = "0.27.0", features = ["fs", "mman"], optional = true }
tiny-xlib = { version = "0.2.1", optional = true } tiny-xlib = { version = "0.2.1", optional = true }
wayland-backend = { version = "0.3.0", features = ["client_system"], optional = true } wayland-backend = { version = "0.3.0", features = ["client_system"], optional = true }
wayland-client = { version = "0.31.0", optional = true } wayland-client = { version = "0.31.0", optional = true }

View file

@ -4,7 +4,9 @@
use drm::buffer::{Buffer, DrmFourcc}; use drm::buffer::{Buffer, DrmFourcc};
use drm::control::dumbbuffer::{DumbBuffer, DumbMapping}; use drm::control::dumbbuffer::{DumbBuffer, DumbMapping};
use drm::control::{connector, crtc, framebuffer, plane, Device as CtrlDevice, PageFlipFlags}; use drm::control::{
connector, crtc, framebuffer, plane, ClipRect, Device as CtrlDevice, PageFlipFlags,
};
use drm::Device; use drm::Device;
use raw_window_handle::{DrmDisplayHandle, DrmWindowHandle}; use raw_window_handle::{DrmDisplayHandle, DrmWindowHandle};
@ -308,20 +310,18 @@ impl BufferImpl<'_> {
.iter() .iter()
.map(|&rect| { .map(|&rect| {
let err = || SoftBufferError::DamageOutOfRange { rect }; let err = || SoftBufferError::DamageOutOfRange { rect };
Ok(drm_sys::drm_clip_rect { Ok(ClipRect::new(
x1: rect.x.try_into().map_err(|_| err())?, rect.x.try_into().map_err(|_| err())?,
y1: rect.y.try_into().map_err(|_| err())?, rect.y.try_into().map_err(|_| err())?,
x2: rect rect.x
.x
.checked_add(rect.width.get()) .checked_add(rect.width.get())
.and_then(|x| x.try_into().ok()) .and_then(|x| x.try_into().ok())
.ok_or_else(err)?, .ok_or_else(err)?,
y2: rect rect.y
.y
.checked_add(rect.height.get()) .checked_add(rect.height.get())
.and_then(|y| y.try_into().ok()) .and_then(|y| y.try_into().ok())
.ok_or_else(err)?, .ok_or_else(err)?,
}) ))
}) })
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;

View file

@ -2,7 +2,7 @@ use memmap2::MmapMut;
use std::{ use std::{
ffi::CStr, ffi::CStr,
fs::File, fs::File,
os::unix::prelude::{AsFd, AsRawFd, FromRawFd}, os::unix::prelude::{AsFd, AsRawFd},
slice, slice,
sync::{ sync::{
atomic::{AtomicBool, Ordering}, atomic::{AtomicBool, Ordering},
@ -30,11 +30,11 @@ fn create_memfile() -> File {
) )
.expect("Failed to create memfd to store buffer."); .expect("Failed to create memfd to store buffer.");
let _ = fcntl( let _ = fcntl(
fd, fd.as_raw_fd(),
FcntlArg::F_ADD_SEALS(SealFlag::F_SEAL_SHRINK | SealFlag::F_SEAL_SEAL), FcntlArg::F_ADD_SEALS(SealFlag::F_SEAL_SHRINK | SealFlag::F_SEAL_SEAL),
) )
.expect("Failed to seal memfd."); .expect("Failed to seal memfd.");
unsafe { File::from_raw_fd(fd) } File::from(fd)
} }
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))] #[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
@ -64,10 +64,10 @@ fn create_memfile() -> File {
OFlag::O_RDWR | OFlag::O_CREAT | OFlag::O_EXCL, OFlag::O_RDWR | OFlag::O_CREAT | OFlag::O_EXCL,
Mode::S_IRWXU, Mode::S_IRWXU,
); );
if fd != Err(Errno::EEXIST) { if !matches!(fd, Err(Errno::EEXIST)) {
let fd = fd.expect("Failed to create POSIX shm to store buffer."); let fd = fd.expect("Failed to create POSIX shm to store buffer.");
let _ = shm_unlink(name); let _ = shm_unlink(name);
return unsafe { File::from_raw_fd(fd) }; return File::from(fd);
} }
} }