intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: dump the device info
@ 2012-08-08 16:11 Daniel Vetter
  2012-08-08 18:29 ` Chris Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2012-08-08 16:11 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Handy for lazy people like me, or when people forget to add the output
of lspci -nn.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c |   39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d57ea16..dfa2ab2 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1428,6 +1428,42 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 	kfree(ap);
 }
 
+static void i915_dump_device_info(struct drm_i915_private *dev_priv)
+{
+	const struct intel_device_info *info = dev_priv->info;
+
+#define DEV_FLAG_STR(name) info->name ? #name "," : ""
+	DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x flags="
+			 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+			 info->gen,
+			 dev_priv->dev->pdev->device,
+			 DEV_FLAG_STR(is_mobile),
+			 DEV_FLAG_STR(is_i85x),
+			 DEV_FLAG_STR(is_i915g),
+			 DEV_FLAG_STR(is_i945gm),
+			 DEV_FLAG_STR(is_g33),
+			 DEV_FLAG_STR(need_gfx_hws),
+			 DEV_FLAG_STR(is_g4x),
+			 DEV_FLAG_STR(is_pineview),
+			 DEV_FLAG_STR(is_broadwater),
+			 DEV_FLAG_STR(is_crestline),
+			 DEV_FLAG_STR(is_ivybridge),
+			 DEV_FLAG_STR(is_valleyview),
+			 DEV_FLAG_STR(is_haswell),
+			 DEV_FLAG_STR(has_force_wake),
+			 DEV_FLAG_STR(has_fbc),
+			 DEV_FLAG_STR(has_pipe_cxsr),
+			 DEV_FLAG_STR(has_hotplug),
+			 DEV_FLAG_STR(cursor_needs_physical),
+			 DEV_FLAG_STR(has_overlay),
+			 DEV_FLAG_STR(overlay_needs_physical),
+			 DEV_FLAG_STR(supports_tv),
+			 DEV_FLAG_STR(has_bsd_ring),
+			 DEV_FLAG_STR(has_blt_ring),
+			 DEV_FLAG_STR(has_llc));
+#undef DEV_FLAG_STR
+}
+
 /**
  * i915_driver_load - setup chip and create an initial config
  * @dev: DRM device
@@ -1452,7 +1488,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	if (info->gen >= 6 && !drm_core_check_feature(dev, DRIVER_MODESET))
 		return -ENODEV;
 
-
 	/* i915 has 4 more counters */
 	dev->counters += 4;
 	dev->types[6] = _DRM_STAT_IRQ;
@@ -1468,6 +1503,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	dev_priv->dev = dev;
 	dev_priv->info = info;
 
+	i915_dump_device_info(dev_priv);
+
 	if (i915_get_bridge_dev(dev)) {
 		ret = -EIO;
 		goto free_priv;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: dump the device info
  2012-08-08 16:11 [PATCH] drm/i915: dump the device info Daniel Vetter
@ 2012-08-08 18:29 ` Chris Wilson
  2012-08-08 20:01   ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2012-08-08 18:29 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

On Wed,  8 Aug 2012 18:11:13 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Handy for lazy people like me, or when people forget to add the output
> of lspci -nn.

Is there any chance of sharing this with the similar code for
debugfs/i915_capabilities?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] drm/i915: dump the device info
  2012-08-08 18:29 ` Chris Wilson
@ 2012-08-08 20:01   ` Daniel Vetter
  2012-08-08 21:41     ` Chris Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2012-08-08 20:01 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Handy for lazy people like me, or when people forget to add the output
of lspci -nn.

v2: Chris Wilson noticed that we have this duplicated already in the
i915_capabilites debugfs file. But there \n as separator looks better,
which would be a bit verbose in dmesg. Abuse the preprocessor to
extract this all.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   27 +++++----------------------
 drivers/gpu/drm/i915/i915_dma.c     |   18 +++++++++++++++++-
 drivers/gpu/drm/i915/i915_drv.h     |   26 ++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 1312b79..2e07cdd 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -61,28 +61,11 @@ static int i915_capabilities(struct seq_file *m, void *data)
 
 	seq_printf(m, "gen: %d\n", info->gen);
 	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev));
-#define B(x) seq_printf(m, #x ": %s\n", yesno(info->x))
-	B(is_mobile);
-	B(is_i85x);
-	B(is_i915g);
-	B(is_i945gm);
-	B(is_g33);
-	B(need_gfx_hws);
-	B(is_g4x);
-	B(is_pineview);
-	B(is_broadwater);
-	B(is_crestline);
-	B(has_fbc);
-	B(has_pipe_cxsr);
-	B(has_hotplug);
-	B(cursor_needs_physical);
-	B(has_overlay);
-	B(overlay_needs_physical);
-	B(supports_tv);
-	B(has_bsd_ring);
-	B(has_blt_ring);
-	B(has_llc);
-#undef B
+#define DEV_INFO_FLAG(x) seq_printf(m, #x ": %s\n", yesno(info->x))
+#define DEV_INFO_SEP ;
+	DEV_INFO_FLAGS;
+#undef DEV_INFO_FLAG
+#undef DEV_INFO_SEP
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d57ea16..a7a213c 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1428,6 +1428,21 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 	kfree(ap);
 }
 
+static void i915_dump_device_info(struct drm_i915_private *dev_priv)
+{
+	const struct intel_device_info *info = dev_priv->info;
+
+#define DEV_INFO_FLAG(name) info->name ? #name "," : ""
+#define DEV_INFO_SEP ,
+	DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x flags="
+			 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+			 info->gen,
+			 dev_priv->dev->pdev->device,
+			 DEV_INFO_FLAGS);
+#undef DEV_INFO_FLAG
+#undef DEV_INFO_SEP
+}
+
 /**
  * i915_driver_load - setup chip and create an initial config
  * @dev: DRM device
@@ -1452,7 +1467,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	if (info->gen >= 6 && !drm_core_check_feature(dev, DRIVER_MODESET))
 		return -ENODEV;
 
-
 	/* i915 has 4 more counters */
 	dev->counters += 4;
 	dev->types[6] = _DRM_STAT_IRQ;
@@ -1468,6 +1482,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	dev_priv->dev = dev;
 	dev_priv->info = info;
 
+	i915_dump_device_info(dev_priv);
+
 	if (i915_get_bridge_dev(dev)) {
 		ret = -EIO;
 		goto free_priv;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0b2eb17..26a2cf6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -279,6 +279,32 @@ struct drm_i915_gt_funcs {
 	void (*force_wake_put)(struct drm_i915_private *dev_priv);
 };
 
+#define DEV_INFO_FLAGS \
+	DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_i85x) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_i915g) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_i945gm) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_g33) DEV_INFO_SEP \
+	DEV_INFO_FLAG(need_gfx_hws) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_g4x) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_pineview) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_broadwater) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_crestline) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_ivybridge) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_valleyview) DEV_INFO_SEP \
+	DEV_INFO_FLAG(is_haswell) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_force_wake) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_fbc) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_pipe_cxsr) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_hotplug) DEV_INFO_SEP \
+	DEV_INFO_FLAG(cursor_needs_physical) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_overlay) DEV_INFO_SEP \
+	DEV_INFO_FLAG(overlay_needs_physical) DEV_INFO_SEP \
+	DEV_INFO_FLAG(supports_tv) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_bsd_ring) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_blt_ring) DEV_INFO_SEP \
+	DEV_INFO_FLAG(has_llc)
+
 struct intel_device_info {
 	u8 gen;
 	u8 is_mobile:1;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: dump the device info
  2012-08-08 20:01   ` Daniel Vetter
@ 2012-08-08 21:41     ` Chris Wilson
  2012-08-09 16:29       ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2012-08-08 21:41 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

On Wed,  8 Aug 2012 22:01:51 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Handy for lazy people like me, or when people forget to add the output
> of lspci -nn.
> 
> v2: Chris Wilson noticed that we have this duplicated already in the
> i915_capabilites debugfs file. But there \n as separator looks better,
> which would be a bit verbose in dmesg. Abuse the preprocessor to
> extract this all.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I like the placement of the cpp magic next to the struct, that should make
it easier to update both at the same time. I think I'd prefer the struct
first, magic cpp second. And given the alternatives, I think this is
the cleanest way to minimise the code duplication.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: dump the device info
  2012-08-08 21:41     ` Chris Wilson
@ 2012-08-09 16:29       ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2012-08-09 16:29 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, Intel Graphics Development

On Wed, Aug 08, 2012 at 10:41:14PM +0100, Chris Wilson wrote:
> On Wed,  8 Aug 2012 22:01:51 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Handy for lazy people like me, or when people forget to add the output
> > of lspci -nn.
> > 
> > v2: Chris Wilson noticed that we have this duplicated already in the
> > i915_capabilites debugfs file. But there \n as separator looks better,
> > which would be a bit verbose in dmesg. Abuse the preprocessor to
> > extract this all.
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> I like the placement of the cpp magic next to the struct, that should make
> it easier to update both at the same time. I think I'd prefer the struct
> first, magic cpp second. And given the alternatives, I think this is
> the cleanest way to minimise the code duplication.
> 
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Queued for -next, thanks for the review.
-Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-09 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08 16:11 [PATCH] drm/i915: dump the device info Daniel Vetter
2012-08-08 18:29 ` Chris Wilson
2012-08-08 20:01   ` Daniel Vetter
2012-08-08 21:41     ` Chris Wilson
2012-08-09 16:29       ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).