refactor: correct variable naming

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2023-10-31 07:39:02 +00:00 committed by Compute-Runtime-Automation
parent 1116424824
commit 9c7f31620a
9 changed files with 99 additions and 99 deletions

View File

@ -42,7 +42,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
SysmanDeviceFixture::TearDown(); SysmanDeviceFixture::TearDown();
} }
std::vector<zes_pwr_handle_t> get_power_handles(uint32_t count) { std::vector<zes_pwr_handle_t> getPowerHandles(uint32_t count) {
std::vector<zes_pwr_handle_t> handles(count, nullptr); std::vector<zes_pwr_handle_t> handles(count, nullptr);
EXPECT_EQ(zesDeviceEnumPowerDomains(pSysmanDevice->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS); EXPECT_EQ(zesDeviceEnumPowerDomains(pSysmanDevice->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
return handles; return handles;
@ -97,7 +97,7 @@ TEST_F(SysmanDevicePowerFixture, DISABLED_GivenValidPowerHandleWhenGettingPowerP
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_properties_t properties; zes_power_properties_t properties;
@ -119,7 +119,7 @@ TEST_F(SysmanDevicePowerFixture, DISABLED_GivenValidPowerHandleWhenGettingPowerP
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_properties_t properties; zes_power_properties_t properties;
@ -141,7 +141,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCoun
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_energy_counter_t energyCounter; zes_power_energy_counter_t energyCounter;
@ -158,7 +158,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerLimitsAllo
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_sustained_limit_t sustained; zes_power_sustained_limit_t sustained;
@ -182,7 +182,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_sustained_limit_t sustained; zes_power_sustained_limit_t sustained;
@ -205,7 +205,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingEnergyThreshold
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
double energyThreshold = 2000; double energyThreshold = 2000;
@ -220,7 +220,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingEnergyThreshold
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
double energyThreshold = 2000; double energyThreshold = 2000;
@ -241,7 +241,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_sustained_limit_t sustained; zes_power_sustained_limit_t sustained;
@ -250,8 +250,8 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
uint32_t powerIncrement = 1500; uint32_t powerIncrement = 1500;
uint32_t timeIncrement = 12000; uint32_t timeIncrement = 12000;
uint32_t AcPeakPower = 56000; uint32_t acPeakPower = 56000;
uint32_t DcPeakPower = 44100; uint32_t dcPeakPower = 44100;
ze_result_t result = zesPowerGetLimits(handle, &sustained, &burst, &peak); ze_result_t result = zesPowerGetLimits(handle, &sustained, &burst, &peak);
@ -260,8 +260,8 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
sustained.power += powerIncrement; sustained.power += powerIncrement;
sustained.interval += timeIncrement; sustained.interval += timeIncrement;
burst.power += powerIncrement; burst.power += powerIncrement;
peak.powerAC = AcPeakPower; peak.powerAC = acPeakPower;
peak.powerDC = DcPeakPower; peak.powerDC = dcPeakPower;
result = zesPowerSetLimits(handle, &sustained, &burst, &peak); result = zesPowerSetLimits(handle, &sustained, &burst, &peak);
@ -287,7 +287,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandlesWhenCallingSetAndGetPower
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
uint32_t limitCount = 0; uint32_t limitCount = 0;

View File

@ -58,7 +58,7 @@ class SysmanDevicePowerFixture : public SysmanDeviceFixture {
SysmanDeviceFixture::TearDown(); SysmanDeviceFixture::TearDown();
} }
std::vector<zes_pwr_handle_t> get_power_handles(uint32_t count) { std::vector<zes_pwr_handle_t> getPowerHandles(uint32_t count) {
std::vector<zes_pwr_handle_t> handles(count, nullptr); std::vector<zes_pwr_handle_t> handles(count, nullptr);
EXPECT_EQ(zesDeviceEnumPowerDomains(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS); EXPECT_EQ(zesDeviceEnumPowerDomains(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
return handles; return handles;
@ -113,7 +113,7 @@ TEST_F(SysmanDevicePowerFixture, DISABLED_GivenValidPowerHandleWhenGettingPowerP
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_properties_t properties; zes_power_properties_t properties;
@ -135,7 +135,7 @@ TEST_F(SysmanDevicePowerFixture, DISABLED_GivenValidPowerHandleWhenGettingPowerP
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_properties_t properties; zes_power_properties_t properties;
@ -157,7 +157,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCoun
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_energy_counter_t energyCounter; zes_power_energy_counter_t energyCounter;
@ -174,7 +174,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenGettingPowerLimitsAllo
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_sustained_limit_t sustained; zes_power_sustained_limit_t sustained;
@ -198,7 +198,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_sustained_limit_t sustained; zes_power_sustained_limit_t sustained;
@ -221,7 +221,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingEnergyThreshold
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
double energyThreshold = 2000; double energyThreshold = 2000;
@ -236,7 +236,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingEnergyThreshold
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
double energyThreshold = 2000; double energyThreshold = 2000;
@ -257,7 +257,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_sustained_limit_t sustained; zes_power_sustained_limit_t sustained;
@ -266,8 +266,8 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
uint32_t powerIncrement = 1500; uint32_t powerIncrement = 1500;
uint32_t timeIncrement = 12000; uint32_t timeIncrement = 12000;
uint32_t AcPeakPower = 56000; uint32_t acPeakPower = 56000;
uint32_t DcPeakPower = 44100; uint32_t dcPeakPower = 44100;
ze_result_t result = zesPowerGetLimits(handle, &sustained, &burst, &peak); ze_result_t result = zesPowerGetLimits(handle, &sustained, &burst, &peak);
@ -276,8 +276,8 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
sustained.power += powerIncrement; sustained.power += powerIncrement;
sustained.interval += timeIncrement; sustained.interval += timeIncrement;
burst.power += powerIncrement; burst.power += powerIncrement;
peak.powerAC = AcPeakPower; peak.powerAC = acPeakPower;
peak.powerDC = DcPeakPower; peak.powerDC = dcPeakPower;
result = zesPowerSetLimits(handle, &sustained, &burst, &peak); result = zesPowerSetLimits(handle, &sustained, &burst, &peak);
@ -302,7 +302,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerLimitsAllo
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandlesWhenCallingSetAndGetPowerLimitExtThenLimitsSetEarlierAreRetrieved) { TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandlesWhenCallingSetAndGetPowerLimitExtThenLimitsSetEarlierAreRetrieved) {
// Setting allow set calls or not // Setting allow set calls or not
init(true); init(true);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
uint32_t limitCount = 0; uint32_t limitCount = 0;
@ -359,7 +359,7 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandlesWhenCallingSetAndGetPower
TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenCallingGetPowerLimitsExtThenProperValuesAreReturned) { TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenCallingGetPowerLimitsExtThenProperValuesAreReturned) {
// Setting allow set calls or not // Setting allow set calls or not
init(false); init(false);
auto handles = get_power_handles(powerHandleComponentCount); auto handles = getPowerHandles(powerHandleComponentCount);
for (auto handle : handles) { for (auto handle : handles) {
zes_power_limit_ext_desc_t allLimits{}; zes_power_limit_ext_desc_t allLimits{};

View File

@ -77,27 +77,27 @@ bool GLSharingFunctionsWindows::isOpenGlSharingSupported() {
if ((vendor.empty()) || (vendor != intelVendor)) { if ((vendor.empty()) || (vendor != intelVendor)) {
return false; return false;
} }
std::basic_string<unsigned char> Version = glGetString(GL_VERSION); std::basic_string<unsigned char> version = glGetString(GL_VERSION);
if (Version.empty()) { if (version.empty()) {
return false; return false;
} }
bool isOpenGLES = false; bool isOpenGLES = false;
const unsigned char versionES[] = "OpenGL ES"; const unsigned char versionES[] = "OpenGL ES";
if (Version.find(versionES) != std::string::npos) { if (version.find(versionES) != std::string::npos) {
isOpenGLES = true; isOpenGLES = true;
} }
if (isOpenGLES == true) { if (isOpenGLES == true) {
const unsigned char versionES1[] = "OpenGL ES 1."; const unsigned char versionES1[] = "OpenGL ES 1.";
if (Version.find(versionES1) != std::string::npos) { if (version.find(versionES1) != std::string::npos) {
const unsigned char supportGLOES[] = "GL_OES_framebuffer_object"; const unsigned char supportGLOES[] = "GL_OES_framebuffer_object";
if (isOpenGlExtensionSupported(supportGLOES) == false) { if (isOpenGlExtensionSupported(supportGLOES) == false) {
return false; return false;
} }
} }
} else { } else {
if (Version[0] < '3') { if (version[0] < '3') {
const unsigned char supportGLEXT[] = "GL_EXT_framebuffer_object"; const unsigned char supportGLEXT[] = "GL_EXT_framebuffer_object";
if (isOpenGlExtensionSupported(supportGLEXT) == false) { if (isOpenGlExtensionSupported(supportGLEXT) == false) {
return false; return false;

View File

@ -30,15 +30,15 @@ bool GlSharingContextBuilder::processProperties(cl_context_properties &propertyT
contextData->glHGLRCHandle = (GLContext)propertyValue; contextData->glHGLRCHandle = (GLContext)propertyValue;
return true; return true;
case CL_WGL_HDC_KHR: case CL_WGL_HDC_KHR:
contextData->GLHDCType = (GLType)CL_WGL_HDC_KHR; contextData->glHDCType = (GLType)CL_WGL_HDC_KHR;
contextData->glHDCHandle = (GLDisplay)propertyValue; contextData->glHDCHandle = (GLDisplay)propertyValue;
return true; return true;
case CL_GLX_DISPLAY_KHR: case CL_GLX_DISPLAY_KHR:
contextData->GLHDCType = (GLType)CL_GLX_DISPLAY_KHR; contextData->glHDCType = (GLType)CL_GLX_DISPLAY_KHR;
contextData->glHDCHandle = (GLDisplay)propertyValue; contextData->glHDCHandle = (GLDisplay)propertyValue;
return true; return true;
case CL_EGL_DISPLAY_KHR: case CL_EGL_DISPLAY_KHR:
contextData->GLHDCType = (GLType)CL_EGL_DISPLAY_KHR; contextData->glHDCType = (GLType)CL_EGL_DISPLAY_KHR;
contextData->glHDCHandle = (GLDisplay)propertyValue; contextData->glHDCHandle = (GLDisplay)propertyValue;
return true; return true;
} }
@ -50,7 +50,7 @@ bool GlSharingContextBuilder::finalizeProperties(Context &context, int32_t &errc
return true; return true;
if (contextData->glHGLRCHandle) { if (contextData->glHGLRCHandle) {
context.registerSharing(new GLSharingFunctionsWindows(contextData->GLHDCType, contextData->glHGLRCHandle, context.registerSharing(new GLSharingFunctionsWindows(contextData->glHDCType, contextData->glHGLRCHandle,
nullptr, contextData->glHDCHandle)); nullptr, contextData->glHDCHandle));
} }

View File

@ -15,7 +15,7 @@ namespace NEO {
class Context; class Context;
struct GlCreateContextProperties { struct GlCreateContextProperties {
GLType GLHDCType = 0; GLType glHDCType = 0;
GLContext glHGLRCHandle = 0; GLContext glHGLRCHandle = 0;
GLDisplay glHDCHandle = 0; GLDisplay glHDCHandle = 0;
}; };

View File

@ -113,16 +113,16 @@ class GlSharingFunctionsMock : public GLSharingFunctionsWindows {
using GLSharingFunctionsWindows::pfnGlArbSyncObjectSignal; using GLSharingFunctionsWindows::pfnGlArbSyncObjectSignal;
using GLSharingFunctionsWindows::pfnGlArbSyncObjectWaitServer; using GLSharingFunctionsWindows::pfnGlArbSyncObjectWaitServer;
GlSharingFunctionsMock(GLType GLHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle) GlSharingFunctionsMock(GLType glHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle)
: GLSharingFunctionsWindows(GLHDCType, glHGLRCHandle, glHGLRCHandleBkpCtx, glHDCHandle) { : GLSharingFunctionsWindows(glHDCType, glHGLRCHandle, glHGLRCHandleBkpCtx, glHDCHandle) {
initMembers(); initMembers();
updateOpenGLContext(); updateOpenGLContext();
createBackupContext(); createBackupContext();
} }
GlSharingFunctionsMock(); GlSharingFunctionsMock();
void setHandles(GLType GLHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle) { void setHandles(GLType glHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle) {
this->glHDCType = GLHDCType; this->glHDCType = glHDCType;
this->glHGLRCHandle = glHGLRCHandle; this->glHGLRCHandle = glHGLRCHandle;
this->glHGLRCHandleBkpCtx = glHGLRCHandleBkpCtx; this->glHGLRCHandleBkpCtx = glHGLRCHandleBkpCtx;
this->glHDCHandle = glHDCHandle; this->glHDCHandle = glHDCHandle;
@ -136,7 +136,7 @@ class GlSharingFunctionsMock : public GLSharingFunctionsWindows {
class MockGlSharing { class MockGlSharing {
public: public:
MockGlSharing() {} MockGlSharing() {}
MockGlSharing(GLType GLHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle); MockGlSharing(GLType glHDCType, GLContext glHGLRCHandle, GLContext glHGLRCHandleBkpCtx, GLDisplay glHDCHandle);
void uploadDataToBufferInfo() { void uploadDataToBufferInfo() {
dllParam->loadBuffer(bufferInfoOutput); dllParam->loadBuffer(bufferInfoOutput);
} }

View File

@ -46,13 +46,13 @@ struct MockOSInterface : OSInterface {
}; };
TEST(glSharingBasicTest, GivenSharingFunctionsWhenItIsConstructedThenBackupContextIsCreated) { TEST(glSharingBasicTest, GivenSharingFunctionsWhenItIsConstructedThenBackupContextIsCreated) {
GLType GLHDCType = CL_WGL_HDC_KHR; GLType glHDCType = CL_WGL_HDC_KHR;
GLContext glHGLRCHandle = 0; GLContext glHGLRCHandle = 0;
GLDisplay glHDCHandle = 0; GLDisplay glHDCHandle = 0;
int32_t expectedContextAttrs[3] = {0}; int32_t expectedContextAttrs[3] = {0};
GlDllHelper dllHelper; GlDllHelper dllHelper;
auto glSharingFunctions = new GlSharingFunctionsMock(GLHDCType, glHGLRCHandle, glHGLRCHandle, glHDCHandle); auto glSharingFunctions = new GlSharingFunctionsMock(glHDCType, glHGLRCHandle, glHGLRCHandle, glHDCHandle);
EXPECT_EQ(1, dllHelper.getParam("wglCreateContextCalled")); EXPECT_EQ(1, dllHelper.getParam("wglCreateContextCalled"));
EXPECT_EQ(1, dllHelper.getParam("wglShareListsCalled")); EXPECT_EQ(1, dllHelper.getParam("wglShareListsCalled"));

View File

@ -41,7 +41,7 @@
using namespace NEO; using namespace NEO;
class glSharingTests : public ::testing::Test { class GlSharingTests : public ::testing::Test {
public: public:
void SetUp() override { void SetUp() override {
rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex(); rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex();
@ -60,18 +60,18 @@ class glSharingTests : public ::testing::Test {
unsigned int bufferId = 1u; unsigned int bufferId = 1u;
}; };
TEST_F(glSharingTests, givenGlMockWhenItIsCreatedThenNonZeroObjectIsReturned) { TEST_F(GlSharingTests, givenGlMockWhenItIsCreatedThenNonZeroObjectIsReturned) {
EXPECT_NE(nullptr, &mockGlSharing); EXPECT_NE(nullptr, &mockGlSharing);
EXPECT_NE(nullptr, &mockGlSharing->clGlResourceInfo); EXPECT_NE(nullptr, &mockGlSharing->clGlResourceInfo);
EXPECT_NE(nullptr, &mockGlSharing->glClResourceInfo); EXPECT_NE(nullptr, &mockGlSharing->glClResourceInfo);
} }
TEST_F(glSharingTests, givenGLSharingFunctionsWhenAskedForIdThenClGlSharingIdIsReturned) { TEST_F(GlSharingTests, givenGLSharingFunctionsWhenAskedForIdThenClGlSharingIdIsReturned) {
auto v = SharingType::CLGL_SHARING; auto v = SharingType::CLGL_SHARING;
EXPECT_EQ(v, mockGlSharingFunctions->getId()); EXPECT_EQ(v, mockGlSharingFunctions->getId());
} }
TEST_F(glSharingTests, givenMockGlWhenGlBufferIsCreatedThenMemObjectHasGlHandler) { TEST_F(GlSharingTests, givenMockGlWhenGlBufferIsCreatedThenMemObjectHasGlHandler) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, &retVal); auto glBuffer = GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, &retVal);
@ -102,7 +102,7 @@ class FailingMemoryManager : public MockMemoryManager {
} }
}; };
TEST_F(glSharingTests, givenMockGlWhenGlBufferIsCreatedFromWrongHandleThenErrorAndNoBufferIsReturned) { TEST_F(GlSharingTests, givenMockGlWhenGlBufferIsCreatedFromWrongHandleThenErrorAndNoBufferIsReturned) {
auto tempMemoryManager = context.getMemoryManager(); auto tempMemoryManager = context.getMemoryManager();
auto memoryManager = std::unique_ptr<FailingMemoryManager>(new FailingMemoryManager()); auto memoryManager = std::unique_ptr<FailingMemoryManager>(new FailingMemoryManager());
@ -117,7 +117,7 @@ TEST_F(glSharingTests, givenMockGlWhenGlBufferIsCreatedFromWrongHandleThenErrorA
context.memoryManager = tempMemoryManager; context.memoryManager = tempMemoryManager;
} }
TEST_F(glSharingTests, givenContextWhenClCreateFromGlBufferIsCalledThenBufferIsReturned) { TEST_F(GlSharingTests, givenContextWhenClCreateFromGlBufferIsCalledThenBufferIsReturned) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -127,7 +127,7 @@ TEST_F(glSharingTests, givenContextWhenClCreateFromGlBufferIsCalledThenBufferIsR
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenContextWithoutSharingWhenClCreateFromGlBufferIsCalledThenErrorIsReturned) { TEST_F(GlSharingTests, givenContextWithoutSharingWhenClCreateFromGlBufferIsCalledThenErrorIsReturned) {
context.resetSharingFunctions(CLGL_SHARING); context.resetSharingFunctions(CLGL_SHARING);
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
@ -139,7 +139,7 @@ GLboolean OSAPI mockGLAcquireSharedBuffer(GLDisplay, GLContext, GLContext, GLvoi
return GL_FALSE; return GL_FALSE;
}; };
TEST_F(glSharingTests, givenContextWithSharingWhenClCreateFromGlBufferIsCalledWithIncorrectThenErrorIsReturned) { TEST_F(GlSharingTests, givenContextWithSharingWhenClCreateFromGlBufferIsCalledWithIncorrectThenErrorIsReturned) {
mockGlSharingFunctions->setGLAcquireSharedBufferMock(mockGLAcquireSharedBuffer); mockGlSharingFunctions->setGLAcquireSharedBufferMock(mockGLAcquireSharedBuffer);
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
@ -147,7 +147,7 @@ TEST_F(glSharingTests, givenContextWithSharingWhenClCreateFromGlBufferIsCalledWi
ASSERT_EQ(nullptr, glBuffer); ASSERT_EQ(nullptr, glBuffer);
} }
TEST_F(glSharingTests, givenContextAnd32BitAddressingWhenClCreateFromGlBufferIsCalledThenBufferIsReturned) { TEST_F(GlSharingTests, givenContextAnd32BitAddressingWhenClCreateFromGlBufferIsCalledThenBufferIsReturned) {
auto flagToRestore = DebugManager.flags.Force32bitAddressing.get(); auto flagToRestore = DebugManager.flags.Force32bitAddressing.get();
DebugManager.flags.Force32bitAddressing.set(true); DebugManager.flags.Force32bitAddressing.set(true);
@ -163,7 +163,7 @@ TEST_F(glSharingTests, givenContextAnd32BitAddressingWhenClCreateFromGlBufferIsC
DebugManager.flags.Force32bitAddressing.set(flagToRestore); DebugManager.flags.Force32bitAddressing.set(flagToRestore);
} }
TEST_F(glSharingTests, givenGlClBufferWhenAskedForCLGLGetInfoThenIdAndTypeIsReturned) { TEST_F(GlSharingTests, givenGlClBufferWhenAskedForCLGLGetInfoThenIdAndTypeIsReturned) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
@ -192,7 +192,7 @@ TEST_F(glSharingTests, givenGlClBufferWhenAskedForCLGLGetInfoThenIdAndTypeIsRetu
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClBufferWhenAskedForCLGLGetInfoThenErrorIsReturned) { TEST_F(GlSharingTests, givenClBufferWhenAskedForCLGLGetInfoThenErrorIsReturned) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateBuffer(&context, 0, 1, nullptr, &retVal); auto glBuffer = clCreateBuffer(&context, 0, 1, nullptr, &retVal);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -207,7 +207,7 @@ TEST_F(glSharingTests, givenClBufferWhenAskedForCLGLGetInfoThenErrorIsReturned)
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredThenAcuqireCountIsIncremented) { TEST_F(GlSharingTests, givenClGLBufferWhenItIsAcquiredThenAcuqireCountIsIncremented) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
EXPECT_EQ(1, mockGlSharing->dllParam->getParam("glAcquireSharedBufferCalled")); EXPECT_EQ(1, mockGlSharing->dllParam->getParam("glAcquireSharedBufferCalled"));
@ -230,7 +230,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredThenAcuqireCountIsIncremen
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalled) { TEST_F(GlSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalled) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
auto memObject = castToObject<MemObj>(glBuffer); auto memObject = castToObject<MemObj>(glBuffer);
@ -251,7 +251,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalle
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) { TEST_F(GlSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) {
void *ptr = (void *)0x1000; void *ptr = (void *)0x1000;
auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex(); auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex();
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
@ -272,7 +272,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUs
delete gmm; delete gmm;
} }
TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceAfterReleaseThenAcuqireIsIncremented) { TEST_F(GlSharingTests, givenClGLBufferWhenItIsAcquiredTwiceAfterReleaseThenAcuqireIsIncremented) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
auto memObject = castToObject<MemObj>(glBuffer); auto memObject = castToObject<MemObj>(glBuffer);
@ -291,7 +291,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceAfterReleaseThenAcuqi
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquireCountIsDecrementedToZeroThenCallReleaseFunction) { TEST_F(GlSharingTests, givenClGLBufferWhenItIsAcquireCountIsDecrementedToZeroThenCallReleaseFunction) {
std::unique_ptr<Buffer> buffer(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, nullptr)); std::unique_ptr<Buffer> buffer(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, nullptr));
auto sharingHandler = buffer->peekSharingHandler(); auto sharingHandler = buffer->peekSharingHandler();
@ -306,7 +306,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquireCountIsDecrementedToZeroThe
EXPECT_EQ(bufferId, mockGlSharing->dllParam->getBufferInfo().bufferName); EXPECT_EQ(bufferId, mockGlSharing->dllParam->getBufferInfo().bufferName);
} }
TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredWithDifferentOffsetThenGraphicsAllocationContainsLatestOffsetValue) { TEST_F(GlSharingTests, givenClGLBufferWhenItIsAcquiredWithDifferentOffsetThenGraphicsAllocationContainsLatestOffsetValue) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex(); auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex();
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
@ -327,7 +327,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredWithDifferentOffsetThenGra
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenHwCommandQueueWhenAcquireIsCalledThenAcquireCountIsIncremented) { TEST_F(GlSharingTests, givenHwCommandQueueWhenAcquireIsCalledThenAcquireCountIsIncremented) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal); auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -357,7 +357,7 @@ TEST_F(glSharingTests, givenHwCommandQueueWhenAcquireIsCalledThenAcquireCountIsI
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenHwCommandQueueWhenAcquireIsCalledWithIncorrectWaitlistThenReturnError) { TEST_F(GlSharingTests, givenHwCommandQueueWhenAcquireIsCalledWithIncorrectWaitlistThenReturnError) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal); auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -376,7 +376,7 @@ TEST_F(glSharingTests, givenHwCommandQueueWhenAcquireIsCalledWithIncorrectWaitli
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenEnabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalledWithIncompleteExternallySynchronizedEventThenItIsAddedToAsyncEventsHandler) { TEST_F(GlSharingTests, givenEnabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalledWithIncompleteExternallySynchronizedEventThenItIsAddedToAsyncEventsHandler) {
std::unique_ptr<DebugManagerStateRestore> dbgRestore; std::unique_ptr<DebugManagerStateRestore> dbgRestore;
DebugManager.flags.EnableAsyncEventsHandler.set(true); DebugManager.flags.EnableAsyncEventsHandler.set(true);
@ -433,7 +433,7 @@ TEST_F(glSharingTests, givenEnabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalle
event->release(); event->release();
} }
TEST_F(glSharingTests, givenDisabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalledWithIncompleteExternallySynchronizedEventThenItIsNotAddedToAsyncEventsHandler) { TEST_F(GlSharingTests, givenDisabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalledWithIncompleteExternallySynchronizedEventThenItIsNotAddedToAsyncEventsHandler) {
DebugManagerStateRestore dbgRestore; DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableAsyncEventsHandler.set(false); DebugManager.flags.EnableAsyncEventsHandler.set(false);
@ -466,7 +466,7 @@ TEST_F(glSharingTests, givenDisabledAsyncEventsHandlerWhenAcquireGlObjectsIsCall
event->release(); event->release();
} }
TEST_F(glSharingTests, givenEnabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalledWithIncompleteButNotExternallySynchronizedEventThenItIsNotAddedToAsyncEventsHandler) { TEST_F(GlSharingTests, givenEnabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalledWithIncompleteButNotExternallySynchronizedEventThenItIsNotAddedToAsyncEventsHandler) {
DebugManagerStateRestore dbgRestore; DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableAsyncEventsHandler.set(false); DebugManager.flags.EnableAsyncEventsHandler.set(false);
@ -489,7 +489,7 @@ TEST_F(glSharingTests, givenEnabledAsyncEventsHandlerWhenAcquireGlObjectsIsCalle
event->release(); event->release();
} }
TEST_F(glSharingTests, givenHwCommandQueueWhenReleaseIsCalledWithIncorrectWaitlistThenReturnError) { TEST_F(GlSharingTests, givenHwCommandQueueWhenReleaseIsCalledWithIncorrectWaitlistThenReturnError) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal); auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -514,7 +514,7 @@ TEST_F(glSharingTests, givenHwCommandQueueWhenReleaseIsCalledWithIncorrectWaitli
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenContextWithoutSharingWhenAcquireIsCalledThenErrorIsReturned) { TEST_F(GlSharingTests, givenContextWithoutSharingWhenAcquireIsCalledThenErrorIsReturned) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal); auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -535,7 +535,7 @@ TEST_F(glSharingTests, givenContextWithoutSharingWhenAcquireIsCalledThenErrorIsR
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenContextWithoutSharingWhenReleaseIsCalledThenErrorIsReturned) { TEST_F(GlSharingTests, givenContextWithoutSharingWhenReleaseIsCalledThenErrorIsReturned) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal); auto commandQueue = clCreateCommandQueue(&context, context.getDevice(0), 0, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -561,7 +561,7 @@ TEST_F(glSharingTests, givenContextWithoutSharingWhenReleaseIsCalledThenErrorIsR
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenHwCommandQueueWhenAcquireAndReleaseCallsAreMadeWithEventsThenProperCmdTypeIsReturned) { TEST_F(GlSharingTests, givenHwCommandQueueWhenAcquireAndReleaseCallsAreMadeWithEventsThenProperCmdTypeIsReturned) {
cl_event retEvent; cl_event retEvent;
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
@ -596,7 +596,7 @@ TEST_F(glSharingTests, givenHwCommandQueueWhenAcquireAndReleaseCallsAreMadeWithE
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
HWTEST_F(glSharingTests, givenCommandQueueWhenReleaseGlObjectIsCalledThenFinishIsCalled) { HWTEST_F(GlSharingTests, givenCommandQueueWhenReleaseGlObjectIsCalledThenFinishIsCalled) {
MockCommandQueueHw<FamilyType> mockCmdQueue(&context, context.getDevice(0), nullptr); MockCommandQueueHw<FamilyType> mockCmdQueue(&context, context.getDevice(0), nullptr);
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, nullptr); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, nullptr);
@ -608,7 +608,7 @@ HWTEST_F(glSharingTests, givenCommandQueueWhenReleaseGlObjectIsCalledThenFinishI
clReleaseMemObject(glBuffer); clReleaseMemObject(glBuffer);
} }
TEST_F(glSharingTests, givenMockGLWhenFunctionsAreCalledThenCallsAreReceived) { TEST_F(GlSharingTests, givenMockGLWhenFunctionsAreCalledThenCallsAreReceived) {
auto ptrToStruct = &mockGlSharing->clGlResourceInfo; auto ptrToStruct = &mockGlSharing->clGlResourceInfo;
auto glDisplay = (GLDisplay)1; auto glDisplay = (GLDisplay)1;
auto glContext = (GLContext)1; auto glContext = (GLContext)1;
@ -867,7 +867,7 @@ TEST(glSharingBasicTest, givenInvalidFlagsWhenGettingSupportedFormatsThenIvalidV
EXPECT_EQ(0u, numImageFormats); EXPECT_EQ(0u, numImageFormats);
} }
TEST_F(glSharingTests, givenContextWhenCreateFromSharedBufferThenSharedImageIsReturned) { TEST_F(GlSharingTests, givenContextWhenCreateFromSharedBufferThenSharedImageIsReturned) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
@ -878,8 +878,8 @@ TEST_F(glSharingTests, givenContextWhenCreateFromSharedBufferThenSharedImageIsRe
hardwareInfo->capabilityTable.supportsImages = true; hardwareInfo->capabilityTable.supportsImages = true;
cl_image_format format = {CL_RGBA, CL_FLOAT}; cl_image_format format = {CL_RGBA, CL_FLOAT};
cl_image_desc image_desc = {CL_MEM_OBJECT_IMAGE1D_BUFFER, 1, 1, 1, 1, 0, 0, 0, 0, {glBuffer}}; cl_image_desc imageDesc = {CL_MEM_OBJECT_IMAGE1D_BUFFER, 1, 1, 1, 1, 0, 0, 0, 0, {glBuffer}};
cl_mem image = clCreateImage(&context, CL_MEM_READ_WRITE, &format, &image_desc, 0, &retVal); cl_mem image = clCreateImage(&context, CL_MEM_READ_WRITE, &format, &imageDesc, 0, &retVal);
ASSERT_EQ(CL_SUCCESS, retVal); ASSERT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, glBuffer); ASSERT_NE(nullptr, glBuffer);
auto childImage = castToObject<Image>(image); auto childImage = castToObject<Image>(image);
@ -892,7 +892,7 @@ TEST_F(glSharingTests, givenContextWhenCreateFromSharedBufferThenSharedImageIsRe
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledThenCopyOnGpu) { TEST_F(GlSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledThenCopyOnGpu) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
auto buffer = castToObject<Buffer>(glBuffer); auto buffer = castToObject<Buffer>(glBuffer);
@ -929,14 +929,14 @@ TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledThenCopyOnGpu
delete commandQueue; delete commandQueue;
} }
TEST_F(glSharingTests, givenClGLBufferWhenretValIsNotPassedToCreateFunctionThenBufferIsCreated) { TEST_F(GlSharingTests, givenClGLBufferWhenretValIsNotPassedToCreateFunctionThenBufferIsCreated) {
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, nullptr); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, nullptr);
ASSERT_NE(nullptr, glBuffer); ASSERT_NE(nullptr, glBuffer);
auto retVal = clReleaseMemObject(glBuffer); auto retVal = clReleaseMemObject(glBuffer);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
} }
TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledTwiceThenReuseStorage) { TEST_F(GlSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledTwiceThenReuseStorage) {
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal); auto glBuffer = clCreateFromGLBuffer(&context, 0, bufferId, &retVal);
auto buffer = castToObject<Buffer>(glBuffer); auto buffer = castToObject<Buffer>(glBuffer);
@ -980,7 +980,7 @@ TEST(APIclCreateEventFromGLsyncKHR, givenInvalidContexWhenCreateThenReturnError)
EXPECT_EQ(nullptr, event); EXPECT_EQ(nullptr, event);
} }
TEST_F(glSharingTests, givenContextWithoutSharingWhenCreateEventFromGLThenErrorIsReturned) { TEST_F(GlSharingTests, givenContextWithoutSharingWhenCreateEventFromGLThenErrorIsReturned) {
context.resetSharingFunctions(CLGL_SHARING); context.resetSharingFunctions(CLGL_SHARING);
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;
cl_GLsync sync = {0}; cl_GLsync sync = {0};
@ -1103,7 +1103,7 @@ TEST(glSharingContextSwitch, givenSharingFunctionsWhenGlDeleteContextIsNotPresen
EXPECT_EQ(currentGlDeleteContextCalledCount, dllParam.getParam("glDeleteContextCalled")); EXPECT_EQ(currentGlDeleteContextCalledCount, dllParam.getParam("glDeleteContextCalled"));
} }
HWTEST_F(glSharingTests, givenSyncObjectWhenCreateEventIsCalledThenCreateGLSyncObj) { HWTEST_F(GlSharingTests, givenSyncObjectWhenCreateEventIsCalledThenCreateGLSyncObj) {
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;
GLsync glSync = {0}; GLsync glSync = {0};
auto event = clCreateEventFromGLsyncKHR(&context, glSync, &retVal); auto event = clCreateEventFromGLsyncKHR(&context, glSync, &retVal);
@ -1125,7 +1125,7 @@ HWTEST_F(glSharingTests, givenSyncObjectWhenCreateEventIsCalledThenCreateGLSyncO
EXPECT_EQ(1, mockGlSharing->dllParam->getParam("glReleaseSyncCalled")); EXPECT_EQ(1, mockGlSharing->dllParam->getParam("glReleaseSyncCalled"));
} }
HWTEST_F(glSharingTests, givenEventCreatedFromFenceObjectWhenItIsPassedToAcquireThenItsStatusIsUpdated) { HWTEST_F(GlSharingTests, givenEventCreatedFromFenceObjectWhenItIsPassedToAcquireThenItsStatusIsUpdated) {
GLsync glSync = {0}; GLsync glSync = {0};
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto event = clCreateEventFromGLsyncKHR(&context, glSync, &retVal); auto event = clCreateEventFromGLsyncKHR(&context, glSync, &retVal);
@ -1147,7 +1147,7 @@ HWTEST_F(glSharingTests, givenEventCreatedFromFenceObjectWhenItIsPassedToAcquire
clReleaseEvent(event); clReleaseEvent(event);
} }
TEST_F(glSharingTests, GivenGlSyncEventThenReportsAsExternallySynchronized) { TEST_F(GlSharingTests, GivenGlSyncEventThenReportsAsExternallySynchronized) {
GLsync glSync = {0}; GLsync glSync = {0};
auto syncEvent = GlSyncEvent::create(context, glSync, nullptr); auto syncEvent = GlSyncEvent::create(context, glSync, nullptr);
ASSERT_NE(nullptr, syncEvent); ASSERT_NE(nullptr, syncEvent);
@ -1155,7 +1155,7 @@ TEST_F(glSharingTests, GivenGlSyncEventThenReportsAsExternallySynchronized) {
syncEvent->release(); syncEvent->release();
} }
TEST_F(glSharingTests, givenSyncEventWhenUpdateExecutionStatusIsCalledThenGLGetSyncivCalled) { TEST_F(GlSharingTests, givenSyncEventWhenUpdateExecutionStatusIsCalledThenGLGetSyncivCalled) {
GLsync glSync = {0}; GLsync glSync = {0};
auto syncEvent = GlSyncEvent::create(context, glSync, nullptr); auto syncEvent = GlSyncEvent::create(context, glSync, nullptr);
ASSERT_NE(nullptr, syncEvent); ASSERT_NE(nullptr, syncEvent);
@ -1174,14 +1174,14 @@ TEST_F(glSharingTests, givenSyncEventWhenUpdateExecutionStatusIsCalledThenGLGetS
delete syncEvent; delete syncEvent;
} }
TEST_F(glSharingTests, givenContextWhenEmptySharingTableEmptyThenReturnsNullptr) { TEST_F(GlSharingTests, givenContextWhenEmptySharingTableEmptyThenReturnsNullptr) {
MockContext context; MockContext context;
context.clearSharingFunctions(); context.clearSharingFunctions();
GLSharingFunctions *sharingF = context.getSharing<GLSharingFunctions>(); GLSharingFunctions *sharingF = context.getSharing<GLSharingFunctions>();
EXPECT_EQ(sharingF, nullptr); EXPECT_EQ(sharingF, nullptr);
} }
TEST_F(glSharingTests, givenUnknownBaseEventWhenGetGlArbSyncEventIsCalledThenNullptrIsReturned) { TEST_F(GlSharingTests, givenUnknownBaseEventWhenGetGlArbSyncEventIsCalledThenNullptrIsReturned) {
auto *sharing = context.getSharing<GLSharingFunctionsWindows>(); auto *sharing = context.getSharing<GLSharingFunctionsWindows>();
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
auto event = new MockEvent<UserEvent>(); auto event = new MockEvent<UserEvent>();
@ -1190,7 +1190,7 @@ TEST_F(glSharingTests, givenUnknownBaseEventWhenGetGlArbSyncEventIsCalledThenNul
event->release(); event->release();
} }
TEST_F(glSharingTests, givenKnownBaseEventWhenGetGlArbSyncEventIsCalledThenProperArbEventIsReturned) { TEST_F(GlSharingTests, givenKnownBaseEventWhenGetGlArbSyncEventIsCalledThenProperArbEventIsReturned) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
auto baseEvent = new MockEvent<UserEvent>; auto baseEvent = new MockEvent<UserEvent>;
@ -1200,7 +1200,7 @@ TEST_F(glSharingTests, givenKnownBaseEventWhenGetGlArbSyncEventIsCalledThenPrope
baseEvent->release(); baseEvent->release();
} }
TEST_F(glSharingTests, givenKnownBaseEventWhenRemoveGlArbSyncEventMappingIsCalledThenProperArbEventIsRemovedFromMap) { TEST_F(GlSharingTests, givenKnownBaseEventWhenRemoveGlArbSyncEventMappingIsCalledThenProperArbEventIsRemovedFromMap) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
auto baseEvent = new MockEvent<UserEvent>; auto baseEvent = new MockEvent<UserEvent>;
@ -1212,7 +1212,7 @@ TEST_F(glSharingTests, givenKnownBaseEventWhenRemoveGlArbSyncEventMappingIsCalle
baseEvent->release(); baseEvent->release();
} }
TEST_F(glSharingTests, givenUnknownBaseEventWhenRemoveGlArbSyncEventMappingIsCalledThenProperArbEventIsRemovedFromMap) { TEST_F(GlSharingTests, givenUnknownBaseEventWhenRemoveGlArbSyncEventMappingIsCalledThenProperArbEventIsRemovedFromMap) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
auto baseEvent = new MockEvent<UserEvent>; auto baseEvent = new MockEvent<UserEvent>;
@ -1228,7 +1228,7 @@ TEST_F(glSharingTests, givenUnknownBaseEventWhenRemoveGlArbSyncEventMappingIsCal
baseEvent->release(); baseEvent->release();
} }
TEST_F(glSharingTests, givenUnknownBaseEventWhenGetOrCreateGlArbSyncEventIsCalledThenNewArbEventIsReturned) { TEST_F(GlSharingTests, givenUnknownBaseEventWhenGetOrCreateGlArbSyncEventIsCalledThenNewArbEventIsReturned) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
sharing->pfnGlArbSyncObjectCleanup = glArbSyncObjectCleanupMockDoNothing; sharing->pfnGlArbSyncObjectCleanup = glArbSyncObjectCleanupMockDoNothing;
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
@ -1247,7 +1247,7 @@ TEST_F(glSharingTests, givenUnknownBaseEventWhenGetOrCreateGlArbSyncEventIsCalle
clReleaseCommandQueue(commandQueue); clReleaseCommandQueue(commandQueue);
} }
TEST_F(glSharingTests, givenKnownBaseEventWhenGetOrCreateGlArbSyncEventIsCalledThenOldArbEventIsReused) { TEST_F(GlSharingTests, givenKnownBaseEventWhenGetOrCreateGlArbSyncEventIsCalledThenOldArbEventIsReused) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
sharing->pfnGlArbSyncObjectCleanup = glArbSyncObjectCleanupMockDoNothing; sharing->pfnGlArbSyncObjectCleanup = glArbSyncObjectCleanupMockDoNothing;
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
@ -1266,7 +1266,7 @@ TEST_F(glSharingTests, givenKnownBaseEventWhenGetOrCreateGlArbSyncEventIsCalledT
clReleaseCommandQueue(commandQueue); clReleaseCommandQueue(commandQueue);
} }
TEST_F(glSharingTests, WhenArbSyncEventCreationFailsThenGetOrCreateGlArbSyncEventReturnsNull) { TEST_F(GlSharingTests, WhenArbSyncEventCreationFailsThenGetOrCreateGlArbSyncEventReturnsNull) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
@ -1280,27 +1280,27 @@ TEST_F(glSharingTests, WhenArbSyncEventCreationFailsThenGetOrCreateGlArbSyncEven
clReleaseCommandQueue(commandQueue); clReleaseCommandQueue(commandQueue);
} }
TEST_F(glSharingTests, whenGetGlDeviceHandleIsCalledThenProperHandleIsReturned) { TEST_F(GlSharingTests, whenGetGlDeviceHandleIsCalledThenProperHandleIsReturned) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
sharing->glDeviceHandle = 0x2c; sharing->glDeviceHandle = 0x2c;
EXPECT_EQ(0x2cU, sharing->getGLDeviceHandle()); EXPECT_EQ(0x2cU, sharing->getGLDeviceHandle());
} }
TEST_F(glSharingTests, whenGetGlContextHandleIsCalledThenProperHandleIsReturned) { TEST_F(GlSharingTests, whenGetGlContextHandleIsCalledThenProperHandleIsReturned) {
auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>()); auto *sharing = static_cast<GlSharingFunctionsMock *>(context.getSharing<GLSharingFunctions>());
ASSERT_NE(nullptr, sharing); ASSERT_NE(nullptr, sharing);
sharing->glContextHandle = 0x2c; sharing->glContextHandle = 0x2c;
EXPECT_EQ(0x2cU, sharing->getGLContextHandle()); EXPECT_EQ(0x2cU, sharing->getGLContextHandle());
} }
TEST_F(glSharingTests, givenClGLBufferWhenCreatedThenSharedBufferAllocatoinTypeIsSet) { TEST_F(GlSharingTests, givenClGLBufferWhenCreatedThenSharedBufferAllocatoinTypeIsSet) {
std::unique_ptr<Buffer> buffer(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, nullptr)); std::unique_ptr<Buffer> buffer(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId, nullptr));
ASSERT_NE(nullptr, buffer->getGraphicsAllocation(rootDeviceIndex)); ASSERT_NE(nullptr, buffer->getGraphicsAllocation(rootDeviceIndex));
EXPECT_EQ(AllocationType::SHARED_BUFFER, buffer->getGraphicsAllocation(rootDeviceIndex)->getAllocationType()); EXPECT_EQ(AllocationType::SHARED_BUFFER, buffer->getGraphicsAllocation(rootDeviceIndex)->getAllocationType());
} }
using clGetSupportedGLTextureFormatsINTELTests = glSharingTests; using clGetSupportedGLTextureFormatsINTELTests = GlSharingTests;
TEST_F(clGetSupportedGLTextureFormatsINTELTests, givenContextWithoutGlSharingWhenGettingFormatsThenInvalidContextErrorIsReturned) { TEST_F(clGetSupportedGLTextureFormatsINTELTests, givenContextWithoutGlSharingWhenGettingFormatsThenInvalidContextErrorIsReturned) {
MockContext context; MockContext context;

View File

@ -20,7 +20,7 @@ using namespace NEO;
LARGE_INTEGER valueToSet = {}; LARGE_INTEGER valueToSet = {};
BOOL WINAPI QueryPerformanceCounterMock( BOOL WINAPI queryPerformanceCounterMock(
_Out_ LARGE_INTEGER *lpPerformanceCount) { _Out_ LARGE_INTEGER *lpPerformanceCount) {
*lpPerformanceCount = valueToSet; *lpPerformanceCount = valueToSet;
return true; return true;
@ -139,7 +139,7 @@ TEST_F(OSTimeWinTest, givenOsTimeWinWhenGetCpuRawTimestampIsCalledThenReturnsNon
} }
TEST_F(OSTimeWinTest, givenHighValueOfCpuTimestampWhenItIsObtainedThenItHasProperValue) { TEST_F(OSTimeWinTest, givenHighValueOfCpuTimestampWhenItIsObtainedThenItHasProperValue) {
osTime->overrideQueryPerformanceCounterFunction(QueryPerformanceCounterMock); osTime->overrideQueryPerformanceCounterFunction(queryPerformanceCounterMock);
LARGE_INTEGER frequency = {}; LARGE_INTEGER frequency = {};
frequency.QuadPart = 190457; frequency.QuadPart = 190457;
osTime->setFrequency(frequency); osTime->setFrequency(frequency);