All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Show cursor status in debugfs/i915_display_info
@ 2014-03-12  9:13 Chris Wilson
  2014-03-12  9:29 ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2014-03-12  9:13 UTC (permalink / raw)
  To: intel-gfx

I have the occasional absent cursor on i845 and I want to know why.
This should help by revealing the last known cursor state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 57 ++++++++++++++++++++++++++++++++-----
 1 file changed, 50 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 72c866a41e27..5df093d178a9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2383,24 +2383,67 @@ static void intel_connector_info(struct seq_file *m,
 		intel_seq_print_mode(m, 2, mode);
 }
 
+static bool cursor_active(struct drm_device *dev, int pipe)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 state;
+
+	if (IS_845G(dev) || IS_I865G(dev))
+		state = I915_READ(_CURACNTR) & CURSOR_ENABLE;
+	else if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev))
+		state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;
+	else
+		state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE;
+
+	return state;
+}
+
+static bool cursor_position(struct drm_device *dev, int pipe, int *x, int *y)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 pos;
+
+	if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev))
+		pos = I915_READ(CURPOS_IVB(pipe));
+	else
+		pos = I915_READ(CURPOS(pipe));
+
+	*x = (pos >> CURSOR_X_SHIFT) & CURSOR_POS_MASK;
+	if (pos & (CURSOR_POS_SIGN << CURSOR_X_SHIFT))
+		*x = -*x;
+
+	*y = (pos >> CURSOR_Y_SHIFT) & CURSOR_POS_MASK;
+	if (pos & (CURSOR_POS_SIGN << CURSOR_Y_SHIFT))
+		*y = -*y;
+
+	return cursor_active(dev, pipe);
+}
+
 static int i915_display_info(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	struct drm_crtc *crtc;
+	struct intel_crtc *crtc;
 	struct drm_connector *connector;
 
 	drm_modeset_lock_all(dev);
 	seq_printf(m, "CRTC info\n");
 	seq_printf(m, "---------\n");
-	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
+		bool active;
+		int x, y;
 
 		seq_printf(m, "CRTC %d: pipe: %c, active: %s\n",
-			   crtc->base.id, pipe_name(intel_crtc->pipe),
-			   intel_crtc->active ? "yes" : "no");
-		if (intel_crtc->active)
-			intel_crtc_info(m, intel_crtc);
+			   crtc->base.base.id, pipe_name(crtc->pipe),
+			   yesno(crtc->active));
+		if (crtc->active)
+			intel_crtc_info(m, crtc);
+
+		active = cursor_position(dev, crtc->pipe, &x, &y);
+		seq_printf(m, "\tcursor visible? %s, position (%d, %d), addr 0x%08x, active? %s\n",
+			   yesno(crtc->cursor_visible),
+			   x, y, crtc->cursor_addr,
+			   yesno(active));
 	}
 
 	seq_printf(m, "\n");
-- 
1.9.0

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

* Re: [PATCH] drm/i915: Show cursor status in debugfs/i915_display_info
  2014-03-12  9:13 [PATCH] drm/i915: Show cursor status in debugfs/i915_display_info Chris Wilson
@ 2014-03-12  9:29 ` Ville Syrjälä
  2014-03-12 15:17   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2014-03-12  9:29 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Mar 12, 2014 at 09:13:13AM +0000, Chris Wilson wrote:
> I have the occasional absent cursor on i845 and I want to know why.
> This should help by revealing the last known cursor state.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 57 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 50 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 72c866a41e27..5df093d178a9 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2383,24 +2383,67 @@ static void intel_connector_info(struct seq_file *m,
>  		intel_seq_print_mode(m, 2, mode);
>  }
>  
> +static bool cursor_active(struct drm_device *dev, int pipe)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	u32 state;
> +
> +	if (IS_845G(dev) || IS_I865G(dev))
> +		state = I915_READ(_CURACNTR) & CURSOR_ENABLE;
> +	else if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev))
> +		state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;
> +	else
> +		state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE;
> +
> +	return state;
> +}
> +
> +static bool cursor_position(struct drm_device *dev, int pipe, int *x, int *y)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	u32 pos;
> +
> +	if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev))
> +		pos = I915_READ(CURPOS_IVB(pipe));
> +	else
> +		pos = I915_READ(CURPOS(pipe));
> +
> +	*x = (pos >> CURSOR_X_SHIFT) & CURSOR_POS_MASK;
> +	if (pos & (CURSOR_POS_SIGN << CURSOR_X_SHIFT))
> +		*x = -*x;
> +
> +	*y = (pos >> CURSOR_Y_SHIFT) & CURSOR_POS_MASK;
> +	if (pos & (CURSOR_POS_SIGN << CURSOR_Y_SHIFT))
> +		*y = -*y;
> +
> +	return cursor_active(dev, pipe);
> +}
> +
>  static int i915_display_info(struct seq_file *m, void *unused)
>  {
>  	struct drm_info_node *node = (struct drm_info_node *) m->private;
>  	struct drm_device *dev = node->minor->dev;
> -	struct drm_crtc *crtc;
> +	struct intel_crtc *crtc;
>  	struct drm_connector *connector;
>  
>  	drm_modeset_lock_all(dev);
>  	seq_printf(m, "CRTC info\n");
>  	seq_printf(m, "---------\n");
> -	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
> -		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> +	list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
> +		bool active;
> +		int x, y;
>  
>  		seq_printf(m, "CRTC %d: pipe: %c, active: %s\n",
> -			   crtc->base.id, pipe_name(intel_crtc->pipe),
> -			   intel_crtc->active ? "yes" : "no");
> -		if (intel_crtc->active)
> -			intel_crtc_info(m, intel_crtc);
> +			   crtc->base.base.id, pipe_name(crtc->pipe),
> +			   yesno(crtc->active));
> +		if (crtc->active)
> +			intel_crtc_info(m, crtc);
> +
> +		active = cursor_position(dev, crtc->pipe, &x, &y);
> +		seq_printf(m, "\tcursor visible? %s, position (%d, %d), addr 0x%08x, active? %s\n",
> +			   yesno(crtc->cursor_visible),
> +			   x, y, crtc->cursor_addr,
> +			   yesno(active));
>  	}
>  
>  	seq_printf(m, "\n");
> -- 
> 1.9.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

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

* Re: [PATCH] drm/i915: Show cursor status in debugfs/i915_display_info
  2014-03-12  9:29 ` Ville Syrjälä
@ 2014-03-12 15:17   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2014-03-12 15:17 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Wed, Mar 12, 2014 at 11:29:35AM +0200, Ville Syrjälä wrote:
> On Wed, Mar 12, 2014 at 09:13:13AM +0000, Chris Wilson wrote:
> > I have the occasional absent cursor on i845 and I want to know why.
> > This should help by revealing the last known cursor state.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2014-03-12 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-12  9:13 [PATCH] drm/i915: Show cursor status in debugfs/i915_display_info Chris Wilson
2014-03-12  9:29 ` Ville Syrjälä
2014-03-12 15:17   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.