Add linux-drm-syncobj-v1 protocol
This commit is contained in:
parent
005093b622
commit
9dddead15d
4 changed files with 73 additions and 1 deletions
|
|
@ -35,7 +35,11 @@ use smithay::{
|
|||
wayland_server::{Client, DisplayHandle},
|
||||
},
|
||||
utils::{Clock, DevPath, Monotonic, Size},
|
||||
wayland::{dmabuf::DmabufGlobal, relative_pointer::RelativePointerManagerState},
|
||||
wayland::{
|
||||
dmabuf::DmabufGlobal,
|
||||
drm_syncobj::{supports_syncobj_eventfd, DrmSyncobjState},
|
||||
relative_pointer::RelativePointerManagerState,
|
||||
},
|
||||
};
|
||||
use surface::GbmDrmOutput;
|
||||
use tracing::{error, info, trace, warn};
|
||||
|
|
@ -70,6 +74,8 @@ pub struct KmsState {
|
|||
|
||||
session: LibSeatSession,
|
||||
libinput: Libinput,
|
||||
|
||||
pub syncobj_state: Option<DrmSyncobjState>,
|
||||
}
|
||||
|
||||
pub fn init_backend(
|
||||
|
|
@ -136,6 +142,8 @@ pub fn init_backend(
|
|||
|
||||
session,
|
||||
libinput: libinput_context,
|
||||
|
||||
syncobj_state: None,
|
||||
});
|
||||
|
||||
// start x11
|
||||
|
|
@ -148,6 +156,23 @@ pub fn init_backend(
|
|||
}
|
||||
}
|
||||
|
||||
let kms = match &mut state.backend {
|
||||
BackendData::Kms(kms) => kms,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
if let Some(primary_node) = kms
|
||||
.primary_node
|
||||
.and_then(|node| node.node_with_type(NodeType::Primary).and_then(|x| x.ok()))
|
||||
{
|
||||
if let Some(device) = kms.drm_devices.get(&primary_node) {
|
||||
let import_device = device.drm.device().device_fd().clone();
|
||||
if supports_syncobj_eventfd(&import_device) {
|
||||
let syncobj_state = DrmSyncobjState::new::<State>(&dh, import_device);
|
||||
kms.syncobj_state = Some(syncobj_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue