Commit 28500291 authored by Liu Ying's avatar Liu Ying Committed by Daniel Vetter

drm/atomic-helper: Disable appropriate planes in disable_planes_on_crtc()

Currently, the helper drm_atomic_helper_disable_planes_on_crtc() calls
->atomic_disable for all planes _to be_ enabled on a particular CRTC.
This is obviously wrong for those planes which are not scanning out frames
when the helper is called.  Instead, it's sane to disable active planes
of old_crtc_state in the helper.
Suggested-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarLiu Ying <gnuiyl@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1472196644-30563-3-git-send-email-gnuiyl@gmail.com
parent c9ac8b4c
...@@ -1842,12 +1842,12 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); ...@@ -1842,12 +1842,12 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
/** /**
* drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes * drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes
* @crtc: CRTC * @old_crtc_state: atomic state object with the old CRTC state
* @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks * @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks
* *
* Disables all planes associated with the given CRTC. This can be * Disables all planes associated with the given CRTC. This can be
* used for instance in the CRTC helper disable callback to disable * used for instance in the CRTC helper atomic_disable callback to disable
* all planes before shutting down the display pipeline. * all planes.
* *
* If the atomic-parameter is set the function calls the CRTC's * If the atomic-parameter is set the function calls the CRTC's
* atomic_begin hook before and atomic_flush hook after disabling the * atomic_begin hook before and atomic_flush hook after disabling the
...@@ -1856,9 +1856,11 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc); ...@@ -1856,9 +1856,11 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
* It is a bug to call this function without having implemented the * It is a bug to call this function without having implemented the
* ->atomic_disable() plane hook. * ->atomic_disable() plane hook.
*/ */
void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, void
bool atomic) drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,
bool atomic)
{ {
struct drm_crtc *crtc = old_crtc_state->crtc;
const struct drm_crtc_helper_funcs *crtc_funcs = const struct drm_crtc_helper_funcs *crtc_funcs =
crtc->helper_private; crtc->helper_private;
struct drm_plane *plane; struct drm_plane *plane;
...@@ -1866,11 +1868,11 @@ void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, ...@@ -1866,11 +1868,11 @@ void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc,
if (atomic && crtc_funcs && crtc_funcs->atomic_begin) if (atomic && crtc_funcs && crtc_funcs->atomic_begin)
crtc_funcs->atomic_begin(crtc, NULL); crtc_funcs->atomic_begin(crtc, NULL);
drm_for_each_plane(plane, crtc->dev) { drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) {
const struct drm_plane_helper_funcs *plane_funcs = const struct drm_plane_helper_funcs *plane_funcs =
plane->helper_private; plane->helper_private;
if (plane->state->crtc != crtc || !plane_funcs) if (!plane_funcs)
continue; continue;
WARN_ON(!plane_funcs->atomic_disable); WARN_ON(!plane_funcs->atomic_disable);
......
...@@ -71,8 +71,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, ...@@ -71,8 +71,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
void drm_atomic_helper_cleanup_planes(struct drm_device *dev, void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
struct drm_atomic_state *old_state); struct drm_atomic_state *old_state);
void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state); void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state);
void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, void
bool atomic); drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,
bool atomic);
void drm_atomic_helper_swap_state(struct drm_atomic_state *state, void drm_atomic_helper_swap_state(struct drm_atomic_state *state,
bool stall); bool stall);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment