kms: Fix remaining hot-plugging issue
This commit is contained in:
parent
f7a04024ba
commit
6fd29784d2
4 changed files with 33 additions and 30 deletions
|
|
@ -24,7 +24,7 @@ pub fn display_configuration(
|
|||
// That means, to reduce flickering, we try to keep an established mapping.
|
||||
for conn in connectors
|
||||
.iter()
|
||||
.flat_map(|conn| device.get_connector(*conn).ok())
|
||||
.flat_map(|conn| device.get_connector(*conn, true).ok())
|
||||
{
|
||||
if let Some(enc) = conn.current_encoder() {
|
||||
if let Some(crtc) = device.get_encoder(enc)?.crtc() {
|
||||
|
|
@ -43,7 +43,7 @@ pub fn display_configuration(
|
|||
// But just in case we try to match all remaining connectors.
|
||||
for conn in connectors
|
||||
.iter()
|
||||
.flat_map(|conn| device.get_connector(*conn).ok())
|
||||
.flat_map(|conn| device.get_connector(*conn, false).ok())
|
||||
.filter(|conn| conn.state() == ConnectorState::Connected)
|
||||
.filter(|conn| !map.contains_key(&conn.handle()))
|
||||
.collect::<Vec<_>>()
|
||||
|
|
@ -52,8 +52,7 @@ pub fn display_configuration(
|
|||
'outer: for encoder_info in conn
|
||||
.encoders()
|
||||
.iter()
|
||||
.filter_map(|e| *e)
|
||||
.flat_map(|encoder_handle| device.get_encoder(encoder_handle))
|
||||
.flat_map(|encoder_handle| device.get_encoder(*encoder_handle))
|
||||
{
|
||||
for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) {
|
||||
if !map.values().any(|v| *v == crtc) {
|
||||
|
|
@ -71,7 +70,7 @@ pub fn display_configuration(
|
|||
|
||||
for conn in connectors
|
||||
.iter()
|
||||
.flat_map(|conn| device.get_connector(*conn).ok())
|
||||
.flat_map(|conn| device.get_connector(*conn, false).ok())
|
||||
.filter(|conn| {
|
||||
if let Some(enc) = conn.current_encoder() {
|
||||
if let Some(enc) = device.get_encoder(enc).ok() {
|
||||
|
|
@ -90,14 +89,14 @@ pub fn display_configuration(
|
|||
|
||||
// We cannot just shortcut and use the legacy api for all cleanups because of this.
|
||||
// (Technically a device does not need to be atomic for planes to be used, but nobody does this otherwise.)
|
||||
for plane in plane_handles.planes() {
|
||||
let info = device.get_plane(*plane)?;
|
||||
for plane in plane_handles {
|
||||
let info = device.get_plane(plane)?;
|
||||
if let Some(crtc) = info.crtc() {
|
||||
if cleanup.contains(&crtc) {
|
||||
let crtc_id = get_prop(device, *plane, "CRTC_ID")?;
|
||||
let fb_id = get_prop(device, *plane, "FB_ID")?;
|
||||
req.add_property(*plane, crtc_id, property::Value::CRTC(None));
|
||||
req.add_property(*plane, fb_id, property::Value::Framebuffer(None));
|
||||
let crtc_id = get_prop(device, plane, "CRTC_ID")?;
|
||||
let fb_id = get_prop(device, plane, "FB_ID")?;
|
||||
req.add_property(plane, crtc_id, property::Value::CRTC(None));
|
||||
req.add_property(plane, fb_id, property::Value::Framebuffer(None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -123,7 +122,7 @@ pub fn display_configuration(
|
|||
}
|
||||
|
||||
pub fn interface_name(device: &impl ControlDevice, connector: connector::Handle) -> Result<String> {
|
||||
let conn_info = device.get_connector(connector)?;
|
||||
let conn_info = device.get_connector(connector, false)?;
|
||||
|
||||
let other_short_name;
|
||||
let interface_short_name = match conn_info.interface() {
|
||||
|
|
|
|||
|
|
@ -520,6 +520,9 @@ impl State {
|
|||
slog_scope::warn!("Failed to initialize output: {}", err);
|
||||
}
|
||||
}
|
||||
for output in outputs_removed {
|
||||
self.common.shell.remove_output(&output);
|
||||
}
|
||||
self.common.output_configuration_state.update();
|
||||
self.common.config.read_outputs(
|
||||
self.common.output_configuration_state.outputs(),
|
||||
|
|
@ -562,6 +565,9 @@ impl State {
|
|||
self.common.output_configuration_state.update();
|
||||
|
||||
if self.backend.kms().session.is_active() {
|
||||
for output in outputs_removed {
|
||||
self.common.shell.remove_output(&output);
|
||||
}
|
||||
self.common.config.read_outputs(
|
||||
self.common.output_configuration_state.outputs(),
|
||||
&mut self.backend,
|
||||
|
|
@ -619,7 +625,7 @@ impl Device {
|
|||
) -> Result<Output> {
|
||||
let drm = &mut *self.drm.as_source_mut();
|
||||
let crtc_info = drm.get_crtc(crtc)?;
|
||||
let conn_info = drm.get_connector(conn)?;
|
||||
let conn_info = drm.get_connector(conn, false)?;
|
||||
let vrr = drm_helpers::set_vrr(drm, crtc, conn, true).unwrap_or(false);
|
||||
let interface = drm_helpers::interface_name(drm, conn)?;
|
||||
let edid_info = drm_helpers::edid_info(drm, conn)?;
|
||||
|
|
@ -824,7 +830,7 @@ impl KmsState {
|
|||
} else {
|
||||
let drm = &mut *device.drm.as_source_mut();
|
||||
let conn = surface.connector;
|
||||
let conn_info = drm.get_connector(conn)?;
|
||||
let conn_info = drm.get_connector(conn, false)?;
|
||||
let mode = conn_info
|
||||
.modes()
|
||||
.iter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue