Skip to content
This repository was archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
gbm_allocator: use GBM_BO_USE_LINEAR if modifier is DRM_FORMAT_MOD_LI…
Browse files Browse the repository at this point in the history
…NEAR

This allows an allocator user to force linear even if modifiers aren't
supported.
  • Loading branch information
emersion committed Apr 10, 2020
1 parent cd65604 commit 2f4d151
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gbm_allocator.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <assert.h>
#include <drm_fourcc.h>
#include <stdlib.h>
#include <unistd.h>
#include <wlr/util/log.h>
Expand All @@ -20,8 +21,12 @@ struct glider_gbm_buffer *glider_gbm_buffer_create(struct gbm_device *gbm_device
format->format, format->modifiers, format->len);
}
if (bo == NULL) {
bo = gbm_bo_create(gbm_device, width, height,
format->format, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
uint32_t usage = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
if (format->len == 1 &&
format->modifiers[0] == DRM_FORMAT_MOD_LINEAR) {
usage |= GBM_BO_USE_LINEAR;
}
bo = gbm_bo_create(gbm_device, width, height, format->format, usage);
}
if (bo == NULL) {
wlr_log(WLR_ERROR, "gbm_bo_create failed");
Expand Down

0 comments on commit 2f4d151

Please sign in to comment.