From 13b55664eec7b85607c4ab9d26a62b4af413a771 Mon Sep 17 00:00:00 2001 From: Gustavo Padovan Date: Mon, 7 Nov 2016 19:03:30 +0900 Subject: drm/atomic: add drm_atomic_set_fence_for_plane() This new function should be used by drivers when setting a implicit fence for the plane. It abstracts the fact that the user might have chosen explicit fencing instead. Signed-off-by: Gustavo Padovan Reviewed-by: Daniel Vetter Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-1-git-send-email-gustavo@padovan.org --- include/drm/drm_plane.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/drm/drm_plane.h') diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index c5e8a0df1623..68f6d221a3da 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -59,7 +59,7 @@ struct drm_plane_state { struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ - struct dma_fence *fence; + struct dma_fence *fence; /* do not write directly, use drm_atomic_set_fence_for_plane() */ /* Signed dest location allows it to be partially off screen */ int32_t crtc_x, crtc_y; -- cgit v1.2.1 From 3835b46e5535d9ad534776bc93670db097682556 Mon Sep 17 00:00:00 2001 From: Gustavo Padovan Date: Mon, 7 Nov 2016 19:03:33 +0900 Subject: drm/plane: add inline doc for struct drm_plane Some of the members of struct drm_plane had extra comments so for these add inline kernel comment to consolidate all documentation in one place. Signed-off-by: Gustavo Padovan [danvet: Bikeshed a bit more to have real paragraphs with real sentences.] Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-4-git-send-email-gustavo@padovan.org --- include/drm/drm_plane.h | 58 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) (limited to 'include/drm/drm_plane.h') diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 68f6d221a3da..29a175754aee 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -32,11 +32,6 @@ struct drm_crtc; /** * struct drm_plane_state - mutable plane state * @plane: backpointer to the plane - * @crtc: currently bound CRTC, NULL if disabled - * @fb: currently bound framebuffer - * @fence: optional fence to wait for before scanning out @fb - * @crtc_x: left position of visible portion of plane on crtc - * @crtc_y: upper position of visible portion of plane on crtc * @crtc_w: width of visible portion of plane on crtc * @crtc_h: height of visible portion of plane on crtc * @src_x: left position of visible portion of plane within @@ -51,18 +46,51 @@ struct drm_crtc; * where N is the number of active planes for given crtc * @src: clipped source coordinates of the plane (in 16.16) * @dst: clipped destination coordinates of the plane - * @visible: visibility of the plane * @state: backpointer to global drm_atomic_state */ struct drm_plane_state { struct drm_plane *plane; - struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ - struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ - struct dma_fence *fence; /* do not write directly, use drm_atomic_set_fence_for_plane() */ + /** + * @crtc: + * + * Currently bound CRTC, NULL if disabled. Do not this write directly, + * use drm_atomic_set_crtc_for_plane() + */ + struct drm_crtc *crtc; + + /** + * @fb: + * + * Currently bound framebuffer. Do not write this directly, use + * drm_atomic_set_fb_for_plane() + */ + struct drm_framebuffer *fb; + + /** + * @fence: + * + * Optional fence to wait for before scanning out @fb. Do not write this + * directly, use drm_atomic_set_fence_for_plane() + */ + struct dma_fence *fence; + + /** + * @crtc_x: + * + * Left position of visible portion of plane on crtc, signed dest + * location allows it to be partially off screen. + */ + + int32_t crtc_x; + /** + * @crtc_y: + * + * Upper position of visible portion of plane on crtc, signed dest + * location allows it to be partially off screen. + */ + int32_t crtc_y; - /* Signed dest location allows it to be partially off screen */ - int32_t crtc_x, crtc_y; uint32_t crtc_w, crtc_h; /* Source values are 16.16 fixed point */ @@ -79,9 +107,11 @@ struct drm_plane_state { /* Clipped coordinates */ struct drm_rect src, dst; - /* - * Is the plane actually visible? Can be false even - * if fb!=NULL and crtc!=NULL, due to clipping. + /** + * @visible: + * + * Visibility of the plane. This can be false even if fb!=NULL and + * crtc!=NULL, due to clipping. */ bool visible; -- cgit v1.2.1 From 1638d30c1584ff8097776d691f5fa5aafa7aeb8c Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 5 Nov 2016 11:08:08 -0400 Subject: drm: add helpers to go from plane state to drm_rect Signed-off-by: Rob Clark Reviewed-by: Sean Paul [seanpaul resolved conflict in drm_plane.h] Signed-off-by: Sean Paul --- include/drm/drm_plane.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/drm/drm_plane.h') diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 29a175754aee..a421cb553620 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -118,6 +118,30 @@ struct drm_plane_state { struct drm_atomic_state *state; }; +static inline struct drm_rect +drm_plane_state_src(const struct drm_plane_state *state) +{ + struct drm_rect src = { + .x1 = state->src_x, + .y1 = state->src_y, + .x2 = state->src_x + state->src_w, + .y2 = state->src_y + state->src_h, + }; + return src; +} + +static inline struct drm_rect +drm_plane_state_dest(const struct drm_plane_state *state) +{ + struct drm_rect dest = { + .x1 = state->crtc_x, + .y1 = state->crtc_y, + .x2 = state->crtc_x + state->crtc_w, + .y2 = state->crtc_y + state->crtc_h, + }; + return dest; +} + /** * struct drm_plane_funcs - driver plane control functions */ -- cgit v1.2.1 From fceffb325b30f6a9f0bdee22e65d0b8bb35883af Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 5 Nov 2016 11:08:09 -0400 Subject: drm/atomic: add new drm_debug bit to dump atomic state The contents of drm_{plane,crtc,connector}_state is dumped before commit. If a driver extends any of the state structs, it can implement the corresponding funcs->atomic_print_state() to add it's own driver specific state. Signed-off-by: Rob Clark [seanpaul resolved conflict in drm_plane.h] Signed-off-by: Sean Paul --- include/drm/drm_plane.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/drm/drm_plane.h') diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index a421cb553620..63d4e5051936 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -28,6 +28,7 @@ #include struct drm_crtc; +struct drm_printer; /** * struct drm_plane_state - mutable plane state @@ -370,6 +371,18 @@ struct drm_plane_funcs { * before data structures are torndown. */ void (*early_unregister)(struct drm_plane *plane); + + /** + * @atomic_print_state: + * + * If driver subclasses struct &drm_plane_state, it should implement + * this optional hook for printing additional driver specific state. + * + * Do not call this directly, use drm_atomic_plane_print_state() + * instead. + */ + void (*atomic_print_state)(struct drm_printer *p, + const struct drm_plane_state *state); }; /** -- cgit v1.2.1