[PATCH 06/13] drm: add atomic hook to read property plus helper

Daniel Vetter daniel at ffwll.ch
Wed Dec 17 06:06:08 PST 2014


On Wed, Dec 17, 2014 at 03:02:41PM +0100, Daniel Vetter wrote:
> On Tue, Dec 16, 2014 at 06:05:34PM -0500, Rob Clark wrote:
> > Once a driver is using atomic helpers for modeset, the next step is to
> > switch over to atomic properties.  To do this, plug in the helper
> > function to your modeconfig funcs and be sure to implement the plane/
> > crtc/connector atomic_{get,set}_property vfuncs for any of your mode-
> > objects which have driver custom properties.
> > 
> > Signed-off-by: Rob Clark <robdclark at gmail.com>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 46 +++++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/drm_crtc.c          |  9 ++++++++
> >  include/drm/drm_atomic_helper.h     |  2 ++
> >  include/drm/drm_crtc.h              |  3 +++
> >  4 files changed, 60 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index d42fdb1..1a1ab34 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1703,6 +1703,52 @@ backoff:
> >  EXPORT_SYMBOL(drm_atomic_helper_connector_set_property);
> >  
> >  /**
> > + * drm_atomic_helper_get_property - helper to read atomic property
> > + * @obj: drm mode object whose property to read
> > + * @property: the property to read
> > + * @val: the read value, returned by reference
> > + *
> > + * RETURNS:
> > + * Zero on success, error code on failure
> > + */
> > +int drm_atomic_helper_get_property(struct drm_mode_object *obj,
> > +		struct drm_property *property, uint64_t *val)
> > +{
> > +	struct drm_device *dev = property->dev;
> > +	int ret;
> > +
> > +	switch (obj->type) {
> > +	case DRM_MODE_OBJECT_CONNECTOR: {
> > +		struct drm_connector *connector = obj_to_connector(obj);
> > +		WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
> > +		ret = connector->funcs->atomic_get_property(connector,
> > +				connector->state, property, val);
> 
> Shouldn't we use the get helpers introduced in previous patches here? For
> legacy support we definitely want old core stuff like dpms to keep
> working. Of course that means all the new atomic properties won't get
> magically filtered out. But I think we need to hide them explicitly
> anyway, e.g. with a new DRM_MODE_PROP_ATOMIC and checking for that in
> legacy paths.

Also I'm not sure if there's a benefit to make this a vfunc+helper instead
of just core code called unconditionally. Meaning I can't think of any
case where drivers want to overwrite this, ever. They can do all the fancy
they want for their private properties in the per-object hooks. And for
core/shared stuff we better not allow them to play with fire.

Or do I miss an important case here?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list