aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_irq.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-11-22 03:07:02 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2010-11-22 03:07:02 -0500
commitc724e8a9407683a8a2ee8eb00b972badf237bbe1 (patch)
treeaf28081e274dd5982ed956a988542f7d840ef966 /drivers/gpu/drm/i915/i915_irq.c
parent3143a2bf18d12545f77dafa5b9f7fee83b001223 (diff)
drm/i915: Capture pinned buffers on error
The pinned buffers are useful for diagnosing errors in setting up state for the chipset, which may not necessarily be 'active' at the time of the error, e.g. the cursor buffer object. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_irq.c')
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c87
1 files changed, 57 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index ef3503733ebb..bbcd5da89ba5 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -552,6 +552,40 @@ i915_ringbuffer_last_batch(struct drm_device *dev,
552 return bbaddr; 552 return bbaddr;
553} 553}
554 554
555static u32 capture_bo_list(struct drm_i915_error_buffer *err,
556 int count,
557 struct list_head *head)
558{
559 struct drm_i915_gem_object *obj;
560 int i = 0;
561
562 list_for_each_entry(obj, head, mm_list) {
563 err->size = obj->base.size;
564 err->name = obj->base.name;
565 err->seqno = obj->last_rendering_seqno;
566 err->gtt_offset = obj->gtt_offset;
567 err->read_domains = obj->base.read_domains;
568 err->write_domain = obj->base.write_domain;
569 err->fence_reg = obj->fence_reg;
570 err->pinned = 0;
571 if (obj->pin_count > 0)
572 err->pinned = 1;
573 if (obj->user_pin_count > 0)
574 err->pinned = -1;
575 err->tiling = obj->tiling_mode;
576 err->dirty = obj->dirty;
577 err->purgeable = obj->madv != I915_MADV_WILLNEED;
578 err->ring = obj->ring->id;
579
580 if (++i == count)
581 break;
582
583 err++;
584 }
585
586 return i;
587}
588
555/** 589/**
556 * i915_capture_error_state - capture an error record for later analysis 590 * i915_capture_error_state - capture an error record for later analysis
557 * @dev: drm device 591 * @dev: drm device
@@ -700,42 +734,35 @@ static void i915_capture_error_state(struct drm_device *dev)
700 error->ringbuffer = i915_error_object_create(dev, 734 error->ringbuffer = i915_error_object_create(dev,
701 dev_priv->render_ring.gem_object); 735 dev_priv->render_ring.gem_object);
702 736
703 /* Record buffers on the active list. */ 737 /* Record buffers on the active and pinned lists. */
704 error->active_bo = NULL; 738 error->active_bo = NULL;
705 error->active_bo_count = 0; 739 error->pinned_bo = NULL;
706 740
707 if (count) 741 error->active_bo_count = count;
742 list_for_each_entry(obj_priv, &dev_priv->mm.pinned_list, mm_list)
743 count++;
744 error->pinned_bo_count = count - error->active_bo_count;
745
746 if (count) {
708 error->active_bo = kmalloc(sizeof(*error->active_bo)*count, 747 error->active_bo = kmalloc(sizeof(*error->active_bo)*count,
709 GFP_ATOMIC); 748 GFP_ATOMIC);
710 749 if (error->active_bo)
711 if (error->active_bo) { 750 error->pinned_bo =
712 int i = 0; 751 error->active_bo + error->active_bo_count;
713 list_for_each_entry(obj_priv, &dev_priv->mm.active_list, mm_list) {
714 struct drm_gem_object *obj = &obj_priv->base;
715
716 error->active_bo[i].size = obj->size;
717 error->active_bo[i].name = obj->name;
718 error->active_bo[i].seqno = obj_priv->last_rendering_seqno;
719 error->active_bo[i].gtt_offset = obj_priv->gtt_offset;
720 error->active_bo[i].read_domains = obj->read_domains;
721 error->active_bo[i].write_domain = obj->write_domain;
722 error->active_bo[i].fence_reg = obj_priv->fence_reg;
723 error->active_bo[i].pinned = 0;
724 if (obj_priv->pin_count > 0)
725 error->active_bo[i].pinned = 1;
726 if (obj_priv->user_pin_count > 0)
727 error->active_bo[i].pinned = -1;
728 error->active_bo[i].tiling = obj_priv->tiling_mode;
729 error->active_bo[i].dirty = obj_priv->dirty;
730 error->active_bo[i].purgeable = obj_priv->madv != I915_MADV_WILLNEED;
731 error->active_bo[i].ring = obj_priv->ring->id;
732
733 if (++i == count)
734 break;
735 }
736 error->active_bo_count = i;
737 } 752 }
738 753
754 if (error->active_bo)
755 error->active_bo_count =
756 capture_bo_list(error->active_bo,
757 error->active_bo_count,
758 &dev_priv->mm.active_list);
759
760 if (error->pinned_bo)
761 error->pinned_bo_count =
762 capture_bo_list(error->pinned_bo,
763 error->pinned_bo_count,
764 &dev_priv->mm.pinned_list);
765
739 do_gettimeofday(&error->time); 766 do_gettimeofday(&error->time);
740 767
741 error->overlay = intel_overlay_capture_error_state(dev); 768 error->overlay = intel_overlay_capture_error_state(dev);