aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2012-05-15 17:09:05 -0400
committerDave Airlie <airlied@redhat.com>2012-05-17 06:11:46 -0400
commitbffd9de0297702566e6aec0678c7ebc3806fe3db (patch)
treee94c9388bb9f6c765f8bc47b26f92b7d2ac75ae3
parent7f88a9bedfb814a2d4d537db8295c524298256cb (diff)
drm: add CRTC properties
The i915 driver needs this for the rotation and overscan compensation properties. Other drivers might need this too. Reviewed-by: Rob Clark <rob.clark@linaro.org> Tested-by: Rob Clark <rob.clark@linaro.org> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c20
-rw-r--r--include/drm/drm_crtc.h9
2 files changed, 28 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 368e3e72a452..a177d0abb8bb 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,
384 if (ret) 384 if (ret)
385 goto out; 385 goto out;
386 386
387 crtc->base.properties = &crtc->properties;
388
387 list_add_tail(&crtc->head, &dev->mode_config.crtc_list); 389 list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
388 dev->mode_config.num_crtc++; 390 dev->mode_config.num_crtc++;
389 391
@@ -3141,6 +3143,21 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
3141 return ret; 3143 return ret;
3142} 3144}
3143 3145
3146static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
3147 struct drm_property *property,
3148 uint64_t value)
3149{
3150 int ret = -EINVAL;
3151 struct drm_crtc *crtc = obj_to_crtc(obj);
3152
3153 if (crtc->funcs->set_property)
3154 ret = crtc->funcs->set_property(crtc, property, value);
3155 if (!ret)
3156 drm_object_property_set_value(obj, property, value);
3157
3158 return ret;
3159}
3160
3144int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, 3161int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
3145 struct drm_file *file_priv) 3162 struct drm_file *file_priv)
3146{ 3163{
@@ -3239,6 +3256,9 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
3239 ret = drm_mode_connector_set_obj_prop(arg_obj, property, 3256 ret = drm_mode_connector_set_obj_prop(arg_obj, property,
3240 arg->value); 3257 arg->value);
3241 break; 3258 break;
3259 case DRM_MODE_OBJECT_CRTC:
3260 ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
3261 break;
3242 } 3262 }
3243 3263
3244out: 3264out:
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 6d36552899ae..d59bb7d93657 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -306,7 +306,8 @@ struct drm_plane;
306 * @mode_fixup: fixup proposed mode 306 * @mode_fixup: fixup proposed mode
307 * @mode_set: set the desired mode on the CRTC 307 * @mode_set: set the desired mode on the CRTC
308 * @gamma_set: specify color ramp for CRTC 308 * @gamma_set: specify color ramp for CRTC
309 * @destroy: deinit and free object. 309 * @destroy: deinit and free object
310 * @set_property: called when a property is changed
310 * 311 *
311 * The drm_crtc_funcs structure is the central CRTC management structure 312 * The drm_crtc_funcs structure is the central CRTC management structure
312 * in the DRM. Each CRTC controls one or more connectors (note that the name 313 * in the DRM. Each CRTC controls one or more connectors (note that the name
@@ -350,6 +351,9 @@ struct drm_crtc_funcs {
350 int (*page_flip)(struct drm_crtc *crtc, 351 int (*page_flip)(struct drm_crtc *crtc,
351 struct drm_framebuffer *fb, 352 struct drm_framebuffer *fb,
352 struct drm_pending_vblank_event *event); 353 struct drm_pending_vblank_event *event);
354
355 int (*set_property)(struct drm_crtc *crtc,
356 struct drm_property *property, uint64_t val);
353}; 357};
354 358
355/** 359/**
@@ -369,6 +373,7 @@ struct drm_crtc_funcs {
369 * @framedur_ns: precise line timing 373 * @framedur_ns: precise line timing
370 * @pixeldur_ns: precise pixel timing 374 * @pixeldur_ns: precise pixel timing
371 * @helper_private: mid-layer private data 375 * @helper_private: mid-layer private data
376 * @properties: property tracking for this CRTC
372 * 377 *
373 * Each CRTC may have one or more connectors associated with it. This structure 378 * Each CRTC may have one or more connectors associated with it. This structure
374 * allows the CRTC to be controlled. 379 * allows the CRTC to be controlled.
@@ -404,6 +409,8 @@ struct drm_crtc {
404 409
405 /* if you are using the helper */ 410 /* if you are using the helper */
406 void *helper_private; 411 void *helper_private;
412
413 struct drm_object_properties properties;
407}; 414};
408 415
409 416