[Intel-gfx] [PATCH] HAX: Do not restore mode through fbcon

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Fri Oct 13 07:51:41 UTC 2017


Lets try it and see what breaks!

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6a31d13f2f81..0414da99de5b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -352,7 +352,8 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
 	struct drm_device *dev = fb_helper->dev;
 	struct drm_plane *plane;
 	struct drm_atomic_state *state;
-	int i, ret;
+	struct drm_crtc *crtc;
+	int ret;
 	unsigned int plane_mask;
 	struct drm_modeset_acquire_ctx ctx;
 
@@ -381,32 +382,23 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper, bool activ
 		plane->old_fb = plane->fb;
 		plane_mask |= 1 << drm_plane_index(plane);
 
-		/* disable non-primary: */
-		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
-			continue;
-
 		ret = __drm_atomic_helper_disable_plane(plane, plane_state);
 		if (ret != 0)
 			goto out_state;
 	}
 
-	for (i = 0; i < fb_helper->crtc_count; i++) {
-		struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
+	drm_for_each_crtc(crtc, dev) {
+		struct drm_crtc_state *crtc_state = drm_atomic_get_crtc_state(state, crtc);
 
-		ret = __drm_atomic_helper_set_config(mode_set, state);
-		if (ret != 0)
+		if (IS_ERR(crtc_state)) {
+			ret = PTR_ERR(crtc_state);
 			goto out_state;
-
-		/*
-		 * __drm_atomic_helper_set_config() sets active when a
-		 * mode is set, unconditionally clear it if we force DPMS off
-		 */
-		if (!active) {
-			struct drm_crtc *crtc = mode_set->crtc;
-			struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
-
-			crtc_state->active = false;
 		}
+
+		crtc_state->active = false;
+		ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL);
+		if (ret)
+			goto out_state;
 	}
 
 	ret = drm_atomic_commit(state);
-- 
2.14.1



More information about the Intel-gfx mailing list