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

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old August 19th, 2006   #1
kpkeerthi
Ubuntu addict and loving it
 
Join Date: Jun 2006
Location: $ pwd _
Beans: 3,974
Ubuntu 9.04 Jaunty Jackalope
HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

About:
1. How to eliminate choppiness and tearing in fullscreen Video/DVD playback and Cube rotation.
2. How to eliminate jaggies from compiz cube and window edges (wobbly plugin) - antialiasing

Prequisites:
1. Nvidia graphics card
2. Binary "nvidia" driver.
3. Ubuntu 6.06
4. Xgl/Compiz

Step 1: Verify OpenGL
Part 1
Open a terminal and do:
Code:
$ glxinfo | grep OpenGL
If you get something similar to:
Code:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce Go 7800 GTX/PCI/SSE2
OpenGL version string: 1.2 (2.0.2 NVIDIA 87.62)
... then proceed to Part 2 of Step 1.

If, otherwise, you see
Code:
OpenGL vendor string: Mesa project: www.mesa3d.org
OpenGL renderer string: Mesa GLX Indirect
OpenGL version string: 1.2 (1.5 Mesa 6.5.1)
... follow instructions here to install "nvidia" binary driver.

Part 2
Now, check if opengl libraries are linked properly:
Code:
$ ls -al /usr/lib/libGL.*
The result should be similar to:
Code:
lrwxrwxrwx 1 root root     19 2006-08-19 09:39 /usr/lib/libGL.so -> /usr/lib/libGL.so.1
lrwxrwxrwx 1 root root     17 2006-07-11 20:08 /usr/lib/libGL.so.1 -> libGL.so.1.0.8762
-rw-r--r-- 1 root root 540136 2006-07-10 07:10 /usr/lib/libGL.so.1.0.8762
Most importantly, you should see the line highlighted above. If not, do
Code:
$ sudo ln -s /usr/lib/libGL.so.1 /usr/lib/libGL.so
Reboot.

