From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 01/15] drm: omapdrm: Fix plane state free in plane reset handler
Date: Wed, 9 Dec 2015 14:43:19 +0200 [thread overview]
Message-ID: <566821E7.8030202@ti.com> (raw)
In-Reply-To: <1449268039-24682-2-git-send-email-laurent.pinchart@ideasonboard.com>
[-- Attachment #1.1: Type: text/plain, Size: 3087 bytes --]
On 05/12/15 00:27, Laurent Pinchart wrote:
> The plane reset handler frees the plane state and allocates a new
> default state, but when doing so attempt to free the plane state using
> the base plane state pointer instead of casting it to the
> driver-specific state object that has been allocated. Fix it by using
> the omap_plane_atomic_destroy_state() function to destroy the plane
> state instead of duplicating the code.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/omapdrm/omap_plane.c | 53 ++++++++++++++++++------------------
> 1 file changed, 26 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 3054bda72688..11d406b160e1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -188,33 +188,6 @@ static const struct drm_plane_helper_funcs omap_plane_helper_funcs = {
> .atomic_disable = omap_plane_atomic_disable,
> };
>
> -static void omap_plane_reset(struct drm_plane *plane)
> -{
> - struct omap_plane *omap_plane = to_omap_plane(plane);
> - struct omap_plane_state *omap_state;
> -
> - if (plane->state && plane->state->fb)
> - drm_framebuffer_unreference(plane->state->fb);
> -
> - kfree(plane->state);
> - plane->state = NULL;
> -
> - omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL);
> - if (omap_state == NULL)
> - return;
> -
> - /*
> - * Set defaults depending on whether we are a primary or overlay
> - * plane.
> - */
> - omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
> - ? 0 : omap_plane->id;
> - omap_state->base.rotation = BIT(DRM_ROTATE_0);
> -
> - plane->state = &omap_state->base;
> - plane->state->plane = plane;
> -}
> -
> static void omap_plane_destroy(struct drm_plane *plane)
> {
> struct omap_plane *omap_plane = to_omap_plane(plane);
> @@ -270,6 +243,32 @@ static void omap_plane_atomic_destroy_state(struct drm_plane *plane,
> kfree(to_omap_plane_state(state));
> }
>
> +static void omap_plane_reset(struct drm_plane *plane)
> +{
> + struct omap_plane *omap_plane = to_omap_plane(plane);
> + struct omap_plane_state *omap_state;
> +
> + if (plane->state) {
> + omap_plane_atomic_destroy_state(plane, plane->state);
> + plane->state = NULL;
> + }
> +
> + omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL);
> + if (omap_state == NULL)
> + return;
> +
> + /*
> + * Set defaults depending on whether we are a primary or overlay
> + * plane.
> + */
> + omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
> + ? 0 : omap_plane->id;
> + omap_state->base.rotation = BIT(DRM_ROTATE_0);
> +
> + plane->state = &omap_state->base;
> + plane->state->plane = plane;
> +}
> +
> static int omap_plane_atomic_set_property(struct drm_plane *plane,
> struct drm_plane_state *state,
> struct drm_property *property,
>
This one moves the function, so it's pretty hard to see what actually
was changed.
Tomi
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-12-09 12:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 22:27 [PATCH 00/15] omapdrm: Implement dma_buf import Laurent Pinchart
2015-12-04 22:27 ` [PATCH 01/15] drm: omapdrm: Fix plane state free in plane reset handler Laurent Pinchart
2015-12-09 12:43 ` Tomi Valkeinen [this message]
2015-12-13 20:39 ` Laurent Pinchart
2015-12-14 7:59 ` Tomi Valkeinen
2015-12-04 22:27 ` [PATCH 02/15] drm: omapdrm: Make fbdev emulation optional Laurent Pinchart
2015-12-04 22:27 ` [PATCH 03/15] drm: omapdrm: gem: Remove unused function prototypes Laurent Pinchart
2015-12-04 22:27 ` [PATCH 04/15] drm: omapdrm: gem: Remove forward declarations Laurent Pinchart
2015-12-04 22:27 ` [PATCH 05/15] drm: omapdrm: gem: Group functions by purpose Laurent Pinchart
2015-12-04 22:27 ` [PATCH 06/15] drm: omapdrm: gem: Move global usergart variable to omap_drm_private Laurent Pinchart
2015-12-04 22:27 ` [PATCH 07/15] drm: omapdrm: gem: Remove omap_drm_private has_dmm field Laurent Pinchart
2015-12-04 22:27 ` [PATCH 08/15] drm: omapdrm: gem: Mask out private flags passed from userspace Laurent Pinchart
2015-12-07 14:13 ` Emil Velikov
2015-12-14 20:33 ` Laurent Pinchart
2015-12-16 17:33 ` Emil Velikov
2015-12-16 23:27 ` Rob Clark
2015-12-04 22:27 ` [PATCH 09/15] drm: omapdrm: gem: Clean up GEM objects memory flags Laurent Pinchart
2015-12-04 22:27 ` [PATCH 10/15] drm: omapdrm: gem: Free the correct memory object Laurent Pinchart
2015-12-14 11:45 ` Tomi Valkeinen
2015-12-14 19:52 ` Laurent Pinchart
2015-12-04 22:27 ` [PATCH 11/15] drm: omapdrm: gem: Don't free mmap offset twice Laurent Pinchart
2015-12-04 22:27 ` [PATCH 12/15] drm: omapdrm: gem: Simplify error handling when creating GEM object Laurent Pinchart
2015-12-04 22:27 ` [PATCH 13/15] drm: omapdrm: gem: Remove check for impossible condition Laurent Pinchart
2015-12-04 22:27 ` [PATCH 14/15] drm: omapdrm: gem: Refactor GEM object allocation Laurent Pinchart
2015-12-04 22:27 ` [PATCH 15/15] drm: omapdrm: gem: Implement dma_buf import Laurent Pinchart
2015-12-05 15:40 ` Daniel Vetter
2015-12-05 22:24 ` Laurent Pinchart
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=566821E7.8030202@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
/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