enable create image 2d from buffer in clCreateImage

Graphics / Beignet - Luo Xionghu [intel.com] - 22 September 2015 03:15 UTC

this patch allows create 2d image with a cl buffer with zero copy.

v2: should use reference to manage the release the buffer and image. After being created, the buffer reference count is 2, and image reference count is 1. if image is released first, decrease the image reference count and buffer reference count both, release the bo when the buffer is released at last; if buffer is released first, decrease the buffer reference count only, release the buffer when the image is released. add CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT in cl_device_info.

v3: move is_image_from_buffer to _cl_mem_image; return CL_INVALID_IMAGE_SIZE if image size is larger than the buffer.

v4: pitchalignment set to 2.

9aa056e enable create image 2d from buffer in clCreateImage.
src/cl_api.c | 3 +-
src/cl_device_id.c | 2 +
src/cl_device_id.h | 2 +
src/cl_extensions.c | 2 +
src/cl_gt_device.h | 3 +-
src/cl_mem.c | 115 +++++++++++++++++++++++++++++++++++++++------------
src/cl_mem.h | 1 +
7 files changed, 99 insertions(+), 29 deletions(-)

Upstream: cgit.freedesktop.org


  • Share