legacy: bugfix, add null-commit to free pipeline

This commit is contained in:
Victor Brekenfeld 2020-04-19 01:56:17 +02:00
parent ea44343315
commit 57e5494941
2 changed files with 20 additions and 4 deletions

View File

@ -126,7 +126,8 @@ impl<A: AsRawFd + 'static> Surface for LegacyDrmSurfaceInternal<A> {
.iter() .iter()
.map(|conn| self.check_connector(*conn, pending.mode.as_ref().unwrap())) .map(|conn| self.check_connector(*conn, pending.mode.as_ref().unwrap()))
.collect::<Result<Vec<bool>, _>>()? .collect::<Result<Vec<bool>, _>>()?
.iter().all(|v| *v) .iter()
.all(|v| *v)
{ {
pending.connectors = connectors.into_iter().cloned().collect(); pending.connectors = connectors.into_iter().cloned().collect();
} }
@ -175,12 +176,27 @@ impl<A: AsRawFd + 'static> RawSurface for LegacyDrmSurfaceInternal<A> {
let removed = current.connectors.difference(&pending.connectors); let removed = current.connectors.difference(&pending.connectors);
let added = pending.connectors.difference(&current.connectors); let added = pending.connectors.difference(&current.connectors);
let mut conn_removed = false;
for conn in removed { for conn in removed {
if let Ok(info) = self.get_connector(*conn) { if let Ok(info) = self.get_connector(*conn) {
info!(self.logger, "Removing connector: {:?}", info.interface()); info!(self.logger, "Removing connector: {:?}", info.interface());
} else { } else {
info!(self.logger, "Removing unknown connector"); info!(self.logger, "Removing unknown connector");
} }
// if the connector was mapped to our crtc, we need to ack the disconnect.
// the graphics pipeline will not be freed otherwise
conn_removed = true;
}
if conn_removed {
// We need to do a null commit to free graphics pipelines
self.set_crtc(self.crtc, None, (0, 0), &[], None)
.compat()
.map_err(|source| Error::Access {
errmsg: "Error setting crtc",
dev: self.dev_path(),
source,
})?;
} }
for conn in added { for conn in added {