[PATCH 10/13] drm/atomic: atomic plane properties
On Tue, Dec 16, 2014 at 06:05:38PM -0500, Rob Clark wrote: > Expose the core plane state as properties, so they can be updated via > atomic ioctl. > > Signed-off-by: Rob Clark Just comments about the lack of PROP_ATOMIC and one suggestion for a comment. With that addressed this is Reviewed-by: Daniel Vetter > --- > Documentation/DocBook/drm.tmpl | 74 -- > drivers/gpu/drm/drm_atomic.c | 69 --- > drivers/gpu/drm/drm_crtc.c | 82 > +++--- > include/drm/drm_crtc.h | 10 ++ > 4 files changed, 224 insertions(+), 11 deletions(-) > > diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl > index 4b592ff..282fa6b 100644 > --- a/Documentation/DocBook/drm.tmpl > +++ b/Documentation/DocBook/drm.tmpl > @@ -2564,7 +2564,7 @@ void intel_crt_init(struct drm_device *dev) > Description/Restrictions > > > - DRM > + DRM > Generic > âEDIDâ > BLOB | IMMUTABLE > @@ -2594,7 +2594,7 @@ void intel_crt_init(struct drm_device *dev) > Contains tiling information for a connector. > > > - Plane > + Plane > âtypeâ > ENUM | IMMUTABLE > { "Overlay", "Primary", "Cursor" } > @@ -2602,6 +2602,76 @@ void intel_crt_init(struct drm_device *dev) > Plane type > > > + âSRC_Xâ > + RANGE > + Min=0, Max=UINT_MAX > + Plane > + Scanout source x coordinate in 16.16 fixed point > (atomic) > + > + > + âSRC_Yâ > + RANGE > + Min=0, Max=UINT_MAX > + Plane > + Scanout source y coordinate in 16.16 fixed point > (atomic) > + > + > + âSRC_Wâ > + RANGE > + Min=0, Max=UINT_MAX > + Plane > + Scanout source width in 16.16 fixed point > (atomic) > + > + > + âSRC_Hâ > + RANGE > + Min=0, Max=UINT_MAX > + Plane > + Scanout source height in 16.16 fixed point > (atomic) > + > + > + âCRTC_Xâ > + SIGNED_RANGE > + Min=INT_MIN, Max=INT_MAX > + Plane > + Scanout CRTC (destination) x coordinate (atomic) > + > + > + âCRTC_Yâ > + SIGNED_RANGE > + Min=INT_MIN, Max=INT_MAX > + Plane > + Scanout CRTC (destination) y coordinate (atomic) > + > + > + âCRTC_Wâ > + RANGE > + Min=0, Max=UINT_MAX > + Plane > + Scanout CRTC (destination) width (atomic) > + > + > + âCRTC_Hâ > + RANGE > + Min=0, Max=UINT_MAX > + Plane > + Scanout CRTC (destination) height (atomic) > + > + > + âFB_IDâ > + OBJECT > + DRM_MODE_OBJECT_FB > + Plane > + Scanout framebuffer (atomic) > + > + > + âCRTC_IDâ > + OBJECT > + DRM_MODE_OBJECT_CRTC > + Plane > + CRTC that plane is attached to (atomic) > + > + > DVI-I > âsubconnectorâ > ENUM > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index afb830d..c09a05a 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -352,9 +352,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 = >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->state, plane, 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; We need to check for PROP_ATOMIC somewhere. Well more precisely if ((prop->flags & PROP_ATOMIC) && !file_priv->atomic_kms)
[PATCH 10/13] drm/atomic: atomic plane properties
Expose the core plane state as properties, so they can be updated via atomic ioctl. Signed-off-by: Rob Clark --- Documentation/DocBook/drm.tmpl | 74 -- drivers/gpu/drm/drm_atomic.c | 69 --- drivers/gpu/drm/drm_crtc.c | 82 +++--- include/drm/drm_crtc.h | 10 ++ 4 files changed, 224 insertions(+), 11 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 4b592ff..282fa6b 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2564,7 +2564,7 @@ void intel_crt_init(struct drm_device *dev) Description/Restrictions - DRM + DRM Generic âEDIDâ BLOB | IMMUTABLE @@ -2594,7 +2594,7 @@ void intel_crt_init(struct drm_device *dev) Contains tiling information for a connector. - Plane + Plane âtypeâ ENUM | IMMUTABLE { "Overlay", "Primary", "Cursor" } @@ -2602,6 +2602,76 @@ void intel_crt_init(struct drm_device *dev) Plane type + âSRC_Xâ + RANGE + Min=0, Max=UINT_MAX + Plane + Scanout source x coordinate in 16.16 fixed point (atomic) + + + âSRC_Yâ + RANGE + Min=0, Max=UINT_MAX + Plane + Scanout source y coordinate in 16.16 fixed point (atomic) + + + âSRC_Wâ + RANGE + Min=0, Max=UINT_MAX + Plane + Scanout source width in 16.16 fixed point (atomic) + + + âSRC_Hâ + RANGE + Min=0, Max=UINT_MAX + Plane + Scanout source height in 16.16 fixed point (atomic) + + + âCRTC_Xâ + SIGNED_RANGE + Min=INT_MIN, Max=INT_MAX + Plane + Scanout CRTC (destination) x coordinate (atomic) + + + âCRTC_Yâ + SIGNED_RANGE + Min=INT_MIN, Max=INT_MAX + Plane + Scanout CRTC (destination) y coordinate (atomic) + + + âCRTC_Wâ + RANGE + Min=0, Max=UINT_MAX + Plane + Scanout CRTC (destination) width (atomic) + + + âCRTC_Hâ + RANGE + Min=0, Max=UINT_MAX + Plane + Scanout CRTC (destination) height (atomic) + + + âFB_IDâ + OBJECT + DRM_MODE_OBJECT_FB + Plane + Scanout framebuffer (atomic) + + + âCRTC_IDâ + OBJECT + DRM_MODE_OBJECT_CRTC + Plane + CRTC that plane is attached to (atomic) + + DVI-I âsubconnectorâ ENUM diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index afb830d..c09a05a 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -352,9 +352,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 = >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->state, plane, 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); @@ -374,9 +406,36 @@ int drm_atomic_plane_get_property(struct drm_plane *plane, const