color-management: use more consistent naming
This commit is contained in:
parent
32db933242
commit
83e79b68e6
65 changed files with 439 additions and 510 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::BackendTransferFunction,
|
||||
backend::BackendEotfs,
|
||||
cmm::cmm_luminance::Luminance,
|
||||
ifs::head_management::HeadState,
|
||||
wire::{
|
||||
|
|
@ -27,7 +27,7 @@ impl HeadName {
|
|||
}
|
||||
|
||||
fn after_transaction(&self, shared: &HeadState, tran: &HeadState) {
|
||||
if shared.transfer_function != tran.transfer_function {
|
||||
if shared.eotf != tran.eotf {
|
||||
self.send_implied_default_brightness(shared);
|
||||
}
|
||||
if shared.brightness != tran.brightness {
|
||||
|
|
@ -36,14 +36,14 @@ impl HeadName {
|
|||
}
|
||||
|
||||
pub(in super::super) fn send_implied_default_brightness(&self, shared: &HeadState) {
|
||||
let lux = match shared.transfer_function {
|
||||
BackendTransferFunction::Default => shared
|
||||
let lux = match shared.eotf {
|
||||
BackendEotfs::Default => shared
|
||||
.monitor_info
|
||||
.as_ref()
|
||||
.and_then(|m| m.luminance.as_ref())
|
||||
.map(|l| l.max)
|
||||
.unwrap_or(Luminance::SRGB.white.0),
|
||||
BackendTransferFunction::Pq => Luminance::ST2084_PQ.white.0,
|
||||
BackendEotfs::Pq => Luminance::ST2084_PQ.white.0,
|
||||
};
|
||||
self.client.event(ImpliedDefaultBrightness {
|
||||
self_id: self.id,
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ impl HeadName {
|
|||
}
|
||||
|
||||
fn after_transaction(&self, shared: &HeadState, tran: &HeadState) {
|
||||
if (shared.color_space, shared.transfer_function)
|
||||
!= (tran.color_space, tran.transfer_function)
|
||||
{
|
||||
if (shared.color_space, shared.eotf) != (tran.color_space, tran.eotf) {
|
||||
self.send_state(shared);
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +40,7 @@ impl HeadName {
|
|||
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,
|
||||
eotf: state.eotf.to_drm() as u32,
|
||||
});
|
||||
self.client.event(Colorimetry {
|
||||
self_id: self.id,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{BackendColorSpace, BackendTransferFunction},
|
||||
backend::{BackendColorSpace, BackendEotfs},
|
||||
ifs::head_management::{HeadOp, HeadState},
|
||||
video::drm::{
|
||||
DRM_MODE_COLORIMETRY_BT2020_RGB, DRM_MODE_COLORIMETRY_DEFAULT, HDMI_EOTF_SMPTE_ST2084,
|
||||
|
|
@ -41,7 +41,7 @@ impl HeadName {
|
|||
return;
|
||||
};
|
||||
self.send_supported_eotf(HDMI_EOTF_TRADITIONAL_GAMMA_SDR);
|
||||
for tf in &mi.transfer_functions {
|
||||
for tf in &mi.eotfs {
|
||||
self.send_supported_eotf(tf.to_drm());
|
||||
}
|
||||
self.send_supported_colorimetry(DRM_MODE_COLORIMETRY_DEFAULT);
|
||||
|
|
@ -80,20 +80,20 @@ impl JayHeadExtDrmColorSpaceSetterV1RequestHandler for HeadName {
|
|||
const DEFAULT: u32 = HDMI_EOTF_TRADITIONAL_GAMMA_SDR as u32;
|
||||
const PQ: u32 = HDMI_EOTF_SMPTE_ST2084 as u32;
|
||||
let eotf = match req.eotf {
|
||||
DEFAULT => BackendTransferFunction::Default,
|
||||
PQ => BackendTransferFunction::Pq,
|
||||
DEFAULT => BackendEotfs::Default,
|
||||
PQ => BackendEotfs::Pq,
|
||||
_ => return Err(ErrorName::UnknownEotf(req.eotf)),
|
||||
};
|
||||
if eotf != BackendTransferFunction::Default {
|
||||
if eotf != BackendEotfs::Default {
|
||||
let state = &*self.common.transaction_state.borrow();
|
||||
let Some(mi) = &state.monitor_info else {
|
||||
return Err(ErrorName::UnsupportedEotf(req.eotf));
|
||||
};
|
||||
if mi.transfer_functions.not_contains(&eotf) {
|
||||
if mi.eotfs.not_contains(&eotf) {
|
||||
return Err(ErrorName::UnsupportedEotf(req.eotf));
|
||||
}
|
||||
}
|
||||
self.common.push_op(HeadOp::SetTransferFunction(eotf))?;
|
||||
self.common.push_op(HeadOp::SetEotf(eotf))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ impl JayHeadManagerSessionV1 {
|
|||
new.non_desktop_override = desired.override_non_desktop;
|
||||
new.format = desired.format;
|
||||
new.color_space = desired.color_space;
|
||||
new.transfer_function = desired.transfer_function;
|
||||
new.eotf = desired.eotf;
|
||||
if old == new {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -447,8 +447,8 @@ impl JayHeadManagerSessionV1RequestHandler for JayHeadManagerSessionV1 {
|
|||
state.format = f;
|
||||
to_send |= FORMAT_INFO;
|
||||
}
|
||||
HeadOp::SetTransferFunction(e) => {
|
||||
state.transfer_function = e;
|
||||
HeadOp::SetEotf(e) => {
|
||||
state.eotf = e;
|
||||
to_send |= DRM_COLOR_SPACE_INFO;
|
||||
to_send |= BRIGHTNESS_INFO;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue