Logo de ce site

Accueil > GnuLinux Debian/Ubuntu > Configurer Xorg

Configurer Xorg

mardi 7 septembre 2010

Copie pour usage perso de la page du forum ubuntu

http://ubuntuforums.org/showthread.php?t=1346125

HOWTO : How I solved my Karmic resolution problem
I have an Acer 24" monitor plugged into my laptop, Karmic only offered me the choices of 1152x864 and 1920x1080, but I wanted 1440x900 like I used to have.
I have Intel 945GM/GMS (or similar) integrated graphics.
Here’s my fix :

1) Get the settings you’ll need later :

$ cvt 1440 900

That command gives output similar to this :
# 1440x900 59.89 Hz (CVT 1.30MA) hsync : 55.93 kHz ; pclk : 106.50 MHz
Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
Note : any text below this in green is copy-pasted from the output of the previous line

$ xrandr

Gives output similar to this :

Screen 0: minimum 320 x 200, current 1152 x 864, maximum 4096 x 4096
VGA1 connected 1152x864+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.0 +
1152x864 75.0
LVDS1 connected (normal left inverted right x axis y axis)
1024x768 85.0 75.0 70.1 60.0
640x350 85.1

You can see I have two screens : VGA1 (my monitor) and LVDS1 (my laptop). Yours may be named something else, substitute names below accordingly - highlighted in purple

2) Testing - making sure the target resolution will work.

$ xrandr —newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync <— green stuff copied from step 1 output

$ xrandr —addmode VGA1 1440x900_60.00

$ xrandr —output VGA1 —mode 1440x800_60.00 —output LVDS1 —off

Note : the grey stuff in the last line is only needed if you have a screen plugged into a laptop and want to turn the laptop screen off. Otherwise, leave it out.

At this point, your resolution will have changed (if you can’t see anything hit RightAlt+PrintScreen+K to go back to login.
Note that this resolution change isn’t permanent.
One way to make it permanent is to add the three xrandr lines from step 2 into the file /.xprofile (create it if it doesn’t exist).
That’s not a good way to do it though, so go to step 3+4 for a better but more difficult way to make the change permanent....

3) Create /etc/X11/xorg.conf if it doesn’t exist

Note : this step only necessary if you don’t have the file /etc/X11/xorg.conf
If you already have it go directly to step 4.

Write down these next three lines BEFORE you execute the first one !! :

$ sudo /etc/init.d/gdm stop

The previous line will close down X ; you will now be in a black screen with only a command line. You did write down the next two lines first, didn’t you ?
Login here with your usual name and password.

$ sudo Xorg -configure

$ sudo /etc/init.d/gdm start

The previous line starts X again. Login.

The file /xorg.conf.new has been created. Move it to /etc/X11/xorg.conf :

$ sudo mv /xorg.conf.new /etc/X11/xorg.conf

4) Apply changes to /etc/X11/xorg.conf

$ sudo gedit /etc/X11/xorg.conf

I used https://wiki.ubuntu.com/X/Config/Resolution for this step.

I am not an expert on xorg.conf (not even close), so I’m just showing you my xorg.conf, with all additions by me marked in red (I didn’t remove anything from the file) and then an explanation of each addition below the file.
Note I’m only showing the Monitor, Device, and Screen sections of xorg.conf, as they are the only relevant ones :

Code :

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        Modeline "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync
        Option       "PreferredMode" "1440x900_60.00"
EndSection

Section "Device"
        Identifier  "Card0"
        Driver      "intel"
        VendorName  "Intel Corporation"
        BoardName   "Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
        BusID       "PCI:0:2:0"
        Option  "Monitor0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth    24       
        SubSection "Display"
                Viewport   0 0
                Depth     4
        EndSubSection       
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1440x900" "1024x768" "640x480"
        EndSubSection
EndSection

An explanation of the five lines I added :

1. Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
This is copied and pasted from the output of cvt in step 1.

2. Option "PreferredMode" "1440x900_60.00"
Just using the mode name from the line above this.

3. Option "Monitor0"
Used the Identifier from the Monitor section : "Monitor0"

4. DefaultDepth 24
Pretty obvious ; just choosing which subsection below is default. Choose 24.

5. Modes "1440x900" "1024x768" "640x480"
1440x900 is my target resolution, obviously. The other two are just standard ones that I put in this line for no particular reason.

Once you’ve made your changes to xorg.conf, save it, log out, log back in, then go to

System > Preferences > Display

and you should be able to choose 1440x900 (your resolution) as normal. Success !

5) Conclusion.

That worked for me, I don’t know if it will work for anyone else. I honestly know nothing about xorg.conf, so please don’t ask me for help with it, I can’t help you

Obviously, you need to substitute your own desired resolution for my 1440 and 900.

I think (although I don’t know) that if you’re one of the people limited to 800x600 by Karmic, you have a different problem, and this won’t work for you.

This didn’t solve all my Karmic display woes : Without X, my monitor just smears the display across the screen, in an unreadable mess. I have to rely on my laptop display when this happens. Note that I had this problem before this resolution fix, it’s not a result of anything in this post.
This happens to me on boot (when my laptop shows a white Ubuntu symbol on a black background, but my monitor shows a flickering thin white smear on black), and if I go to tty (eg hit ctrl-alt-F1) my laptop displays it fine, but my monitor just shows a little white garbage on black.