anvil: do not double initialize surfaces with multiple matching encoders

This commit is contained in:
Victor Brekenfeld 2020-05-22 22:59:32 +02:00
parent 69c1116d82
commit 38d3db565a
1 changed files with 4 additions and 4 deletions

View File

@ -301,7 +301,7 @@ impl<S: SessionNotifier, Data: 'static> UdevHandlerImpl<S, Data> {
.filter_map(|e| *e) .filter_map(|e| *e)
.flat_map(|encoder_handle| device.get_encoder_info(encoder_handle)) .flat_map(|encoder_handle| device.get_encoder_info(encoder_handle))
.collect::<Vec<EncoderInfo>>(); .collect::<Vec<EncoderInfo>>();
for encoder_info in encoder_infos { 'outer: for encoder_info in encoder_infos {
for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) { for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) {
if let Entry::Vacant(entry) = backends.entry(crtc) { if let Entry::Vacant(entry) = backends.entry(crtc) {
let renderer = GliumDrawer::init( let renderer = GliumDrawer::init(
@ -313,7 +313,7 @@ impl<S: SessionNotifier, Data: 'static> UdevHandlerImpl<S, Data> {
); );
entry.insert(Rc::new(renderer)); entry.insert(Rc::new(renderer));
break; break 'outer;
} }
} }
} }
@ -349,14 +349,14 @@ impl<S: SessionNotifier, Data: 'static> UdevHandlerImpl<S, Data> {
.filter_map(|e| *e) .filter_map(|e| *e)
.flat_map(|encoder_handle| device.get_encoder_info(encoder_handle)) .flat_map(|encoder_handle| device.get_encoder_info(encoder_handle))
.collect::<Vec<EncoderInfo>>(); .collect::<Vec<EncoderInfo>>();
for encoder_info in encoder_infos { 'outer: for encoder_info in encoder_infos {
for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) { for crtc in res_handles.filter_crtcs(encoder_info.possible_crtcs()) {
if !backends.contains_key(&crtc) { if !backends.contains_key(&crtc) {
let renderer = let renderer =
GliumDrawer::init(device.create_surface(crtc).unwrap(), logger.clone()); GliumDrawer::init(device.create_surface(crtc).unwrap(), logger.clone());
backends.insert(crtc, Rc::new(renderer)); backends.insert(crtc, Rc::new(renderer));
break; break 'outer;
} }
} }
} }