From patchwork Fri Jun 30 16:51:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 9820105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 387B360224 for ; Fri, 30 Jun 2017 16:52:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26B30286C7 for ; Fri, 30 Jun 2017 16:52:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B7E8286D7; Fri, 30 Jun 2017 16:52:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ACFEC286C7 for ; Fri, 30 Jun 2017 16:52:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C0E16E84A; Fri, 30 Jun 2017 16:52:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90E1E6E847; Fri, 30 Jun 2017 16:52:52 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.9]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v5UGpt6p026519; Fri, 30 Jun 2017 17:51:56 +0100 From: Liviu Dudau To: Daniel Vetter Subject: [PATCH] drm/fb-helper: Restore first connection behaviour on deferred setup Date: Fri, 30 Jun 2017 17:51:55 +0100 Message-Id: <20170630165155.8658-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170628113201.27383-1-daniel.vetter@ffwll.ch> References: <20170628113201.27383-1-daniel.vetter@ffwll.ch> Cc: Intel Graphics Development , DRI Development , Thierry Reding X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Prior to commit b0aa06e9a7fd ("drm/fb-helper: Support deferred setup"), if no output is connected at framebuffer setup time, we get a default 1024x768 mode that is going to be used when we first connect a monitor. After the commit, on first connection after deferred setup, we probe the monitor and get the preferred resolution, but no mode get set because the drm_fb_helper_hotplug_event() function returns early when the setup has been deferred. That is different from what happens on a second re-connect of the monitor, when the native mode get set. Create a more consistent behaviour by checking in the drm_fb_helper_hotplug_event() function if the deferred setup is still active. If not, that means we now have a valid framebuffer that can be used for setting the correct mode. Fixes: b0aa06e9a7fd ("drm/fb-helper: Support deferred setup") Signed-off-by: Liviu Dudau Cc: Daniel Vetter --- drivers/gpu/drm/drm_fb_helper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index d833eb2320d1..bb7b44d284ec 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2444,6 +2444,7 @@ static int __drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, if (ret == -EAGAIN) { fb_helper->preferred_bpp = bpp_sel; fb_helper->deferred_setup = true; + ret = 0; } mutex_unlock(&fb_helper->lock); @@ -2565,7 +2566,13 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) if (fb_helper->deferred_setup) { err = __drm_fb_helper_initial_config(fb_helper, fb_helper->preferred_bpp); - return err; + /* + * __drm_fb_helper_initial_config can change deferred_setup, + * if 'false' that means we can go ahead with the rest of + * the setup as normal + */ + if (fb_helper->deferred_setup) + return err; } if (!fb_helper->fb || !drm_fb_helper_is_bound(fb_helper)) {