forge
Explore
Log in

Don't you dare go Hollow

B17: cros-libva DrmDeviceIterator: skip missing renderD nodes instead of stopping at the first gap (scan renderD128..renderD191)

Browse files at this commit

e521131fb21e520e8c7261cde36697aee672d81dAhmet Kaan GümüşParent: 4ec7fdc
shims/cros-libva/src/display.rsmodified+6 -10
@@ -45,18 +45,14 @@ impl Iterator for DrmDeviceIterator {
45 type Item = PathBuf;45 type Item = PathBuf;
46 46
47 fn next(&mut self) -> Option<Self::Item> {47 fn next(&mut self) -> Option<Self::Item> {
48- match self.cur_idx {48+ while self.cur_idx < DRM_RENDER_NODE_START + DRM_NUM_NODES {
49- idx if idx >= DRM_RENDER_NODE_START + DRM_NUM_NODES => None,49+ let path = PathBuf::from(format!("{}{}", DRM_NODE_DEFAULT_PREFIX, self.cur_idx));
50- idx => {50+ self.cur_idx += 1;
51- let path = PathBuf::from(format!("{}{}", DRM_NODE_DEFAULT_PREFIX, idx));51+ if path.exists() {
52- if !path.exists() {52+ return Some(path);
53- None
54- } else {
55- self.cur_idx += 1;
56- Some(path)
57- }
58 }53 }
59 }54 }
55+ None
60 }56 }
61 }57 }
62 58