From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 6/6] drm/i915: Give meaningful names to all the planes
Date: Thu, 12 Nov 2015 20:32:42 +0200 [thread overview]
Message-ID: <20151112183242.GS4437@intel.com> (raw)
In-Reply-To: <20151112174919.GR4437@intel.com>
On Thu, Nov 12, 2015 at 07:49:19PM +0200, Ville Syrjälä wrote:
> On Thu, Nov 12, 2015 at 05:38:48PM +0000, Emil Velikov wrote:
> > Hi Ville,
> >
> > On 12 November 2015 at 16:52, <ville.syrjala@linux.intel.com> wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > >
> > > Let's name our planes in a way that makes sense wrt. the spec:
> > > - skl+ -> "plane 1A", "plane 2A", "plane 1C", "cursor A" etc.
> > > - g4x+ -> "primary A", "primary B", "sprite A", "cursor C" etc.
> > > - pre-g4x -> "plane A", "cursor B" etc.
> > >
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > > drivers/gpu/drm/i915/intel_display.c | 35 +++++++++++++++++++++++++++++++++--
> > > drivers/gpu/drm/i915/intel_sprite.c | 14 ++++++++++++++
> > > 2 files changed, 47 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > > index 2b5e81a..82b2f58 100644
> > > --- a/drivers/gpu/drm/i915/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/intel_display.c
> > > @@ -13788,7 +13788,15 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc,
> > > void intel_plane_destroy(struct drm_plane *plane)
> > > {
> > > struct intel_plane *intel_plane = to_intel_plane(plane);
> > > + char *name;
> > > +
> > > + /*
> > > + * drm_plane_cleanup() zeroes the structure, so
> > > + * need an extra dance to avoid leaking the name.
> > > + */
> > > + name = plane->name;
> > > drm_plane_cleanup(plane);
> > > + kfree(name);
> > > kfree(intel_plane);
> > > }
> > >
> > > @@ -13838,6 +13846,21 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
> > > if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4)
> > > primary->plane = !pipe;
> > >
> > > + if (INTEL_INFO(dev)->gen >= 9)
> > > + primary->base.name = kasprintf(GFP_KERNEL, "plane 1%c",
> > > + pipe_name(pipe));
> > > + else if (INTEL_INFO(dev)->gen >= 5 || IS_G4X(dev))
> > > + primary->base.name = kasprintf(GFP_KERNEL, "primary %c",
> > > + pipe_name(pipe));
> > > + else
> > > + primary->base.name = kasprintf(GFP_KERNEL, "plane %c",
> > > + plane_name(primary->plane));
> > > + if (!primary->base.name) {
> > > + kfree(state);
> > > + kfree(primary);
> > > + return NULL;
> > Worth adding a label and doing all the teardown there ? (same goes for
> > the rest of the patch)
>
> Dunno. Was feeling lazy, and so didn't go the extra mile.
After a better look I saw that I fumbled the error paths in the crtc
name patch too. So I went on to clean things up a bit. I think I'll
repost the lot since there are now more patches.
>
> >
> > > + }
> > > +
> > > if (INTEL_INFO(dev)->gen >= 9) {
> > > intel_primary_formats = skl_primary_formats;
> > > num_formats = ARRAY_SIZE(skl_primary_formats);
> > > @@ -13987,6 +14010,14 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> > > cursor->commit_plane = intel_commit_cursor_plane;
> > > cursor->disable_plane = intel_disable_cursor_plane;
> > >
> > > + cursor->base.name = kasprintf(GFP_KERNEL, "cursor %c",
> > > + pipe_name(pipe));
> > > + if (!cursor->base.name) {
> > > + kfree(state);
> > > + kfree(cursor);
> > > + return NULL;
> > > + }
> > > +
> > > drm_universal_plane_init(dev, &cursor->base, 0,
> > > &intel_plane_funcs,
> > > intel_cursor_formats,
> > > @@ -14113,9 +14144,9 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
> > >
> > > fail:
> > > if (primary)
> > > - drm_plane_cleanup(primary);
> > > + intel_plane_destroy(primary);
> > > if (cursor)
> > > - drm_plane_cleanup(cursor);
> > > + intel_plane_destroy(cursor);
> > Something feels strange here. We are either leaking memory before or
> > we'll end up with double free after your patch. Worth
> > checking/mentioning in the commit message ?
>
> Yeah, I think we were leaking here. Forgot to add a note.
>
> --
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-11-12 18:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 16:52 [PATCH 0/6] drm: Give crtcs and planes actual names ville.syrjala
2015-11-12 16:52 ` [PATCH 1/6] drm: Add crtc->name and use it in debug messages ville.syrjala
2015-11-12 16:52 ` [PATCH 2/6] drm: Add plane->name and use it in debug prints ville.syrjala
2015-11-12 16:52 ` [PATCH 3/6] drm/i915: Use crtc->name in debug messages ville.syrjala
2015-11-12 16:52 ` [PATCH 4/6] drm/i915: Use plane->name in debug prints ville.syrjala
2015-11-12 16:52 ` [PATCH 5/6] drm/i915: Set crtc->name to "pipe A", "pipe B", etc ville.syrjala
2015-11-12 16:52 ` [PATCH 6/6] drm/i915: Give meaningful names to all the planes ville.syrjala
2015-11-12 17:38 ` Emil Velikov
2015-11-12 17:49 ` Ville Syrjälä
2015-11-12 18:32 ` Ville Syrjälä [this message]
2015-11-17 10:11 ` [PATCH 0/6] drm: Give crtcs and planes actual names Daniel Vetter
2015-11-17 10:20 ` [Intel-gfx] " Jani Nikula
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=20151112183242.GS4437@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--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