All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Abriou <vincent.abriou@st.com>
To: dri-devel@lists.freedesktop.org
Cc: Yannick Fertre <yannick.fertre@st.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Vincent Abriou <vincent.abriou@st.com>,
	Fabien Dessenne <fabien.dessenne@st.com>
Subject: [PATCH v2] drm: get fbdev size from cmdline mode if it exists
Date: Tue, 10 Jan 2017 12:21:09 +0100	[thread overview]
Message-ID: <1484047269-18013-1-git-send-email-vincent.abriou@st.com> (raw)

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 <tomi.valkeinen@ti.com>
Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
---
Patch v2:
 add a break in the connector for loop when a first cmdline mode is found

 drivers/gpu/drm/drm_fb_helper.c | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 0ab6aaa..b38285f 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1526,6 +1526,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;
@@ -1570,11 +1571,34 @@ 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)
+				break;
+		}
+
+		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 */
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2017-01-10 11:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 11:21 Vincent Abriou [this message]
2017-01-10 11:39 ` [PATCH v2] drm: get fbdev size from cmdline mode if it exists Daniel Vetter
2017-01-10 13:33   ` Vincent ABRIOU
2017-01-10 20:06     ` Laurent Pinchart
2017-01-11  7:48       ` Daniel Vetter
2017-01-11  9:03         ` Vincent ABRIOU
2017-01-11 11:11           ` Laurent Pinchart
2017-01-11 12:31             ` Daniel Vetter
2017-01-11 12:40             ` Vincent ABRIOU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484047269-18013-1-git-send-email-vincent.abriou@st.com \
    --to=vincent.abriou@st.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabien.dessenne@st.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=yannick.fertre@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.