Waiting a precise amount of time in a video miniport

I’m trying to write a Windows driver for the Intel UHD Graphics 605 and there are some parts of initialization that require the driver to wait a certain length of time. My first thought was to use KeQueryTickCount() and KeQueryTimeIncrement() but my code refused to compile. I tried including the header and library files necessary but it still wouldn’t compile. Further research showed this in the WDK documentation: “A miniport driver can only make calls exported by videoprt.sys” It looks like the closest function exported by videoprt.sys is VideoPortStallExecution(), but if at all possible I would prefer not to keep control of the CPU while I’m waiting.

There is also a statement on docs.microsoft.com that says, “All kernel-mode drivers except video and SCSI miniport drivers and NDIS drivers are likely to call at least some KeXxx routines”, so I can’t call anything beginning with “Ke” in a video miniport.

Just so you know that I’ve “done my homework” as requested by the community guidelines, I went through the i915 Linux code and official Intel PDF’s to figure out how the hardware works and then looked through the WDK documentation, MSDN, and sources for the the ET6000 and a couple of virtual video devices. Can someone recommend a good way to wait up to 2 milliseconds in a video miniport? Thank you in advance.

You can use VideoPortWaitForSingleObject with a timeout. If it is only during initialization, there’s nothing wrong with using VideoPortStallExecution for 2ms.

But what is really going on here? Intel already has WDDM drivers for the 605. Why are you trying to write an XPDM driver? What operating systems do you need to support?

Thank you for the tips. For VideoPortWaitForSingleObject, is it okay to use NULL for the Object argument?

I want these graphics to work on 64-bit Windows XP and Windows 7. Someone said there should be an old driver for Windows 7 but I’m having trouble finding one for anything less than Windows 10.

No, you’ll need to create a dummy object with VideoPortCreateEvent.

It’s an enormous task to create a display driver and miniport from scratch, especially if you weren’t part of the design team and thus don’t have full specs and access to engineering support. Doesn’t the generic VGA driver work for this? You wouldn’t get acceleration, but you’re never going to use XP64 for gaming anyway.

“Doesn’t the generic VGA driver work for this?” Windows 8.1 seemed to have limited support, so I assume XP64 would at least have basic support as well. I was hoping to do better by writing a driver that supports acceleration.

I’m sure you could do better, but it’s not clear to me that it will be worth the enormous effort.