mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-17 06:46:39 -04:00
render/allocator/gbm: add bo_flags arg to create function
This allows callers to opt out of SCANOUT, for instance.
This commit is contained in:
parent
bf75706555
commit
a245201dad
3 changed files with 10 additions and 4 deletions
|
|
@ -16,6 +16,7 @@
|
|||
#include "render/wlr_renderer.h"
|
||||
|
||||
#if WLR_HAS_GBM_ALLOCATOR
|
||||
#include <gbm.h>
|
||||
#include "render/allocator/gbm.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -109,7 +110,8 @@ struct wlr_allocator *allocator_autocreate_with_drm_fd(
|
|||
if (gbm_fd < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if ((alloc = wlr_gbm_allocator_create_with_drm_fd(gbm_fd)) != NULL) {
|
||||
uint32_t bo_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
||||
if ((alloc = wlr_gbm_allocator_create_with_drm_fd(gbm_fd, bo_flags)) != NULL) {
|
||||
return alloc;
|
||||
}
|
||||
close(gbm_fd);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static struct wlr_gbm_buffer *create_buffer(struct wlr_gbm_allocator *alloc,
|
|||
|
||||
bool has_modifier = true;
|
||||
uint64_t fallback_modifier = DRM_FORMAT_MOD_INVALID;
|
||||
uint32_t flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
||||
uint32_t flags = alloc->bo_flags;
|
||||
struct gbm_bo *bo;
|
||||
#if HAVE_GBM_BO_CREATE_WITH_MODIFIERS2
|
||||
bo = gbm_bo_create_with_modifiers2(gbm_device, width, height,
|
||||
|
|
@ -192,7 +192,7 @@ static struct wlr_gbm_allocator *get_gbm_alloc_from_alloc(
|
|||
return alloc;
|
||||
}
|
||||
|
||||
struct wlr_allocator *wlr_gbm_allocator_create_with_drm_fd(int fd) {
|
||||
struct wlr_allocator *wlr_gbm_allocator_create_with_drm_fd(int fd, uint32_t bo_flags) {
|
||||
uint64_t cap;
|
||||
if (drmGetCap(fd, DRM_CAP_PRIME, &cap) ||
|
||||
!(cap & DRM_PRIME_CAP_EXPORT)) {
|
||||
|
|
@ -207,6 +207,7 @@ struct wlr_allocator *wlr_gbm_allocator_create_with_drm_fd(int fd) {
|
|||
wlr_allocator_init(&alloc->base, &allocator_impl, WLR_BUFFER_CAP_DMABUF);
|
||||
|
||||
alloc->fd = fd;
|
||||
alloc->bo_flags = bo_flags;
|
||||
wl_list_init(&alloc->buffers);
|
||||
|
||||
alloc->gbm_device = gbm_create_device(fd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue