minigbm: add gbm_{bo,surface}_create_with_modifiers2
Rationale: this will help get Rust gbm bindings into Android (go/drm-gbm-rust-crates-for-android) without needing minigbm-specific patches to upstream Rust code. Upstream Mesa gbm defines those functions as variants with an extra "flags" argument[2][3] (these don't exist in the mesa version checked into Chromium though). The definitions added in this CL provide variants that fail for any non-zero flags. [1] https://crates.io/crates/gbm [2]b7d6d90dab/src/gbm/main/gbm.h (L303)[3]b7d6d90dab/src/gbm/main/gbm.h (L443)Bug: 328363177 Test: cros build-packages --board=amd64-generic minigbm drm-tests Change-Id: I9284d597e2d4de5ff9b677db0a0ffe6d274e4f57 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352371 Reviewed-by: Dominik Behr <dbehr@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Marcin Radomski <dextero@google.com> Tested-by: Marcin Radomski <dextero@google.com>
This commit is contained in:
parent
3b508e145f
commit
40b28f098a
2 changed files with 42 additions and 1 deletions
24
gbm.c
24
gbm.c
|
|
@ -86,11 +86,22 @@ PUBLIC struct gbm_surface *gbm_surface_create_with_modifiers(struct gbm_device *
|
||||||
uint32_t height, uint32_t format,
|
uint32_t height, uint32_t format,
|
||||||
const uint64_t *modifiers,
|
const uint64_t *modifiers,
|
||||||
const unsigned int count)
|
const unsigned int count)
|
||||||
|
{
|
||||||
|
return gbm_surface_create_with_modifiers2(gbm, width, height, format, modifiers, count, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC struct gbm_surface *
|
||||||
|
gbm_surface_create_with_modifiers2(struct gbm_device *gbm, uint32_t width, uint32_t height,
|
||||||
|
uint32_t format, const uint64_t *modifiers,
|
||||||
|
const unsigned int count, uint32_t flags)
|
||||||
{
|
{
|
||||||
if (count != 0 || modifiers != NULL)
|
if (count != 0 || modifiers != NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return gbm_surface_create(gbm, width, height, format, 0);
|
if (flags != 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return gbm_surface_create(gbm, width, height, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC struct gbm_bo *gbm_surface_lock_front_buffer(struct gbm_surface *surface)
|
PUBLIC struct gbm_bo *gbm_surface_lock_front_buffer(struct gbm_surface *surface)
|
||||||
|
|
@ -160,9 +171,20 @@ PUBLIC struct gbm_bo *gbm_bo_create(struct gbm_device *gbm, uint32_t width, uint
|
||||||
PUBLIC struct gbm_bo *gbm_bo_create_with_modifiers(struct gbm_device *gbm, uint32_t width,
|
PUBLIC struct gbm_bo *gbm_bo_create_with_modifiers(struct gbm_device *gbm, uint32_t width,
|
||||||
uint32_t height, uint32_t format,
|
uint32_t height, uint32_t format,
|
||||||
const uint64_t *modifiers, uint32_t count)
|
const uint64_t *modifiers, uint32_t count)
|
||||||
|
{
|
||||||
|
return gbm_bo_create_with_modifiers2(gbm, width, height, format, modifiers, count, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC struct gbm_bo *gbm_bo_create_with_modifiers2(struct gbm_device *gbm, uint32_t width,
|
||||||
|
uint32_t height, uint32_t format,
|
||||||
|
const uint64_t *modifiers,
|
||||||
|
const unsigned int count, uint32_t flags)
|
||||||
{
|
{
|
||||||
struct gbm_bo *bo;
|
struct gbm_bo *bo;
|
||||||
|
|
||||||
|
if (flags != 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
bo = gbm_bo_new(gbm, format);
|
bo = gbm_bo_new(gbm, format);
|
||||||
|
|
||||||
if (!bo)
|
if (!bo)
|
||||||
|
|
|
||||||
19
gbm.h
19
gbm.h
|
|
@ -339,6 +339,16 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
const uint64_t *modifiers,
|
const uint64_t *modifiers,
|
||||||
const unsigned int count);
|
const unsigned int count);
|
||||||
|
|
||||||
|
struct gbm_bo *
|
||||||
|
gbm_bo_create_with_modifiers2(struct gbm_device *gbm,
|
||||||
|
uint32_t width,
|
||||||
|
uint32_t height,
|
||||||
|
uint32_t format,
|
||||||
|
const uint64_t *modifiers,
|
||||||
|
const unsigned int count,
|
||||||
|
uint32_t flags);
|
||||||
|
|
||||||
#define GBM_BO_IMPORT_WL_BUFFER 0x5501
|
#define GBM_BO_IMPORT_WL_BUFFER 0x5501
|
||||||
#define GBM_BO_IMPORT_EGL_IMAGE 0x5502
|
#define GBM_BO_IMPORT_EGL_IMAGE 0x5502
|
||||||
#define GBM_BO_IMPORT_FD 0x5503
|
#define GBM_BO_IMPORT_FD 0x5503
|
||||||
|
|
@ -491,6 +501,15 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm,
|
||||||
const uint64_t *modifiers,
|
const uint64_t *modifiers,
|
||||||
const unsigned int count);
|
const unsigned int count);
|
||||||
|
|
||||||
|
struct gbm_surface *
|
||||||
|
gbm_surface_create_with_modifiers2(struct gbm_device *gbm,
|
||||||
|
uint32_t width,
|
||||||
|
uint32_t height,
|
||||||
|
uint32_t format,
|
||||||
|
const uint64_t *modifiers,
|
||||||
|
const unsigned int count,
|
||||||
|
uint32_t flags);
|
||||||
|
|
||||||
struct gbm_bo *
|
struct gbm_bo *
|
||||||
gbm_surface_lock_front_buffer(struct gbm_surface *surface);
|
gbm_surface_lock_front_buffer(struct gbm_surface *surface);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue