HOWTO XGL

出自Gentoo Linux Wiki

跳转到: 导航, 搜索
这篇文章属于 HOWTO 系列的一部分。
安装方法 架构/平台 内核 & 硬件 Portage 系统相关 网络 & 服务器 X服务器 软件 游戏 非x86平台
Xgl/Compiz cube with 'in' setting
Xgl/Compiz cube with 'in' setting

Window sorting feature
Window sorting feature

Compiz Alt+Tab replacement
Compiz Alt+Tab replacement

Cube plugin without 'in' setting and moving a window across desktops
Cube plugin without 'in' setting and moving a window across desktops

Transparent Mplayer over desktop and programs - by neppakyo
Transparent Mplayer over desktop and programs - by neppakyo

3D cube stopped in mid spin = by neppakyo
3D cube stopped in mid spin = by neppakyo

3D cube with playing movie
3D cube with playing movie

目录

[编辑] 介绍

Xgl 是一个使用 OpenGL 进行绘图操作的 Xserver。 它和 compiz (一个 opengl 混合及窗口管理器)一起工作,可以实现一些很酷的桌面效果。Xgl 依赖 mesa 的一个功能扩展 : GLX_EXT_texture_from_pixmap,目前只有 CVS mesa 支持。

Xorg 邮件列表上的相关信息 ([1] )

警告: 这是非常实验性的东西,目前处在 alpha 测试阶段

这里有个基于 Gentoo 的内建 XGL 的 liveCD here 如果谁想先看看效果而不想搞坏系统的可以试试 :)

还有一个 RR64 Linux 3.0b1 也支持 XGL here.

想瞧瞧 Xgl 到底能有多酷,最简单的方法就是下载 David Reveman 的演示视频. 强烈推荐!

[编辑] 准备硬件

[编辑] 支持 Xgl 的显卡

厂商

[编辑] ATI 显卡

ATI Technologies, Inc.,

  • Radeon Mobility
    • Chipset: M6 LY
    • Driver: DRM_RADEON kernel driver
    • Notes:
  • Radeon All-in-Wonder 8500
    • Chipset: R200 BC
    • Driver: xf86-video-ati-6.5.7.3
    • Notes: Rootless mode only with xf86-video-ati-6.5.7.3
  • Radeon 8500 LE
    • Chipset: R200 QL
    • Driver: xf86-video-ati-6.5.7.3
    • Notes:
  • Radeon 8500 (Radeon 8500 -> FireGL 8800 mod)
    • Chipset: R200
    • Driver:
    • Notes:
  • FireGL 9000
    • Chipset: R250 Lf (rev 02)
    • Driver: Xorg open source drivers
    • Notes: Distored Screen with both drivers (ati-drivers-8.22.05, 8.23.7)
  • Mobility Radeon 7500
    • Chipset: RV200
    • Driver: xf86-video-ati-6.5.7.3
    • Notes: Slow at 24 bpp. Flickering, bitmaps not properly redrawn, slow windows, and black windows at 16 bpp
  • Radeon 7500
    • Chipset: RV200 QW
    • Driver: xf86-video-ati-6.5.7.3
    • Notes: No DRM, slow video
  • Mobility Radeon 9200SE M9+
    • Chipset: RV280
    • Driver: xorg-drivers
    • Notes: tested on a PPC iBook
  • Radeon 9700
    • Chipset: RV300 NE
    • Driver: ati-drivers-8.22.5
    • Notes:
  • Mobility Radeon 9600 M10
    • Chipset: RV350
    • Driver: ati-drivers-8.22.5, 8.23.7
    • Notes: Everything works.
  • Mobility Radeon 9700
    • Chipset: RV350
    • Driver: ati-drivers-8.22.5
    • Notes:
  • Radeon 9550
    • Chipset: RV350 AS
    • Driver: ati-drivers-8.22.5
    • Notes:
  • Radeon 9600
    • Chipset: RV350 AR
    • Driver: ati-drivers-8.22.5
    • Notes:
  • Radeon 9600 Pro
    • Chipset: RV350 AP
    • Driver: ati-drivers-8.22.5
    • Notes:
  • Radeon 9800
    • Chipset: RV350 NH
    • Driver: ati-drivers-8.23.7
    • Notes:
  • Radeon 9800 Pro
    • Chipset: R350
    • Driver: ati-drivers-8.22.5
    • Notes:
  • Radeon X300 (PCIE)
    • Chipset: RV370 5B60
    • Driver: ati-drivers-8.22.5
    • Notes: Random lockups can be fixed by turning off mtrr in Xorg.conf
  • Radeon X600
    • Chipset: RV380 0x3E50
    • Driver: ati-drivers-8.22.5
    • Notes: OpenGL applications and mplayer crash X. Screenshots garbled.
  • Radeon X700
    • Chipset:
    • Driver: ati-drivers-8.22.5
    • Notes: tested on AMD64
  • Mobility Radeon X700
    • Chipset: RV410
    • Driver: ati-drivers-8.23.7
    • Notes: Random lockups on X86. Movies and OpenGL applications crash X with the fade plugin.
  • Radeon X800
    • Chipset: R420 JK
    • Driver: ati-drivers-8.22.5
    • Notes: OpenGL windows render black, mplayer and xscreensaver crash X
  • Radeon XPRESS 200M 5955 (PCIE)
    • Chipset:
    • Driver: ati-drivers-8.22.6
    • Notes:
  • FireGL Mobility T2
    • Chipset: M10 NT
    • Driver:
    • Notes: tested with Kororaa XGL Demo LiveCD 0.1
  • Radeon IGP 345M
    • Chipset:
    • Driver: xf86-video-ati-6.5.7.3
    • Notes: No DRI. Use EXA to prevent flickering

