<p>Thanks for writing this up! It was good info.<br>
On Oct 4, 2011 7:55 PM, &quot;Adam Jackson&quot; &lt;<a href="mailto:ajax@redhat.com">ajax@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Tue, 2011-10-04 at 11:46 -0400, Kaleb S. KEITHLEY wrote:<br>
&gt;<br>
&gt; &gt; Grovelling around in the F15 xorg-server sources and reviewing the Xorg<br>
&gt; &gt; log file on my F15 box, I see, with _modern hardware_ at least, that we<br>
&gt; &gt; do have the monitor geometry available from DDC or EDIC, and obviously<br>
&gt; &gt; it is trivial to compute the actual, correct DPI for each screen.<br>
&gt;<br>
&gt; I am clearly going to have to explain this one more time, forever.<br>
&gt; Let&#39;s see if I can&#39;t write it authoritatively once and simply answer<br>
&gt; with a URL from here out.  (As always, use of the second person &quot;you&quot;<br>
&gt; herein is plural, not singular.)<br>
&gt;<br>
&gt; EDID does not reliably give you the size of the display.<br>
&gt;<br>
&gt; Base EDID has at least two different places where you can give a<br>
&gt; physical size (before considering extensions that aren&#39;t widely deployed<br>
&gt; so whatever).  The first is a global property, measured in centimeters,<br>
&gt; of the physical size of the glass.  The second is attached to your (zero<br>
&gt; or more) detailed timing specifications, and reflects the size of the<br>
&gt; mode, in millimeters.<br>
&gt;<br>
&gt; So, how does this screw you?<br>
&gt;<br>
&gt; a) Glass size is too coarse.  On a large display that cm roundoff isn&#39;t<br>
&gt; a big deal, but on subnotebooks it&#39;s a different game.  The 11&quot; MBA is<br>
&gt; 25.68x14.44 cm, so that gives you a range of 52.54-54.64 dpcm horizontal<br>
&gt; and 51.20-54.86 dpcm vertical (133.4-138.8 dpi h and 130.0-139.3 dpi v).<br>
&gt; Which is optimistic, because that&#39;s doing the math forward from knowing<br>
&gt; the actual size, and you as the EDID parser can&#39;t know which way the<br>
&gt; manufacturer rounded.<br>
&gt;<br>
&gt; b) Glass size need not be non-zero.  This is in fact the usual case for<br>
&gt; projectors, which don&#39;t have a fixed display size since it&#39;s a function<br>
&gt; of how far away the wall is from the lens.<br>
&gt;<br>
&gt; c) Glass size could be partially non-zero.  Yes, really.  EDID 1.4<br>
&gt; defines a method of using these two bytes to encode aspect ratio, where<br>
&gt; if vertical size is 0 then the aspect ratio is computed as (horizontal<br>
&gt; value + 99) / 100 in portrait mode (and the obvious reverse thing if<br>
&gt; horizontal is zero).  Admittedly, unlike every other item in this list,<br>
&gt; I&#39;ve never seen this in the wild.  But it&#39;s legal.<br>
&gt;<br>
&gt; d) Glass size could be a direct encoding of the aspect ratio.  Base EDID<br>
&gt; doesn&#39;t condone this behaviour, but the CEA spec (to which all HDMI<br>
&gt; monitors must conform) does allow-but-not-require it, which means your<br>
&gt; 1920x1080 TV could claim to be 16 &quot;cm&quot; by 9 &quot;cm&quot;.  So of course that&#39;s<br>
&gt; what TV manufacturers do because that way they don&#39;t have to modify the<br>
&gt; EDID info when physical construction changes, and that&#39;s cheaper.<br>
&gt;<br>
&gt; e) You could use mode size to get size in millimeters, but you might not<br>
&gt; have any detailed timings.<br>
&gt;<br>
&gt; f) You could use mode size, but mode size is explicitly _not_ glass<br>
&gt; size.  It&#39;s the size that the display chooses to present that mode.<br>
&gt; Sometimes those are the same, and sometimes they&#39;re not.  You could be<br>
&gt; scaled or {letter,pillar}boxed, and that&#39;s not necessarily something you<br>
&gt; can control from the host side.<br>
&gt;<br>
&gt; g) You could use mode size, but it could be an encoded aspect ratio, as<br>
&gt; in case d above, because CEA says that&#39;s okay.<br>
&gt;<br>
&gt; h) You could use mode size, but it could be the aspect ratio from case d<br>
&gt; multiplied by 10 in each direction (because, of course, you gave size in<br>
&gt; centimeters and so your authoring tool just multiplied it up).<br>
&gt;<br>
&gt; i) Any or all of the above could be complete and utter garbage, because<br>
&gt; - and I really, really need you to understand this - there is no<br>
&gt; requirements program for any commercial OS or industry standard that<br>
&gt; requires honesty here, as far as I&#39;m aware.  There is every incentive<br>
&gt; for there to _never_ be one, because it would make the manufacturing<br>
&gt; process more expensive.<br>
&gt;<br>
&gt; So from this point the suggestion is usually &quot;well come up with some<br>
&gt; heuristic to make a good guess assuming there&#39;s some correlation between<br>
&gt; the various numbers you&#39;re given&quot;.  I have in fact written heuristics<br>
&gt; for this, and they&#39;re in your kernel and your X server, and they still<br>
&gt; encounter a huge number of cases where we simply _cannot_ know from EDID<br>
&gt; anything like a physical size, because - to pick only one example - the<br>
&gt; consumer electronics industry are cheap bastards, because you the<br>
&gt; consumer demanded that they be cheap.<br>
&gt;<br>
&gt; And then your only recourse is to an external database, and now you&#39;re<br>
&gt; up the creek again because the identifying information here is a<br>
&gt; vendor/model/serial tuple, and the vendor can and does change physical<br>
&gt; construction without changing model number.  Now you get to play the<br>
&gt; guessing game of how big the serial number range is for each subvariant,<br>
&gt; assuming they bothered to encode a serial number - and they didn&#39;t.  Or,<br>
&gt; if they bothered to encode week/year of manufacturer correctly - and<br>
&gt; they didn&#39;t - which weeks meant which models.  And then you still have<br>
&gt; to go out and buy one of every TV at Fry&#39;s, and that covers you for one<br>
&gt; market, for three months.<br>
&gt;<br>
&gt; If someone wants to write something better, please, by all means.  If<br>
&gt; it&#39;s kernel code, send it to <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a> and cc me<br>
&gt; and I will happily review it.  Likewise xorg-devel@ for X server<br>
&gt; changes.<br>
&gt;<br>
&gt; I gently suggest that doing so is a waste of time.<br>
&gt;<br>
&gt; But if there&#39;s one thing free software has taught me, it&#39;s that you can<br>
&gt; not tell people something is a bad idea and have any expectation they<br>
&gt; will believe you.<br>
&gt;<br>
&gt; &gt; Obviously in a multi-screen set-up using Xinerama this has the potential<br>
&gt; &gt; to be a Hard Problem if the monitors differ greatly in their DPI.<br>
&gt; &gt;<br>
&gt; &gt; If the major resistance is over what to do with older hardware that<br>
&gt; &gt; doesn&#39;t have this data available, then yes, punt; use a hard-coded<br>
&gt; &gt; default. Likewise, if the two monitors really differ greatly, then punt.<br>
&gt;<br>
&gt; I&#39;m going to limit myself to observing that &quot;greatly&quot; is a matter of<br>
&gt; opinion, and that in order to be really useful you&#39;d need some way of<br>
&gt; communicating &quot;I punted&quot; to the desktop.<br>
&gt;<br>
&gt; Beyond that, sure, pick a heuristic, accept that it&#39;s going to be<br>
&gt; insufficient for someone, and then sit back and wait to get<br>
&gt; second-guessed on it over and over.<br>
&gt;<br>
&gt; &gt; And it wouldn&#39;t be so hard to to add something like -dpi:0, -dpi:1,<br>
&gt; &gt; -dpi:2 command line options to specify per-screen dpi. I kinda thought I<br>
&gt; &gt; did that a long, long time ago, but maybe I only thought about doing it<br>
&gt; &gt; and never actually got around to it.<br>
&gt;<br>
&gt; The RANDR extension as of version 1.2 does allow you to override<br>
&gt; physical size on a per-output basis at runtime.  We even try pretty hard<br>
&gt; to set them as honestly as we can up front.  The 96dpi thing people<br>
&gt; complain about is from the per-screen info, which is simply a default<br>
&gt; because of all the tl;dr above; because you have N outputs per screen<br>
&gt; which means a single number is in general useless; and because there is<br>
&gt; no way to refresh the per-screen info at runtime, as it&#39;s only ever sent<br>
&gt; in the initial connection handshake.<br>
&gt;<br>
&gt; - ajax<br>
&gt;<br>
&gt; --<br>
&gt; devel mailing list<br>
&gt; <a href="mailto:devel@lists.fedoraproject.org">devel@lists.fedoraproject.org</a><br>
&gt; <a href="https://admin.fedoraproject.org/mailman/listinfo/devel">https://admin.fedoraproject.org/mailman/listinfo/devel</a><br>
</p>