[Mesa-dev] [PATCH 08/32] gbm: Export a per plane getter for offset

Daniel Stone daniel at fooishbar.org
Thu Jan 12 19:01:04 UTC 2017


 Hi,

On 3 January 2017 at 02:36, Ben Widawsky <ben at bwidawsk.net> wrote:
> +static uint32_t
> +gbm_dri_bo_get_offset(struct gbm_bo *_bo, int plane)
> +{
> +   struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm);
> +   struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
> +   int offset = 0;
> +
> +   if (!dri->image || dri->image->base.version < 13 || !dri->image->fromPlanar) {
> +      errno = ENOSYS;
> +      return 0;
> +   }
> +
> +   if (plane >= get_number_planes(dri, bo->image))
> +      return 0;
> +
> +   __DRIimage *image = dri->image->fromPlanar(bo->image, plane, NULL);
> +   if (!image) {
> +      /* Use the parent offset */
> +      image = bo->image;
> +   }

You can probably guess what I'm going to say here.

Cheers,
Daniel


More information about the mesa-dev mailing list