aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <rob@ti.com>2012-05-17 04:23:27 -0400
committerDave Airlie <airlied@redhat.com>2012-05-22 05:54:30 -0400
commit4d93914ae3db4a897ead4b1e33eca7cdfff4c6f7 (patch)
tree8e7c7b6ce6012f717e0c32929f5d632c930be745
parent49e2754578b9f99bde18ad318d888a462d271479 (diff)
drm: add plane properties
The omapdrm driver uses this for setting per-overlay rotation. It is likely also useful for setting YUV->RGB colorspace conversion matrix, etc. Signed-off-by: Rob Clark <rob@ti.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c19
-rw-r--r--include/drm/drm_crtc.h7
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e3135c7ee87a..92cea9d77ec9 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -608,6 +608,7 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
608 if (ret) 608 if (ret)
609 goto out; 609 goto out;
610 610
611 plane->base.properties = &plane->properties;
611 plane->dev = dev; 612 plane->dev = dev;
612 plane->funcs = funcs; 613 plane->funcs = funcs;
613 plane->format_types = kmalloc(sizeof(uint32_t) * format_count, 614 plane->format_types = kmalloc(sizeof(uint32_t) * format_count,
@@ -3199,6 +3200,21 @@ static int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
3199 return ret; 3200 return ret;
3200} 3201}
3201 3202
3203static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
3204 struct drm_property *property,
3205 uint64_t value)
3206{
3207 int ret = -EINVAL;
3208 struct drm_plane *plane = obj_to_plane(obj);
3209
3210 if (plane->funcs->set_property)
3211 ret = plane->funcs->set_property(plane, property, value);
3212 if (!ret)
3213 drm_object_property_set_value(obj, property, value);
3214
3215 return ret;
3216}
3217
3202int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, 3218int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
3203 struct drm_file *file_priv) 3219 struct drm_file *file_priv)
3204{ 3220{
@@ -3300,6 +3316,9 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
3300 case DRM_MODE_OBJECT_CRTC: 3316 case DRM_MODE_OBJECT_CRTC:
3301 ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value); 3317 ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value);
3302 break; 3318 break;
3319 case DRM_MODE_OBJECT_PLANE:
3320 ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
3321 break;
3303 } 3322 }
3304 3323
3305out: 3324out:
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 9b33629e654c..73e45600f95d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -601,6 +601,7 @@ struct drm_connector {
601 * @update_plane: update the plane configuration 601 * @update_plane: update the plane configuration
602 * @disable_plane: shut down the plane 602 * @disable_plane: shut down the plane
603 * @destroy: clean up plane resources 603 * @destroy: clean up plane resources
604 * @set_property: called when a property is changed
604 */ 605 */
605struct drm_plane_funcs { 606struct drm_plane_funcs {
606 int (*update_plane)(struct drm_plane *plane, 607 int (*update_plane)(struct drm_plane *plane,
@@ -611,6 +612,9 @@ struct drm_plane_funcs {
611 uint32_t src_w, uint32_t src_h); 612 uint32_t src_w, uint32_t src_h);
612 int (*disable_plane)(struct drm_plane *plane); 613 int (*disable_plane)(struct drm_plane *plane);
613 void (*destroy)(struct drm_plane *plane); 614 void (*destroy)(struct drm_plane *plane);
615
616 int (*set_property)(struct drm_plane *plane,
617 struct drm_property *property, uint64_t val);
614}; 618};
615 619
616/** 620/**
@@ -628,6 +632,7 @@ struct drm_plane_funcs {
628 * @enabled: enabled flag 632 * @enabled: enabled flag
629 * @funcs: helper functions 633 * @funcs: helper functions
630 * @helper_private: storage for drver layer 634 * @helper_private: storage for drver layer
635 * @properties: property tracking for this plane
631 */ 636 */
632struct drm_plane { 637struct drm_plane {
633 struct drm_device *dev; 638 struct drm_device *dev;
@@ -650,6 +655,8 @@ struct drm_plane {
650 655
651 const struct drm_plane_funcs *funcs; 656 const struct drm_plane_funcs *funcs;
652 void *helper_private; 657 void *helper_private;
658
659 struct drm_object_properties properties;
653}; 660};
654 661
655/** 662/**