wlroots/include/render/allocator/gbm.h
Kenny Levinsen 5a786d96d0 WIP Introduce WLR_GBM_EXPLICIT_UPGRADE
When the `WLR_GBM_EXPLICIT_UPGRADE` flag is set to 1, the GBM allocator
will attempt to "upgrade" buffers allocated with implicit modifiers to
be managed with explicit modifiers.

This is useful to enable the conservative modifier fallback for the
Vulkan renderer on drivers/hardware that fully support implicit and
explicit modifiers, including being able to report the modifier of an
implicitly allocated BO.
2025-11-25 15:51:11 +01:00

38 lines
752 B
C

#ifndef RENDER_ALLOCATOR_GBM_H
#define RENDER_ALLOCATOR_GBM_H
#include <gbm.h>
#include <wlr/render/allocator.h>
#include <wlr/render/dmabuf.h>
#include <wlr/types/wlr_buffer.h>
struct wlr_gbm_buffer {
struct wlr_buffer base;
struct wl_list link; // wlr_gbm_allocator.buffers
struct gbm_bo *gbm_bo; // NULL if the gbm_device has been destroyed
struct wlr_dmabuf_attributes dmabuf;
};
struct wlr_gbm_allocator {
struct wlr_allocator base;
int fd;
struct gbm_device *gbm_device;
struct wl_list buffers; // wlr_gbm_buffer.link
struct {
bool explicit_upgrade;
} WLR_PRIVATE;
};
/**
* Creates a new GBM allocator from a DRM FD.
*
* Takes ownership over the FD.
*/
struct wlr_allocator *wlr_gbm_allocator_create(int drm_fd);
#endif