[Intel-gfx] [PATCH 2/2] drm/i915: Don't capture pinned bo separately

Daniel Vetter daniel.vetter at ffwll.ch
Tue Dec 2 07:19:44 PST 2014


We only care about pinned bo in the global ggtt, so simplify the logic
a bit. Since we don't yet capture any per-vm state the pretty-printing
isn't too pretty.

v2: git add to make it build ...

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |  4 ++--
 drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++-------------------
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ef1f00e0a7b3..f9fe9293290c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -450,9 +450,9 @@ struct drm_i915_error_state {
 		u32 userptr:1;
 		s32 ring:4;
 		u32 cache_level:3;
-	} **active_bo, **pinned_bo;
+	} **active_bo;
 
-	u32 *active_bo_count, *pinned_bo_count;
+	u32 *active_bo_count;
 	u32 vm_count;
 };
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index b76443778e8e..b1387343812d 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -398,13 +398,9 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 	for (i = 0; i < error->vm_count; i++) {
 		err_printf(m, "vm[%d]\n", i);
 
-		print_error_buffers(m, "Active",
+		print_error_buffers(m, "Active (+ pinned for ggtt)",
 				    error->active_bo[i],
 				    error->active_bo_count[i]);
-
-		print_error_buffers(m, "Pinned",
-				    error->pinned_bo[i],
-				    error->pinned_bo_count[i]);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
@@ -1098,7 +1094,6 @@ static void i915_gem_capture_vm(struct drm_i915_private *dev_priv,
 			i++;
 		}
 	}
-	error->pinned_bo_count[ndx] = i - error->active_bo_count[ndx];
 
 	if (i) {
 		active_bo = kcalloc(i, sizeof(*active_bo), GFP_ATOMIC);
@@ -1113,12 +1108,11 @@ static void i915_gem_capture_vm(struct drm_i915_private *dev_priv,
 					  &vm->active_list);
 
 	if (pinned_bo)
-		error->pinned_bo_count[ndx] =
+		error->active_bo_count[ndx] +=
 			capture_pinned_bo(pinned_bo,
-					  error->pinned_bo_count[ndx],
+					  i - error->active_bo_count[ndx],
 					  &vm->inactive_list);
 	error->active_bo[ndx] = active_bo;
-	error->pinned_bo[ndx] = pinned_bo;
 }
 
 static void i915_gem_capture_buffers(struct drm_i915_private *dev_priv,
@@ -1131,25 +1125,16 @@ static void i915_gem_capture_buffers(struct drm_i915_private *dev_priv,
 		cnt++;
 
 	error->active_bo = kcalloc(cnt, sizeof(*error->active_bo), GFP_ATOMIC);
-	error->pinned_bo = kcalloc(cnt, sizeof(*error->pinned_bo), GFP_ATOMIC);
 	error->active_bo_count = kcalloc(cnt, sizeof(*error->active_bo_count),
 					 GFP_ATOMIC);
-	error->pinned_bo_count = kcalloc(cnt, sizeof(*error->pinned_bo_count),
-					 GFP_ATOMIC);
 
 	if (error->active_bo == NULL ||
-	    error->pinned_bo == NULL ||
-	    error->active_bo_count == NULL ||
-	    error->pinned_bo_count == NULL) {
+	    error->active_bo_count == NULL) {
 		kfree(error->active_bo);
 		kfree(error->active_bo_count);
-		kfree(error->pinned_bo);
-		kfree(error->pinned_bo_count);
 
 		error->active_bo = NULL;
 		error->active_bo_count = NULL;
-		error->pinned_bo = NULL;
-		error->pinned_bo_count = NULL;
 	} else {
 		list_for_each_entry(vm, &dev_priv->vm_list, global_link)
 			i915_gem_capture_vm(dev_priv, error, vm, i++);
-- 
1.9.3




More information about the Intel-gfx mailing list