Skip to content

Commit 98dc43a

Browse files
committed
Update drm, nix, and criterion dependencies
1 parent 888a996 commit 98dc43a

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ harness = false
1818

1919
[features]
2020
default = ["kms", "x11", "x11-dlopen", "wayland", "wayland-dlopen"]
21-
kms = ["bytemuck", "drm", "drm-sys", "nix"]
21+
kms = ["bytemuck", "drm", "nix"]
2222
wayland = ["wayland-backend", "wayland-client", "memmap2", "nix", "fastrand"]
2323
wayland-dlopen = ["wayland-sys/dlopen"]
2424
x11 = ["as-raw-xcb-connection", "bytemuck", "nix", "tiny-xlib", "x11rb"]
@@ -31,10 +31,9 @@ raw-window-handle = "0.5.0"
3131
[target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dependencies]
3232
as-raw-xcb-connection = { version = "1.0.0", optional = true }
3333
bytemuck = { version = "1.12.3", optional = true }
34-
drm = { version = "0.9.0", default-features = false, optional = true }
35-
drm-sys = { version = "0.4.0", default-features = false, optional = true }
34+
drm = { version = "0.10.0", default-features = false, optional = true }
3635
memmap2 = { version = "0.9.0", optional = true }
37-
nix = { version = "0.26.1", optional = true }
36+
nix = { version = "0.27.0", features = ["fs", "mman"], optional = true }
3837
tiny-xlib = { version = "0.2.1", optional = true }
3938
wayland-backend = { version = "0.3.0", features = ["client_system"], optional = true }
4039
wayland-client = { version = "0.31.0", optional = true }
@@ -80,7 +79,7 @@ cfg_aliases = "0.1.1"
8079

8180
[dev-dependencies]
8281
colorous = "1.0.12"
83-
criterion = { version = "0.4.0", default-features = false, features = ["cargo_bench_support"] }
82+
criterion = { version = "0.5.1", default-features = false, features = ["cargo_bench_support"] }
8483
instant = "0.1.12"
8584
winit = "0.28.1"
8685
winit-test = "0.1.0"

src/kms.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
55
use drm::buffer::{Buffer, DrmFourcc};
66
use drm::control::dumbbuffer::{DumbBuffer, DumbMapping};
7-
use drm::control::{connector, crtc, framebuffer, plane, Device as CtrlDevice, PageFlipFlags};
7+
use drm::control::{
8+
connector, crtc, framebuffer, plane, ClipRect, Device as CtrlDevice, PageFlipFlags,
9+
};
810
use drm::Device;
911

1012
use raw_window_handle::{DrmDisplayHandle, DrmWindowHandle};
@@ -308,20 +310,18 @@ impl BufferImpl<'_> {
308310
.iter()
309311
.map(|&rect| {
310312
let err = || SoftBufferError::DamageOutOfRange { rect };
311-
Ok(drm_sys::drm_clip_rect {
312-
x1: rect.x.try_into().map_err(|_| err())?,
313-
y1: rect.y.try_into().map_err(|_| err())?,
314-
x2: rect
315-
.x
313+
Ok(ClipRect::new(
314+
rect.x.try_into().map_err(|_| err())?,
315+
rect.y.try_into().map_err(|_| err())?,
316+
rect.x
316317
.checked_add(rect.width.get())
317318
.and_then(|x| x.try_into().ok())
318319
.ok_or_else(err)?,
319-
y2: rect
320-
.y
320+
rect.y
321321
.checked_add(rect.height.get())
322322
.and_then(|y| y.try_into().ok())
323323
.ok_or_else(err)?,
324-
})
324+
))
325325
})
326326
.collect::<Result<Vec<_>, _>>()?;
327327

src/wayland/buffer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use memmap2::MmapMut;
22
use std::{
33
ffi::CStr,
44
fs::File,
5-
os::unix::prelude::{AsFd, AsRawFd, FromRawFd},
5+
os::unix::prelude::{AsFd, AsRawFd},
66
slice,
77
sync::{
88
atomic::{AtomicBool, Ordering},
@@ -30,11 +30,11 @@ fn create_memfile() -> File {
3030
)
3131
.expect("Failed to create memfd to store buffer.");
3232
let _ = fcntl(
33-
fd,
33+
fd.as_raw_fd(),
3434
FcntlArg::F_ADD_SEALS(SealFlag::F_SEAL_SHRINK | SealFlag::F_SEAL_SEAL),
3535
)
3636
.expect("Failed to seal memfd.");
37-
unsafe { File::from_raw_fd(fd) }
37+
File::from(fd)
3838
}
3939

4040
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
@@ -64,10 +64,10 @@ fn create_memfile() -> File {
6464
OFlag::O_RDWR | OFlag::O_CREAT | OFlag::O_EXCL,
6565
Mode::S_IRWXU,
6666
);
67-
if fd != Err(Errno::EEXIST) {
67+
if !matches!(fd, Err(Errno::EEXIST)) {
6868
let fd = fd.expect("Failed to create POSIX shm to store buffer.");
6969
let _ = shm_unlink(name);
70-
return unsafe { File::from_raw_fd(fd) };
70+
return File::from(fd);
7171
}
7272
}
7373

0 commit comments

Comments
 (0)