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

Ben Widawsky ben at bwidawsk.net
Thu Jan 12 19:54:32 UTC 2017


On 17-01-12 14:33:01, Daniel Stone wrote:
>On 12 January 2017 at 14:32, Daniel Stone <daniel at fooishbar.org> wrote:
>> If allocated, this image is just leaked, along with its reference on
>> the BO. Same problem in gbm_dri_bo_get_handle_for_plane.
>
>... and gbm_dri_bo_get_offset.
>
>Cheers,
>Daniel

Does this work (compile tested only)?

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 656fef3481..3c44c24d81 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -684,6 +684,9 @@ gbm_dri_bo_get_stride(struct gbm_bo *_bo, int plane)

    dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);

+   if (image != bo->image)
+      dri->image->destroyImage(image);
+
    return (uint32_t)stride;
 }



More information about the mesa-dev mailing list