UPSTREAM: drm: add plane properties
authorRob Clark <rob@ti.com>
Thu, 17 May 2012 08:23:27 +0000 (02:23 -0600)
committerChromeBot <chrome-bot@google.com>
Wed, 27 Mar 2013 22:49:27 +0000 (15:49 -0700)
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>
(cherry picked from commit 4d93914ae3db4a897ead4b1e33eca7cdfff4c6f7)

BUG=chrome-os-partner:17074
TEST=Use hardware cursor with kernel v3.8 and v3.4 and no flicker on screen.

Change-Id: I8f50d93443cc6c51f06d553cd0286fff11de3269
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/40516
Tested-by: Prathyush Kalashwaram <prathyush@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>

drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index 0f87797..d063e3d 100644 (file)
@@ -639,6 +639,7 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
        if (ret)
                goto out;
 
+       plane->base.properties = &plane->properties;
        plane->dev = dev;
        plane->funcs = funcs;
        plane->format_types = kmalloc(sizeof(uint32_t) * format_count,
@@ -3152,6 +3153,21 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
        return ret;
 }
 
+static int drm_mode_plane_set_obj_prop(struct drm_mode_object *obj,
+                                     struct drm_property *property,
+                                     uint64_t value)
+{
+       int ret = -EINVAL;
+       struct drm_plane *plane = obj_to_plane(obj);
+
+       if (plane->funcs->set_property)
+               ret = plane->funcs->set_property(plane, 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)
 {
@@ -3250,6 +3266,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_PLANE:
+               ret = drm_mode_plane_set_obj_prop(arg_obj, property, arg->value);
+               break;
        }
 
 out:
index e3e2ec7..9ce8e10 100644 (file)
@@ -605,6 +605,7 @@ struct drm_connector {
  * @update_plane: update the plane configuration
  * @disable_plane: shut down the plane
  * @destroy: clean up plane resources
+ * @set_property: called when a property is changed
  */
 struct drm_plane_funcs {
        int (*update_plane)(struct drm_plane *plane,
@@ -615,6 +616,9 @@ struct drm_plane_funcs {
                            uint32_t src_w, uint32_t src_h);
        int (*disable_plane)(struct drm_plane *plane);
        void (*destroy)(struct drm_plane *plane);
+
+       int (*set_property)(struct drm_plane *plane,
+                           struct drm_property *property, uint64_t val);
 };
 
 /**
@@ -632,6 +636,7 @@ struct drm_plane_funcs {
  * @enabled: enabled flag
  * @funcs: helper functions
  * @helper_private: storage for drver layer
+ * @properties: property tracking for this plane
  */
 struct drm_plane {
        struct drm_device *dev;
@@ -654,6 +659,8 @@ struct drm_plane {
 
        const struct drm_plane_funcs *funcs;
        void *helper_private;
+
+       struct drm_object_properties properties;
 };
 
 /**