Merge pull request #409 from Smithay/drm/non-alpha-primary

gbm: use Xrgb8888, if alpha variant is not available
This commit is contained in:
Victor Brekenfeld 2021-11-16 09:05:39 +01:00 committed by GitHub
commit 0ea8899dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);