1
0
Fork 0
forked from wry/wry

head-management: add drm-color-space-info-v1 extension

This commit is contained in:
Julian Orth 2025-07-14 11:03:34 +02:00
parent 1195613fc6
commit 6647b93e1e
9 changed files with 117 additions and 1 deletions

View file

@ -402,4 +402,5 @@ declare_extensions! {
vrr_state_v1: VrrStateV1,
tearing_state_v1: TearingStateV1,
format_info_v1: FormatInfoV1,
drm_color_space_info_v1: DrmColorSpaceInfoV1,
}

View file

@ -5,6 +5,7 @@ pub(super) mod jay_head_ext_compositor_space_scaler_v1;
pub(super) mod jay_head_ext_compositor_space_transformer_v1;
pub(super) mod jay_head_ext_connector_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_format_info_v1;
pub(super) mod jay_head_ext_mode_info_v1;
pub(super) mod jay_head_ext_mode_setter_v1;

View file

@ -0,0 +1,66 @@
use {
crate::{
backend::CONCAP_CONNECTOR,
ifs::head_management::{HeadCommon, HeadState},
state::ConnectorData,
wire::{
jay_head_ext_drm_color_space_info_v1::{
Colorimetry, HdmiEotf, JayHeadExtDrmColorSpaceInfoV1RequestHandler,
},
jay_head_manager_ext_drm_color_space_info_v1::JayHeadManagerExtDrmColorSpaceInfoV1RequestHandler,
},
},
std::rc::Rc,
};
impl_drm_color_space_info_v1! {
version = 1,
filter = filter,
after_announce = after_announce,
after_transaction = after_transaction,
}
impl MgrName {
fn filter(&self, connector: &ConnectorData, _common: &Rc<HeadCommon>) -> bool {
connector.connector.caps().contains(CONCAP_CONNECTOR)
}
}
impl HeadName {
fn after_announce(&self, shared: &HeadState) {
self.send_state(shared);
}
fn after_transaction(&self, shared: &HeadState, tran: &HeadState) {
if (shared.color_space, shared.transfer_function)
!= (tran.color_space, tran.transfer_function)
{
self.send_state(shared);
}
}
pub(in super::super) fn send_state(&self, state: &HeadState) {
self.client.event(HdmiEotf {
self_id: self.id,
eotf: state.transfer_function.to_drm() as u32,
});
self.client.event(Colorimetry {
self_id: self.id,
colorimetry: state.color_space.to_drm() as u32,
});
}
}
impl JayHeadManagerExtDrmColorSpaceInfoV1RequestHandler for MgrName {
type Error = ErrorName;
mgr_common_req!();
}
impl JayHeadExtDrmColorSpaceInfoV1RequestHandler for HeadName {
type Error = ErrorName;
head_common_req!();
}
error!();