1
0
Fork 0
forked from wry/wry

all: syncobj is one word

This commit is contained in:
Julian Orth 2026-03-02 15:56:14 +01:00
parent 949ff558fd
commit 7a891a6131
20 changed files with 199 additions and 199 deletions

View file

@ -90,7 +90,7 @@ use {
},
video::{
dmabuf::DMA_BUF_SYNC_READ,
drm::sync_obj::{SyncObj, SyncObjPoint},
drm::syncobj::{Syncobj, SyncobjPoint},
},
wire::{
WlOutputId, WlSurfaceId, WpColorManagementSurfaceFeedbackV1Id, ZwpIdleInhibitorV1Id,
@ -217,7 +217,7 @@ pub struct SurfaceBuffer {
pub buffer: AttachedBuffer,
sync_files: SmallMap<BufferResvUser, SyncFile, 1>,
pub release_sync: ReleaseSync,
release: Option<SyncObjRelease>,
release: Option<SyncobjRelease>,
_surface_release: SmallVec<[SurfaceRelease; 1]>,
}
@ -303,7 +303,7 @@ pub struct WlSurface {
pub has_content_type_manager: Cell<bool>,
pub content_type: Cell<Option<ContentType>>,
pub drm_feedback: CopyHashMap<ZwpLinuxDmabufFeedbackV1Id, Rc<ZwpLinuxDmabufFeedbackV1>>,
sync_obj_surface: CloneCell<Option<Rc<WpLinuxDrmSyncobjSurfaceV1>>>,
syncobj_surface: CloneCell<Option<Rc<WpLinuxDrmSyncobjSurfaceV1>>>,
destroyed: Cell<bool>,
commit_timeline: CommitTimeline,
alpha_modifier: CloneCell<Option<Rc<WpAlphaModifierSurfaceV1>>>,
@ -452,8 +452,8 @@ struct PendingState {
xdg_surface: Option<Box<PendingXdgSurfaceData>>,
layer_surface: Option<Box<PendingLayerSurfaceData>>,
subsurfaces: AHashMap<SubsurfaceId, AttachedSubsurfaceState>,
acquire_point: Option<(Rc<SyncObj>, SyncObjPoint)>,
release_point: Option<SyncObjRelease>,
acquire_point: Option<(Rc<Syncobj>, SyncobjPoint)>,
release_point: Option<SyncobjRelease>,
alpha_multiplier: Option<Option<f32>>,
explicit_sync: bool,
fifo_barrier_set: bool,
@ -652,7 +652,7 @@ impl WlSurface {
has_content_type_manager: Default::default(),
content_type: Default::default(),
drm_feedback: Default::default(),
sync_obj_surface: Default::default(),
syncobj_surface: Default::default(),
destroyed: Cell::new(false),
commit_timeline: client.commit_timelines.create_timeline(),
alpha_modifier: Default::default(),
@ -1541,7 +1541,7 @@ impl WlSurface {
}
fn verify_explicit_sync(&self, pending: &mut PendingState) -> Result<(), WlSurfaceError> {
pending.explicit_sync = self.sync_obj_surface.is_some();
pending.explicit_sync = self.syncobj_surface.is_some();
if !pending.explicit_sync {
return Ok(());
}
@ -2255,47 +2255,47 @@ impl Drop for FrameRequest {
}
}
pub struct SyncObjRelease {
pub struct SyncobjRelease {
state: Rc<State>,
committed: bool,
syncobj: Option<Rc<SyncObj>>,
point: SyncObjPoint,
syncobj: Option<Rc<Syncobj>>,
point: SyncobjPoint,
}
impl SyncObjRelease {
impl SyncobjRelease {
fn signal(&mut self, sync_files: Option<&SmallVec<[(BufferResvUser, SyncFile); 1]>>) {
if !self.committed {
return;
}
let Some(sync_obj) = self.syncobj.take() else {
let Some(syncobj) = self.syncobj.take() else {
return;
};
let Some(ctx) = self.state.render_ctx.get() else {
log::error!("Cannot signal release point because there is no render context");
return;
};
let Some(ctx) = ctx.sync_obj_ctx() else {
let Some(ctx) = ctx.syncobj_ctx() else {
log::error!("Cannot signal release point because there is no syncobj context");
return;
};
if let Some(sync_files) = sync_files
&& sync_files.is_not_empty()
{
let res = ctx.import_sync_files(&sync_obj, self.point, sync_files.iter().map(|f| &f.1));
let res = ctx.import_sync_files(&syncobj, self.point, sync_files.iter().map(|f| &f.1));
match res {
Ok(_) => return,
Err(e) => {
log::error!("Could not import sync files into sync obj: {}", ErrorFmt(e));
log::error!("Could not import sync files into syncobj: {}", ErrorFmt(e));
}
}
}
if let Err(e) = ctx.signal(&sync_obj, self.point) {
if let Err(e) = ctx.signal(&syncobj, self.point) {
log::error!("Could not signal release point: {}", ErrorFmt(e));
}
}
}
impl Drop for SyncObjRelease {
impl Drop for SyncobjRelease {
fn drop(&mut self) {
self.signal(None);
}

View file

@ -22,8 +22,8 @@ use {
},
video::drm::{
DrmError,
sync_obj::{SyncObj, SyncObjPoint},
wait_for_sync_obj::{SyncObjWaiter, WaitForSyncObj, WaitForSyncObjHandle},
syncobj::{Syncobj, SyncobjPoint},
wait_for_syncobj::{SyncobjWaiter, WaitForSyncobj, WaitForSyncobjHandle},
},
},
isnt::std_1::{primitive::IsntSliceExt, vec::IsntVecExt},
@ -45,7 +45,7 @@ linear_ids!(CommitTimelineIds, CommitTimelineId, u64);
pub struct CommitTimelines {
next_id: CommitTimelineIds,
wfs: Rc<WaitForSyncObj>,
wfs: Rc<WaitForSyncobj>,
ring: Rc<IoUring>,
depth: NumCell<usize>,
gc: CopyHashMap<CommitTimelineId, LinkedList<Entry>>,
@ -113,7 +113,7 @@ pub enum CommitTimelineError {
impl CommitTimelines {
pub fn new(
wfs: &Rc<WaitForSyncObj>,
wfs: &Rc<WaitForSyncobj>,
ring: &Rc<IoUring>,
eng: &Rc<AsyncEngine>,
client: &Weak<Client>,
@ -238,7 +238,7 @@ impl CommitTimeline {
EntryKind::Commit(Commit {
surface: surface.clone(),
pending: RefCell::new(mem::take(pending)),
sync_obj: NumCell::new(points.len()),
syncobj: NumCell::new(points.len()),
wait_handles: Cell::new(Default::default()),
pending_uploads: NumCell::new(pending_uploads),
shm_upload: RefCell::new(ShmUploadState::None),
@ -256,11 +256,11 @@ impl CommitTimeline {
};
if points.is_not_empty() {
let mut wait_handles = SmallVec::new();
for (sync_obj, point) in points {
for (syncobj, point) in points {
let handle = self
.shared
.wfs
.wait(&sync_obj, point, true, noderef.clone())
.wait(&syncobj, point, true, noderef.clone())
.map_err(CommitTimelineError::RegisterWait)?;
wait_handles.push(handle);
}
@ -336,7 +336,7 @@ impl CommitTimeline {
}
}
impl SyncObjWaiter for NodeRef<Entry> {
impl SyncobjWaiter for NodeRef<Entry> {
fn done(self: Rc<Self>, result: Result<(), DrmError>) {
let EntryKind::Commit(commit) = &self.kind else {
unreachable!();
@ -345,7 +345,7 @@ impl SyncObjWaiter for NodeRef<Entry> {
commit.surface.client.error(CommitTimelineError::Wait(e));
return;
}
commit.sync_obj.fetch_sub(1);
commit.syncobj.fetch_sub(1);
flush_commit(&self, commit);
}
}
@ -440,8 +440,8 @@ enum CommitTimesState {
struct Commit {
surface: Rc<WlSurface>,
pending: RefCell<Box<PendingState>>,
sync_obj: NumCell<usize>,
wait_handles: Cell<SmallVec<[WaitForSyncObjHandle; 1]>>,
syncobj: NumCell<usize>,
wait_handles: Cell<SmallVec<[WaitForSyncobjHandle; 1]>>,
pending_uploads: NumCell<usize>,
shm_upload: RefCell<ShmUploadState>,
num_pending_polls: NumCell<usize>,
@ -471,7 +471,7 @@ impl NodeRef<Entry> {
match &self.kind {
EntryKind::Commit(c) => {
let mut has_unmet_dependencies = false;
let may_access_buffer = c.sync_obj.get() == 0 && c.num_pending_polls.get() == 0;
let may_access_buffer = c.syncobj.get() == 0 && c.num_pending_polls.get() == 0;
if may_access_buffer {
if c.pending_uploads.get() > 0 {
check_shm_uploads(c)?;
@ -687,7 +687,7 @@ fn schedule_async_upload(
.map_err(WlSurfaceError::PrepareAsyncUpload)
}
type Point = (Rc<SyncObj>, SyncObjPoint);
type Point = (Rc<Syncobj>, SyncobjPoint);
struct CommitDataCollector {
acquire_points: SmallVec<[Point; 1]>,

View file

@ -1,10 +1,10 @@
use {
crate::{
client::{Client, ClientError},
ifs::wl_surface::{SyncObjRelease, WlSurface},
ifs::wl_surface::{SyncobjRelease, WlSurface},
leaks::Tracker,
object::{Object, Version},
video::drm::sync_obj::SyncObjPoint,
video::drm::syncobj::SyncobjPoint,
wire::{WpLinuxDrmSyncobjSurfaceV1Id, wp_linux_drm_syncobj_surface_v1::*},
},
std::rc::Rc,
@ -36,10 +36,10 @@ impl WpLinuxDrmSyncobjSurfaceV1 {
}
pub fn install(self: &Rc<Self>) -> Result<(), WpLinuxDrmSyncobjSurfaceV1Error> {
if self.surface.sync_obj_surface.is_some() {
if self.surface.syncobj_surface.is_some() {
return Err(WpLinuxDrmSyncobjSurfaceV1Error::Exists);
}
self.surface.sync_obj_surface.set(Some(self.clone()));
self.surface.syncobj_surface.set(Some(self.clone()));
Ok(())
}
}
@ -48,7 +48,7 @@ impl WpLinuxDrmSyncobjSurfaceV1RequestHandler for WpLinuxDrmSyncobjSurfaceV1 {
type Error = WpLinuxDrmSyncobjSurfaceV1Error;
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
self.surface.sync_obj_surface.take();
self.surface.syncobj_surface.take();
let pending = &mut *self.surface.pending.borrow_mut();
pending.release_point.take();
pending.acquire_point.take();
@ -57,19 +57,19 @@ impl WpLinuxDrmSyncobjSurfaceV1RequestHandler for WpLinuxDrmSyncobjSurfaceV1 {
}
fn set_acquire_point(&self, req: SetAcquirePoint, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let point = SyncObjPoint(req.point);
let point = SyncobjPoint(req.point);
let timeline = self.client.lookup(req.timeline)?;
self.surface.pending.borrow_mut().acquire_point = Some((timeline.sync_obj.clone(), point));
self.surface.pending.borrow_mut().acquire_point = Some((timeline.syncobj.clone(), point));
Ok(())
}
fn set_release_point(&self, req: SetReleasePoint, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let point = SyncObjPoint(req.point);
let point = SyncobjPoint(req.point);
let timeline = self.client.lookup(req.timeline)?;
self.surface.pending.borrow_mut().release_point = Some(SyncObjRelease {
self.surface.pending.borrow_mut().release_point = Some(SyncobjRelease {
state: self.client.state.clone(),
committed: false,
syncobj: Some(timeline.sync_obj.clone()),
syncobj: Some(timeline.syncobj.clone()),
point,
});
Ok(())

View file

@ -11,7 +11,7 @@ use {
leaks::Tracker,
object::{Object, Version},
state::State,
video::drm::sync_obj::SyncObj,
video::drm::syncobj::Syncobj,
wire::{WpLinuxDrmSyncobjManagerV1Id, wp_linux_drm_syncobj_manager_v1::*},
},
std::rc::Rc,
@ -97,11 +97,11 @@ impl WpLinuxDrmSyncobjManagerV1RequestHandler for WpLinuxDrmSyncobjManagerV1 {
}
fn import_timeline(&self, req: ImportTimeline, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let sync_obj = Rc::new(SyncObj::new(&req.fd));
let syncobj = Rc::new(Syncobj::new(&req.fd));
let sync = Rc::new(WpLinuxDrmSyncobjTimelineV1::new(
req.id,
&self.client,
&sync_obj,
&syncobj,
self.version,
));
track!(self.client, sync);

View file

@ -3,7 +3,7 @@ use {
client::{Client, ClientError},
leaks::Tracker,
object::{Object, Version},
video::drm::sync_obj::SyncObj,
video::drm::syncobj::Syncobj,
wire::{WpLinuxDrmSyncobjTimelineV1Id, wp_linux_drm_syncobj_timeline_v1::*},
},
std::rc::Rc,
@ -13,7 +13,7 @@ use {
pub struct WpLinuxDrmSyncobjTimelineV1 {
id: WpLinuxDrmSyncobjTimelineV1Id,
client: Rc<Client>,
pub sync_obj: Rc<SyncObj>,
pub syncobj: Rc<Syncobj>,
pub tracker: Tracker<Self>,
version: Version,
}
@ -22,14 +22,14 @@ impl WpLinuxDrmSyncobjTimelineV1 {
pub fn new(
id: WpLinuxDrmSyncobjTimelineV1Id,
client: &Rc<Client>,
sync_obj: &Rc<SyncObj>,
syncobj: &Rc<Syncobj>,
version: Version,
) -> Self {
Self {
id,
client: client.clone(),
tracker: Default::default(),
sync_obj: sync_obj.clone(),
syncobj: syncobj.clone(),
version,
}
}