[编辑] Intel 显卡

  • Intel Corporation 82852/855GM Integrated Grapics Device (with latest drivers)
  • Intel Corporation 82852/915GM Integrated Grapics Device (with latest drivers (drivers copied from mesa-6.4.2-r1 into the cvs-head mesa)
  • Intel Corporation 82865G Integrated Graphics Device (with latest drivers and CVS xorg-server; compiz does not yet work, error: "GLXUnsupportedPrivateRequest")

[编辑] nVidia 显卡

  • nVidia GeForce 256 Pro (with nvidia-glx-1.0.7174)
  • nVidia GeForce 2 Go 16MB and 32MB (with nvidia-glx-1.0.8178)
  • nVidia GeForce 2 MX 200 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 2 MX 400 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 2 MX 440 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 2 GTS (with nvidia-glx-1.0.7174) *card is now considered LEGACY
  • nVidia GeForce 2 Pro (with nvidia-glx-1.0.7174) *card is now considered LEGACY
  • nVidia GeForce 2 Ultra (with nvidia-glx-1.0.7174) *card is now considered LEGACY
  • nVidia GeForce 2 Ti (with nvidia-glx-1.0.7174) *card is now considered LEGACY
  • nVidia GeForce 3 (with nvidia-glx-1.0.8178-r3)
  • nVidia GeForce 3 Ti 200 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3, no direct rendering)
  • nVidia GeForce 3 Ti 500 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 MX 420 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 MX 440 (with latest nvidia-glx-1.0.8178)
  • nVidia GeForce 4 MX 460 (with nvidia-glx-1.0.7174)
  • nVidia GeForce 4 Go 440 32Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Go 440 64Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 MX 4000 64Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Ti 4200 go 64Mb (DELL inspiron 8500)(with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Ti 4200 128Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Ti 4200 64Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Ti 4400 128Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Ti 4600 128Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Ti 4800 SE 128Mb (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5200 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3, no direct rendering)
  • nVidia GeForce FX5500 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3, no direct rendering)
  • nVidia GeForce FX5600 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3, no direct rendering)
  • nVidia GeForce FX5650 Go (nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5700 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5700 LE (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5700 Go (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce PCX-5750 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5900 XT (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5900 Ultra (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce FX5950 Ultra (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6150
  • nVidia GeForce 6200 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3, no direct rendering)
  • nVidia GeForce 6200 Go (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6600 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6600 GT (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6600 Go (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6700 XL (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6800 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3, no direct rendering)
  • nVidia GeForce 6800 LE (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6800 GT (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6800 GS (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6800 Go (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6800 XT (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 6800 XT (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 7300 GS (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 7800 Go (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 7800 GS (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 7800 GT (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 7800 GTX (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 7800 GTX Go (with latest nvidia-glx-1.0.8178)
  • nVidia Quadro 4 200/400 NVS (tested with kororaa livecd 0.1)
  • nVidia Quadro 4 580 XGL (tested with kororaa livecd 0.1)
  • nVidia Quadro FX 500 (tested with kororaa livecd 0.1)
  • nVidia Quadro FX1400 (with nvidia-glx-1.0.6629-r6 and nvidia-kernel-1.0.6629-r5)
  • nVidia Quadro FX4000 (with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)
  • nVidia GeForce 4 Go 420 32Mb on HP laptop (with kororaa-xgl-demo-livecd-0.1)

[编辑] 看起来还不支持的显卡

  • ATI Technologies Inc R200 BC [Radeon All in Wonder 8500] (with ati-drivers-8.22.5, distorted screen)
  • ATI Technologies Inc R200 QL [Radeon 8500 LE] (with ati-drivers-8.22.5, distorted screen)
  • ATI Technologies Inc RV280 (5960) [Radeon 9200 Pro] (with ati-drivers-8.22.05, distorted screen)
  • ATI Technologies Inc RV280 (5961) [Radeon 9200] (Kororaa XGL Live CD 0.1, distorted screen)
  • ATI Technologies Inc RV280 (5964) [Radeon 9200SE] (with ati-drivers-8.22.5, distorted screen)
  • ATI Technologies Inc R200 [FireGL 8800] (with ati-drivers-8.22.5, distorted screen)
  • ATI Technologies Inc [Radeon X600] (Kororaa XGL Live CD 0.1, distorted screen (Note: Works for me with coffe's overlay, only distorted with the live CD.))
  • ATI Technologies Inc [Radeon 7000] (Kororaa XGL Live CD 0.1, distorted screen)
  • ATI Technologies Inc M9 [Radeon Mobility 9000] (Kororaa XGL Live CD 0.1, distorted screen)
  • ATI Technologies Inc M22 [Radeon Mobility M300] (Kororaa XGL Live CD 0.1, Freezed Machine)
  • SiS 6326 (Kororaa XGL Live CD 0.1, distorted screen)
  • nVidia GeForce 4 Go 420 32Mb on Toshiba laptop(with latest nvidia-glx-1.0.8178 and nvidia-kernel-1.0.8178-r3)(problems in refreshing windows content)(with kororaa XGL Live CD 0.1 Freezed Machine)
  • nVidia Geforce 4 Go 420 worked fine with Ubuntu Dapper Drake
  • VIA Unichrome KM400 (svn 173 openchrome.org drivers, "No screens found")

[编辑] Cards we wish we had results for

  • ATI Technologies Inc R200 [Radeon 9250] often referred to as the fastest card currently available with open source drivers. no one should care if Xgl works on this card or not.

[编辑] 安装 Xgl

[编辑] 必要软件

更新你的本地 portage tree.

emerge --sync

你将需要模块化的 Xorg (7.0版)。请参照 Gentoo 官方文档或 wiki 条目以获取详细的安装说明。

(理论上)你能使用任何一种桌面环境,只要它允许你更换窗口管理器。 Gnome 和 KDE 在这方面被大量的测试过。

就这一点来说,Gnome 是 唯一 拥有图形界面配置工具(Gconf Editor)来对 Xgl/compiz 进行配置的桌面环境。你需要安装它和它相关的依赖包即使你并不使用 Gnome 。

emerge gconf-editor


你还需要安装有 webdav 支持的 Subversion 。注意 USE 参数中的双重否定。你必须关闭 nowebdav标志。如果有必要的话,添加以下行到/etc/portage/package.use :

echo "dev-util/subversion -nowebdav" >> /etc/portage/package.use

接下来,

emerge subversion

[编辑] 使用 Overlay

按照下面的指令下载一个来自 CoffeeBuzz 的最新版 overlay :

  • 注意 1: 最好是把它和其他的 overlays 分开来。
  • 注意 2: 你需要 emerge 一个不含 nowebdav use 标志的 subversion 来使用。
  • 注意 3: 只要你愿意,可以使用你喜欢的 overlay 路径,只要保持一致就行了。
  • 注意 4: 你或许还可以在这里找到 Hanno 的 overlay :http://svn.hboeck.de/xgl-overlay 不过建议你不要用这个。
警告: xgl overlay 已经采用了新的格式,要升级请先删除revision 152,rm -rf /usr/local/xgl-coffee,然按照下面的指令检出最新的版本。
# 在这里可以使用你喜欢的 overlays 目录
cd /usr/local
# 从 CoffeeBuzz的 Subversion 仓库下载 overlay 到 'xgl-coffee'子目录
svn co http://svn.xgl-coffee.org/xgl-coffee/trunk xgl-coffee

现在,你有一个 portage overlay tree 在 /usr/local/xgl-coffee

把这个 overlay 路径添加到 /etc/make.conf 中 PORTDIR_OVERLAY 的后面。

文件: /etc/make.conf
PORTDIR_OVERLAY="/usr/local/xgl-coffee"

现在这里有一个专门用来测试的 overlay ,不要使用它,除非你知道自己在干什么!

svn co http://svn.xgl-coffee.org/xgl-coffee/testing xgl-testing

[编辑] Unmasking 相关软件包

将下列内容加入/etc/portage/package.keywords

文件: /etc/portage/package.keywords
x11-proto/glproto ~x86
media-libs/mesa ~x86
media-libs/glitz ~x86
x11-base/xgl ~x86
x11-wm/compiz ~x86
x11-libs/cairo ~x86
sys-apps/man ~x86
x11-misc/util-macros ~x86
x11-misc/xwinwrap ~x86 # movies/openGL screensaver on desktop as in Novel video: 可选
>=x11-libs/libwnck-2.14 -*  # 仅在你使用 xgl-coffee 的 overlay 编译 compiz 时加入

如果你使用 xgl-coffee 的 overlay,你需要添 :

echo ">=x11-libs/libwnck-2.14" >> /etc/portage/package.unmask

media-libs/mesa 应该已经被 Xorg7 unmask 了。如果 emerge 的时候要安装稳定版 (6.4.2) 请确认 package.unmask 包含:

media-libs/mesa

[编辑] Emerging Xgl

在我们开始 emerge Xgl 之前,先把这些 USE 标志:glitzcairo 添加到 /etc/make.conf。 然后 emerge cairo 。我们将使用 "--oneshot" 选项 (或者是 "-1",是数字 1 不是字母) 以保证 Portage 不会把这个软件记录到你的 world 文件中。 因为有些软件会依赖于 cairo ,所以我们使用 oneshot 选项来保持系统的干净。

emerge -v1a cairo

然后,我们需要确保 pango 和 gtk+ 是依靠 cairo 来编译的。

emerge -v1a pango gtk+

最后,让我们安装 compiz ,编译它之前请确保 gnome 和 svg 这两个 use 标志已经打开。 或者你可以添加一行到 /etc/portage/package.use:

x11-wm/compiz gnome svg

如果你还使用 KDE, 请把 kde 标志也包含进去 :

x11-wm/compiz gnome kde svg

对于那些使用封闭显卡驱动 nVidia 或者 ATI (nvidia, fglrx) 的用户,如果碰到 mesa 编译失败的话,请添加 VIDEO_CARDS="none" 或者 VIDEO_CARDS="ati" 到 /etc/make.conf。 这样可以避免编译一堆无用的驱动(比如 i810, sis 等等。),而且它们还经常编译失败,呵呵。 理想的情况下,在 make.conf 里指定好 INPUT_DEVICES 后你将得到一个更小安装的 xorg-x11。

我们需要 glproto-1.4.6 。它已经在 portage 里了。 并且应该和 Xorg7 一起被 unmasked 以及添加到 package.keywords 里了。

emerge -av glproto

NVidia 显卡的用户,不要忘记在 emerge 完 mesa 后切换回 nvidia 的 libGl 。

emerge -av mesa
eselect opengl set nvidia # (对于 nvidia 用户)
emerge -av xgl compiz

其他显卡的用户,只要简单的执行:

emerge -av mesa xgl compiz

对于哪些使用 CoffeeBuzz overlay 因为 dri 的问题导致编译 mesa 失败的用户,可以试试先 overly 里的 libdrm 。

echo "x11-libs/libdrm ~x86" >> /etc/portage/package.keywords
emerge libdrm mesa

有人报告说在 AMD64+NVidia 系统上编译 xgl 有些困难, 那么到这里看看相关的讨论吧 :XGL Compilation error with NVidia on AMD64 使用来自 xgl-coffee 的 20060307 ebuild 据说可以成功:(其实我用 xgl-0.0.1_alpha20060317 已经成功了:) )

emerge =x11-base/xgl-0.0.1_alpha20060307


一切都准备好以后, cairo 应该是在系统中被依赖的包,用这个命令检查一下

equery d cairo

如果没有返回任何软件包,那说明你有些地方可能做错了!

[编辑] 安装脚本

[编辑] install.sh

emxgl 现在已经旧了,在 xgl-coffee 的 overlay 里有一个新的安装脚本可用。
该脚本支持所有的显卡类型 (i810, ati 和 nvidia)。

要取得该脚本的用法,请用 root 身份运行,

代码: 使用 install.sh
cd /usr/local/xgl-coffee
./install.sh
[编辑] emxgl

这是论坛中贴出的脚本,解决了一些用户遇到的问题(amd64用户)。当前仅供 NVidia 显卡用户使用。

文件: emxgl
#!/bin/bash

rm -rf /usr/portage/distfiles/cvs-src/*
rm -rf /var/tmp/portage/{xgl*,mesa*,glitz*,compiz*}

cd /usr/include/GL
rm  glext.h && ln -s /usr/lib/opengl/global/include/glext.h
rm  gl.h  && ln -s /usr/lib/opengl/nvidia/include/gl.h
rm  glxext.h  && ln -s /usr/lib/opengl/global/include/glxext.h
rm  glx.h  && ln -s /usr/lib/opengl/nvidia/include/glx.h
rm  glxmd.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxmd.h
rm  glxproto.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxproto.h
rm  glxtokens.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxtokens.h

emerge glproto
rm  glext.h && ln -s /usr/lib/opengl/global/include/glext.h
rm  gl.h  && ln -s /usr/lib/opengl/nvidia/include/gl.h
rm  glxext.h  && ln -s /usr/lib/opengl/global/include/glxext.h
rm  glx.h  && ln -s /usr/lib/opengl/nvidia/include/glx.h
rm  glxmd.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxmd.h
rm  glxproto.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxproto.h
rm  glxtokens.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxtokens.h

emerge mesa
eselect opengl set nvidia
rm  glext.h && ln -s /usr/lib/opengl/global/include/glext.h
rm  gl.h  && ln -s /usr/lib/opengl/nvidia/include/gl.h
rm  glxext.h  && ln -s /usr/lib/opengl/global/include/glxext.h
rm  glx.h  && ln -s /usr/lib/opengl/nvidia/include/glx.h
rm  glxmd.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxmd.h
rm  glxproto.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxproto.h
rm  glxtokens.h  && ln -s /usr/lib/opengl/xorg-x11/include/glxtokens.h

emerge glitz xgl compiz compiz-plugin-opacity xbindkeys transset

CoffeeBuzz 的 overlay 中包含了一个类似的脚本 emxgl 在 /usr/local/xgl-coffee 目录中。需要更多的信息请访问 Hanno 的在线日志

警告: glxcompmgr 已经过期,并且无法在不打补丁的情况下与当前 mesa builds 一起工作!

[编辑] CFLAGS注释

AMD64 用户编译 compiz 时应该使用 CFLAGS="-march=k8 -O0" 参数,因为它修复了旋转和倾斜扩展造成的破坏。如果在其它平台上你也体验到了破坏, 你首选应该尝试重新编译 compiz 使用 -O0 参数, 因为 compiz 看上去还没有非常稳定的优化。

从 Hanno 和 CoffeeBuzz处得到的最新的 compiz ebuilds 将会修正amd64平台的CFLAGS参数

[编辑] 升级Xgl

要升级 overlay, 进入 overlay目录 然后输入 svn up

cd /usr/local/xgl-coffee/
svn up
警告: As of 2006-01-03 there are several ebuild updates in xgl-coffee overlay as of revision 40 regarding package versions. Some packages may appear to be downgrading but ignore this.

[编辑] 运行 Xgl

你需要告诉 Compiz 使用哪些插件。如果不指定插件,你甚至看不到窗口装饰!(没有 最小化/最大化/关闭 等按钮,没有改变大小,什么都没有:) )

这里有两种指定插件的方法。你可以在命令行下指定你所要的一切,或者使用图形化的配置工具 Gconf Configuration Editor。 但是你不能同时使用这两种方法! 如果 gconf 被命令行所指定,那么 compiz 将会忽略所有其他所有的插件并使用 Gconf 里的插件列表取而代之。

因此,如果你是第一次运行 Xgl,而且想配置 Gconf ,那正好可以运行:

gconf-editor

修正: 请至少先运行 compiz 一次,不然在配置列表中你会找不到 compiz 配置项。

依此打开 apps => compiz => general => allscreens => options 然后编辑 active_plugins 的值。 最起码,你需要添加 gconfdecoration。 但是,如果你想得到一个更加炫目的 Xgl,你得按顺序把这些插件都加上 wobbly, fade, switcher, move, resize, place, minimize, cube, rotate, zoom, 还有 scale

修正: 在下一节中,我们将会用屏幕 1 来运行 Xgl ,而不是屏幕 0,因为有些人在屏幕 0 中使用第一个版本的 Xgl 碰到问题了。但是在最新的版本中这已经不是问题了。

[编辑] 非 Root 用户

To try it out as another window on an already running X server:

代码: 对 ati 用户
Xgl :1 -ac -accel glx:pbuffer -accel xv:pbuffer
代码: 对 nvidia 用户
Xgl :1 -ac -accel glx:pbuffer -accel xv

然后启动 compiz:

代码: 启动 compiz
LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ DISPLAY=:1 compiz gconf
代码: 启动 gnome-window-decorator
DISPLAY=:1 gnome-window-decorator
代码: 启动一个程序
DISPLAY=:1 xterm
注意: You can set the compiz plugins in gconf-editor under /apps/compiz

[编辑] 设置 KDM

将 kdmrc 文件中的 ServerCmd 项改为:

文件: /usr/kde/<your version>/share/config/kdm/kdmrc
ServerCmd=/usr/bin/Xgl -br -kb -ac -accel glx:pbuffer -accel xv

另外也可以直接添加到 Xstartup 脚本中:

文件: /usr/kde/3.5/share/config/kdm/Xstartup
LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib compiz --replace decoration wobbly fade minimize cube rotate zoom scale move resize place switcher &
sleep 3
gnome-window-decorator &

This allows me to just have /etc/init.d/xdm start on boot creating a full Xgl with effects enabled with no user intervention with the normal kdm login.

注意: 如果你遇到了键盘方面的问题 (小键盘开关, 大小写切换键, super key 不起作用), 可以尝试从上面的命令中去掉 -kb 开关.

[编辑] Server Mode - Gnome

[编辑] Bypassing startx

If you want to start like classical X server with Gnome as desktop enviroment then open a file and write out

文件: ./startxgl
#!/bin/bash
echo ">Starting XGL at Display: $1"
echo "========= XGL ============"
Xgl :$1 -ac -accel xv -accel glx:pbuffer &
sleep 3
echo "======= COMPIZ ==========="
DISPLAY=:$1 LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ compiz --replace decoration wobbly fade switcher minimize cube rotate zoom scale move resize place &
 sleep 3
echo "====== DECORATIONS ======="
DISPLAY=:$1 gnome-window-decorator &
# sleep 3
echo "======= GNOME ============"
DISPLAY=:$1 /usr/libexec/gnome-settings-daemon &
DISPLAY=:$1 nautilus -n --sync &
DISPLAY=:$1 gnome-panel &
# DISPLAY=:$1 setxkbmap -model pc105 -layout de -variant basic &
#echo "======= LOGOUT ============"
#killall Xgl
# Adding the line above,if you can't logout Gnome correctly.
文件: Extended ./startxgl

An alternative to the above startxgl file can be found at: http://www.binary-pulse.co.uk/random/startxgl
This allows you to provide display, wm, and graphics card arguments to start xgl correctly.

代码: Make the script executable

chmod +x ./startxgl

To start Xgl Server run this:

代码: Start Xgl server at port 1

~/startxgl 1

Note: Many people reported problems to start server at port 0 (the default).
Also Note: Many people have reported problems where the gnome-panel will not show any applications while running in xgl. -> Workaround: After restarting the panel (killall gnome-panel && gnome-panel) the panel shows all applications.

[编辑] Gdm 和 gnome-session

要使 Xgl 和 gdm 一起工作并且在登录时自动加载 compiz,必须通过以下两个步骤. 1) 配置 gdm,使 gdm 使用 Xgl 服务器. 2) 设置 gnome session ,使它自动载入 compiz.

注意: 在gdm 2.14.0版以前,运行gdmsetup来配置gdm,使之支持Xgl服务器是不可能的。如果你的gdm版本比较新,请参考下面的1a部分,用gdmsetup进行配置。如果你的gdm比2.14.0早,请参考下面的1b部分,手工编辑gdm的配置文件。

1a) 配置 gdm (使用 gdmsetup):

  • 首先,备份 gdm.conf 文件
cp /etc/X11/gdm/gdm.conf /etc/X11/gdm/gdm.conf.back
  • 运行 gdmsetup
  • 选择 “安全”(Security)标签页
  • 点击标签页右下侧的“配置X服务器”(Configure X Server)按钮

首先,删除“标准”(Standard)服务器项:

  • 点击“要启动的服务器”(Servers to Start)清单中的“标准”(standard)服务器
  • 点击“删除”(Remove)按钮


接下来,创建新的Xgl服务器项:

  • 点击“添加/修改”按钮
  • 让新的服务器使用“VT 1”。“服务器”选项选择“标准”(Standard),这个选项控制服务器的基本类型。如果我们可以直接创建“Xgl”框架当然更好,但是目前的gdmsetup还做不到。所以我们先选择“标准”,以后再加以调整。现在不要输入任何的“选项”(Option)。最后点击“确认”。
  • 在“服务器设置”下面把“服务器名称”(Server Name)改为"Xgl"。
  • 在“命令”(Command)栏中输入你的Xgl启动命令。比如,ATI显卡的用户应该输入:
/usr/bin/Xgl :1 -ac -accel xv:pbuffer -accel glx:pbuffer
  • Change the "Launch" dropdown to "Greeter"
  • Check the "Logins are handled by this computer" box
  • Check the "Flexible (on demand)" box
  • 保存并退出
  • 重新启动 gdm


1b) 设置 gdm (手动):

  • 首先,备份 gdm.conf 文件
cp /etc/X11/gdm/gdm.conf /etc/X11/gdm/gdm.conf.back
  • 现在用一个文本编辑器打开 /etc/X11/gdm/gdm.conf 文件,通过搜索找到 [servers] 部分。 这部分应该大致位于文件末尾。
  • Comment out "0=Standard" and add a new line that reads "0=inactive" and one that reads "1=Xgl".
  • Add the server information for the Xgl server, remember to substitute the correct Xgl server command! The one below is for ati cards.


修改后的 /etc/X11/gdm/gdm.conf 文件:

...

[servers]
#0=Standard
0=inactive
1=Xgl

...

# Definition of the xgl X server.
[server-Xgl]
name=Xgl
command=/usr/bin/Xgl :1 -ac -accel xv:pbuffer -accel glx:pbuffer
flexible=true
chooser=false
handled=true
priority=0 
  • Restart gdm


2) Adding compiz to your gnome session (replacing metacity): Here is a little startscript, which i've placed in /usr/bin/. Useful if you do not always run Xgl. Change or remove the setxkbmap line according to your keyboard layout.

文件: /usr/bin/compizrc
#!/bin/bash
#
# Start compiz within gnome-session
#
if [ `ps -A | grep Xgl | wc -l` == "1" ]; then
        DISPLAY=:1 LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ compiz --replace gconf &
        DISPLAY=:1 gnome-window-decorator &
        DISPLAY=:1 setxkbmap -model pc105 -layout it -variant basic
fi
代码: Make the script executable

chmod 755 /usr/bin/compizrc

a) After logging into Gnome, start System->Settings->Sessions (or use "gnome-session-properties" in the terminal, as user - not root!) Here you go to the 3rd tab "manual startup" and press the add button. Enter the path to your compiz startscript (/usr/bin/compizrc) and set the priorty to 45 (after the gnome-panel, which is 40 and before programs started by the user, which are 50).

b) After logging out and back in compiz will start, but you'll see no decorations and effects. Thats because the compiz gconf tree for the current user has just been created - without any plugins!

c) So start your configuration editor (gconf-editor as user!) and go to "apps/compiz/general/allscreens/options" and edit the "active_plugins" key. This should contain the following items in this order: gconf decoration wobbly fade minimize cube rotate zoom scale move resize place menu switcher (opacity*)

d) After restarting your Xgl Server should be accessible with gdm & gnome-session.

\*opacity is the later described plugin, which has to be installed first - see below.

[编辑] Server Mode - XSESSION (修改 startx)

注意: 仅适用于 nvidia 显卡用户

Copy /usr/bin/startx to /usr/bin/startxgl and change the following line towards the end of the file:

文件: /usr/bin/startxgl (old)

xinit $clientargs -- $serverargs -deferglyphs 16 &

文件: /usr/bin/startxgl (new)

xinit $clientargs -- /usr/bin/Xgl -ac -accel xv -accel glx:pbuffer $serverargs -deferglyphs 16 &

This does not start compiz so create a small start script:

文件: ./startcompiz
#!/bin/sh

LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ compiz --replace gconf &
sleep 2
gnome-window-decorator &
xbindkeys

This includes starting xbindkeys for transparency (see below).

 注意:修改后的 startx 将启动 /etc/rc.conf 的 XSESSION 设置的桌面环境

[编辑] Server Mode - Xfce4

[编辑] With xfce4-session

xfce4-session is installed by default as part of the xfce4 meta-package. 如果你是用这种方法安装的 xfce4,下面的步骤是可以正常工作的.

First, it is necessary to create a script that will start compiz and gnome-window-decorator with the correct libraries and switches.

文件: /usr/bin/compizrc
LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib compiz --replace gconf &
gnome-window-decorator
代码: Make the script executable

chmod 755 /usr/bin/compizrc

Now, edit the xfce4-session settings to point to this rather than xfwm4.

文件: /etc/xdg/xfce4-session/xfce4-session.rc
[Failsafe Session]
Count=4
Client0_Command=compizrc
Client0_PerScreen=False
Client1_Command=xfce4-panel
Client1_PerScreen=True
Client2_Command=xftaskbar4
Client2_PerScreen=True
Client3_Command=xfdesktop
Client3_PerScreen=False

Finally, create a script to start XGL with Xfce4.

文件: /usr/bin/startxgl for nVIDIA
#!/bin/bash
Xgl -ac -accel xv:fbo -accel glx:pbuffer &
xfce4-session
文件: /usr/bin/startxgl for ATi
#!/bin/bash
Xgl -ac -accel xv:pbuffer -accel glx:pbuffer &
xfce4-session
代码: Make the script executable

chmod 755 /usr/bin/startxgl

你会注意到 xfce4-panel 不是透明的, 就像你在使用 xfwm4 的 compositor 一样。 The pager will be distorted, but otherwise everything works beautifuly. Windows even minimize to the correct spot on the taskbar.

[编辑] Without xfce4-session

If you compiled a minimal xfce (without xfce4-session, xffm4, etc.), then you can use this altered startxgl script from the gnome script above:

#!/bin/bash
echo ">Starting XGL at Display: $1"
echo "========= XGL ============"
Xgl :$1 -ac -accel xv -accel glx:pbuffer &
sleep 3
echo "======= COMPIZ ==========="
DISPLAY=:$1 LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ compiz --replace switcher decoration wobbly fade minimize cube rotate zoom scale move resize place &
sleep 3
echo "======= XFCE ============"
DISPLAY=:$1 xfce-mcs-manager
DISPLAY=:$1 gnome-window-decorator &
DISPLAY=:$1 xftaskbar4 &
DISPLAY=:$1 xfdesktop &
DISPLAY=:$1 exec xfce4-panel

Again, xfce4-panel will be transparent as if you had the X.org composite extension turned on (but you don't), and the pager will be distorted. Everything else should be fine.

[编辑] Generic startxgl script

文件: startxgl
#!/bin/bash
# xgl startup script by RiPz @ www.binary-pulse.co.uk
# GNU Public Licence
# woo!
# Edit: 20060301 Added xfce-svn CF (CoffeeBuzz www.tripthelight.net/xgloverlay)

echo "###### STARTXGL SCRIPT ######"

if [ "$1" = "" ]; then
    echo "Usage: startxgl <display number> <window manager> <gfx>"
    echo "<gfx> is optional, values 'ati' or 'nvidia/other', default is nvidia/other"
    echo "Window Managers currently supported: xfce, gnome."
elif [ "$2" = "" ]; then
    echo "Usage: startxgl <display number> <window manager> <gfx>"
    echo "<gfx> is optional, values 'ati' or 'nvidia/other', default is nvidia/other"
    echo "Window Managers currently supported: xfce, gnome."
else
    echo "Starting X Server with XGL"
    echo "   Using Display $1"
    echo "   Using WM: $2"

    if [ "$3" = "ati" ]; then
        echo "   Using Card: ati"
        Xgl :$1 -ac -accel xv:pbuffer -accel glx:pbuffer &
    else
        echo "   Using Card: nvidia/other"
        Xgl :$1 -ac -accel xv -accel glx:pbuffer &
    fi

    sleep 2
    echo "   Starting compiz"
    DISPLAY=:$1 LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ compiz --replace gconf decoration wobbly fade minimize cube rotate zoom scale move resize place switcher &
    sleep 2

    echo "   Starting Window Manager"

    if [ "$2" = "gnome" ]; then
        DISPLAY=:$1 gnome-window-decorator &
        DISPLAY=:$1 /usr/libexec/gnome-settings-daemon &
        DISPLAY=:$1 nautilus -n --sync &
        DISPLAY=:$1 gnome-panel
    elif [ "$2" = "xfce" ]; then
        DISPLAY=:$1 xfce-mcs-manager
        DISPLAY=:$1 gnome-window-decorator &
        DISPLAY=:$1 xftaskbar4 &
        DISPLAY=:$1 xfdesktop &
        DISPLAY=:$1 exec xfce4-panel
    elif [ "$2" = "xfce-svn" ]; then
        DISPLAY=:$1 xfce-mcs-manager
        DISPLAY=:$1 gnome-window-decorator &
        DISPLAY=:$1 xfdesktop &
        DISPLAY=:$1 exec xfce4-panel

    fi
    
    echo "   DONE!"
fi

[编辑] Compiz 插件

As stated above, compiz plugins can be specified as command line parameters to compiz when starting it, or with gconf (apps/compiz). It's a good idea to browse the settings for the plugins with gconf-editor (non-obvious/interesting settings listed below).

[编辑] Plugins loading order

From the author:

There are currently two things with the plugin system in compiz that are
a bit confusing.
1. Once you've loaded the gconf plugin, plugins specified on the command
line will be ignored. gconf plugin will override them with the list of
plugins stored in the gconf db.
2. Some plugins depend on other plugins and some plugins needs to be
loaded before other plugins. The plugin loader will not do anything to
try and resolve the order, if some plugin can't be loaded due to a
dependency problem it will just be ignored.
The plan was to have some other program for configuration and loading of
plugins and this program could figure out the order in which the plugins
should be loaded. But maybe we should add some code to the plugin loader
for this instead.
The current order in which the plugins should be loaded:
gconf,decoration,wobbly,fade,minimize,cube,rotate,zoom,scale,move,resize,place,switcher
-David

[编辑] 插件列表

decoration
开启窗口管理器。其实你必须打开一个 decorator ! 例如: `gnome-window-decorator` ,它已经包含在 compiz 里了。
move
允许你设置一个键盘和鼠标的组合按键来任意移动一个窗口。
resize
允许你设置一个键盘和鼠标的组合按键来改变一个窗口的大小。
place
在合适的位置放置一个新的窗口,并且一般不会和其他窗口或工具栏重叠在一起。
fade
当你打开或者关闭 窗口、工具提示、菜单 的时候出现 淡入/淡出 的效果。
switcher
一个用 Alt+Tab 来切换应用程序窗口的替代品,很酷的。
wobbly
这个可以让你在移动或者改变窗口大小的时候出现一种类似摇晃果冻的效果(或者称之为 豆腐 效果)。
Settings
  • focus_effect (None, Shiver): Effect when a window gets focus. This might interact badly with scale with sloppy_focus set.
  • map_effect (None, Shiver): Effect when a window gets created
  • friction, spring_k: Affect together the wobbliness
  • grid_resolution, min_grid_size: The resolution of the grid which is wobbled
  • snap (shortcut): Wobbly snapping while moving windows
minimize
Enables quartz like minimizing effect.
cube
Provides the cube the virtual desktop is mapped upon. You can also configure svg slides on the top (as shown in the offical xgl presentation). This is (currently) a necessary prerequisite for rotate.
Settings
  • in: Places the visitor inside the cube (just test to see)
rotate
Enables 3d desktop rotating via keyboard+mouse shortcuts.
zoom
Enables zooming in and around desktop.
scale
Exposé-like window-switcher.
Settings
  • sloppy_focus: mouse-over focus

[编辑] 使用插件

安装XGL的过程让你受够了吧,现在怎么来使用它呢?这里有启用每个插件效果的组合键:

在窗口之间切换 = Alt + Tab

排列并查看所有窗口 = F12 可以打开和关闭此效果;效果打开时点击任意一个窗口可以令之恢复原状并变成活动窗口

切换虚拟桌面 = Ctrl + Alt + 左/右方向键

切换虚拟桌面,并保持或者活动窗口始终在前 = Ctrl + Shift + Alt + 左/右方向键

旋转桌面正方体 = Ctrl + Alt + 点击墙纸并拖拽

在正方体上面显示svg图片 = 修改 gconf 数据库,添加svg图片路径到键值 /apps/compiz/plugins/cube/screen0/options/svgs (需要重起compiz)

Make window translucent/opaque (built-in) = Alt + mouse wheel up/down

Make window translucent/opaque (with the opacity plugin) = Ctrl + Shift + Scroll, or right-click the window's title bar and select Opacity (seems to be absent in current compiz cvs.)

Zoom-in once = Super-key right-click

Zoom-in manually = Super-key + wheel mouse up

Zoom-out manually = Super-key + wheel mouse down

移动窗口 = Alt + left-click

Snap Move window (will stick to borders) = Ctrl during move (either by Alt + left-click or by title bar)

改变窗口大小 = Alt + right-click

注意: Super-key 和 Windows 徽标键是相同的

你可以用 gconf-editor 更改以上所有设置(Might be necessary since the windows key is reported not to work with xgl on some systems).

警告: The key combinations interact! If you bind something to <Alt><Ctrl>Button4 and to <Ctrl>Button4 both will be activated if you use the first!
警告: The key combinations are also passed-through to apps below the cursor.

[编辑] Custom Plugins

[编辑] Opacity

注意: As of 13. March 2006 compiz now has it's in-built mechanism to change opacity, so the plug-in is not necessary anymore, Atl-mousewheel to use. So you dont need the instructions that follow

opacity = Ctrl + Shift + Mouse wheel

It's possible to create your own plugins for Compiz. Here's an opacity changer plugin and associated installation info and code walkthrough. The plugin allows you to change the currently focused window's opacity by using Ctrl+Shift+Mouse wheel, although this can be changed with gconf-editor.

The plugin interface can be fairly complex, but different levels can be stripped out depending on the functionality you wish to provide. The code walkthrough is for a plugin that does no custom rendering; rather, it demonstrates how to listen for keypresses, how to store and retrieve options, how to alter a window's properties, and most importantly, how to initialise a plugin.

To get this the Gentoo way, here are a few options:

[编辑] Easiest, use the ebuild from the overlay

Simply set up the xgl-coffee overlay (see above), and run

emerge compiz-plugin-opacity

Then activate the plugin

[编辑] easy, hack the compiz ebuild way

copy the compiz_opacity.tar.gz to the compiz files dir and modify the compiz ebuild by adding the following lines at the start of src_compile:

代码: compiz ebuild
        cd ${WORKDIR}
        mkdir opacity
        cd opacity
        ls ${FILESDIR}
        # for some reason unpack doesn't work ?!?
        tar zxvf "${FILESDIR}/compiz_opacity.tar.gz"
        cp opacity.c ${S}/plugins
        cd ${S}/plugins
        epatch ../../opacity/compiz-opacity.patch
        cd ${S}

(I know it's hacky, but it works with hannos ebuild)


[编辑] separate ebuild way

You need to save this ebuild to an apropriate direcory (eg x11-plugins/compiz-plugin-opacity)

文件: compiz-plugin-opacity-20060217.ebuild
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit eutils cvs flag-o-matic multilib

DESCRIPTION="Opacity plugin for compiz composite manager"
HOMEPAGE="http://www.downwithnumbers.com/compiz_plugins.html"
SRC_URI="http://www.downwithnumbers.com/files/compiz_opacity.tar.gz"
LICENSE="X11"
SLOT="0"
KEYWORDS="~x86 ~amd64 ~ppc"
IUSE=""

DEPEND="x11-wm/compiz"

src_unpack() {
        # Lets hack together something that works...
        ewarn "This is a crappy ebuild that could stop working at any time, so no need to cry if it breaks =)"
        mkdir ${S}
        cd ${S}
        mkdir plugins
        cd plugins
        unpack ${A}
        cp ${FILESDIR}/Makefile-plugins.am Makefile.am
        cd ..
        cp ${ECVS_TOP_DIR}/compiz/autogen.sh . || die "Compiz cvs in ${ECVS_TOP_DIR}/compiz necessary"
        cp ${ECVS_TOP_DIR}/compiz/configure.ac .
        epatch ${FILESDIR}/configure.ac.patch
        echo "SUBDIRS = plugins" > Makefile.am
        # Lets satisfy autocrap
        touch NEWS AUTHORS README ChangeLog
}

src_compile() {
        use amd64 && replace-flags -O[1-9] -O0

        ./autogen.sh --host=${CHOST} \
                --libdir=/usr/$(get_libdir) \
                --prefix=/usr \
                --infodir=/usr/share/info \
                --mandir=/usr/share/man || die
        # Clean out the binaries from the tarball
        emake clean
        emake || die
}

src_install() {
        make DESTDIR="${D}" install || die
}

And the following two files to the respective files dir:

文件: Makefile-plugins.am
libopacity_la_LDFLAGS = -module -avoid-version -no-undefined
libopacity_la_LIBADD = @COMPIZ_LIBS@
libopacity_la_SOURCES = opacity.c


INCLUDES =                      \
        @COMPIZ_CFLAGS@         \
        @LIBSVG_CAIRO_CFLAGS@   \
        @GCONF_CFLAGS@          \
        @PLACE_CFLAGS@          \
        -I/usr/include/compiz

moduledir = $(plugindir)

module_LTLIBRARIES =          \
        libopacity.la
文件: configure.ac.patch
--- configure.ac.old    2006-02-17 20:13:40.000000000 +0100
+++ configure.ac        2006-02-17 19:26:31.000000000 +0100
@@ -182,21 +182,12 @@
   QT_MOC=${QT_MOC}/bin/moc
 fi
 AC_SUBST(QT_MOC)

 AC_OUTPUT([
-compiz.pc
 Makefile
-src/Makefile
-include/Makefile
 plugins/Makefile
-images/Makefile
-gnome/Makefile
-gnome/window-decorator/Makefile
-gnome/compiz.desktop
-kde/Makefile
-kde/window-decorator/Makefile
 ])

 echo ""
 echo "the following optional plugins will be compiled:"
 echo "  gconf: $use_gconf"

Generate Manifest and digest files run in x11-plugins-plugin-compiz

代码: generate Manifest and digest files
ebuild compiz-plugin-opacity-20060217.ebuild digest

Emerge the plugin

代码: emerge compiz-plugin-opacity
emerge compiz-plugin-opacity
[编辑] cvs way
代码: cvs install command
        cvs -d :pserver:anoncvs@cvs.freedesktop.org:/cvs/xorg co app/compiz
        cd app/compiz/plugins
        wget http://www.downwithnumbers.com/files/compiz_opacity.tar.gz
        # get opacity plugin.
        tar zxvf compiz_opacity.tar.gz
        patch -p0 < compiz-opacity.patch
        cd ../
        ./autogen.sh
        # if there is no error.
        make
        sudo make install
[编辑] Activating Opacity

To activate just add opacity to the plugins list in your xgl command. If you use the gconf plugin, then run gconf-editor and add opacity to the /apps/compiz/general/allscreens/options->active_plugins list. If gconf does not add it to the list, you may have a problem with your plugin order, in which case you should check the console output to see which plugin it depends on.


警告: You must unmerge the opacity plugin if using the ebuild before compiling and running compiz from later than 20060313 or you might get seg faults.

[编辑] 经验心得

[编辑] Movies and xscreensaver on desktop using xwinwrap

This is what David R. used to play screensavers and movies on his background in that video.

CoffeeBuzz's overlay as of revision 75 contains an ebuild for xwinwrap. Emerge it and once installed try out:

xwinwrap -ni -argb -fs -s -st -sp -a -nf -- /usr/lib/misc/xscreensaver/glmatrix -root -window-id WID 

or for movies:

xwinwrap -ni -o 0.6 -fs -s -st -sp -b -nf -- mplayer -wid WID -quiet movie.mpg 

Play around with the settings. Post neat tricks to http://forums.gentoo.org/viewtopic-t-444350.html

[编辑] 透明

As of compiz 20060314, opacity is built in. Alt-mousewheel to use.

Other possibilities include using transset-df and xbindkeys. Refer to the Xorg X11 transparency page. This allows you to use Ctrl+Wheel to change the transparency of the current window.

See also the homebrew opacity changer plugin for Compiz. (Breaks compiz >=20060314).

[编辑] Doing important stuff

If you have important applications that you need and shouldn't die (eg burning with k3b) while playing around with xgl, consider using them in a local vnc server. For console apps, screen is your friend =)

If you need to use an app that doesn't work well in xgl (eg some java apps have an empty window for me) you can use Xnest which is like the window xgl, only the other way around =)

[编辑] Alt+tab 仅限于当前的工作空间

The compiz ebuild in CoffeeBuzz's overlay contains a USE flag, "switch_all_desktops" that enables a gconf option in the switcher plugin which toggles whether apps from the current workspace or ALL workspaces appear in the swithcer. After emerging and loading compiz, don't forget to activate the patch by changing the following gconf key:

/apps/compiz/plugins/switcher/screen0/options/all_desktops

Alternatively, you can apply this patch, by Tiago Sousa, to only switch between the windows of the current workspace. Then Bartosz Taudul enhanced it with the ability to turn it on or off through a gconf key. The final result, which is the recommended patch, is here.

To apply the patch, one should edit the ebuild to patch compiz after the cvs update. Copy the patch to x11-wm/compiz/files/ (in your xgl overlay) and add this to your compiz ebuild, inside src_compile(), before the emake:

epatch "${FILESDIR}"/compiz-switcher-all-desktops.patch || die

Now update the digest:

ebuild /path/to/compiz.ebuild digest

And compiz is ready for emerging. Don't forget to activate the option using the key (as above).

[编辑] Terminal with real transparent background

Only rxvt-unicode 7.6 and above supports this feature. It's not in portage but you can use the existing rxvt-unicode-7.1.ebuild to create an overlay with rxvt-unicode-7.6.ebuild (the newest version is 7.7, that should work as well). If you have trouble downloading the package you can get it from here and copy to /usr/portage/distfiles. This is not the same effect as with transset-df; the point is to have a real transparent background, with the frame and text remaining normal. It's pseudo-transparency done right.

启动 rxvt-unicode:

urxvt -depth 32 -fg grey90 -bg rgba:0000/0000/0000/dddd

This is with different font, slightly brighter bg and text, no scrollbar for neat freaks and Terminal naming.

urxvt -name Terminal -fn "xft:Monospace:pixelsize=11" -fade 20 +sb -depth 32 -fg white -bg rgba:2000/2000/2000/dddd

See the rxvt-unicode FAQ for more details:

man 7 urxvt

[编辑] Experimental patch for r200

David Airlied posted this patch on irc. It might increase your performance using an r200 card and the open source drivers. Beware you are on your own if your trying this. Get it here. This patch is automatically applied in both overlay's. If you experience problems, try disabling it.

[编辑] Troubleshooting

[编辑] Patch XYZ failed during unpack

This usually means that a cvs update broke a patch. The first thing to try is to comment it out in the ebuild and redo the digest. If that doesn't work there is no easy solution. You can check the forum and Hanno's blog to see if someone found a solution, if not, probably the best place to post is Hanno's blog as he seems te regularly read it and fix his overlay.

[编辑] GLX_EXT_texture_from_pixmap is missing

compiz outputs this:

compiz: GLX_EXT_texture_from_pixmap is missing
compiz: Failed to manage screen: 0
compiz: No managable screens found on display localhost:2.0

You forgot to prepend LD_LIBRARY_PATH=/usr/lib/opengl/xorg-x11/lib/ to the compiz command line.

On ubuntuforums.org, it is stated that this error can occur from a wrong libGL.so (only the libGL.so from mesa can do the trick). It is reported that using the right library, compiz should work on a GeForce FX 5200 -- doesn't work for me, though (not being too much of an expert as far as libraries are concerned, i assume that setting LD_LIBRARY_PATH does roughly the same as LD_PRELOAD, though on a more general level).

If the above doesn't work then try remerging mesa and xgl after switching back to the xorg-x11 libGl.

eselect opengl set xorg-x11
emerge -va mesa xgl
eselect opengl set nvidia # (for nvidia users)

Another possible cause is not emerging the correct version of Mesa. Be sure you have it unmasked properly and are pulling in a version greater than mesa-6.4.2. It should be mesa-6.5.0_alpha*.

(I do use mesa-6.4.3_alpha20060216, but that's the latest version I can get; just did svn up for Hanno's overlay, but no news there)

[编辑] No Window Decorations

Important: You need to enable the gnome use flag to build the decorator!

Compiz will be built with gnome-window-decorator only if cairo is installed and pango and gtk+ are built against it. gnome-base/control-center and libwnck are also required. Make sure the gnome and svg use flags are enabled for compiz. It has also been reported that in some cases you need to remove the compiz cvs directory to get it built (usually /usr/portage/cvs-src/compiz).

[编辑] Failed to load shadow images

If the gnome-window-decorator doesn't start and shows the error

 gnome-window-decorator, Failed to load shadow images

you may have set XLIB_SKIP_ARGB_VISUALS=1. Sometimes this is the case with Mozilla Firefox, so try commenting out the line in /etc/env.d/10MozillaFirefox and login again.


Even if the decorator works, some apps' windows get decorated wrongly (dialogs without a close button) or aren't decorated at all (eg vlc).

Try to remove "gconf" from compiz's command line option, if you haven't activated compiz' plugins using gconf-editor. According the author(see above), if you start compiz with "gconf" option, all other options on the command line will be ignored.

[编辑] SDL games or other apps that should be opaque are unevenly translucent

Open a console, export XLIB_SKIP_ARGB_VISUALS=1, then run the app from there.

[编辑] No Visual Format

When you start up Xgl you get an error like:

Fatal error:
no visual format 

Solution:

emerge nvidia-glx

Do not forget to load the glx module in your /etc/X11/xorg.conf file.

Also make sure you're using a color depth of 16 or 24.

Question: I'm having this error, but an Intel i915 chipset, so emerging the nvidia-glx package won't work for me, won't it?

[编辑] Black Windows

All windows turn black when running compiz.

compiz may output errors like this:

compiz: pixmap 0x200043 can't be bound to texture
compiz: Couldn't bind redirected window 0x40001a to texture

Affected by this problem:

  • Nvidia Geforce (mostly GF4 MX)
  • Intel i810 and i915
  • Radeon XPRESS 200M

For me, and probably many people with the binary nvidia drivers, this appears to have been caused by glitz building against mesa's GL libraries rather than the nvidia libraries. Hanno's instructions are:

emerge mesa glitz xgl compiz

But as soon as mesa is finished, the active GL libraries are switched to be mesa's, so glitz is built against them.

glitz and xgl need to build against the nvidia libraries, compiz needs to see the mesa libraries. Try:

代码: Emerge order for nvidia users
emerge mesa
eselect opengl set nvidia
emerge nvidia-glx glitz xgl 
eselect opengl set xorg-x11
emerge compiz
eselect opengl set nvidia

and make sure LD_LIBRARY_PATH=/usr/include/opengl/xorg-x11/lib when compiz is started. (the xgl ebuild builds along with the mesa from cvs).


Everything works relatively correctly now on a Geforce2Go. A few issues remain. When Xgl is started from within an already running Xserver without the -fullscreen option, it looks great. When started with the -fullscreen option or from the console its super slow, but I believe that's because my card only has 16MB of ram on it. If I set the depth to 16 bits rather than 24 in xorg.conf, things improve. There are some refresh and stability issues, but it does seem to work.

For me this is not the problem. The problem could be that you had to reinstall the mesa (cvs) package each time you reinstall the xgl package, because xgl checkout the mesa cvs and if there are differences this could cause problem. So cvs change in mesa + xgl merge => mesa merge first.

[编辑] Distorted Screen

Some distortion errors fixed with new drivers from here http://dri.freedesktop.org/snapshots/ They may run very slow though. Slower than the older Radeon drivers.

[编辑] Half-screen problem

Some users get a "half-screen" problem:

  • Radeon Mobility M9+
  • Radeon Mobility M6 LY (IBM ThinkPad X32) -> screenshots [2], [3], [4], [5]

This seems to be specific to ATI cards.

[编辑] Whole distortion

Some users get a completely distorted screen:

fuxed.png

This issue is apparently only present for ATi users. Furthermore, the issue is only present when using compiz, and not when using glxcompmgr. A solution is currently unknown.

Example: Compaq nx7010 with radeon mobility 9200 (9000 M9) and fglrx driver.

[编辑] Partial distortion

It is usually accompanied with the following error messages:

No matching visual for __GLcontextMode with visual class = 4 (32770), nplanes = 24
No matching visual for __GLcontextMode with visual class = 4 (32770), nplanes = 24
NOTE: __GLcontextMode is due to Color Depth, setting it to 24 solves the problem with these messages.

Partial distortion of the screen has also been reported. This seems to be an issue when using 16 bit color depth. A workaround is to use 24 bit color depth.

[编辑] Support for non power of two textures missing

compiz outputs this:

compiz: Support for non power of two textures missing

The driver has to support either the GL_{NV,EXT,ARB}_texture_rectangle or the GL_ARB_texture_non_power_of_two extension. The open source ATi driver, x11-drivers/xf86-video-ati, does not support these extensions. If you are using an ATi card, try using the proprietary fglrx drivers, x11-drivers/ati-drivers. This info may only relate to r300 and newer cards.

For nvidia users affected by this, the problem appears to have been fixed in a recent update to glitz:

2006-02-16 David Reveman <davidr@novell.com>

* src/glitz_texture.c: Fix so that GL_ARB_texture_rectangle and GL_ARB_texture_border_clamp are not required for texture object creation.

Updating glitz to 0.5.3 should be sufficient to remedy this problem.

To check if the driver supports the needed extension, use the following command:

glxinfo | grep 'GL_\(NV\|EXT\|ARB\)_texture_rectangle\|GL_ARB_texture_non_power_of_two'

[编辑] dlopen: /usr/lib/xorg/modules/xgl/libglcore.so: undefined symbol: _tnl_arb_vertex_shader_stage

A bug was introduced into the CVS version of XGL on the 13th of February, which generated an error like this:

dlopen: /usr/lib/xorg/modules/xgl/libglcore.so: undefined symbol: _tnl_arb_vertex_shader_stage

The exact wording depends on your machine architecture and what libs you are using (x86 or x86_64).

The bug was fixed on the 14th of February 2:32 UTC.

The solution to this is simply to reemerge xgl and mesa.

If this does not fix it, execute the following command:

rm -rf /usr/portage/distfiles/cvs-src/{Mesa,xgl-xorg}

This will clear the old CVS sources and refetch the source if you had problems, and a new checkout will take place (this may take considerable time to do however).

[编辑] dlopen: /usr/lib/xorg/modules/xgl/libglx.la: file not found

Please re-emerge xgl.

[编辑] I915_PARAM_LAST_DISPATCH not declared in kernel DRM headers

Mesa CVS requires some DRM headers "i915_drm.h" from linux kernel RC 2.6.16. Either upgrade your kernel to this experimental version, or find a copy of that header file (I hear the coffee overlay ebuilds come with it). If you upgraded kernels, Copy it into your kernel header include dir like this:

cp /usr/src/linux/drivers/char/drm/i915_drm.h /usr/include/drm/

It is confirmed that Xorg 7.0 DRM works with i915GM on 2.6.16-rc3-nitro1 on an IBM X41.

[编辑] Compiz is loaded but all my special effects are missing

Start up the gconf-editor and go to apps/compiz/general/allscreens/options -> active_plugins.

Make sure your desired plugins are in that list - if not, add them following these instructions.

[编辑] Wrong keyboard layout

The keyboard layout seems to have problems if it's not us. To fix this

setxkbmap -model pc105 -layout dk -variant basic 

Change "dk" in the above line to your own keyboard layout country code if it's not "dk".

If you need to swap the Caps Lock and Ctrl keys add to the above: -option ctrl:swapcaps


For grabbing the cube you also have something launch in the root window. The best way to achieve that is to launch nautilus. If you run KDE, the process that runs in the root window is "kdesktop"


CAN'T VT SWITCH ?

I found after many hours of googling that the xkb database can get burned during the xorg 7.x upgrade.. to solve this:

emerge -Cva xkbdata && rm -Rf /usr/share/X11/xkb/ && emerge xkeyboard-config

~mordjah --67.185.152.175 04:07, 8 March 2006 (GMT) hopefully google will index this edit nicely ;)

[编辑] KDE Apps Not Showing Up

If you have tray icon enabled (eg, Amarok) turn it off, which should allow the application to work inside XGL.

This can be solved with this patch for kdelibs. The KDE Panel then works as expected.

CoffeeBuzz's overlay contains kdelibs-3.5.1-r2 with ksystray patch.

[编辑] Apps not showing up in KDE's taskbar

Open KDE Control Center and go to desktop->taskbar and enable "Show windows from all desktops". Note: You should start KDE under normal X server rather then Xgl. Under Xgl I didn't find this option.

[编辑] MPlayer crashes Xgl

If your MPlayer crashes Xgl (pops you back to the textmode console), try using 'mplayer -vo x11', worked for me. Note: direct rendering is enabled and working well!

An other possible solution, you can re-merge mplayer with USE="-xv". Then choosing the "gl2" video driver for mplayer.

If either x11 or gl2 work, then put the following line in your .mplayer/config

vo=gl2,x11,xv

[编辑] BadLength (poly request too large or internal Xlib length error) with radeon/fglrx

Running Xgl on fglrx (radeon 9600) I get:

X Error of failed request: BadLength (poly request too large or internal Xlib length error)
 Major opcode of failed request: 161 (GLX)
 Minor opcode of failed request: 1 (X_GLXRender)
 Serial number of failed request: 94
 Current serial number in output stream: 95

When running

LD_PRELOAD=/usr/lib/opengl/ati/lib/libGL.so.1.2 Xgl :1

Xgl starts and seems to work, but when running opengl-apps (as glxgears or glxinfo) inside it crashes. Note: I use a fresh install of gentoo.

I got it working this way:

# eselect opengl set xorg-x11
# emerge -av glproto mesa
# eselect opengl set ati

--212.242.54.49 16:39, 5 March 2006 (GMT)

Make certain you are using mesa 6.5.0 alpha. I was still getting the mesa-6.4.2r1 because the script didn't unmask the package that I used from coffee's overlay. Davebailey 15:16, 9 March 2006 (GMT)

I got it working this way:

eselect opengl set ati
cd /usr/include/GL
rm gl.h glext.h glx.h glxext.h glxmd.h glxproto.h glxtokens.h
ln -s /usr/lib64/opengl/(ati|nvidia)/include/* ./
emerge -av --oneshot xgl
eselect opengl set ati

after noticing that the culprit was /usr/lib/xorg/modules/xgl/libxglx.so, which is naughty and links directly to /usr/lib/opengl/(xorg-x11|ati|nvidia)/lib/libGL.so.1, depending on which OpenGL profile is set when you compile XGL. This was on an AMD64 machine; substitute 64 for 32 as necessary, and fill in your desired vendor. Xgl runs without needing LD_PRELOAD after this.

[编辑] BadLength (poly request too large or internal Xlib length error) with i915

A potential solution is to install a STABLE version of mesa and copy the driver (i915_drm.so) from:

/usr/lib/xorg/modules/dri/

to a temporary directory. Then install the cvs version and copy the old driver back.


Another potential solution that has been tested and proven to work is to install the latest xorg-server from the xgl-coffee SVN repository. This was tested when the previous possible solution failed to be of assistance in the resolution to this error. So, if that didn't work for you, please try this.

[编辑] X_GLvop_* undeclared

If you get this:

glxcmds.c: In function '__glXVendorPrivateWithReply'
glxcmds.c:2351: error: 'X_GLvop_IsRenderbufferEXT' undeclared (first use in this function)
glxcmds.c:2351: error: (Each undeclared identifier is reported only once
glxcmds.c:2351: error: for each function it appears in.)
glxcmds.c:2353: error: 'X_GLvop_GenRenderbuffersEXT' undeclared (first use in this function)
glxcmds.c:2355: error: 'X_GLvop_GetRenderbufferParameterivEXT' undeclared (first use in this function)
glxcmds.c:2357: error: 'X_GLvop_IsFramebufferEXT' undeclared (first