diff options
author | Chuanbo Weng <chuanbo.weng@intel.com> | 2016-07-01 16:01:18 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-07-20 17:35:31 +0800 |
commit | 0be8687edc5b7793ca0777480eac61dfaa922b41 (patch) | |
tree | 0607546277a1d9e87841f48a63ae66cad8db080d /src/intel | |
parent | 33f5a328e36a1dc9826dc1c1695053fd863ff397 (diff) |
Runtime: set size member of cl_image created by clCreateImageFromFdINTEL.
The size need to be set, so clGetMemObjectInfo(.., CL_MEM_SIZE, ..) can
return actual size of this cl_image instead of 0.
Also some code refinement to make logic more clear.
Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/intel_driver.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c index a85ba006..e561725c 100644 --- a/src/intel/intel_driver.c +++ b/src/intel/intel_driver.c @@ -730,6 +730,9 @@ cl_buffer intel_share_image_from_libva(cl_context ctx, intel_bo = intel_driver_share_buffer_from_name((intel_driver_t *)ctx->drv, "shared from libva", bo_name); + if (intel_bo == NULL) + return NULL; + drm_intel_bo_get_tiling(intel_bo, &intel_tiling, &intel_swizzle_mode); image->tiling = get_cl_tiling(intel_tiling); @@ -760,6 +763,9 @@ cl_buffer intel_share_image_from_fd(cl_context ctx, intel_bo = intel_driver_share_buffer_from_fd((intel_driver_t *)ctx->drv, fd, image_size); + if (intel_bo == NULL) + return NULL; + drm_intel_bo_get_tiling(intel_bo, &intel_tiling, &intel_swizzle_mode); image->tiling = get_cl_tiling(intel_tiling); |