summaryrefslogtreecommitdiff
path: root/src/cl_mem_gl.c
AgeCommit message (Collapse)AuthorFilesLines
2014-11-11License: adjust all license version to LGPL v2.1+.Zhigang Gong1-1/+1
To make the license statement consistent to each other, adjust all license versions to v2.1+. Thus beignet should have a pure LGPL v2.1+ license. Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
2014-11-07support CL_MEM_USE_HOST_PTR with userptr for cl bufferGuo Yejun1-1/+1
userptr is used to wrap a memory pointer (page aligned) supplied by user space into a buffer object accessed by GPU, and so no extra copy is needed. It is supported starting from linux kernel 3.16 and libdrm 2.4.58. This patch is originally finished by Zhenyu Wang <zhenyuw@linux.intel.com>, I did a little change and some code clean. No regression issue found on IVB+Ubuntu14.10 with libdrm upgraded with tests: beignet/utests, piglit, OpenCV/test&perf, conformance/basic&mem_host_flags&buffers V2: add page align limit for data size, add comments for kernel without MMU_NOTIFIER V3: add runtime check with host_unified_memory, return CL_MEM_OBJECT_ALLOCATION_FAILURE if failed Signed-off-by: Guo Yejun <yejun.guo@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
2013-09-26we should check the 'err' parameterLu Guanqun1-4/+2
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-09-06CL: Enalbe gl sharing with new egl extension.Zhigang Gong1-143/+10
The previous implementation is only for 2d/3d texture sharing and is implemented in a hacky fashinon. We need to replace it with a clean and complete one. We introduce a new egl extension to export low level layout information of a buffer object/texture/render buffer from the mesa dri driver to the cl driver layer. As the extension is not accpepted by mesa, we have to implement this new extension in beignet internally. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Tested-by: He Junyan <junyan.he@inbox.com>
2013-08-30CL: Refactor cl_mem's implementation.Zhigang Gong1-52/+41
The buffer object is much simpler than the image object. We'd better to not use the same big data structure for both objects. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: "Lu, Guanqun" <guanqun.lu@intel.com>
2013-07-12CL: Refine the version string handling.Zhigang Gong1-1/+1
Now concentrate the version assignment at the root cmake files. All the other place will refer the specified macros other than hard coded a number. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: Song, Ruiling <ruiling.song@intel.com>
2013-07-03CL: destroy the EGL image which is created for gl sharing when delete the ↵Zhigang Gong1-0/+9
mem object. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-06-19update to OpenCL 1.1 headerHomer Hsing1-0/+4
Based on our current progress, we plan to implement OpenCL 1.1 rather than OpenCL 1.2 for the next release. Thus we downgrade the header file to 1.1 in this commit. put OpenCL 1.1 header in include/CL/ add OpenCL 1.2 defs, used by some code, by "#ifndef CL_VERSION_1.2" " some OpenCL 1.2 defs" "#endif" add OCL_CREATE_IMAGE2D, OCL_CREATE_IMAGE3D, OCL_CREATE_GL_IMAGE2D, OCL_CREATE_GL_IMAGE3D update test cases Signed-off-by: Homer Hsing <homer.xing@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-05-20Save depth and slice_pitch in cl_mem images.Dag Lem1-1/+3
Signed-off-by: Dag Lem <dag@nimrod.no>
2013-04-18Avoid extension names as preprocessor tokensSimon Richter1-5/+1
The Khronos Group headers define constants with the names of extensions if the header defines the extension API. When the preprocessor sees one of these names, it performs macro substitution, leading to compilation errors. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-04-10Implement cl_khr_gl_sharing by using upstream technology.Zhigang Gong1-62/+65
The previous implementation use a modified mesa library and can't work with upstream mesa. Now I managed to use existing egl extension and gbm to import a gl texture to a cl image. Actually, the gbm can't fully support our purpose, as it can't lookup image for egl x11 platform. We have to touch gbm's internal data structure to manually initialize its image extension. Furthermore, gbm only provide the API to get the image's handle, and doesn't provide the one to get image's name. As we are using different fd from the existing GL loader. The handle is useless for us. I use the DRI2 image extension function directly to get the name rather than the handle. And it works well. Now, after this patch applied. The cl_khr_gl_sharing could work with upstream mesa. I recommend you use the latest git master version. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Tested-by: Homer Hsing <homer.xing@intel.com>
2013-04-10implement OCL 1.2 new APIs.Zhigang Gong1-29/+26
clCreateImage2D and clCreateFromGLTexture2D have been deprecated from OCL1.2, we need to implement the new API clCreateImage/clCreateFromGLTexture to replace them. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: Homer Hsing <homer.xing@intel.com>
2013-03-29update headers to OpenCL 1.2 standardsLu Guanqun1-6/+6
The header files are downloaded from this link: http://www.khronos.org/registry/cl/ And there are several other fixes due to this header update: - change cl_mem_type to cl_mem_object_type - change CL_INVALID_MEM to CL_INVALID_MEM_OBJECT - change CL_INVALID_TEXTURE to CL_INVALID_IMAGE_DESCRIPTOR - change CL_MEM_ALLOCATION_FAILURE to CL_MEM_OBJECT_ALLOCATION_FAILURE Signed-off-by: Lu Guanqun <guanqun.lu@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-03-29First implementation for extension cl_khr_gl_sharing.Zhigang Gong1-0/+232
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>