[Mesa-dev] [PATCH] gbm: add gbm_{bo, surface}_create_with_modifiers2
Tapani Pälli
tapani.palli at intel.com
Tue Jun 25 06:16:25 UTC 2019
On 6/24/19 9:51 PM, Simon Ser wrote:
> 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 <contact at emersion.fr>
> ---
> src/gbm/main/gbm.c | 38 ++++++++++++++++++++++++++++++++++++++
> src/gbm/main/gbm.h | 17 +++++++++++++++++
> 2 files changed, 55 insertions(+)
>
> diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
> index 38480ca966c6..ca68a3292327 100644
> --- a/src/gbm/main/gbm.c
> +++ b/src/gbm/main/gbm.c
> @@ -491,6 +491,27 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm,
> return gbm->bo_create(gbm, width, height, format, 0, modifiers, count);
> }
>
> +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 usage)
> +{
> + 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, usage, modifiers, count);
> +}
> +
> /**
> * Create a gbm buffer object from a foreign object
> *
> @@ -616,6 +637,23 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm,
> modifiers, count);
> }
>
> +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->surface_create(gbm, width, height, format, flags,
> + modifiers, count);
> +}
> +
> /**
> * Destroys the given surface and frees all resources associated with
> * it.
> diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
> index 9b5288710a5b..0bb2e4443f97 100644
> --- a/src/gbm/main/gbm.h
> +++ b/src/gbm/main/gbm.h
> @@ -263,6 +263,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);
Declaration here says 'flags' while definition says 'usage'.
I noticed that original patch (v1) for gbm_bo_create_with_modifiers did
have usage at first but it was removed during the review. I'm having
trouble digging what was the reason for this?
> +
> #define GBM_BO_IMPORT_WL_BUFFER 0x5501
> #define GBM_BO_IMPORT_EGL_IMAGE 0x5502
> #define GBM_BO_IMPORT_FD 0x5503
> @@ -390,6 +399,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);
>
> --
> 2.22.0
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list