Bug 17255

Summary: using fuzzy aspect match for initial modes (picked 1280x960 instead of 1280x1024)
Product: xorg Reporter: Bryce Harrington <bryce>
Component: Server/GeneralAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: ethana2
Version: 7.3 (2007.09)   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Bryce Harrington 2008-08-21 19:15:31 UTC
Forwarding this bug from a Ubuntu user:
https://bugs.edge.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/188792

EDID and ddcprobe show that resolution 1280x1024 is available from the monitor, but 1280x960 is selected instead:

ubuntu@ubuntu:~$ sudo ddcprobe
vbe: VESA 2.0 detected.
oem: ATI RADEON 9200
memory: 131072kb
mode: 800x600x16
mode: 1024x768x16
mode: 320x200x32k
mode: 320x200x64k
mode: 320x200x16m
mode: 1600x1200x256
mode: 640x400x256
mode: 640x480x256
mode: 640x480x32k
mode: 640x480x64k
mode: 640x480x16m
mode: 1600x1200x32k
mode: 800x600x256
mode: 800x600x32k
mode: 800x600x64k
mode: 800x600x16m
mode: 1600x1200x64k
mode: 1024x768x256
mode: 1024x768x32k
mode: 1024x768x64k
mode: 1024x768x16m
mode: 1280x1024x256
mode: 1280x1024x32k
mode: 1280x1024x64k
mode: 1280x1024x16m
mode: 132x25 (text)
mode: 132x43 (text)
edid:
edid: 1 3
id: 0302
eisa: MAG0302
serial: f900992f
manufacture: 41 2004
input: sync on green, analog signal.
screensize: 32 24
gamma: 1.270000
dpms: RGB, active off, suspend, standby
timing: 720x400@70 Hz (VGA 640x400, IBM)
timing: 640x480@75 Hz (VESA)
timing: 800x600@60 Hz (VESA)
timing: 800x600@75 Hz (VESA)
timing: 1024x768@87 Hz Interlaced (8514A)
timing: 1024x768@75 Hz (VESA)
ctiming: 640x480@85
ctiming: 800x600@85
ctiming: 800x600@100
ctiming: 1024x768@85
ctiming: 1280x1024@60
dtiming: 640x480@100
dtiming: 800x600@85
monitorrange: 30-70, 50-160
monitorserial: FAIU4A039215

ubuntu@ubuntu:~$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 960, maximum 1600 x 1200
VGA-0 connected 1280x960+0+0 (normal left inverted right x axis y
axis) 310mm x 230mm
   1600x1024 60.2
   1280x1024 60.0 60.0
   1440x900 59.9
   1280x960 60.0*
   1360x768 59.8
   1152x864 75.0 75.0 70.0 60.0
   1024x768 85.0 85.0 75.1 75.0 70.1 60.0
   832x624 74.6
   800x600 100.0 85.0 85.1 85.1 72.2 75.0
 60.3 56.2
   640x480 100.0 85.0 85.0 72.8 75.0 60.0 59.9
   720x400 85.0 70.1
   640x400 85.1
   640x350 85.1
DVI-0 disconnected (normal left inverted right x axis y axis)
S-video disconnected (normal left inverted right x axis y axis)


(II) RADEON(0): EDID vendor "MAG", prod id 770
(II) RADEON(0): Using hsync ranges from config file
(II) RADEON(0): Using vrefresh ranges from config file
(II) RADEON(0): Printing DDC gathered Modelines:
(II) RADEON(0): Modeline "640x480"x0.0   40.50  640 656 720 800  480 481 484 506 -hsync -vsync (50.6 kHz)
(II) RADEON(0): Modeline "800x600"x0.0   56.25  800 832 896 1048  600 601 604 631 +hsync +vsync (53.7 kHz)
(II) RADEON(0): Modeline "800x600"x0.0   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz)
(II) RADEON(0): Modeline "640x480"x0.0   25.20  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz)
(II) RADEON(0): Modeline "720x400"x0.0   28.32  720 738 846 900  400 412 414 449 -hsync +vsync (31.5 kHz)
(II) RADEON(0): Modeline "1024x768"x0.0   78.80  1024 1040 1136 1312  768 769 772 800 +hsync +vsync (60.1 kHz)
(II) RADEON(0): Modeline "1024x768"x0.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz)
(II) RADEON(0): Modeline "800x600"x0.0   49.50  800 816 896 1056  600 601 604 625 +hsync +vsync (46.9 kHz)
(II) RADEON(0): Modeline "640x480"x85.0   35.71  640 672 736 832  480 481 484 505 -hsync +vsync (42.9 kHz)
(II) RADEON(0): Modeline "800x600"x85.0   56.55  800 840 928 1056  600 601 604 630 -hsync +vsync (53.5 kHz)
(II) RADEON(0): Modeline "800x600"x100.0   68.18  800 848 936 1072  600 601 604 636 -hsync +vsync (63.6 kHz)
(II) RADEON(0): Modeline "1024x768"x85.0   94.39  1024 1088 1200 1376  768 769 772 807 -hsync +vsync (68.6 kHz)
(II) RADEON(0): Modeline "1280x1024"x60.0  108.88  1280 1360 1496 1712  1024 1025 1028 1060 -hsync +vsync (63.6 kHz)
(II) RADEON(0): Output: VGA-0, Detected Monitor Type: 1
(II) RADEON(0): EDID data from the display on output: VGA-0 ----------------------
(II) RADEON(0): Manufacturer: MAG  Model: 302  Serial#: 39215
(II) RADEON(0): Year: 2004  Week: 41
(II) RADEON(0): EDID Version: 1.3
(II) RADEON(0): Analog Display Input,  Input Voltage Level: 0.700/0.300 V
(II) RADEON(0): Sync:  Separate
(II) RADEON(0): Max Image Size [cm]: horiz.: 32  vert.: 24
(II) RADEON(0): Gamma: 1.27
(II) RADEON(0): DPMS capabilities: StandBy Suspend Off; RGB/Color Display
(II) RADEON(0): First detailed timing not preferred mode in violation of standard!(II) RADEON(0): redX: 0.618 redY: 0.349   greenX: 0.280 greenY: 0.605
(II) RADEON(0): blueX: 0.152 blueY: 0.063   whiteX: 0.281 whiteY: 0.310
(II) RADEON(0): Supported VESA Video Modes:
(II) RADEON(0): 720x400@70Hz
(II) RADEON(0): 640x480@60Hz
(II) RADEON(0): 800x600@60Hz
(II) RADEON(0): 800x600@75Hz
(II) RADEON(0): 1024x768@60Hz
(II) RADEON(0): 1024x768@75Hz
(II) RADEON(0): Manufacturer's mask: 0
(II) RADEON(0): Supported Future Video Modes:
(II) RADEON(0): #0: hsize: 640  vsize 480  refresh: 85  vid: 22833
(II) RADEON(0): #2: hsize: 800  vsize 600  refresh: 85  vid: 22853
(II) RADEON(0): #3: hsize: 800  vsize 600  refresh: 100  vid: 26693
(II) RADEON(0): #4: hsize: 1024  vsize 768  refresh: 85  vid: 22881
(II) RADEON(0): #5: hsize: 1280  vsize 1024  refresh: 60  vid: 32897
(II) RADEON(0): Supported additional Video Mode:
(II) RADEON(0): clock: 40.5 MHz   Image Size:  310 x 230 mm
(II) RADEON(0): h_active: 640  h_sync: 656  h_sync_end 720 h_blank_end 800 h_border: 0
(II) RADEON(0): v_active: 480  v_sync: 481  v_sync_end 484 v_blanking: 506 v_border: 0
(II) RADEON(0): Supported additional Video Mode:
(II) RADEON(0): clock: 56.2 MHz   Image Size:  310 x 230 mm
(II) RADEON(0): h_active: 800  h_sync: 832  h_sync_end 896 h_blank_end 1048 h_border: 0
(II) RADEON(0): v_active: 600  v_sync: 601  v_sync_end 604 v_blanking: 631 v_border: 0
(II) RADEON(0): Ranges: V min: 50 V max: 160 Hz, H min: 30 H max: 70 kHz, PixClock max 110 MHz
(II) RADEON(0): Serial No: FAIU4A039215U
(II) RADEON(0): EDID (in hex):
(II) RADEON(0): 	00ffffffffffff00342702032f990000
(II) RADEON(0): 	290e01030820181be85c119e59479b27
(II) RADEON(0): 	10484fa14a0031590101455945686159
(II) RADEON(0): 	818000000000d20f80a020e01a101040
(II) RADEON(0): 	130036e610000018f91520f830581f20
(II) RADEON(0): 	2040130036e61000001e000000fd0032
(II) RADEON(0): 	a01e460b000a202020202020000000ff
(II) RADEON(0): 	00464149553441303339323135550029
in RADEONProbeOutputModes
(II) RADEON(0): EDID vendor "MAG", prod id 770
(II) RADEON(0): I2C device "DVI-0:ddc2" registered at address 0xA0.
(II) RADEON(0): I2C device "DVI-0:ddc2" removed.
(II) RADEON(0): I2C device "DVI-0:ddc2" registered at address 0xA0.
(II) RADEON(0): I2C device "DVI-0:ddc2" removed.
(II) RADEON(0): I2C device "DVI-0:ddc2" registered at address 0xA0.
(II) RADEON(0): I2C device "DVI-0:ddc2" removed.
(II) RADEON(0): Output: DVI-0, Detected Monitor Type: 0
(II) RADEON(0): Output: S-video, Detected Monitor Type: 0
(II) RADEON(0): Output VGA-0 connected
(II) RADEON(0): Output DVI-0 disconnected
(II) RADEON(0): Output S-video disconnected
(II) RADEON(0): Using fuzzy aspect match for initial modes
(II) RADEON(0): Output VGA-0 using initial mode 1280x960
after xf86InitialConfiguration
(**) RADEON(0): Display dimensions: (320, 240) mm
(**) RADEON(0): DPI set to (126, 126)
(II) Loading sub module "fb"
(II) LoadModule: "fb"


