Testing and debugging TDR during driver development

This article provides TDR (timeout detection and recovery) testing and debugging strategies for display driver developers.

TDR tests in WHLK

The Windows Hardware Lab Kit (WHLK) contains TDR-specific tests that driver developers can use for testing and debugging purposes. For example, developers can manually trigger a GPU TDR using the SimulatePreemption TDR. See Device.Graphics for more information about the various TDR-related tests.

TDR registry keys for testing and debugging

Developers can use the following TDR-related registry keys for testing or debugging purposes only during the driver development process.

Important

These registry keys should not be manipulated by end users, or by applications outside of targeted testing or debugging during driver development.

TdrLevel

Specifies the initial level of recovery.

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrLevel
ValueType : REG_DWORD
ValueData : TdrLevelXxx (see the following table)

Where TdrLevelXxx can be one of the following values:

Value Meaning
TdrLevelOff (0) Detection disabled
TdrLevelBugcheck (1) Bug check on detected timeout; for example, no recovery.
TdrLevelRecoverVGA (2) Recover to VGA (not implemented).
TdrLevelRecover (3) Recover on timeout (default value).

TdrDelay

Specifies the number of seconds that the GPU can delay the preempt request from the GPU scheduler. TdrDelay is effectively the timeout threshold.

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrDelay
ValueType : REG_DWORD
ValueData : Number of seconds to delay. The default value is 2 seconds.

TdrDdiDelay

Specifies the number of seconds that the OS allows threads to leave the driver. After a specified time, the OS bug-checks the computer with the code VIDEO_TDR_FAILURE (0x116).

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrDdiDelay
ValueType : REG_DWORD
ValueData : Number of seconds to leave the driver. The default value is 5 seconds.

TdrDebugMode

Specifies the debugging-related behavior of the TDR process. The default value is TDR_DEBUG_MODE_RECOVER_NO_PROMPT, which indicates not to break into the debugger.

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrDebugMode
ValueType : REG_DWORD
ValueData : TDR_DEBUG_MODE_XXX (see the following table)
Value Meaning
TDR_DEBUG_MODE_OFF (0) Break to kernel debugger before the recovery to allow investigation of the timeout.
TDR_DEBUG_MODE_IGNORE_TIMEOUT (1) Ignore any timeout.
TDR_DEBUG_MODE_RECOVER_NO_PROMPT (2) Recover without breaking into the debugger (default value).
TDR_DEBUG_MODE_RECOVER_UNCONDITIONAL (3) Recover even if some recovery conditions aren't met (for example, recover on consecutive timeouts).

TdrLimitTime

Specifies the default time within which a specific number of TDRs (specified by the TdrLimitCount key) are allowed without crashing the computer.

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrLimitTime
ValueType : REG_DWORD
ValueData : Number of seconds before crashing. The default value is 60 seconds.

TdrLimitCount

Specifies the default number of TDRs (0x117) that are allowed during the time specified by the TdrLimitTime key without crashing the computer.

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrLimitCount
ValueType : REG_DWORD
ValueData : Number of TDRs before crashing. The default value is 5.

TdrTestMode

Reserved. Don't use.

KeyPath   : HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
KeyValue  : TdrTestMode
ValueType : REG_DWORD
ValueData : Do not use.