1
0
Fork 0
forked from wry/wry

Merge pull request #275 from mahkoh/jorth/vsync-min-max

wp-presentation: implement version 2
This commit is contained in:
mahkoh 2024-10-12 10:00:28 +02:00 committed by GitHub
commit eb905c160f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 152 additions and 14 deletions

View file

@ -301,6 +301,7 @@ impl PresentationListener for ExtImageCopyCaptureSessionV1 {
_refresh: u32,
_seq: u64,
_flags: u32,
_vrr: bool,
) {
self.presentation_listener.detach();
let Some(frame) = self.frame.get() else {

View file

@ -59,7 +59,7 @@ use {
zwlr_layer_surface_v1::{PendingLayerSurfaceData, ZwlrLayerSurfaceV1Error},
},
wp_content_type_v1::ContentType,
wp_presentation_feedback::WpPresentationFeedback,
wp_presentation_feedback::{WpPresentationFeedback, VRR_REFRESH_SINCE},
zwp_linux_dmabuf_feedback_v1::ZwpLinuxDmabufFeedbackV1,
},
io_uring::IoUringError,
@ -2190,6 +2190,7 @@ impl PresentationListener for WlSurface {
refresh: u32,
seq: u64,
flags: u32,
vrr: bool,
) {
let bindings = output.global.bindings.borrow();
let bindings = bindings.get(&self.client.id);
@ -2199,6 +2200,10 @@ impl PresentationListener for WlSurface {
pf.send_sync_output(binding);
}
}
let mut refresh = refresh;
if vrr && pf.version < VRR_REFRESH_SINCE {
refresh = 0;
}
pf.send_presented(tv_sec, tv_nsec, refresh, seq, flags);
let _ = pf.client.remove_obj(&*pf);
}

View file

@ -48,7 +48,7 @@ impl Global for WpPresentationGlobal {
}
fn version(&self) -> u32 {
1
2
}
}

View file

@ -24,6 +24,8 @@ pub const KIND_HW_CLOCK: u32 = 0x2;
pub const KIND_HW_COMPLETION: u32 = 0x4;
pub const KIND_ZERO_COPY: u32 = 0x8;
pub const VRR_REFRESH_SINCE: Version = Version(2);
impl WpPresentationFeedback {
pub fn send_sync_output(&self, output: &WlOutput) {
self.client.event(SyncOutput {