[Intel-gfx] [PATCH] drm/i915: Display fence registers in /proc

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


Add /proc/dri/.../i915_gem_register to show what objects are currently
fenced.

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

diff --git a/drivers/gpu/drm/i915/i915_gem_proc.c b/drivers/gpu/drm/i915/i915_gem_proc.c
index 97b4f2b..c7cc9e0 100644
--- a/drivers/gpu/drm/i915/i915_gem_proc.c
+++ b/drivers/gpu/drm/i915/i915_gem_proc.c
@@ -276,6 +276,67 @@ static int i915_interrupt_info(char *buf, char **start, off_t offset,
 	return len - offset;
 }
 
+static const char *tiling_flag(struct drm_i915_gem_object *obj_priv)
+{
+    switch (obj_priv->tiling_mode) {
+    default:
+    case I915_TILING_NONE: return " ";
+    case I915_TILING_X: return "X";
+    case I915_TILING_Y: return "Y";
+    }
+}
+
+static int i915_fence_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;
+	struct drm_i915_gem_object *obj_priv;
+	int len = 0;
+	int i;
+
+	if (offset > DRM_PROC_LIMIT) {
+		*eof = 1;
+		return 0;
+	}
+
+	*start = &buf[offset];
+	*eof = 0;
+
+	DRM_PROC_PRINT("Reserved fences = %d\n", dev_priv->fence_reg_start);
+	DRM_PROC_PRINT("Total fences = %d\n", dev_priv->num_fence_regs);
+	for (i = 0; i < dev_priv->num_fence_regs; i++) {
+		struct drm_gem_object *obj = dev_priv->fence_regs[i].obj;
+		if (obj == NULL) {
+			DRM_PROC_PRINT("Fenced object[%2d] = unused\n", i);
+		} else if (obj->name) {
+			obj_priv = obj->driver_private;
+			DRM_PROC_PRINT("Fenced object[%2d] =%s%p(%d): %08x %08x %08x %s %08x %08x %d\n",
+				       i, is_pinned(obj_priv), obj, obj->name,
+				       obj_priv->gtt_offset,
+				       obj->size, obj_priv->stride,
+				       tiling_flag(obj_priv),
+				       obj->read_domains, obj->write_domain,
+				       obj_priv->last_rendering_seqno);
+		} else {
+			obj_priv = obj->driver_private;
+			DRM_PROC_PRINT("Fenced object[%2d] =%s%p: %08x %08x %08x %s %08x %08x %d\n",
+				       i, is_pinned(obj_priv), obj,
+				       obj_priv->gtt_offset,
+				       obj->size, obj_priv->stride,
+				       tiling_flag(obj_priv),
+				       obj->read_domains, obj->write_domain,
+				       obj_priv->last_rendering_seqno);
+		}
+	}
+
+	if (len > request + offset)
+		return request;
+	*eof = 1;
+	return len - offset;
+}
+
 static int i915_hws_info(char *buf, char **start, off_t offset,
 			 int request, int *eof, void *data)
 {
@@ -316,6 +377,7 @@ static struct drm_proc_list {
 	int (*f) (char *, char **, off_t, int, int *, void *);
 } i915_gem_proc_list[] = {
 	{"i915_gem_active", i915_gem_active_info},
+	{"i915_gem_fence", i915_fence_info},
 	{"i915_gem_flushing", i915_gem_flushing_info},
 	{"i915_gem_inactive", i915_gem_inactive_info},
 	{"i915_gem_request", i915_gem_request_info},
-- 
1.6.0.4




More information about the Intel-gfx mailing list