"Using fuzzy aspect match for initial modes" sounds suspicious.  Also, it's showing dimensions as 310 x 230 mm in some places, and (320, 240) mm others.  Rounding issue?
Comment 1 Ethan Anderson 2008-08-21 19:52:39 UTC
I'm the Ubuntu user who reported this bug, just let me know what you need me to do.
Comment 2 Julien Cristau 2008-08-22 05:19:46 UTC
On Thu, Aug 21, 2008 at 19:15:34 -0700, bugzilla-daemon@freedesktop.org wrote:

> (II) RADEON(0): Using hsync ranges from config file
> (II) RADEON(0): Using vrefresh ranges from config file

that might be a problem.  what happens if the log file doesn't give any
hsync/vrefresh ranges?

Cheers,
Julien
Comment 3 Alex Deucher 2008-08-22 07:30:15 UTC
You monitor does not specify a preferred mode so the server ends up picking one.  Also as Julien noted the driver is using the sync ranges from the monitor section of your config which may influence that decision.  1280x960 is a valid mode based on the sync ranges provided and it's actually 4:3 whereas 1280x1024 is not.  I suppose it comes down to what mode do you pick as a default on an analog monitor which does not specify a preferred mode.  You can use the preferred mode option in your monitor section to hardcode your preferred mode if you don't like what the xserver picks.

As to the display sizes, both come from the monitor via the EDID:
- Max image size supported by the monitor:
(II) RADEON(0): Max Image Size [cm]: horiz.: 32  vert.: 24
- The extended timings can individually specify an image sizes:
(II) RADEON(0): clock: 40.5 MHz   Image Size:  310 x 230 mm
(II) RADEON(0): clock: 56.2 MHz   Image Size:  310 x 230 mm
Comment 4 Julien Cristau 2008-08-22 09:05:41 UTC
> --- Comment #2 from Julien Cristau <jcristau@debian.org>  2008-08-22 05:19:46 PST ---
> what happens if the log file doesn't give any hsync/vrefresh ranges?
> 
bah. i obviously meant *config* file there...
Comment 5 Bryce Harrington 2008-08-22 17:03:46 UTC
The user isn't specifying anything in their xorg.conf; it's just a stock empty config file (see below).  Here's an updated description of the problem:

"I measured my screen. The viewing area is 32cm wide and like 25 and a
half cm tall.
This 1280x960 stetches everything vertically and leaves two big black
strips up the side of the screen. You'd think it would do the
opposite.."

So it sounds like the driver (or server) is picking an inappropriate modeline.


# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "InputDevice"
	Identifier	"Generic Keyboard"
	Driver		"kbd"
	Option		"XkbRules"	"xorg"
	Option		"XkbModel"	"pc105"
	Option		"XkbLayout"	"us"
EndSection

Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	Option		"CorePointer"
EndSection

Section "Device"
	Identifier	"Configured Video Device"
EndSection

Section "Monitor"
	Identifier	"Configured Monitor"
EndSection

Section "Screen"
	Identifier	"Default Screen"
	Monitor		"Configured Monitor"
	Device		"Configured Video Device"
EndSection

Section "ServerLayout"
	Identifier	"Default Layout"
	Screen		"Default Screen"
EndSection
Comment 6 Alex Deucher 2008-08-23 07:56:06 UTC
The server is injecting that mode.  It's technically valid based on the sync ranges reported by the monitor.  I guess ideally the server should not inject any modelines if the output has an EDID.
Comment 7 Ethan Anderson 2008-08-23 08:58:29 UTC
A circle is a circle on the monitor when it's 1280x1024, with the
other one it's kinda stretched.
Also, 1280x1024 is simply more information being sent to the screen.
Why on earth would I want to use a resolution /less/ than my screen
supports?
There's people out there with 2560x1600 LCD's, and I have this
pathetic CRT, the least I can do is use it to its fullest potential.

