gbm: use Xrgb8888, if alpha variant is not available

This commit is contained in:
Victor Brekenfeld 2021-11-04 18:56:08 +01:00
parent 1a1fe01349
commit cf6f7a0726
1 changed files with 8 additions and 3 deletions

View File

@ -62,16 +62,21 @@ where
// Once we have proper color management and possibly HDR support,
// we need to have a more sophisticated picker.
// (Or maybe just pick ARGB2101010, if available, we will see.)
let code = Fourcc::Argb8888;
let mut code = Fourcc::Argb8888;
let logger = crate::slog_or_fallback(log).new(o!("backend" => "drm_render"));
// select a format
let plane_formats = drm
let mut plane_formats = drm
.supported_formats(drm.plane())?
.iter()
.filter(|fmt| fmt.code == code)
.cloned()
.collect::<HashSet<_>>();
// try non alpha variant if not available
if !plane_formats.iter().any(|fmt| fmt.code == code) {
code = Fourcc::Xrgb8888;
}
plane_formats.retain(|fmt| fmt.code == code);
renderer_formats.retain(|fmt| fmt.code == code);
trace!(logger, "Plane formats: {:?}", plane_formats);