diff mbox

[v2,4/7] drm/i915: Use a custom restore_fbdev_mode hook

Message ID 1370020027-27595-5-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjala May 31, 2013, 5:07 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Disable sprite planes and cursors when restoring the fbdev mode.

Should makes oopses more readable if they're not covered by sprites and
cursors.

v2: Rebased due to changes earlier in the series

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_fb.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

Comments

Chris Wilson June 3, 2013, 10:08 a.m. UTC | #1
On Fri, May 31, 2013 at 08:07:04PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Disable sprite planes and cursors when restoring the fbdev mode.
> 
> Should makes oopses more readable if they're not covered by sprites and
> cursors.
> 
> v2: Rebased due to changes earlier in the series

Nice, this should fix the issue of the rogue cursor and the like if X
exits abnormally. Explicitly disabling it feels wrong, but as the cursor
is not integrated into the modesetting sequence I have no better
suggestion.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Comment inline.

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_fb.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
> index b34ccf3..e8389df 100644
> --- a/drivers/gpu/drm/i915/intel_fb.c
> +++ b/drivers/gpu/drm/i915/intel_fb.c
> @@ -183,11 +183,25 @@ out:
>  	return ret;
>  }
>  
> +static bool intel_fb_restore_fbdev_mode(struct drm_fb_helper *helper)
> +{
> +	struct drm_device *dev = helper->dev;
> +	bool ret;
> +
> +	intel_disable_cursors_and_sprites(dev);
> +
> +	ret = drm_fb_helper_restore_fbdev_mode(helper);
> +	if (ret)
> +		DRM_DEBUG("failed to restore crtc mode\n");

Just return without the DBG here, and keep the DBG up a level where we
discard the error code.

> +
> +	return ret;
> +}
> +
>  static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
>  	.gamma_set = intel_crtc_fb_gamma_set,
>  	.gamma_get = intel_crtc_fb_gamma_get,
>  	.fb_probe = intelfb_create,
> -	.restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
> +	.restore_fbdev_mode = intel_fb_restore_fbdev_mode,
>  };
>  
>  static void intel_fbdev_destroy(struct drm_device *dev,
> @@ -291,7 +305,6 @@ void intel_fb_output_poll_changed(struct drm_device *dev)
>  
>  void intel_fb_restore_mode(struct drm_device *dev)
>  {
> -	int ret;
>  	drm_i915_private_t *dev_priv = dev->dev_private;
>  
>  	if (INTEL_INFO(dev)->num_pipes == 0)
> @@ -299,11 +312,7 @@ void intel_fb_restore_mode(struct drm_device *dev)
>  
>  	drm_modeset_lock_all(dev);
>  
> -	intel_disable_cursors_and_sprites(dev);
> -
> -	ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
> -	if (ret)
> -		DRM_DEBUG("failed to restore crtc mode\n");
As above, I think this is the better location for the DBG.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index b34ccf3..e8389df 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -183,11 +183,25 @@  out:
 	return ret;
 }
 
+static bool intel_fb_restore_fbdev_mode(struct drm_fb_helper *helper)
+{
+	struct drm_device *dev = helper->dev;
+	bool ret;
+
+	intel_disable_cursors_and_sprites(dev);
+
+	ret = drm_fb_helper_restore_fbdev_mode(helper);
+	if (ret)
+		DRM_DEBUG("failed to restore crtc mode\n");
+
+	return ret;
+}
+
 static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 	.gamma_set = intel_crtc_fb_gamma_set,
 	.gamma_get = intel_crtc_fb_gamma_get,
 	.fb_probe = intelfb_create,
-	.restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
+	.restore_fbdev_mode = intel_fb_restore_fbdev_mode,
 };
 
 static void intel_fbdev_destroy(struct drm_device *dev,
@@ -291,7 +305,6 @@  void intel_fb_output_poll_changed(struct drm_device *dev)
 
 void intel_fb_restore_mode(struct drm_device *dev)
 {
-	int ret;
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
 	if (INTEL_INFO(dev)->num_pipes == 0)
@@ -299,11 +312,7 @@  void intel_fb_restore_mode(struct drm_device *dev)
 
 	drm_modeset_lock_all(dev);
 
-	intel_disable_cursors_and_sprites(dev);
-
-	ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
-	if (ret)
-		DRM_DEBUG("failed to restore crtc mode\n");
+	intel_fb_restore_fbdev_mode(&dev_priv->fbdev->helper);
 
 	drm_modeset_unlock_all(dev);
 }