legacy: bugfix, add null-commit to free pipeline
This commit is contained in:
parent
ea44343315
commit
57e5494941
|
@ -235,7 +235,7 @@ impl<A: AsRawFd + 'static> Device for LegacyDrmDevice<A> {
|
||||||
|
|
||||||
// Now try to do the least possible amount of changes to set this to the state the users requested
|
// Now try to do the least possible amount of changes to set this to the state the users requested
|
||||||
// TODO!
|
// TODO!
|
||||||
|
|
||||||
let state = State { mode, connectors };
|
let state = State { mode, connectors };
|
||||||
let backend = Rc::new(LegacyDrmSurfaceInternal {
|
let backend = Rc::new(LegacyDrmSurfaceInternal {
|
||||||
dev: self.dev.clone(),
|
dev: self.dev.clone(),
|
||||||
|
|
|
@ -118,15 +118,16 @@ impl<A: AsRawFd + 'static> Surface for LegacyDrmSurfaceInternal<A> {
|
||||||
self.pending.write().unwrap().connectors.remove(&connector);
|
self.pending.write().unwrap().connectors.remove(&connector);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_connectors(&self, connectors: &[connector::Handle]) -> Result<(), Self::Error> {
|
fn set_connectors(&self, connectors: &[connector::Handle]) -> Result<(), Self::Error> {
|
||||||
let mut pending = self.pending.write().unwrap();
|
let mut pending = self.pending.write().unwrap();
|
||||||
|
|
||||||
if connectors
|
if connectors
|
||||||
.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(¤t.connectors);
|
let added = pending.connectors.difference(¤t.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 {
|
||||||
|
|
Loading…
Reference in New Issue