From: Simon Ser Date: Sun, 22 Dec 2019 20:46:57 +0000 (+0100) Subject: gbm: add gbm_{bo,surface}_create_with_modifiers2 X-Git-Tag: upstream/22.3.5~17236 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=268e12c605341eedfda22bdbbf623aa123a290e8;p=platform%2Fupstream%2Fmesa.git gbm: add gbm_{bo,surface}_create_with_modifiers2 gbm_{bo,surface}_create_with_modifiers is missing the usage flags. Add a new function which lets library users specify it. Signed-off-by: Simon Ser Reviewed-by: James Jones Reviewed-by: Daniel Stone Part-of: --- diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 1c2b989..d4eee4d 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 8cdbc21..d3c99b0 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 ffe8335..5c722ad 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -497,6 +497,18 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm, 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; return NULL; @@ -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); } /** @@ -631,12 +648,29 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm, 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 6117b35..a963ed7 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);