From patchwork Fri Jan 6 16:44:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Abriou X-Patchwork-Id: 9501507 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 3C573606E0 for ; Fri, 6 Jan 2017 16:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2565E284FA for ; Fri, 6 Jan 2017 16:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A4D5284FC; Fri, 6 Jan 2017 16:45:13 +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=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 9AD62284FA for ; Fri, 6 Jan 2017 16:45:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8630D6EA53; Fri, 6 Jan 2017 16:45:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DFD76EA59 for ; Fri, 6 Jan 2017 16:45:05 +0000 (UTC) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id v06GicZu028796; Fri, 6 Jan 2017 17:45:03 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-.pphosted.com with ESMTP id 27p4ehg5bp-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 06 Jan 2017 17:45:03 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8014B31; Fri, 6 Jan 2017 16:45:02 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 64BDB4E5D; Fri, 6 Jan 2017 16:45:02 +0000 (GMT) Received: from localhost (10.201.23.35) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 6 Jan 2017 17:45:02 +0100 From: Vincent Abriou To: Subject: [PATCH 2/2] drm: get fbdev size from cmdline if no connector found Date: Fri, 6 Jan 2017 17:44:44 +0100 Message-ID: <1483721084-20278-3-git-send-email-vincent.abriou@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483721084-20278-1-git-send-email-vincent.abriou@st.com> References: <1483721084-20278-1-git-send-email-vincent.abriou@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.35] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-01-06_14:, , signatures=0 Cc: Tomi Valkeinen , Vincent Abriou , Fabien Dessenne 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case no connector is found while creating the fbdev, gives the possibility to specify the default fbdev size by firstly checking if the command line is defining a preferred mode. Else go into fallback and set 1024x768 fbdev size as it was already done. Cc: Tomi Valkeinen Signed-off-by: Vincent Abriou --- drivers/gpu/drm/drm_fb_helper.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 77d9ac6..115c265 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1522,6 +1522,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, } crtc_count = 0; + for (i = 0; i < fb_helper->crtc_count; i++) { struct drm_display_mode *desired_mode; struct drm_mode_set *mode_set; @@ -1566,11 +1567,32 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, } if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) { - /* hmm everyone went away - assume VGA cable just fell out - and will come back later. */ - DRM_INFO("Cannot find any crtc or sizes - going 1024x768\n"); - sizes.fb_width = sizes.surface_width = 1024; - sizes.fb_height = sizes.surface_height = 768; + struct drm_display_mode *mode = NULL; + /* hmm everyone went away - assume cable just fell out and will + * come back later. + * Get fb size from command line mode (if existing) else fb size + * is set to 1024x768 + */ + for (i = 0; i < fb_helper->connector_count; i++) { + struct drm_fb_helper_connector *fb_helper_conn; + + fb_helper_conn = fb_helper->connector_info[i]; + mode = drm_pick_cmdline_mode(fb_helper_conn); + } + + if (mode) { + sizes.fb_width = mode->hdisplay; + sizes.fb_height = mode->vdisplay; + DRM_INFO("Cannot find any crtc or sizes - use cmdline %dx%d\n", + sizes.fb_width, sizes.fb_height); + } else { + sizes.fb_width = 1024; + sizes.fb_height = 768; + DRM_INFO("Cannot find any crtc or sizes - going 1024x768\n"); + } + + sizes.surface_width = sizes.fb_width; + sizes.surface_height = sizes.fb_height; } /* push down into drivers */