From: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx> The i915 driver needs this for the rotation and overscan compensation properties. Other drivers might need this too. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx> --- drivers/gpu/drm/drm_crtc.c | 20 ++++++++++++++++++++ include/drm/drm_crtc.h | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) Hi As you may have noticed, this is, for now, the last patch of the series (there are no users of the CRTC props). This is because there were some suggestions to the i915 properties I implemented, so while I don't implement them in a way that pleases everybody, I'll just submit the infrastructure work. There are other people interested in having these "object properties", so they can add their own properties on top of this patch series while I still don't have the i915 stuff. Patches 0 to 6 are not completely useless: they change the code that's executed when someone changes the Connector properties, and they allow the implementation of other object properties. This patch (0007) is an example of "how to add properties to other objects". Although I didn't send more patches implementing the CRTC i915 properties, I have these implemented locally and they work, as far as I have tested. I will send these patches to the list as soon as I reimplement them following the suggestions I received. My series of libdrm patches implement a "proptest" program that allows us to read and set object properties, so they are the first thing you should try when testing this patch series. Thank you, Paulo diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 368e3e7..a177d0a 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -384,6 +384,8 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, if (ret) goto out; + crtc->base.properties = &crtc->properties; + list_add_tail(&crtc->head, &dev->mode_config.crtc_list); dev->mode_config.num_crtc++; @@ -3141,6 +3143,21 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj, return ret; } +static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj, + struct drm_property *property, + uint64_t value) +{ + int ret = -EINVAL; + struct drm_crtc *crtc = obj_to_crtc(obj); + + if (crtc->funcs->set_property) + ret = crtc->funcs->set_property(crtc, property, value); + if (!ret) + drm_object_property_set_value(obj, property, value); + + return ret; +} + int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -3239,6 +3256,9 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, ret = drm_mode_connector_set_obj_prop(arg_obj, property, arg->value); break; + case DRM_MODE_OBJECT_CRTC: + ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value); + break; } out: diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 6d36552..d59bb7d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -306,7 +306,8 @@ struct drm_plane; * @mode_fixup: fixup proposed mode * @mode_set: set the desired mode on the CRTC * @gamma_set: specify color ramp for CRTC - * @destroy: deinit and free object. + * @destroy: deinit and free object + * @set_property: called when a property is changed * * 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 @@ -350,6 +351,9 @@ struct drm_crtc_funcs { int (*page_flip)(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event); + + int (*set_property)(struct drm_crtc *crtc, + struct drm_property *property, uint64_t val); }; /** @@ -369,6 +373,7 @@ struct drm_crtc_funcs { * @framedur_ns: precise line timing * @pixeldur_ns: precise pixel timing * @helper_private: mid-layer private data + * @properties: property tracking for this CRTC * * Each CRTC may have one or more connectors associated with it. This structure * allows the CRTC to be controlled. @@ -404,6 +409,8 @@ struct drm_crtc { /* if you are using the helper */ void *helper_private; + + struct drm_object_properties properties; }; -- 1.7.10 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel