All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Export intel_framebuffer_fini
Date: Tue, 6 Aug 2013 20:13:04 +0300	[thread overview]
Message-ID: <20130806171304.GJ5004@intel.com> (raw)
In-Reply-To: <1375807387-11075-1-git-send-email-chris@chris-wilson.co.uk>

On Tue, Aug 06, 2013 at 05:43:07PM +0100, Chris Wilson wrote:
> Rather than open-code the teardown of a framebuffer, export the routine
> from intel_display.c. This then make intel_fbdev symmetric in its use of
> the common intel_framebuffer routines to initialise and clean up the
> struct intel_framebuffer. (And new features need only be added in one
> location!)
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 10 +++++++---
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  drivers/gpu/drm/i915/intel_fb.c      | 15 +++++----------
>  3 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0584480..dc52fea 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9438,13 +9438,17 @@ static void intel_setup_outputs(struct drm_device *dev)
>  	drm_helper_move_panel_connectors_to_head(dev);
>  }
>  
> +void intel_framebuffer_fini(struct intel_framebuffer *fb)
> +{
> +	drm_framebuffer_cleanup(&fb->base);
> +	drm_gem_object_unreference_unlocked(&fb->obj->base);
> +}
> +
>  static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
>  {
>  	struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
>  
> -	drm_framebuffer_cleanup(fb);
> -	drm_gem_object_unreference_unlocked(&intel_fb->obj->base);
> -
> +	intel_framebuffer_fini(intel_fb);
>  	kfree(intel_fb);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index ed33976..54e389d 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -720,6 +720,7 @@ extern int intel_framebuffer_init(struct drm_device *dev,
>  				  struct intel_framebuffer *ifb,
>  				  struct drm_mode_fb_cmd2 *mode_cmd,
>  				  struct drm_i915_gem_object *obj);
> +extern void intel_framebuffer_fini(struct intel_framebuffer *fb);
>  extern int intel_fbdev_init(struct drm_device *dev);
>  extern void intel_fbdev_initial_config(struct drm_device *dev);
>  extern void intel_fbdev_fini(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
> index f3c97e0..bc21000 100644
> --- a/drivers/gpu/drm/i915/intel_fb.c
> +++ b/drivers/gpu/drm/i915/intel_fb.c
> @@ -193,26 +193,21 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
>  static void intel_fbdev_destroy(struct drm_device *dev,
>  				struct intel_fbdev *ifbdev)
>  {
> -	struct fb_info *info;
> -	struct intel_framebuffer *ifb = &ifbdev->ifb;
> -
>  	if (ifbdev->helper.fbdev) {
> -		info = ifbdev->helper.fbdev;
> +		struct fb_info *info = ifbdev->helper.fbdev;
> +
>  		unregister_framebuffer(info);
>  		iounmap(info->screen_base);
>  		if (info->cmap.len)
>  			fb_dealloc_cmap(&info->cmap);
> +
>  		framebuffer_release(info);
>  	}
>  
>  	drm_fb_helper_fini(&ifbdev->helper);
>  
> -	drm_framebuffer_unregister_private(&ifb->base);
> -	drm_framebuffer_cleanup(&ifb->base);
> -	if (ifb->obj) {
> -		drm_gem_object_unreference_unlocked(&ifb->obj->base);
> -		ifb->obj = NULL;
> -	}

I wonder what this thing was trying to achieve. Almost like it was
expecting to be called before .fb_probe() happened, but that doesn't
appear to be possible. And if it did happen, the fb itself wouldn't
have been initialized either so it would explode anyway.

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

> +	drm_framebuffer_unregister_private(&ifbdev->ifb.base);
> +	intel_framebuffer_fini(&ifbdev->ifb);
>  }
>  
>  int intel_fbdev_init(struct drm_device *dev)
> -- 
> 1.8.4.rc1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-08-06 17:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 16:43 [PATCH] drm/i915: Export intel_framebuffer_fini Chris Wilson
2013-08-06 17:13 ` Ville Syrjälä [this message]
2013-08-06 18:09   ` Daniel Vetter

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=20130806171304.GJ5004@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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 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.