summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nouveau_fence.c
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-10-30 20:44:57 -0400
committerIlia Mirkin <[email protected]>2015-11-05 11:22:19 -0500
commitba093a099af13a630c255b34dc5d315760248e5f (patch)
treeb2956b21308a10c94453c04422c1ce07b9dc5bc4 /src/gallium/drivers/nouveau/nouveau_fence.c
parent4f6cd5fad03757e371b66049dcd42855e4853c14 (diff)
nouveau: send back a debug message when waiting for a fence to complete
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_fence.c')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_fence.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c
index 21cf2b9ae5e..d3a34060952 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -23,6 +23,7 @@
#include "nouveau_screen.h"
#include "nouveau_winsys.h"
#include "nouveau_fence.h"
+#include "os/os_time.h"
#ifdef PIPE_OS_UNIX
#include <sched.h>
@@ -182,10 +183,11 @@ nouveau_fence_signalled(struct nouveau_fence *fence)
}
bool
-nouveau_fence_wait(struct nouveau_fence *fence)
+nouveau_fence_wait(struct nouveau_fence *fence, struct pipe_debug_callback *debug)
{
struct nouveau_screen *screen = fence->screen;
uint32_t spins = 0;
+ int64_t start = 0;
/* wtf, someone is waiting on a fence in flush_notify handler? */
assert(fence->state != NOUVEAU_FENCE_STATE_EMITTING);
@@ -206,11 +208,19 @@ nouveau_fence_wait(struct nouveau_fence *fence)
if (fence == screen->fence.current)
nouveau_fence_next(screen);
+ if (debug && debug->debug_message)
+ start = os_time_get_nano();
+
do {
nouveau_fence_update(screen, false);
- if (fence->state == NOUVEAU_FENCE_STATE_SIGNALLED)
+ if (fence->state == NOUVEAU_FENCE_STATE_SIGNALLED) {
+ if (debug && debug->debug_message)
+ pipe_debug_message(debug, PERF_INFO,
+ "stalled %.3f ms waiting for fence",
+ (os_time_get_nano() - start) / 1000000.f);
return true;
+ }
if (!spins)
NOUVEAU_DRV_STAT(screen, any_non_kernel_fence_sync_count, 1);
spins++;