Open Bug 1359757 Opened 5 years ago Updated 5 years ago
Use event triggered method for device status checking
Per Bug 1355416, we check device status for device remove in several places which causes some performance concerns. Instead of polling the status via GetDeviceRemovedReason, is it possible to use some callback function to replace it? After the survey, there are to possible options: 1. RegisterDeviceRemovedEvent: this is designed for detecting device removed event; but this api just is released recently, the minimum supported system is not clear yet. 2. RegisterOcclusionStatusEvent: It is mainly used to detect occlusion status; however, according to this page, the event can also be triggered by TDR. This function require Windows 8 and above, Windows 7 also supports the interface but do not implement it.  https://msdn.microsoft.com/en-us/library/windows/desktop/ff476526(v=vs.85).aspx  https://msdn.microsoft.com/en-us/library/windows/desktop/mt589890(v=vs.85).aspx  https://msdn.microsoft.com/en-us/library/windows/desktop/hh404578(v=vs.85).aspx  https://msdn.microsoft.com/library/windows/desktop/hh768892(v=vs.85).aspx
Hello Bas, do you have any thought on this?
See my comments on bug 1355416. This is not really worth spending time on at the moment the risk & investment vs the potential user facing win is not worth it, the best way if we want to mitigate the CPU usage for this function is to put a Sleep(1) in EndFrame instead of a Sleep(0). (Note the Sleep(0) already guarantees that -if- the CPU has other work to do in the form of other unblocked threads waiting for execution, it will get done) In the end driving this off the event is better, but complicated as the event handler may be called only after we've already proceeded doing some other work and we'd still presumably need to check in some places to be safe. It may be better just to crash as David has suggested. This is a complicated issue to solve.
You need to log in before you can comment on or make changes to this bug.