"You can use the preferred mode option in your monitor section to
hardcode your preferred mode if you don't like what the xserver
picks."
Sometimes a problem is so complicated that it comes down to personal
preference.  This is not one of those times.
1280x1024 is the -correct- resolution for my setup.

"1280x960 is a valid mode based on the sync ranges provided and it's
actually 4:3 whereas 1280x1024 is not"
My physical hardware is 5:4 aspect ratio, not 4:3.  If you have
something against 5:4, please take it up with the manufacturers, not
the end users.
Comment 8 Ethan Anderson 2008-08-23 08:58:34 UTC
Julien, what is it you want me to do exactly?  I have Ubuntu 8.10
alpha4 on a LiveCD..
Comment 9 Ethan Anderson 2008-08-23 11:30:36 UTC
"It's technically valid based on the sync ranges reported by the monitor."

I thought the only thing worse than display EDID accuracy was ACPI..
Comment 10 Alex Deucher 2008-08-23 13:38:43 UTC
(In reply to comment #7)
> A circle is a circle on the monitor when it's 1280x1024, with the
> other one it's kinda stretched.
> Also, 1280x1024 is simply more information being sent to the screen.
> Why on earth would I want to use a resolution /less/ than my screen
> supports?
> There's people out there with 2560x1600 LCD's, and I have this
> pathetic CRT, the least I can do is use it to its fullest potential.
> 

You can.  Just add the preferred mode to your config and be done with it. or change it on the fly with xrandr:
xrandr --output VGA-0 --mode 1280x1024

> "You can use the preferred mode option in your monitor section to
> hardcode your preferred mode if you don't like what the xserver
> picks."
> Sometimes a problem is so complicated that it comes down to personal
> preference.  This is not one of those times.
> 1280x1024 is the -correct- resolution for my setup.

How is this not one of those times?  You monitor is a CRT and does not list a preferred mode, so it comes down to what mode should be picked.  Most people would say 1280x1024@60hz is pretty rough on the eyes.  I would argue that based on your monitor's EDID, 1024x768@85hz would be the preferred mode.  1280x960 happens to be right in the middle.  Some people like 800x600.  That's why there is a preferred mode option.
Comment 11 Ethan Anderson 2008-08-23 16:00:44 UTC
Naturally if I had it installed instead of just booting the livecd 75
times, I wouldn't mind such a simple modification...
(I don't like trusting my life to a partitioner in an alpha OS)

"Most people would say 1280x1024@60hz is pretty rough on the eyes.  I
would argue that based on your monitor's EDID, 1024x768@85hz would be
the preferred mode.  1280x960 happens to be right in the middle.  Some
people like 800x600.  That's why there is a preferred mode option."

'Oh gee, they didn't sell pathetic enough displays at Wal-Mart, looks
like I'll have to get this ok one and set it down to youtube
resolution.'
I'll take your word that those people exist, I've never met one.  ..I
can see that having a GUI that's not zoomable can really be a pain
with any kind of decent display, but .svg icons should do a lot to
help us out there.

My only argument now is that more people will /prefer/ 1280x1024 on
this display than won't, and because of that, it should be the default
resolution..

Sorry for getting snappy, I hear people who hold things in become mass
murderers.  I'm a quiet, friendly guy who always keeps to himself but
lends a helping hand when people need it, so I figure the risk factors
are already stacked against me.
Comment 12 Ethan Anderson 2008-08-23 16:05:34 UTC
/me shakes fist at vendors who use incomplete and/or erroneous EDID
Comment 13 Ethan Anderson 2008-08-23 16:18:02 UTC
Quick addendum:
"I would argue that based on your monitor's EDID, 1024x768@85hz would
be the preferred mode."
If I had a GPU that didn't completely suck, I would most certainly
want to use that mode for OpenGL applications.  85 FPS would be
awesome.
As it stands, Firefox gains a lot more from those extra pixels than it
does from being painted at 85 Hz.
Also, it's trivial for games to change the screen mode, they do it all
the time, I may even have tremulous set to 1024x768@85Hz.

Let's forget all this for a second and say that I want the 1280x960 resolution.
...you know, if it didn't stretch everything insanely, I probably
wouldn't have even noticed in the first placed, and also, even if I
had, probably not have cared that much.

If this bug is fixed only by making 1280x960 work properly by default,
I'll be content.

And just as a final note, all politics and technical arguments aside,
you guys rock, your work is amazing, I'm very, very grateful for all
the time you spend on these drivers and I think many other people are
too.  Don't let the minutiae get you down.
Comment 14 Roland Scheidegger 2008-08-23 17:48:52 UTC
(In reply to comment #7)
> "1280x960 is a valid mode based on the sync ranges provided and it's
> actually 4:3 whereas 1280x1024 is not"
> My physical hardware is 5:4 aspect ratio, not 4:3.  If you have
> something against 5:4, please take it up with the manufacturers, not
> the end users.
Sure about that? I've never seen a CRT which has a 5:4 aspect ratio. Maybe they exist as some specialty items but certainly usual (non-widescreen) crts are all 4:3.
And I'd have to agree default mode on CRTs should be any mode which uses more than 60Hz. Maybe it doesn't bother you, but I know a lot of people (me included...) which will get killed by the annoying flicker within minutes :-).

Comment 15 Ethan Anderson 2008-08-23 23:10:10 UTC
I think I posted this on the bug in Ubuntu, not freedesktop.org, but I
measured my screen viewing area with a ruler, and it is exactly 5:4.
Comment 16 James Cloos 2008-08-24 12:50:29 UTC
> I’ve never seen a CRT which has a 5:4 aspect ratio.

There were several on the market back when 1280x1024 was a top-notch resolution.

At that time, only the Mac-specific monitors in that pixel-class were
designed for 1280x960.  Everyone else went for a 5x4 1280x1024.

(I once drove one such monitor at 1168x930 — 1160x928 with a few extra
pixels horizontally because the card required a width divisible by 16
and a couple of extra lines just because I could — to get a better-than-
60 Hz refresh rate.)
Comment 17 Alex Deucher 2008-08-24 14:48:32 UTC
Update your monitor and screen sections like so:

Section "Monitor"
        Identifier      "VGA-0"
        Option          "DPMS"
        Modeline "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060 -hsync +vsync
        Option "PreferredMode" "1280x1024_60.00"
EndSection


Section "Screen"
        Identifier      "Default Screen"
        Monitor         "VGA-0"
        Device          "Configured Video Device"
EndSection

That will select 1280x1024 @ 60hz as your default mode.
Comment 18 Roland Scheidegger 2008-08-25 07:24:58 UTC
(In reply to comment #16)
> > I’ve never seen a CRT which has a 5:4 aspect ratio.
> 
> There were several on the market back when 1280x1024 was a top-notch
> resolution.
> 
> At that time, only the Mac-specific monitors in that pixel-class were
> designed for 1280x960.  Everyone else went for a 5x4 1280x1024.
Well everybody used 1280x1024, but I'm not too sure that the monitors were really 5:4. I've got a 19" CRT here for instance which clearly is 4:3, and there were lots of similar monitors around that time. And especially the cheaper ones, while they could run 1600x1200, it was unusable due to fuzziness and restriction to 60Hz, so everybody just used 1280x1024 on them. But you may be right some might indeed have been 5:4. Anyway, even if the monitor in question here really is 5:4 physically, there's nothing in the edid data which would indicate this - in fact edid just shows it's 4:3. So there's absolutely nothing the driver could do to figure out it should indeed chose a 5:4 resolution by default.
Comment 19 Ethan Anderson 2008-08-25 10:27:54 UTC
> Well everybody used 1280x1024, but I'm not too sure that the monitors were
> really 5:4. I've got a 19" CRT here for instance which clearly is 4:3, and
> there were lots of similar monitors around that time. And especially the
> cheaper ones, while they could run 1600x1200, it was unusable due to fuzziness
> and restriction to 60Hz, so everybody just used 1280x1024 on them. But you may
> be right some might indeed have been 5:4.
Yes, as I said, I measured it.

>Anyway, even if the monitor in
> question here really is 5:4 physically, there's nothing in the edid data which
> would indicate this - in fact edid just shows it's 4:3. So there's absolutely
> nothing the driver could do to figure out it should indeed chose a 5:4
> resolution by default.

Keep a database of accurate EDIDs to use for all known monitors.
I thought you guy already did something like this.  I was always under
the impression that monitor EDIDs in general have never been accurate
at all, this reaffirms that.
Comment 20 Alex Deucher 2009-11-11 10:26:27 UTC
This is not actually a radeon issue, but an xserver issue as it picks the mode.
Comment 21 Adam Jackson 2018-06-12 18:43:25 UTC
Mass closure: This bug has been untouched for more than six years, and is not obviously still valid. Please file a new report if you continue to experience issues with a current server.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.