drm/atomic: atomic plane properties
authorRob Clark <robdclark@gmail.com>
Thu, 18 Dec 2014 21:01:53 +0000 (16:01 -0500)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 5 Jan 2015 12:55:28 +0000 (13:55 +0100)
Expose the core plane state as properties, so they can be updated via
atomic ioctl.

v2: atomic property flag

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Documentation/DocBook/drm.tmpl
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index 7fa4f98..8d8dc71 100644 (file)
@@ -2572,7 +2572,7 @@ void intel_crt_init(struct drm_device *dev)
        <td valign="top" >Description/Restrictions</td>
        </tr>
        <tr>
-       <td rowspan="25" valign="top" >DRM</td>
+       <td rowspan="35" valign="top" >DRM</td>
        <td rowspan="4" valign="top" >Generic</td>
        <td valign="top" >“EDID”</td>
        <td valign="top" >BLOB | IMMUTABLE</td>
@@ -2602,7 +2602,7 @@ void intel_crt_init(struct drm_device *dev)
        <td valign="top" >Contains tiling information for a connector.</td>
        </tr>
        <tr>
-       <td rowspan="1" valign="top" >Plane</td>
+       <td rowspan="11" valign="top" >Plane</td>
        <td valign="top" >“type”</td>
        <td valign="top" >ENUM | IMMUTABLE</td>
        <td valign="top" >{ "Overlay", "Primary", "Cursor" }</td>
@@ -2610,6 +2610,76 @@ void intel_crt_init(struct drm_device *dev)
        <td valign="top" >Plane type</td>
        </tr>
        <tr>
+       <td valign="top" >“SRC_X”</td>
+       <td valign="top" >RANGE</td>
+       <td valign="top" >Min=0, Max=UINT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout source x coordinate in 16.16 fixed point (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“SRC_Y”</td>
+       <td valign="top" >RANGE</td>
+       <td valign="top" >Min=0, Max=UINT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout source y coordinate in 16.16 fixed point (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“SRC_W”</td>
+       <td valign="top" >RANGE</td>
+       <td valign="top" >Min=0, Max=UINT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout source width in 16.16 fixed point (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“SRC_H”</td>
+       <td valign="top" >RANGE</td>
+       <td valign="top" >Min=0, Max=UINT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout source height in 16.16 fixed point (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“CRTC_X”</td>
+       <td valign="top" >SIGNED_RANGE</td>
+       <td valign="top" >Min=INT_MIN, Max=INT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout CRTC (destination) x coordinate (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“CRTC_Y”</td>
+       <td valign="top" >SIGNED_RANGE</td>
+       <td valign="top" >Min=INT_MIN, Max=INT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout CRTC (destination) y coordinate (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“CRTC_W”</td>
+       <td valign="top" >RANGE</td>
+       <td valign="top" >Min=0, Max=UINT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout CRTC (destination) width (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“CRTC_H”</td>
+       <td valign="top" >RANGE</td>
+       <td valign="top" >Min=0, Max=UINT_MAX</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout CRTC (destination) height (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“FB_ID”</td>
+       <td valign="top" >OBJECT</td>
+       <td valign="top" >DRM_MODE_OBJECT_FB</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >Scanout framebuffer (atomic)</td>
+       </tr>
+       <tr>
+       <td valign="top" >“CRTC_ID”</td>
+       <td valign="top" >OBJECT</td>
+       <td valign="top" >DRM_MODE_OBJECT_CRTC</td>
+       <td valign="top" >Plane</td>
+       <td valign="top" >CRTC that plane is attached to (atomic)</td>
+       </tr>
+       <tr>
        <td rowspan="2" valign="top" >DVI-I</td>
        <td valign="top" >“subconnector”</td>
        <td valign="top" >ENUM</td>
index 1c472b1..131d47f 100644 (file)
@@ -366,9 +366,41 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
                struct drm_plane_state *state, struct drm_property *property,
                uint64_t val)
 {
-       if (plane->funcs->atomic_set_property)
-               return plane->funcs->atomic_set_property(plane, state, property, val);
-       return -EINVAL;
+       struct drm_device *dev = plane->dev;
+       struct drm_mode_config *config = &dev->mode_config;
+
+       if (property == config->prop_fb_id) {
+               struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, val);
+               drm_atomic_set_fb_for_plane(state, fb);
+               if (fb)
+                       drm_framebuffer_unreference(fb);
+       } else if (property == config->prop_crtc_id) {
+               struct drm_crtc *crtc = drm_crtc_find(dev, val);
+               return drm_atomic_set_crtc_for_plane(state, crtc);
+       } else if (property == config->prop_crtc_x) {
+               state->crtc_x = U642I64(val);
+       } else if (property == config->prop_crtc_y) {
+               state->crtc_y = U642I64(val);
+       } else if (property == config->prop_crtc_w) {
+               state->crtc_w = val;
+       } else if (property == config->prop_crtc_h) {
+               state->crtc_h = val;
+       } else if (property == config->prop_src_x) {
+               state->src_x = val;
+       } else if (property == config->prop_src_y) {
+               state->src_y = val;
+       } else if (property == config->prop_src_w) {
+               state->src_w = val;
+       } else if (property == config->prop_src_h) {
+               state->src_h = val;
+       } else if (plane->funcs->atomic_set_property) {
+               return plane->funcs->atomic_set_property(plane, state,
+                               property, val);
+       } else {
+               return -EINVAL;
+       }
+
+       return 0;
 }
 EXPORT_SYMBOL(drm_atomic_plane_set_property);
 
@@ -392,9 +424,36 @@ int drm_atomic_plane_get_property(struct drm_plane *plane,
                const struct drm_plane_state *state,
                struct drm_property *property, uint64_t *val)
 {
-       if (plane->funcs->atomic_get_property)
+       struct drm_device *dev = plane->dev;
+       struct drm_mode_config *config = &dev->mode_config;
+
+       if (property == config->prop_fb_id) {
+               *val = (state->fb) ? state->fb->base.id : 0;
+       } else if (property == config->prop_crtc_id) {
+               *val = (state->crtc) ? state->crtc->base.id : 0;
+       } else if (property == config->prop_crtc_x) {
+               *val = I642U64(state->crtc_x);
+       } else if (property == config->prop_crtc_y) {
+               *val = I642U64(state->crtc_y);
+       } else if (property == config->prop_crtc_w) {
+               *val = state->crtc_w;
+       } else if (property == config->prop_crtc_h) {
+               *val = state->crtc_h;
+       } else if (property == config->prop_src_x) {
+               *val = state->src_x;
+       } else if (property == config->prop_src_y) {
+               *val = state->src_y;
+       } else if (property == config->prop_src_w) {
+               *val = state->src_w;
+       } else if (property == config->prop_src_h) {
+               *val = state->src_h;
+       } else if (plane->funcs->atomic_get_property) {
                return plane->funcs->atomic_get_property(plane, state, property, val);
-       return -EINVAL;
+       } else {
+               return -EINVAL;
+       }
+
+       return 0;
 }
 EXPORT_SYMBOL(drm_atomic_plane_get_property);
 
Simple merge
Simple merge