Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699623 > unrolled thread

[RFC] drm/fb: Propagate physical display dimensions to fbdev

Started byDavid Lechner <david@lechnology.com>
First post2017-07-30 23:20 +0200
Last post2017-07-31 09:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RFC] drm/fb: Propagate physical display dimensions to fbdev David Lechner <david@lechnology.com> - 2017-07-30 23:20 +0200
    Re: [RFC] drm/fb: Propagate physical display dimensions to fbdev Daniel Vetter <daniel@ffwll.ch> - 2017-07-31 09:50 +0200

#1699623 — [RFC] drm/fb: Propagate physical display dimensions to fbdev

FromDavid Lechner <david@lechnology.com>
Date2017-07-30 23:20 +0200
Subject[RFC] drm/fb: Propagate physical display dimensions to fbdev
Message-ID<u93N0-5Ax-7@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1699790

FromDaniel Vetter <daniel@ffwll.ch>
Date2017-07-31 09:50 +0200
Message-ID<u9dCG-3sb-25@gated-at.bofh.it>
In reply to#1699623
> Sun, Jul 30, 2017 at 11:11 PM, David Lechner <david@lechnology.com> wrote:
> 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.

This data can also change at runtime, which means we need to reprobe
it. And as you mention, we need to pick the data of the first
connected connector, not the very first connector the driver has. The
final connector loo in drm_setup_crtcs() would be a good place to do
that I think.
-Daniel

> ---
>  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
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web