metal: fix presentation-feedback parameters
This commit is contained in:
parent
a7408555be
commit
7786b55971
3 changed files with 22 additions and 4 deletions
|
|
@ -257,6 +257,8 @@ impl MetalConnector {
|
||||||
apply_change!(plane.crtc_w);
|
apply_change!(plane.crtc_w);
|
||||||
apply_change!(plane.crtc_h);
|
apply_change!(plane.crtc_h);
|
||||||
if let Some(fb) = present_fb {
|
if let Some(fb) = present_fb {
|
||||||
|
self.presentation_is_zero_copy
|
||||||
|
.set(fb.direct_scanout_data.is_some());
|
||||||
if fb.direct_scanout_data.is_none() {
|
if fb.direct_scanout_data.is_none() {
|
||||||
self.next_buffer.fetch_add(1);
|
self.next_buffer.fetch_add(1);
|
||||||
}
|
}
|
||||||
|
|
@ -404,9 +406,11 @@ impl MetalConnector {
|
||||||
if try_async_flip {
|
if try_async_flip {
|
||||||
res = changes.commit(FLAGS | DRM_MODE_PAGE_FLIP_ASYNC, 0);
|
res = changes.commit(FLAGS | DRM_MODE_PAGE_FLIP_ASYNC, 0);
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
|
self.presentation_is_sync.set(false);
|
||||||
break 'commit;
|
break 'commit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.presentation_is_sync.set(true);
|
||||||
res = changes.commit(FLAGS, 0);
|
res = changes.commit(FLAGS, 0);
|
||||||
}
|
}
|
||||||
res.map_err(MetalError::Commit)
|
res.map_err(MetalError::Commit)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use {
|
||||||
},
|
},
|
||||||
ifs::{
|
ifs::{
|
||||||
wl_output::OutputId,
|
wl_output::OutputId,
|
||||||
wp_presentation_feedback::{KIND_HW_COMPLETION, KIND_VSYNC},
|
wp_presentation_feedback::{KIND_HW_COMPLETION, KIND_VSYNC, KIND_ZERO_COPY},
|
||||||
},
|
},
|
||||||
state::State,
|
state::State,
|
||||||
udev::UdevDevice,
|
udev::UdevDevice,
|
||||||
|
|
@ -472,6 +472,8 @@ pub struct MetalConnector {
|
||||||
pub post_commit_margin_decay: GeometricDecay,
|
pub post_commit_margin_decay: GeometricDecay,
|
||||||
pub vblank_miss_sec: Cell<u32>,
|
pub vblank_miss_sec: Cell<u32>,
|
||||||
pub vblank_miss_this_sec: NumCell<u32>,
|
pub vblank_miss_this_sec: NumCell<u32>,
|
||||||
|
pub presentation_is_sync: Cell<bool>,
|
||||||
|
pub presentation_is_zero_copy: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for MetalConnector {
|
impl Debug for MetalConnector {
|
||||||
|
|
@ -1069,6 +1071,8 @@ fn create_connector(
|
||||||
post_commit_margin: Cell::new(DEFAULT_POST_COMMIT_MARGIN),
|
post_commit_margin: Cell::new(DEFAULT_POST_COMMIT_MARGIN),
|
||||||
vblank_miss_sec: Cell::new(0),
|
vblank_miss_sec: Cell::new(0),
|
||||||
vblank_miss_this_sec: Default::default(),
|
vblank_miss_this_sec: Default::default(),
|
||||||
|
presentation_is_sync: Cell::new(false),
|
||||||
|
presentation_is_zero_copy: Cell::new(false),
|
||||||
});
|
});
|
||||||
let futures = ConnectorFutures {
|
let futures = ConnectorFutures {
|
||||||
_present: backend
|
_present: backend
|
||||||
|
|
@ -1975,13 +1979,24 @@ impl MetalBackend {
|
||||||
.set(tv_sec as u64 * 1_000_000_000 + tv_usec as u64 * 1000 + dd.refresh as u64);
|
.set(tv_sec as u64 * 1_000_000_000 + tv_usec as u64 * 1000 + dd.refresh as u64);
|
||||||
{
|
{
|
||||||
let global = self.state.root.outputs.get(&connector.connector_id);
|
let global = self.state.root.outputs.get(&connector.connector_id);
|
||||||
|
let mut flags = KIND_HW_COMPLETION;
|
||||||
|
if connector.presentation_is_sync.get() {
|
||||||
|
flags |= KIND_VSYNC;
|
||||||
|
}
|
||||||
|
if connector.presentation_is_zero_copy.get() {
|
||||||
|
flags |= KIND_ZERO_COPY;
|
||||||
|
}
|
||||||
|
let refresh = match crtc.vrr_enabled.value.get() {
|
||||||
|
true => 0,
|
||||||
|
false => dd.refresh,
|
||||||
|
};
|
||||||
if let Some(g) = &global {
|
if let Some(g) = &global {
|
||||||
g.presented(
|
g.presented(
|
||||||
tv_sec as _,
|
tv_sec as _,
|
||||||
tv_usec * 1000,
|
tv_usec * 1000,
|
||||||
dd.refresh,
|
refresh,
|
||||||
connector.sequence.get(),
|
connector.sequence.get(),
|
||||||
KIND_VSYNC | KIND_HW_COMPLETION,
|
flags,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ pub const KIND_VSYNC: u32 = 0x1;
|
||||||
#[expect(dead_code)]
|
#[expect(dead_code)]
|
||||||
pub const KIND_HW_CLOCK: u32 = 0x2;
|
pub const KIND_HW_CLOCK: u32 = 0x2;
|
||||||
pub const KIND_HW_COMPLETION: u32 = 0x4;
|
pub const KIND_HW_COMPLETION: u32 = 0x4;
|
||||||
#[expect(dead_code)]
|
|
||||||
pub const KIND_ZERO_COPY: u32 = 0x8;
|
pub const KIND_ZERO_COPY: u32 = 0x8;
|
||||||
|
|
||||||
impl WpPresentationFeedback {
|
impl WpPresentationFeedback {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue