1
0
Fork 0
forked from wry/wry

video: allow configuring the output brightness

This commit is contained in:
Julian Orth 2025-04-21 15:41:52 +02:00
parent 7d0c9e2c3f
commit 27025a565c
19 changed files with 343 additions and 40 deletions

View file

@ -795,6 +795,13 @@ impl Client {
});
}
pub fn connector_set_brightness(&self, connector: Connector, brightness: Option<f64>) {
self.send(&ClientMessage::ConnectorSetBrightness {
connector,
brightness,
});
}
pub fn connector_get_scale(&self, connector: Connector) -> f64 {
let res = self.send_with_response(&ClientMessage::ConnectorGetScale { connector });
get_response!(res, 1.0, ConnectorGetScale { scale });

View file

@ -538,6 +538,10 @@ pub enum ClientMessage<'a> {
color_space: ColorSpace,
transfer_function: TransferFunction,
},
ConnectorSetBrightness {
connector: Connector,
brightness: Option<f64>,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -285,6 +285,22 @@ impl Connector {
pub fn set_colors(self, color_space: ColorSpace, transfer_function: TransferFunction) {
get!().connector_set_colors(self, color_space, transfer_function);
}
/// Sets the brightness of the output.
///
/// By default or when `brightness` is `None`, the brightness depends on the
/// transfer function:
///
/// - [`TransferFunction::DEFAULT`]: The maximum brightness of the output.
/// - [`TransferFunction::PQ`]: 203 cd/m^2.
///
/// This should only be used with the PQ transfer function. If the default transfer
/// function is used, you should instead calibrate the hardware directly.
///
/// This has no effect unless the vulkan renderer is used.
pub fn set_brightness(self, brightness: Option<f64>) {
get!().connector_set_brightness(self, brightness);
}
}
/// Returns all available DRM devices.