kms: Don't commit anything before updating the mode
This commit is contained in:
parent
e34a289c01
commit
87742c1e0c
1 changed files with 16 additions and 37 deletions
|
|
@ -762,7 +762,6 @@ impl<'a> KmsGuard<'a> {
|
||||||
.context("Failed to enable devices")?;
|
.context("Failed to enable devices")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut all_outputs = Vec::new();
|
|
||||||
for device in self.drm_devices.values_mut() {
|
for device in self.drm_devices.values_mut() {
|
||||||
let now = clock.now();
|
let now = clock.now();
|
||||||
let output_map = device
|
let output_map = device
|
||||||
|
|
@ -772,28 +771,6 @@ impl<'a> KmsGuard<'a> {
|
||||||
.map(|(crtc, surface)| (*crtc, surface.output.clone()))
|
.map(|(crtc, surface)| (*crtc, surface.output.clone()))
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
|
|
||||||
// configure primary scanout allowance
|
|
||||||
if !device.surfaces.is_empty() {
|
|
||||||
let mut renderer = self
|
|
||||||
.api
|
|
||||||
.single_renderer(&device.render_node)
|
|
||||||
.with_context(|| "Failed to create renderer")?;
|
|
||||||
|
|
||||||
device
|
|
||||||
.allow_primary_scanout_any(
|
|
||||||
device
|
|
||||||
.surfaces
|
|
||||||
.values()
|
|
||||||
.filter(|s| s.output.is_enabled() && s.output.mirroring().is_none())
|
|
||||||
.count()
|
|
||||||
<= 1,
|
|
||||||
&mut renderer,
|
|
||||||
clock,
|
|
||||||
&shell,
|
|
||||||
)
|
|
||||||
.context("Failed to switch primary-plane scanout flags")?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
@ -972,26 +949,27 @@ impl<'a> KmsGuard<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
all_outputs.extend(
|
// configure primary scanout allowance
|
||||||
device
|
|
||||||
.outputs
|
|
||||||
.iter()
|
|
||||||
.filter(|(conn, _)| {
|
|
||||||
!device
|
|
||||||
.leased_connectors
|
|
||||||
.iter()
|
|
||||||
.any(|(leased_conn, _)| *conn == leased_conn)
|
|
||||||
})
|
|
||||||
.map(|(_, output)| output.clone())
|
|
||||||
.collect::<Vec<_>>(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if !device.surfaces.is_empty() {
|
if !device.surfaces.is_empty() {
|
||||||
let mut renderer = self
|
let mut renderer = self
|
||||||
.api
|
.api
|
||||||
.single_renderer(&device.render_node)
|
.single_renderer(&device.render_node)
|
||||||
.with_context(|| "Failed to create renderer")?;
|
.with_context(|| "Failed to create renderer")?;
|
||||||
|
|
||||||
|
device
|
||||||
|
.allow_primary_scanout_any(
|
||||||
|
device
|
||||||
|
.surfaces
|
||||||
|
.values()
|
||||||
|
.filter(|s| s.output.is_enabled() && s.output.mirroring().is_none())
|
||||||
|
.count()
|
||||||
|
<= 1,
|
||||||
|
&mut renderer,
|
||||||
|
clock,
|
||||||
|
&shell,
|
||||||
|
)
|
||||||
|
.context("Failed to switch primary-plane scanout flags")?;
|
||||||
|
|
||||||
let mut elements = DrmOutputRenderElements::default();
|
let mut elements = DrmOutputRenderElements::default();
|
||||||
for (crtc, output) in output_map.iter() {
|
for (crtc, output) in output_map.iter() {
|
||||||
let output_elements = output_elements(
|
let output_elements = output_elements(
|
||||||
|
|
@ -1018,6 +996,7 @@ impl<'a> KmsGuard<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to handle mirroring, after all outputs have been enabled
|
// we need to handle mirroring, after all outputs have been enabled
|
||||||
|
let all_outputs = self.all_outputs();
|
||||||
for device in self.drm_devices.values_mut() {
|
for device in self.drm_devices.values_mut() {
|
||||||
for surface in device.surfaces.values_mut() {
|
for surface in device.surfaces.values_mut() {
|
||||||
let mirrored_output =
|
let mirrored_output =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue