LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   CentOS Display Problems, your display needs tweaking, here you go, no xrandr needed.. (https://www.linuxquestions.org/questions/linux-desktop-74/centos-display-problems-your-display-needs-tweaking-here-you-go-no-xrandr-needed-4175421160/)

damiank 08-09-2012 02:14 AM

CentOS Display Problems, your display needs tweaking, here you go, no xrandr needed..
 
I was goint to post this as a question earlier for a xRandr Guru, I needed a transformation to allow my desktop to be shifted ever so slightly to the left, perhaps by maybe 8 pixels or so.

After trying a few of the xRandr transformations I quickly realized that they we're very CPU/GPU intensive. So, I went back to my grass roots and did it the best way, the modeline way, which, btw I would have never had to do if the RHEL people had some common sense and kept the nice and easy to use graphical video config tool in RHEL/CentOS. But, no, they decided to let HAL (Quite a name) provide all the config info on the fly, WHICH BTW means you can NEVER DISABLE IT NOW, because it won't be able to feed input into Xorg, and you will have no inputs if you disable the daemon. So, not only did we lose the video tweaking, we lost the ability to disable a resource hogging service.

So RHEL has decided to let HAL (appropriate name;), and let DDC, and EDID info supply everything needed which of course is a very bad idea to do exclusively, meaning, that if they we're going to remove a very highly used tool and go the fully automated way of X Config, they should have had the common sense to make it "Optional", so during install the user could simply pick "Include Nice GUI Tools and Normal XConfig" or "Do Automated Luck of the Draw XConfig and hope for the best"? (1) (2) and let the user select the high road or the road to doooom.

Then, there would be a zillion less posts online regarding video problems. But, no, they decided to go full auto in a single release. What a massive mistake, even after their list was full of community developers screaming/ranting about it. Anyway, Linux is NOT Windows. I think RedHat forgets that over at corporate, but, anyway this is about fixing a common problem these days.

So, I installed CentOS 6.3 today, and my "screen" was too far to the right, this, when I maximize Chrome/Firefox, I have no scrollbar, it's cutoff. So, I quickly launched "xvidtune" to move the screen a few clicks, and discovered this entire mess that RHEL has gotten us into.

To fix this problem, we first startup xvidtune, and do the following:

1) Run xvidtune in your xwindows, from the Gnome Terminal (this is important since you'll get your settings from the command line).
Note: Install xorg-x11-apps if you don't have xvidtune, using:
yum install xorg-x11-apps

2) A gui should popup, you should be able to see your Console window where you ran it from and go ahead and click "Show". This shows your current virtual modeline. Also, take note of your hsync and csync values in the console just above the current modeline.

3) Now, this process takes a bit of trial and error, but works, so click whatever you need to do on the GUI, if you want to move your screen just a tiny bit to the left, click the left button once. If it's a few pixels off, click it twice. Right after clicking the direction or width button(s), click "Show" and copy and paste this into a file. Just open another terminal, run VI/nano and highlight the modeline with the mouse, the bottom one, and middle button or Shift+Insert the text into Vi/nano in the new console window, and save it to /tmp, call it whatever you can remember. Also copy the hsync and vsync values. This will be your first modeline to try, then if it's perfect, your done, if not, repeat the xvidtune procedure changing your modeline to the new values that show up after clicking the direction and "Show" until your display is perfectly aligned.

4) Time to generate your initial xorg.conf file. Type init 3 in the console after making sure you saved the modeline you pasted in step 3. You are now at a console login prompt, go ahead and login as root.

5) cd /tmp and type Xorg -configure this will write an xorg.conf file out in the present directory. It will probably crash and give you errors, but, what is in the file is perfect for what you need.

6) copy the file to /etc/X11/xorg.conf and then open it in an editor. To make life easier, go ahead and do a service gpm start to make the mouse work in the console so you can flip back and forth copying and pasting by highlighting and hitting the middle button. Not there?? yum install gpm;service gpm start

7) Hit Alt+F2 to goto the second tty and login and open /var/log/Xorg.0.log with an editor. Now start going through it and look at the parts where it is loading stuff from a config file, virtually of course. You will see that all your screens and devices located inside the xorg.conf file are also inside this virtual file inside the log. Just make sure your fbdev/fb/vesa/ati/nvidia drivers match. This will ensure you've got all your devices inside your generated xorg.conf file.

8) If missing a 'Section "Device"' section, add the entire section to your xorg.conf, along with the 'Section "Screen"' section that goes with it. You shouldn't be missing any however, so be sure.

9) Now look for the line that says: ModulePath set to "/usr/lib(64)/xorg/modules" abd start copying and pasting each module that gets loaded, in order, from the logfile into your xorg.conf file in the modules section. So, if you see LoadModule: "extmod" first, make sure you load that first in your xorg.conf. LEAVE DDC OUT!! Heres my modules section:

Section "Module"
Load "extmod"
Load "dbe"
Load "glx"
Load "record"
Load "dri"
Load "dri2"
Load "ati"
Load "radeon"
Load "vesa"
Load "fbdev"
Load "fb"
Load "ramdac"
Load "exa"
Load "evdev"
EndSection

9) Somewhere inside the log file towards the end maybe the graphics card will pick the proper display geometry for the screen. Go ahead and copy that over to the xorg.conf file and comment it with a '#' sign for later use. It looks like this:

clock: 146.2 MHz Image Size: 434 x 270 mm <<< note: sometimes cards change the size after 3D init, so also look for something like this:
RADEON(0): Setting screen physical size to 444 x 277 towards the end, by the 3D stuff. Use that last geometry setting your card makes and copy it to xorg.conf.

10) Now that you've got your modules all setup, go ahead and create the modeline from before. Close the log file, open up that modeline file you saved earlier and build this into your 'Section "Monitor"' section for "Monitor0", it shouold look something like this:

Section "Monitor"
Identifier "Monitor0"
DisplaySize 444 277
VendorName "Monitor Vendor"
ModelName "Monitor Model"
Option "DPMS"
HorizSync 30.00 - 83.00
VertRefresh 56.00 - 76.00
Modeline "NativeRes" 146.25 1680 1796 1972 2240 1050 1053 1059 1089 -hsync +vsync
Option "PreferredMode" "NativeRes"
EndSection

As you can see here, it is very self explanatory, I just created a modeline called NativeRes and made it "preferred". I put in the hsync and vsync and Geometry settings and DPMS. The geometry and clock settings are crucial if you want 3D rendering to work properly.

Note on 3D rendering, if you have an ati/amd card and are using the mesa drivers, then you may need to add this to your 'Section "Device"' for the card (the section with the "radeon" driver)
Option "IgnoreEDID" "True" # [<bool>]
Option "AccelMethod" "EXA"
Option "MigrationHeuristic" "greedy"
Option "NoDDC" "True"

Then, in the Screen section labeled with Identifier "Screen0" add the modeline name to your Display subsection with the highest "Depth" value, so it looks like this:

SubSection "Display"
Viewport 0 0
Depth 24
Modes "NativeRes"
EndSubSection

One last thing, make sure the top of the config is proper, sometimes it may get generated imporperly for multiple monitors and you may only be using one, if this is the case, a single monitor is all you need, just make it look like this:

Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1"
Screen 2 "Screen2"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

That should do it. Go ahead and save your xorg.conf file.

type startx, and see what happens.

If the screen lines up perfectly, your done, logout, login as a regular user, and type init 5.

Or if it's still messed up, like I said above, you juse have to run xvidtune again, click the direction/width/etc a couple times and click "show" and change the modeline in xorg.conf, logout, and type startx again.

It took me 3 startx's to get it right.

Here is my entire xorg.conf file:

ection "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1"
Screen 2 "Screen2"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
# 32bit only ModulePath "/usr/lib/xorg/modules"
ModulePath "/usr/lib64/xorg/modules"
FontPath "catalogue:/etc/X11/fontpath.d"
FontPath "built-ins"
EndSection

Section "Module"
Load "extmod"
Load "dbe"
Load "glx"
Load "record"
Load "dri"
Load "dri2"
Load "ati"
Load "radeon"
Load "vesa"
Load "fbdev"
Load "fb"
Load "ramdac"
Load "exa"
Load "evdev"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
Identifier "Monitor0"
# DisplaySize 434 270
DisplaySize 444 277
VendorName "Monitor Vendor"
ModelName "Monitor Model"
Option "DPMS"
HorizSync 30.00 - 83.00
VertRefresh 56.00 - 76.00
Modeline "NativeRes" 146.25 1680 1796 1972 2240 1050 1053 1059 1089 -hsync +vsync
Option "PreferredMode" "NativeRes"
EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Monitor"
Identifier "Monitor2"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Device"
Option "IgnoreEDID" "True" # [<bool>]
Option "AccelMethod" "EXA"
Option "MigrationHeuristic" "greedy"
Option "NoDDC" "True"
Identifier "Card0"
Driver "radeon"
BusID "PCI:1:0:0"
EndSection

Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "ShadowFB" # [<bool>]
#Option "Rotate" # <str>
#Option "fbdev" # <str>
#Option "debug" # [<bool>]
Identifier "Card1"
Driver "fbdev"
BusID "PCI:1:0:0"
EndSection

Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "ShadowFB" # [<bool>]
#Option "DefaultRefresh" # [<bool>]
#Option "ModeSetClearScreen" # [<bool>]
Identifier "Card2"
Driver "vesa"
BusID "PCI:1:0:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
Modes "NativeRes"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
Modes "NativeRes"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
Modes "NativeRes"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
Modes "NativeRes"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
Modes "NativeRes"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
Modes "NativeRes"
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Section "Screen"
Identifier "Screen2"
Device "Card2"
Monitor "Monitor2"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection


Now you should be all set. Enjoy your tweakable Xwindows. Now you can setup different modes, and hotkey switch between different resolutions like in the good old days when RHEL had a good Xwindows thing going. (I'm hoping they bring it back)

Enjoy!!

Damian Kohlfeld


All times are GMT -5. The time now is 01:27 PM.