dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 04/13] drm: add atomic_set_property wrappers
Date: Wed, 17 Dec 2014 07:49:54 -0500	[thread overview]
Message-ID: <20141217124953.GA19962@philcollins> (raw)
In-Reply-To: <1418771141-16954-5-git-send-email-robdclark@gmail.com>

On Tue, Dec 16, 2014 at 06:05:32PM -0500, Rob Clark wrote:
> As we add properties for all the standard plane/crtc/connector
> attributes (in preperation for the atomic ioctl), we are going to want
> to handle core state in core (rather than per driver).  Intercepting the
> core properties will be easier if the atomic_set_property vfuncs are not
> called directly, but instead have a mandatory wrapper function (which
> will later serve as the point to intercept core properties).
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Tiny copypasta nit in one comment.

> ---
>  drivers/gpu/drm/drm_atomic.c        | 78 +++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_atomic_helper.c | 12 +++---
>  include/drm/drm_atomic.h            |  9 +++++
>  include/drm/drm_crtc.h              |  3 ++
>  4 files changed, 96 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index ff5f034..1261ade 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -217,6 +217,28 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
>  EXPORT_SYMBOL(drm_atomic_get_crtc_state);
>  
>  /**
> + * drm_atomic_crtc_set_property - set property on connector

s/connector/crtc/

> + * @crtc: the drm CRTC to set a property on
> + * @state: the state object to update with the new property value
> + * @property: the property to set
> + * @val: the new property value
> + *
> + * Use this instead of calling crtc->atomic_set_property directly
> + *
> + * RETURNS:
> + * Zero on success, error code on failure
> + */
> +int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
> +		struct drm_crtc_state *state, struct drm_property *property,
> +		uint64_t val)
> +{
> +	if (crtc->funcs->atomic_set_property)
> +		return crtc->funcs->atomic_set_property(crtc, state, property, val);
> +	return -EINVAL;
> +}
> +EXPORT_SYMBOL(drm_atomic_crtc_set_property);
> +
> +/**
>   * drm_atomic_get_plane_state - get plane state
>   * @state: global atomic state object
>   * @plane: plane to get state object for
> @@ -272,6 +294,28 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
>  EXPORT_SYMBOL(drm_atomic_get_plane_state);
>  
>  /**
> + * drm_atomic_plane_set_property - set property on plane
> + * @plane: the drm plane to set a property on
> + * @state: the state object to update with the new property value
> + * @property: the property to set
> + * @val: the new property value
> + *
> + * Use this instead of calling plane->atomic_set_property directly
> + *
> + * RETURNS:
> + * Zero on success, error code on failure
> + */
> +int drm_atomic_plane_set_property(struct drm_plane *plane,
> +		struct drm_plane_state *state, struct drm_property *property,
> +		uint64_t val)
> +{
> +	if (plane->funcs->atomic_set_property)
> +		return plane->funcs->atomic_set_property(plane, state, property, val);
> +	return -EINVAL;
> +}
> +EXPORT_SYMBOL(drm_atomic_plane_set_property);
> +
> +/**
>   * drm_atomic_get_connector_state - get connector state
>   * @state: global atomic state object
>   * @connector: connector to get state object for
> @@ -343,6 +387,40 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
>  EXPORT_SYMBOL(drm_atomic_get_connector_state);
>  
>  /**
> + * drm_atomic_connector_set_property - set property on connector.
> + * @connector: the drm connector to set a property on
> + * @state: the state object to update with the new property value
> + * @property: the property to set
> + * @val: the new property value
> + *
> + * Use this instead of calling connector->atomic_set_property directly
> + *
> + * RETURNS:
> + * Zero on success, error code on failure
> + */
> +int drm_atomic_connector_set_property(struct drm_connector *connector,
> +		struct drm_connector_state *state, struct drm_property *property,
> +		uint64_t val)
> +{
> +	struct drm_device *dev = connector->dev;
> +	struct drm_mode_config *config = &dev->mode_config;
> +
> +	if (property == config->dpms_property) {
> +		/* setting DPMS property requires special handling, which
> +		 * is done in legacy setprop path for us.  Disallow (for
> +		 * now?) atomic writes to DPMS property:
> +		 */
> +		return -EINVAL;
> +	} else if (connector->funcs->atomic_set_property) {
> +		return connector->funcs->atomic_set_property(connector,
> +				state, property, val);
> +	} else {
> +		return -EINVAL;
> +	}
> +}
> +EXPORT_SYMBOL(drm_atomic_connector_set_property);
> +
> +/**
>   * drm_atomic_set_crtc_for_plane - set crtc for plane
>   * @state: the incoming atomic state
>   * @plane: the plane whose incoming state to update
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 4a78a77..d42fdb1 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1558,8 +1558,8 @@ retry:
>  		goto fail;
>  	}
>  
> -	ret = crtc->funcs->atomic_set_property(crtc, crtc_state,
> -					       property, val);
> +	ret = drm_atomic_crtc_set_property(crtc, crtc_state,
> +			property, val);
>  	if (ret)
>  		goto fail;
>  
> @@ -1617,8 +1617,8 @@ retry:
>  		goto fail;
>  	}
>  
> -	ret = plane->funcs->atomic_set_property(plane, plane_state,
> -					       property, val);
> +	ret = drm_atomic_plane_set_property(plane, plane_state,
> +			property, val);
>  	if (ret)
>  		goto fail;
>  
> @@ -1676,8 +1676,8 @@ retry:
>  		goto fail;
>  	}
>  
> -	ret = connector->funcs->atomic_set_property(connector, connector_state,
> -					       property, val);
> +	ret = drm_atomic_connector_set_property(connector, connector_state,
> +			property, val);
>  	if (ret)
>  		goto fail;
>  
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index ad22295..b0834dc 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -38,12 +38,21 @@ void drm_atomic_state_free(struct drm_atomic_state *state);
>  struct drm_crtc_state * __must_check
>  drm_atomic_get_crtc_state(struct drm_atomic_state *state,
>  			  struct drm_crtc *crtc);
> +int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
> +		struct drm_crtc_state *state, struct drm_property *property,
> +		uint64_t val);
>  struct drm_plane_state * __must_check
>  drm_atomic_get_plane_state(struct drm_atomic_state *state,
>  			   struct drm_plane *plane);
> +int drm_atomic_plane_set_property(struct drm_plane *plane,
> +		struct drm_plane_state *state, struct drm_property *property,
> +		uint64_t val);
>  struct drm_connector_state * __must_check
>  drm_atomic_get_connector_state(struct drm_atomic_state *state,
>  			       struct drm_connector *connector);
> +int drm_atomic_connector_set_property(struct drm_connector *connector,
> +		struct drm_connector_state *state, struct drm_property *property,
> +		uint64_t val);
>  
>  int __must_check
>  drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 61ab3e5..1b71f60 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -300,6 +300,7 @@ struct drm_crtc_state {
>   * @atomic_duplicate_state: duplicate the atomic state for this CRTC
>   * @atomic_destroy_state: destroy an atomic state for this CRTC
>   * @atomic_set_property: set a property on an atomic state for this CRTC
> + *    (do not call directly, use drm_atomic_crtc_set_property())
>   *
>   * The drm_crtc_funcs structure is the central CRTC management structure
>   * in the DRM.  Each CRTC controls one or more connectors (note that the name
> @@ -483,6 +484,7 @@ struct drm_connector_state {
>   * @atomic_duplicate_state: duplicate the atomic state for this connector
>   * @atomic_destroy_state: destroy an atomic state for this connector
>   * @atomic_set_property: set a property on an atomic state for this connector
> + *    (do not call directly, use drm_atomic_connector_set_property())
>   *
>   * Each CRTC may have one or more connectors attached to it.  The functions
>   * below allow the core DRM code to control connectors, enumerate available modes,
> @@ -743,6 +745,7 @@ struct drm_plane_state {
>   * @atomic_duplicate_state: duplicate the atomic state for this plane
>   * @atomic_destroy_state: destroy an atomic state for this plane
>   * @atomic_set_property: set a property on an atomic state for this plane
> + *    (do not call directly, use drm_atomic_plane_set_property())
>   */
>  struct drm_plane_funcs {
>  	int (*update_plane)(struct drm_plane *plane,
> -- 
> 2.1.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2014-12-17 12:50 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 23:05 [PATCH 00/13] Atomic Properties Rob Clark
2014-12-16 23:05 ` [PATCH 01/13] drm: allow property validation for refcnted props Rob Clark
2014-12-17 12:31   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 02/13] drm: store property instead of id in obj attachment Rob Clark
2014-12-17 13:29   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 03/13] drm: get rid of direct property value access Rob Clark
2014-12-17 13:37   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 04/13] drm: add atomic_set_property wrappers Rob Clark
2014-12-17 12:49   ` Sean Paul [this message]
2014-12-17 13:43   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 05/13] drm: add atomic_get_property Rob Clark
2014-12-17 12:52   ` Sean Paul
2014-12-17 13:54   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 06/13] drm: add atomic hook to read property plus helper Rob Clark
2014-12-17 14:02   ` Daniel Vetter
2014-12-17 14:06     ` Daniel Vetter
2014-12-17 14:15       ` Rob Clark
2014-12-17 14:29         ` Daniel Vetter
2014-12-17 14:12     ` Rob Clark
2014-12-17 14:32       ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 07/13] drm: small property creation cleanup Rob Clark
2014-12-17 14:13   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 08/13] drm: tweak getconnector locking Rob Clark
2014-12-17 14:14   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 09/13] drm/atomic: atomic_check functions Rob Clark
2014-12-17 14:25   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 10/13] drm/atomic: atomic plane properties Rob Clark
2014-12-17 14:41   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 11/13] drm/atomic: atomic connector properties Rob Clark
2014-12-17 14:48   ` Daniel Vetter
2014-12-16 23:05 ` [PATCH 12/13] drm/msm: atomic property support Rob Clark
2014-12-16 23:05 ` [PATCH 13/13] RFC: drm: Atomic modeset ioctl Rob Clark
2014-12-17  2:48   ` Michel Dänzer
2014-12-17  7:20     ` Pekka Paalanen
2014-12-17  9:31       ` Michel Dänzer
2014-12-17 11:18         ` Daniel Vetter
2014-12-19  3:29           ` Michel Dänzer
2014-12-19  7:55             ` Daniel Vetter
2014-12-17 14:04         ` Rob Clark
2014-12-17 15:04   ` Daniel Vetter
2014-12-17 13:08 ` [PATCH 00/13] Atomic Properties Sean Paul

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=20141217124953.GA19962@philcollins \
    --to=seanpaul@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robdclark@gmail.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