mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
feature(ocl): Improve Linux CL/GL sharing support
This commit is aimed at drastically improving the support for the CL/GL sharing extension on linux. The current support is not really usable as it only supports a few texture format, and only on EGL contexts. It is also pretty buggy since it requires the texture to be bound when placing the CL call to share it which is just plain wrong and will not work in many applications. This new version makes used of the "official" interop extension from MESA which is available for GLX and EGL contexts, allows sharing of buffers and not just texture and supports many more formats. This is still far from being a fully compliant / full featured version of the extension, but it's a big step forward in my opinion and allows to run some real applications. I've tested gr-fosphor (SDR spectrum display) and Davinci Resolve as examples. Both of theses don't work without theses improvements. Fixes: https://github.com/intel/compute-runtime/issues/659 Fixes: https://github.com/intel/compute-runtime/issues/667 https://github.com/intel/compute-runtime/pull/673 Related-To: NEO-3599 Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
80aa55a3cb
commit
e2c511bc00
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -29,31 +29,16 @@ class GlSharingFunctionsMock : public GLSharingFunctionsLinux {
|
||||
public:
|
||||
~GlSharingFunctionsMock() override = default;
|
||||
|
||||
using GLSharingFunctionsLinux::eglMakeCurrent;
|
||||
using GLSharingFunctionsLinux::glAcquireSharedBuffer;
|
||||
using GLSharingFunctionsLinux::glAcquireSharedRenderBuffer;
|
||||
using GLSharingFunctionsLinux::glAcquireSharedTexture;
|
||||
using GLSharingFunctionsLinux::glGetCurrentContext;
|
||||
using GLSharingFunctionsLinux::glGetCurrentDisplay;
|
||||
using GLSharingFunctionsLinux::eglGLInteropExportObject;
|
||||
using GLSharingFunctionsLinux::eglGLInteropFlushObjects;
|
||||
using GLSharingFunctionsLinux::eglGLInteropQueryDeviceInfo;
|
||||
|
||||
using GLSharingFunctionsLinux::glGetIntegerv;
|
||||
using GLSharingFunctionsLinux::glGetString;
|
||||
using GLSharingFunctionsLinux::glGetStringi;
|
||||
using GLSharingFunctionsLinux::glGetSynciv;
|
||||
using GLSharingFunctionsLinux::glReleaseSharedBuffer;
|
||||
using GLSharingFunctionsLinux::glReleaseSharedRenderBuffer;
|
||||
using GLSharingFunctionsLinux::glReleaseSharedTexture;
|
||||
using GLSharingFunctionsLinux::glReleaseSync;
|
||||
using GLSharingFunctionsLinux::glRetainSync;
|
||||
using GLSharingFunctionsLinux::glSetSharedOCLContextState;
|
||||
using GLSharingFunctionsLinux::isOpenGlExtensionSupported;
|
||||
using GLSharingFunctionsLinux::pfnEglCreateContext;
|
||||
using GLSharingFunctionsLinux::pfnEglDeleteContext;
|
||||
using GLSharingFunctionsLinux::pfnEglShareLists;
|
||||
using GLSharingFunctionsLinux::setSharedOCLContextState;
|
||||
|
||||
using GLSharingFunctionsLinux::glArbEventMapping;
|
||||
using GLSharingFunctionsLinux::glContextHandle;
|
||||
using GLSharingFunctionsLinux::glDeviceHandle;
|
||||
|
||||
using GLSharingFunctionsLinux::getSupportedFormats;
|
||||
using GLSharingFunctionsLinux::pfnGlArbSyncObjectCleanup;
|
||||
@@ -64,8 +49,6 @@ class GlSharingFunctionsMock : public GLSharingFunctionsLinux {
|
||||
GlSharingFunctionsMock(GLType glHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle)
|
||||
: GLSharingFunctionsLinux(glHDCType, glHGLRCHandle, glHGLRCHandleBkpCtx, glHDCHandle) {
|
||||
initMembers();
|
||||
updateOpenGLContext();
|
||||
createBackupContext();
|
||||
}
|
||||
GlSharingFunctionsMock();
|
||||
|
||||
@@ -76,9 +59,11 @@ class GlSharingFunctionsMock : public GLSharingFunctionsLinux {
|
||||
this->glHDCHandle = glHDCHandle;
|
||||
}
|
||||
|
||||
void setGLAcquireSharedBufferMock(PFNOGLAcquireSharedBufferINTEL mock) { glAcquireSharedBuffer = mock; }
|
||||
void setGLInteropQueryDeviceInfoMock(PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC mock) { eglGLInteropQueryDeviceInfo = mock; }
|
||||
|
||||
void setGLAcquireSharedTextureMock(PFNEGLEXPORTDMABUFIMAGEMESAPROC mock) { glAcquireSharedTexture = mock; }
|
||||
void setGLInteropExportObjectMock(PFNMESAGLINTEROPEGLEXPORTOBJECTPROC mock) { eglGLInteropExportObject = mock; }
|
||||
|
||||
void setGLInteropFlushObjectsMock(PFNMESAGLINTEROPEGLFLUSHOBJECTSPROC mock) { eglGLInteropFlushObjects = mock; }
|
||||
};
|
||||
|
||||
class MockGlSharing {
|
||||
@@ -117,7 +102,6 @@ class MockGlSharing {
|
||||
class MockGLSharingFunctions : public GLSharingFunctionsLinux {
|
||||
public:
|
||||
using GLSharingFunctionsLinux::isOpenGlExtensionSupported;
|
||||
using GLSharingFunctionsLinux::setSharedOCLContextState;
|
||||
|
||||
static void glGetIntegervTest(GLenum pname, GLint *data) {
|
||||
if (pname == GL_NUM_EXTENSIONS)
|
||||
|
||||
Reference in New Issue
Block a user