kms: Fix output mirroring not working across gpus
This commit is contained in:
parent
cc0bbb61e3
commit
7373567af1
1 changed files with 25 additions and 15 deletions
|
|
@ -561,17 +561,6 @@ impl KmsState {
|
||||||
// reconfigure existing
|
// reconfigure existing
|
||||||
for (crtc, surface) in device.surfaces.iter_mut() {
|
for (crtc, surface) in device.surfaces.iter_mut() {
|
||||||
let output_config = surface.output.config();
|
let output_config = surface.output.config();
|
||||||
let mirrored_output = if let OutputState::Mirroring(conn) = &output_config.enabled {
|
|
||||||
Some(
|
|
||||||
outputs
|
|
||||||
.iter()
|
|
||||||
.find(|output| &output.name() == conn)
|
|
||||||
.cloned()
|
|
||||||
.ok_or(anyhow::anyhow!("Unable to find mirroring output"))?,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let drm = &mut device.drm;
|
let drm = &mut device.drm;
|
||||||
let conn = surface.connector;
|
let conn = surface.connector;
|
||||||
|
|
@ -631,10 +620,6 @@ impl KmsState {
|
||||||
surface.set_mode(*mode);
|
surface.set_mode(*mode);
|
||||||
// TODO: .context("Failed to apply new mode")?;
|
// TODO: .context("Failed to apply new mode")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if mirrored_output != surface.output.mirroring() {
|
|
||||||
surface.set_mirroring(mirrored_output.clone());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -654,12 +639,37 @@ impl KmsState {
|
||||||
if output.mirroring().is_none() {
|
if output.mirroring().is_none() {
|
||||||
w += output.config().mode_size().w;
|
w += output.config().mode_size().w;
|
||||||
}
|
}
|
||||||
|
all_outputs.push(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
all_outputs.extend(outputs);
|
all_outputs.extend(outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we need to handle mirroring, after all outputs have been enabled
|
||||||
|
for device in self.drm_devices.values_mut() {
|
||||||
|
for surface in device.surfaces.values_mut() {
|
||||||
|
let mirrored_output =
|
||||||
|
if let OutputState::Mirroring(conn) = &surface.output.config().enabled {
|
||||||
|
Some(
|
||||||
|
all_outputs
|
||||||
|
.iter()
|
||||||
|
.find(|output| &output.name() == conn)
|
||||||
|
.cloned()
|
||||||
|
.ok_or(anyhow::anyhow!("Unable to find mirroring output"))?,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
if !test_only {
|
||||||
|
if mirrored_output != surface.output.mirroring() {
|
||||||
|
surface.set_mirroring(mirrored_output.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(all_outputs)
|
Ok(all_outputs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue