summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Harrison <John.C.Harrison@Intel.com>2015-12-22 15:27:06 +0000
committerJohn Harrison <John.C.Harrison@Intel.com>2016-06-28 17:19:08 +0100
commit673b7992f697feee67b460a393fa7f8a57687f16 (patch)
tree7a72e13f80ce5e4b826f7a743f582e2a8d37e637
parent94bce9bfc8669161039a566a9f0be7d7b1d76b96 (diff)
drm/i915: Add sync support to the scheduler statistics and status dump
There are useful statistics and debug information about fences that can be returned via the scheduler's existing reporting mechanisms (sysfs and debug output). These changes were previously part of the patches that originally added those mechanisms. However, as the sync framework has now been rebased to after the scheduler patches, they must now be done as a separate patch on top. For: VIZ-1587 Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c8
-rw-r--r--drivers/gpu/drm/i915/i915_scheduler.c20
-rw-r--r--drivers/gpu/drm/i915/i915_scheduler.h5
4 files changed, 32 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 97629213a1b8..b4a9e4b8e83a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3718,6 +3718,10 @@ static int i915_scheduler_info(struct seq_file *m, void *unused)
PRINT_VAR(" ExecEarly retry", "u", stats[e].exec_early);
PRINT_VAR(" ExecFinal requeue", "u", stats[e].exec_again);
PRINT_VAR(" ExecFinal killed", "u", stats[e].exec_dead);
+ PRINT_VAR(" Fence wait", "u", stats[e].fence_wait);
+ PRINT_VAR(" Fence wait again", "u", stats[e].fence_again);
+ PRINT_VAR(" Fence wait ignore", "u", stats[e].fence_ignore);
+ PRINT_VAR(" Fence supplied", "u", stats[e].fence_got);
PRINT_VAR(" Hung flying", "u", stats[e].kill_flying);
PRINT_VAR(" Hung queued", "u", stats[e].kill_queued);
PRINT_VAR(" File queue wait", "u", stats[e].file_wait);
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index f9756a9710a6..61b1a5f1e855 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1512,6 +1512,8 @@ eb_select_ring(struct drm_i915_private *dev_priv,
*/
static int i915_early_fence_wait(struct intel_engine_cs *ring, int fence_fd)
{
+ struct drm_i915_private *dev_priv = to_i915(ring->dev);
+ struct i915_scheduler *scheduler = dev_priv->scheduler;
struct sync_fence *fence;
int ret = 0;
@@ -1533,8 +1535,12 @@ static int i915_early_fence_wait(struct intel_engine_cs *ring, int fence_fd)
* because the the mutex lock has not yet been acquired and
* the wait is interruptible.
*/
- if (!i915_safe_to_ignore_fence(ring, fence))
+ if (i915_safe_to_ignore_fence(ring, fence))
+ scheduler->stats[ring->id].fence_ignore++;
+ else {
+ scheduler->stats[ring->id].fence_wait++;
ret = sync_fence_wait(fence, -1);
+ }
sync_fence_put(fence);
return ret;
diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
index 4d9d9f4a6373..c74606520ebc 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.c
+++ b/drivers/gpu/drm/i915/i915_scheduler.c
@@ -394,15 +394,20 @@ static void i915_scheduler_wait_fence_signaled(struct sync_fence *fence,
static bool i915_scheduler_async_fence_wait(struct drm_device *dev,
struct i915_scheduler_queue_entry *node)
{
+ struct drm_i915_private *dev_priv = to_i915(node->params.engine->dev);
+ struct i915_scheduler *scheduler = dev_priv->scheduler;
struct i915_sync_fence_waiter *fence_waiter;
struct sync_fence *fence = node->params.fence_wait;
int signaled;
bool success = true;
- if ((node->flags & I915_QEF_FENCE_WAITING) == 0)
+ if ((node->flags & I915_QEF_FENCE_WAITING) == 0) {
node->flags |= I915_QEF_FENCE_WAITING;
- else
+ scheduler->stats[node->params.engine->id].fence_wait++;
+ } else {
+ scheduler->stats[node->params.engine->id].fence_again++;
return true;
+ }
if (fence == NULL)
return false;
@@ -465,8 +470,10 @@ static int i915_scheduler_pop_from_queue_locked(struct intel_engine_cs *engine,
else
signalled = true;
- if (!signalled)
+ if (!signalled) {
signalled = i915_safe_to_ignore_fence(engine, node->params.fence_wait);
+ scheduler->stats[node->params.engine->id].fence_ignore++;
+ }
has_local = false;
has_remote = false;
@@ -855,6 +862,9 @@ int i915_scheduler_queue_execbuffer(struct i915_scheduler_queue_entry *qe)
int i, e;
int incomplete;
+ if (qe->params.fence_wait)
+ scheduler->stats[engine->id].fence_got++;
+
/* Bypass the scheduler and send the buffer immediately? */
if (!i915.enable_scheduler)
return i915_scheduler_queue_execbuffer_bypass(qe);
@@ -1414,7 +1424,7 @@ static int i915_scheduler_dump_locked(struct intel_engine_cs *engine,
deps++;
DRM_DEBUG_DRIVER("<%s> %c:%02d> uniq = %d, seqno"
- " = %d/%s, deps = %d / %d, %s [pri = "
+ " = %d/%s, deps = %d / %d, fence = %p/%d, %s [pri = "
"%4d]\n", engine->name,
i915_scheduler_queue_status_chr(node->status),
count,
@@ -1422,6 +1432,8 @@ static int i915_scheduler_dump_locked(struct intel_engine_cs *engine,
node->params.request->seqno,
node->params.engine->name,
deps, node->num_deps,
+ node->params.fence_wait,
+ node->params.fence_wait ? sync_fence_is_signaled(node->params.fence_wait) : 0,
i915_qe_state_str(node),
node->priority);
diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h
index 49545207deda..1c20c1f04df5 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.h
+++ b/drivers/gpu/drm/i915/i915_scheduler.h
@@ -116,6 +116,11 @@ struct i915_scheduler_stats {
uint32_t file_wait;
uint32_t file_stall;
uint32_t file_lost;
+
+ uint32_t fence_wait;
+ uint32_t fence_again;
+ uint32_t fence_ignore;
+ uint32_t fence_got;
};
struct i915_scheduler_stats_nodes {