Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Desktop Effects & Customization
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Desktop Effects & Customization
This section is for all your compositing needs. This includes Beryl, Compiz, xcompmgr, and other fancy apps which take advantage of compositing managers such as kiba-dock and avant window decorator

 
Thread Tools Display Modes
Old October 19th, 2007   #1
BungaMan
Gee! These Aren't Roasted!
 
Join Date: Oct 2005
Beans: 163
Tips for Gutsy Xrandr compiz radeon driver dual screen

This stuff is not for beginners. If you don't know much about this then don't try it. If you do then it's up to your own responsibility if your system gets broken so you are warned in advance !

This is entirely written for my situation which is: Try to use dual screen with AIGLX, open source radeon driver and compiz. My setup is a laptop with radeon mobility 9600 and an external connected CRT screen.

1. If you upgraded from Feisty to Gutsy, chances are you also have the Xgl package (xserver-xgl) installed. You better remove this for better performance. It degraded the graphical UI and you don't need it anyway because we will use aixgl.

2. Auto setup of dual screen doesn't work to good for me and the "Screens and graphics" ain't much worth for me either so diving back into xorg.conf. The updated radeon driver doesn't support mergedfb or xinerama anymore so we'll prep xorg.conf for xrandr.

Start with a simple Device section, leave the tweaking for later on
Code:
Section "Device"
	Identifier	"MobRad9600"
	Boardname	"ATI Radeon"
	Busid		"PCI:1:0:0"
	Driver		"radeon"
	Vendorname	"ATI"
EndSection
Now add a Monitor section for each monitor you have attached
Code:
Section "Monitor" 
	Identifier	"Laptop"
	Vendorname	"Generic LCD Display"
	Modelname	"LCD Panel 1280x800"
	Option		"DPMS"
	HorizSync	28-51
	VertRefresh	43-60
EndSection

Section "Monitor"
	Identifier	"CRTThuis"
	Vendorname	"LG"
	Modelname	"CRT 1280x1024"
	Option		"DPMS"
	HorizSync	30-96
	VertRefresh	50-160
	Modeline  "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
EndSection
If you don't know the horizonsync and vertrefresh then you can start without them and hope for decent detection. The modeline in the second monitor isn't necessary either but I'll explain that later. If you absolutely want to add the modeline then run the following command in a terminal.
Code:
more /var/log/Xorg.0.log | grep "Modeline \"1280x1024\" "
Replace the resolution with the one you are looking for. Note that a monitor can have multiple modelines, each will give you a different refresh rate. More so, with 2 monitors supporting the same resolution you will have the modelines of each so be careful here. To be sure, open up Xorg.0.log in gedit and look for the lines. See for which monitor they are generated. You will need the right modeline afterwards for xrandr.

Now setup the Screen section
Code:
Section "Screen"
	Identifier	"Default Screen"
	Device		"MobRad9600"
	Defaultdepth	24
	Monitor		"Laptop"
	SubSection "Display"
		Depth	24
		Viewport	1280 0
		Virtual		2560 1024
		Modes		"1280x1024" "1280x800"
	EndSubSection
EndSection
Only one screen section and we set it up with the default monitor. In my case thats the LVDS of my laptop. Virtual is important, it defines the total horizontal and vertical size of what you are going to look at. I have a CRT at 1280x1024 and a laptop lcd at 1280x800. The crt left of the laptop so that makes 1280+1280=2560 for the horizontal size and 1024 vertically. Not 1824 vertically because the screens are next to each other, not below each other. Viewport will define the position of my default screen in this virtual size. My crt will take up the first 1280 horizontally so the horizontal starting point of my lcd is 1280. 0 for the vertical position because I let both screens align at the top. Modes contains all the resolutions that I will use. Probably isn't needed with xrandr, but this is untested.

Now we still need a serverlayout
Code:
Section "ServerLayout"
	Identifier	"Default Layout"
	Screen		"Default Screen"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
	Option		"AIGLX"		"true"
EndSection

Section "DRI"
	Mode	0666
EndSection

Section "Extensions"
	Option		"Composite"		"Enable"
EndSection
Make sure that the AIGLX is there and set to true. I don't kow if the DRI section is necessary but it works when it is there, same for Composite

My xorg.conf is attached for reference.

3. That should do it for xorg.conf but it doesn't make dual screen work yet. So let's see how we can get xrandr to do its job properly.

Let's query for some info in a console
Code:
xrandr -q
It will show you the detected resolutions for each connector (VGA-0 and LVDS in my case). For my CRT, the 1280x1024 resolution was not detected but my monitor sure can handle it so I instruct xrandr to add this "mode". This is where the detected Modelines are needed from Xorg.0.log. The example will make it clear.
Code:
 xrandr --output VGA-0 --newmode "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
As you can see, I'm telling xrandr to add a new mode to connector VGA-0. I'm giving the mode the name "1280x1024" but you can call it "monkeyres" for example The rest of the parameters are taken from the Modeline as you know by now.

This is not enough, newmode is for adding a supported resolution. Now we have to tell to actually use that resolution.
Code:
xrandr --addmode VGA-0 "1280x1024"
The example is pretty much self explainatory now.

Now we are ready to activate dual screen properly compared to the clone mode you may have right now.
Code:
xrandr --output VGA-0 --left-of LVDS --mode 1280x1024
This is also easy to understand. Tell xrandr that I want to have VGA-0 positioned left of LVDS (my laptop lcd) and use mode name 1280x1024 for VGA-0.

Because xrandr is all about dynamic setup, your setup ain't going to last after a reboot so I made a little script that detects if my desired mode is added and executes the above commands if necessary. Then added the script to my session and each time I log on I have a dual screen started.

This is the content of the script
Code:
#!/bin/sh

if ! xrandr -q | grep -q "VGA-0 connected 1280x1024" ; then
        xrandr --output VGA-0 --newmode "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
fi

xrandr --addmode VGA-0 "1280x1024"
xrandr --output VGA-0 --left-of LVDS --mode 1280x1024
Now lets get compiz started. Try running the following command in a terminal.
Code:
compiz --replace &
It is possible that due to the dual screen setup, you now have a screen that is too large for the maximum texture size.

4. To solve the maximum texture size problem, first of all add support for large textures in DRI. Install driconf and then check in your home dir for the file ".drirc". If it doesn't exist then you may need to run driconf once. In the file add a node for allow_large_textures.
Code:
<driconf>
    <device screen="0" driver="r300">
        <application name="Default">
            ...other options...
            <option name="allow_large_textures" value="2" />
        </application>
    </device>
</driconf>
Good, now this won't run compiz. Compiz checks for the opengl parameters. In my case the maximum supported texture size is 2048x2048. As you know my virtual area is 2560x1024 so that's a bit out of range. For some background info... compiz makes textures of everything, programs, task bars at the top, your wallpaper, etc.

5. Let's make compiz not check for the texture size. DO THIS ON YOUR OWN RISK. The effect for me is that texturizing my background fails so I have a white are for the supported texture size and for the desktop area that is out of range, I get a funky disfunctional area that I can live with If you stretch a program across your dual screen, you'll notice that at one point it will be blank until you resize it back within your maximum texture size.

So... edit /usr/bin/compiz and comment out "return 1;" in the following function. Should be at line 231.
Code:
# Check if the max texture size is large enough compared to the resolution
check_texture_size()
{
	TEXTURE_LIMIT=$(glxinfo -l | grep GL_MAX_TEXTURE_SIZE | sed 's/.*=[^0-9]//g')
	RESOLUTION=$(xdpyinfo  | grep -i dimensions: | sed 's/[^0-9]*pixels.*(.*).*//' | sed 's/[^0-9x]*//')
	VRES=$(echo $RESOLUTION | sed 's/.*x//')
	HRES=$(echo $RESOLUTION | sed 's/x.*//')
	verbose "Comparing resolution ($RESOLUTION) to maximum 3D texture size ($TEXTURE_LIMIT): ";
	if [ $VRES -gt $TEXTURE_LIMIT ] || [ $HRES -gt $TEXTURE_LIMIT ]; then
		verbose "Failed.\n"
#		return 1;
	fi
	verbose "Passed.\n"
	return 0
}
Commenting it out will keep everything OK except that it will not return a failure but just continue. This is a bit dirty but for now the easiest.

Save the file and try again to run "compiz --replace &" in a terminal.

I hope that works for you or at least give you a clue on where to look.

[edit]updated some info
Attached Files
File Type: txt xorg.conf.txt (2.5 KB, 323 views)

Last edited by BungaMan; October 23rd, 2007 at 03:05 PM..
BungaMan is offline   Reply With Quote
Old October 20th, 2007   #2
justmehere
Spilled the Beans
 
Join Date: Oct 2005
Beans: 14
Smile Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

Thank you. After several days of trauma these tips helped me get my screens working properly again. I've got a radeon X700 and 2 Samsung SyncMaster 225bws (DVI-0 and VGA-0). Following these tips and setting the virtual size to 3360x1050 I've now got them working in a similar way to Xinerama. Having followed the tips I did

xrandr --q
xrandr --auto
xrandr --output VGA-0 --pos 1680x0
xrandr --output VGA-0 --mode 1680x1050

and it all works.

:¬}
justmehere is offline   Reply With Quote
Old October 20th, 2007   #3
cygnis1
Gee! These Aren't Roasted!
 
cygnis1's Avatar
 
Join Date: May 2007
Beans: 186
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

How do I remove xserver-xgl ?
Cygnis1
cygnis1 is offline   Reply With Quote
Old October 21st, 2007   #4
BungaMan
Gee! These Aren't Roasted!
 
Join Date: Oct 2005
Beans: 163
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

I'm using a dutch version so this is translated out of my head. It could be a bit different.

system -> Management -> Synaptic package management

Search for xserver-xgl and remove it.
BungaMan is offline   Reply With Quote
Old October 23rd, 2007   #5
BungaMan
Gee! These Aren't Roasted!
 
Join Date: Oct 2005
Beans: 163
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

In the attachment you have my updated xorg.conf

It contains modification so that X starts up with dual head from the start. The trick is to define the monitors for the connectors in the driver section.
Attached Files
File Type: txt xorg.conf.txt (2.9 KB, 486 views)
BungaMan is offline   Reply With Quote
Old October 24th, 2007   #6
pdelgado
First Cup of Ubuntu
 
Join Date: Oct 2007
Beans: 1
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

Thank you so much for your tips.. I finally got both monitors working...

the only problem I've got now is that the wallpaper isn't displayed and my right monitor shows a black block (rectangle) yet I CAN place windows in that area.

I'm assuming the problem is with the texture size... any ideas how to fix that?
pdelgado is offline   Reply With Quote
Old October 24th, 2007   #7
BungaMan
Gee! These Aren't Roasted!
 
Join Date: Oct 2005
Beans: 163
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

yes that is because it fails to generate a texture for your desktop area. For the maximum size you'll get the white area and the right most becomes an area that is never cleared in memory. Hence the effect you notice when moving stuff around in that area.
BungaMan is offline   Reply With Quote
Old October 25th, 2007   #8
gtducati
First Cup of Ubuntu
 
Join Date: May 2007
Beans: 8
Ubuntu 7.10 Gutsy Gibbon
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

For anyone interested, this is the cleanest working xorg.conf file I have finally assembled to handle the dual monitor issue with Gutsy using the ATI driver. The order of the device, monitor and screen sections apparently is important (after much wasted time struggling to figure it all out). I'm posting links below as they helped me arrive at a solution.

http://wiki.debian.org/XStrikeForce/HowToRandR12
http://www.intellinuxgraphics.org/dualhead.html

My configuration is as follows:
Dell Precision Workstation 320 w/
Two Dell 20" Flat Panels (max. combined res: 3200x1200)

Details can be seen in the attached file.
Attached Files
File Type: txt xorg.txt (3.1 KB, 452 views)
gtducati is offline   Reply With Quote
Old October 25th, 2007   #9
BungaMan
Gee! These Aren't Roasted!
 
Join Date: Oct 2005
Beans: 163
Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

The order of the sections is not important. What would have been the issue if the order was not correct?
BungaMan is offline   Reply With Quote
Old October 25th, 2007   #10
userid
Just Give Me the Beans!
 
userid's Avatar
 
Join Date: Aug 2006
Beans: 68
Smile Re: Tips for Gutsy Xrandr compiz radeon driver dual screen

Radeon 9700

Thanks for your clean xorg.conf.. have had a nightmare so far, only occurred to me v late that mergedfb is deprecated. No luck with proprietary AMD drivers either.

Now I got it working on randr, dual head WITH direct rendering; only problem are full-screen applications that "crash" randr and re-set it to clone mode.

As randr appears to be rather new, I havent found any appropriate guides on this subject..
userid is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:27 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry