intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 05/15] drm/atmel-hlcdc: Use per-plane rotation property
Date: Wed, 10 Aug 2016 18:38:39 +0200	[thread overview]
Message-ID: <20160810183839.2bdcffdf@bbrezillon> (raw)
In-Reply-To: <20160810140437.GE6232@phenom.ffwll.local>

On Wed, 10 Aug 2016 16:04:37 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Wed, Aug 10, 2016 at 01:52:45PM +0200, Boris Brezillon wrote:
> > On Wed, 10 Aug 2016 14:41:52 +0300
> > Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> >   
> > > On Wed, Aug 10, 2016 at 11:25:03AM +0200, Boris Brezillon wrote:  
> > > > On Wed, 10 Aug 2016 12:09:41 +0300
> > > > Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > > >     
> > > > > On Wed, Aug 10, 2016 at 10:35:22AM +0200, Boris Brezillon wrote:    
> > > > > > Hi Ville,
> > > > > > 
> > > > > > On Fri, 22 Jul 2016 18:47:01 +0300
> > > > > > ville.syrjala@linux.intel.com wrote:
> > > > > >       
> > > > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > > > 
> > > > > > > The global mode_config.rotation_property is going away, switch over to
> > > > > > > per-plane rotation_property.
> > > > > > > 
> > > > > > > v2: Propagate error upwards (Boris)
> > > > > > > 
> > > > > > > Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> > > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > > > > ---
> > > > > > >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 37 +++++++++++++------------
> > > > > > >  1 file changed, 20 insertions(+), 17 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > > > > > > index f3350c80704d..ee9bd7a938c3 100644
> > > > > > > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > > > > > > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> > > > > > > @@ -883,9 +883,9 @@ static int atmel_hlcdc_plane_atomic_get_property(struct drm_plane *p,
> > > > > > >  	return 0;
> > > > > > >  }
> > > > > > >  
> > > > > > > -static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
> > > > > > > -				const struct atmel_hlcdc_layer_desc *desc,
> > > > > > > -				struct atmel_hlcdc_plane_properties *props)
> > > > > > > +static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
> > > > > > > +					     const struct atmel_hlcdc_layer_desc *desc,
> > > > > > > +					     struct atmel_hlcdc_plane_properties *props)
> > > > > > >  {
> > > > > > >  	struct regmap *regmap = plane->layer.hlcdc->regmap;
> > > > > > >  
> > > > > > > @@ -902,10 +902,18 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
> > > > > > >  				ATMEL_HLCDC_LAYER_GA_MASK);
> > > > > > >  	}
> > > > > > >  
> > > > > > > -	if (desc->layout.xstride && desc->layout.pstride)
> > > > > > > -		drm_object_attach_property(&plane->base.base,
> > > > > > > -				plane->base.dev->mode_config.rotation_property,
> > > > > > > -				BIT(DRM_ROTATE_0));
> > > > > > > +	if (desc->layout.xstride && desc->layout.pstride) {
> > > > > > > +		int ret;
> > > > > > > +
> > > > > > > +		ret = drm_plane_create_rotation_property(&plane->base,
> > > > > > > +							 BIT(DRM_ROTATE_0),
> > > > > > > +							 BIT(DRM_ROTATE_0) |
> > > > > > > +							 BIT(DRM_ROTATE_90) |
> > > > > > > +							 BIT(DRM_ROTATE_180) |
> > > > > > > +							 BIT(DRM_ROTATE_270));
> > > > > > > +		if (ret)
> > > > > > > +			return ret;
> > > > > > > +	}
> > > > > > >  
> > > > > > >  	if (desc->layout.csc) {
> > > > > > >  		/*
> > > > > > > @@ -925,6 +933,8 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
> > > > > > >  			     ATMEL_HLCDC_LAYER_CSC_CFG(&plane->layer, 2),
> > > > > > >  			     0x40040890);
> > > > > > >  	}
> > > > > > > +
> > > > > > > +	return 0;
> > > > > > >  }
> > > > > > >  
> > > > > > >  static struct drm_plane_helper_funcs atmel_hlcdc_layer_plane_helper_funcs = {
> > > > > > > @@ -1036,7 +1046,9 @@ atmel_hlcdc_plane_create(struct drm_device *dev,
> > > > > > >  			     &atmel_hlcdc_layer_plane_helper_funcs);
> > > > > > >  
> > > > > > >  	/* Set default property values*/
> > > > > > > -	atmel_hlcdc_plane_init_properties(plane, desc, props);
> > > > > > > +	ret = atmel_hlcdc_plane_init_properties(plane, desc, props);
> > > > > > > +	if (ret)
> > > > > > > +		return ERR_PTR(ret);      
> > > > > > 
> > > > > > Shouldn't we call drm_plane_cleanup() here?      
> > > > > 
> > > > > The other error path doesn't call it either, so I figured no really
> > > > > cares anyway.    
> > > > 
> > > > Because the other error path is before plane initialization.    
> > > 
> > > There's some stuff being done earlier already, so either that part
> > > doesn't need cleaning, or the init/cleanup is somehow asymmetric, or
> > > it's just broken.  
> > 
> > devm_ resources are automatically released by the device-model, hence
> > the absence of devm_kfree(). atmel_hlcdc_layer_cleanup() should be
> > called if drm_universal_plane_init() fails though.  
> 
> Aside: drm objects are independently refcounting, mostly likely using
> devm_ on the underlying physical device for drm objects is a bug.

AFAICT it's not buggy: I'm not freeing the plane object in ->destroy()
(this is done when the underlying device is destroyed), but I release
other resources.

> At least all this stuff looks extremely fishy.

But that's true, using devm_ here is probably not the best solution.

I'll try to change that along with the memory leak fixes.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-08-10 16:38 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 13:43 [PATCH 00/15] drm: Per-plane rotation etc ville.syrjala
2016-07-22 13:43 ` [PATCH 01/15] drm: Add drm_rotation_90_or_270() ville.syrjala
2016-07-22 13:43 ` [PATCH 02/15] drm/atomic: Reject attempts to use multiple rotation angles at once ville.syrjala
2016-07-22 13:43 ` [PATCH v2 03/15] drm: Add support for optional per-plane rotation property ville.syrjala
2016-07-25  7:08   ` Joonas Lahtinen
2016-07-22 13:43 ` [PATCH 04/15] drm/arm: Use " ville.syrjala
2016-07-22 14:37   ` Brian Starkey
2016-07-22 13:43 ` [PATCH 05/15] drm/atmel-hlcdc: " ville.syrjala
2016-07-22 13:58   ` Boris Brezillon
2016-07-22 15:47   ` [PATCH v2 " ville.syrjala
2016-08-10  8:35     ` Boris Brezillon
2016-08-10  9:09       ` Ville Syrjälä
2016-08-10  9:25         ` Boris Brezillon
2016-08-10 11:41           ` Ville Syrjälä
2016-08-10 11:52             ` Boris Brezillon
2016-08-10 12:04               ` Boris Brezillon
2016-08-10 14:04               ` Daniel Vetter
2016-08-10 16:38                 ` Boris Brezillon [this message]
2016-08-11  8:50                   ` Daniel Vetter
2016-07-22 13:43 ` [PATCH 06/15] drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
2016-07-22 13:43 ` [PATCH 07/15] drm/omap: Use per-plane rotation property ville.syrjala
2016-08-11 11:32   ` Tomi Valkeinen
2016-08-11 13:33     ` Ville Syrjälä
2016-08-12 16:04       ` Ville Syrjälä
2016-09-23 11:33         ` [Intel-gfx] " Tomi Valkeinen
2016-07-22 13:43 ` [PATCH 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
2016-07-22 13:43 ` [PATCH 09/15] drm/msm/mdp5: Use per-plane rotation property ville.syrjala
2016-07-22 13:43 ` [PATCH 10/15] drm/msm/mdp5: Advertize 180 degree rotation ville.syrjala
2016-07-22 13:43 ` [PATCH v2 11/15] drm/i915: Use the per-plane rotation property ville.syrjala
2016-07-25  6:19   ` Joonas Lahtinen
2016-07-22 13:43 ` [PATCH 12/15] drm: RIP mode_config->rotation_property ville.syrjala
2016-07-25  6:08   ` Joonas Lahtinen
2016-10-17 22:38   ` Laurent Pinchart
2016-10-18  7:36     ` Daniel Vetter
2016-10-18  8:13       ` Laurent Pinchart
2016-10-18  9:16         ` [Intel-gfx] " Ville Syrjälä
2016-07-22 13:43 ` [PATCH 13/15] drm/i915: Use & instead if == to check for rotations ville.syrjala
2016-07-22 13:43 ` [PATCH 14/15] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup ville.syrjala
2016-07-22 13:43 ` [PATCH 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes ville.syrjala
2016-07-22 14:24 ` ✗ Ro.CI.BAT: failure for drm: Per-plane rotation etc Patchwork
2016-07-22 16:31 ` ✗ Ro.CI.BAT: failure for drm: Per-plane rotation etc. (rev2) Patchwork

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=20160810183839.2bdcffdf@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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).