[Mesa-dev] [PATCH] gbm: add gbm_{bo, surface}_create_with_modifiers2

Daniel Stone daniel at fooishbar.org
Tue Jun 25 09:06:32 UTC 2019


Hi,

On Mon, 24 Jun 2019 at 19:51, Simon Ser <contact at emersion.fr> wrote:
> +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);

This will trip an assert inside gbm_dri_bo_create:
   /* 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));

You can fix this without modifying the libgbm <-> backend interface,
given that the two should be tightly coupled together. But within
Mesa, you'll need a new version of the DRIimageExtension, adding a
createImageWithModifiers2() which re-adds the flags, given that
they're not there in the current createImageWithModifiers() hook.

Cheers,
Daniel


More information about the mesa-dev mailing list