[Intel-gfx] [PATCH] drm/i915: Only dump 'active' batch buffers
Chris Wilson
chris at chris-wilson.co.uk
Wed Sep 2 18:53:51 CEST 2009
If we have a long sequence of batch buffers queued when running
intel_gpu_dump, then we will mysteriously fail to read back any of the
batches. This implements a work-around by only dumping the batch buffers
that are older than the current seqno, which are the ones most likely to
contain the error (and active HEAD pointer).
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_debugfs.c | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index dd355ae..cc962e7 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -276,6 +276,12 @@ static void i915_dump_pages(struct seq_file *m, struct page **pages, int page_co
}
}
+static int
+i915_seqno_passed(uint32_t seq1, uint32_t seq2)
+{
+ return (int32_t)(seq1 - seq2) >= 0;
+}
+
static int i915_batchbuffer_info(struct seq_file *m, void *data)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
@@ -283,21 +289,26 @@ static int i915_batchbuffer_info(struct seq_file *m, void *data)
drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_gem_object *obj;
struct drm_i915_gem_object *obj_priv;
- int ret;
+ int ret = 0;
+ u32 seqno;
/* Avoid 'impossible' deadlock when debugging */
if (! spin_trylock(&dev_priv->mm.active_list_lock))
return -EBUSY;
+ /* Only show active batchbuffers to curtail the amount of data
+ * returned (trying to return too many causes allocation failures,
+ * and returning nothing).
+ */
+ seqno = i915_get_gem_seqno(dev) + 2;
+
list_for_each_entry(obj_priv, &dev_priv->mm.active_list, list) {
obj = obj_priv->obj;
- if (obj->read_domains & I915_GEM_DOMAIN_COMMAND) {
+ if (i915_seqno_passed(seqno, obj_priv->last_rendering_seqno) &&
+ obj->read_domains & I915_GEM_DOMAIN_COMMAND) {
ret = i915_gem_object_get_pages(obj);
- if (ret) {
- DRM_ERROR("Failed to get pages: %d\n", ret);
- spin_unlock(&dev_priv->mm.active_list_lock);
- return ret;
- }
+ if (ret)
+ goto out;
seq_printf(m, "--- gtt_offset = 0x%08x\n", obj_priv->gtt_offset);
i915_dump_pages(m, obj_priv->pages, obj->size / PAGE_SIZE);
@@ -306,9 +317,9 @@ static int i915_batchbuffer_info(struct seq_file *m, void *data)
}
}
+out:
spin_unlock(&dev_priv->mm.active_list_lock);
-
- return 0;
+ return ret;
}
static int i915_ringbuffer_data(struct seq_file *m, void *data)
--
1.6.3.3
More information about the Intel-gfx
mailing list