Step 2: Eliminate "tearing" in DVD and other video playback
Now that OpenGL has been setup properly, lets get the "tearing" fixed in fullscreen DVD playback.
Part 1
Enable vsync:
Code:
$ gksudo gedit /etc/init.d/gdm
Open the file and locate the line (near line# 37) containing:
Code:
if [ -r /etc/environment ]; then
  if LANG=$(pam_getenv -l LANG); then
    export LANG
  fi
  if LANGUAGE=$(pam_getenv -l LANGUAGE); then
    export LANGUAGE
  fi

fi
Now add
Code:
export __GL_SYNC_TO_VBLANK="1"
above it. It should now look similar to below:
Code:
export __GL_SYNC_TO_VBLANK="1"

if [ -r /etc/environment ]; then
  if LANG=$(pam_getenv -l LANG); then
    export LANG
  fi
  if LANGUAGE=$(pam_getenv -l LANGUAGE); then
    export LANGUAGE
  fi

fi
Save and exit.

Enable tripple buffering in xorg.conf:
Code:
$ gksudo gedit /etc/X11/xorg.conf
Code:
Section "Device"
        Identifier      "NVIDIA Corporation NVIDIA Default Card"
        Driver          "nvidia"
        BusID           "PCI:1:0:0"
        Option          "RenderAccel"   "true"
     Option          "TripleBuffer" "true"
        Option          "NoLogo" 
EndSection
Save and exit. Reboot.

Part 2
Enable opengl driver in your favorite player. I personally prefer Totem-xine.
Code:
$ gedit ./.gnome2/totem_config
Search for video.driver and add
Code:
video.driver:opengl
Save and exit.

Now, play your favorite video/DVD movie fullscreen in Totem-xine and enjoy tearless smooth playback.

Did you notice that cube rotation is also free from tearing? I'm sure you did. If not, try it now.

Step 3: Eliminate jagged cube edges [OPTIONAL]
Its also possible to eliminate the jaggies we get along the edges of the cube. Enable antialiasing by adding
Code:
export __GL_FSAA_MODE="2"
to /etc/init.d/gdm. Reboot. You should now have smooth antialiased cube and window edges. To see it in action, <Ctrl> <Atl> + left click on desktop and drag the mouse. Also dragging the windows by title bar (wobbly) should produce smooth edges.

Here is a setting that works best for me:
Code:
export __GL_SYNC_TO_VBLANK="1"
export __GL_FSAA_MODE="4"
export __GL_LOG_MAX_ANISO="4"
if [ -r /etc/environment ]; then
  if LANG=$(pam_getenv -l LANG); then
    export LANG
  fi
  if LANGUAGE=$(pam_getenv -l LANGUAGE); then
    export LANGUAGE
  fi

fi
Refer to OpenGL Environment Variable Settings for more information.

EDIT:
This guide also helps improving the cool animations available in the latest version of compiz (quinn's). Try it to belive it.
__________________

Last edited by kpkeerthi; September 25th, 2006 at 12:20 AM.. Reason: Typo corrections
kpkeerthi is offline   Reply With Quote
Old August 19th, 2006   #2
lordsavant
First Cup of Ubuntu
 
Join Date: May 2006
Beans: 6
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Will ATI cards work with this tutorial past step 2 with the ATI binary drivers? Thanks!
lordsavant is offline   Reply With Quote
Old August 19th, 2006   #3
kpkeerthi
Ubuntu addict and loving it
 
Join Date: Jun 2006
Location: $ pwd _
Beans: 3,974
Ubuntu 9.04 Jaunty Jackalope
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Unfortunately, no. The environment variables are nvidia specific.
__________________
kpkeerthi is offline   Reply With Quote
Old August 24th, 2006   #4
neikous
First Cup of Ubuntu
 
Join Date: Jul 2006
Beans: 7
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Hm, I did everything this said, but I still have tearing in cube and wobbly. Any ideas?

I've got a PCI-E 7900 GT OC, 4 GB DDR2 4200 ram, dual 250 SATA 7200s, Pentium D 940 - 3.2 GHz.

Everything works great except the vsync.
neikous is offline   Reply With Quote
Old August 24th, 2006   #5
kpkeerthi
Ubuntu addict and loving it
 
Join Date: Jun 2006
Location: $ pwd _
Beans: 3,974
Ubuntu 9.04 Jaunty Jackalope
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Can you post the output of
Code:
$ glxinfo | grep OpenGL
$ ls -al /usr/lib/libGL.*
.. and the environment variables in your /etc/init.d/gdm
__________________
kpkeerthi is offline   Reply With Quote
Old August 24th, 2006   #6
neikous
First Cup of Ubuntu
 
Join Date: Jul 2006
Beans: 7
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 7900 GT/PCI/SSE2
OpenGL version string: 1.2 (2.0.2 NVIDIA 87.62)
OpenGL extensions:





$ ls -al /usr/lib/libGL.*
lrwxrwxrwx 1 root root 19 2006-08-24 12:09 /usr/lib/libGL.so -> /usr/lib/libGL.so.1
lrwxrwxrwx 1 root root 17 2006-08-08 17:07 /usr/lib/libGL.so.1 -> libGL.so.1.0.8762
-rw-r--r-- 1 root root 540136 2006-07-10 10:10 /usr/lib/libGL.so.1.0.8762



Here's my whole GDM file, I'm not very Linux savvy so I wasn't sure exactly what to post. -

#! /bin/sh
#
# Originally based on:
# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl
#
# Modified for gdm, Steve Haslam <steve@arise.dmeon.co.uk> 14mar99
# modified to remove --exec, as it does not work on upgrades. 18jan2000
# modified to use --name, to detect stale PID files 18mar2000
# sleep until gdm dies, then restart it 16jul2000
# get along with other display managers (Branden Robinson, Ryan Murray) 05sep2001

set -e

# To start gdm even if it is not the default display manager, change
# HEED_DEFAULT_DISPLAY_MANAGER to "false."
HEED_DEFAULT_DISPLAY_MANAGER=true
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/gdm
PIDFILE=/var/run/gdm.pid
UPGRADEFILE=/var/run/gdm.upgrade

if [ -e $UPGRADEFILE -a "$1" != "restart" -a "$1" != "force-reload" ]; then
SSD_ARG="--startas $DAEMON"
rm -f $UPGRADEFILE
else
SSD_ARG="--exec $DAEMON"
fi

# Allow cdd to override the config
if [ -f /etc/gdm/gdm-cdd.conf ]; then
CONFIG_FILE="--config=/etc/gdm/gdm-cdd.conf"
fi

test -x $DAEMON || exit 0

export __GL_SYNC_TO_VBLANK="1"

if [ -r /etc/environment ]; then
if LANG=$(pam_getenv -l LANG); then
export LANG
fi
if LANGUAGE=$(pam_getenv -l LANGUAGE); then
export LANGUAGE
fi

fi

. /lib/lsb/init-functions

case "$1" in
start)
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" -a "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" -a "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2>/dev/null)" != "$DAEMON" ]; then
log_warning_msg "Not starting GNOME Display Manager (gdm); it is not the default display manager."
else
# if usplash is runing, make sure to stop it now, yes "start" kills it.
if pidof usplash > /dev/null; then
/etc/init.d/usplash start
fi
log_begin_msg "Starting GNOME Display Manager..."
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --name gdm $SSD_ARG -- $CONFIG_FILE >/dev/null 2>&1 || log_end_msg 1
log_end_msg 0
fi
;;
stop)
log_begin_msg "Stopping GNOME Display Manager..."
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name gdm $SSD_ARG --retry 30 >/dev/null 2>&1
log_end_msg 0
;;
reload)
log_begin_msg "Reloading GNOME Display Manager configuration..."
log_warning_msg "Changes will take effect when all current X sessions have ended."
start-stop-daemon --stop --signal USR1 --quiet --pidfile \
$PIDFILE --name gdm $SSD_ARG >/dev/null 2>&1
log_end_msg 0
;;
restart|force-reload)
$0 stop || true
$0 start
;;
*)
log_success_msg "Usage: /etc/init.d/gdm {start|stop|restart|reload|force-reload}"
exit 1
;;
esac

exit 0





Thanks for the quick reply
neikous is offline   Reply With Quote
Old August 25th, 2006   #7
BongoBob
Just Give Me the Beans!
 
Join Date: Jan 2006
Beans: 64
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Would anyone happen to know how would I go about enabling openGL for VLC media player?
BongoBob is offline   Reply With Quote
Old August 27th, 2006   #8
metathran
5 Cups of Ubuntu
 
metathran's Avatar
 
Join Date: Apr 2006
Location: France
Beans: 16
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

I already knew this tips and it really increase image quality, tearing in video, and cube edge aliasing...

But there is a disadvantage to use

Code:
export __GL_FSAA_MODE="2"
With this setting everything is smooth but FSAA seems to be applied to the font too, so when you wait 3-4 seconds when watching pages in firefox you can clealy see that font become blur, and this effect disappear if you click on the page then come again a few seconds later...

In fact it affects everything displayed on the screen for example the toolbar of this form become blur...

metathran is offline   Reply With Quote
Old August 27th, 2006   #9
junamuno
5 Cups of Ubuntu
 
junamuno's Avatar
 
Join Date: Nov 2005
Location: Casselberry, FL USA
Beans: 38
Ubuntu 6.06
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Great Guide!!!! ThX
__________________
Global Warming is OUR PROBLEM!!!
junamuno is offline   Reply With Quote
Old August 27th, 2006   #10
kpkeerthi
Ubuntu addict and loving it
 
Join Date: Jun 2006
Location: $ pwd _
Beans: 3,974
Ubuntu 9.04 Jaunty Jackalope
Re: HOW TO: Nvidia/Xgl/Compiz - Improve video playback performance/Eliminate Jaggies

Quote:
Originally Posted by metathran View Post
export __GL_FSAA_MODE="2"
With this setting everything is smooth but FSAA seems to be applied to the font too, so when you wait 3-4 seconds when watching pages in firefox you can clealy see that font become blur, and this effect disappear if you click on the page then come again a few seconds later...

In fact it affects everything displayed on the screen for example the toolbar of this form become blur...
Hmm.. Thats strange. I don't see the problem with my setup. Did you check the FSAA settings that is appropriate for your video card here...
http://download.nvidia.com/solaris/1...ppendix-e.html

FSAA="2" seems to have different effect in different cards. May be that should explain why. Just wondering?
__________________
kpkeerthi 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 06:58 PM.


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