How to realize hot-plug function of Virtual Display with indirect display?

on basis of this sample github.com/kfroe/IndirectDisplay i have realized virtual monitor in win10, But i want to realize the hot-plug function that using DeviceIoControl from application to open/close virtual monitor,what would i do?

1 Like

If you want the display to come and go dynamically, a root device is not going to help you. You need a root enumerated bus driver which will then enumerate a child display device(s). Statbus and dynambus in the wdk toaster sample both show how to implement a root enumerated bus driver and you can probably reuse 95% of the code there. You will need to change the hardware id of the virtual display device in the virtual display inf too d

Hi ,
thanks for your reply,the indirect display sample in github what noticed above is based on wdf framework,now ,in oder to implement communication from application to driver, i use WdfDeviceCreateDeviceInterface function to generate the guid that application can find and CreateFile with it ,but it does not work when driver init IDD_CX_CLIENT_CONFIG struct. it return fail. so, it seam to should not handle DeviceIoControl message via standard driver device, it seam to use idd device,because i find the attribute of EvtIddCxDeviceIoControl In IDD_CX_CLIENT_CONFIG struct ,what does the mean of the attribute of EvtIddCxDeviceIoControl? How to establish communication between application and idd device?thank you.

@JiaBang_Lin
Hi JiaBang,
some times ago,i ask you for some advice about LCI proxy driver in github, now,could you help me solve this problem, thank you .

wentao786 wrote:

it return fail.

What fails?  Do you mean the CreateFile fails?  How did you get the file
name to open?

In IDD_CX_CLIENT_CONFIG struct ,what does the mean of the attribute of EvtIddCxDeviceIoControl? How to establish communication between application and idd device?thank you.

Ordinarily, the IddCx framework handles all of the ioctls internally. 
The EvtIddCxDeviceIoControl callback lets you handle them instead.

Hi,
in Indirect display driver,after use WdfDeviceCreateDeviceInterface to create guid,you should use IddCxDeviceInitialize,IddDeviceIoControl is not the same as other wdf’s DeviceIoControl function ,his first argument is WDFDEVICE Device,not WDFQUEUE,so you don’t need to use WdfIoQueueCreate to create a queue to receive I/O queue message.After all of the above,you should create IOCTL code,this can establish communication between application and idd device.

Doron’s approach is correct and would work, but usually it is not necessary in a WDDM IddCx driver. Typically it is not the graphics adapter itself which needs to be hot-plugged. Typically it is the display monitor which is hot-plugged. The display monitor is a child device object of the WDDM IddCx Adapter device object. The IddCx framework itself (namely IndirectKmd.sys kernel mode filter driver) acts as a bus driver creating a child device object (PDO) for each hot-plugged display monitor. In a WDDM IddCx driver, a new display monitor child device object is created using IddCxMonitorCreate(…). After being created, it can be hot-plugged using IddCxMonitorArrival(…). Currently IddCx seems to support up to 16 hot-plugged display monitors. If more than 16 are needed, then Doron’s approach could be used to support multiple IddCx Adapters.

Marcel Ruedinger
datronicsoft

@Marcel_Ruedinger said:
Doron’s approach is correct and would work, but usually it is not necessary in a WDDM IddCx driver. Typically it is not the graphics adapter itself which needs to be hot-plugged. Typically it is the display monitor which is hot-plugged. The display monitor is a child device object of the WDDM IddCx Adapter device object. The IddCx framework itself (namely IndirectKmd.sys kernel mode filter driver) acts as a bus driver creating a child device object (PDO) for each hot-plugged display monitor. In a WDDM IddCx driver, a new display monitor child device object is created using IddCxMonitorCreate(…). After being created, it can be hot-plugged using IddCxMonitorArrival(…). Currently IddCx seems to support up to 16 hot-plugged display monitors. If more than 16 are needed, then Doron’s approach could be used to support multiple IddCx Adapters.

Marcel Ruedinger
datronicsoft

hi,can i ask you a question?I use Idd drvier to plugin a monitor,and it works in my physical machine,but i try it to my kvm virtual machine(i passthrough a NVIDIA adapter to it),the monitor can plugin to the win10 system,but the monitor’s status is “display is not active”,because of it, i can’t extend the second montior.I don’t know why Idd driver in virtual machine with NVIDIA adpater passthrough can’t let NVIDIA adpater use the monitor…thanks

If you develop WDDM IddCx driver, then you should always compare your driver to the two WDDM IddCx drivers with the largest market share worldwide. Buy a DisplayLink USB Display and download spacedesk multi monitor virtual display software (our freeware).
If these two products work and yours doesn’t, then it is your driver’s problem.
If these two don’t work, then it is most likely an IddCx problem.
Hint: When testing Wddm IddCx drivers in virtual machines, then always also test with Microsoft Basic Display as main monitor.
Marcel Ruedinger
datronicsoft

@Marcel_Ruedinger said:
If you develop WDDM IddCx driver, then you should always compare your driver to the two WDDM IddCx drivers with the largest market share worldwide. Buy a DisplayLink USB Display and download spacedesk multi monitor virtual display software (our freeware).
If these two products work and yours doesn’t, then it is your driver’s problem.
If these two don’t work, then it is most likely an IddCx problem.
Hint: When testing Wddm IddCx drivers in virtual machines, then always also test with Microsoft Basic Display as main monitor.
Marcel Ruedinger
datronicsoft

Hi,first of all, thank you for giving me these suggestions,i had tried my IddCx driver in vmvare and kvm machine,when i use Microsoft Basic Display as main monitor,iddCx driver can works now, but i still have some other questions about Iddcx driver,i just started learning the driver for about half a year,may I ask you some related questions?Thank you!