All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Leigh <rleigh@codelibre.net>
To: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	David Airlie <airlied@linux.ie>
Subject: [bug] drmfb does not set physical screen dimensions
Date: Mon, 09 May 2011 18:08:25 +0000	[thread overview]
Message-ID: <20110509180825.GM13524@codelibre.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 3331 bytes --]

Hi,

drivers/gpu/drm/drm_fb_helper.c is not setting width and height
in struct fb_var_screeninfo.  drm_fb_helper_fill_var sets them to -1
rather than using the real values:
        info->var.height = -1;
        info->var.width = -1;

Since the physical dimensions are most likely known from the monitor
EDID, it would be ideal if this could be set here.  If not, it might
be nice to assume a default of 96dpi and compute the size based upon
the current resolution (so applications don't need to implement
fallbacks when unset).  On my hardware the radeon driver certainly
does have this information.

This information is needed in order to do accurate font rendering and
drawing.  It's available in X, and it would be great if it was also
available using the framebuffer.

I've also attached a small patch to fbset to allow reporting of the
current state in fb_var_screeninfo such as resolution, size, depth etc.
Could be extended to report more info if desired.
I'm not entirely sure who is best to submit this to, so my apologies
if this is not you.

I've included the dri and fbdev lists because I'm not sure if it's
specific to the drmfb code or the generic framebuffer code.  Likewise
if you set a default 96dpi size, I'm not sure if it's a generic issue
or specific to drmfb.


Thanks,
Roger


diff -urN /tmp/fbset-2.1/fbset.c ./fbset.c
--- /tmp/fbset-2.1/fbset.c	2011-05-09 18:47:47.000000000 +0100
+++ ./fbset.c	2011-05-09 18:46:32.142945642 +0100
@@ -281,7 +281,8 @@
 static struct VideoMode *FindVideoMode(const char *name);
 static void ModifyVideoMode(struct VideoMode *vmode);
 static void DisplayVModeInfo(struct VideoMode *vmode);
-static void DisplayFBInfo(struct fb_fix_screeninfo *fix);
+static void DisplayFBInfo(struct fb_fix_screeninfo *fix,
+			  struct fb_var_screeninfo *var);
 static int FillScanRates(struct VideoMode *vmode);
 static void Usage(void) __attribute__ ((noreturn));
 int main(int argc, char *argv[]);
@@ -758,7 +759,8 @@
      *  Display the Frame Buffer Device Information
      */
 
-static void DisplayFBInfo(struct fb_fix_screeninfo *fix)
+static void DisplayFBInfo(struct fb_fix_screeninfo *fix,
+			  struct fb_var_screeninfo *var)
 {
     int i;
 
@@ -845,6 +847,16 @@
 	puts(Accelerators[i].name);
     else
 	printf("Unknown (%d)\n", fix->accel);
+
+    printf("    Dimensions  : %dx%d pixels", var->xres, var->yres);
+    if (var->width != -1 && var->height != -1)
+      printf(" (%dx%d mm)", var->width, var->height);
+    putc('\n', stdout);
+    printf("    Virtual     : %dx%d pixels\n", var->xres_virtual, var->yres_virtual);
+    printf("    Offset      : %dx%d pixels\n", var->xoffset, var->yoffset);
+    printf("    Bits/Pixel  : %d\n", var->bits_per_pixel);
+    if (var->grayscale)
+      printf("    Graylevels  : %d\n", var->grayscale);
 }
 
 
@@ -1101,7 +1113,7 @@
 	if (Opt_verbose)
 	    puts("Getting further frame buffer information");
 	GetFixScreenInfo(fh, &fix);
