mirror of
https://github.com/intel/compute-runtime.git
synced 2025-11-10 05:49:51 +08:00
Remove Context::processExtraProperties function
Related-To: NEO-4700 Simplify SharingContextBuilder::processProperties function. Change-Id: I78bbf06c688c37490d9d7f09c9bfc451f1e68d30 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0d35af9327
commit
818a5a683e
@@ -7,7 +7,6 @@
|
||||
set(RUNTIME_SRCS_CONTEXT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/context_extra.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context_type.h
|
||||
|
||||
@@ -153,10 +153,8 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
interopUserSync = propertyValue > 0;
|
||||
break;
|
||||
default:
|
||||
if (!sharingBuilder->processProperties(propertyType, propertyValue, errcodeRet)) {
|
||||
errcodeRet = processExtraProperties(propertyType, propertyValue);
|
||||
}
|
||||
if (errcodeRet != CL_SUCCESS) {
|
||||
if (!sharingBuilder->processProperties(propertyType, propertyValue)) {
|
||||
errcodeRet = CL_INVALID_PROPERTY;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -178,7 +178,6 @@ class Context : public BaseObject<_cl_context> {
|
||||
// OS specific implementation
|
||||
void *getOsContextInfo(cl_context_info ¶mName, size_t *srcParamSize);
|
||||
|
||||
cl_int processExtraProperties(cl_context_properties propertyType, cl_context_properties propertyValue);
|
||||
void setupContextType();
|
||||
|
||||
std::set<uint32_t> rootDeviceIndices = {};
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/mem_obj/mem_obj.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
cl_int Context::processExtraProperties(cl_context_properties propertyType, cl_context_properties propertyValue) {
|
||||
return CL_INVALID_PROPERTY;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -23,11 +23,10 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
|
||||
bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
if (contextData.get() == nullptr) {
|
||||
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D9>>();
|
||||
}
|
||||
bool res = false;
|
||||
|
||||
switch (propertyType) {
|
||||
case CL_CONTEXT_ADAPTER_D3D9_KHR:
|
||||
@@ -38,41 +37,37 @@ bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_contex
|
||||
case CL_CONTEXT_DXVA_DEVICE_INTEL:
|
||||
contextData->pDevice = (D3DTypesHelper::D3D9::D3DDevice *)propertyValue;
|
||||
contextData->argumentsDefined = true;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool D3DSharingContextBuilder<D3DTypesHelper::D3D10>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
|
||||
bool D3DSharingContextBuilder<D3DTypesHelper::D3D10>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
if (contextData.get() == nullptr) {
|
||||
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D10>>();
|
||||
}
|
||||
bool res = false;
|
||||
|
||||
switch (propertyType) {
|
||||
case CL_CONTEXT_D3D10_DEVICE_KHR:
|
||||
contextData->pDevice = (D3DTypesHelper::D3D10::D3DDevice *)propertyValue;
|
||||
contextData->argumentsDefined = true;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool D3DSharingContextBuilder<D3DTypesHelper::D3D11>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
|
||||
bool D3DSharingContextBuilder<D3DTypesHelper::D3D11>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
if (contextData.get() == nullptr) {
|
||||
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D11>>();
|
||||
}
|
||||
bool res = false;
|
||||
|
||||
switch (propertyType) {
|
||||
case CL_CONTEXT_D3D11_DEVICE_KHR:
|
||||
contextData->pDevice = (D3DTypesHelper::D3D11::D3DDevice *)propertyValue;
|
||||
contextData->argumentsDefined = true;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -27,7 +27,7 @@ class D3DSharingContextBuilder : public SharingContextBuilder {
|
||||
std::unique_ptr<D3DCreateContextProperties<D3D>> contextData;
|
||||
|
||||
public:
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) override;
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) override;
|
||||
bool finalizeProperties(Context &context, int32_t &errcodeRet) override;
|
||||
};
|
||||
|
||||
@@ -41,4 +41,4 @@ class D3DSharingBuilderFactory : public SharingBuilderFactory {
|
||||
void setExtensionEnabled(DriverInfo *driverInfo) override;
|
||||
bool extensionEnabled = true;
|
||||
};
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
||||
@@ -20,39 +20,29 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool GlSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue,
|
||||
cl_int &errcodeRet) {
|
||||
bool GlSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
if (contextData.get() == nullptr) {
|
||||
contextData = std::make_unique<GlCreateContextProperties>();
|
||||
}
|
||||
bool res = false;
|
||||
|
||||
switch (propertyType) {
|
||||
case CL_GL_CONTEXT_KHR:
|
||||
contextData->GLHGLRCHandle = (GLContext)propertyValue;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
case CL_WGL_HDC_KHR:
|
||||
contextData->GLHDCType = (GLType)CL_WGL_HDC_KHR;
|
||||
contextData->GLHDCHandle = (GLDisplay)propertyValue;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
case CL_GLX_DISPLAY_KHR:
|
||||
contextData->GLHDCType = (GLType)CL_GLX_DISPLAY_KHR;
|
||||
contextData->GLHDCHandle = (GLDisplay)propertyValue;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
case CL_EGL_DISPLAY_KHR:
|
||||
contextData->GLHDCType = (GLType)CL_EGL_DISPLAY_KHR;
|
||||
contextData->GLHDCHandle = (GLDisplay)propertyValue;
|
||||
res = true;
|
||||
break;
|
||||
case CL_CGL_SHAREGROUP_KHR:
|
||||
errcodeRet = CL_INVALID_PROPERTY;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GlSharingContextBuilder::finalizeProperties(Context &context, int32_t &errcodeRet) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class GlSharingContextBuilder : public SharingContextBuilder {
|
||||
std::unique_ptr<GlCreateContextProperties> contextData;
|
||||
|
||||
public:
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) override;
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) override;
|
||||
bool finalizeProperties(Context &context, int32_t &errcodeRet) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ void *SharingFactory::getExtensionFunctionAddress(const std::string &functionNam
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SharingFactory::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
|
||||
bool SharingFactory::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
for (auto &sharing : sharings) {
|
||||
if (sharing->processProperties(propertyType, propertyValue, errcodeRet))
|
||||
if (sharing->processProperties(propertyType, propertyValue))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -29,7 +29,7 @@ enum SharingType {
|
||||
class SharingContextBuilder {
|
||||
public:
|
||||
virtual ~SharingContextBuilder() = default;
|
||||
virtual bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) = 0;
|
||||
virtual bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) = 0;
|
||||
virtual bool finalizeProperties(Context &context, int32_t &errcodeRet) = 0;
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ class SharingFactory {
|
||||
};
|
||||
|
||||
static std::unique_ptr<SharingFactory> build();
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet);
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue);
|
||||
bool finalizeProperties(Context &context, int32_t &errcodeRet);
|
||||
std::string getExtensions(DriverInfo *driverInfo);
|
||||
void fillGlobalDispatchTable();
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool UnifiedSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue,
|
||||
cl_int &errcodeRet) {
|
||||
bool UnifiedSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
switch (propertyType) {
|
||||
case static_cast<cl_context_properties>(UnifiedSharingContextType::DeviceHandle):
|
||||
case static_cast<cl_context_properties>(UnifiedSharingContextType::DeviceGroup):
|
||||
|
||||
@@ -21,7 +21,7 @@ class UnifiedSharingContextBuilder : public SharingContextBuilder {
|
||||
std::unique_ptr<UnifiedCreateContextProperties> contextData;
|
||||
|
||||
public:
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) override;
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) override;
|
||||
bool finalizeProperties(Context &context, int32_t &errcodeRet) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -23,19 +23,17 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool VaSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
|
||||
bool VaSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
if (contextData.get() == nullptr) {
|
||||
contextData = std::make_unique<VaCreateContextProperties>();
|
||||
}
|
||||
bool res = false;
|
||||
|
||||
switch (propertyType) {
|
||||
case CL_CONTEXT_VA_API_DISPLAY_INTEL:
|
||||
contextData->vaDisplay = (VADisplay)propertyValue;
|
||||
res = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return res;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VaSharingContextBuilder::finalizeProperties(Context &context, int32_t &errcodeRet) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class VaSharingContextBuilder : public SharingContextBuilder {
|
||||
std::unique_ptr<VaCreateContextProperties> contextData;
|
||||
|
||||
public:
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) override;
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) override;
|
||||
bool finalizeProperties(Context &context, int32_t &errcodeRet) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -70,31 +70,27 @@ TEST_F(GlSharingEnablerTests, givenGlFactoryWhenAskedThenBuilderIsCreated) {
|
||||
EXPECT_NE(nullptr, builder);
|
||||
}
|
||||
|
||||
TEST_F(GlSharingEnablerTests, givenGlBuilderWhenUnknownPropertyThenFalseIsReturnedAndErrcodeUnchanged) {
|
||||
TEST_F(GlSharingEnablerTests, givenGlBuilderWhenUnknownPropertyThenFalseIsReturned) {
|
||||
auto builder = factory->createContextBuilder();
|
||||
ASSERT_NE(nullptr, builder);
|
||||
|
||||
cl_context_properties property = CL_CONTEXT_PLATFORM;
|
||||
cl_context_properties value;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_FALSE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
}
|
||||
|
||||
TEST_F(GlSharingEnablerTests, givenGlBuilderWhenInvalidPropertyThenTrueIsReturnedAndErrcodeSet) {
|
||||
TEST_F(GlSharingEnablerTests, givenGlBuilderWhenInvalidPropertyThenFalseIsReturned) {
|
||||
auto builder = factory->createContextBuilder();
|
||||
ASSERT_NE(nullptr, builder);
|
||||
|
||||
cl_context_properties property = CL_CGL_SHAREGROUP_KHR;
|
||||
cl_context_properties value;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_INVALID_PROPERTY, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_FALSE(res);
|
||||
}
|
||||
|
||||
TEST_F(GlSharingEnablerTests, givenGlBuilderWhenValidPropertyThenTrueIsReturnedAndErrcodeUnchanged) {
|
||||
TEST_F(GlSharingEnablerTests, givenGlBuilderWhenValidPropertyThenTrueIsReturned) {
|
||||
cl_context_properties props[] = {CL_GL_CONTEXT_KHR, CL_WGL_HDC_KHR, CL_GLX_DISPLAY_KHR, CL_EGL_DISPLAY_KHR};
|
||||
for (auto currProperty : props) {
|
||||
auto builder = factory->createContextBuilder();
|
||||
@@ -102,16 +98,13 @@ TEST_F(GlSharingEnablerTests, givenGlBuilderWhenValidPropertyThenTrueIsReturnedA
|
||||
|
||||
cl_context_properties property = currProperty;
|
||||
cl_context_properties value = 0x10000;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
// repeat to check if we don't allocate twice
|
||||
auto prevAllocations = MemoryManagement::numAllocations.load();
|
||||
res = builder->processProperties(property, value, errcodeRet);
|
||||
res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
auto currAllocations = MemoryManagement::numAllocations.load();
|
||||
EXPECT_EQ(prevAllocations, currAllocations);
|
||||
}
|
||||
@@ -134,13 +127,11 @@ TEST_F(GlSharingEnablerTests, givenGlBuilderWhenInvalidPropertiesThenFinalizerRe
|
||||
|
||||
cl_context_properties property = CL_CONTEXT_PLATFORM;
|
||||
cl_context_properties value;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_FALSE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
MockContext context;
|
||||
errcodeRet = CL_SUCCESS;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
res = builder->finalizeProperties(context, errcodeRet);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
@@ -152,13 +143,11 @@ TEST_F(GlSharingEnablerTests, givenGlBuilderWhenNullHandleThenFinalizerReturnsTr
|
||||
|
||||
cl_context_properties property = CL_GL_CONTEXT_KHR;
|
||||
cl_context_properties value = 0x0;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
MockContext context;
|
||||
errcodeRet = CL_SUCCESS;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
res = builder->finalizeProperties(context, errcodeRet);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
@@ -173,13 +162,11 @@ TEST_F(GlSharingEnablerTests, givenGlBuilderWhenHandleThenFinalizerReturnsTrueAn
|
||||
|
||||
cl_context_properties property = CL_GL_CONTEXT_KHR;
|
||||
cl_context_properties value = 0x1000;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
MockContext context;
|
||||
errcodeRet = CL_SUCCESS;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
res = builder->finalizeProperties(context, errcodeRet);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
@@ -94,11 +94,11 @@ class MockSharingContextBuilder : public SharingContextBuilder {
|
||||
cl_context_properties value;
|
||||
|
||||
public:
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) override;
|
||||
bool processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) override;
|
||||
bool finalizeProperties(Context &context, int32_t &errcodeRet) override;
|
||||
};
|
||||
|
||||
bool MockSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
|
||||
bool MockSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) {
|
||||
if (propertyType == clContextPropertyMock) {
|
||||
if (propertyValue) {
|
||||
value = propertyValue;
|
||||
@@ -277,4 +277,4 @@ TEST(SharingFactoryTests, givenEnabledFormatQueryAndFactoryWithNoSharingsWhenAsk
|
||||
|
||||
auto extensionsList = sharingFactory.getExtensions(nullptr);
|
||||
EXPECT_THAT(extensionsList, ::testing::Not(::testing::HasSubstr(Extensions::sharingFormatQuery)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,8 @@ TEST(UnifiedSharingTests, givenExternalDeviceHandleWhenProcessingBySharingContex
|
||||
MockUnifiedSharingContextBuilder builder{};
|
||||
cl_context_properties propertyType = static_cast<cl_context_properties>(UnifiedSharingContextType::DeviceHandle);
|
||||
cl_context_properties propertyValue = 0x1234;
|
||||
cl_int retVal{};
|
||||
bool result = builder.processProperties(propertyType, propertyValue, retVal);
|
||||
bool result = builder.processProperties(propertyType, propertyValue);
|
||||
EXPECT_TRUE(result);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, builder.contextData);
|
||||
}
|
||||
|
||||
@@ -55,10 +53,8 @@ TEST(UnifiedSharingTests, givenExternalDeviceGroupHandleWhenProcessingBySharingC
|
||||
MockUnifiedSharingContextBuilder builder{};
|
||||
cl_context_properties propertyType = static_cast<cl_context_properties>(UnifiedSharingContextType::DeviceGroup);
|
||||
cl_context_properties propertyValue = 0x1234;
|
||||
cl_int retVal{};
|
||||
bool result = builder.processProperties(propertyType, propertyValue, retVal);
|
||||
bool result = builder.processProperties(propertyType, propertyValue);
|
||||
EXPECT_TRUE(result);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, builder.contextData);
|
||||
}
|
||||
|
||||
@@ -66,10 +62,8 @@ TEST(UnifiedSharingTests, givenExternalDeviceGroupHandleWhenProcessingBySharingC
|
||||
MockUnifiedSharingContextBuilder builder{};
|
||||
cl_context_properties propertyType = CL_CONTEXT_PLATFORM;
|
||||
cl_context_properties propertyValue = 0x1234;
|
||||
cl_int retVal{};
|
||||
bool result = builder.processProperties(propertyType, propertyValue, retVal);
|
||||
bool result = builder.processProperties(propertyType, propertyValue);
|
||||
EXPECT_FALSE(result);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(nullptr, builder.contextData);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,34 +111,29 @@ TEST_F(VaSharingEnablerTests, givenVaFactoryWhenAskedThenBuilderIsCreated) {
|
||||
EXPECT_NE(nullptr, builder);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingEnablerTests, givenVaBuilderWhenUnknownPropertyThenFalseIsReturnedAndErrcodeUnchanged) {
|
||||
TEST_F(VaSharingEnablerTests, givenVaBuilderWhenUnknownPropertyThenFalseIsReturned) {
|
||||
auto builder = factory->createContextBuilder();
|
||||
ASSERT_NE(nullptr, builder);
|
||||
|
||||
cl_context_properties property = CL_CONTEXT_PLATFORM;
|
||||
cl_context_properties value;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_FALSE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
}
|
||||
|
||||
TEST_F(VaSharingEnablerTests, givenVaBuilderWhenValidPropertyThenTrueIsReturnedAndErrcodeUnchanged) {
|
||||
TEST_F(VaSharingEnablerTests, givenVaBuilderWhenValidPropertyThenTrueIsReturned) {
|
||||
auto builder = factory->createContextBuilder();
|
||||
ASSERT_NE(nullptr, builder);
|
||||
|
||||
cl_context_properties property = CL_CONTEXT_VA_API_DISPLAY_INTEL;
|
||||
cl_context_properties value = 0x1243;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
//repeat to check if we don't allocate twice
|
||||
auto prevAllocations = MemoryManagement::numAllocations.load();
|
||||
res = builder->processProperties(property, value, errcodeRet);
|
||||
res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
auto currAllocations = MemoryManagement::numAllocations.load();
|
||||
EXPECT_EQ(prevAllocations, currAllocations);
|
||||
}
|
||||
@@ -160,13 +155,11 @@ TEST_F(VaSharingEnablerTests, givenVaBuilderWhenInvalidPropertiesThenFinalizerRe
|
||||
|
||||
cl_context_properties property = CL_CONTEXT_PLATFORM;
|
||||
cl_context_properties value;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_FALSE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
MockContext context;
|
||||
errcodeRet = CL_SUCCESS;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
res = builder->finalizeProperties(context, errcodeRet);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
@@ -179,13 +172,11 @@ TEST_F(VaSharingEnablerTests, givenVaBuilderWhenValidPropertyButInvalidDisplayTh
|
||||
vaDisplayIsValidRet = 0;
|
||||
cl_context_properties property = CL_CONTEXT_VA_API_DISPLAY_INTEL;
|
||||
cl_context_properties value = 0x10000;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
MockContext context;
|
||||
errcodeRet = CL_SUCCESS;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
res = builder->finalizeProperties(context, errcodeRet);
|
||||
EXPECT_FALSE(res);
|
||||
EXPECT_EQ(CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL, errcodeRet);
|
||||
@@ -198,13 +189,11 @@ TEST_F(VaSharingEnablerTests, givenVaBuilderWhenValidPropertyButValidDisplayThen
|
||||
vaDisplayIsValidRet = 1;
|
||||
cl_context_properties property = CL_CONTEXT_VA_API_DISPLAY_INTEL;
|
||||
cl_context_properties value = 0x10000;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
auto res = builder->processProperties(property, value, errcodeRet);
|
||||
auto res = builder->processProperties(property, value);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
MockContext context;
|
||||
errcodeRet = CL_SUCCESS;
|
||||
int32_t errcodeRet = CL_SUCCESS;
|
||||
res = builder->finalizeProperties(context, errcodeRet);
|
||||
EXPECT_TRUE(res);
|
||||
EXPECT_EQ(CL_SUCCESS, errcodeRet);
|
||||
|
||||
Reference in New Issue
Block a user