From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Neil Armstrong <narmstrong@baylibre.com>
Cc: linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, khilman@baylibre.com,
Benoit Parrot <bparrot@ti.com>
Subject: Re: [PATCH v5 4/8] drm/omap: omap_plane: subclass drm_plane_state
Date: Tue, 12 Oct 2021 11:13:59 +0300 [thread overview]
Message-ID: <b9bb0e4b-26b8-72f0-937b-1a08145352d8@ideasonboard.com> (raw)
In-Reply-To: <20210923070701.145377-5-narmstrong@baylibre.com>
On 23/09/2021 10:06, Neil Armstrong wrote:
> From: Benoit Parrot <bparrot@ti.com>
>
> In preparation to add omap plane state specific extensions we need to
> subclass drm_plane_state and add the relevant helpers.
>
> The addition of specific extension will be done separately.
>
> Signed-off-by: Benoit Parrot <bparrot@ti.com>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> drivers/gpu/drm/omapdrm/omap_plane.c | 38 +++++++++++++++++++++++++---
> 1 file changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 0df5381cc015..bda794b4c915 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -16,6 +16,13 @@
> * plane funcs
> */
>
> +#define to_omap_plane_state(x) container_of(x, struct omap_plane_state, base)
> +
> +struct omap_plane_state {
> + /* Must be first. */
> + struct drm_plane_state base;
> +};
> +
> #define to_omap_plane(x) container_of(x, struct omap_plane, base)
>
> struct omap_plane {
> @@ -207,11 +214,17 @@ void omap_plane_install_properties(struct drm_plane *plane,
> static void omap_plane_reset(struct drm_plane *plane)
> {
> struct omap_plane *omap_plane = to_omap_plane(plane);
> + struct omap_plane_state *omap_state;
>
> - drm_atomic_helper_plane_reset(plane);
> - if (!plane->state)
> + if (plane->state)
> + drm_atomic_helper_plane_destroy_state(plane, plane->state);
> +
> + omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL);
> + if (!omap_state)
> return;
>
> + __drm_atomic_helper_plane_reset(plane, &omap_state->base);
> +
> /*
> * Set the zpos default depending on whether we are a primary or overlay
> * plane.
> @@ -222,6 +235,25 @@ static void omap_plane_reset(struct drm_plane *plane)
> plane->state->color_range = DRM_COLOR_YCBCR_FULL_RANGE;
> }
>
> +static struct drm_plane_state *
> +omap_plane_atomic_duplicate_state(struct drm_plane *plane)
> +{
> + struct omap_plane_state *state;
> + struct omap_plane_state *copy;
> +
> + if (WARN_ON(!plane->state))
> + return NULL;
> +
> + state = to_omap_plane_state(plane->state);
> + copy = kmemdup(state, sizeof(*state), GFP_KERNEL);
> + if (!copy)
> + return NULL;
> +
> + __drm_atomic_helper_plane_duplicate_state(plane, ©->base);
> +
> + return ©->base;
> +}
> +
omap_crtc.c has similar, but slightly different, functions. I think it
would be good to use the same style in omap_plane, or, if the approach
above is better, change omap_crtc to match the style here.
Tomi
next prev parent reply other threads:[~2021-10-12 8:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-23 7:06 [PATCH v5 0/8] drm/omap: Add virtual-planes support Neil Armstrong
2021-09-23 7:06 ` [PATCH v5 1/8] drm/omap: Add ability to check if requested plane modes can be supported Neil Armstrong
2021-10-12 7:21 ` Tomi Valkeinen
2021-10-12 8:32 ` Neil Armstrong
2021-09-23 7:06 ` [PATCH v5 2/8] drm/omap: Add ovl checking funcs to dispc_ops Neil Armstrong
2021-09-23 7:06 ` [PATCH v5 3/8] drm/omap: introduce omap_hw_overlay Neil Armstrong
2021-10-12 7:59 ` Tomi Valkeinen
2021-10-12 8:47 ` Neil Armstrong
2021-09-23 7:06 ` [PATCH v5 4/8] drm/omap: omap_plane: subclass drm_plane_state Neil Armstrong
2021-10-12 8:13 ` Tomi Valkeinen [this message]
2021-10-12 8:56 ` Neil Armstrong
2021-09-23 7:06 ` [PATCH v5 5/8] drm/omap: Add global state as a private atomic object Neil Armstrong
2021-10-12 10:44 ` Tomi Valkeinen
2021-10-12 13:23 ` Neil Armstrong
2021-10-12 13:38 ` Tomi Valkeinen
2021-10-12 15:41 ` Neil Armstrong
2021-09-23 7:06 ` [PATCH v5 6/8] drm/omap: dynamically assign hw overlays to planes Neil Armstrong
2021-10-12 13:34 ` Tomi Valkeinen
2021-10-12 14:45 ` Neil Armstrong
2021-09-23 7:07 ` [PATCH v5 7/8] drm/omap: add plane_atomic_print_state support Neil Armstrong
2021-09-23 7:07 ` [PATCH v5 8/8] drm/omap: Add a 'right overlay' to plane state Neil Armstrong
2021-10-06 8:17 ` [PATCH v5 0/8] drm/omap: Add virtual-planes support Neil Armstrong
2021-10-06 12:48 ` Tomi Valkeinen
2021-10-12 7:15 ` Tomi Valkeinen
2021-10-12 8:30 ` Neil Armstrong
2021-10-12 10:36 ` Tomi Valkeinen
2021-10-12 13:27 ` Neil Armstrong
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=b9bb0e4b-26b8-72f0-937b-1a08145352d8@ideasonboard.com \
--to=tomi.valkeinen@ideasonboard.com \
--cc=bparrot@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=narmstrong@baylibre.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
all inboxes | Powered by JetHome®