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

@ -70,7 +70,7 @@ impl Global for JayCompositorGlobal {
}
fn version(&self) -> u32 {
9
10
}
fn required_caps(&self) -> ClientCaps {

View file

@ -29,6 +29,7 @@ pub struct JayRandr {
const VRR_CAPABLE_SINCE: Version = Version(2);
const TEARING_SINCE: Version = Version(3);
const FORMAT_SINCE: Version = Version(8);
const FLIP_MARGIN_SINCE: Version = Version(10);
impl JayRandr {
pub fn new(id: JayRandrId, client: &Rc<Client>, version: Version) -> Self {
@ -144,6 +145,14 @@ impl JayRandr {
}
}
}
if self.version >= FLIP_MARGIN_SINCE {
if let Some(margin_ns) = node.flip_margin_ns.get() {
self.client.event(FlipMargin {
self_id: self.id,
margin_ns,
});
}
}
let current_mode = global.mode.get();
for mode in &global.modes {
self.client.event(Mode {
@ -395,6 +404,14 @@ impl JayRandrRequestHandler for JayRandr {
c.global.connector.connector.set_fb_format(format);
Ok(())
}
fn set_flip_margin(&self, req: SetFlipMargin<'_>, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let Some(dev) = self.get_device(req.dev) else {
return Ok(());
};
dev.dev.set_flip_margin(req.margin_ns);
Ok(())
}
}
object_base! {