drm/atomic: add drm_atomic_set_fence_for_plane()
PATCH v2 1/4 drm/atomic: add drm_atomic_set_fence_for_plane()
From: Gustavo Padovan <[email protected]>
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.
--- drivers/gpu/drm/drm_atomic.c | 30 ++++++++++++++++++++++++++++++ include/drm/drm_atomic.h | 2 ++ include/drm/drm_plane.h | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +30 -0
@@ -1147,6 +1147,36 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,EXPORT_SYMBOL (drm_atomic_set_fb_for_plane);/** +* drm_atomic_set_fence_for_plane - set fence for plane +* @plane_state: atomic state object for the plane +* @fence: dma_fence to use for the plane +* +* Helper to setup the plane_state fence in case it is not set yet. +* By using this drivers doesn't need to worry if the user choose +* implicit or explicit fencing. +* +* This function will not set the fence to the state if it was set +* via explicit fencing interfaces on the atomic ioctl. It will +* all drope the reference to the fence as we not storing it +* anywhere. +* +* Otherwise, if plane_state->fence is not set this function we +* just set it with the received implict fence. +*/ +void +drm_atomic_set_fence_for_plane (struct drm_plane_state *plane_state, +struct dma_fence *fence) +{ +if (plane_state->fence) { +dma_fence_put (fence); +return ; + } + + plane_state->fence = fence; +} +EXPORT_SYMBOL (drm_atomic_set_fence_for_plane); + +/** * drm_atomic_set_crtc_for_connector - set crtc for connector * @conn_state: atomic state object for the connector * @crtc: crtc to use for the connector
include/drm/drm_atomic.h +2 -0
@@ -345,6 +345,8 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, struct drm_crtc *crtc);void drm_atomic_set_fb_for_plane (struct drm_plane_state *plane_state,struct drm_framebuffer *fb); +void drm_atomic_set_fence_for_plane (struct drm_plane_state *plane_state, +struct dma_fence *fence);int __must_check drm_atomic_set_crtc_for_connector (struct drm_connector_state *conn_state,struct drm_crtc *crtc);
include/drm/drm_plane.h +1 -1
@@ -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;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/4 drm/imx: use drm_atomic_set_fence_for_plane() to set the fence
From: Gustavo Padovan <[email protected]>
drm_atomic_set_fence_for_plane() is smart and won't overwrite plane_state->fence if the user already set an explicit fence there.
--- drivers/gpu/drm/imx/imx-drm-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/imx-drm-core.c +4 -2
@@ -158,6 +158,7 @@ static int imx_drm_atomic_commit(struct drm_device *dev,struct drm_plane_state *plane_state;struct drm_plane *plane;struct dma_buf *dma_buf; +struct dma_fence *fence;int i;/*
@@ -170,8 +171,9 @@ static int imx_drm_atomic_commit(struct drm_device *dev, 0)->base.dma_buf;if (!dma_buf)continue ; - plane_state->fence = -reservation_object_get_excl_rcu (dma_buf->resv); + fence =reservation_object_get_excl_rcu (dma_buf->resv); + +drm_atomic_set_fence_for_plane (plane_state, fence); } }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/4] drm/imx: use drm_atomic_set_fence_for_plane() to set the fence
Am Montag, den 07.11.2016, 19:03 +0900 schrieb Gustavo Padovan:
Quoted 8 lines
From: Gustavo Padovan <[email protected]>
drm_atomic_set_fence_for_plane()is smart and won't overwriteplane_state->fenceif the user already set an explicit fence there.Cc Philipp Zabel <[email protected]>Signed-off-by Gustavo Padovan <[email protected]>Reviewed-by Daniel Vetter <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/imx/imx-drm-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/imx/imx-drm-core.c +1
-0@@ -158,6 +158,7 @@ static int imx_drm_atomic_commit(struct drm_device *dev,struct drm_plane_state *plane_state;struct drm_plane *plane;struct dma_buf *dma_buf; +struct dma_fence *fence;int i;/*
drivers/gpu/drm/imx/imx-drm-core.c static int imx_drm_atomic_commit(struct drm_device *dev, · line 178
Quoted 10 lines
drivers/gpu/drm/imx/imx-drm-core.c +3
-2@@ -170,8 +171,9 @@ static int imx_drm_atomic_commit(struct drm_device *dev, 0)->base.dma_buf;if (!dma_buf)continue ; - plane_state->fence = -reservation_object_get_excl_rcu (dma_buf->resv); + fence =reservation_object_get_excl_rcu (dma_buf->resv); + +drm_atomic_set_fence_for_plane (plane_state, fence); } }
regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/4 drm/msm: use drm_atomic_set_fence_for_plane() to set the fence
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
drm_atomic_set_fence_for_plane() is smart and won't overwrite plane_state->fence if the user already set an explicit fence there.
--- drivers/gpu/drm/msm/msm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_atomic.c +2 -1
@@ -217,8 +217,9 @@ int msm_atomic_commit(struct drm_device *dev,if ((plane->state->fb != plane_state->fb) && plane_state->fb) {struct drm_gem_object *obj =msm_framebuffer_bo (plane_state->fb,0 );struct msm_gem_object *msm_obj =to_msm_bo (obj); +struct dma_fence *fence =reservation_object_get_excl_rcu (msm_obj->resv); - plane_state->fence =reservation_object_get_excl_rcu (msm_obj->resv); +drm_atomic_set_fence_for_plane (plane_state, fence); } }
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 3/4] drm/msm: use drm_atomic_set_fence_for_plane() to set the fence
Quoted 8 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
drm_atomic_set_fence_for_plane()is smart and won't overwriteplane_state->fenceif the user already set an explicit fence there.Cc Rob Clark <[email protected]>Signed-off-by Gustavo Padovan <[email protected]>Reviewed-by Daniel Vetter <[email protected]>
LGTM
let me know if I should pull this in via msm-next for 4.10.. otherwise taking it via drm-misc is fine by me
BR,
-R
Quoted 20 lines
--- drivers/gpu/drm/msm/msm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/msm/msm_atomic.c +2
-2@@ -217,8 +217,9 @@ int msm_atomic_commit(struct drm_device *dev,if ((plane->state->fb != plane_state->fb) && plane_state->fb) {struct drm_gem_object *obj =msm_framebuffer_bo (plane_state->fb,0 );struct msm_gem_object *msm_obj =to_msm_bo (obj); +struct dma_fence *fence =reservation_object_get_excl_rcu (msm_obj->resv); - plane_state->fence =reservation_object_get_excl_rcu (msm_obj->resv); +drm_atomic_set_fence_for_plane (plane_state, fence); } } --
Quoted 2 lines
2.5.5
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 4/4 drm/plane: add inline doc for struct drm_plane
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
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.
--- include/drm/drm_plane.h | 61 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 12 deletions(-)
include/drm/drm_plane.h +49 -12
@@ -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,56 @@ 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 write directly, use drm_atomic_set_crtc_for_plane() +*/ +struct drm_crtc *crtc; + +/** +* @fb: +* +* currently bound framebuffer +* +* do not write 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 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,7 +112,11 @@ struct drm_plane_state {/* Clipped coordinates */ struct drm_rect src, dst; -/* +/** +* @visible: +* +* visibility of the plane +* * Is the plane actually visible? Can be false even * if fb!=NULL and crtc!=NULL, due to clipping. */
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 4/4] drm/plane: add inline doc for struct drm_plane
Quoted 6 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
Some of the members of struct
drm_planehad extra comments so for these add inline kernel comment to consolidate all documentation in one place.Signed-off-by Gustavo Padovan <[email protected]>
For in-line kerneldoc I think we want real paragraphs with real sentences, just looks better. I bikesheded your patch to suit and applied the entire series to drm-misc.
Thanks, Daniel
Quoted 103 lines
--- include/drm/drm_plane.h | 61 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 12 deletions(-)include/drm/drm_plane.h +49
-12@@ -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,56 @@ 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 write directly, use drm_atomic_set_crtc_for_plane() +*/ +struct drm_crtc *crtc; + +/** +* @fb: +* +* currently bound framebuffer +* +* do not write 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 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,7 +112,11 @@ struct drm_plane_state {/* Clipped coordinates */ struct drm_rect src, dst; -/* +/** +* @visible: +* +* visibility of the plane +* * Is the plane actually visible? Can be false even * if fb!=NULL and crtc!=NULL, due to clipping. */ Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel