1
0
Fork 0
forked from wry/wry

cmm: enable using the display primaries in SDR mode

This commit is contained in:
Julian Orth 2025-12-04 17:08:05 +01:00
parent 2b7b3b5310
commit 67760e270e
19 changed files with 259 additions and 21 deletions

View file

@ -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! {