From: Daniel Vetter <daniel@ffwll.ch>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/5] drm: Add __drm_atomic_helper_crtc_state_reset() & co.
Date: Thu, 7 Nov 2019 18:38:41 +0100 [thread overview]
Message-ID: <20191107173841.GP23790@phenom.ffwll.local> (raw)
In-Reply-To: <20191107142417.11107-1-ville.syrjala@linux.intel.com>
On Thu, Nov 07, 2019 at 04:24:13PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Annoyingly __drm_atomic_helper_crtc_reset() does two
> totally separate things:
> a) reset the state to defaults values
> b) assign the crtc->state pointer
>
> I just want a) without the b) so let's split out part
> a) into __drm_atomic_helper_crtc_state_reset(). And
> of course we'll do the same thing for planes and connectors.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
And I guess
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
for merging through drm-intel, I don't expect anyone to start using this
in the next few weeks.
Cheers, Daniel
> ---
> drivers/gpu/drm/drm_atomic_state_helper.c | 70 ++++++++++++++++++++---
> include/drm/drm_atomic_state_helper.h | 6 ++
> 2 files changed, 67 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
> index d0a937fb0c56..a972068d58cf 100644
> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> @@ -57,6 +57,22 @@
> * for these functions.
> */
>
> +/**
> + * __drm_atomic_helper_crtc_state_reset - reset the CRTC state
> + * @crtc_state: atomic CRTC state, must not be NULL
> + * @crtc: CRTC object, must not be NULL
> + *
> + * Initializes the newly allocated @crtc_state with default
> + * values. This is useful for drivers that subclass the CRTC state.
> + */
> +void
> +__drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
> + struct drm_crtc *crtc)
> +{
> + crtc_state->crtc = crtc;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
> +
> /**
> * __drm_atomic_helper_crtc_reset - reset state on CRTC
> * @crtc: drm CRTC
> @@ -74,7 +90,7 @@ __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
> struct drm_crtc_state *crtc_state)
> {
> if (crtc_state)
> - crtc_state->crtc = crtc;
> + __drm_atomic_helper_crtc_state_reset(crtc_state, crtc);
>
> crtc->state = crtc_state;
> }
> @@ -212,23 +228,43 @@ void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
> EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
>
> /**
> - * __drm_atomic_helper_plane_reset - resets planes state to default values
> + * __drm_atomic_helper_plane_state_reset - resets plane state to default values
> + * @plane_state: atomic plane state, must not be NULL
> * @plane: plane object, must not be NULL
> - * @state: atomic plane state, must not be NULL
> *
> - * Initializes plane state to default. This is useful for drivers that subclass
> - * the plane state.
> + * Initializes the newly allocated @plane_state with default
> + * values. This is useful for drivers that subclass the CRTC state.
> */
> -void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> - struct drm_plane_state *state)
> +void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
> + struct drm_plane *plane)
> {
> state->plane = plane;
> state->rotation = DRM_MODE_ROTATE_0;
>
> state->alpha = DRM_BLEND_ALPHA_OPAQUE;
> state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_plane_state_reset);
>
> - plane->state = state;
> +/**
> + * __drm_atomic_helper_plane_reset - reset state on plane
> + * @plane: drm plane
> + * @plane_state: plane state to assign
> + *
> + * Initializes the newly allocated @plane_state and assigns it to
> + * the &drm_crtc->state pointer of @plane, usually required when
> + * initializing the drivers or when called from the &drm_plane_funcs.reset
> + * hook.
> + *
> + * This is useful for drivers that subclass the plane state.
> + */
> +void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> + struct drm_plane_state *plane_state)
> +{
> + if (plane_state)
> + __drm_atomic_helper_plane_state_reset(plane_state, plane);
> +
> + plane->state = plane_state;
> }
> EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
>
> @@ -335,6 +371,22 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
> }
> EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
>
> +/**
> + * __drm_atomic_helper_connector_state_reset - reset the connector state
> + * @conn__state: atomic connector state, must not be NULL
> + * @connector: connectotr object, must not be NULL
> + *
> + * Initializes the newly allocated @conn_state with default
> + * values. This is useful for drivers that subclass the connector state.
> + */
> +void
> +__drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
> + struct drm_connector *connector)
> +{
> + conn_state->connector = connector;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_connector_state_reset);
> +
> /**
> * __drm_atomic_helper_connector_reset - reset state on connector
> * @connector: drm connector
> @@ -352,7 +404,7 @@ __drm_atomic_helper_connector_reset(struct drm_connector *connector,
> struct drm_connector_state *conn_state)
> {
> if (conn_state)
> - conn_state->connector = connector;
> + __drm_atomic_helper_connector_state_reset(conn_state, connector);
>
> connector->state = conn_state;
> }
> diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h
> index e4577cc11689..8171dea4cc22 100644
> --- a/include/drm/drm_atomic_state_helper.h
> +++ b/include/drm/drm_atomic_state_helper.h
> @@ -37,6 +37,8 @@ struct drm_private_state;
> struct drm_modeset_acquire_ctx;
> struct drm_device;
>
> +void __drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *state,
> + struct drm_crtc *crtc);
> void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
> struct drm_crtc_state *state);
> void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
> @@ -48,6 +50,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state);
> void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
> struct drm_crtc_state *state);
>
> +void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
> + struct drm_plane *plane);
> void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> struct drm_plane_state *state);
> void drm_atomic_helper_plane_reset(struct drm_plane *plane);
> @@ -59,6 +63,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state);
> void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
> struct drm_plane_state *state);
>
> +void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
> + struct drm_connector *connector);
> void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
> struct drm_connector_state *conn_state);
> void drm_atomic_helper_connector_reset(struct drm_connector *connector);
> --
> 2.23.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/5] drm: Add __drm_atomic_helper_crtc_state_reset() & co.
Date: Thu, 7 Nov 2019 18:38:41 +0100 [thread overview]
Message-ID: <20191107173841.GP23790@phenom.ffwll.local> (raw)
Message-ID: <20191107173841.bXSuLoDH_YBPKfDXD6OjhVsk1oDHWJ7Z1q7xBdbLszM@z> (raw)
In-Reply-To: <20191107142417.11107-1-ville.syrjala@linux.intel.com>
On Thu, Nov 07, 2019 at 04:24:13PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Annoyingly __drm_atomic_helper_crtc_reset() does two
> totally separate things:
> a) reset the state to defaults values
> b) assign the crtc->state pointer
>
> I just want a) without the b) so let's split out part
> a) into __drm_atomic_helper_crtc_state_reset(). And
> of course we'll do the same thing for planes and connectors.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
And I guess
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
for merging through drm-intel, I don't expect anyone to start using this
in the next few weeks.
Cheers, Daniel
> ---
> drivers/gpu/drm/drm_atomic_state_helper.c | 70 ++++++++++++++++++++---
> include/drm/drm_atomic_state_helper.h | 6 ++
> 2 files changed, 67 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
> index d0a937fb0c56..a972068d58cf 100644
> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> @@ -57,6 +57,22 @@
> * for these functions.
> */
>
> +/**
> + * __drm_atomic_helper_crtc_state_reset - reset the CRTC state
> + * @crtc_state: atomic CRTC state, must not be NULL
> + * @crtc: CRTC object, must not be NULL
> + *
> + * Initializes the newly allocated @crtc_state with default
> + * values. This is useful for drivers that subclass the CRTC state.
> + */
> +void
> +__drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
> + struct drm_crtc *crtc)
> +{
> + crtc_state->crtc = crtc;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
> +
> /**
> * __drm_atomic_helper_crtc_reset - reset state on CRTC
> * @crtc: drm CRTC
> @@ -74,7 +90,7 @@ __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
> struct drm_crtc_state *crtc_state)
> {
> if (crtc_state)
> - crtc_state->crtc = crtc;
> + __drm_atomic_helper_crtc_state_reset(crtc_state, crtc);
>
> crtc->state = crtc_state;
> }
> @@ -212,23 +228,43 @@ void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
> EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
>
> /**
> - * __drm_atomic_helper_plane_reset - resets planes state to default values
> + * __drm_atomic_helper_plane_state_reset - resets plane state to default values
> + * @plane_state: atomic plane state, must not be NULL
> * @plane: plane object, must not be NULL
> - * @state: atomic plane state, must not be NULL
> *
> - * Initializes plane state to default. This is useful for drivers that subclass
> - * the plane state.
> + * Initializes the newly allocated @plane_state with default
> + * values. This is useful for drivers that subclass the CRTC state.
> */
> -void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> - struct drm_plane_state *state)
> +void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
> + struct drm_plane *plane)
> {
> state->plane = plane;
> state->rotation = DRM_MODE_ROTATE_0;
>
> state->alpha = DRM_BLEND_ALPHA_OPAQUE;
> state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_plane_state_reset);
>
> - plane->state = state;
> +/**
> + * __drm_atomic_helper_plane_reset - reset state on plane
> + * @plane: drm plane
> + * @plane_state: plane state to assign
> + *
> + * Initializes the newly allocated @plane_state and assigns it to
> + * the &drm_crtc->state pointer of @plane, usually required when
> + * initializing the drivers or when called from the &drm_plane_funcs.reset
> + * hook.
> + *
> + * This is useful for drivers that subclass the plane state.
> + */
> +void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> + struct drm_plane_state *plane_state)
> +{
> + if (plane_state)
> + __drm_atomic_helper_plane_state_reset(plane_state, plane);
> +
> + plane->state = plane_state;
> }
> EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
>
> @@ -335,6 +371,22 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
> }
> EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
>
> +/**
> + * __drm_atomic_helper_connector_state_reset - reset the connector state
> + * @conn__state: atomic connector state, must not be NULL
> + * @connector: connectotr object, must not be NULL
> + *
> + * Initializes the newly allocated @conn_state with default
> + * values. This is useful for drivers that subclass the connector state.
> + */
> +void
> +__drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
> + struct drm_connector *connector)
> +{
> + conn_state->connector = connector;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_connector_state_reset);
> +
> /**
> * __drm_atomic_helper_connector_reset - reset state on connector
> * @connector: drm connector
> @@ -352,7 +404,7 @@ __drm_atomic_helper_connector_reset(struct drm_connector *connector,
> struct drm_connector_state *conn_state)
> {
> if (conn_state)
> - conn_state->connector = connector;
> + __drm_atomic_helper_connector_state_reset(conn_state, connector);
>
> connector->state = conn_state;
> }
> diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h
> index e4577cc11689..8171dea4cc22 100644
> --- a/include/drm/drm_atomic_state_helper.h
> +++ b/include/drm/drm_atomic_state_helper.h
> @@ -37,6 +37,8 @@ struct drm_private_state;
> struct drm_modeset_acquire_ctx;
> struct drm_device;
>
> +void __drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *state,
> + struct drm_crtc *crtc);
> void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
> struct drm_crtc_state *state);
> void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
> @@ -48,6 +50,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state);
> void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
> struct drm_crtc_state *state);
>
> +void __drm_atomic_helper_plane_state_reset(struct drm_plane_state *state,
> + struct drm_plane *plane);
> void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> struct drm_plane_state *state);
> void drm_atomic_helper_plane_reset(struct drm_plane *plane);
> @@ -59,6 +63,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state);
> void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
> struct drm_plane_state *state);
>
> +void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_state,
> + struct drm_connector *connector);
> void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
> struct drm_connector_state *conn_state);
> void drm_atomic_helper_connector_reset(struct drm_connector *connector);
> --
> 2.23.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-11-07 17:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-07 14:24 [PATCH 1/5] drm: Add __drm_atomic_helper_crtc_state_reset() & co Ville Syrjala
2019-11-07 14:24 ` Ville Syrjala
2019-11-07 14:24 ` [PATCH 2/5] drm/i915: s/intel_crtc/crtc/ in intel_crtc_init() Ville Syrjala
2019-11-07 14:24 ` Ville Syrjala
2019-12-10 2:06 ` [Intel-gfx] " Souza, Jose
2019-11-07 14:24 ` [PATCH 3/5] drm/i915: Introduce intel_crtc_{alloc,free}() Ville Syrjala
2019-12-10 2:09 ` Souza, Jose
2019-11-07 14:24 ` [PATCH 4/5] drm/i915: Introduce intel_crtc_state_reset() Ville Syrjala
2019-12-10 2:12 ` [Intel-gfx] " Souza, Jose
2019-11-07 14:24 ` [PATCH 5/5] drm/i915: Introduce intel_plane_state_reset() Ville Syrjala
2019-12-10 2:12 ` [Intel-gfx] " Souza, Jose
2019-11-07 17:38 ` Daniel Vetter [this message]
2019-11-07 17:38 ` [Intel-gfx] [PATCH 1/5] drm: Add __drm_atomic_helper_crtc_state_reset() & co Daniel Vetter
2019-12-13 23:38 ` Lucas De Marchi
2019-12-18 14:53 ` Ville Syrjälä
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=20191107173841.GP23790@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.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