diff --git a/opencl/test/unit_test/api/gl/cl_get_gl_context_info_khr_tests.cpp b/opencl/test/unit_test/api/gl/cl_get_gl_context_info_khr_tests.cpp index 7ba7270b67..560aa295da 100644 --- a/opencl/test/unit_test/api/gl/cl_get_gl_context_info_khr_tests.cpp +++ b/opencl/test/unit_test/api/gl/cl_get_gl_context_info_khr_tests.cpp @@ -12,7 +12,7 @@ #include "opencl/test/unit_test/api/cl_api_tests.h" #include "opencl/test/unit_test/mocks/mock_device.h" #include "opencl/test/unit_test/mocks/mock_platform.h" -#include "opencl/test/unit_test/sharings/gl/windows/gl_dll_helper.h" +#include "opencl/test/unit_test/sharings/gl/gl_dll_helper.h" using namespace NEO; @@ -83,7 +83,7 @@ TEST_F(clGetGLContextInfoKHR_, givenContextFromNoIntelOpenGlDriverWhenCallClGetG cl_device_id retDevice = 0; size_t retSize = 0; const cl_context_properties properties[] = {CL_GL_CONTEXT_KHR, 1, CL_WGL_HDC_KHR, 2, 0}; - glDllHelper setDllParam; + GlDllHelper setDllParam; setDllParam.glSetString("NoIntel", GL_VENDOR); retVal = clGetGLContextInfoKHR(properties, 0, sizeof(cl_device_id), &retDevice, &retSize); @@ -96,7 +96,7 @@ TEST_F(clGetGLContextInfoKHR_, givenNullVersionFromIntelOpenGlDriverWhenCallClGe cl_device_id retDevice = 0; size_t retSize = 0; const cl_context_properties properties[] = {CL_GL_CONTEXT_KHR, 1, CL_WGL_HDC_KHR, 2, 0}; - glDllHelper setDllParam; + GlDllHelper setDllParam; setDllParam.glSetString("", GL_VERSION); retVal = clGetGLContextInfoKHR(properties, 0, sizeof(cl_device_id), &retDevice, &retSize); diff --git a/opencl/test/unit_test/mock_gl/windows/mock_opengl32.cpp b/opencl/test/unit_test/mock_gl/windows/mock_opengl32.cpp index b369eb0914..7161cbe815 100644 --- a/opencl/test/unit_test/mock_gl/windows/mock_opengl32.cpp +++ b/opencl/test/unit_test/mock_gl/windows/mock_opengl32.cpp @@ -327,7 +327,7 @@ void memParam() { memset(&bufferInfoOutput, 0, sizeof(CL_GL_BUFFER_INFO)); memset(&textureInfoInput, 0, sizeof(CL_GL_RESOURCE_INFO)); memset(&textureInfoOutput, 0, sizeof(CL_GL_RESOURCE_INFO)); - memset(&glMockReturnedValues, 0, sizeof(GLMockReturnedValues)); + memset(&glMockReturnedValues, 0, sizeof(NEO::GLMockReturnedValues)); }; void loadBuffer(CL_GL_BUFFER_INFO buff) { bufferInfoOutput = buff; }; void loadTexture(CL_GL_RESOURCE_INFO texture) { textureInfoOutput = texture; }; diff --git a/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.cpp b/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.cpp index 1961b4783c..d6f0aec3f6 100644 --- a/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.cpp +++ b/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.cpp @@ -23,7 +23,7 @@ GLXBkpContextParams glxBkpContextParams = {0}; void GlSharingFunctionsMock::initMembers() { GLSharingFunctionsWindows::initGLFunctions(); - glDllHelper dllParam; + GlDllHelper dllParam; dllParam.setGLSetSharedOCLContextStateReturnedValue(1u); dllParam.resetParam(""); dllParam.loadTexture({0}); diff --git a/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h b/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h index 8e7912f60f..c74f9f17c0 100644 --- a/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h +++ b/opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h @@ -8,7 +8,7 @@ #pragma once #include "opencl/extensions/public/cl_gl_private_intel.h" #include "opencl/source/sharings/gl/windows/gl_sharing_windows.h" -#include "opencl/test/unit_test/sharings/gl/windows/gl_dll_helper.h" +#include "opencl/test/unit_test/sharings/gl/gl_dll_helper.h" #include "config.h" @@ -170,7 +170,7 @@ class MockGlSharing { } std::unique_ptr sharingFunctions = std::make_unique(); - std::unique_ptr dllParam = std::make_unique(); + std::unique_ptr dllParam = std::make_unique(); CL_GL_RESOURCE_INFO m_clGlResourceInfo = {0}; GL_CL_RESOURCE_INFO m_glClResourceInfo = {0}; CL_GL_BUFFER_INFO m_bufferInfoOutput = {0}; @@ -191,7 +191,7 @@ class MockGLSharingFunctions : public GLSharingFunctionsWindows { }; using GLSharingFunctionsWindows::glGetIntegerv; using GLSharingFunctionsWindows::glGetString; - std::unique_ptr dllParam = std::make_unique(); + std::unique_ptr dllParam = std::make_unique(); MockGLSharingFunctions() { GLSharingFunctionsWindows::initGLFunctions(); MockGLSharingFunctions::SharingEnabled = 1; diff --git a/opencl/test/unit_test/sharings/gl/CMakeLists.txt b/opencl/test/unit_test/sharings/gl/CMakeLists.txt index 24658f6d0c..a4da1f6d0c 100644 --- a/opencl/test/unit_test/sharings/gl/CMakeLists.txt +++ b/opencl/test/unit_test/sharings/gl/CMakeLists.txt @@ -6,6 +6,7 @@ set(IGDRCL_SRCS_tests_sharings_gl ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/gl_dll_helper.h ) target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_sharings_gl}) add_subdirectories() diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_dll_helper.h b/opencl/test/unit_test/sharings/gl/gl_dll_helper.h similarity index 97% rename from opencl/test/unit_test/sharings/gl/windows/gl_dll_helper.h rename to opencl/test/unit_test/sharings/gl/gl_dll_helper.h index f03cda2aa4..377d9f569c 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_dll_helper.h +++ b/opencl/test/unit_test/sharings/gl/gl_dll_helper.h @@ -12,17 +12,16 @@ #include "opencl/extensions/public/cl_gl_private_intel.h" -#include "Gl/gl.h" +#include "GL/gl.h" #include -using namespace NEO; namespace Os { extern const char *openglDllName; } + namespace NEO { struct GLMockReturnedValues; -} using GLString = void (*)(const char *, unsigned int); using GLSharedOCLContext = void (*)(GLboolean); @@ -36,9 +35,9 @@ using TextureInfo = CL_GL_RESOURCE_INFO (*)(); using GLMockValue = GLMockReturnedValues (*)(); using setGLMockValue = void (*)(GLMockReturnedValues); -struct glDllHelper { +struct GlDllHelper { public: - glDllHelper() { + GlDllHelper() { glDllLoad.reset(OsLibrary::load(Os::openglDllName)); if (glDllLoad) { glSetString = (*glDllLoad)["glSetString"]; @@ -69,7 +68,7 @@ struct glDllHelper { UNRECOVERABLE_IF(setGlMockReturnedValues == nullptr); } } - ~glDllHelper() { + ~GlDllHelper() { if (glDllLoad) { glSetString("Intel", GL_VENDOR); glSetString("4.0", GL_VERSION); @@ -83,14 +82,14 @@ struct glDllHelper { glBoolean getGLSetSharedOCLContextStateReturnedValue; Void resetParam; Int getParam; - BufferParam loadBuffer; - TextureParam loadTexture; BuffInfo getBufferInfo; TextureInfo getTextureInfo; + TextureParam loadTexture; GLMockValue getGlMockReturnedValues; setGLMockValue setGlMockReturnedValues; private: std::unique_ptr glDllLoad; }; +} // namespace NEO diff --git a/opencl/test/unit_test/sharings/gl/windows/CMakeLists.txt b/opencl/test/unit_test/sharings/gl/windows/CMakeLists.txt index 479f1f56a6..4996c0a0f1 100644 --- a/opencl/test/unit_test/sharings/gl/windows/CMakeLists.txt +++ b/opencl/test/unit_test/sharings/gl/windows/CMakeLists.txt @@ -9,7 +9,6 @@ if(WIN32) ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/gl_arb_sync_event_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gl_create_from_texture_tests.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/gl_dll_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/gl_library_name.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gl_os_sharing_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gl_reused_buffers_tests.cpp diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp index 701917d8b6..c3cdd60b91 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_os_sharing_tests.cpp @@ -57,7 +57,7 @@ TEST(glSharingBasicTest, GivenSharingFunctionsWhenItIsConstructedThenBackupConte GLContext GLHGLRCHandle = 0; GLDisplay GLHDCHandle = 0; int32_t expectedContextAttrs[3] = {0}; - glDllHelper dllHelper; + GlDllHelper dllHelper; auto glSharingFunctions = new GlSharingFunctionsMock(GLHDCType, GLHGLRCHandle, GLHGLRCHandle, GLHDCHandle); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp index 65b23a8a0c..93d9650e0b 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_reused_buffers_tests.cpp @@ -94,10 +94,10 @@ TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenCreating } TEST_F(GlReusedBufferTests, givenGlobalShareHandleChangedWhenAcquiringSharedBufferThenChangeGraphicsAllocation) { - std::unique_ptr dllParam = std::make_unique(); - CL_GL_BUFFER_INFO bufferInfoOutput = dllParam->getBufferInfo(); + GlDllHelper dllParam; + CL_GL_BUFFER_INFO bufferInfoOutput = dllParam.getBufferInfo(); bufferInfoOutput.globalShareHandle = 40; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); auto clBuffer = std::unique_ptr(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); auto glBuffer = clBuffer->peekSharingHandler(); auto oldGraphicsAllocation = clBuffer->getGraphicsAllocation(); @@ -105,7 +105,7 @@ TEST_F(GlReusedBufferTests, givenGlobalShareHandleChangedWhenAcquiringSharedBuff ASSERT_EQ(40, oldGraphicsAllocation->peekSharedHandle()); bufferInfoOutput.globalShareHandle = 41; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); glBuffer->acquire(clBuffer.get()); auto newGraphicsAllocation = clBuffer->getGraphicsAllocation(); @@ -126,11 +126,11 @@ TEST_F(GlReusedBufferTests, givenGlobalShareHandleDidNotChangeWhenAcquiringShare GlBuffer::resolveGraphicsAllocationChange(currentSharedHandle, updateData); } }; - std::unique_ptr dllParam = std::make_unique(); - CL_GL_BUFFER_INFO bufferInfoOutput = dllParam->getBufferInfo(); + GlDllHelper dllParam; + CL_GL_BUFFER_INFO bufferInfoOutput = dllParam.getBufferInfo(); bufferInfoOutput.globalShareHandle = 40; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); auto clBuffer = std::unique_ptr(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); auto glBuffer = new MyGlBuffer(context.getSharing(), bufferId1); clBuffer->setSharingHandler(glBuffer); @@ -151,26 +151,26 @@ TEST_F(GlReusedBufferTests, givenGlobalShareHandleChangedWhenAcquiringSharedBuff GlBuffer::resolveGraphicsAllocationChange(currentSharedHandle, updateData); } }; - std::unique_ptr dllParam = std::make_unique(); - CL_GL_BUFFER_INFO bufferInfoOutput = dllParam->getBufferInfo(); + GlDllHelper dllParam; + CL_GL_BUFFER_INFO bufferInfoOutput = dllParam.getBufferInfo(); bufferInfoOutput.globalShareHandle = 40; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); auto clBuffer = std::unique_ptr(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); auto glBuffer = new MyGlBuffer(context.getSharing(), bufferId1); clBuffer->setSharingHandler(glBuffer); bufferInfoOutput.globalShareHandle = 41; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); glBuffer->acquire(clBuffer.get()); glBuffer->release(clBuffer.get()); } TEST_F(GlReusedBufferTests, givenMultipleBuffersAndGlobalShareHandleChangedWhenAcquiringSharedBufferDeleteOldGfxAllocationFromReuseVector) { - std::unique_ptr dllParam = std::make_unique(); - CL_GL_BUFFER_INFO bufferInfoOutput = dllParam->getBufferInfo(); + GlDllHelper dllParam; + CL_GL_BUFFER_INFO bufferInfoOutput = dllParam.getBufferInfo(); bufferInfoOutput.globalShareHandle = 40; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); auto clBuffer1 = std::unique_ptr(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); auto clBuffer2 = std::unique_ptr(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); auto graphicsAllocation1 = clBuffer1->getGraphicsAllocation(); @@ -180,7 +180,7 @@ TEST_F(GlReusedBufferTests, givenMultipleBuffersAndGlobalShareHandleChangedWhenA ASSERT_EQ(1, graphicsAllocationsForGlBufferReuse->size()); bufferInfoOutput.globalShareHandle = 41; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); clBuffer1->peekSharingHandler()->acquire(clBuffer1.get()); auto newGraphicsAllocation = clBuffer1->getGraphicsAllocation(); EXPECT_EQ(1, graphicsAllocationsForGlBufferReuse->size()); @@ -199,16 +199,16 @@ TEST_F(GlReusedBufferTests, givenGraphicsAllocationCreationReturnsNullptrWhenAcq auto suceedingMemoryManager = context.getMemoryManager(); auto failingMemoryManager = std::unique_ptr(new FailingMemoryManager()); - std::unique_ptr dllParam = std::make_unique(); - CL_GL_BUFFER_INFO bufferInfoOutput = dllParam->getBufferInfo(); + GlDllHelper dllParam; + CL_GL_BUFFER_INFO bufferInfoOutput = dllParam.getBufferInfo(); bufferInfoOutput.globalShareHandle = 40; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); auto clBuffer = std::unique_ptr(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); auto glBuffer = clBuffer->peekSharingHandler(); bufferInfoOutput.globalShareHandle = 41; - dllParam->loadBuffer(bufferInfoOutput); + dllParam.loadBuffer(bufferInfoOutput); context.memoryManager = failingMemoryManager.get(); auto result = glBuffer->acquire(clBuffer.get()); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp index ba247dc1d6..4e213df0b0 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_sharing_tests.cpp @@ -637,7 +637,7 @@ TEST(glSharingBasicTest, GivenSharingFunctionsWhenItIsConstructedThenOglContextF GLType GLHDCType = 0; GLContext GLHGLRCHandle = 0; GLDisplay GLHDCHandle = 0; - glDllHelper getDllParam; + GlDllHelper getDllParam; GlSharingFunctionsMock glSharingFunctions(GLHDCType, GLHGLRCHandle, GLHGLRCHandle, GLHDCHandle); EXPECT_EQ(1, getDllParam.getGLSetSharedOCLContextStateReturnedValue()); @@ -1080,7 +1080,7 @@ TEST(glSharingContextSwitch, givenZeroCurrentContextWhenSwitchAttemptedThenMakeS TEST(glSharingContextSwitch, givenSharingFunctionsWhenGlDeleteContextIsNotPresentThenItIsNotCalled) { auto glSharingFunctions = new GLSharingFunctionsWindows(); - glDllHelper dllParam; + GlDllHelper dllParam; auto currentGlDeleteContextCalledCount = dllParam.getParam("GLDeleteContextCalled"); delete glSharingFunctions; EXPECT_EQ(currentGlDeleteContextCalledCount, dllParam.getParam("GLDeleteContextCalled")); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp index 15d0b468f2..1a756d754c 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_texture_tests.cpp @@ -135,7 +135,7 @@ TEST_F(GlSharingTextureTests, givenMockGlWhenGlTextureIsCreatedFromWrongHandleTh GLboolean OSAPI mockGLAcquireSharedTexture(GLDisplay, GLContext, GLContext, GLvoid *pResourceInfo) { auto pTextureInfo = (CL_GL_RESOURCE_INFO *)pResourceInfo; - glDllHelper dllParam; + GlDllHelper dllParam; pTextureInfo->globalShareHandle = dllParam.getTextureInfo().globalShareHandle; pTextureInfo->globalShareHandleMCS = dllParam.getTextureInfo().globalShareHandleMCS;