1
0
Fork 0
forked from wry/wry

head-management: add jay-tearing-mode-info-v1 extension

This commit is contained in:
Julian Orth 2025-07-14 15:00:56 +02:00
parent 3e2707174e
commit a7f8a26df7
11 changed files with 107 additions and 11 deletions

View file

@ -17,7 +17,7 @@ use {
utils::{copyhashmap::CopyHashMap, hash_map_ext::HashMapExt, rc_eq::RcEq},
wire::JayHeadManagerSessionV1Id,
},
jay_config::video::{Transform, VrrMode},
jay_config::video::{TearingMode, Transform, VrrMode},
std::{
cell::{Cell, RefCell},
rc::Rc,
@ -87,6 +87,7 @@ pub struct HeadState {
pub vrr_mode: VrrMode,
pub tearing_enabled: bool,
pub tearing_active: bool,
pub tearing_mode: TearingMode,
pub format: &'static Format,
pub color_space: BackendColorSpace,
pub transfer_function: BackendTransferFunction,
@ -231,6 +232,7 @@ impl HeadManagers {
state.mode = n.global.mode.get();
state.transform = n.global.persistent.transform.get();
state.vrr_mode = n.global.persistent.vrr_mode.get().to_config();
state.tearing_mode = n.global.persistent.tearing_mode.get().to_config();
}
for head in self.managers.lock().values() {
skip_in_transaction!(head);
@ -270,6 +272,10 @@ impl HeadManagers {
ext.send_mode(state);
head.session.schedule_done();
}
if let Some(ext) = &head.ext.jay_tearing_mode_info_v1 {
ext.send_mode(state);
head.session.schedule_done();
}
}
}
@ -433,6 +439,18 @@ impl HeadManagers {
}
}
pub fn handle_tearing_mode_change(&self, tearing_mode: TearingMode) {
let state = &mut *self.state.borrow_mut();
state.tearing_mode = tearing_mode;
for head in self.managers.lock().values() {
skip_in_transaction!(head);
if let Some(ext) = &head.ext.jay_tearing_mode_info_v1 {
ext.send_mode(state);
head.session.schedule_done();
}
}
}
pub fn handle_format_change(&self, format: &'static Format) {
let state = &mut *self.state.borrow_mut();
state.format = format;