summaryrefslogtreecommitdiff
path: root/src/intel/intel_driver.c
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@intel.com>2013-10-17 13:11:01 +0800
committerZhigang Gong <zhigang.gong@intel.com>2013-10-18 12:17:54 +0800
commitb65be48cbd96334c097ddf4afeee70539e7c5e6b (patch)
treec76a3ae626d2aa8713b7ef0eaab472678c6cdb37 /src/intel/intel_driver.c
parent7137485c0418b9f8ca4c1e4d4a158b7ff0454089 (diff)
add clCreateBufferFromLibvaIntel() api
We can pass in libva's buffer object name and then create the cl buffer from it, thus we can share the buffer between libva and our opencl. Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/intel/intel_driver.c')
-rw-r--r--src/intel/intel_driver.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index cc339144..dc194fe0 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -583,6 +583,20 @@ intel_release_buffer_from_texture(cl_context ctx, unsigned int target,
}
#endif
+cl_buffer intel_share_buffer_from_libva(cl_context ctx,
+ unsigned int bo_name,
+ size_t *sz)
+{
+ drm_intel_bo *intel_bo;
+
+ intel_bo = intel_driver_share_buffer((intel_driver_t *)ctx->drv, "shared from libva", bo_name);
+
+ if (sz)
+ *sz = intel_bo->size;
+
+ return (cl_buffer)intel_bo;
+}
+
static int32_t get_intel_tiling(cl_int tiling, uint32_t *intel_tiling)
{
switch (tiling) {
@@ -630,6 +644,7 @@ intel_setup_callbacks(void)
cl_buffer_release_from_texture = (cl_buffer_release_from_texture_cb *) intel_release_buffer_from_texture;
intel_set_cl_gl_callbacks();
#endif
+ cl_buffer_get_buffer_from_libva = (cl_buffer_get_buffer_from_libva_cb *) intel_share_buffer_from_libva;
cl_buffer_reference = (cl_buffer_reference_cb *) drm_intel_bo_reference;
cl_buffer_unreference = (cl_buffer_unreference_cb *) drm_intel_bo_unreference;
cl_buffer_map = (cl_buffer_map_cb *) drm_intel_bo_map;