aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Ying <gnuiyl@gmail.com>2016-08-26 03:30:39 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-08-29 04:22:05 -0400
commit28500291c29ae2174eb0322e839cc3204d06b963 (patch)
treebb6262366dbbbc571f63c64f952568714427e166
parentc9ac8b4c5caf493fba8c43f1bd02f687ffccb429 (diff)
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: Daniel 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: Liu Ying <gnuiyl@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1472196644-30563-3-git-send-email-gnuiyl@gmail.com
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c16
-rw-r--r--include/drm/drm_atomic_helper.h5
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 4828b9b860de..5f82290f2f0f 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1842,12 +1842,12 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
1842 1842
1843/** 1843/**
1844 * drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes 1844 * drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes
1845 * @crtc: CRTC 1845 * @old_crtc_state: atomic state object with the old CRTC state
1846 * @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks 1846 * @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks
1847 * 1847 *
1848 * Disables all planes associated with the given CRTC. This can be 1848 * Disables all planes associated with the given CRTC. This can be
1849 * used for instance in the CRTC helper disable callback to disable 1849 * used for instance in the CRTC helper atomic_disable callback to disable
1850 * all planes before shutting down the display pipeline. 1850 * all planes.
1851 * 1851 *
1852 * If the atomic-parameter is set the function calls the CRTC's 1852 * If the atomic-parameter is set the function calls the CRTC's
1853 * atomic_begin hook before and atomic_flush hook after disabling the 1853 * 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 * It is a bug to call this function without having implemented the 1856 * It is a bug to call this function without having implemented the
1857 * ->atomic_disable() plane hook. 1857 * ->atomic_disable() plane hook.
1858 */ 1858 */
1859void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, 1859void
1860 bool atomic) 1860drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,
1861 bool atomic)
1861{ 1862{
1863 struct drm_crtc *crtc = old_crtc_state->crtc;
1862 const struct drm_crtc_helper_funcs *crtc_funcs = 1864 const struct drm_crtc_helper_funcs *crtc_funcs =
1863 crtc->helper_private; 1865 crtc->helper_private;
1864 struct drm_plane *plane; 1866 struct drm_plane *plane;
@@ -1866,11 +1868,11 @@ void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc,
1866 if (atomic && crtc_funcs && crtc_funcs->atomic_begin) 1868 if (atomic && crtc_funcs && crtc_funcs->atomic_begin)
1867 crtc_funcs->atomic_begin(crtc, NULL); 1869 crtc_funcs->atomic_begin(crtc, NULL);
1868 1870
1869 drm_for_each_plane(plane, crtc->dev) { 1871 drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) {
1870 const struct drm_plane_helper_funcs *plane_funcs = 1872 const struct drm_plane_helper_funcs *plane_funcs =
1871 plane->helper_private; 1873 plane->helper_private;
1872 1874
1873 if (plane->state->crtc != crtc || !plane_funcs) 1875 if (!plane_funcs)
1874 continue; 1876 continue;
1875 1877
1876 WARN_ON(!plane_funcs->atomic_disable); 1878 WARN_ON(!plane_funcs->atomic_disable);
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 5a02e499f32b..1abf2c0227a6 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -71,8 +71,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
71void drm_atomic_helper_cleanup_planes(struct drm_device *dev, 71void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
72 struct drm_atomic_state *old_state); 72 struct drm_atomic_state *old_state);
73void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state); 73void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state);
74void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc, 74void
75 bool atomic); 75drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,
76 bool atomic);
76 77
77void drm_atomic_helper_swap_state(struct drm_atomic_state *state, 78void drm_atomic_helper_swap_state(struct drm_atomic_state *state,
78 bool stall); 79 bool stall);