color-management: use more consistent naming
This commit is contained in:
parent
32db933242
commit
83e79b68e6
65 changed files with 439 additions and 510 deletions
|
|
@ -2,9 +2,9 @@ use {
|
|||
crate::{
|
||||
client::{Client, ClientError},
|
||||
cmm::{
|
||||
cmm_eotf::Eotf,
|
||||
cmm_luminance::{Luminance, TargetLuminance},
|
||||
cmm_primaries::{NamedPrimaries, Primaries},
|
||||
cmm_transfer_function::TransferFunction,
|
||||
},
|
||||
ifs::color_management::{
|
||||
MIN_LUM_MUL_INV, PRIMARIES_MUL_INV,
|
||||
|
|
@ -40,7 +40,7 @@ pub struct WpImageDescriptionCreatorParamsV1 {
|
|||
pub client: Rc<Client>,
|
||||
pub version: Version,
|
||||
pub tracker: Tracker<Self>,
|
||||
pub tf: Cell<Option<TransferFunction>>,
|
||||
pub tf: Cell<Option<Eotf>>,
|
||||
pub primaries: Cell<Option<(Option<NamedPrimaries>, Primaries)>>,
|
||||
pub luminance: Cell<Option<Luminance>>,
|
||||
pub mastering_primaries: Cell<Option<Primaries>>,
|
||||
|
|
@ -53,19 +53,19 @@ impl WpImageDescriptionCreatorParamsV1RequestHandler for WpImageDescriptionCreat
|
|||
type Error = WpImageDescriptionCreatorParamsV1Error;
|
||||
|
||||
fn create(&self, req: Create, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let Some(transfer_function) = self.tf.get() else {
|
||||
let Some(eotf) = self.tf.get() else {
|
||||
return Err(WpImageDescriptionCreatorParamsV1Error::TfNotSet);
|
||||
};
|
||||
let Some((named_primaries, primaries)) = self.primaries.get() else {
|
||||
return Err(WpImageDescriptionCreatorParamsV1Error::PrimariesNotSet);
|
||||
};
|
||||
let default_luminance = match transfer_function {
|
||||
TransferFunction::Bt1886 => Luminance::BT1886,
|
||||
TransferFunction::St2084Pq => Luminance::ST2084_PQ,
|
||||
let default_luminance = match eotf {
|
||||
Eotf::Bt1886 => Luminance::BT1886,
|
||||
Eotf::St2084Pq => Luminance::ST2084_PQ,
|
||||
_ => Luminance::SRGB,
|
||||
};
|
||||
let mut luminance = self.luminance.get().unwrap_or(default_luminance);
|
||||
if transfer_function == TransferFunction::St2084Pq {
|
||||
if eotf == Eotf::St2084Pq {
|
||||
luminance.max.0 = luminance.min.0 + 10_000.0;
|
||||
}
|
||||
if luminance.max.0 <= luminance.min.0 || luminance.white.0 <= luminance.min.0 {
|
||||
|
|
@ -80,7 +80,7 @@ impl WpImageDescriptionCreatorParamsV1RequestHandler for WpImageDescriptionCreat
|
|||
named_primaries,
|
||||
primaries,
|
||||
luminance,
|
||||
transfer_function,
|
||||
eotf,
|
||||
target_primaries,
|
||||
target_luminance,
|
||||
self.max_cll.get(),
|
||||
|
|
@ -102,17 +102,17 @@ impl WpImageDescriptionCreatorParamsV1RequestHandler for WpImageDescriptionCreat
|
|||
|
||||
fn set_tf_named(&self, req: SetTfNamed, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let tf = match req.tf {
|
||||
TRANSFER_FUNCTION_BT1886 => TransferFunction::Bt1886,
|
||||
TRANSFER_FUNCTION_GAMMA22 => TransferFunction::Gamma22,
|
||||
TRANSFER_FUNCTION_GAMMA28 => TransferFunction::Gamma28,
|
||||
TRANSFER_FUNCTION_ST240 => TransferFunction::St240,
|
||||
TRANSFER_FUNCTION_EXT_LINEAR => TransferFunction::Linear,
|
||||
TRANSFER_FUNCTION_LOG_100 => TransferFunction::Log100,
|
||||
TRANSFER_FUNCTION_LOG_316 => TransferFunction::Log316,
|
||||
TRANSFER_FUNCTION_SRGB => TransferFunction::Gamma22,
|
||||
TRANSFER_FUNCTION_EXT_SRGB => TransferFunction::Gamma22,
|
||||
TRANSFER_FUNCTION_ST2084_PQ => TransferFunction::St2084Pq,
|
||||
TRANSFER_FUNCTION_ST428 => TransferFunction::St428,
|
||||
TRANSFER_FUNCTION_BT1886 => Eotf::Bt1886,
|
||||
TRANSFER_FUNCTION_GAMMA22 => Eotf::Gamma22,
|
||||
TRANSFER_FUNCTION_GAMMA28 => Eotf::Gamma28,
|
||||
TRANSFER_FUNCTION_ST240 => Eotf::St240,
|
||||
TRANSFER_FUNCTION_EXT_LINEAR => Eotf::Linear,
|
||||
TRANSFER_FUNCTION_LOG_100 => Eotf::Log100,
|
||||
TRANSFER_FUNCTION_LOG_316 => Eotf::Log316,
|
||||
TRANSFER_FUNCTION_SRGB => Eotf::Gamma22,
|
||||
TRANSFER_FUNCTION_EXT_SRGB => Eotf::Gamma22,
|
||||
TRANSFER_FUNCTION_ST2084_PQ => Eotf::St2084Pq,
|
||||
TRANSFER_FUNCTION_ST428 => Eotf::St428,
|
||||
_ => {
|
||||
return Err(WpImageDescriptionCreatorParamsV1Error::UnsupportedTf(
|
||||
req.tf,
|
||||
|
|
@ -261,9 +261,9 @@ pub enum WpImageDescriptionCreatorParamsV1Error {
|
|||
UnsupportedPrimaries(u32),
|
||||
#[error("set_tf_power is not supported")]
|
||||
SetTfPowerNotSupported,
|
||||
#[error("{} is not a supported named transfer function", .0)]
|
||||
#[error("{} is not a supported named EOTF", .0)]
|
||||
UnsupportedTf(u32),
|
||||
#[error("The transfer function has already been set")]
|
||||
#[error("The EOTF has already been set")]
|
||||
TfAlreadySet,
|
||||
#[error("The primaries have already been set")]
|
||||
PrimariesAlreadySet,
|
||||
|
|
@ -271,7 +271,7 @@ pub enum WpImageDescriptionCreatorParamsV1Error {
|
|||
LuminancesAlreadySet,
|
||||
#[error("The minimum luminance is too low")]
|
||||
MinLuminanceTooLow,
|
||||
#[error("The transfer function was not set")]
|
||||
#[error("The EOTF was not set")]
|
||||
TfNotSet,
|
||||
#[error("The primaries were not set")]
|
||||
PrimariesNotSet,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
use {
|
||||
crate::{
|
||||
client::Client,
|
||||
cmm::{
|
||||
cmm_description::ColorDescription, cmm_primaries::NamedPrimaries,
|
||||
cmm_transfer_function::TransferFunction,
|
||||
},
|
||||
cmm::{cmm_description::ColorDescription, cmm_eotf::Eotf, cmm_primaries::NamedPrimaries},
|
||||
ifs::color_management::{
|
||||
MIN_LUM_MUL, PRIMARIES_ADOBE_RGB, PRIMARIES_BT2020, PRIMARIES_CIE1931_XYZ,
|
||||
PRIMARIES_DCI_P3, PRIMARIES_DISPLAY_P3, PRIMARIES_GENERIC_FILM, PRIMARIES_MUL,
|
||||
|
|
@ -31,16 +28,16 @@ pub struct WpImageDescriptionInfoV1 {
|
|||
|
||||
impl WpImageDescriptionInfoV1 {
|
||||
pub fn send_description(&self, d: &ColorDescription) {
|
||||
let tf = match d.transfer_function {
|
||||
TransferFunction::Linear => TRANSFER_FUNCTION_EXT_LINEAR,
|
||||
TransferFunction::St2084Pq => TRANSFER_FUNCTION_ST2084_PQ,
|
||||
TransferFunction::Bt1886 => TRANSFER_FUNCTION_BT1886,
|
||||
TransferFunction::Gamma22 => TRANSFER_FUNCTION_GAMMA22,
|
||||
TransferFunction::Gamma28 => TRANSFER_FUNCTION_GAMMA28,
|
||||
TransferFunction::St240 => TRANSFER_FUNCTION_ST240,
|
||||
TransferFunction::Log100 => TRANSFER_FUNCTION_LOG_100,
|
||||
TransferFunction::Log316 => TRANSFER_FUNCTION_LOG_316,
|
||||
TransferFunction::St428 => TRANSFER_FUNCTION_ST428,
|
||||
let tf = match d.eotf {
|
||||
Eotf::Linear => TRANSFER_FUNCTION_EXT_LINEAR,
|
||||
Eotf::St2084Pq => TRANSFER_FUNCTION_ST2084_PQ,
|
||||
Eotf::Bt1886 => TRANSFER_FUNCTION_BT1886,
|
||||
Eotf::Gamma22 => TRANSFER_FUNCTION_GAMMA22,
|
||||
Eotf::Gamma28 => TRANSFER_FUNCTION_GAMMA28,
|
||||
Eotf::St240 => TRANSFER_FUNCTION_ST240,
|
||||
Eotf::Log100 => TRANSFER_FUNCTION_LOG_100,
|
||||
Eotf::Log316 => TRANSFER_FUNCTION_LOG_316,
|
||||
Eotf::St428 => TRANSFER_FUNCTION_ST428,
|
||||
};
|
||||
self.send_primaries(&d.linear.primaries);
|
||||
if let Some(n) = d.named_primaries {
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ impl ExtImageCopyCaptureFrameV1 {
|
|||
aq,
|
||||
re,
|
||||
jay_config::video::Transform::None,
|
||||
self.client.state.color_manager.srgb_srgb(),
|
||||
self.client.state.color_manager.srgb_gamma22(),
|
||||
on.global.pos.get(),
|
||||
render_hardware_cursors,
|
||||
x_off,
|
||||
|
|
@ -235,7 +235,7 @@ impl ExtImageCopyCaptureFrameV1 {
|
|||
fb.render_node(
|
||||
aq,
|
||||
re,
|
||||
self.client.state.color_manager.srgb_srgb(),
|
||||
self.client.state.color_manager.srgb_gamma22(),
|
||||
node,
|
||||
&self.client.state,
|
||||
Some(node.node_absolute_position()),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{
|
||||
BackendColorSpace, BackendTransferFunction, ConnectorId, Mode, MonitorInfo,
|
||||
BackendColorSpace, BackendEotfs, ConnectorId, Mode, MonitorInfo,
|
||||
transaction::BackendConnectorTransactionError,
|
||||
},
|
||||
client::ClientId,
|
||||
|
|
@ -90,7 +90,7 @@ pub struct HeadState {
|
|||
pub tearing_mode: TearingMode,
|
||||
pub format: &'static Format,
|
||||
pub color_space: BackendColorSpace,
|
||||
pub transfer_function: BackendTransferFunction,
|
||||
pub eotf: BackendEotfs,
|
||||
pub supported_formats: RcEq<Vec<&'static Format>>,
|
||||
pub brightness: Option<f64>,
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ enum HeadOp {
|
|||
SetVrrMode(VrrMode),
|
||||
SetTearingMode(TearingMode),
|
||||
SetFormat(&'static Format),
|
||||
SetTransferFunction(BackendTransferFunction),
|
||||
SetEotf(BackendEotfs),
|
||||
SetColorSpace(BackendColorSpace),
|
||||
SetBrightness(Option<f64>),
|
||||
}
|
||||
|
|
@ -491,14 +491,10 @@ impl HeadManagers {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_colors_change(
|
||||
&self,
|
||||
color_space: BackendColorSpace,
|
||||
transfer_function: BackendTransferFunction,
|
||||
) {
|
||||
pub fn handle_colors_change(&self, color_space: BackendColorSpace, eotf: BackendEotfs) {
|
||||
let state = &mut *self.state.borrow_mut();
|
||||
state.color_space = color_space;
|
||||
state.transfer_function = transfer_function;
|
||||
state.eotf = eotf;
|
||||
for head in self.managers.lock().values() {
|
||||
skip_in_transaction!(head);
|
||||
if let Some(ext) = &head.ext.drm_color_space_info_v1 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{CAP_JAY_COMPOSITOR, Client, ClientCaps, ClientError},
|
||||
cmm::cmm_transfer_function::TransferFunction,
|
||||
cmm::cmm_eotf::Eotf,
|
||||
globals::{Global, GlobalName},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
|
|
@ -97,7 +97,7 @@ impl JayDamageTrackingRequestHandler for JayDamageTracking {
|
|||
req: SetVisualizerColor,
|
||||
_slf: &Rc<Self>,
|
||||
) -> Result<(), Self::Error> {
|
||||
let color = Color::new(TransferFunction::Gamma22, req.r, req.g, req.b) * req.a;
|
||||
let color = Color::new(Eotf::Gamma22, req.r, req.g, req.b) * req.a;
|
||||
self.client.state.damage_visualizer.set_color(color);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{self, BackendColorSpace, BackendTransferFunction},
|
||||
backend::{self, BackendColorSpace, BackendEotfs},
|
||||
client::{Client, ClientError},
|
||||
compositor::MAX_EXTENTS,
|
||||
format::named_formats,
|
||||
|
|
@ -170,15 +170,15 @@ impl JayRandr {
|
|||
});
|
||||
}
|
||||
if self.version >= COLORIMETRY_SINCE {
|
||||
for tf in &node.global.transfer_functions {
|
||||
self.client.event(SupportedTransferFunction {
|
||||
for eotf in &node.global.eotfs {
|
||||
self.client.event(SupportedEotf {
|
||||
self_id: self.id,
|
||||
transfer_function: tf.name(),
|
||||
eotf: eotf.name(),
|
||||
});
|
||||
}
|
||||
self.client.event(CurrentTransferFunction {
|
||||
self.client.event(CurrentEotf {
|
||||
self_id: self.id,
|
||||
transfer_function: node.global.btf.get().name(),
|
||||
eotf: node.global.btf.get().name(),
|
||||
});
|
||||
for cs in &node.global.color_spaces {
|
||||
self.client.event(SupportedColorSpace {
|
||||
|
|
@ -484,21 +484,19 @@ impl JayRandrRequestHandler for JayRandr {
|
|||
));
|
||||
};
|
||||
let tf = 'tf: {
|
||||
for tf in BackendTransferFunction::variants() {
|
||||
if tf.name() == req.transfer_function {
|
||||
for tf in BackendEotfs::variants() {
|
||||
if tf.name() == req.eotf {
|
||||
break 'tf tf;
|
||||
}
|
||||
}
|
||||
return Err(JayRandrError::UnknownTransferFunction(
|
||||
req.transfer_function.to_string(),
|
||||
));
|
||||
return Err(JayRandrError::UnknownEotf(req.eotf.to_string()));
|
||||
};
|
||||
let Some(c) = self.get_connector(req.output) else {
|
||||
return Ok(());
|
||||
};
|
||||
let res = c.modify_state(&self.state, |s| {
|
||||
s.color_space = cs;
|
||||
s.transfer_function = tf;
|
||||
s.eotf = tf;
|
||||
});
|
||||
if let Err(e) = res {
|
||||
self.send_error(&format!(
|
||||
|
|
@ -551,7 +549,7 @@ pub enum JayRandrError {
|
|||
UnknownFormat(String),
|
||||
#[error("Unknown color space {0}")]
|
||||
UnknownColorSpace(String),
|
||||
#[error("Unknown transfer function {0}")]
|
||||
UnknownTransferFunction(String),
|
||||
#[error("Unknown EOTF {0}")]
|
||||
UnknownEotf(String),
|
||||
}
|
||||
efrom!(JayRandrError, ClientError);
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ impl JayScreencast {
|
|||
let res = buffer.fb.render_node(
|
||||
AcquireSync::Implicit,
|
||||
ReleaseSync::Implicit,
|
||||
self.client.state.color_manager.srgb_srgb(),
|
||||
self.client.state.color_manager.srgb_gamma22(),
|
||||
&*tl,
|
||||
&self.client.state,
|
||||
Some(tl.node_absolute_position()),
|
||||
|
|
@ -341,7 +341,7 @@ impl JayScreencast {
|
|||
AcquireSync::Implicit,
|
||||
ReleaseSync::Implicit,
|
||||
Transform::None,
|
||||
self.client.state.color_manager.srgb_srgb(),
|
||||
self.client.state.color_manager.srgb_gamma22(),
|
||||
on.global.pos.get(),
|
||||
render_hardware_cursors,
|
||||
x_off,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ mod removed_output;
|
|||
|
||||
use {
|
||||
crate::{
|
||||
backend::{self, BackendColorSpace, BackendLuminance, BackendTransferFunction},
|
||||
backend::{self, BackendColorSpace, BackendEotfs, BackendLuminance},
|
||||
client::{Client, ClientError, ClientId},
|
||||
cmm::{
|
||||
cmm_description::ColorDescription,
|
||||
cmm_eotf::Eotf,
|
||||
cmm_luminance::Luminance,
|
||||
cmm_primaries::{NamedPrimaries, Primaries},
|
||||
cmm_transfer_function::TransferFunction,
|
||||
},
|
||||
damage::DamageMatrix,
|
||||
format::{Format, XRGB8888},
|
||||
|
|
@ -76,7 +76,7 @@ pub struct WlOutputGlobal {
|
|||
pub format: Cell<&'static Format>,
|
||||
pub width_mm: i32,
|
||||
pub height_mm: i32,
|
||||
pub transfer_functions: Vec<BackendTransferFunction>,
|
||||
pub eotfs: Vec<BackendEotfs>,
|
||||
pub color_spaces: Vec<BackendColorSpace>,
|
||||
pub primaries: Primaries,
|
||||
pub luminance: Option<BackendLuminance>,
|
||||
|
|
@ -86,7 +86,7 @@ pub struct WlOutputGlobal {
|
|||
pub persistent: Rc<PersistentOutputState>,
|
||||
pub opt: Rc<OutputGlobalOpt>,
|
||||
pub damage_matrix: Cell<DamageMatrix>,
|
||||
pub btf: Cell<BackendTransferFunction>,
|
||||
pub btf: Cell<BackendEotfs>,
|
||||
pub bcs: Cell<BackendColorSpace>,
|
||||
pub color_description: CloneCell<Rc<ColorDescription>>,
|
||||
pub linear_color_description: CloneCell<Rc<ColorDescription>>,
|
||||
|
|
@ -179,7 +179,7 @@ impl WlOutputGlobal {
|
|||
height_mm: i32,
|
||||
output_id: &Rc<OutputId>,
|
||||
persistent_state: &Rc<PersistentOutputState>,
|
||||
transfer_functions: Vec<BackendTransferFunction>,
|
||||
eotfs: Vec<BackendEotfs>,
|
||||
color_spaces: Vec<BackendColorSpace>,
|
||||
primaries: Primaries,
|
||||
luminance: Option<BackendLuminance>,
|
||||
|
|
@ -205,7 +205,7 @@ impl WlOutputGlobal {
|
|||
format: Cell::new(XRGB8888),
|
||||
width_mm,
|
||||
height_mm,
|
||||
transfer_functions,
|
||||
eotfs,
|
||||
color_spaces,
|
||||
primaries,
|
||||
luminance,
|
||||
|
|
@ -215,9 +215,9 @@ impl WlOutputGlobal {
|
|||
persistent: persistent_state.clone(),
|
||||
opt: Default::default(),
|
||||
damage_matrix: Default::default(),
|
||||
btf: Cell::new(connector_state.transfer_function),
|
||||
btf: Cell::new(connector_state.eotf),
|
||||
bcs: Cell::new(connector_state.color_space),
|
||||
color_description: CloneCell::new(state.color_manager.srgb_srgb().clone()),
|
||||
color_description: CloneCell::new(state.color_manager.srgb_gamma22().clone()),
|
||||
linear_color_description: CloneCell::new(state.color_manager.srgb_linear().clone()),
|
||||
color_description_listeners: Default::default(),
|
||||
};
|
||||
|
|
@ -345,7 +345,7 @@ impl WlOutputGlobal {
|
|||
pub fn update_color_description(&self) -> bool {
|
||||
let mut luminance = Luminance::SRGB;
|
||||
let tf = match self.btf.get() {
|
||||
BackendTransferFunction::Default => {
|
||||
BackendEotfs::Default => {
|
||||
if let Some(brightness) = self.persistent.brightness.get() {
|
||||
let output_max = match self.luminance {
|
||||
None => 80.0,
|
||||
|
|
@ -353,14 +353,14 @@ impl WlOutputGlobal {
|
|||
};
|
||||
luminance.white.0 = luminance.max.0 * brightness / output_max;
|
||||
}
|
||||
TransferFunction::Gamma22
|
||||
Eotf::Gamma22
|
||||
}
|
||||
BackendTransferFunction::Pq => {
|
||||
BackendEotfs::Pq => {
|
||||
luminance = Luminance::ST2084_PQ;
|
||||
if let Some(brightness) = self.persistent.brightness.get() {
|
||||
luminance.white.0 = brightness;
|
||||
}
|
||||
TransferFunction::St2084Pq
|
||||
Eotf::St2084Pq
|
||||
}
|
||||
};
|
||||
let mut target_luminance = luminance.to_target();
|
||||
|
|
@ -386,10 +386,7 @@ impl WlOutputGlobal {
|
|||
max_cll,
|
||||
max_fall,
|
||||
);
|
||||
let cd_linear = self
|
||||
.state
|
||||
.color_manager
|
||||
.get_with_tf(&cd, TransferFunction::Linear);
|
||||
let cd_linear = self.state.color_manager.get_with_tf(&cd, Eotf::Linear);
|
||||
self.linear_color_description.set(cd_linear.clone());
|
||||
self.color_description.set(cd.clone()).id != cd.id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1723,7 +1723,7 @@ impl WlSurface {
|
|||
pub fn color_description(&self) -> Rc<ColorDescription> {
|
||||
match self.color_description.get() {
|
||||
Some(cd) => cd,
|
||||
None => self.client.state.color_manager.srgb_srgb().clone(),
|
||||
None => self.client.state.color_manager.srgb_gamma22().clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue