Smithay / drm-rs

A low-level abstraction of the Direct Rendering Manager API
MIT License
77 stars 51 forks source link

Fix drm::control::Device::add_planar_buffer when GBM Bo uses DrmModifier::Invalid #192

Closed tronical closed 5 months ago

tronical commented 6 months ago

When adding a GBM supplied buffer via add_planar_buffer, since commit 6cb3a27d5b3f4fecb5415bed69497491759126a9 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.

tronical commented 6 months ago

One could argue that the PlanarBuffer implementation of BufferObject in gbm, fn modifiers(&self) -> Option<Modifier> should return None for DrmModifier::Invalid. I can make a PR for that - separately - but meanwhile I think since the ::Invalid variant does exist, it makes sense to "support" it.

tronical commented 6 months ago

I force-pushed to get the formatting fixed (my bad).

tronical commented 5 months ago

The CI failure looks bogus. The error about the invalid cast looks like it was from a build of an earlier sha. The latest build in https://github.com/Smithay/drm-rs/actions/runs/8346623741 has only the (seemingly unrelated) drm_syncobj failures.

Drakulix commented 5 months ago

Could you rebase? https://github.com/Smithay/drm-rs/pull/190 should have fixed CI.

tronical commented 5 months ago

Done :)

Drakulix commented 5 months ago

Thanks!