Open Bug 1359757 Opened 5 years ago Updated 5 years ago

Use event triggered method for device status checking

Categories

(Core :: Graphics, enhancement, P5)

All
Windows
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: kechen, Unassigned)

References

Details

(Whiteboard: [gfx-noted])

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[1], is it possible to use some callback function to replace it?

After the survey, there are to possible options:
1. RegisterDeviceRemovedEvent[2]: 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[3]: It is mainly used to detect occlusion status; however, according to this page[4], 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.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ff476526(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/windows/desktop/mt589890(v=vs.85).aspx
[3] https://msdn.microsoft.com/en-us/library/windows/desktop/hh404578(v=vs.85).aspx
[4] https://msdn.microsoft.com/library/windows/desktop/hh768892(v=vs.85).aspx
Hello Bas, do you have any thought on this?
Flags: needinfo?(bas)
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.
Flags: needinfo?(bas)
See Also: → 1355416
Priority: -- → P5
Whiteboard: [gfx-noted]
You need to log in before you can comment on or make changes to this bug.