Update drm and nix dependencies
This commit is contained in:
parent
888a9963ad
commit
e667df2da6
3 changed files with 17 additions and 18 deletions
|
|
@ -18,7 +18,7 @@ harness = false
|
|||
|
||||
[features]
|
||||
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-dlopen = ["wayland-sys/dlopen"]
|
||||
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]
|
||||
as-raw-xcb-connection = { version = "1.0.0", optional = true }
|
||||
bytemuck = { version = "1.12.3", optional = true }
|
||||
drm = { version = "0.9.0", default-features = false, optional = true }
|
||||
drm-sys = { version = "0.4.0", default-features = false, optional = true }
|
||||
drm = { version = "0.10.0", default-features = false, 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 }
|
||||
wayland-backend = { version = "0.3.0", features = ["client_system"], optional = true }
|
||||
wayland-client = { version = "0.31.0", optional = true }
|
||||
|
|
|
|||
18
src/kms.rs
18
src/kms.rs
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
use drm::buffer::{Buffer, DrmFourcc};
|
||||
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 raw_window_handle::{DrmDisplayHandle, DrmWindowHandle};
|
||||
|
|
@ -308,20 +310,18 @@ impl BufferImpl<'_> {
|
|||
.iter()
|
||||
.map(|&rect| {
|
||||
let err = || SoftBufferError::DamageOutOfRange { rect };
|
||||
Ok(drm_sys::drm_clip_rect {
|
||||
x1: rect.x.try_into().map_err(|_| err())?,
|
||||
y1: rect.y.try_into().map_err(|_| err())?,
|
||||
x2: rect
|
||||
.x
|
||||
Ok(ClipRect::new(
|
||||
rect.x.try_into().map_err(|_| err())?,
|
||||
rect.y.try_into().map_err(|_| err())?,
|
||||
rect.x
|
||||
.checked_add(rect.width.get())
|
||||
.and_then(|x| x.try_into().ok())
|
||||
.ok_or_else(err)?,
|
||||
y2: rect
|
||||
.y
|
||||
rect.y
|
||||
.checked_add(rect.height.get())
|
||||
.and_then(|y| y.try_into().ok())
|
||||
.ok_or_else(err)?,
|
||||
})
|
||||
))
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use memmap2::MmapMut;
|
|||
use std::{
|
||||
ffi::CStr,
|
||||
fs::File,
|
||||
os::unix::prelude::{AsFd, AsRawFd, FromRawFd},
|
||||
os::unix::prelude::{AsFd, AsRawFd},
|
||||
slice,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
|
|
@ -30,11 +30,11 @@ fn create_memfile() -> File {
|
|||
)
|
||||
.expect("Failed to create memfd to store buffer.");
|
||||
let _ = fcntl(
|
||||
fd,
|
||||
fd.as_raw_fd(),
|
||||
FcntlArg::F_ADD_SEALS(SealFlag::F_SEAL_SHRINK | SealFlag::F_SEAL_SEAL),
|
||||
)
|
||||
.expect("Failed to seal memfd.");
|
||||
unsafe { File::from_raw_fd(fd) }
|
||||
File::from(fd)
|
||||
}
|
||||
|
||||
#[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,
|
||||
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 _ = shm_unlink(name);
|
||||
return unsafe { File::from_raw_fd(fd) };
|
||||
return File::from(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue