Skip to content

Commit d926544

Browse files
tronicalDrakulix
authored andcommitted
Fix drm::control::Device::add_planar_buffer when GBM Bo uses DrmModifier::Invalid
When adding a GBM supplied buffer via add_planar_buffer, since commit 6cb3a27 the modifiers are fetched directly from the planar buffer trait. What the code does not take into account though is when the GBM bo returns DrmModifier::Invalid. In that case add_fb2 expects 0 as modifier in the array for each plane, instead of DRM_FORMAT_MOD_INVALID.
1 parent 9819117 commit d926544

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/control/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ pub trait Device: super::Device {
353353
where
354354
B: buffer::PlanarBuffer + ?Sized,
355355
{
356-
let modifier = planar_buffer.modifier();
356+
let modifier = planar_buffer
357+
.modifier()
358+
.filter(|modifier| !matches!(modifier, DrmModifier::Invalid));
357359
let has_modifier = flags.contains(FbCmd2Flags::MODIFIERS);
358360
assert!((has_modifier && modifier.is_some()) || (!has_modifier && modifier.is_none()));
359361
let modifier = if let Some(modifier) = modifier {

0 commit comments

Comments
 (0)