1
0
Fork 0
forked from wry/wry

metal: make post_commit_margin configurable

This commit is contained in:
Julian Orth 2024-09-14 13:56:22 +02:00
parent 76b0f2f734
commit 02ece60909
24 changed files with 224 additions and 55 deletions

View file

@ -744,6 +744,10 @@ impl Client {
self.send(&ClientMessage::SetDirectScanoutEnabled { device, enabled });
}
pub fn set_flip_margin(&self, device: DrmDevice, margin: Duration) {
self.send(&ClientMessage::SetFlipMargin { device, margin });
}
pub fn connector_connected(&self, connector: Connector) -> bool {
let res = self.send_with_response(&ClientMessage::ConnectorConnected { connector });
get_response!(res, false, ConnectorConnected { connected });

View file

@ -513,6 +513,10 @@ pub enum ClientMessage<'a> {
connector: Connector,
format: Format,
},
SetFlipMargin {
device: DrmDevice,
margin: Duration,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -12,7 +12,7 @@ use {
_private::WireMode,
},
serde::{Deserialize, Serialize},
std::str::FromStr,
std::{str::FromStr, time::Duration},
};
/// The mode of a connector.
@ -504,6 +504,16 @@ impl DrmDevice {
pub fn set_direct_scanout_enabled(self, enabled: bool) {
get!().set_direct_scanout_enabled(Some(self), enabled);
}
/// Sets the flip margin of this device.
///
/// This is duration between the compositor initiating a page flip and the output's
/// vblank event. This determines the minimum input latency. The default is 1.5 ms.
///
/// Note that if the margin is too small, the compositor will dynamically increase it.
pub fn set_flip_margin(self, margin: Duration) {
get!().set_flip_margin(self, margin);
}
}
/// A graphics API.