output-configuration: Support cosmic-ext v2
This commit is contained in:
parent
80965a61b9
commit
81b9fb179b
9 changed files with 120 additions and 25 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::{
|
||||
config::{OutputConfig, OutputState},
|
||||
config::{AdaptiveSync, OutputConfig, OutputState},
|
||||
shell::Shell,
|
||||
utils::prelude::*,
|
||||
};
|
||||
|
|
@ -664,6 +664,10 @@ fn populate_modes(
|
|||
max_bpc,
|
||||
scale,
|
||||
transform,
|
||||
// Try opportunistic VRR by default,
|
||||
// if not supported this will be turned off on `resume`,
|
||||
// when we have the `Surface` to actually check for support.
|
||||
vrr: AdaptiveSync::Enabled,
|
||||
..std::mem::take(&mut *output_config)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -684,6 +684,9 @@ impl KmsState {
|
|||
|
||||
match surface.resume(drm_surface, gbm, cursor_size) {
|
||||
Ok(_) => {
|
||||
surface.output.set_adaptive_sync_support(
|
||||
surface.adaptive_sync_support().ok(),
|
||||
);
|
||||
if surface.use_adaptive_sync(vrr)? {
|
||||
surface.output.set_adaptive_sync(vrr);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -405,6 +405,14 @@ impl Surface {
|
|||
rx.recv().context("Surface thread died")?
|
||||
}
|
||||
|
||||
pub fn adaptive_sync_support(&self) -> Result<VrrSupport> {
|
||||
let (tx, rx) = std::sync::mpsc::sync_channel(1);
|
||||
let _ = self
|
||||
.thread_command
|
||||
.send(ThreadCommand::AdaptiveSyncAvailable(tx));
|
||||
rx.recv().context("Surface thread died")?
|
||||
}
|
||||
|
||||
pub fn use_adaptive_sync(&mut self, vrr: AdaptiveSync) -> Result<bool> {
|
||||
if vrr != AdaptiveSync::Disabled {
|
||||
let (tx, rx) = std::sync::mpsc::sync_channel(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue