Make the EnableVaLibCalls debug key tri-state (-1/0/1)

Related-To: NEO-5110

Change-Id: I56b709e266a091fca68b55ff136690d673773734
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
Slawomir Milczarek
2020-10-20 12:37:09 +02:00
committed by sys_ocldev
parent 9f08a60a20
commit 5d9467b753
4 changed files with 39 additions and 3 deletions

View File

@@ -43,7 +43,12 @@ bool VASharingFunctions::isVaLibraryAvailable() {
}
void VASharingFunctions::initFunctions() {
if (DebugManager.flags.EnableVaLibCalls.get()) {
bool enableVaLibCalls = true;
if (DebugManager.flags.EnableVaLibCalls.get() != -1) {
enableVaLibCalls = !!DebugManager.flags.EnableVaLibCalls.get();
}
if (enableVaLibCalls) {
libHandle = fdlopen(Os::libvaDllName, RTLD_LAZY);
if (libHandle) {
vaDisplayIsValidPFN = reinterpret_cast<VADisplayIsValidPFN>(fdlsym(libHandle, "vaDisplayIsValid"));

View File

@@ -90,6 +90,37 @@ TEST(VASharingFunctions, GivenInitFunctionsWhenDLOpenSuccedsThenFunctionsAreNotN
EXPECT_TRUE(functions.wereFunctionsAssigned());
}
TEST(VASharingFunctions, GivenInitFunctionsWhenEnableVaLibCallsThenFunctionsAreAssigned) {
DebugManagerStateRestore restorer;
VariableBackup<decltype(VASharingFunctions::fdlopen)> dlopenBackup(&VASharingFunctions::fdlopen);
VariableBackup<decltype(VASharingFunctions::fdlsym)> dlsymBackup(&VASharingFunctions::fdlsym);
VariableBackup<decltype(VASharingFunctions::fdlclose)> dlcloseBackup(&VASharingFunctions::fdlclose);
std::unique_ptr<uint32_t> valib(new uint32_t);
ASSERT_NE(nullptr, valib.get());
VASharingFunctions::fdlopen = [&](const char *filename, int flag) -> void * {
return valib.get();
};
VASharingFunctions::fdlsym = [&](void *handle, const char *symbol) -> void * {
return (void *)GetLibFunc;
};
VASharingFunctions::fdlclose = [&](void *handle) -> int {
return 0;
};
EXPECT_EQ(-1, DebugManager.flags.EnableVaLibCalls.get());
VASharingFunctionsTested functionsWithDefaultVaLibCalls;
EXPECT_TRUE(functionsWithDefaultVaLibCalls.wereFunctionsAssigned());
DebugManager.flags.EnableVaLibCalls.set(1);
VASharingFunctionsTested functionsWithEnabledVaLibCalls;
EXPECT_TRUE(functionsWithEnabledVaLibCalls.wereFunctionsAssigned());
}
TEST(VASharingFunctions, GivenFunctionsWhenNoLibvaThenDlcloseNotCalled) {
VariableBackup<decltype(VASharingFunctions::fdlopen)> dlopenBackup(&VASharingFunctions::fdlopen);
VariableBackup<decltype(VASharingFunctions::fdlsym)> dlsymBackup(&VASharingFunctions::fdlsym);

View File

@@ -113,7 +113,7 @@ EnableGemCloseWorker = -1
EnableComputeWorkSizeND = 1
EnableMultiRootDeviceContexts = 0
EnableComputeWorkSizeSquared = 0
EnableVaLibCalls = 1
EnableVaLibCalls = -1
EnableExtendedVaFormats = 0
AddClGlSharing = 0
EnableFormatQuery = 0

View File

@@ -158,7 +158,6 @@ DECLARE_DEBUG_VARIABLE(bool, EnableForcePin, true, "Enables early pinning for me
DECLARE_DEBUG_VARIABLE(bool, EnableComputeWorkSizeND, true, "Enables diffrent algorithm to compute local work size")
DECLARE_DEBUG_VARIABLE(bool, EnableMultiRootDeviceContexts, false, "Enables support for multi root device contexts")
DECLARE_DEBUG_VARIABLE(bool, EnableComputeWorkSizeSquared, false, "Enables algorithm to compute the most squared work group as possible")
DECLARE_DEBUG_VARIABLE(bool, EnableVaLibCalls, true, "Enable cl-va sharing lib calls")
DECLARE_DEBUG_VARIABLE(bool, EnableExtendedVaFormats, false, "Enable more formats in cl-va sharing")
DECLARE_DEBUG_VARIABLE(bool, AddClGlSharing, false, "Add cl-gl extension")
DECLARE_DEBUG_VARIABLE(bool, EnableFormatQuery, false, "Enable sharing format querying")
@@ -173,6 +172,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, EnableBlitterOperationsForReadWriteBuffers, -1,
DECLARE_DEBUG_VARIABLE(int32_t, EnableCacheFlushAfterWalker, -1, "-1: platform behavior, 0: disabled, 1: enabled. Adds dedicated cache flush command after WALKER command when surfaces used by kernel require to flush the cache")
DECLARE_DEBUG_VARIABLE(int32_t, EnableLocalMemory, -1, "-1: default behavior, 0: disabled, 1: enabled, Allows allocating graphics memory in Local Memory")
DECLARE_DEBUG_VARIABLE(int32_t, EnableStatelessToStatefulBufferOffsetOpt, -1, "-1: dont override, 0: disable, 1: enable, Enables buffer-offset improvement of the stateless to stateful optimization")
DECLARE_DEBUG_VARIABLE(int32_t, EnableVaLibCalls, -1, "-1: default, 0: disable, 1: enable cl-va sharing lib calls")
DECLARE_DEBUG_VARIABLE(int32_t, CreateMultipleRootDevices, 0, "0: default - disable, 1+: Driver will create multiple (N) devices during initialization.")
DECLARE_DEBUG_VARIABLE(int32_t, CreateMultipleSubDevices, 0, "0: default - disable, 1+: Driver will create multiple (N) sub devices during initialization.")
DECLARE_DEBUG_VARIABLE(int32_t, LimitAmountOfReturnedDevices, 0, "0: default - disable, 1+: Driver will limit the number of devices returned from clGetDeviceIds to N.")