diff options
Diffstat (limited to 'src/gbm/main')
-rw-r--r-- | src/gbm/main/gbm.c | 39 | ||||
-rw-r--r-- | src/gbm/main/gbm.h | 12 | ||||
-rw-r--r-- | src/gbm/main/gbmint.h | 12 |
3 files changed, 59 insertions, 4 deletions
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index afcca63da3a..7bacd8b86a6 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -369,9 +369,28 @@ gbm_bo_create(struct gbm_device *gbm, return NULL; } - return gbm->bo_create(gbm, width, height, format, usage); + return gbm->bo_create(gbm, width, height, format, usage, NULL, 0); } +GBM_EXPORT struct gbm_bo * +gbm_bo_create_with_modifiers(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, + const uint64_t *modifiers, + const unsigned int count) +{ + if (width == 0 || height == 0) { + errno = EINVAL; + return NULL; + } + + if ((count && !modifiers) || (modifiers && !count)) { + errno = EINVAL; + return NULL; + } + + return gbm->bo_create(gbm, width, height, format, 0, modifiers, count); +} /** * Create a gbm buffer object from an foreign object * @@ -477,7 +496,23 @@ gbm_surface_create(struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, uint32_t flags) { - return gbm->surface_create(gbm, width, height, format, flags); + return gbm->surface_create(gbm, width, height, format, flags, NULL, 0); +} + +GBM_EXPORT struct gbm_surface * +gbm_surface_create_with_modifiers(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, + const uint64_t *modifiers, + const unsigned int count) +{ + if ((count && !modifiers) || (modifiers && !count)) { + errno = EINVAL; + return NULL; + } + + return gbm->surface_create(gbm, width, height, format, 0, + modifiers, count); } /** diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index e3e5d34d976..5f588dab58d 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -243,6 +243,12 @@ gbm_bo_create(struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, uint32_t flags); +struct gbm_bo * +gbm_bo_create_with_modifiers(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, + const uint64_t *modifiers, + const unsigned int count); #define GBM_BO_IMPORT_WL_BUFFER 0x5501 #define GBM_BO_IMPORT_EGL_IMAGE 0x5502 #define GBM_BO_IMPORT_FD 0x5503 @@ -345,6 +351,12 @@ gbm_surface_create(struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, uint32_t flags); +struct gbm_surface * +gbm_surface_create_with_modifiers(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, + const uint64_t *modifiers, + const unsigned int count); int gbm_surface_needs_lock_front_buffer(struct gbm_surface *surface); diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h index a6541d91c55..d8c9f6e5d7e 100644 --- a/src/gbm/main/gbmint.h +++ b/src/gbm/main/gbmint.h @@ -65,7 +65,9 @@ struct gbm_device { struct gbm_bo *(*bo_create)(struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, - uint32_t usage); + uint32_t usage, + const uint64_t *modifiers, + const unsigned int count); struct gbm_bo *(*bo_import)(struct gbm_device *gbm, uint32_t type, void *buffer, uint32_t usage); void *(*bo_map)(struct gbm_bo *bo, @@ -84,7 +86,9 @@ struct gbm_device { struct gbm_surface *(*surface_create)(struct gbm_device *gbm, uint32_t width, uint32_t height, - uint32_t format, uint32_t flags); + uint32_t format, uint32_t flags, + const uint64_t *modifiers, + const unsigned count); struct gbm_bo *(*surface_lock_front_buffer)(struct gbm_surface *surface); void (*surface_release_buffer)(struct gbm_surface *surface, struct gbm_bo *bo); @@ -114,6 +118,10 @@ struct gbm_surface { uint32_t height; uint32_t format; uint32_t flags; + struct { + uint64_t *modifiers; + unsigned count; + }; }; struct gbm_backend { |