DXGKDDI_NOTIFY_SURPRISE_REMOVAL - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// dispmprt.h

DXGKDDI_NOTIFY_SURPRISE_REMOVAL DxgkddiNotifySurpriseRemoval;

NTSTATUS DxgkddiNotifySurpriseRemoval(
  [in] PVOID MiniportDeviceContext,
  [in] DXGK_SURPRISE_REMOVAL_TYPE RemovalType
)
{...}
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nc-dispmprt-dxgkddi_notify_surprise_removal)

DXGKDDI_NOTIFY_SURPRISE_REMOVAL callback function

Description

DXGKDDI_NOTIFY_SURPRISE_REMOVAL is called by the operating system when a user disconnects an external display device without notifying the system.

Parameters

MiniportDeviceContext [in]

A handle to a context block associated with a display adapter. The display miniport driver's DxgkDdiAddDevice function previously provided this handle to the DirectX graphics kernel subsystem.

RemovalType [in]

A value of type DXGK_SURPRISE_REMOVAL_TYPE that identifies the type of surprise removal event.

Return value

Returns STATUS_SUCCESS if software resources were cleaned up for RemovalType = DxgkRemovalHibernation. If the driver instead returns an error code, the operating system will attempt to reboot the system, as described in the following Remarks section.

Remarks

This callback can be optionally be implemented by Windows Display Driver Model (WDDM) 1.2 and later display miniport drivers.

[!NOTE]

The operating system calls DxgkDdiNotifySurpriseRemoval only if the display miniport driver indicates support by setting the SupportSurpriseRemovalInHibernation member of the DXGK_DRIVERCAPS structure to 1.

When the OS detects a surprise removal, it notifies the driver as quickly as possible. DxgkDdiNotifySurpriseRemoval is a level zero DDI function, which means that it can be called when a driver has pending GPU workload and/or is running inside other DDI functions. Since a call to this function indicates the graphics hardware has been physically removed or has disappeared from system, any further attempt to access hardware might cause problems such as a hard hang.

The OS categorizes surprise removal as follows:

If the display miniport driver returns STATUS_SUCCESS, the DirectX graphics kernel subsystem will continue to remove the external display adapter from the graphics stack and will call other driver-implemented DxgkDdiXxx kernel-mode functions to release all resources. In this case, the driver must complete its cleanup of software resources in response to calls from the operating system but must not touch or clean any hardware settings. If no other hardware is using the driver, the operating system will unload the driver.

If the driver returns an error code, does not set DXGK_DRIVERCAPS.SupportSurpriseRemovalInHibernation, or does not implement this function, the DirectX graphics kernel subsystem will not call any more driver-implemented DxgkDdiXxx functions and will attempt to reboot the system. In this case, the resource that was allocated before the external display device was disconnected will not be released.

See also

D3DKMT_WDDM_1_2_CAPS

DXGK_DRIVERCAPS

DXGK_SURPRISE_REMOVAL_TYPE

DxgkDdiAddDevice