B17: cros-libva DrmDeviceIterator: skip missing renderD nodes instead of stopping at the first gap (scan renderD128..renderD191)
Browse files at this commite521131fb21e520e8c7261cde36697aee672d81dParent: 4ec7fdc1 changed file +6 -10
shims/cros-libva/src/display.rsmodified+6 -10
| @@ -45,18 +45,14 @@ impl Iterator for DrmDeviceIterator { | ||
| 45 | 45 | type Item = PathBuf; |
| 46 | 46 | |
| 47 | 47 | fn next(&mut self) -> Option<Self::Item> { |
| 48 | - match self.cur_idx { | |
| 49 | - idx if idx >= DRM_RENDER_NODE_START + DRM_NUM_NODES => None, | |
| 50 | - idx => { | |
| 51 | - let path = PathBuf::from(format!("{}{}", DRM_NODE_DEFAULT_PREFIX, idx)); | |
| 52 | - if !path.exists() { | |
| 53 | - None | |
| 54 | - } else { | |
| 55 | - self.cur_idx += 1; | |
| 56 | - Some(path) | |
| 57 | - } | |
| 48 | + while self.cur_idx < DRM_RENDER_NODE_START + DRM_NUM_NODES { | |
| 49 | + let path = PathBuf::from(format!("{}{}", DRM_NODE_DEFAULT_PREFIX, self.cur_idx)); | |
| 50 | + self.cur_idx += 1; | |
| 51 | + if path.exists() { | |
| 52 | + return Some(path); | |
| 58 | 53 | } |
| 59 | 54 | } |
| 55 | + None | |
| 60 | 56 | } |
| 61 | 57 | } |
| 62 | 58 |