public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: intel-gfx <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH] drm/i915: add debugfs file for swizzling information
Date: Thu, 10 Nov 2011 17:39:02 +0100	[thread overview]
Message-ID: <1320943142-7060-1-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1320931087-1557-8-git-send-email-daniel.vetter@ffwll.ch>

This will also come handy for the gen6+ swizzling support, where the
driver is supposed to control swizzling depending upon dram
configuration.

v2: CxDRB3 are 16 bit regs! Noticed by Chris Wilson.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---

v3: align case blocks with the switch statement.

 drivers/gpu/drm/i915/i915_debugfs.c |   50 +++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 2ad2237..a0659f9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1334,6 +1334,55 @@ static int i915_gen6_forcewake_count_info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static const char *swizzle_string(unsigned swizzle)
+{
+	switch(swizzle) {
+	case I915_BIT_6_SWIZZLE_NONE:
+		return "none";
+	case I915_BIT_6_SWIZZLE_9:
+		return "bit9";
+	case I915_BIT_6_SWIZZLE_9_10:
+		return "bit9/bit10";
+	case I915_BIT_6_SWIZZLE_9_11:
+		return "bit9/bit11";
+	case I915_BIT_6_SWIZZLE_9_10_11:
+		return "bit9/bit10/bit11";
+	case I915_BIT_6_SWIZZLE_9_17:
+		return "bit9/bit17";
+	case I915_BIT_6_SWIZZLE_9_10_17:
+		return "bit9/bit10/bit17";
+	case I915_BIT_6_SWIZZLE_UNKNOWN:
+		return "unkown";
+	}
+
+	return "bug";
+}
+
+static int i915_swizzle_info(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	mutex_lock(&dev->struct_mutex);
+	seq_printf(m, "bit6 swizzle for X-tiling = %s\n",
+		   swizzle_string(dev_priv->mm.bit_6_swizzle_x));
+	seq_printf(m, "bit6 swizzle for Y-tiling = %s\n",
+		   swizzle_string(dev_priv->mm.bit_6_swizzle_y));
+
+	if (IS_GEN3(dev) || IS_GEN4(dev)) {
+		seq_printf(m, "DDC = 0x%08x\n",
+			   I915_READ(DCC));
+		seq_printf(m, "C0DRB3 = 0x%04x\n",
+			   I915_READ16(C0DRB3));
+		seq_printf(m, "C1DRB3 = 0x%04x\n",
+			   I915_READ16(C1DRB3));
+	}
+	mutex_unlock(&dev->struct_mutex);
+
+	return 0;
+}
+
 static int
 i915_debugfs_common_open(struct inode *inode,
 			 struct file *filp)
@@ -1732,6 +1781,7 @@ static struct drm_info_list i915_debugfs_list[] = {
 	{"i915_gem_framebuffer", i915_gem_framebuffer_info, 0},
 	{"i915_context_status", i915_context_status, 0},
 	{"i915_gen6_forcewake_count", i915_gen6_forcewake_count_info, 0},
+	{"i915_swizzle_info", i915_swizzle_info, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
-- 
1.7.6.4

  reply	other threads:[~2011-11-10 16:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 13:17 [PATCH 0/9] gpu hang and swizzle patches Daniel Vetter
2011-11-10 13:17 ` [PATCH 1/9] drm/i915: refactor debugfs open function Daniel Vetter
2011-11-10 19:25   ` Ben Widawsky
2011-11-10 13:18 ` [PATCH 2/9] drm/i915: refactor debugfs create functions Daniel Vetter
2011-11-10 19:26   ` Ben Widawsky
2011-11-10 13:18 ` [PATCH 3/9] drm/i915: add interface to simulate gpu hangs Daniel Vetter
2011-11-10 16:34   ` [PATCH] " Daniel Vetter
2011-12-02 22:21     ` Daniel Vetter
2011-12-03  1:33       ` Chris Wilson
2011-12-05 23:20       ` Ben Widawsky
2011-11-10 13:18 ` [PATCH 4/9] drm/i915: rework dev->first_error locking Daniel Vetter
2011-11-27 19:31   ` [PATCH] " Daniel Vetter
2011-11-10 13:18 ` [PATCH 5/9] drm/i915: destroy existing error_state when simulating a gpu hang Daniel Vetter
2011-11-10 13:18 ` [PATCH 6/9] drm/i915: fix swizzle detection for gen3 Daniel Vetter
2011-11-10 16:36   ` [PATCH] " Daniel Vetter
2011-11-10 13:18 ` [PATCH 7/9] drm/i915: add debugfs file for swizzling information Daniel Vetter
2011-11-10 16:39   ` Daniel Vetter [this message]
2011-11-10 13:18 ` [PATCH 8/9] drm/i915: add gen6+ registers to i915_swizzle_info Daniel Vetter
2011-11-10 13:18 ` [PATCH 9/9] drm/i915: swizzling support for snb/ivb Daniel Vetter
2011-11-11 16:50   ` Eric Anholt
2011-11-11 17:22     ` Daniel Vetter
2011-11-11 19:37       ` Eric Anholt
2011-11-11 19:51         ` Daniel Vetter
2011-11-11 19:58           ` Eric Anholt
2011-11-11 20:18             ` Daniel Vetter
2011-11-14 16:19               ` Eric Anholt
2011-11-11  0:15 ` [PATCH 0/9] gpu hang and swizzle patches Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320943142-7060-1-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox