diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 1c2b9898716..d4eee4db717 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -1185,11 +1185,6 @@ gbm_dri_bo_create(struct gbm_device *gbm, int dri_format; unsigned dri_use = 0; - /* Callers of this may specify a modifier, or a dri usage, but not both. The - * newer modifier interface deprecates the older usage flags. - */ - assert(!(usage && count)); - format = gbm_core.v0.format_canonicalize(format); if (usage & GBM_BO_USE_WRITE || dri->image == NULL) diff --git a/src/gbm/gbm-symbols.txt b/src/gbm/gbm-symbols.txt index 8cdbc21fc33..d3c99b0c389 100644 --- a/src/gbm/gbm-symbols.txt +++ b/src/gbm/gbm-symbols.txt @@ -1,5 +1,6 @@ gbm_bo_create gbm_bo_create_with_modifiers +gbm_bo_create_with_modifiers2 gbm_bo_destroy gbm_bo_get_bpp gbm_bo_get_device @@ -30,6 +31,7 @@ gbm_device_is_format_supported gbm_format_get_name gbm_surface_create gbm_surface_create_with_modifiers +gbm_surface_create_with_modifiers2 gbm_surface_destroy gbm_surface_has_free_buffers gbm_surface_lock_front_buffer diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index ffe83351a23..5c722add96a 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -496,6 +496,18 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm, uint32_t format, const uint64_t *modifiers, const unsigned int count) +{ + return gbm_bo_create_with_modifiers2(gbm, width, height, format, modifiers, + count, 0); +} + +GBM_EXPORT 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) { if (width == 0 || height == 0) { errno = EINVAL; @@ -507,7 +519,12 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm, return NULL; } - return gbm->v0.bo_create(gbm, width, height, format, 0, modifiers, count); + if (modifiers && (flags & GBM_BO_USE_LINEAR)) { + errno = EINVAL; + return NULL; + } + + return gbm->v0.bo_create(gbm, width, height, format, flags, modifiers, count); } /** @@ -630,13 +647,30 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm, uint32_t format, const uint64_t *modifiers, const unsigned int count) +{ + return gbm_surface_create_with_modifiers2(gbm, width, height, format, + modifiers, count, 0); +} + +GBM_EXPORT 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 && !modifiers) || (modifiers && !count)) { errno = EINVAL; return NULL; } - return gbm->v0.surface_create(gbm, width, height, format, 0, + if (modifiers && (flags & GBM_BO_USE_LINEAR)) { + errno = EINVAL; + return NULL; + } + + return gbm->v0.surface_create(gbm, width, height, format, flags, modifiers, count); } diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 6117b355496..a963ed78e48 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -281,6 +281,15 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm, uint32_t format, const uint64_t *modifiers, 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_EGL_IMAGE 0x5502 #define GBM_BO_IMPORT_FD 0x5503 @@ -413,6 +422,14 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm, const uint64_t *modifiers, 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 * gbm_surface_lock_front_buffer(struct gbm_surface *surface);