kms: Fix enabling outputs
This commit is contained in:
parent
7e8cb91d23
commit
dbb51e827d
2 changed files with 46 additions and 28 deletions
|
|
@ -253,8 +253,6 @@ impl State {
|
||||||
self.backend.kms().drm_devices.insert(drm_node, device);
|
self.backend.kms().drm_devices.insert(drm_node, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.backend.kms().refresh_used_devices()?;
|
|
||||||
|
|
||||||
self.common
|
self.common
|
||||||
.output_configuration_state
|
.output_configuration_state
|
||||||
.add_heads(wl_outputs.iter());
|
.add_heads(wl_outputs.iter());
|
||||||
|
|
@ -267,6 +265,8 @@ impl State {
|
||||||
&self.common.xdg_activation_state,
|
&self.common.xdg_activation_state,
|
||||||
self.common.startup_done.clone(),
|
self.common.startup_done.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
self.backend.kms().refresh_used_devices()?;
|
||||||
self.common.refresh();
|
self.common.refresh();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -349,8 +349,6 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.backend.kms().refresh_used_devices()?;
|
|
||||||
|
|
||||||
self.common
|
self.common
|
||||||
.output_configuration_state
|
.output_configuration_state
|
||||||
.remove_heads(outputs_removed.iter());
|
.remove_heads(outputs_removed.iter());
|
||||||
|
|
@ -376,6 +374,8 @@ impl State {
|
||||||
self.common.refresh();
|
self.common.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.backend.kms().refresh_used_devices()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -528,7 +528,6 @@ impl KmsState {
|
||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut all_outputs = Vec::new();
|
|
||||||
for device in self.drm_devices.values_mut() {
|
for device in self.drm_devices.values_mut() {
|
||||||
// we only want outputs exposed to wayland - not leased ones
|
// we only want outputs exposed to wayland - not leased ones
|
||||||
// but that is also not all surface, because that doesn't contain all detected, but unmapped outputs
|
// but that is also not all surface, because that doesn't contain all detected, but unmapped outputs
|
||||||
|
|
@ -587,7 +586,7 @@ impl KmsState {
|
||||||
.flat_map(|encoder_handle| device.drm.get_encoder(*encoder_handle))
|
.flat_map(|encoder_handle| device.drm.get_encoder(*encoder_handle))
|
||||||
{
|
{
|
||||||
for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) {
|
for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) {
|
||||||
if !free_crtcs.contains(&crtc) {
|
if free_crtcs.contains(&crtc) {
|
||||||
new_pairings.insert(conn, crtc);
|
new_pairings.insert(conn, crtc);
|
||||||
break 'outer;
|
break 'outer;
|
||||||
}
|
}
|
||||||
|
|
@ -607,7 +606,34 @@ impl KmsState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconfigure existing
|
// add new ones
|
||||||
|
let mut w = shell.read().unwrap().global_space().size.w as u32;
|
||||||
|
if !test_only {
|
||||||
|
for (conn, crtc) in new_pairings {
|
||||||
|
let (output, _) = device.connector_added(
|
||||||
|
self.primary_node.as_ref(),
|
||||||
|
conn,
|
||||||
|
Some(crtc),
|
||||||
|
(w, 0),
|
||||||
|
loop_handle,
|
||||||
|
shell.clone(),
|
||||||
|
startup_done.clone(),
|
||||||
|
)?;
|
||||||
|
if output.mirroring().is_none() {
|
||||||
|
w += output.config().transformed_size().w as u32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !test_only {
|
||||||
|
self.refresh_used_devices()
|
||||||
|
.context("Failed to enable devices")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut all_outputs = Vec::new();
|
||||||
|
for device in self.drm_devices.values_mut() {
|
||||||
|
// reconfigure
|
||||||
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();
|
||||||
|
|
||||||
|
|
@ -673,27 +699,19 @@ impl KmsState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add new ones
|
all_outputs.extend(
|
||||||
let mut w = shell.read().unwrap().global_space().size.w as u32;
|
device
|
||||||
if !test_only {
|
.outputs
|
||||||
for (conn, crtc) in new_pairings {
|
.iter()
|
||||||
let (output, _) = device.connector_added(
|
.filter(|(conn, _)| {
|
||||||
self.primary_node.as_ref(),
|
!device
|
||||||
conn,
|
.leased_connectors
|
||||||
Some(crtc),
|
.iter()
|
||||||
(0, w),
|
.any(|(leased_conn, _)| *conn == leased_conn)
|
||||||
loop_handle,
|
})
|
||||||
shell.clone(),
|
.map(|(_, output)| output.clone())
|
||||||
startup_done.clone(),
|
.collect::<Vec<_>>(),
|
||||||
)?;
|
);
|
||||||
if output.mirroring().is_none() {
|
|
||||||
w += output.config().transformed_size().w as u32;
|
|
||||||
}
|
|
||||||
all_outputs.push(output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
all_outputs.extend(outputs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to handle mirroring, after all outputs have been enabled
|
// we need to handle mirroring, after all outputs have been enabled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue