1
0
Fork 0
forked from wry/wry

config: allow disabling direct scanout

This commit is contained in:
Julian Orth 2024-02-18 20:44:56 +01:00
parent da84e9ec27
commit 114c293950
9 changed files with 63 additions and 1 deletions

View file

@ -511,6 +511,10 @@ impl Client {
self.send(&ClientMessage::SetGfxApi { device, api });
}
pub fn set_direct_scanout_enabled(&self, device: Option<DrmDevice>, enabled: bool) {
self.send(&ClientMessage::SetDirectScanoutEnabled { device, enabled });
}
pub fn connector_connected(&self, connector: Connector) -> bool {
let res = self.send_with_response(&ClientMessage::ConnectorConnected { connector });
get_response!(res, false, ConnectorConnected { connected });

View file

@ -338,6 +338,10 @@ pub enum ClientMessage<'a> {
device: Option<DrmDevice>,
api: GfxApi,
},
SetDirectScanoutEnabled {
device: Option<DrmDevice>,
enabled: bool,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -369,6 +369,11 @@ impl DrmDevice {
pub fn set_gfx_api(self, gfx_api: GfxApi) {
get!().set_gfx_api(Some(self), gfx_api);
}
/// Enables or disables direct scanout of client surfaces for this device.
pub fn set_direct_scanout_enabled(self, enabled: bool) {
get!().set_direct_scanout_enabled(Some(self), enabled);
}
}
/// A graphics API.
@ -389,3 +394,12 @@ pub enum GfxApi {
pub fn set_gfx_api(gfx_api: GfxApi) {
get!().set_gfx_api(None, gfx_api);
}
/// Enables or disables direct scanout of client surfaces.
///
/// The default is `true`.
///
/// This setting can be overwritten per-device with [DrmDevice::set_direct_scanout_enabled].
pub fn set_direct_scanout_enabled(enabled: bool) {
get!().set_direct_scanout_enabled(None, enabled);
}