[Intel-gfx] [PATCH] drm/i915: Show ringbuffer details in /proc.

Chris Wilson chris at chris-wilson.co.uk
Wed Feb 11 15:26:39 CET 2009


For me the most important information is knowing the current position
of PRBO_HEAD and ACTHD, so add /proc/dri/.../i915_gem_ringbuffer to dump
the registers and the local values.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_proc.c |   41 ++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_proc.c b/drivers/gpu/drm/i915/i915_gem_proc.c
index c7cc9e0..6d47184 100644
--- a/drivers/gpu/drm/i915/i915_gem_proc.c
+++ b/drivers/gpu/drm/i915/i915_gem_proc.c
@@ -202,6 +202,46 @@ static int i915_gem_request_info(char *buf, char **start, off_t offset,
 	return len - offset;
 }
 
+static int i915_gem_ringbuffer_info(char *buf, char **start, off_t offset,
+				    int request, int *eof, void *data)
+{
+	struct drm_minor *minor = (struct drm_minor *) data;
+	struct drm_device *dev = minor->dev;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+	unsigned int head, tail, mask;
+	unsigned int prbo_head, prbo_tail;
+	int len = 0;
+
+	if (offset > DRM_PROC_LIMIT) {
+		*eof = 1;
+		return 0;
+	}
+
+	*start = &buf[offset];
+	*eof = 0;
+
+	head = dev_priv->ring.head & HEAD_ADDR;
+	tail = dev_priv->ring.tail & TAIL_ADDR;
+	mask = dev_priv->ring.tail_mask;
+
+	prbo_head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
+	prbo_tail = I915_READ(PRB0_TAIL) & TAIL_ADDR;
+
+	DRM_PROC_PRINT("RingHead :  %08x\n", head);
+	DRM_PROC_PRINT("PrboHead :  %08x\n", prbo_head);
+	DRM_PROC_PRINT("RingTail :  %08x\n", tail);
+	DRM_PROC_PRINT("PrboTail :  %08x\n", prbo_tail);
+	DRM_PROC_PRINT("RingMask :  %08x\n", mask);
+	DRM_PROC_PRINT("RingSize :  %08lx\n", dev_priv->ring.Size);
+	DRM_PROC_PRINT("Acthd    :  %08x\n",
+		   I915_READ(IS_I965G(dev) ? ACTHD_I965 : ACTHD));
+
+	if (len > request + offset)
+		return request;
+	*eof = 1;
+	return len - offset;
+}
+
 static int i915_gem_seqno_info(char *buf, char **start, off_t offset,
 			       int request, int *eof, void *data)
 {
@@ -381,6 +421,7 @@ static struct drm_proc_list {
 	{"i915_gem_flushing", i915_gem_flushing_info},
 	{"i915_gem_inactive", i915_gem_inactive_info},
 	{"i915_gem_request", i915_gem_request_info},
+	{"i915_gem_ringbuffer", i915_gem_ringbuffer_info},
 	{"i915_gem_seqno", i915_gem_seqno_info},
 	{"i915_gem_interrupt", i915_interrupt_info},
 	{"i915_gem_hws", i915_hws_info},
-- 
1.6.0.4




More information about the Intel-gfx mailing list