drm/atomic-helper: Add option to update planes only on active crtc
Subsystems (10)
PATCH 1/3 drm/atomic-helper: Add option to update planes only on active crtc
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the commit_planes helper to support this case.
Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL state->crtc before chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.
v3: Since commit_planes(active_only = true) is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drm_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +18 -2
@@ -1029,7 +1029,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);
@@ -1144,10 +1144,16 @@ fail: }EXPORT_SYMBOL (drm_atomic_helper_prepare_planes); +bool plane_crtc_active (struct drm_plane_state *state) +{ +return state->crtc && state->crtc->state->active; +} +/** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures +* @active_only: Only commit on active CRTC if set * * This function commits the new plane state using the plane and atomic helper * functions for planes and crtcs. It assumes that the atomic state has already
@@ -1162,7 +1168,8 @@ EXPORT_SYMBOL(drm_atomic_helper_prepare_planes);* drm_atomic_helper_commit_planes_on_crtc() instead. */ void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *old_state, +bool active_only) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;
@@ -1178,6 +1185,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_begin)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_begin (crtc, old_crtc_state); }
@@ -1189,6 +1199,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs)continue ; +if (active_only && !plane_crtc_active (plane->state)) +continue ; +/* * Special-case disabling the plane if drivers support it. */
@@ -1208,6 +1221,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_flush)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_flush (crtc, old_crtc_state); } }
drivers/gpu/drm/exynos/exynos_drm_fb.c +1 -1
@@ -293,7 +293,7 @@ static int exynos_atomic_commit(struct drm_device *dev,* have the relevant clocks enabled to perform the update. */ -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_cleanup_planes (dev, state);
drivers/gpu/drm/msm/msm_atomic.c +1 -1
@@ -125,7 +125,7 @@ static void complete_commit(struct msm_commit *c)drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -96,7 +96,7 @@ static void omap_atomic_complete(struct omap_atomic_state_commit *commit)dispc_runtime_get ();drm_atomic_helper_commit_modeset_disables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_commit_modeset_enables (dev, old_state);omap_atomic_wait_for_completion (dev, old_state);
drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 -1
@@ -456,7 +456,7 @@ static void rcar_du_atomic_complete(struct rcar_du_commit *commit)/* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables (dev, old_state);drm_atomic_helper_commit_modeset_enables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_wait_for_vblanks (dev, old_state);
drivers/gpu/drm/sti/sti_drm_drv.c +1 -1
@@ -59,7 +59,7 @@ static void sti_drm_atomic_complete(struct sti_drm_private *private,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);
drivers/gpu/drm/tegra/drm.c +1 -1
@@ -56,7 +56,7 @@ static void tegra_atomic_complete(struct tegra_drm *tegra,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);
include/drm/drm_atomic_helper.h +2 -1
@@ -55,7 +55,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,int drm_atomic_helper_prepare_planes (struct drm_device *dev,struct drm_atomic_state *state);void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *state); +struct drm_atomic_state *state, +bool active_only);void drm_atomic_helper_cleanup_planes (struct drm_device *dev,struct drm_atomic_state *old_state);void drm_atomic_helper_commit_planes_on_crtc (struct drm_crtc_state *old_crtc_state);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/rcar: Only update planes on active crtc
R-car does runtime pm (that's why it's committing plane state only at the end). Therefore better to only update planes on active crtc. Note that since the helpers always add all enabled planes when doing a modeset change on a crtc we are guaranteed to update plane hw state to the latest requested state each time the crtc is enabled.
--- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 -1
@@ -456,7 +456,7 @@ static void rcar_du_atomic_complete(struct rcar_du_commit *commit)/* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables (dev, old_state);drm_atomic_helper_commit_modeset_enables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state, false); +drm_atomic_helper_commit_planes (dev, old_state, true);drm_atomic_helper_wait_for_vblanks (dev, old_state);
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/atomic: refuse changing CRTC for planes while active
In reply to Daniel VetterVery strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
The exception is when both CRTC do a full modeset, then it should be no problem at all to move the planes around (presuming a correct implementation) so allow that case.
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
--- drivers/gpu/drm/drm_atomic.c | 38 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 1 + 2 files changed, 39 insertions(+)
drivers/gpu/drm/drm_atomic.c +38 -0
@@ -663,6 +663,38 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +/* checks whether a plane has its CRTC switched while being in active use. */ +static bool +active_plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + + curr_crtc_state = plane->state->crtc->state; +if (!curr_crtc_state->active) +return false; + + crtc_state =drm_atomic_get_existing_crtc_state (state, + plane_state->crtc); +if (!crtc_state->active) +return false; + +/* plane switching CRTC and both CRTC are active. This is only ok if +* both CRTC do a full modeset. */ +if (drm_atomic_crtc_needs_modeset (curr_crtc_state) && +drm_atomic_crtc_needs_modeset (crtc_state)) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check
@@ -734,6 +766,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (active_plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching active CRTC without modeset\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }
drivers/gpu/drm/drm_atomic_helper.c +1 -0
@@ -497,6 +497,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev, plane->base.id);return ret; } + }for_each_crtc_in_state (state, crtc, crtc_state, i) {
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/atomic: refuse changing CRTC for planes while active
Task id: 6889 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK 297/297 297/297 SNB 315/315 315/315 IVB 342/342 342/342 BYT 282/282 282/282 HSW 378/378 378/378
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/atomic: refuse changing CRTC for planes directly
In reply to Daniel VetterVery strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/drm_atomic.c +22 -0
@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check
@@ -734,6 +750,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 27 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +0
-0
drivers/gpu/drm/drm_atomic.c drm_atomic_plane_get_property(struct drm_plane *plane, · line 669
Quoted 7 lines
drivers/gpu/drm/drm_atomic.c +4
-0@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state)
plane_switching_crtc()?
Quoted 35 lines
drivers/gpu/drm/drm_atomic.c +18
-0+{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +750,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Stone
Acked-byRe: [Intel-gfx] [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 38 lines · Ville Syrjälä
Quoted 37 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC
just won't work so well and is probably not tested at all. Just forbid
it.I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it
would be easy to move this check into helpers.v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we
don't have any hw that could do it anyway and current atomic userspace
(weston) works like this already anyway.Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +0
-0@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(structdrm_plane *plane, return 0; }
Quoted 6 lines
drivers/gpu/drm/drm_atomic.c drm_atomic_plane_get_property(struct drm_plane *plane, · line 669
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +4
-0+static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state)
plane_switching_crtc()?
With Ville's shed colour:
As this won't work in the general case, I'd prefer to see a hint to userspace that two CRTCs are genlocked before we enable it and people start to rely on it.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
In reply to Daniel VetterQuoted 4 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
So, I expect msm should actually be able to do this w/ dual-dsi (where we are using two CRTC's, w/ synchronized flushes)..
Probably someone who has a dual-dsi panel should actually test that to confirm. But it seems like it should work. Maybe we need something in 'struct drm_crtc' so core can realize that two CRTC's are locked together..
BR,
-R
Quoted 60 lines
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +22
-1@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +750,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; } --2.5.0
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 6 lines · Rob Clark
Quoted 4 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
Quoted 7 lines
So, I expect msm should actually be able to do this w/ dual-dsi (where we are using two CRTC's, w/ synchronized flushes)..
Probably someone who has a dual-dsi panel should actually test that to confirm. But it seems like it should work. Maybe we need something in 'struct
drm_crtc' so core can realize that two CRTC's are locked together..
oh, and for most drivers, switching plane between CRTCs without an off-cycle would probably also work for DSI cmd mode..
BR,
-R
Quoted 58 lines
Quoted 58 lines
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +22
-0@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +750,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }
Quoted 7 lines
Quoted 7 lines
--
2.5.0_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 10 lines · Rob Clark
Quoted 9 lines · Rob Clark
Quoted 4 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
So, I expect msm should actually be able to do this w/ dual-dsi (where we are using two CRTC's, w/ synchronized flushes)..
Quoted 7 lines
Quoted 4 lines
Probably someone who has a dual-dsi panel should actually test that to confirm. But it seems like it should work. Maybe we need something in 'struct
drm_crtc' so core can realize that two CRTC's are locked together..oh, and for most drivers, switching plane between CRTCs without an off-cycle would probably also work for DSI cmd mode..
You'd need to wait for any ongoing transfer on the old crtc to finish before moving the plane. So that's not really any different than the driver doing the dance with a vblank wait on a video mode display.
Quoted 73 lines
BR,
-RQuoted 58 lines
Quoted 58 lines
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +22
-0@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +750,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }Quoted 7 lines
Quoted 7 lines
--
2.5.0_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 16 lines · Ville Syrjälä
Quoted 15 lines · Rob Clark
Quoted 13 lines · Rob Clark
Quoted 4 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
So, I expect msm should actually be able to do this w/ dual-dsi (where we are using two CRTC's, w/ synchronized flushes)..
Probably someone who has a dual-dsi panel should actually test that to confirm. But it seems like it should work. Maybe we need something in 'struct
drm_crtc' so core can realize that two CRTC's are locked together..
Quoted 6 lines
Quoted 2 lines
oh, and for most drivers, switching plane between CRTCs without an off-cycle would probably also work for DSI cmd mode..
You'd need to wait for any ongoing transfer on the old crtc to finish before moving the plane. So that's not really any different than the driver doing the dance with a vblank wait on a video mode display.
except that update would need to block from previous xfer anyways, so there isn't really a race w/ frame n+1 like there would be with video mode..
I do think that *somehow* we need to expose whether or not the display is cmd-mode to userspace, since that factors into decisions about whether it can immediately re-use a plane on another CRTC, and I think it factors into discussion about some differences between ADF fencing and upstream fencing as we add explicit fencing support to atomic.. but that is probably a different topic..
BR,
-R
Quoted 74 lines
Quoted 65 lines
BR,
-RQuoted 61 lines
Quoted 61 lines
I've put this into the core since I really couldn't come up with a case where we don't want to enforce that. But if that ever happens it would be easy to move this check into helpers.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +22
-1@@ -663,6 +663,22 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +750,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; } --2.5.0
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 21 lines · Rob Clark
Quoted 19 lines · Ville Syrjälä
Quoted 17 lines · Rob Clark
Quoted 6 lines · Rob Clark
Quoted 4 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
Quoted 7 lines
So, I expect msm should actually be able to do this w/ dual-dsi (where we are using two CRTC's, w/ synchronized flushes)..
Probably someone who has a dual-dsi panel should actually test that to confirm. But it seems like it should work. Maybe we need something in 'struct
drm_crtc' so core can realize that two CRTC's are locked together..oh, and for most drivers, switching plane between CRTCs without an off-cycle would probably also work for DSI cmd mode..
Quoted 7 lines
Quoted 3 lines
You'd need to wait for any ongoing transfer on the old crtc to finish before moving the plane. So that's not really any different than the driver doing the dance with a vblank wait on a video mode display.
except that update would need to block from previous xfer anyways, so there isn't really a race w/ frame n+1 like there would be with video mode..
Why would it block if it's on a separate crtc?
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 26 lines · Ville Syrjälä
Quoted 25 lines · Rob Clark
Quoted 22 lines · Ville Syrjälä
Quoted 10 lines · Rob Clark
Quoted 9 lines · Rob Clark
Quoted 4 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
So, I expect msm should actually be able to do this w/ dual-dsi (where we are using two CRTC's, w/ synchronized flushes)..
Quoted 7 lines
Quoted 4 lines
Probably someone who has a dual-dsi panel should actually test that to confirm. But it seems like it should work. Maybe we need something in 'struct
drm_crtc' so core can realize that two CRTC's are locked together..oh, and for most drivers, switching plane between CRTCs without an off-cycle would probably also work for DSI cmd mode..
You'd need to wait for any ongoing transfer on the old crtc to finish before moving the plane. So that's not really any different than the driver doing the dance with a vblank wait on a video mode display.
Quoted 5 lines
Quoted 3 lines
except that update would need to block from previous xfer anyways, so there isn't really a race w/ frame n+1 like there would be with video mode..
Why would it block if it's on a separate crtc?
or, well, could block.. but anyways, the more realistic scenario for 2x dsi is dual-dsi to single panel w/ the two CRTC's locked in sync..
BR,
-R
Quoted 3 lines
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/atomic: refuse changing CRTC for planes directly
In reply to Daniel VetterVery strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
I've put this into the core since right now no helper or driver copes with it, no userspace has code for it and no one asks for it. Yes there's piles of corner-cases where this would be possible to do this like:
- switch from inactive crtc to active crtc
- swithc from active crtc to inactive crtc
- genlocked display
- invisible plane (to do whatever)
- idle plane hw due to dsi cmd mode/psr
- whatever
but looking at details it's not that easy to implement this correctly. Hence just put it into the core and add a comment, since the only userspace we have right now for atomic (weston) doesn't want to use direct plane switching either.
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
v3: Bikeshed function name (Ville) and add comment (Rob).
v4: Also bikeshed commit message (Rob).
---
Imo this is bikeshedded enough, so either someone takes this or someone else can mangle this patch more.
-Daniel
--- drivers/gpu/drm/drm_atomic.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/drm_atomic.c +27 -0
@@ -663,6 +663,27 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching_crtc (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +/* This could be refined, but currently there's no helper or driver code +* to implement direct switching of active planes nor userspace to take +* advantage of more direct plane switching without the intermediate +* full OFF state. +*/ +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check
@@ -734,6 +755,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching_crtc (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 5 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
Quoted 14 lines
I've put this into the core since right now no helper or driver copes with it, no userspace has code for it and no one asks for it. Yes there's piles of corner-cases where this would be possible to do this like:
- switch from inactive crtc to active crtc
- swithc from active crtc to inactive crtc
- genlocked display
- invisible plane (to do whatever)
- idle plane hw due to dsi cmd mode/psr
- whatever
but looking at details it's not that easy to implement this correctly. Hence just put it into the core and add a comment, since the only userspace we have right now for atomic (weston) doesn't want to use direct plane switching either.
I suspect that eventually we'll want to make this a helper exposed to drivers and push this check down into the drivers.. perhaps that is not until weston (and/or atomic based hwc) grows driver specific userspace plugin type API to make smarter hw specific decisions.. until then, this is probably the most reasonable thing to do.. so
(w/ s/swihc/switch/ fix smashed in above)
Quoted 72 lines
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
v3: Bikeshed function name (Ville) and add comment (Rob).
v4: Also bikeshed commit message (Rob).
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Acked-by Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>---
Imo this is bikeshedded enough, so either someone takes this or someone else can mangle this patch more.
(quoted diff) +0
-2-Daniel --- drivers/gpu/drm/drm_atomic.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/gpu/drm/drm_atomic.c +27
-1@@ -663,6 +663,27 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching_crtc (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +/* This could be refined, but currently there's no helper or driver code +* to implement direct switching of active planes nor userspace to take +* advantage of more direct plane switching without the intermediate +* full OFF state. +*/ +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +755,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching_crtc (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; } --2.5.0
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
Quoted 21 lines · Rob Clark
Quoted 5 lines · Daniel Vetter
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
Quoted 14 lines
I've put this into the core since right now no helper or driver copes with it, no userspace has code for it and no one asks for it. Yes there's piles of corner-cases where this would be possible to do this like:
- switch from inactive crtc to active crtc
- swithc from active crtc to inactive crtc
- genlocked display
- invisible plane (to do whatever)
- idle plane hw due to dsi cmd mode/psr
- whatever
but looking at details it's not that easy to implement this correctly. Hence just put it into the core and add a comment, since the only userspace we have right now for atomic (weston) doesn't want to use direct plane switching either.
Quoted 5 lines
I suspect that eventually we'll want to make this a helper exposed to drivers and push this check down into the drivers.. perhaps that is not until weston (and/or atomic based hwc) grows driver specific userspace plugin type API to make smarter hw specific decisions.. until then, this is probably the most reasonable thing to do.. so
Yeah this really is just to plug a "undefined behaviour" gap in the abi until we know what exactly we want and have some userspace needing this.
Quoted 3 lines
(w/ s/swihc/switch/ fix smashed in above)
Reviewed-by Rob Clark <[email protected]>
Fixed&merged to drm-misc, thanks for the review.
-Daniel
Quoted 78 lines
Quoted 78 lines
v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
v3: Bikeshed function name (Ville) and add comment (Rob).
v4: Also bikeshed commit message (Rob).
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Daniel Stone <[email protected]>Acked-by Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>---
Imo this is bikeshedded enough, so either someone takes this or someone else can mangle this patch more.
(quoted diff) +0
-2-Daniel --- drivers/gpu/drm/drm_atomic.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/gpu/drm/drm_atomic.c +27
-1@@ -663,6 +663,27 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching_crtc (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +/* This could be refined, but currently there's no helper or driver code +* to implement direct switching of active planes nor userspace to take +* advantage of more direct plane switching without the intermediate +* full OFF state. +*/ +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +755,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; } +if (plane_switching_crtc (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; } --2.5.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
In reply to Daniel VetterOp 26-08-15 om 21:49 schreef Daniel Vetter:
Quoted 25 lines
Very strictly speaking this is possible if you have special hw and genlocked CRTCs. In general switching a plane between two active CRTC just won't work so well and is probably not tested at all. Just forbid it.
I've put this into the core since right now no helper or driver copes with it, no userspace has code for it and no one asks for it. Yes there's piles of corner-cases where this would be possible to do this like:
- switch from inactive crtc to active crtc
- swithc from active crtc to inactive crtc
- genlocked display
- invisible plane (to do whatever)
- idle plane hw due to dsi cmd mode/psr
- whatever
but looking at details it's not that easy to implement this correctly. Hence just put it into the core and add a comment, since the only userspace we have right now for atomic (weston) doesn't want to use direct plane switching either.v2: don't bother with complexity and just outright disallow plane switching without the intermediate OFF state. Simplifies drivers, we don't have any hw that could do it anyway and current atomic userspace (weston) works like this already anyway.
Quoted 6 lines
v3: Bikeshed function name (Ville) and add comment (Rob).
v4: Also bikeshed commit message (Rob).
Cc Thierry Reding <[email protected]>Cc Maarten Lankhorst <[email protected]>
Quoted 48 lines
Cc Daniel Stone <[email protected]>Acked-by Daniel Stone <[email protected]>Signed-off-by Daniel Vetter <[email protected]>---
Imo this is bikeshedded enough, so either someone takes this or someone else can mangle this patch more.
(quoted diff) +0
-2-Daniel --- drivers/gpu/drm/drm_atomic.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/gpu/drm/drm_atomic.c +21
-0@@ -663,6 +663,27 @@ drm_atomic_plane_get_property(struct drm_plane *plane,return 0 ; } +static bool +plane_switching_crtc (struct drm_atomic_state *state, +struct drm_plane *plane, +struct drm_plane_state *plane_state) +{ +struct drm_crtc_state *crtc_state, *curr_crtc_state; + +if (!plane->state->crtc || !plane_state->crtc) +return false; + +if (plane->state->crtc == plane_state->crtc) +return false; + +/* This could be refined, but currently there's no helper or driver code +* to implement direct switching of active planes nor userspace to take +* advantage of more direct plane switching without the intermediate +* full OFF state. +*/ +return true; +} +/** * drm_atomic_plane_check - check plane state * @plane: plane to check @@ -734,6 +755,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,return -ENOSPC ; }
drivers/gpu/drm/drm_atomic.c static int drm_atomic_plane_check(struct drm_plane *plane, · line 766
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +6
-0+if (plane_switching_crtc (state->state, plane, state)) { +DRM_DEBUG_ATOMIC ("[PLANE:%d] switching CRTC directly\n" , + plane->base.id); +return -EINVAL ; + } +return 0 ; }
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
In reply to Daniel VetterTask id: 7266 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK -1 302/302 301/302
SNB 315/315 315/315 IVB 336/336 336/336
BYT -1 283/283 282/283
HSW 378/378 378/378
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@wf_vblank-vs-modeset-interruptible PASS(1) DMESG_WARN(1)
*BYT igt@gem_persistent_relocs@interruptible PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/atomic: refuse changing CRTC for planes directly
In reply to Daniel VetterTask id: 7264 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK -2 302/302 300/302
SNB 315/315 315/315 IVB 336/336 336/336
BYT -1 283/283 282/283
HSW 378/378 378/378
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@flip-vs-dpms-interruptible PASS(1) DMESG_WARN(1) *ILK igt@kms_flip@wf_vblank-vs-modeset-interruptible PASS(1) DMESG_WARN(1) *BYT igt@gem_tiled_partial_pwrite_pread@reads PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerOp 29-07-15 om 14:01 schreef Daniel Vetter:
Quoted 89 lines
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the
commit_planeshelper to support this case.Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL
state->crtcbefore chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.v3: Since
commit_planes(active_only = true)is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.Cc Maarten Lankhorst <[email protected]>Cc Thierry Reding <[email protected]>Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drm_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +12
-2@@ -1029,7 +1029,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);@@ -1144,10 +1144,16 @@ fail: }EXPORT_SYMBOL (drm_atomic_helper_prepare_planes); +bool plane_crtc_active (struct drm_plane_state *state) +{ +return state->crtc && state->crtc->state->active; +} +/** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures +* @active_only: Only commit on active CRTC if set * * This function commits the new plane state using the plane and atomic helper * functions for planes and crtcs. It assumes that the atomic state has already @@ -1162,7 +1168,8 @@ EXPORT_SYMBOL(drm_atomic_helper_prepare_planes);* drm_atomic_helper_commit_planes_on_crtc() instead. */ void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *old_state, +bool active_only) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;@@ -1178,6 +1185,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_begin)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_begin (crtc, old_crtc_state); }
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_commit_planes(struct drm_device *dev, · line 1207
Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +3
-0@@ -1189,6 +1199,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs)continue ; +if (active_only && !plane_crtc_active (plane->state)) +continue ; +/* * Special-case disabling the plane if drivers support it. */
This would leave a plane active if it was moved from a active crtc to a inactive crtc, you would still need to call the atomic_disable(plane) callback for that one. ;-)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/atomic-helper: Add option to update planes only on active crtc
In reply to Daniel VetterWith drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the commit_planes helper to support this case.
Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL state->crtc before chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.
v3: Since commit_planes(active_only = true) is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +18 -2
@@ -1037,7 +1037,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);
@@ -1152,10 +1152,16 @@ fail: }EXPORT_SYMBOL (drm_atomic_helper_prepare_planes); +bool plane_crtc_active (struct drm_plane_state *state) +{ +return state->crtc && state->crtc->state->active; +} +/** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures +* @active_only: Only commit on active CRTC if set * * This function commits the new plane state using the plane and atomic helper * functions for planes and crtcs. It assumes that the atomic state has already
@@ -1170,7 +1176,8 @@ EXPORT_SYMBOL(drm_atomic_helper_prepare_planes);* drm_atomic_helper_commit_planes_on_crtc() instead. */ void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *old_state, +bool active_only) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;
@@ -1186,6 +1193,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_begin)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_begin (crtc, old_crtc_state); }
@@ -1197,6 +1207,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs)continue ; +if (active_only && !plane_crtc_active (plane->state)) +continue ; +/* * Special-case disabling the plane if drivers support it. */
@@ -1216,6 +1229,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_flush)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_flush (crtc, old_crtc_state); } }
drivers/gpu/drm/exynos/exynos_drm_fb.c +1 -1
@@ -293,7 +293,7 @@ static int exynos_atomic_commit(struct drm_device *dev,* have the relevant clocks enabled to perform the update. */ -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_cleanup_planes (dev, state);
drivers/gpu/drm/msm/msm_atomic.c +1 -1
@@ -125,7 +125,7 @@ static void complete_commit(struct msm_commit *c)drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -96,7 +96,7 @@ static void omap_atomic_complete(struct omap_atomic_state_commit *commit)dispc_runtime_get ();drm_atomic_helper_commit_modeset_disables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_commit_modeset_enables (dev, old_state);omap_atomic_wait_for_completion (dev, old_state);
drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 -1
@@ -456,7 +456,7 @@ static void rcar_du_atomic_complete(struct rcar_du_commit *commit)/* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables (dev, old_state);drm_atomic_helper_commit_modeset_enables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_wait_for_vblanks (dev, old_state);
drivers/gpu/drm/sti/sti_drv.c +1 -1
@@ -59,7 +59,7 @@ static void sti_atomic_complete(struct sti_private *private,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);
drivers/gpu/drm/tegra/drm.c +1 -1
@@ -56,7 +56,7 @@ static void tegra_atomic_complete(struct tegra_drm *tegra,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);
include/drm/drm_atomic_helper.h +2 -1
@@ -55,7 +55,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,int drm_atomic_helper_prepare_planes (struct drm_device *dev,struct drm_atomic_state *state);void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *state); +struct drm_atomic_state *state, +bool active_only);void drm_atomic_helper_cleanup_planes (struct drm_device *dev,struct drm_atomic_state *old_state);void drm_atomic_helper_commit_planes_on_crtc (struct drm_crtc_state *old_crtc_state);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/atomic-helper: Add option to update planes only on active crtc
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the commit_planes helper to support this case.
Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL state->crtc before chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.
v3: Since commit_planes(active_only = true) is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.
v4: Rebase over exynos changes.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +18 -2
@@ -1037,7 +1037,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);
@@ -1146,10 +1146,16 @@ fail: }EXPORT_SYMBOL (drm_atomic_helper_prepare_planes); +bool plane_crtc_active (struct drm_plane_state *state) +{ +return state->crtc && state->crtc->state->active; +} +/** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures +* @active_only: Only commit on active CRTC if set * * This function commits the new plane state using the plane and atomic helper * functions for planes and crtcs. It assumes that the atomic state has already
@@ -1164,7 +1170,8 @@ EXPORT_SYMBOL(drm_atomic_helper_prepare_planes);* drm_atomic_helper_commit_planes_on_crtc() instead. */ void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *old_state, +bool active_only) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;
@@ -1180,6 +1187,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_begin)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_begin (crtc, old_crtc_state); }
@@ -1191,6 +1201,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs)continue ; +if (active_only && !plane_crtc_active (plane->state)) +continue ; +/* * Special-case disabling the plane if drivers support it. */
@@ -1210,6 +1223,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (!funcs || !funcs->atomic_flush)continue ; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_flush (crtc, old_crtc_state); } }
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
@@ -105,7 +105,7 @@ static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit)atomic_inc (&exynos_crtc->pending_update); } -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);exynos_atomic_wait_for_commit (state);
drivers/gpu/drm/msm/msm_atomic.c +1 -1
@@ -125,7 +125,7 @@ static void complete_commit(struct msm_commit *c)drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -96,7 +96,7 @@ static void omap_atomic_complete(struct omap_atomic_state_commit *commit)dispc_runtime_get ();drm_atomic_helper_commit_modeset_disables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_commit_modeset_enables (dev, old_state);omap_atomic_wait_for_completion (dev, old_state);
drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 -1
@@ -456,7 +456,7 @@ static void rcar_du_atomic_complete(struct rcar_du_commit *commit)/* Apply the atomic update. */ drm_atomic_helper_commit_modeset_disables (dev, old_state);drm_atomic_helper_commit_modeset_enables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_wait_for_vblanks (dev, old_state);
drivers/gpu/drm/sti/sti_drv.c +1 -1
@@ -59,7 +59,7 @@ static void sti_atomic_complete(struct sti_private *private,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);
drivers/gpu/drm/tegra/drm.c +1 -1
@@ -56,7 +56,7 @@ static void tegra_atomic_complete(struct tegra_drm *tegra,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);
include/drm/drm_atomic_helper.h +2 -1
@@ -55,7 +55,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,int drm_atomic_helper_prepare_planes (struct drm_device *dev,struct drm_atomic_state *state);void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *state); +struct drm_atomic_state *state, +bool active_only);void drm_atomic_helper_cleanup_planes (struct drm_device *dev,struct drm_atomic_state *old_state);void drm_atomic_helper_commit_planes_on_crtc (struct drm_crtc_state *old_crtc_state);
Signature · 6 lines
2.5.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 28 lines · Daniel Vetter
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the
commit_planeshelper to support this case.Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL
state->crtcbefore chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.v3: Since
commit_planes(active_only = true)is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.v4: Rebase over exynos changes.
Cc Maarten Lankhorst <[email protected]>Cc Thierry Reding <[email protected]>Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 10 lines
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedQuoted 40 lines · Thierry Reding
Quoted 28 lines · Daniel Vetter
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the
commit_planeshelper to support this case.Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL
state->crtcbefore chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.v3: Since
commit_planes(active_only = true)is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.v4: Rebase over exynos changes.
Cc Maarten Lankhorst <[email protected]>Cc Thierry Reding <[email protected]>Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Quoted 10 lines
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)
Quoted 2 lines
Reviewed-by Thierry Reding <[email protected]>Tested-by Thierry Reding <[email protected]>
Applied to drm-misc, thanks for the review.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Daniel,
Thank you for the patch.
Quoted 69 lines · On Tuesday 08 September 2015 12:02:07 Daniel Vetter wrote:
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the
commit_planeshelper to support this case.Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true.
v2: Check for NULL
state->crtcbefore chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense.v3: Since
commit_planes(active_only = true)is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch.v4: Rebase over exynos changes.
Cc Maarten Lankhorst <[email protected]>Cc Thierry Reding <[email protected]>Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_atomic_helper.cindex9b0c47690ae8..12c25c54309f100644drivers/gpu/drm/drm_atomic_helper.c +7
-1@@ -1037,7 +1037,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);@@ -1146,10 +1146,16 @@ fail: }EXPORT_SYMBOL (drm_atomic_helper_prepare_planes); +bool plane_crtc_active (struct drm_plane_state *state) +{ +return state->crtc && state->crtc->state->active; +} +/** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures +* @active_only: Only commit on active CRTC if set * * This function commits the new plane state using the plane and atomic
Quoted 3 lines
helper
* functions for planes and crtcs. It assumes that the atomic state has
already
Following our recent discussion on the subject, I believe some more documentation would be helpful in the form of guidelines for driver developers. Most drivers using the atomic helpers shouldn't need to be notified of plane state update for disabled CRTC, as the DRM core will record the plane state and apply it when the CRTC gets enabled.
Quoted 138 lines
drivers/gpu/drm/drm_atomic_helper.c +0
-0@@ -1164,7 +1170,8 @@
EXPORT_SYMBOL(drm_atomic_helper_prepare_planes); *drm_atomic_helper_commit_planes_on_crtc()instead.
*/
void drm_atomic_helper_commit_planes(structdrm_device*dev,drivers/gpu/drm/drm_atomic_helper.c +11
-1- struct drm_atomic_state *old_state) + struct drm_atomic_state *old_state, + bool active_only) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;@@ -1180,6 +1187,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs || !funcs->atomic_begin) continue; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_begin (crtc, old_crtc_state); }@@ -1191,6 +1201,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs) continue; +if (active_only && !plane_crtc_active (plane->state)) +continue ; +/* * Special-case disabling the plane if drivers support it. */ @@ -1210,6 +1223,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs || !funcs->atomic_flush) continue; +if (active_only && !crtc->state->active) +continue ; + funcs->atomic_flush (crtc, old_crtc_state); } }(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_drv.cindexc1ed308496a2..632e21e0d1be100644drivers/gpu/drm/exynos/exynos_drm_drv.c +1
-1@@ -105,7 +105,7 @@ static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit) atomic_inc(&exynos_crtc->pending_update); } -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);exynos_atomic_wait_for_commit (state);(quoted diff) +0
-0
b/drivers/gpu/drm/msm/msm_atomic.cindex1ceb4f22dd89..7eb253bc24df100644drivers/gpu/drm/msm/msm_atomic.c +1
-1@@ -125,7 +125,7 @@ static void complete_commit(struct msm_commit *c)drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_commit_planes (dev, state, false);drm_atomic_helper_commit_modeset_enables (dev, state);(quoted diff) +0
-0
b/drivers/gpu/drm/omapdrm/omap_drv.cindexe888a831dd3c..0ecce79fc782100644drivers/gpu/drm/omapdrm/omap_drv.c +1
-1@@ -96,7 +96,7 @@ static void omap_atomic_complete(struct omap_atomic_state_commit *commit) dispc_runtime_get();drm_atomic_helper_commit_modeset_disables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_commit_modeset_enables (dev, old_state);omap_atomic_wait_for_completion (dev, old_state);(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_kms.cindex56518eb1269a..ca12e8ca5552100644drivers/gpu/drm/rcar-du/rcar_du_kms.c +0
-0@@ -456,7 +456,7 @@ static void rcar_du_atomic_complete(struct
rcar_du_commit*commit) /* Apply the atomic update. */drivers/gpu/drm/rcar-du/rcar_du_kms.c +1
-1drm_atomic_helper_commit_modeset_disables (dev, old_state);drm_atomic_helper_commit_modeset_enables (dev, old_state); -drm_atomic_helper_commit_planes (dev, old_state); +drm_atomic_helper_commit_planes (dev, old_state, false);drm_atomic_helper_wait_for_vblanks (dev, old_state);drivers/gpu/drm/sti/sti_drv.c +1
-1@@ -59,7 +59,7 @@ static void sti_atomic_complete(struct sti_private*private, */ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);drivers/gpu/drm/tegra/drm.c +1
-1@@ -56,7 +56,7 @@ static void tegra_atomic_complete(struct tegra_drm *tegra,*/ drm_atomic_helper_commit_modeset_disables (drm, state); -drm_atomic_helper_commit_planes (drm, state); +drm_atomic_helper_commit_planes (drm, state, false);drm_atomic_helper_commit_modeset_enables (drm, state);drm_atomic_helper_wait_for_vblanks (drm, state);(quoted diff) +0
-0
b/include/drm/drm_atomic_helper.hindex11266d147a29..4ffe9dca07c4100644include/drm/drm_atomic_helper.h +0
-0@@ -55,7 +55,8 @@ void drm_atomic_helper_commit_modeset_enables(struct
drm_device*dev, int drm_atomic_helper_prepare_planes(structdrm_device*dev,include/drm/drm_atomic_helper.h +2
-1struct drm_atomic_state *state);void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *state); +struct drm_atomic_state *state, +bool active_only);void drm_atomic_helper_cleanup_planes (struct drm_device *dev,struct drm_atomic_state *old_state); void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state
*old_crtc_state);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel