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

Daniel Stone daniel at fooishbar.org
Thu Jan 12 14:32:15 UTC 2017


Hi Ben,

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

If allocated, this image is just leaked, along with its reference on
the BO. Same problem in gbm_dri_bo_get_handle_for_plane.

Cheers,
Daniel


More information about the mesa-dev mailing list