head-management: add jay-tearing-mode-info-v1 extension
This commit is contained in:
parent
3e2707174e
commit
a7f8a26df7
11 changed files with 107 additions and 11 deletions
|
|
@ -657,6 +657,7 @@ fn create_dummy_output(state: &Rc<State>) {
|
||||||
vrr_mode: VrrMode::Never.to_config(),
|
vrr_mode: VrrMode::Never.to_config(),
|
||||||
tearing_enabled: backend_state.tearing,
|
tearing_enabled: backend_state.tearing,
|
||||||
tearing_active: false,
|
tearing_active: false,
|
||||||
|
tearing_mode: TearingMode::Never.to_config(),
|
||||||
format: XRGB8888,
|
format: XRGB8888,
|
||||||
color_space: backend_state.color_space,
|
color_space: backend_state.color_space,
|
||||||
transfer_function: backend_state.transfer_function,
|
transfer_function: backend_state.transfer_function,
|
||||||
|
|
|
||||||
|
|
@ -1413,8 +1413,7 @@ impl ConfigProxyHandler {
|
||||||
match connector {
|
match connector {
|
||||||
Some(c) => {
|
Some(c) => {
|
||||||
let connector = self.get_output_node(c)?;
|
let connector = self.get_output_node(c)?;
|
||||||
connector.global.persistent.tearing_mode.set(mode);
|
connector.set_tearing_mode(mode);
|
||||||
connector.update_presentation_type();
|
|
||||||
}
|
}
|
||||||
_ => self.state.default_tearing_mode.set(mode),
|
_ => self.state.default_tearing_mode.set(mode),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use {
|
||||||
utils::{copyhashmap::CopyHashMap, hash_map_ext::HashMapExt, rc_eq::RcEq},
|
utils::{copyhashmap::CopyHashMap, hash_map_ext::HashMapExt, rc_eq::RcEq},
|
||||||
wire::JayHeadManagerSessionV1Id,
|
wire::JayHeadManagerSessionV1Id,
|
||||||
},
|
},
|
||||||
jay_config::video::{Transform, VrrMode},
|
jay_config::video::{TearingMode, Transform, VrrMode},
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
|
|
@ -87,6 +87,7 @@ pub struct HeadState {
|
||||||
pub vrr_mode: VrrMode,
|
pub vrr_mode: VrrMode,
|
||||||
pub tearing_enabled: bool,
|
pub tearing_enabled: bool,
|
||||||
pub tearing_active: bool,
|
pub tearing_active: bool,
|
||||||
|
pub tearing_mode: TearingMode,
|
||||||
pub format: &'static Format,
|
pub format: &'static Format,
|
||||||
pub color_space: BackendColorSpace,
|
pub color_space: BackendColorSpace,
|
||||||
pub transfer_function: BackendTransferFunction,
|
pub transfer_function: BackendTransferFunction,
|
||||||
|
|
@ -231,6 +232,7 @@ impl HeadManagers {
|
||||||
state.mode = n.global.mode.get();
|
state.mode = n.global.mode.get();
|
||||||
state.transform = n.global.persistent.transform.get();
|
state.transform = n.global.persistent.transform.get();
|
||||||
state.vrr_mode = n.global.persistent.vrr_mode.get().to_config();
|
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() {
|
for head in self.managers.lock().values() {
|
||||||
skip_in_transaction!(head);
|
skip_in_transaction!(head);
|
||||||
|
|
@ -270,6 +272,10 @@ impl HeadManagers {
|
||||||
ext.send_mode(state);
|
ext.send_mode(state);
|
||||||
head.session.schedule_done();
|
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) {
|
pub fn handle_format_change(&self, format: &'static Format) {
|
||||||
let state = &mut *self.state.borrow_mut();
|
let state = &mut *self.state.borrow_mut();
|
||||||
state.format = format;
|
state.format = format;
|
||||||
|
|
|
||||||
|
|
@ -405,4 +405,5 @@ declare_extensions! {
|
||||||
drm_color_space_info_v1: DrmColorSpaceInfoV1,
|
drm_color_space_info_v1: DrmColorSpaceInfoV1,
|
||||||
non_desktop_override_v1: NonDesktopOverrideV1,
|
non_desktop_override_v1: NonDesktopOverrideV1,
|
||||||
jay_vrr_mode_info_v1: JayVrrModeInfoV1,
|
jay_vrr_mode_info_v1: JayVrrModeInfoV1,
|
||||||
|
jay_tearing_mode_info_v1: JayTearingModeInfoV1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ pub(super) mod jay_head_ext_connector_info_v1;
|
||||||
pub(super) mod jay_head_ext_core_info_v1;
|
pub(super) mod jay_head_ext_core_info_v1;
|
||||||
pub(super) mod jay_head_ext_drm_color_space_info_v1;
|
pub(super) mod jay_head_ext_drm_color_space_info_v1;
|
||||||
pub(super) mod jay_head_ext_format_info_v1;
|
pub(super) mod jay_head_ext_format_info_v1;
|
||||||
|
pub(super) mod jay_head_ext_jay_tearing_mode_info_v1;
|
||||||
pub(super) mod jay_head_ext_jay_vrr_mode_info_v1;
|
pub(super) mod jay_head_ext_jay_vrr_mode_info_v1;
|
||||||
pub(super) mod jay_head_ext_mode_info_v1;
|
pub(super) mod jay_head_ext_mode_info_v1;
|
||||||
pub(super) mod jay_head_ext_mode_setter_v1;
|
pub(super) mod jay_head_ext_mode_setter_v1;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
use {
|
||||||
|
crate::{
|
||||||
|
ifs::head_management::HeadState,
|
||||||
|
wire::{
|
||||||
|
jay_head_ext_jay_tearing_mode_info_v1::{
|
||||||
|
JayHeadExtJayTearingModeInfoV1RequestHandler, Mode,
|
||||||
|
},
|
||||||
|
jay_head_manager_ext_jay_tearing_mode_info_v1::JayHeadManagerExtJayTearingModeInfoV1RequestHandler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
std::rc::Rc,
|
||||||
|
};
|
||||||
|
|
||||||
|
impl_jay_tearing_mode_info_v1! {
|
||||||
|
version = 1,
|
||||||
|
after_announce = after_announce,
|
||||||
|
after_transaction = after_transaction,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeadName {
|
||||||
|
fn after_announce(&self, shared: &HeadState) {
|
||||||
|
self.send_mode(shared);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn after_transaction(&self, shared: &HeadState, tran: &HeadState) {
|
||||||
|
if shared.tearing_mode != tran.tearing_mode {
|
||||||
|
self.send_mode(shared);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(in super::super) fn send_mode(&self, state: &HeadState) {
|
||||||
|
self.client.event(Mode {
|
||||||
|
self_id: self.id,
|
||||||
|
mode: state.tearing_mode.0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl JayHeadManagerExtJayTearingModeInfoV1RequestHandler for MgrName {
|
||||||
|
type Error = ErrorName;
|
||||||
|
|
||||||
|
mgr_common_req!();
|
||||||
|
}
|
||||||
|
|
||||||
|
impl JayHeadExtJayTearingModeInfoV1RequestHandler for HeadName {
|
||||||
|
type Error = ErrorName;
|
||||||
|
|
||||||
|
head_common_req!();
|
||||||
|
}
|
||||||
|
|
||||||
|
error!();
|
||||||
|
|
@ -446,8 +446,7 @@ impl JayRandrRequestHandler for JayRandr {
|
||||||
let Some(c) = self.get_output_node(req.output) else {
|
let Some(c) = self.get_output_node(req.output) else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
c.global.persistent.tearing_mode.set(mode);
|
c.set_tearing_mode(mode);
|
||||||
c.update_presentation_type();
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ pub fn handle(state: &Rc<State>, connector: &Rc<dyn Connector>) {
|
||||||
vrr_mode: Default::default(),
|
vrr_mode: Default::default(),
|
||||||
tearing_enabled: backend_state.tearing,
|
tearing_enabled: backend_state.tearing,
|
||||||
tearing_active: false,
|
tearing_active: false,
|
||||||
|
tearing_mode: Default::default(),
|
||||||
format: backend_state.format,
|
format: backend_state.format,
|
||||||
color_space: backend_state.color_space,
|
color_space: backend_state.color_space,
|
||||||
transfer_function: backend_state.transfer_function,
|
transfer_function: backend_state.transfer_function,
|
||||||
|
|
|
||||||
|
|
@ -1335,6 +1335,17 @@ impl OutputNode {
|
||||||
.handle_vrr_mode_change(mode.to_config());
|
.handle_vrr_mode_change(mode.to_config());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_tearing_mode(&self, mode: &'static TearingMode) {
|
||||||
|
let old = self.global.persistent.tearing_mode.replace(mode);
|
||||||
|
if old != mode {
|
||||||
|
self.update_presentation_type();
|
||||||
|
self.global
|
||||||
|
.connector
|
||||||
|
.head_managers
|
||||||
|
.handle_tearing_mode_change(mode.to_config());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct OutputTitle {
|
pub struct OutputTitle {
|
||||||
|
|
@ -1785,13 +1796,13 @@ impl TearingMode {
|
||||||
Some(res)
|
Some(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_config(&self) -> ConfigVrrMode {
|
pub fn to_config(&self) -> ConfigTearingMode {
|
||||||
match self {
|
match self {
|
||||||
Self::NEVER => ConfigVrrMode::NEVER,
|
Self::NEVER => ConfigTearingMode::NEVER,
|
||||||
Self::ALWAYS => ConfigVrrMode::ALWAYS,
|
Self::ALWAYS => ConfigTearingMode::ALWAYS,
|
||||||
Self::VARIANT_1 => ConfigVrrMode::VARIANT_1,
|
Self::VARIANT_1 => ConfigTearingMode::VARIANT_1,
|
||||||
Self::VARIANT_2 => ConfigVrrMode::VARIANT_2,
|
Self::VARIANT_2 => ConfigTearingMode::VARIANT_2,
|
||||||
Self::VARIANT_3 => ConfigVrrMode::VARIANT_3,
|
Self::VARIANT_3 => ConfigTearingMode::VARIANT_3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
wire/jay_head_ext_jay_tearing_mode_info_v1.txt
Normal file
7
wire/jay_head_ext_jay_tearing_mode_info_v1.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
request destroy (destructor) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
event mode {
|
||||||
|
mode: u32,
|
||||||
|
}
|
||||||
7
wire/jay_head_manager_ext_jay_tearing_mode_info_v1.txt
Normal file
7
wire/jay_head_manager_ext_jay_tearing_mode_info_v1.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
request destroy (destructor) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
event head {
|
||||||
|
head: id(jay_head_ext_jay_tearing_mode_info_v1) (new),
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue