1
0
Fork 0
forked from wry/wry

wp-presentation: implement version 2

This commit is contained in:
Julian Orth 2024-09-25 16:25:20 +02:00
parent de47705a32
commit 03dce4af06
8 changed files with 51 additions and 16 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

@ -55,7 +55,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,
},
leaks::Tracker,
@ -2135,6 +2135,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);
@ -2144,6 +2145,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 {