File:  [NetBSD Developer Wiki] / wikisrc / tutorials / x11 / compiz.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Fri Nov 27 10:14:07 2009 UTC (11 years, 11 months ago) by imil
Branches: MAIN
CVS tags: HEAD
Added DRI/Compiz tutorial

    1: ## Eye Candy for NetBSD 5.0
    2: 
    3: Since a couple of years, there are some Window Managers providing shiny 3D effects like a cube-mapped-desktop, wobbly windows and various other animations.
    4: 
    5: NetBSD is capable of dealing with those interfaces, but their installation is not yet straightforward. Here are the couple of steps you'll have to go through in order to impress your friends with a modern 3D NetBSD desktop.
    6: 
    7: ### Enable DRM in the kernel
    8: 
    9: Depending on the graphic card you are using, add one of the following to your kernel configuration:
   10: 
   11: 	i915drm*        at vga?         # Intel i915, i945 DRM driver
   12: 	mach64drm*      at vga?         # mach64 (3D Rage Pro, Rage) DRM driver
   13: 	mgadrm*         at vga?         # Matrox G[24]00, G[45]50 DRM driver
   14: 	r128drm*        at vga?         # ATI Rage 128 DRM driver
   15: 	radeondrm*      at vga?         # ATI Radeon DRM driver
   16: 	savagedrm*      at vga?         # S3 Savage DRM driver
   17: 	sisdrm*         at vga?         # SiS DRM driver
   18: 	tdfxdrm*        at vga?         # 3dfx (voodoo) DRM driver
   19: 
   20: For example, if your graphic card has an intel 945GM chip and your architecture is amd64-based:
   21: 
   22: 	# cd /usr/src/sys/arch/amd64/conf
   23: 	# cp GENERIC MYKERNEL
   24: 	# echo "i915drm*        at vga?" >> MYKERNEL
   25: 
   26: Then recompile and copy your kernel [as usual](http://www.netbsd.org/docs/guide/en/chap-kernel.html as usual).
   27: 
   28: ### Modular Xorg
   29: 
   30: The next step involves the Xorg server. Xorg 1.4.2 which is the version bundled with NetBSD 5.0 has no real [AiGLX](http://en.wikipedia.org/wiki/AIGLX) support. While Xorg.0.log will pretend AiGLX is enabled, it does not load the X dri driver related to your GPU. In order to have full AiGLX support, you will have to use pkgsrc's modular Xorg.
   31: Refer to [this article](http://wiki.netbsd.se/How_to_install_modular_Xorg) see how to achieve this simple -but long- task.
   32: 
   33: Once modular Xorg is installed, you'll have to tell *gdm* not to start the base Xorg server, but the new one installed by *pkgsrc*. Edit */usr/pkg/etc/gdm/custom.conf* and add the following lines:
   34: 
   35: 	[server-Standard]
   36: 	name=Standard server
   37: 	command=/usr/pkg/bin/X vt05 -audit 0
   38: 	flexible=true
   39: 
   40: Those using *startx* instead should create a *${HOME}/.xserverrc* with the following content:
   41: 
   42: 	exec /usr/pkg/bin/X vt05 -audit 0
   43: 
   44: Update your *${PATH}* variable so */usr/pkg/bin* comes before */usr/X11R{6,7}/bin*, i.e.:
   45: 
   46: 	PATH=${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin
   47: 	PATH=${PATH}:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin
   48: 	PATH=${PATH}:/usr/X11R7/bin:/usr/X11R6/bin
   49: 	export PATH
   50: 
   51: ### Xorg configuration
   52: 
   53: Exit from any X Window environment you might be using and run:
   54: 
   55: 	# Xorg -configure
   56: 
   57: This should produce a valid *xorg.conf* file in your *${HOME}* directory, just copy it to */etc/X11/xorg.conf*. Here is a typical *xorg.conf* file with necessary bits for DRI, AiGLX and Composite extensions to be loaded and operationals:
   58: 
   59: 	Section "ServerLayout"
   60: 	        Identifier     "X.org Configured"
   61: 	        Screen      0  "Screen0" 0 0
   62: 	        InputDevice    "Mouse0" "CorePointer"
   63: 	        InputDevice    "Keyboard0" "CoreKeyboard"
   64: 	EndSection
   65: 	
   66: 	Section "Files"
   67: 	        ModulePath   "/usr/pkg/lib/xorg/modules"
   68: 	        FontPath     "/usr/pkg/lib/X11/fonts/misc/"
   69: 	        FontPath     "/usr/pkg/lib/X11/fonts/TTF/"
   70: 	        FontPath     "/usr/pkg/lib/X11/fonts/OTF"
   71: 	        FontPath     "/usr/pkg/lib/X11/fonts/Type1/"
   72: 	        FontPath     "/usr/pkg/lib/X11/fonts/100dpi/"
   73: 	        FontPath     "/usr/pkg/lib/X11/fonts/75dpi/"
   74: 	EndSection
   75: 	
   76: 	Section "Module"
   77: 	        Load  "dbe"
   78: 	        Load  "dri"
   79: 	        Load  "dri2"
   80: 	        Load  "extmod"
   81: 	        Load  "glx"
   82: 	EndSection
   83: 	
   84: 	Section "InputDevice"
   85: 	        Identifier  "Keyboard0"
   86: 	        Driver      "kbd"
   87: 	        Option      "XkbRules"   "xorg"
   88: 	        Option      "XkbModel"   "pc105"
   89: 	        Option      "XkbLayout"  "us"
   90: 	        Option      "XkbOptions" "compose:ralt"
   91: 	EndSection
   92: 	
   93: 	Section "InputDevice"
   94: 	        Identifier  "Mouse0"
   95: 	        Driver      "mouse"
   96: 	        Option      "Protocol" "wsmouse"
   97: 	        Option      "Device" "/dev/wsmouse"
   98: 	        Option      "ZAxisMapping" "4 5 6 7"
   99: 	EndSection
  100: 	
  101: 	Section "Monitor"
  102: 	        #DisplaySize      330   210     # mm
  103: 	        Identifier   "Monitor0"
  104: 	        VendorName   "LPL"
  105: 	        ModelName    "2900"
  106: 	EndSection
  107: 	
  108: 	Section "Device"
  109: 	        Option      "DRI" "true"
  110: 	        Option      "AccelMethod" "XAA" # needed for 945GM GPUs
  111: 	        Option      "XAANoOffscreenPixmaps" "true"
  112: 	        Option      "AllowGLXWithComposite" "true"
  113: 	        Identifier  "Card0"
  114: 	        Driver      "intel"
  115: 	        VendorName  "Intel Corporation"
  116: 	        BoardName   "Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
  117: 	        BusID       "PCI:0:2:0"
  118: 	EndSection
  119: 	
  120: 	Section "Screen"
  121: 	        Identifier "Screen0"
  122: 	        Device     "Card0"
  123: 	        Monitor    "Monitor0"
  124: 	        SubSection "Display"
  125: 	                Viewport   0 0
  126: 	                Depth     1
  127: 	        EndSubSection
  128: 	        SubSection "Display"
  129: 	                Viewport   0 0
  130: 	                Depth     4
  131: 	        EndSubSection
  132: 	        SubSection "Display"
  133: 	                Viewport   0 0
  134: 	                Depth     8
  135: 	        EndSubSection
  136: 	        SubSection "Display"
  137: 	                Viewport   0 0
  138: 	                Depth     15
  139: 	        EndSubSection
  140: 	        SubSection "Display"
  141: 	                Viewport   0 0
  142: 	                Depth     16
  143: 	        EndSubSection
  144: 	        SubSection "Display"
  145: 	                Viewport   0 0
  146: 	                Depth     24
  147: 	        EndSubSection
  148: 	EndSection
  149: 	
  150: 	Section "ServerFlags"
  151: 	        Option "AIGLX" "true"
  152: 	EndSection
  153: 	
  154: 	Section "DRI"
  155: 	        Mode 0666
  156: 	EndSection
  157: 	
  158: 	Section "Extensions"
  159: 	        Option "Composite" "Enable"
  160: 	EndSection
  161: 
  162: ### Checklist
  163: 
  164: Now reboot your NetBSD computer with the previously compiled kernel. When Xorg starts, you should see the following kernel messages using dmesg:
  165: 
  166: 	error: [drm:pid389:i915_getparam] *ERROR* i915_getparam called with no initialization
  167: 	i915drm0: interrupting at ioapic0 pin 16
  168: 	error: [drm:pid389:i915_getparam] *ERROR* Unknown parameter 5
  169: 
  170: Error messages can safely be ignored, they mean you're not running a GNU/Linux kernel >= 2.6.28.
  171: Xorg.0.log now should contain the following messages:
  172: 
  173: 	[...]
  174: 	(**) AIGLX enabled
  175: 	(II) Loading extension GLX
  176: 	(II) LoadModule: "intel"
  177: 	(II) Loading /usr/pkg/lib/xorg/modules/drivers//intel_drv.so
  178: 	[...]
  179: 	drmOpenDevice: node name is /dev/dri/card0
  180: 	drmOpenDevice: open result is 8, (OK)
  181: 	drmOpenDevice: node name is /dev/dri/card0
  182: 	drmOpenDevice: open result is 8, (OK)
  183: 	drmOpenByBusid: Searching for BusID pci:0000:00:02.0
  184: 	drmOpenDevice: node name is /dev/dri/card0
  185: 	drmOpenDevice: open result is 8, (OK)
  186: 	drmOpenByBusid: drmOpenMinor returns 8
  187: 	drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
  188: 	(II) [drm] DRM interface version 1.2
  189: 	(II) [drm] DRM open master succeeded.
  190: 	[...]
  191: 	(II) intel(0): [DRI] installation complete
  192: 	[...]
  193: 	(II) AIGLX: enabled GLX_SGI_make_current_read
  194: 	(II) AIGLX: enabled GLX_MESA_copy_sub_buffer
  195: 	(II) AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control
  196: 	(II) AIGLX: enabled GLX_texture_from_pixmap with driver support
  197: 	(II) AIGLX: Loaded and initialized /usr/pkg/lib/dri/i915_dri.so
  198: 	(II) GLX: Initialized DRI GL provider for screen 0
  199: 
  200: Meaning your X11 environment can now play well with 3D gadgets.
  201: 
  202: ### Running compiz
  203: 
  204: In order to test your new X Window powers, install the following packages using your favourite method (pkgsrc, pkg_add, pkgin...):
  205: 
  206: 	wm/compiz
  207: 	devel/libcompizconfig
  208: 	wm/compiz-fusion-plugins-extra
  209: 	wm/compiz-fusion-plugins-main
  210: 	devel/compizconfig-backend-gconf
  211: 	wm/ccsm
  212: 
  213: As of 26/11/2009, *pkgsrc-2009Q3* binary version of those packages is 0.6.0. If you'd like to use the latest compiz version (0.8.4), you'll have to install it using current version of *pkgsrc*.
  214: 
  215: Once done, if you use the GNOME desktop, start compiz with this little script:
  216: 
  217: 	#/bin/sh
  218: 	
  219: 	# compiz 0.6's --replace does not kill properly metacity
  220: 	pkill metacity
  221: 	
  222: 	# for intel cards, add INTEL_BATCH=1 to the following command
  223: 	LIBGL_ALWAYS_INDIRECT=1 /usr/pkg/bin/compiz --replace --indirect-rendering ccp &
  224: 
  225: If your windows don't have decorations, launch the ccsm utility and under the "Effect" section, check "Window Decoration".
  226: 
  227: 0.6 version of compiz is old and suffers a known bug, instead of using metacity's themes, it draws white translucent borders. A [patch](http://cgit.compiz.org/compiz/core/patch/?id=27cc9c5178921ce6d6266f4b00303913163be7ee) is available for the gtk-window-decorator program that fixes it, but if you don't feel like patching / compiling, revert to compiz's default windows decorator:
  228: 
  229: 	$ gconftool-2 --set /apps/gwd/use_metacity_theme false --type bool
  230: 
  231: It's now up to you to play along with ccsm and try all those shiny effects you'll soon be unable to miss :)
  232: 
  233: Mandatory screenshot:
  234: [Shiny Disco Balls !](http://imil.net/gfx/netbsd-compiz-latest.png)

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb