Skip to content

Commit

Permalink
platforms/atomic-kms: Fail gracefully when bypass buffer can't be imp…
Browse files Browse the repository at this point in the history
…orted for scanout.

The compositor code is expecting `framebuffer_for` to sometimes return `nullptr`; this is fine.
What's *not* fine is passing a null `fb_id` to `AtomicKmsFbHandle` and then returning a
*non*-null `Framebuffer` that's broken :)
  • Loading branch information
RAOF authored and tarek-y-ismail committed Oct 15, 2024
1 parent a423b51 commit f77ddf6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/platforms/atomic-kms/server/kms/display_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ auto mga::DmaBufDisplayAllocator::framebuffer_for(std::shared_ptr<DMABufBuffer>
{
auto fb_id = drm_fb_id_from_dma_buffer(drm_fd(), gbm, buffer);

if (!fb_id)
{
return {};
}

struct AtomicKmsFbHandle : public mg::FBHandle
{
AtomicKmsFbHandle(std::shared_ptr<uint32_t> fb_handle, geometry::Size size) :
Expand Down

0 comments on commit f77ddf6

Please sign in to comment.