Add new debug flag allowing to not register trim callback.

Change-Id: I615be3edc9d843fb7b37cf32f2abd5e2839d6ada
This commit is contained in:
Mrozek, Michal 2018-09-17 18:23:04 -07:00 committed by sys_ocldev
parent a2ed6861d8
commit f5a2b38fa4
5 changed files with 15 additions and 1 deletions

View File

@ -51,6 +51,7 @@ DECLARE_DEBUG_VARIABLE(bool, ForceDispatchScheduler, false, "dispatches schedule
DECLARE_DEBUG_VARIABLE(bool, TrackParentEvents, false, "events track their parents")
DECLARE_DEBUG_VARIABLE(bool, RebuildPrecompiledKernels, false, "forces driver to recompile precompiled kernels from sources")
DECLARE_DEBUG_VARIABLE(bool, LoopAtPlatformInitialize, false, "Adds endless loop in platform initalize, useful for debugging.")
DECLARE_DEBUG_VARIABLE(bool, DoNotRegisterTrimCallback, false, "When set to true driver is not registering trim callback.")
/*LOGGING FLAGS*/
DECLARE_DEBUG_VARIABLE(bool, PrintDebugMessages, false, "when enabled, some debug messages will be propagated to console")
DECLARE_DEBUG_VARIABLE(bool, DumpKernels, false, "Enables dumping kernels' program source code to text files and program from binary to bin file")

View File

@ -826,6 +826,9 @@ uint64_t Wddm::getHeap32Size() {
}
void Wddm::registerTrimCallback(PFND3DKMT_TRIMNOTIFICATIONCALLBACK callback, WddmMemoryManager *memoryManager) {
if (DebugManager.flags.DoNotRegisterTrimCallback.get()) {
return;
}
D3DKMT_REGISTERTRIMNOTIFICATION registerTrimNotification;
registerTrimNotification.Callback = callback;
registerTrimNotification.AdapterLuid = this->adapterLuid;

View File

@ -59,6 +59,7 @@ class WddmMock : public Wddm {
using Wddm::pagingFenceAddress;
using Wddm::pagingQueue;
using Wddm::preemptionMode;
using Wddm::trimCallbackHandle;
using Wddm::wddmInterface;
WddmMock() : Wddm(){};

View File

@ -1107,6 +1107,14 @@ TEST_F(WddmMemoryManagerResidencyTest, trimCallbackIsRegisteredInWddmMemoryManag
EXPECT_EQ(wddm->getDevice(), gdi->getRegisterTrimNotificationArg().hDevice);
}
TEST(WddmDebugModesTests, givenDebugModeWhenItIsActiveThenTrimCallbackIsNotRegistred) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.DoNotRegisterTrimCallback.set(true);
WddmMock wddm;
wddm.init();
EXPECT_EQ(nullptr, wddm.trimCallbackHandle);
}
TEST_F(WddmMemoryManagerResidencyTest, givenNotUsedAllocationsFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenAllocationsAreEvictedMarkedAndRemovedFromTrimCandidateList) {
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
trimNotification.Flags.PeriodicTrim = 1;

View File

@ -83,4 +83,5 @@ CreateMultipleDevices = 0
EnableExperimentalCommandBuffer = 0
LoopAtPlatformInitialize = false
EnableTimestampPacket = false
ReturnRawGpuTimestamps = 0
ReturnRawGpuTimestamps = 0
DoNotRegisterTrimCallback = false