config: allow disabling explicit-sync
This commit is contained in:
parent
aaf73d6fdc
commit
aa296a6aea
12 changed files with 58 additions and 2 deletions
|
|
@ -810,6 +810,10 @@ impl Client {
|
||||||
self.send(&ClientMessage::SetIdle { timeout })
|
self.send(&ClientMessage::SetIdle { timeout })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_explicit_sync_enabled(&self, enabled: bool) {
|
||||||
|
self.send(&ClientMessage::SetExplicitSyncEnabled { enabled })
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_seat(&self, device: InputDevice, seat: Seat) {
|
pub fn set_seat(&self, device: InputDevice, seat: Seat) {
|
||||||
self.send(&ClientMessage::SetSeat { device, seat })
|
self.send(&ClientMessage::SetSeat { device, seat })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -428,6 +428,9 @@ pub enum ClientMessage<'a> {
|
||||||
workspace: WorkspaceSource,
|
workspace: WorkspaceSource,
|
||||||
connector: Connector,
|
connector: Connector,
|
||||||
},
|
},
|
||||||
|
SetExplicitSyncEnabled {
|
||||||
|
enabled: bool,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
|
|
||||||
|
|
@ -222,3 +222,12 @@ pub fn workspaces() -> Vec<Workspace> {
|
||||||
pub fn set_idle(timeout: Option<Duration>) {
|
pub fn set_idle(timeout: Option<Duration>) {
|
||||||
get!().set_idle(timeout.unwrap_or_default())
|
get!().set_idle(timeout.unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Enables or disables explicit sync.
|
||||||
|
///
|
||||||
|
/// Calling this after the compositor has started has no effect.
|
||||||
|
///
|
||||||
|
/// The default is `true`.
|
||||||
|
pub fn set_explicit_sync_enabled(enabled: bool) {
|
||||||
|
get!().set_explicit_sync_enabled(enabled);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,7 @@ fn start_compositor2(
|
||||||
create_default_seat: Cell::new(true),
|
create_default_seat: Cell::new(true),
|
||||||
subsurface_ids: Default::default(),
|
subsurface_ids: Default::default(),
|
||||||
wait_for_sync_obj: Rc::new(WaitForSyncObj::new(&ring, &engine)),
|
wait_for_sync_obj: Rc::new(WaitForSyncObj::new(&ring, &engine)),
|
||||||
|
explicit_sync_enabled: Cell::new(true),
|
||||||
});
|
});
|
||||||
state.tracker.register(ClientId::from_raw(0));
|
state.tracker.register(ClientId::from_raw(0));
|
||||||
create_dummy_output(&state);
|
create_dummy_output(&state);
|
||||||
|
|
|
||||||
|
|
@ -800,6 +800,10 @@ impl ConfigProxyHandler {
|
||||||
self.state.idle.set_timeout(timeout);
|
self.state.idle.set_timeout(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_set_explicit_sync_enabled(&self, enabled: bool) {
|
||||||
|
self.state.explicit_sync_enabled.set(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_connector_connected(&self, connector: Connector) -> Result<(), CphError> {
|
fn handle_connector_connected(&self, connector: Connector) -> Result<(), CphError> {
|
||||||
let connector = self.get_connector(connector)?;
|
let connector = self.get_connector(connector)?;
|
||||||
self.respond(Response::ConnectorConnected {
|
self.respond(Response::ConnectorConnected {
|
||||||
|
|
@ -1725,6 +1729,9 @@ impl ConfigProxyHandler {
|
||||||
} => self
|
} => self
|
||||||
.handle_move_to_output(workspace, connector)
|
.handle_move_to_output(workspace, connector)
|
||||||
.wrn("move_to_output")?,
|
.wrn("move_to_output")?,
|
||||||
|
ClientMessage::SetExplicitSyncEnabled { enabled } => {
|
||||||
|
self.handle_set_explicit_sync_enabled(enabled)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ pub struct State {
|
||||||
pub create_default_seat: Cell<bool>,
|
pub create_default_seat: Cell<bool>,
|
||||||
pub subsurface_ids: SubsurfaceIds,
|
pub subsurface_ids: SubsurfaceIds,
|
||||||
pub wait_for_sync_obj: Rc<WaitForSyncObj>,
|
pub wait_for_sync_obj: Rc<WaitForSyncObj>,
|
||||||
|
pub explicit_sync_enabled: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Drop for State {
|
// impl Drop for State {
|
||||||
|
|
@ -450,7 +451,7 @@ impl State {
|
||||||
if !self.render_ctx_ever_initialized.replace(true) {
|
if !self.render_ctx_ever_initialized.replace(true) {
|
||||||
self.add_global(&Rc::new(WlDrmGlobal::new(self.globals.name())));
|
self.add_global(&Rc::new(WlDrmGlobal::new(self.globals.name())));
|
||||||
self.add_global(&Rc::new(ZwpLinuxDmabufV1Global::new(self.globals.name())));
|
self.add_global(&Rc::new(ZwpLinuxDmabufV1Global::new(self.globals.name())));
|
||||||
if ctx.sync_obj_ctx().supports_async_wait() {
|
if ctx.sync_obj_ctx().supports_async_wait() && self.explicit_sync_enabled.get() {
|
||||||
self.add_global(&Rc::new(WpLinuxDrmSyncobjManagerV1Global::new(
|
self.add_global(&Rc::new(WpLinuxDrmSyncobjManagerV1Global::new(
|
||||||
self.globals.name(),
|
self.globals.name(),
|
||||||
)));
|
)));
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,7 @@ pub struct Config {
|
||||||
pub render_device: Option<DrmDeviceMatch>,
|
pub render_device: Option<DrmDeviceMatch>,
|
||||||
pub inputs: Vec<Input>,
|
pub inputs: Vec<Input>,
|
||||||
pub idle: Option<Duration>,
|
pub idle: Option<Duration>,
|
||||||
|
pub explicit_sync_enabled: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ impl Parser for ConfigParser<'_> {
|
||||||
_,
|
_,
|
||||||
idle_val,
|
idle_val,
|
||||||
),
|
),
|
||||||
|
(explicit_sync,),
|
||||||
) = ext.extract((
|
) = ext.extract((
|
||||||
(
|
(
|
||||||
opt(val("keymap")),
|
opt(val("keymap")),
|
||||||
|
|
@ -120,6 +121,7 @@ impl Parser for ConfigParser<'_> {
|
||||||
opt(val("$schema")),
|
opt(val("$schema")),
|
||||||
opt(val("idle")),
|
opt(val("idle")),
|
||||||
),
|
),
|
||||||
|
(recover(opt(bol("explicit-sync"))),),
|
||||||
))?;
|
))?;
|
||||||
let mut keymap = None;
|
let mut keymap = None;
|
||||||
if let Some(value) = keymap_val {
|
if let Some(value) = keymap_val {
|
||||||
|
|
@ -271,6 +273,7 @@ impl Parser for ConfigParser<'_> {
|
||||||
gfx_api,
|
gfx_api,
|
||||||
drm_devices,
|
drm_devices,
|
||||||
direct_scanout_enabled: direct_scanout.despan(),
|
direct_scanout_enabled: direct_scanout.despan(),
|
||||||
|
explicit_sync_enabled: explicit_sync.despan(),
|
||||||
render_device,
|
render_device,
|
||||||
inputs,
|
inputs,
|
||||||
idle,
|
idle,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ use {
|
||||||
is_reload,
|
is_reload,
|
||||||
keyboard::{Keymap, ModifiedKeySym},
|
keyboard::{Keymap, ModifiedKeySym},
|
||||||
logging::set_log_level,
|
logging::set_log_level,
|
||||||
on_devices_enumerated, on_idle, quit, reload, set_default_workspace_capture, set_idle,
|
on_devices_enumerated, on_idle, quit, reload, set_default_workspace_capture,
|
||||||
|
set_explicit_sync_enabled, set_idle,
|
||||||
status::{set_i3bar_separator, set_status, set_status_command, unset_status_command},
|
status::{set_i3bar_separator, set_status, set_status_command, unset_status_command},
|
||||||
switch_to_vt,
|
switch_to_vt,
|
||||||
theme::{reset_colors, reset_font, reset_sizes, set_font},
|
theme::{reset_colors, reset_font, reset_sizes, set_font},
|
||||||
|
|
@ -789,6 +790,9 @@ fn load_config(initial_load: bool, persistent: &Rc<PersistentState>) {
|
||||||
if let Some(dse) = config.direct_scanout_enabled {
|
if let Some(dse) = config.direct_scanout_enabled {
|
||||||
set_direct_scanout_enabled(dse);
|
set_direct_scanout_enabled(dse);
|
||||||
}
|
}
|
||||||
|
if let Some(ese) = config.explicit_sync_enabled {
|
||||||
|
set_explicit_sync_enabled(ese);
|
||||||
|
}
|
||||||
on_new_drm_device({
|
on_new_drm_device({
|
||||||
let state = state.clone();
|
let state = state.clone();
|
||||||
move |d| {
|
move |d| {
|
||||||
|
|
|
||||||
|
|
@ -498,6 +498,10 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Configured whether the compositor attempts direct scanout.\n"
|
"description": "Configured whether the compositor attempts direct scanout.\n"
|
||||||
},
|
},
|
||||||
|
"explicit-sync": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Configures whether the compositor supports explicit sync.\n\nThis cannot be changed after the compositor has started.\n\nThe default is `true`.\n"
|
||||||
|
},
|
||||||
"render-device": {
|
"render-device": {
|
||||||
"description": "Selects the device to use for rendering in a system with multiple GPUs.\n\nThe first device that matches will be used.\n\n- Example:\n\n ```toml\n render-device.name = \"dedicated\"\n\n [[drm-devices]]\n name = \"dedicated\"\n match = { pci-vendor = 0x1002, pci-model = 0x73ff }\n ```\n",
|
"description": "Selects the device to use for rendering in a system with multiple GPUs.\n\nThe first device that matches will be used.\n\n- Example:\n\n ```toml\n render-device.name = \"dedicated\"\n\n [[drm-devices]]\n name = \"dedicated\"\n match = { pci-vendor = 0x1002, pci-model = 0x73ff }\n ```\n",
|
||||||
"$ref": "#/$defs/DrmDeviceMatch"
|
"$ref": "#/$defs/DrmDeviceMatch"
|
||||||
|
|
|
||||||
|
|
@ -887,6 +887,16 @@ The table has the following fields:
|
||||||
|
|
||||||
The value of this field should be a boolean.
|
The value of this field should be a boolean.
|
||||||
|
|
||||||
|
- `explicit-sync` (optional):
|
||||||
|
|
||||||
|
Configures whether the compositor supports explicit sync.
|
||||||
|
|
||||||
|
This cannot be changed after the compositor has started.
|
||||||
|
|
||||||
|
The default is `true`.
|
||||||
|
|
||||||
|
The value of this field should be a boolean.
|
||||||
|
|
||||||
- `render-device` (optional):
|
- `render-device` (optional):
|
||||||
|
|
||||||
Selects the device to use for rendering in a system with multiple GPUs.
|
Selects the device to use for rendering in a system with multiple GPUs.
|
||||||
|
|
|
||||||
|
|
@ -1875,6 +1875,15 @@ Config:
|
||||||
required: false
|
required: false
|
||||||
description: |
|
description: |
|
||||||
Configured whether the compositor attempts direct scanout.
|
Configured whether the compositor attempts direct scanout.
|
||||||
|
explicit-sync:
|
||||||
|
kind: boolean
|
||||||
|
required: false
|
||||||
|
description: |
|
||||||
|
Configures whether the compositor supports explicit sync.
|
||||||
|
|
||||||
|
This cannot be changed after the compositor has started.
|
||||||
|
|
||||||
|
The default is `true`.
|
||||||
render-device:
|
render-device:
|
||||||
ref: DrmDeviceMatch
|
ref: DrmDeviceMatch
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue