[Beignet] [PATCH] fix issue when create cl image from libva with offset
Zhigang Gong
zhigang.gong at linux.intel.com
Tue Jun 10 18:40:55 PDT 2014
LGTM, will push latter. thanks.
On Mon, Jun 09, 2014 at 08:39:33AM +0800, Guo Yejun wrote:
> to share data between libva and ocl (at drm level), it is acceptable
> to create cl image from libva with offset (to drm object). Correct
> the bo offset whose value will finally go to ss1.base_addr.
>
> Signed-off-by: Guo Yejun <yejun.guo at intel.com>
> ---
> src/cl_driver.h | 2 +-
> src/cl_mem.c | 2 +-
> src/intel/intel_driver.c | 4 +++-
> 3 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/cl_driver.h b/src/cl_driver.h
> index 3e01c92..68b323c 100644
> --- a/src/cl_driver.h
> +++ b/src/cl_driver.h
> @@ -242,7 +242,7 @@ extern cl_buffer_release_from_texture_cb *cl_buffer_release_from_texture;
> typedef cl_buffer (cl_buffer_get_buffer_from_libva_cb)(cl_context ctx, unsigned int bo_name, size_t *sz);
> extern cl_buffer_get_buffer_from_libva_cb *cl_buffer_get_buffer_from_libva;
>
> -typedef cl_buffer (cl_buffer_get_image_from_libva_cb)(cl_context ctx, unsigned int bo_name, struct _cl_mem_image *image);
> +typedef cl_buffer (cl_buffer_get_image_from_libva_cb)(cl_context ctx, unsigned int bo_name, struct _cl_mem_image *image, unsigned int offset);
> extern cl_buffer_get_image_from_libva_cb *cl_buffer_get_image_from_libva;
>
> /* Unref a buffer and destroy it if no more ref */
> diff --git a/src/cl_mem.c b/src/cl_mem.c
> index 6369ba9..2f03935 100644
> --- a/src/cl_mem.c
> +++ b/src/cl_mem.c
> @@ -1365,7 +1365,7 @@ LOCAL cl_mem cl_mem_new_libva_image(cl_context ctx,
>
> image = cl_mem_image(mem);
>
> - mem->bo = cl_buffer_get_image_from_libva(ctx, bo_name, image);
> + mem->bo = cl_buffer_get_image_from_libva(ctx, bo_name, image, offset);
>
> image->w = width;
> image->h = height;
> diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
> index 989193a..d797937 100644
> --- a/src/intel/intel_driver.c
> +++ b/src/intel/intel_driver.c
> @@ -632,13 +632,15 @@ cl_buffer intel_share_buffer_from_libva(cl_context ctx,
>
> cl_buffer intel_share_image_from_libva(cl_context ctx,
> unsigned int bo_name,
> - struct _cl_mem_image *image)
> + struct _cl_mem_image *image,
> + unsigned int offset)
> {
> drm_intel_bo *intel_bo;
> uint32_t intel_tiling, intel_swizzle_mode;
>
> intel_bo = intel_driver_share_buffer((intel_driver_t *)ctx->drv, "shared from libva", bo_name);
>
> + intel_bo->offset += offset;
> drm_intel_bo_get_tiling(intel_bo, &intel_tiling, &intel_swizzle_mode);
> image->tiling = get_cl_tiling(intel_tiling);
>
> --
> 1.8.3.2
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list