cmm: enable using the display primaries in SDR mode
This commit is contained in:
parent
2b7b3b5310
commit
67760e270e
19 changed files with 259 additions and 21 deletions
|
|
@ -79,7 +79,7 @@ impl Global for JayCompositorGlobal {
|
|||
}
|
||||
|
||||
fn version(&self) -> u32 {
|
||||
22
|
||||
23
|
||||
}
|
||||
|
||||
fn required_caps(&self) -> ClientCaps {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ const FLIP_MARGIN_SINCE: Version = Version(10);
|
|||
const COLORIMETRY_SINCE: Version = Version(15);
|
||||
const BRIGHTNESS_SINCE: Version = Version(16);
|
||||
const BLEND_SPACE_SINCE: Version = Version(21);
|
||||
const NATIVE_GAMUT_SINCE: Version = Version(23);
|
||||
|
||||
impl JayRandr {
|
||||
pub fn new(id: JayRandrId, client: &Rc<Client>, version: Version) -> Self {
|
||||
|
|
@ -215,6 +216,23 @@ impl JayRandr {
|
|||
blend_space: node.global.persistent.blend_space.get().name(),
|
||||
});
|
||||
}
|
||||
if self.version >= NATIVE_GAMUT_SINCE {
|
||||
let p = &node.global.primaries;
|
||||
self.client.event(NativeGamut {
|
||||
self_id: self.id,
|
||||
r_x: p.r.0.0,
|
||||
r_y: p.r.1.0,
|
||||
g_x: p.g.0.0,
|
||||
g_y: p.g.1.0,
|
||||
b_x: p.b.0.0,
|
||||
b_y: p.b.1.0,
|
||||
w_x: p.wp.0.0,
|
||||
w_y: p.wp.1.0,
|
||||
});
|
||||
if node.global.persistent.use_native_gamut.get() {
|
||||
self.client.event(UseNativeGamut { self_id: self.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn send_error(&self, msg: &str) {
|
||||
|
|
@ -551,6 +569,18 @@ impl JayRandrRequestHandler for JayRandr {
|
|||
c.set_blend_space(space);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_use_native_gamut(
|
||||
&self,
|
||||
req: SetUseNativeGamut<'_>,
|
||||
_slf: &Rc<Self>,
|
||||
) -> Result<(), Self::Error> {
|
||||
let Some(c) = self.get_output_node(req.output) else {
|
||||
return Ok(());
|
||||
};
|
||||
c.set_use_native_gamut(req.use_native_gamut != 0);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
object_base! {
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ pub struct PersistentOutputState {
|
|||
pub tearing_mode: Cell<&'static TearingMode>,
|
||||
pub brightness: Cell<Option<f64>>,
|
||||
pub blend_space: Cell<BlendSpace>,
|
||||
pub use_native_gamut: Cell<bool>,
|
||||
}
|
||||
|
||||
impl Default for PersistentOutputState {
|
||||
|
|
@ -153,6 +154,7 @@ impl Default for PersistentOutputState {
|
|||
tearing_mode: Cell::new(&TearingMode::Never),
|
||||
brightness: Default::default(),
|
||||
blend_space: Cell::new(BlendSpace::Srgb),
|
||||
use_native_gamut: Cell::new(false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -384,18 +386,25 @@ impl WlOutputGlobal {
|
|||
let target_primaries;
|
||||
match self.bcs.get() {
|
||||
BackendColorSpace::Default => {
|
||||
named_primaries = NamedPrimaries::Srgb;
|
||||
primaries = named_primaries.primaries();
|
||||
if self.persistent.use_native_gamut.get()
|
||||
&& self.primaries != NamedPrimaries::Srgb.primaries()
|
||||
{
|
||||
named_primaries = None;
|
||||
primaries = self.primaries;
|
||||
} else {
|
||||
named_primaries = Some(NamedPrimaries::Srgb);
|
||||
primaries = NamedPrimaries::Srgb.primaries();
|
||||
}
|
||||
target_primaries = primaries;
|
||||
}
|
||||
BackendColorSpace::Bt2020 => {
|
||||
named_primaries = NamedPrimaries::Bt2020;
|
||||
primaries = named_primaries.primaries();
|
||||
named_primaries = Some(NamedPrimaries::Bt2020);
|
||||
primaries = NamedPrimaries::Bt2020.primaries();
|
||||
target_primaries = self.primaries;
|
||||
}
|
||||
}
|
||||
let cd = self.state.color_manager.get_description(
|
||||
Some(named_primaries),
|
||||
named_primaries,
|
||||
primaries,
|
||||
luminance,
|
||||
tf,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue