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: 106756 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2564852qge; Fri, 30 Jun 2017 09:52:55 -0700 (PDT) X-Received: by 10.99.176.1 with SMTP id h1mr21776977pgf.152.1498841575893; Fri, 30 Jun 2017 09:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498841575; cv=none; d=google.com; s=arc-20160816; b=SrDN5YuIVWaot7nzIrnkZKBXIuakqKW/pF7Vqe+GuvsFE5wdm8mq+mRFfT+shUhTPX 97Oalv8W4CnE07t+HXcaqvoQyY//7jJL0n9FZehIHnPYWRovMmfvWnbCaQSe2Rof4fp5 qX/0pShZezHHJ0GN3xBpv39+jrrBAXm5oagIVMXPu9QaR2XXAMpHp6Lkv7mHKI7ccHtL lC+RzkhcWAACobEpcUfLnENe9baR4IHA/iUzc4c2ZaC1VPc3tbafUAmbIUqVw+hcL7+J Ivxyfv6KHISbsKPU4d9mFEXHB6B7/YG14qzPZEgqFh8VDPVkc3goyBvGtfWU0kBXiZYE 5k/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:delivered-to:arc-authentication-results; bh=W6HqxIHa952gNyMPHqTH1/xDSV1jvrzd2sh5/Aa7FmY=; b=ywveP9fdSn49ky0omf9CUSI7TBZhfUNILBBEyJ7g2c+tRHdl7BlGo/yNFfbBV7bKuk vWNY0KNQgeMiPzDWRc96R9KIuPY8iV8iDAwayC9DRFlTBB2X1xrPWj4BSD8861sioqwa jziMLBbXqOLrxkZae7kLNmPWbv4HnKu87AJYlJwtO4i1FSIaOZAGE7xa86/7XmnQZ+2X hY0tVHlvcW7w1Muj4td9i5G87iRnNbJ5mevc76OPEQMl4hazX/yWqsZ7IipwsXQpc/HB pD9sEt/2npN0KULloVMkNUgj8EuUDt2MtHHzsurhqegyl0qQcQ5cHCb01XjdcJdrun7V CrCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id l1si5004382pfe.480.2017.06.30.09.52.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 09:52:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org 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" 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)) {