From patchwork Mon May 9 18:08:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Leigh X-Patchwork-Id: 770062 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p49IHJ9F003014 for ; Mon, 9 May 2011 18:17:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850Ab1EISRM (ORCPT ); Mon, 9 May 2011 14:17:12 -0400 Received: from nagini.codelibre.net ([80.68.93.164]:58997 "EHLO nagini.codelibre.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712Ab1EISRL (ORCPT ); Mon, 9 May 2011 14:17:11 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 09 May 2011 18:17:20 +0000 (UTC) X-Greylist: delayed 524 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 May 2011 14:17:11 EDT Received: by nagini.codelibre.net (Postfix, from userid 1000) id 2EEAB181D4; Mon, 9 May 2011 19:08:25 +0100 (BST) Date: Mon, 9 May 2011 19:08:25 +0100 From: Roger Leigh To: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, David Airlie Subject: [bug] drmfb does not set physical screen dimensions Message-ID: <20110509180825.GM13524@codelibre.net> MIME-Version: 1.0 Content-Disposition: inline X-GPG-Key: 0x25BFB848 X-Debian: testing/unstable X-OS-Uptime: 11:15:17 up 76 days, 14:09, 4 users, load average: 0.00, 0.00, 0.00 User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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); } /*