kms: Cleanup now that output_elements won't panic for uninitialized outputs
This commit is contained in:
parent
db13eea91c
commit
bebd7c5c40
2 changed files with 12 additions and 25 deletions
|
|
@ -18,8 +18,9 @@ use smithay::{
|
|||
Format, Fourcc,
|
||||
},
|
||||
drm::{
|
||||
compositor::FrameFlags, output::DrmOutputManager, DrmDevice, DrmDeviceFd, DrmEvent,
|
||||
DrmNode,
|
||||
compositor::{FrameError, FrameFlags},
|
||||
output::DrmOutputManager,
|
||||
DrmDevice, DrmDeviceFd, DrmEvent, DrmNode,
|
||||
},
|
||||
egl::{context::ContextPriority, EGLContext, EGLDevice, EGLDisplay},
|
||||
session::Session,
|
||||
|
|
@ -620,7 +621,6 @@ impl Device {
|
|||
renderer: &mut GlMultiRenderer,
|
||||
clock: &Clock<Monotonic>,
|
||||
shell: &Arc<RwLock<Shell>>,
|
||||
startup_done: bool,
|
||||
) -> Result<()> {
|
||||
for surface in self.surfaces.values_mut() {
|
||||
surface.allow_frame_flags(flag, flags);
|
||||
|
|
@ -628,16 +628,11 @@ impl Device {
|
|||
|
||||
if !flag {
|
||||
let now = clock.now();
|
||||
|
||||
let mut output_map = self
|
||||
let output_map = self
|
||||
.surfaces
|
||||
.iter()
|
||||
.filter(|(_, s)| s.is_active())
|
||||
.map(|(crtc, surface)| (*crtc, surface.output.clone()))
|
||||
.collect::<HashMap<_, _>>();
|
||||
if !startup_done {
|
||||
output_map.clear();
|
||||
}
|
||||
|
||||
self.drm.with_compositors::<Result<()>>(|map| {
|
||||
for (crtc, compositor) in map.iter() {
|
||||
|
|
@ -662,7 +657,11 @@ impl Device {
|
|||
CLEAR_COLOR,
|
||||
FrameFlags::empty(),
|
||||
)?;
|
||||
compositor.commit_frame()?;
|
||||
if let Err(err) = compositor.commit_frame() {
|
||||
if !matches!(err, FrameError::EmptyFrame) {
|
||||
return Err(err.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
@ -685,7 +684,6 @@ impl Device {
|
|||
renderer,
|
||||
clock,
|
||||
shell,
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +693,6 @@ impl Device {
|
|||
renderer: &mut GlMultiRenderer,
|
||||
clock: &Clock<Monotonic>,
|
||||
shell: &Arc<RwLock<Shell>>,
|
||||
startup_done: bool,
|
||||
) -> Result<()> {
|
||||
self.allow_frame_flags(
|
||||
flag,
|
||||
|
|
@ -703,7 +700,6 @@ impl Device {
|
|||
renderer,
|
||||
clock,
|
||||
shell,
|
||||
startup_done,
|
||||
)?;
|
||||
|
||||
self.drm.with_compositors(|comps| {
|
||||
|
|
|
|||
|
|
@ -44,10 +44,7 @@ use std::{
|
|||
borrow::BorrowMut,
|
||||
collections::{HashMap, HashSet},
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, RwLock,
|
||||
},
|
||||
sync::{atomic::AtomicBool, Arc, RwLock},
|
||||
};
|
||||
|
||||
mod device;
|
||||
|
|
@ -649,19 +646,14 @@ impl KmsState {
|
|||
.context("Failed to enable devices")?;
|
||||
}
|
||||
|
||||
let startup_done = startup_done.load(Ordering::SeqCst);
|
||||
let mut all_outputs = Vec::new();
|
||||
for device in self.drm_devices.values_mut() {
|
||||
let now = clock.now();
|
||||
let mut output_map = device
|
||||
let output_map = device
|
||||
.surfaces
|
||||
.iter()
|
||||
.filter(|(_, s)| s.is_active())
|
||||
.map(|(crtc, surface)| (*crtc, surface.output.clone()))
|
||||
.collect::<HashMap<_, _>>();
|
||||
if !startup_done {
|
||||
output_map.clear();
|
||||
}
|
||||
|
||||
// configure primary scanout allowance
|
||||
if !device.surfaces.is_empty() {
|
||||
|
|
@ -675,13 +667,12 @@ impl KmsState {
|
|||
device
|
||||
.surfaces
|
||||
.values()
|
||||
.filter(|s| s.output.is_enabled())
|
||||
.filter(|s| s.output.is_enabled() && s.output.mirroring().is_none())
|
||||
.count()
|
||||
<= 1,
|
||||
&mut renderer,
|
||||
clock,
|
||||
&shell,
|
||||
startup_done,
|
||||
)
|
||||
.context("Failed to switch primary-plane scanout flags")?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue