diff mbox

[2/2] drm/i915: Add debugfs interface for planes

Message ID 1377141353-11532-2-git-send-email-benjamin.widawsky@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky Aug. 22, 2013, 3:15 a.m. UTC
This interface can enhanced over time to get more per plane information.
I've just flip counts for now. What I'd like to do with flip counts is
integrate them with existing flip tests. It serves a similar, but more
course purpose to some of the CRC work being done.

Unfortunately, I've been unable to get something going on the test side
thus far because I am inexperienced with the APIs, and don't see a way
to map a crtc to a hardware plane (which is what we have flip counts
for).

Chris, maybe you can do something useful with this?

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Ben Widawsky Aug. 22, 2013, 2:16 a.m. UTC | #1
Sent the unfinished commit by accident
On Wed, Aug 21, 2013 at 08:15:53PM -0700, Ben Widawsky wrote:
> This interface can enhanced over time to get more per plane information.
> I've just flip counts for now. What I'd like to do with flip counts is
> integrate them with existing flip tests. It serves a similar, but more
> course purpose to some of the CRC work being done.
  ^^
 coarse.

"It can be used to determine if something is being flipped when we
expect it to be flipped. The immediate issue I want to look into is I've
seen some funny behavior where we're getting two flips per flip queued."


> 
> Unfortunately, I've been unable to get something going on the test side
> thus far because I am inexperienced with the APIs, and don't see a way
> to map a crtc to a hardware plane (which is what we have flip counts
> for).
> 
> Chris, maybe you can do something useful with this?
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 236d97e..1cf0461 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1791,6 +1791,26 @@ static int i915_energy_uJ(struct seq_file *m, void *data)
>  	return 0;
>  }
>  
> +static int i915_plane_info(struct seq_file *m, void *data)
> +{
> +	struct drm_info_node *node = m->private;
> +	struct drm_device *dev = node->minor->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	uintptr_t plane = (uintptr_t) node->info_ent->data;
> +
> +	if (INTEL_INFO(dev)->gen < 5 && !INTEL_INFO(dev)->is_g4x)
> +		return -ENODEV;
> +
> +	if (plane >= INTEL_INFO(dev)->num_pipes)
> +		return -ENODEV;
> +
> +	DRM_ERROR("Plane was %p\n", data);
> +
> +	seq_printf(m, "flip count: %u\n", I915_READ(DSPFLIPCNT(plane)));
> +
> +	return 0;
> +}
> +
>  static int
>  i915_wedged_get(void *data, u64 *val)
>  {
> @@ -2231,6 +2251,9 @@ static struct drm_info_list i915_debugfs_list[] = {
>  	{"i915_llc", i915_llc, 0},
>  	{"i915_edp_psr_status", i915_edp_psr_status, 0},
>  	{"i915_energy_uJ", i915_energy_uJ, 0},
> +	{"i915_plane_a", i915_plane_info, 0, (void *)0},
> +	{"i915_plane_b", i915_plane_info, 0, (void *)1},
> +	{"i915_plane_c", i915_plane_info, 0, (void *)2},
>  };
>  #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
>  
> -- 
> 1.8.3.4
>
Chris Wilson Aug. 22, 2013, 2:21 a.m. UTC | #2
On Wed, Aug 21, 2013 at 07:16:53PM -0700, Ben Widawsky wrote:
> Sent the unfinished commit by accident
> On Wed, Aug 21, 2013 at 08:15:53PM -0700, Ben Widawsky wrote:
> > This interface can enhanced over time to get more per plane information.
> > I've just flip counts for now. What I'd like to do with flip counts is
> > integrate them with existing flip tests. It serves a similar, but more
> > course purpose to some of the CRC work being done.
>   ^^
>  coarse.
> 
> "It can be used to determine if something is being flipped when we
> expect it to be flipped. The immediate issue I want to look into is I've
> seen some funny behavior where we're getting two flips per flip queued."

Cursed email - I only have your reply. On the machines you are interested
in, the CRTCs are assigned to fixed planes.
-Chris
Ben Widawsky Aug. 22, 2013, 2:27 a.m. UTC | #3
On Thu, Aug 22, 2013 at 03:21:09AM +0100, Chris Wilson wrote:
> On Wed, Aug 21, 2013 at 07:16:53PM -0700, Ben Widawsky wrote:
> > Sent the unfinished commit by accident
> > On Wed, Aug 21, 2013 at 08:15:53PM -0700, Ben Widawsky wrote:
> > > This interface can enhanced over time to get more per plane information.
> > > I've just flip counts for now. What I'd like to do with flip counts is
> > > integrate them with existing flip tests. It serves a similar, but more
> > > course purpose to some of the CRC work being done.
> >   ^^
> >  coarse.
> > 
> > "It can be used to determine if something is being flipped when we
> > expect it to be flipped. The immediate issue I want to look into is I've
> > seen some funny behavior where we're getting two flips per flip queued."
> 
> Cursed email - I only have your reply. On the machines you are interested
> in, the CRTCs are assigned to fixed planes.
> -Chris
> 

It's not just you, mailman is acting weird for me also.

In any case, can you give me another hint on how to go from crtc_id to
plane?
Chris Wilson Aug. 22, 2013, 2:32 a.m. UTC | #4
On Wed, Aug 21, 2013 at 07:27:11PM -0700, Ben Widawsky wrote:
> On Thu, Aug 22, 2013 at 03:21:09AM +0100, Chris Wilson wrote:
> > On Wed, Aug 21, 2013 at 07:16:53PM -0700, Ben Widawsky wrote:
> > > Sent the unfinished commit by accident
> > > On Wed, Aug 21, 2013 at 08:15:53PM -0700, Ben Widawsky wrote:
> > > > This interface can enhanced over time to get more per plane information.
> > > > I've just flip counts for now. What I'd like to do with flip counts is
> > > > integrate them with existing flip tests. It serves a similar, but more
> > > > course purpose to some of the CRC work being done.
> > >   ^^
> > >  coarse.
> > > 
> > > "It can be used to determine if something is being flipped when we
> > > expect it to be flipped. The immediate issue I want to look into is I've
> > > seen some funny behavior where we're getting two flips per flip queued."
> > 
> > Cursed email - I only have your reply. On the machines you are interested
> > in, the CRTCs are assigned to fixed planes.
> > -Chris
> > 
> 
> It's not just you, mailman is acting weird for me also.
> 
> In any case, can you give me another hint on how to go from crtc_id to
> plane?

crtc-id to plane is easy, use the get_pipe_ioctl and the plane is
identical to the pipe (for these machines). If you want plane to crtc,
then you need to build a little mapping table.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 236d97e..1cf0461 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1791,6 +1791,26 @@  static int i915_energy_uJ(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int i915_plane_info(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uintptr_t plane = (uintptr_t) node->info_ent->data;
+
+	if (INTEL_INFO(dev)->gen < 5 && !INTEL_INFO(dev)->is_g4x)
+		return -ENODEV;
+
+	if (plane >= INTEL_INFO(dev)->num_pipes)
+		return -ENODEV;
+
+	DRM_ERROR("Plane was %p\n", data);
+
+	seq_printf(m, "flip count: %u\n", I915_READ(DSPFLIPCNT(plane)));
+
+	return 0;
+}
+
 static int
 i915_wedged_get(void *data, u64 *val)
 {
@@ -2231,6 +2251,9 @@  static struct drm_info_list i915_debugfs_list[] = {
 	{"i915_llc", i915_llc, 0},
 	{"i915_edp_psr_status", i915_edp_psr_status, 0},
 	{"i915_energy_uJ", i915_energy_uJ, 0},
+	{"i915_plane_a", i915_plane_info, 0, (void *)0},
+	{"i915_plane_b", i915_plane_info, 0, (void *)1},
+	{"i915_plane_c", i915_plane_info, 0, (void *)2},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)