The previous implementation is using the existing egl extension to convert a texture to a egl image and then hack the gbm to get the image's attributes including the layout and the drm buffer object name then create a corresponding cl image.
The restrications of that solution is: 1. It doens't support buffer object/render buffer. 2. It doesn't support non-zero mipmap level. To overcome the above restrications, we need to introduce a new EGL extension to export low level attribute of texture/buffer object/ render buffer to cl driver layer from the mesa dri driver layer. Unfortunately, the mesa community doesn't accept the new extension. I have to implement it in beignet. Thus we still have to do some level of hack here. Major including to access some _EGLXXX internal data structure and some mesa internal data structure. So we need the mesa's source code when you want to build beignet with cl_khr_gl_sharing support. You could put the mesa source code package to ~/mesa or at the same directory of the beignet source dir, or you can use MESA_SOURCE_DIR to specify the directory of the mesa source code. If beignet can't find the mesa source code directory, cl_khr_gl_sharing will be disabled. This patchset implement the texture sharing and the framework for the buffer object/render buffer sharing. Zhigang Gong (2): CL: Refactor cl_mem's implementation. CL: Enalbe gl sharing with new egl extension. CMake/FindEGL.cmake | 14 ++ src/CMakeLists.txt | 19 +- src/cl_api.c | 44 ++-- src/cl_command_queue.c | 16 +- src/cl_context.h | 3 + src/cl_driver.h | 66 +++--- src/cl_driver_defs.c | 10 +- src/cl_driver_type.h | 24 +++ src/cl_enqueue.c | 19 +- src/cl_extensions.c | 22 +- src/cl_extensions.h | 25 --- src/cl_kernel.c | 4 +- src/cl_khr_icd.h | 4 + src/cl_mem.c | 165 +++++++++------ src/cl_mem.h | 111 ++++++++-- src/cl_mem_gl.c | 194 +++--------------- src/cl_utils.h | 10 +- src/intel/intel_dri_resource_sharing.c | 208 +++++++++++++++++++ src/intel/intel_dri_resource_sharing.h | 39 ++++ src/intel/intel_dri_resource_sharing_int.h | 143 +++++++++++++ src/intel/intel_driver.c | 224 +++++++++++++++----- src/intel/intel_driver.h | 6 - src/x11/dricommon.h | 5 - src/x11/gbm_deps/backend.h | 36 ---- src/x11/gbm_deps/common.h | 42 ---- src/x11/gbm_deps/common_drm.h | 48 ----- src/x11/gbm_deps/gbm.h | 292 -------------------------- src/x11/gbm_deps/gbm_driint.h | 108 ---------- src/x11/gbm_deps/gbmint.h | 116 ----------- src/x11/gbm_dri2_x11_platform.c | 126 ------------ src/x11/mesa_egl_extension.c | 307 ++++++++++++++++++++++++++++ src/x11/mesa_egl_extension.h | 20 ++ src/x11/mesa_egl_res_share.c | 135 ++++++++++++ src/x11/mesa_egl_res_share.h | 44 ++++ utests/CMakeLists.txt | 4 +- utests/utest_helper.cpp | 25 ++- 36 files changed, 1459 insertions(+), 1219 deletions(-) create mode 100644 src/cl_driver_type.h create mode 100644 src/intel/intel_dri_resource_sharing.c create mode 100644 src/intel/intel_dri_resource_sharing.h create mode 100644 src/intel/intel_dri_resource_sharing_int.h delete mode 100644 src/x11/gbm_deps/backend.h delete mode 100644 src/x11/gbm_deps/common.h delete mode 100644 src/x11/gbm_deps/common_drm.h delete mode 100644 src/x11/gbm_deps/gbm.h delete mode 100644 src/x11/gbm_deps/gbm_driint.h delete mode 100644 src/x11/gbm_deps/gbmint.h delete mode 100644 src/x11/gbm_dri2_x11_platform.c create mode 100644 src/x11/mesa_egl_extension.c create mode 100644 src/x11/mesa_egl_extension.h create mode 100644 src/x11/mesa_egl_res_share.c create mode 100644 src/x11/mesa_egl_res_share.h -- 1.7.9.5 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
