[Beignet] [PATCH 1/2] Fix a CL_MEM_HOST_PTR bug.
Zhigang Gong
zhigang.gong at linux.intel.com
Sun Jun 22 23:41:48 PDT 2014
LGTM, will push latter. Thanks.
On Mon, Jun 23, 2014 at 10:38:35PM +0800, Yang Rong wrote:
> Can't add sub_offset if mem is image.
>
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
> src/cl_mem.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/cl_mem.c b/src/cl_mem.c
> index e0c4ec9..46d9af1 100644
> --- a/src/cl_mem.c
> +++ b/src/cl_mem.c
> @@ -71,7 +71,6 @@ cl_get_mem_object_info(cl_mem mem,
> void *param_value,
> size_t *param_value_size_ret)
> {
> - struct _cl_mem_buffer* buf = (struct _cl_mem_buffer*)mem;
> switch(param_name)
> {
> FIELD_SIZE(MEM_TYPE, cl_mem_object_type);
> @@ -99,7 +98,12 @@ cl_get_mem_object_info(cl_mem mem,
> *((size_t *)param_value) = mem->size;
> break;
> case CL_MEM_HOST_PTR:
> - *((size_t *)param_value) = (size_t)mem->host_ptr + buf->sub_offset;
> + if(mem->type == CL_MEM_IMAGE_TYPE) {
> + *((size_t *)param_value) = (size_t)mem->host_ptr;
> + } else {
> + struct _cl_mem_buffer* buf = (struct _cl_mem_buffer*)mem;
> + *((size_t *)param_value) = (size_t)mem->host_ptr + buf->sub_offset;
> + }
> break;
> case CL_MEM_MAP_COUNT:
> *((cl_uint *)param_value) = mem->map_ref;
> --
> 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