qxl-wddm-dod: Debug warning on long wait on event

In release build this does not affect the code.
In debug build we will have a warning printout when waiting
on event is close to 2 seconds - this can be a cause of following
stop by OS. The printout contains name of related event variable.
There is one event (in offload thread) that long wait on it
does not affect any functionality, for it this warning is disabled.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
yuri.benditovich@daynix.com 2017-04-01 19:40:31 +03:00 committed by Frediano Ziglio
parent d8e645c751
commit f86a615e52
2 changed files with 15 additions and 3 deletions

View File

@ -5056,7 +5056,8 @@ void QxlDevice::PresentThreadRoutine()
// No need for a mutex, only one consumer thread // No need for a mutex, only one consumer thread
SPICE_RING_CONS_WAIT(m_PresentRing, wait); SPICE_RING_CONS_WAIT(m_PresentRing, wait);
while (wait) { while (wait) {
WaitForObject(&m_PresentEvent, NULL); // we do not want indication of long wait on this event
DoWaitForObject(&m_PresentEvent, NULL, NULL);
SPICE_RING_CONS_WAIT(m_PresentRing, wait); SPICE_RING_CONS_WAIT(m_PresentRing, wait);
} }
drawables = *SPICE_RING_CONS_ITEM(m_PresentRing); drawables = *SPICE_RING_CONS_ITEM(m_PresentRing);

View File

@ -416,11 +416,13 @@ struct Resource {
BOOLEAN BOOLEAN
FORCEINLINE FORCEINLINE
WaitForObject( DoWaitForObject(
PVOID Object, PVOID Object,
PLARGE_INTEGER Timeout) PLARGE_INTEGER Timeout,
LPCSTR name)
{ {
NTSTATUS status; NTSTATUS status;
TimeMeasurement tm;
status = KeWaitForSingleObject ( status = KeWaitForSingleObject (
Object, Object,
Executive, Executive,
@ -428,9 +430,18 @@ WaitForObject(
FALSE, FALSE,
Timeout); Timeout);
ASSERT(NT_SUCCESS(status)); ASSERT(NT_SUCCESS(status));
tm.Stop();
if (name && tm.Diff() > 1900)
{
// 2 seconds in PresentDisplayOnly triggers watchdog on Win10RS1
// when VSync control enabled. Print the exact event name.
DbgPrint(TRACE_LEVEL_ERROR, ("Waiting %d ms for %s\n", tm.Diff(), name));
}
return (status == STATUS_SUCCESS); return (status == STATUS_SUCCESS);
} }
#define WaitForObject(o, timeout) DoWaitForObject((o), (timeout), #o)
VOID VOID
FORCEINLINE FORCEINLINE
ReleaseMutex( ReleaseMutex(