From patchwork Wed Sep 2 16:53:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 45241 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n82Gs5Vb013033 for ; Wed, 2 Sep 2009 16:54:05 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B3709F5C6; Wed, 2 Sep 2009 09:54:05 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (unknown [94.30.43.99]) by gabe.freedesktop.org (Postfix) with ESMTP id ECF449F5BE for ; Wed, 2 Sep 2009 09:54:03 -0700 (PDT) Received: from localhost.localdomain (unverified [78.156.66.37]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 49098274-1948518 for multiple; Wed, 02 Sep 2009 17:53:57 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 2 Sep 2009 17:53:51 +0100 Message-Id: <1251910431-10469-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.6.3.3 X-Originating-IP: 78.156.66.37 Subject: [Intel-gfx] [PATCH] drm/i915: Only dump 'active' batch buffers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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 --- 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)