Bug 157596

Summary: rhpl.xhwstate seems to be sorting the available X resolution modes incorrectly
Product: [Fedora] Fedora Reporter: Jef Spaleta <jspaleta>
Component: rhplAssignee: Chris Lumens <clumens>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: gczarcinski, sandmann, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-24 18:46:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to sort X modes by width then height instead of area none

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 
"1600x1200". 

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.

-jef

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 
/usr/lib/python2.4/site-packages/rhpl/xhwstate.py



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.