[PATCH 05/13] drm: add atomic_get_property
On Tue, Dec 16, 2014 at 06:05:33PM -0500, Rob Clark wrote: > Since we won't be using the obj->properties->values[] array to shadow > property values for atomic drivers, we are going to need a vfunc for > getting prop values. Add that along w/ mandatory wrapper fxns. > > Signed-off-by: Rob Clark With Sean's nitpick: Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_atomic.c | 76 > > include/drm/drm_atomic.h | 9 ++ > include/drm/drm_crtc.h | 18 +++ > 3 files changed, 103 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 1261ade..4099b44 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -239,6 +239,28 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, > EXPORT_SYMBOL(drm_atomic_crtc_set_property); > > /** > + * drm_atomic_crtc_get_property - get property on connector > + * @crtc: the drm CRTC to get a property on > + * @state: the state object with the property value to read > + * @property: the property to get > + * @val: the property value (returned by reference) > + * > + * Use this instead of calling crtc->atomic_get_property directly > + * > + * RETURNS: > + * Zero on success, error code on failure > + */ > +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, > + const struct drm_crtc_state *state, > + struct drm_property *property, uint64_t *val) > +{ > + if (crtc->funcs->atomic_get_property) > + return crtc->funcs->atomic_get_property(crtc, state, property, > val); > + return -EINVAL; > +} > +EXPORT_SYMBOL(drm_atomic_crtc_get_property); > + > +/** > * drm_atomic_get_plane_state - get plane state > * @state: global atomic state object > * @plane: plane to get state object for > @@ -316,6 +338,28 @@ int drm_atomic_plane_set_property(struct drm_plane > *plane, > EXPORT_SYMBOL(drm_atomic_plane_set_property); > > /** > + * drm_atomic_plane_get_property - get property on plane > + * @plane: the drm plane to get a property on > + * @state: the state object with the property value to read > + * @property: the property to get > + * @val: the property value (returned by reference) > + * > + * Use this instead of calling plane->atomic_get_property directly > + * > + * RETURNS: > + * Zero on success, error code on failure > + */ > +int drm_atomic_plane_get_property(struct drm_plane *plane, > + const struct drm_plane_state *state, > + struct drm_property *property, uint64_t *val) > +{ > + if (plane->funcs->atomic_get_property) > + return plane->funcs->atomic_get_property(plane, state, > property, val); > + return -EINVAL; > +} > +EXPORT_SYMBOL(drm_atomic_plane_get_property); > + > +/** > * drm_atomic_get_connector_state - get connector state > * @state: global atomic state object > * @connector: connector to get state object for > @@ -421,6 +465,38 @@ int drm_atomic_connector_set_property(struct > drm_connector *connector, > EXPORT_SYMBOL(drm_atomic_connector_set_property); > > /** > + * drm_atomic_connector_get_property - get property on connector > + * @connector: the drm connector to get a property on > + * @state: the state object with the property value to read > + * @property: the property to get > + * @val: the property value (returned by reference) > + * > + * Use this instead of calling connector->atomic_get_property directly > + * > + * RETURNS: > + * Zero on success, error code on failure > + */ > +int drm_atomic_connector_get_property(struct drm_connector *connector, > + const 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) { > + *val = connector->dpms; > + } else if (connector->funcs->atomic_get_property) { > + return connector->funcs->atomic_get_property(connector, > + state, property, val); > + } else { > + return -EINVAL; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_atomic_connector_get_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/include/drm/drm_atomic.h b/include/drm/drm_atomic.h > index b0834dc..b34224a 100644 > --- a/include/drm/drm_atomic.h > +++ b/include/drm/drm_atomic.h > @@ -41,18 +41,27 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, > int drm_atomic_crtc_set_property(struct drm_crtc *crtc, > struct drm_crtc_state *state, struct drm_property *property, > uint64_t val); > +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, > + const struct drm_crtc_state *state, > + struct drm_prope
[PATCH 05/13] drm: add atomic_get_property
On Tue, Dec 16, 2014 at 06:05:33PM -0500, Rob Clark wrote: > Since we won't be using the obj->properties->values[] array to shadow > property values for atomic drivers, we are going to need a vfunc for > getting prop values. Add that along w/ mandatory wrapper fxns. > > Signed-off-by: Rob Clark Same nit here > --- > drivers/gpu/drm/drm_atomic.c | 76 > > include/drm/drm_atomic.h | 9 ++ > include/drm/drm_crtc.h | 18 +++ > 3 files changed, 103 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 1261ade..4099b44 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -239,6 +239,28 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, > EXPORT_SYMBOL(drm_atomic_crtc_set_property); > > /** > + * drm_atomic_crtc_get_property - get property on connector s/connector/crtc/ > + * @crtc: the drm CRTC to get a property on > + * @state: the state object with the property value to read > + * @property: the property to get > + * @val: the property value (returned by reference) > + * > + * Use this instead of calling crtc->atomic_get_property directly > + * > + * RETURNS: > + * Zero on success, error code on failure > + */ > +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, > + const struct drm_crtc_state *state, > + struct drm_property *property, uint64_t *val) > +{ > + if (crtc->funcs->atomic_get_property) > + return crtc->funcs->atomic_get_property(crtc, state, property, > val); > + return -EINVAL; > +} > +EXPORT_SYMBOL(drm_atomic_crtc_get_property); > + > +/** > * drm_atomic_get_plane_state - get plane state > * @state: global atomic state object > * @plane: plane to get state object for > @@ -316,6 +338,28 @@ int drm_atomic_plane_set_property(struct drm_plane > *plane, > EXPORT_SYMBOL(drm_atomic_plane_set_property); > > /** > + * drm_atomic_plane_get_property - get property on plane > + * @plane: the drm plane to get a property on > + * @state: the state object with the property value to read > + * @property: the property to get > + * @val: the property value (returned by reference) > + * > + * Use this instead of calling plane->atomic_get_property directly > + * > + * RETURNS: > + * Zero on success, error code on failure > + */ > +int drm_atomic_plane_get_property(struct drm_plane *plane, > + const struct drm_plane_state *state, > + struct drm_property *property, uint64_t *val) > +{ > + if (plane->funcs->atomic_get_property) > + return plane->funcs->atomic_get_property(plane, state, > property, val); > + return -EINVAL; > +} > +EXPORT_SYMBOL(drm_atomic_plane_get_property); > + > +/** > * drm_atomic_get_connector_state - get connector state > * @state: global atomic state object > * @connector: connector to get state object for > @@ -421,6 +465,38 @@ int drm_atomic_connector_set_property(struct > drm_connector *connector, > EXPORT_SYMBOL(drm_atomic_connector_set_property); > > /** > + * drm_atomic_connector_get_property - get property on connector > + * @connector: the drm connector to get a property on > + * @state: the state object with the property value to read > + * @property: the property to get > + * @val: the property value (returned by reference) > + * > + * Use this instead of calling connector->atomic_get_property directly > + * > + * RETURNS: > + * Zero on success, error code on failure > + */ > +int drm_atomic_connector_get_property(struct drm_connector *connector, > + const 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) { > + *val = connector->dpms; > + } else if (connector->funcs->atomic_get_property) { > + return connector->funcs->atomic_get_property(connector, > + state, property, val); > + } else { > + return -EINVAL; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_atomic_connector_get_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/include/drm/drm_atomic.h b/include/drm/drm_atomic.h > index b0834dc..b34224a 100644 > --- a/include/drm/drm_atomic.h > +++ b/include/drm/drm_atomic.h > @@ -41,18 +41,27 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, > int drm_atomic_crtc_set_property(struct drm_crtc *crtc, > struct drm_crtc_state *state, struct drm_property *property, > uint64_t val); > +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, > + const struct drm_crtc_state *state, > + struct drm_property *property,
[PATCH 05/13] drm: add atomic_get_property
Since we won't be using the obj->properties->values[] array to shadow property values for atomic drivers, we are going to need a vfunc for getting prop values. Add that along w/ mandatory wrapper fxns. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_atomic.c | 76 include/drm/drm_atomic.h | 9 ++ include/drm/drm_crtc.h | 18 +++ 3 files changed, 103 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 1261ade..4099b44 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -239,6 +239,28 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, EXPORT_SYMBOL(drm_atomic_crtc_set_property); /** + * drm_atomic_crtc_get_property - get property on connector + * @crtc: the drm CRTC to get a property on + * @state: the state object with the property value to read + * @property: the property to get + * @val: the property value (returned by reference) + * + * Use this instead of calling crtc->atomic_get_property directly + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, + const struct drm_crtc_state *state, + struct drm_property *property, uint64_t *val) +{ + if (crtc->funcs->atomic_get_property) + return crtc->funcs->atomic_get_property(crtc, state, property, val); + return -EINVAL; +} +EXPORT_SYMBOL(drm_atomic_crtc_get_property); + +/** * drm_atomic_get_plane_state - get plane state * @state: global atomic state object * @plane: plane to get state object for @@ -316,6 +338,28 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, EXPORT_SYMBOL(drm_atomic_plane_set_property); /** + * drm_atomic_plane_get_property - get property on plane + * @plane: the drm plane to get a property on + * @state: the state object with the property value to read + * @property: the property to get + * @val: the property value (returned by reference) + * + * Use this instead of calling plane->atomic_get_property directly + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_plane_get_property(struct drm_plane *plane, + const struct drm_plane_state *state, + struct drm_property *property, uint64_t *val) +{ + if (plane->funcs->atomic_get_property) + return plane->funcs->atomic_get_property(plane, state, property, val); + return -EINVAL; +} +EXPORT_SYMBOL(drm_atomic_plane_get_property); + +/** * drm_atomic_get_connector_state - get connector state * @state: global atomic state object * @connector: connector to get state object for @@ -421,6 +465,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, EXPORT_SYMBOL(drm_atomic_connector_set_property); /** + * drm_atomic_connector_get_property - get property on connector + * @connector: the drm connector to get a property on + * @state: the state object with the property value to read + * @property: the property to get + * @val: the property value (returned by reference) + * + * Use this instead of calling connector->atomic_get_property directly + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_connector_get_property(struct drm_connector *connector, + const 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) { + *val = connector->dpms; + } else if (connector->funcs->atomic_get_property) { + return connector->funcs->atomic_get_property(connector, + state, property, val); + } else { + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL(drm_atomic_connector_get_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/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index b0834dc..b34224a 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -41,18 +41,27 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, int drm_atomic_crtc_set_property(struct drm_crtc *crtc, struct drm_crtc_state *state, struct drm_property *property, uint64_t val); +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, + const 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 *proper