[PATCH 34/49] drm/i915/bdw: Fix reset stats ioctl with LR contexts

oscar.mateo
2014-03-27T17:08:25Z

From: Oscar Mateo <oscar.mateo@intel.com>

Since we cannot tell apart which specific context the user refers too,
get stats from all the per-engine cotexts with the same ID.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
drivers/gpu/drm/i915/intel_uncore.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index c3832d9..4fe3e4a 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -931,6 +931,21 @@ int i915_get_reset_stats_ioctl(struct drm_device *dev,
args->batch_active = hs->batch_active;
args->batch_pending = hs->batch_pending;

+ if (dev_priv->lrc_enabled) {
+ struct i915_hw_context *cursor = NULL;
+ list_for_each_entry(cursor, &ctx->dependent_contexts, dependent_contexts) {
+ hs = &cursor->hang_stats;
+
+ if (capable(CAP_SYS_ADMIN))
+ args->reset_count += i915_reset_count(&dev_priv->gpu_error);
+ else
+ args->reset_count = 0;
+
+ args->batch_active += hs->batch_active;
+ args->batch_pending += hs->batch_pending;
+ }
+ }
+
mutex_unlock(&dev->struct_mutex);

return 0;
--
1.9.0