Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 157596 - rhpl.xhwstate seems to be sorting the available X resolution modes incorrectly
Summary: rhpl.xhwstate seems to be sorting the available X resolution modes incorrectly
Alias: None
Product: Fedora
Classification: Fedora
Component: rhpl
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Chris Lumens
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-05-13 00:41 UTC by Jef Spaleta
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-05-24 18:46:09 UTC

Attachments (Terms of Use)
Patch to sort X modes by width then height instead of area (deleted)
2005-05-14 14:07 UTC, Jef Spaleta
no flags Details | Diff

Description Jef Spaleta 2005-05-13 00:41:47 UTC
Description of problem:
when using system-config-display on my hardware i get the modelist
['640x480', '800x600', '1024x768', '1152x768', '1152x864', '1280x800',
'1280x960', '1280x1024', '1400x1050', '1680x1050', '1600x1200', '1920x1200']

This sorts '1680x1050' smaller than '1600x1200' and as a result when i request
'1600x1200' my xorg.conf Display sections looks like:

Modes    "1600x1200" "1680x1050" "1400x1050" "1280x1024" "1280x960" "1280x800"
"1152x864" "1152x768" "1024x768" "800x600" "640x480"

The problem is X sees the "1680x1050" mode as larger than "1600x1200"
and sets the virtual resolution to "1680x1050" and the physical resolution to 

End result..the X display is 80 pixels too wide for the physical display of 1600
 and the precious 80 edge pixels of the display fall outside the physical extent
of the monitor. 

Expected results:
X seems to be sorting modes by width and not by area. If the output of 
XF86HardwareState from the rhpl package would sort by width then height, that
should fix the consistency issue with how X does its sorting of the Modes line. 

When i choose the 1600x1200 in system-config-display i should see:
Modes    "1600x1200" "1400x1050" "1280x1024" "1280x960" "1280x800" "1152x864"
"1152x768" "1024x768" "800x600" "640x480"

And when i choose 1680x1050 i should see:
Modes    "1680x1050" "1600x1200" "1400x1050" "1280x1024" "1280x960" "1280x800"
"1152x864" "1152x768" "1024x768" "800x600" "640x480"

to make sure X chooses the correct virtual resolution to match the selected
physical resolution.

More info:
Here's the low level python run outside of s-c-display
>>> from rhpl.xhwstate import *
>>> import xf86config
>>> (xconfig, path) = xf86config.readConfigFile()
>>> state = XF86HardwareState(xconfig)
>>> print state.available_resolutions()
['640x480', '800x600', '1024x768', '1152x768', '1152x864', '1280x800',
'1280x960', '1280x1024', '1400x1050', '1680x1050', '1600x1200', '1920x1200']

Please let me know if you need me to provide any more info.


Comment 1 Gene Czarcinski 2005-05-13 18:47:01 UTC
My temporary way of getting around this is to manually edit /etc/X11/xorg.conf
and remove the "1680x1050" entry ... everything looks OK then.

I am glad to see 1680x1050 supported (for my wide screen laptop) but the aspect
ratio for 1600x1200 and 1680x1050 are very different.

The "proper" way to fix this is to only list those entries which correspond with
the aspect ratio of the display/monitor you have but ... that might be very
difficult to do on a reliable basis.

Comment 2 Jef Spaleta 2005-05-13 19:26:12 UTC
following up on comment #1

I have a better idea.. though it might fall into the category or RFE.  
When s-c-display write the xorg.conf it could exclude any modes that do not
match the aspect ratio of the selected mode.  Sort of a separate issue than the
underlying problem about sort order. How rhpl is sorting modes is inconsistent
with how X sorts modes on start-up, but excluding modes that have a different
aspect ratio than the one selected would effectively make this problem disappear
from end-user view.

I'll happily refile this idea as an RFE against whichever component is most
appropriate, if that is desirable.

Comment 3 Jef Spaleta 2005-05-14 14:07:19 UTC
Created attachment 114381 [details]
Patch to sort X modes by width then height instead of area

X seems to parse the mode list in the xorg.conf file by width then height.
wider resolutions sort as larger.  This patch makes the compare_resolution
function sort the available X modes in the same way. this should prevent modes
appearing in the wrong order in the x conf file and should keep the virtual
resolution equal to the selected physical resolution when using s-c-display.

Comment 4 Jef Spaleta 2005-05-14 14:10:02 UTC
Oh crap.. sorry...
comment #3 is a patch against 

Comment 5 Chris Lumens 2005-05-16 15:56:34 UTC
Fixed in CVS.  Thanks for the patch.

Comment 6 Jef Spaleta 2005-05-18 23:01:33 UTC
applied today's rawhide update... and thinks look better.
system-config-display is now showing things in the right order and the generated
xorg.conf has the right order as well.

Note You need to log in before you can comment on or make changes to this bug.