From patchwork Tue Apr 17 22:34:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 10346973 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 F2ACD60365 for ; Tue, 17 Apr 2018 22:34:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C590627DA4 for ; Tue, 17 Apr 2018 22:34:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8B0427F10; Tue, 17 Apr 2018 22:34:20 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham 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 1FA0B27DA4 for ; Tue, 17 Apr 2018 22:34:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E79489022; Tue, 17 Apr 2018 22:34:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id C44BF89022 for ; Tue, 17 Apr 2018 22:34:16 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2018 15:34:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,464,1517904000"; d="scan'208";a="217371722" Received: from josouza-mobl.jf.intel.com ([10.24.11.40]) by orsmga005.jf.intel.com with ESMTP; 17 Apr 2018 15:34:14 -0700 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= To: intel-gfx@lists.freedesktop.org Date: Tue, 17 Apr 2018 15:34:18 -0700 Message-Id: <20180417223418.15046-1-jose.souza@intel.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915/fbdev: Enable late fbdev initial configuration X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rodrigo Vivi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If the initial fbdev configuration(intel_fbdev_initial_config()) runs and there still no sink connected it will cause drm_fb_helper_initial_config() to return 0 as no error happened(but internally the return is -EAGAIN). Because no framebuffer was allocated, when a sink is connected intel_fbdev_output_poll_changed() will not execute drm_fb_helper_hotplug_event() that would trigger another try to do the initial fbdev configuration. So here creating a dummy framebuffer of 800x600, so drm_fb_helper_hotplug_event() will be executed and fbdev can be properly setup when a sink is connected, if needed the dummy framebuffer will be freed and a new with the proper size will be allocated. This issue also happens when a MST DP sink is connected since boot, as the MST topology is discovered in parallel if intel_fbdev_initial_config() is executed before the first sink MST is discovered it will cause this same issue. This is a follow up patch of https://patchwork.freedesktop.org/patch/196089/ Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104158 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104425 Cc: Chris Wilson Cc: Rodrigo Vivi Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/i915/intel_fbdev.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 7d41d139341b..773577d39782 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -696,14 +696,36 @@ int intel_fbdev_init(struct drm_device *dev) return 0; } +static void intel_fbdev_dummy_fb_create(struct intel_fbdev *ifbdev) +{ + struct drm_fb_helper_surface_size sizes; + + sizes.fb_width = 800; + sizes.fb_height = 600; + sizes.surface_width = sizes.fb_width; + sizes.surface_height = sizes.fb_height; + sizes.surface_bpp = 32; + sizes.surface_depth = 24; + + if (intelfb_create(&ifbdev->helper, &sizes)) + DRM_ERROR("Unable to create dummy framebufer"); +} + static void intel_fbdev_initial_config(void *data, async_cookie_t cookie) { struct intel_fbdev *ifbdev = data; /* Due to peculiar init order wrt to hpd handling this is separate. */ if (drm_fb_helper_initial_config(&ifbdev->helper, - ifbdev->preferred_bpp)) + ifbdev->preferred_bpp)) { intel_fbdev_unregister(to_i915(ifbdev->helper.dev)); + return; + } + + mutex_lock(&ifbdev->helper.lock); + if (!ifbdev->vma) + intel_fbdev_dummy_fb_create(ifbdev); + mutex_unlock(&ifbdev->helper.lock); } void intel_fbdev_initial_config_async(struct drm_device *dev)