Supporting Miracast wireless display

Support for the Miracast wireless display standard was introduced in Windows 8.1 (WDDM 1.3).

Supporting Miracast starting in Windows 10

Starting in Windows 10 (WDDM 2.0), the operating system ships with a built-in Miracast stack that can work on any GPU. For information about the Microsoft Miracast stack and the requirements of drivers and hardware to support Miracast displays starting in Windows 10, see the following documentation:

Driver developers should no longer implement a custom Miracast stack. Microsoft might remove support for custom Miracast stacks in a future version of Windows.

Supporting Miracast in Windows 8.1

WDDM 1.3 drivers could optionally support Miracast through the Miracast DDIs provided in that release. The rest of this article and its related articles describe how to provide that support.

User-mode device driver interfaces (DDIs)

Wireless display callback functions called by Miracast user-mode drivers

The following table lists the wireless display (Miracast) user-mode functions that the operating system implements. Only Windows 8.1 Miracast user-mode drivers can call these functions. Pointers to the Miracast display callback functions are returned in a MIRACAST_CALLBACKS structure.

Function Description
PFN_GET_NEXT_CHUNK_DATA Provides info about the next Miracast encode chunk that was reported to the DirectX graphics kernel subsystem when the DXGK_INTERRUPT_TYPE interrupt type is DXGK_INTERRUPT_MIRACAST_CHUNK_PROCESSING_COMPLETE.
PFN_MIRACAST_IO_CONTROL Called by the user-mode display driver to send the kernel-mode display miniport driver a synchronous I/O control request.
PFN_REGISTER_DATARATE_NOTIFICATIONS Called by the user-mode driver to register with the operating system to receive network quality of service (QoS) notifications and the current network bandwidth of the Miracast connection.
PFN_REPORT_SESSION_STATUS Called by the user-mode display driver to report the status of the current Miracast connected session.
PFN_REPORT_STATISTIC Called by the user-mode display driver to report the statistics of the Miracast link to the operating system.

Wireless display functions implemented by Windows 8.1 Miracast user-mode drivers

The following table lists the wireless display (Miracast) functions that a Windows 8.1 Miracast user-mode driver must implement. This type of driver runs in a standalone DLL.

In response to an operating system call to the QueryMiracastDriverInterface function, the Miracast user-mode driver must supply pointers to these functions in the MIRACAST_DRIVER_INTERFACE structure. The exception is pfnDataRateNotify, which has a pointer declared in RegisterForDataRateNotifications.

Function Description
PFN_CREATE_MIRACAST_CONTEXT Called by the operating system to create a user-mode Miracast context.
PFN_DESTROY_MIRACAST_CONTEXT Called by the operating system to destroy a user-mode Miracast context.
PFN_HANDLE_KMD_MESSAGE Called by the operating system to handle the asynchronous kernel-mode message that the Miracast user-mode driver receives when the display miniport driver calls the DxgkCbMiracastSendMessage function.
PFN_DATARATE_NOTIFICATION Called by the operating system to notify the Miracast user-mode driver that the bit rate of the Miracast network link has changed. This function is registered with the operating system when the RegisterForDataRateNotifications function is called.
QUERY_MIRACAST_DRIVER_INTERFACE Called by the operating system to query the Miracast user-mode driver interface, MIRACAST_DRIVER_INTERFACE.
PFN_START_MIRACAST_SESSION Called by the operating system to start a Miracast connected session.
PFN_STOP_MIRACAST_SESSION Called by the operating system to start a Miracast connected session that was previously started by a call to the StartMiracastSession function.

The following table lists the user-mode structures and enumerations that are used with Windows 8.1 Miracast display device driver interfaces (DDIs).

Struct/Enum Description
MIRACAST_CALLBACKS Contains pointers to wireless display (Miracast) runtime callback functions that the Miracast user-mode driver can call.
MIRACAST_CHUNK_DATA Contains encode chunk data that is used when a user-mode driver calls the wireless display (Miracast) GetNextChunkData function.
MIRACAST_CHUNK_ID Stores info that identifies a wireless display (Miracast) encode chunk.
MIRACAST_CHUNK_INFO Contains info about a specified wireless display (Miracast) encode chunk.
MIRACAST_CHUNK_TYPE Specifies the types of wireless display (Miracast) chunk info that is to be processed.
MIRACAST_DATARATE_STATS Contains info used in the wireless display (Miracast) pfnDataRateNotify function about the audio/video encoder bit rate and failed or retried Wi-Fi frames.
MIRACAST_DRIVER_INTERFACE Contains pointers to wireless display (Miracast) functions that the Miracast user-mode driver implements.
MIRACAST_PROTOCOL_EVENT Specifies the types of wireless display (Miracast) protocol event that the user-mode display driver should report.
MIRACAST_SESSION_INFO Contains info on a wireless display (Miracast) connected session.
MIRACAST_STATISTIC_DATA Contains Miracast statistics data that the user-mode display driver reports to the operating system.
MIRACAST_STATISTIC_TYPE Specifies types of Miracast statistics data that the user-mode display driver generates.
MIRACAST_STATUS Specifies status types that the user-mode display driver uses to report Miracast connection status.
MIRACAST_WFD_CONNECTION_STATS Contains bit rate info on the Wi-Fi Direct connection.

The following user-mode structures and enumerations support Miracast displays and were new or updated for Windows 8.1:

Kernel-mode DDIs

Wireless display (Miracast) display callback interface

The Miracast display callback interface contains functions that the DirectX graphics kernel subsystem implements to support wireless (Miracast) displays in Windows 8.1.

The following table lists these kernel-mode functions, which are called by WDDM 1.3 display miniport drivers:

Function Description
DXGKCB_MIRACAST_SEND_MESSAGE Sends an asynchronous message to the user-mode display driver.
DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK Called in kernel mode when the message that was sent to the user-mode driver with a call to the DxgkCbMiracastSendMessage function has completed or has been canceled.
DXGKCB_MIRACAST_REPORT_CHUNK_INFO Called by the display miniport driver to report info about an encode chunk.

The display miniport driver must fill in pointers to these functions in the DXGK_MIRACAST_DISPLAY_CALLBACKS structure.

Wireless display (Miracast) interface

The following table lists the kernel-mode functions that display miniport drivers implement to support wireless (Miracast) displays in Windows 8.1. Pointers to the Miracast interface functions are returned in a DXGK_MIRACAST_INTERFACE structure.

Function Description
DXGKCB_MIRACAST_SEND_MESSAGE_CALLBACK Called in kernel mode when the message that was sent to the user-mode driver with a call to the DxgkCbMiracastSendMessage function has completed or has been canceled.
DXGKDDI_MIRACAST_CREATE_CONTEXT Creates a kernel-mode context for a Miracast device.
DXGKDDI_MIRACAST_DESTROY_CONTEXT Destroys an instance of a Miracast device.
DXGKDDI_MIRACAST_HANDLE_IO_CONTROL Called by the operating system to request that the display miniport driver process a synchronous I/O control request in response to a user-mode display driver call to the MiracastIoControl function.
DXGKDDI_MIRACAST_QUERY_CAPS Queries the Miracast capabilities of the current display adapter. The operating system calls this function only when the display adapter is first started and then stores the capabilities that are returned.

These kernel-mode structures and enumerations support Miracast displays and were new or updated for Windows 8.1: