mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Lechner <david@lechnology.com>
To: dri-devel@lists.freedesktop.org
Cc: David Lechner <david@lechnology.com>, linux-kernel@vger.kernel.org
Subject: [RFC] drm/fb: Propagate physical display dimensions to fbdev
Date: Sun, 30 Jul 2017 16:11:38 -0500	[thread overview]
Message-ID: <1501449098-26148-1-git-send-email-david@lechnology.com> (raw)

fbdev has a place for the physical width and height of a display. I would
like to have this information available to userspace. This patch works for me,
but I have a strong suspicion that this is not the "right way".

Any suggestions on how to get the proper struct drm_display_info here
rather than assuming the first connector one is valid? I don't see an obvious
way to do this.
---
 drivers/gpu/drm/drm_fb_helper.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 574af01..ff422da 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1768,8 +1768,14 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
 	info->var.xoffset = 0;
 	info->var.yoffset = 0;
 	info->var.activate = FB_ACTIVATE_NOW;
-	info->var.height = -1;
-	info->var.width = -1;
+
+	if (fb_helper->connector_count) {
+		info->var.height = fb_helper->connector_info[0]->connector->display_info.width_mm;
+		info->var.width = fb_helper->connector_info[0]->connector->display_info.height_mm;
+	} else {
+		info->var.height = -1;
+		info->var.width = -1;
+	}
 
 	switch (fb->format->depth) {
 	case 8:
-- 
2.7.4

             reply	other threads:[~2017-07-30 21:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-30 21:11 David Lechner [this message]
2017-07-31  7:42 ` Daniel Vetter

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=1501449098-26148-1-git-send-email-david@lechnology.com \
    --to=david@lechnology.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®