io-uring: add readable/writable
This commit is contained in:
parent
25d817b722
commit
dcdd91c0b0
31 changed files with 285 additions and 189 deletions
|
|
@ -1,6 +1,5 @@
|
|||
use {
|
||||
crate::{
|
||||
async_engine::FdStatus,
|
||||
backend::{AxisSource, InputEvent, KeyState, ScrollAxis},
|
||||
backends::metal::MetalBackend,
|
||||
fixed::Fixed,
|
||||
|
|
@ -12,9 +11,10 @@ use {
|
|||
},
|
||||
event::LibInputEvent,
|
||||
},
|
||||
utils::errorfmt::ErrorFmt,
|
||||
utils::{bitflags::BitflagsExt, errorfmt::ErrorFmt},
|
||||
},
|
||||
std::rc::Rc,
|
||||
uapi::c,
|
||||
};
|
||||
|
||||
macro_rules! unpack {
|
||||
|
|
@ -49,7 +49,7 @@ macro_rules! unpack {
|
|||
impl MetalBackend {
|
||||
pub async fn handle_libinput_events(self: Rc<Self>) {
|
||||
loop {
|
||||
match self.libinput_fd.readable().await {
|
||||
match self.state.ring.readable(&self.libinput_fd).await {
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Cannot wait for libinput fd to become readable: {}",
|
||||
|
|
@ -57,7 +57,7 @@ impl MetalBackend {
|
|||
);
|
||||
break;
|
||||
}
|
||||
Ok(FdStatus::Err) => {
|
||||
Ok(n) if n.intersects(c::POLLERR | c::POLLHUP) => {
|
||||
log::error!("libinput fd fd is in an error state");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use {
|
||||
crate::{
|
||||
async_engine::FdStatus,
|
||||
backend::BackendEvent,
|
||||
backends::metal::{
|
||||
video::{MetalDrmDevice, PendingDrmDevice},
|
||||
|
|
@ -8,7 +7,7 @@ use {
|
|||
},
|
||||
dbus::TRUE,
|
||||
udev::UdevDevice,
|
||||
utils::{errorfmt::ErrorFmt, nonblock::set_nonblock},
|
||||
utils::{bitflags::BitflagsExt, errorfmt::ErrorFmt, nonblock::set_nonblock},
|
||||
video::drm::DrmMaster,
|
||||
wire_dbus::org::freedesktop::login1::session::{PauseDevice, ResumeDevice},
|
||||
},
|
||||
|
|
@ -33,7 +32,7 @@ fn is_primary_node(n: &[u8]) -> bool {
|
|||
impl MetalBackend {
|
||||
pub async fn monitor_devices(self: Rc<Self>) {
|
||||
loop {
|
||||
match self.monitor_fd.readable().await {
|
||||
match self.state.ring.readable(&self.monitor_fd).await {
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Cannot wait for udev_monitor to become readable: {}",
|
||||
|
|
@ -41,7 +40,7 @@ impl MetalBackend {
|
|||
);
|
||||
break;
|
||||
}
|
||||
Ok(FdStatus::Err) => {
|
||||
Ok(n) if n.intersects(c::POLLERR | c::POLLHUP) => {
|
||||
log::error!("udev_monitor fd is in an error state");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
async_engine::{AsyncFd, Phase, SpawnedFuture},
|
||||
async_engine::{Phase, SpawnedFuture},
|
||||
backend::{
|
||||
BackendDrmDevice, BackendEvent, Connector, ConnectorEvent, ConnectorId,
|
||||
ConnectorKernelId, DrmDeviceId, MonitorInfo,
|
||||
|
|
@ -64,7 +64,6 @@ pub struct MetalDrmDeviceStatic {
|
|||
pub min_height: u32,
|
||||
pub max_height: u32,
|
||||
pub gbm: GbmDevice,
|
||||
pub async_fd: AsyncFd,
|
||||
pub handle_events: HandleEvents,
|
||||
}
|
||||
|
||||
|
|
@ -749,10 +748,6 @@ impl MetalBackend {
|
|||
Ok(g) => g,
|
||||
Err(e) => return Err(MetalError::GbmDevice(e)),
|
||||
};
|
||||
let async_fd = match self.state.eng.fd(master.fd()) {
|
||||
Ok(f) => f,
|
||||
Err(e) => return Err(MetalError::CreateAsyncFd(e)),
|
||||
};
|
||||
|
||||
let dev = Rc::new(MetalDrmDeviceStatic {
|
||||
id: pending.id,
|
||||
|
|
@ -767,7 +762,6 @@ impl MetalBackend {
|
|||
min_height: resources.min_height,
|
||||
max_height: resources.max_height,
|
||||
gbm,
|
||||
async_fd,
|
||||
handle_events: HandleEvents {
|
||||
handle_events: Cell::new(None),
|
||||
},
|
||||
|
|
@ -883,7 +877,7 @@ impl MetalBackend {
|
|||
|
||||
async fn handle_drm_events(self: Rc<Self>, dev: Rc<MetalDrmDevice>) {
|
||||
loop {
|
||||
if let Err(e) = dev.dev.async_fd.readable().await {
|
||||
if let Err(e) = self.state.ring.readable(dev.dev.master.fd()).await {
|
||||
log::error!("Could not register the DRM fd for reading: {}", ErrorFmt(e));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue