Skip to content

Commit

Permalink
Fix drm::control::Device::add_planar_buffer when GBM Bo uses DrmModif…
Browse files Browse the repository at this point in the history
…ier::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.
  • Loading branch information
tronical authored and Drakulix committed Mar 27, 2024
1 parent 9819117 commit d926544
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/control/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ pub trait Device: super::Device {
where
B: buffer::PlanarBuffer + ?Sized,
{
let modifier = planar_buffer.modifier();
let modifier = planar_buffer
.modifier()
.filter(|modifier| !matches!(modifier, DrmModifier::Invalid));
let has_modifier = flags.contains(FbCmd2Flags::MODIFIERS);
assert!((has_modifier && modifier.is_some()) || (!has_modifier && modifier.is_none()));
let modifier = if let Some(modifier) = modifier {
Expand Down

0 comments on commit d926544

Please sign in to comment.