[Mesa-dev] [PATCH 07/11 v3] gbm: add handle2(drm buffer region name)
Ander Conselvan de Oliveira
conselvan2 at gmail.com
Tue Jun 19 05:47:55 PDT 2012
On 06/14/2012 01:32 PM, Zhao Halley wrote:
> ---
> src/gbm/backends/dri/gbm_dri.c | 6 +++++-
> src/gbm/main/gbm.c | 14 ++++++++++++++
> src/gbm/main/gbm.h | 3 +++
> src/gbm/main/gbmint.h | 1 +
> 4 files changed, 23 insertions(+), 1 deletions(-)
> mode change 100644 => 100755 src/gbm/main/gbm.c
> mode change 100644 => 100755 src/gbm/main/gbmint.h
>
> diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
> index 9e2bd83..a71815f 100755
> --- a/src/gbm/backends/dri/gbm_dri.c
> +++ b/src/gbm/backends/dri/gbm_dri.c
> @@ -392,6 +392,8 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
> (int *)&bo->base.base.pitch);
> dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_FORMAT,
> &dri_format);
> + dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME,
> + (uint32_t *)&bo->base.base.handle2.u32);
This will cause a name to be allocated for the region even if the user
does not need it. Maybe this should be delayed until the user calls
gbm_bo_get_handle2().
> bo->base.base.format = gbm_dri_to_gbm_format(dri_format);
>
> @@ -460,7 +462,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
> &bo->base.base.handle.s32);
> dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
> (int *)&bo->base.base.pitch);
> -
> + dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME,
> + (uint32_t *)&bo->base.base.handle2.u32);
Same here.
> +
This line has whitespace errors.
> return&bo->base.base;
> }
>
> diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
> old mode 100644
> new mode 100755
> index 3994f86..f445bb1
> --- a/src/gbm/main/gbm.c
> +++ b/src/gbm/main/gbm.c
> @@ -231,6 +231,20 @@ gbm_bo_get_handle(struct gbm_bo *bo)
> return bo->handle;
> }
>
> +/** Get handle2 (buffer region name) of the buffer object
> + *
> + * This is stored in the platform generic union gbm_bo_handle type. However
> + * the format of this handle is platform specific.
> + *
> + * \param bo The buffer object
> + * \return Returns the handle of the allocated buffer object
> + */
> +GBM_EXPORT union gbm_bo_handle
> +gbm_bo_get_handle2(struct gbm_bo *bo)
I think gbm_bo_get_shared_handle() is a better name for this. And the
function documentation should explain what is the difference between
this and the handle returned by gbm_bo_get_handle().
BR,
Ander
> +{
> + return bo->handle2;
> +}
> +
> /** Write data into the buffer object
> *
> * If the buffer object was created with the GBM_BO_USE_WRITE flag,
> diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
> index b2a0aa3..25c9d37 100755
> --- a/src/gbm/main/gbm.h
> +++ b/src/gbm/main/gbm.h
> @@ -257,6 +257,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
> union gbm_bo_handle
> gbm_bo_get_handle(struct gbm_bo *bo);
>
> +union gbm_bo_handle
> +gbm_bo_get_handle2(struct gbm_bo *bo);
> +
> int
> gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
>
> diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
> old mode 100644
> new mode 100755
> index 8eb8671..5e48e89
> --- a/src/gbm/main/gbmint.h
> +++ b/src/gbm/main/gbmint.h
> @@ -95,6 +95,7 @@ struct gbm_bo {
> uint32_t pitch;
> uint32_t format;
> union gbm_bo_handle handle;
> + union gbm_bo_handle handle2;
> void *user_data;
> void (*destroy_user_data)(struct gbm_bo *, void *);
> };
More information about the mesa-dev
mailing list