-	DisplayFBInfo(&fix);
+	DisplayFBInfo(&fix, &var);
     }
 
     /*

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Roger Leigh <rleigh@codelibre.net>
To: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	David Airlie <airlied@linux.ie>
Subject: [bug] drmfb does not set physical screen dimensions
Date: Mon, 9 May 2011 19:08:25 +0100	[thread overview]
Message-ID: <20110509180825.GM13524@codelibre.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3331 bytes --]

Hi,

drivers/gpu/drm/drm_fb_helper.c is not setting width and height
in struct fb_var_screeninfo.  drm_fb_helper_fill_var sets them to -1
rather than using the real values:
        info->var.height = -1;
        info->var.width = -1;

Since the physical dimensions are most likely known from the monitor
EDID, it would be ideal if this could be set here.  If not, it might
be nice to assume a default of 96dpi and compute the size based upon
the current resolution (so applications don't need to implement
fallbacks when unset).  On my hardware the radeon driver certainly
does have this information.

This information is needed in order to do accurate font rendering and
drawing.  It's available in X, and it would be great if it was also
available using the framebuffer.

I've also attached a small patch to fbset to allow reporting of the
current state in fb_var_screeninfo such as resolution, size, depth etc.
Could be extended to report more info if desired.
I'm not entirely sure who is best to submit this to, so my apologies
if this is not you.

I've included the dri and fbdev lists because I'm not sure if it's
specific to the drmfb code or the generic framebuffer code.  Likewise
if you set a default 96dpi size, I'm not sure if it's a generic issue
or specific to drmfb.


Thanks,
Roger


diff -urN /tmp/fbset-2.1/fbset.c ./fbset.c
--- /tmp/fbset-2.1/fbset.c	2011-05-09 18:47:47.000000000 +0100
+++ ./fbset.c	2011-05-09 18:46:32.142945642 +0100
@@ -281,7 +281,8 @@
 static struct VideoMode *FindVideoMode(const char *name);
 static void ModifyVideoMode(struct VideoMode *vmode);
 static void DisplayVModeInfo(struct VideoMode *vmode);
-static void DisplayFBInfo(struct fb_fix_screeninfo *fix);
+static void DisplayFBInfo(struct fb_fix_screeninfo *fix,
+			  struct fb_var_screeninfo *var);
 static int FillScanRates(struct VideoMode *vmode);
 static void Usage(void) __attribute__ ((noreturn));
 int main(int argc, char *argv[]);
@@ -758,7 +759,8 @@
      *  Display the Frame Buffer Device Information
      */
 
-static void DisplayFBInfo(struct fb_fix_screeninfo *fix)
+static void DisplayFBInfo(struct fb_fix_screeninfo *fix,
+			  struct fb_var_screeninfo *var)
 {
     int i;
 
@@ -845,6 +847,16 @@
 	puts(Accelerators[i].name);
     else
 	printf("Unknown (%d)\n", fix->accel);
+
+    printf("    Dimensions  : %dx%d pixels", var->xres, var->yres);
+    if (var->width != -1 && var->height != -1)
+      printf(" (%dx%d mm)", var->width, var->height);
+    putc('\n', stdout);
+    printf("    Virtual     : %dx%d pixels\n", var->xres_virtual, var->yres_virtual);
+    printf("    Offset      : %dx%d pixels\n", var->xoffset, var->yoffset);
+    printf("    Bits/Pixel  : %d\n", var->bits_per_pixel);
+    if (var->grayscale)
+      printf("    Graylevels  : %d\n", var->grayscale);
 }
 
 
@@ -1101,7 +1113,7 @@
 	if (Opt_verbose)
 	    puts("Getting further frame buffer information");
 	GetFixScreenInfo(fh, &fix);
-	DisplayFBInfo(&fix);
+	DisplayFBInfo(&fix, &var);
     }
 
     /*

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

             reply	other threads:[~2011-05-09 18:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-09 18:08 Roger Leigh [this message]
2011-05-09 18:08 ` [bug] drmfb does not set physical screen dimensions Roger Leigh

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=20110509180825.GM13524@codelibre.net \
    --to=rleigh@codelibre.net \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@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 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.