diff --git a/x11/driver/xorg-input-evdev/actions.py b/x11/driver/xorg-input-evdev/actions.py
new file mode 100644
index 0000000000..33d3751a6d
--- /dev/null
+++ b/x11/driver/xorg-input-evdev/actions.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-fiv")
+ autotools.configure("\
+ --disable-static \
+ --disable-silent-rules \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-input-evdev/pspec.xml b/x11/driver/xorg-input-evdev/pspec.xml
new file mode 100644
index 0000000000..49936418d7
--- /dev/null
+++ b/x11/driver/xorg-input-evdev/pspec.xml
@@ -0,0 +1,135 @@
+
+
+
+
+ xorg-input-evdev
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org evdev input driver
+ xorg-input-evdev contains the X.Org driver for Linux's generic event devices. It supports all input devices that the kernel knows about.
+ mirrors://xorg/individual/driver/xf86-input-evdev-2.9.2.tar.bz2
+
+ xorg-server-devel
+ libmtdev-devel
+ libevdev
+
+
+
+
+ xorg-input-evdev
+
+ xorg-server
+ libmtdev
+ libevdev
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+ xorg-input-evdev-devel
+ Development files for evdev driver
+
+ xorg-input-evdev
+
+
+ /usr/include
+ /usr/lib/pkgconfig
+
+
+
+
+
+ 2015-05-08
+ 2.9.2
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-22
+ 2.9.1
+ Version bump
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+- 2014-08-31
+- 2.9.0
+- Version bump.
+- Marcin Bojara
+- marcin@pisilinux.org
+
+
+ 2014-05-16
+ 2.8.4
+ Version bump.
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-08
+ 2.8.2
+ Rebuild for xserver 1.15.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-11-06
+ 2.8.2
+ Fix deps.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-10-11
+ 2.8.2
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-08-25
+ 2.8.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 2.8.0
+ Add patch
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 2.8.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-04-14
+ 2.8.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 2.7.3
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-evdev/translations.xml b/x11/driver/xorg-input-evdev/translations.xml
new file mode 100644
index 0000000000..ac82b15197
--- /dev/null
+++ b/x11/driver/xorg-input-evdev/translations.xml
@@ -0,0 +1,13 @@
+
+
+
+ xorg-input-evdev
+ X.Org evdev giriş aygıtı sürücüsü
+ xorg-input-evdev, Linux'un genel olay aygıtları için X.Org sürücüsünü içerir. Çekirdek tarafından bilinen tüm giriş aygıtlarını destekler.
+
+
+
+ xorg-input-evdev-devel
+ evdev sürücüsü için geliştirme dosyaları
+
+
diff --git a/x11/driver/xorg-input-joystick/actions.py b/x11/driver/xorg-input-joystick/actions.py
new file mode 100644
index 0000000000..142ab1ae5f
--- /dev/null
+++ b/x11/driver/xorg-input-joystick/actions.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import get
+
+def setup():
+ autotools.configure()
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
diff --git a/x11/driver/xorg-input-joystick/pspec.xml b/x11/driver/xorg-input-joystick/pspec.xml
new file mode 100644
index 0000000000..5fcc2fb4d3
--- /dev/null
+++ b/x11/driver/xorg-input-joystick/pspec.xml
@@ -0,0 +1,110 @@
+
+
+
+
+ xorg-input-joystick
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org joystick input driver
+ xorg-input-joystick contains the X.Org driver for joysticks.
+
+ mirrors://xorg/individual/driver/xf86-input-joystick-1.6.2.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+ xorg-input-joystick
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/man
+
+
+
+
+ xorg-input-joystick-devel
+ Development files for xorg-input-joystick
+
+ xorg-input-joystick
+
+
+ /usr/include
+ /usr/lib/pkgconfig
+
+
+
+
+
+ 2015-05-08
+ 1.6.2
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-22
+ 1.6.2
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.6.2
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.6.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.6.2
+ Rebuild for xserver 1.15.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 1.6.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.6.2
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.6.1
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-05-30
+ 1.6.1
+ First release
+ Erdem Artan
+ admins@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-joystick/translations.xml b/x11/driver/xorg-input-joystick/translations.xml
new file mode 100644
index 0000000000..0a89aa032f
--- /dev/null
+++ b/x11/driver/xorg-input-joystick/translations.xml
@@ -0,0 +1,13 @@
+
+
+
+ xorg-input-joystick
+ X.Org joystick giriş aygıtı sürücüsü
+ xorg-input-joystick, oyun çubukları için X.Org sürücüsünü içerir.
+
+
+
+ xorg-input-joystick-devel
+ xorg-input-joystick için geliştirme dosyaları
+
+
diff --git a/x11/driver/xorg-input-kbd/actions.py b/x11/driver/xorg-input-kbd/actions.py
new file mode 100644
index 0000000000..11a5645088
--- /dev/null
+++ b/x11/driver/xorg-input-kbd/actions.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure()
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-input-kbd/pspec.xml b/x11/driver/xorg-input-kbd/pspec.xml
new file mode 100644
index 0000000000..a4a7716c4c
--- /dev/null
+++ b/x11/driver/xorg-input-kbd/pspec.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ xorg-input-kbd
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org kbd input driver
+ xorg-input-kbd contains the X.Org driver for keyboards.
+ mirrors://xorg/individual/driver/xf86-input-keyboard-1.8.0.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+ xorg-input-kbd
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.8.0
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-21
+ 1.8.0
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.8.0
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.8.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-08
+ 1.8.0
+ Rebuild for xserver 1.15.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2014-03-08
+ 1.8.0
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-08-25
+ 1.7.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.7.0
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.7.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-04-14
+ 1.7.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.6.2
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-kbd/translations.xml b/x11/driver/xorg-input-kbd/translations.xml
new file mode 100644
index 0000000000..c903a1d1ba
--- /dev/null
+++ b/x11/driver/xorg-input-kbd/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-input-kbd
+ X.Org kbd giriş aygıtı sürücüsü
+ xorg-input-kbd, klavyeler için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-input-mouse/actions.py b/x11/driver/xorg-input-mouse/actions.py
new file mode 100644
index 0000000000..6fe58752d9
--- /dev/null
+++ b/x11/driver/xorg-input-mouse/actions.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-fiv")
+ autotools.configure("\
+ --disable-static \
+ --disable-silent-rules \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-input-mouse/files/0001-Don-t-disable-3-button-emulation-if-third-mouse-butt.patch b/x11/driver/xorg-input-mouse/files/0001-Don-t-disable-3-button-emulation-if-third-mouse-butt.patch
new file mode 100644
index 0000000000..59a42c864d
--- /dev/null
+++ b/x11/driver/xorg-input-mouse/files/0001-Don-t-disable-3-button-emulation-if-third-mouse-butt.patch
@@ -0,0 +1,11 @@
+--- a/src/mouse.c 2012-07-30 09:51:42.000000000 +0400
++++ b/src/mouse.c 2012-08-10 15:56:04.868170012 +0400
+@@ -2044,7 +2044,7 @@
+ {
+ MouseDevPtr pMse = pInfo->private;
+
+- if (!pMse->emulate3ButtonsSoft)
++ if (pMse->emulate3Buttons || !pMse->emulate3ButtonsSoft)
+ return TRUE;
+
+ xf86Msg(X_INFO,"3rd Button detected: disabling emulate3Button\n");
diff --git a/x11/driver/xorg-input-mouse/pspec.xml b/x11/driver/xorg-input-mouse/pspec.xml
new file mode 100644
index 0000000000..83c805976c
--- /dev/null
+++ b/x11/driver/xorg-input-mouse/pspec.xml
@@ -0,0 +1,120 @@
+
+
+
+
+ xorg-input-mouse
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org mouse input driver
+ xorg-input-mouse contains the X.Org driver for mice.
+ mirrors://xorg/individual/driver/xf86-input-mouse-1.9.1.tar.bz2
+
+ xorg-server-devel
+
+
+ 0001-Don-t-disable-3-button-emulation-if-third-mouse-butt.patch
+
+
+
+
+ xorg-input-mouse
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+ xorg-input-mouse-devel
+ Development files for xorg-input-mouse
+
+ xorg-input-mouse
+
+
+ /usr/include/xorg/xf86-mouse-properties.h
+ /usr/lib/pkgconfig/xorg-mouse.pc
+
+
+
+
+
+ 2015-05-08
+ 1.9.1
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-21
+ 1.9.1
+ Rebuild xorg-server 1.6.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-08-31
+ 1.9.1
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.9.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.9.0
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.9.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.9.0
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.9.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-04-14
+ 1.9.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.8.1
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-mouse/translations.xml b/x11/driver/xorg-input-mouse/translations.xml
new file mode 100644
index 0000000000..3fca339b23
--- /dev/null
+++ b/x11/driver/xorg-input-mouse/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-input-mouse
+ X.Org mouse giriş aygıtı sürücüsü
+ xorg-input-mouse, fareler için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-input-synaptics/actions.py b/x11/driver/xorg-input-synaptics/actions.py
new file mode 100644
index 0000000000..fce2e98389
--- /dev/null
+++ b/x11/driver/xorg-input-synaptics/actions.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-vif")
+ autotools.configure("\
+ --disable-static \
+ --disable-silent-rules \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-input-synaptics/files/50-synaptics.conf b/x11/driver/xorg-input-synaptics/files/50-synaptics.conf
new file mode 100644
index 0000000000..258be2f522
--- /dev/null
+++ b/x11/driver/xorg-input-synaptics/files/50-synaptics.conf
@@ -0,0 +1,50 @@
+# Example xorg.conf.d snippet that assigns the touchpad driver
+# to all touchpads. See xorg.conf.d(5) for more information on
+# InputClass.
+# DO NOT EDIT THIS FILE, your distribution will likely overwrite
+# it when updating. Copy (and rename) this file into
+# /etc/X11/xorg.conf.d first.
+# Additional options may be added in the form of
+# Option "OptionName" "value"
+#
+Section "InputClass"
+ Identifier "touchpad catchall"
+ Driver "synaptics"
+ MatchIsTouchpad "on"
+ Option "TapButton1" "1"
+ Option "TapButton2" "2"
+ Option "TapButton3" "3"
+# This option is recommend on all Linux systems using evdev, but cannot be
+# enabled by default. See the following link for details:
+# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
+ MatchDevicePath "/dev/input/event*"
+EndSection
+
+Section "InputClass"
+ Identifier "touchpad ignore duplicates"
+ MatchIsTouchpad "on"
+ MatchOS "Linux"
+ MatchDevicePath "/dev/input/mouse*"
+ Option "Ignore" "on"
+EndSection
+
+# This option enables the bottom right corner to be a right button on
+# non-synaptics clickpads.
+# This option is only interpreted by clickpads.
+Section "InputClass"
+ Identifier "Default clickpad buttons"
+ MatchDriver "synaptics"
+ Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
+# To disable the bottom edge area so the buttons only work as buttons,
+# not for movement, set the AreaBottomEdge
+# Option "AreaBottomEdge" "82%"
+EndSection
+
+# This option disables software buttons on Apple touchpads.
+# This option is only interpreted by clickpads.
+Section "InputClass"
+ Identifier "Disable clickpad buttons on Apple touchpads"
+ MatchProduct "Apple|bcm5974"
+ MatchDriver "synaptics"
+ Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
+EndSection
\ No newline at end of file
diff --git a/x11/driver/xorg-input-synaptics/files/70-touchpad-quirks.rules b/x11/driver/xorg-input-synaptics/files/70-touchpad-quirks.rules
new file mode 100644
index 0000000000..6c65c294ed
--- /dev/null
+++ b/x11/driver/xorg-input-synaptics/files/70-touchpad-quirks.rules
@@ -0,0 +1,15 @@
+ACTION!="add|change", GOTO="touchpad_quirks_end"
+KERNEL!="event*", GOTO="touchpad_quirks_end"
+
+ENV{ID_INPUT_TOUCHPAD}!="1", GOTO="touchpad_quirks_end"
+
+# model specific quirks
+
+# Dell Minis have a touchpad where the buttons and the touchpad area
+# overlap. Clicking a button thus moves the pointer, this requires special
+# Xorg configuration.
+
+ATTR{[dmi/id]product_name}=="Inspiron 1011|Inspiron 1012", \
+ ENV{ID_INPUT.tags}="touchpad_button_overlap"
+
+LABEL="touchpad_quirks_end"
diff --git a/x11/driver/xorg-input-synaptics/files/add_tapbuttons.diff b/x11/driver/xorg-input-synaptics/files/add_tapbuttons.diff
new file mode 100644
index 0000000000..f9170f74a0
--- /dev/null
+++ b/x11/driver/xorg-input-synaptics/files/add_tapbuttons.diff
@@ -0,0 +1,17 @@
+--- a/conf/50-synaptics.conf 2012-05-11 01:01:10.000000000 +0200
++++ b/conf/50-synaptics.conf.new 2013-01-05 14:20:21.959670353 +0100
+@@ -11,10 +11,13 @@
+ Identifier "touchpad catchall"
+ Driver "synaptics"
+ MatchIsTouchpad "on"
++ Option "TapButton1" "1"
++ Option "TapButton2" "2"
++ Option "TapButton3" "3"
+ # This option is recommend on all Linux systems using evdev, but cannot be
+ # enabled by default. See the following link for details:
+ # http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
+-# MatchDevicePath "/dev/input/event*"
++ MatchDevicePath "/dev/input/event*"
+ EndSection
+
+ Section "InputClass"
diff --git a/x11/driver/xorg-input-synaptics/pspec.xml b/x11/driver/xorg-input-synaptics/pspec.xml
new file mode 100644
index 0000000000..4f3790de17
--- /dev/null
+++ b/x11/driver/xorg-input-synaptics/pspec.xml
@@ -0,0 +1,148 @@
+
+
+
+
+ xorg-input-synaptics
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org synaptics input driver
+ xorg-input-synaptics contains the X.Org driver for Synaptics touchpad devices.
+ http://ftp.x.org/pub/individual/driver/xf86-input-synaptics-1.8.2.tar.bz2
+
+ libXi-devel
+ libXtst-devel
+ libmtdev-devel
+ xorg-server-devel
+
+
+ add_tapbuttons.diff
+
+
+
+
+ xorg-input-synaptics
+
+ libXi
+ libXtst
+ libmtdev
+ xorg-server
+ libevdev
+
+
+ /lib/udev
+ /usr/bin
+ /usr/lib/xorg
+ /usr/share/X11
+ /usr/share/doc
+ /usr/share/man
+
+
+ 50-synaptics.conf
+ 70-touchpad-quirks.rules
+
+
+
+
+ xorg-input-synaptics-devel
+ Development files for xorg-input-synaptics
+
+ xorg-input-synaptics
+
+
+ /usr/include
+ /usr/lib/pkgconfig
+
+
+
+
+
+ 2015-05-08
+ 1.8.2
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-22
+ 1.8.1
+ Version bump.
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-08-31
+ 1.7.6
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.7.5
+ version bump.
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-08
+ 1.7.3
+ Rebuild for xserver 1.15.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2014-03-08
+ 1.7.3
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-08-25
+ 1.7.1
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-26
+ 1.7.1
+ Fixed.
+ Osman Erkan
+ osman.erkan@pisilinux.org
+
+
+ 2013-06-21
+ 1.7.1
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.7.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-04-14
+ 1.7.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.6.2
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-synaptics/translations.xml b/x11/driver/xorg-input-synaptics/translations.xml
new file mode 100644
index 0000000000..7219f7c67b
--- /dev/null
+++ b/x11/driver/xorg-input-synaptics/translations.xml
@@ -0,0 +1,13 @@
+
+
+
+ xorg-input-synaptics
+ X.Org synaptics giriş aygıtı sürücüsü
+ xorg-input-synaptics, Synaptics dokunmatik aygıtlar için X.Org sürücüsünü içerir.
+
+
+
+ xorg-input-synaptics-devel
+ xorg-input-synaptics için geliştirme dosyaları
+
+
diff --git a/x11/driver/xorg-input-vmmouse/actions.py b/x11/driver/xorg-input-vmmouse/actions.py
new file mode 100644
index 0000000000..4c6fb7f158
--- /dev/null
+++ b/x11/driver/xorg-input-vmmouse/actions.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import get
+
+def setup():
+ autotools.configure("\
+ --without-hal-fdi-dir \
+ --without-hal-callouts-dir \
+ --with-udev-rules-dir=/lib/udev/rules.d \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
\ No newline at end of file
diff --git a/x11/driver/xorg-input-vmmouse/files/xf86-input-vmmouse-13.0.0-build_fix-1.patch b/x11/driver/xorg-input-vmmouse/files/xf86-input-vmmouse-13.0.0-build_fix-1.patch
new file mode 100644
index 0000000000..d199463f35
--- /dev/null
+++ b/x11/driver/xorg-input-vmmouse/files/xf86-input-vmmouse-13.0.0-build_fix-1.patch
@@ -0,0 +1,68 @@
+Submitted By: Armin K.
+Date: 2014-08-23
+Initial Package Version: 13.0.0
+Upstream Status: Fixed
+Origin: Upstream
+Description: Fixes building with Glibc 2.20
+
+--- a/shared/vmmouse_client.c 2013-01-15 19:36:50.000000000 +0100
++++ b/shared/vmmouse_client.c 2014-08-23 15:13:54.336165103 +0200
+@@ -35,6 +35,10 @@
+ *
+ */
+
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
+ #include "vmmouse_client.h"
+ #include "vmmouse_proto.h"
+
+--- a/shared/vmmouse_proto.c 2013-01-15 19:36:50.000000000 +0100
++++ b/shared/vmmouse_proto.c 2014-08-23 15:13:54.336165103 +0200
+@@ -33,6 +33,10 @@
+ */
+
+
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
+ #include "vmmouse_proto.h"
+
+
+--- a/shared/vmmouse_proto.h 2013-01-15 19:36:50.000000000 +0100
++++ b/shared/vmmouse_proto.h 2014-08-23 15:13:54.336165103 +0200
+@@ -36,11 +36,6 @@
+ #ifndef _VMMOUSE_PROTO_H_
+ #define _VMMOUSE_PROTO_H_
+
+-
+-#ifdef HAVE_CONFIG_H
+-#include "config.h"
+-#endif
+-
+ #include
+
+ #ifdef HAVE_XORG_SERVER_1_1_0
+--- a/tools/vmmouse_detect.c 2013-01-15 19:36:50.000000000 +0100
++++ b/tools/vmmouse_detect.c 2014-08-23 15:13:54.336165103 +0200
+@@ -26,14 +26,14 @@
+ */
+
+
+-#include
+-#include
+-#include "vmmouse_client.h"
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+
++#include
++#include
++#include "vmmouse_client.h"
++
+ void
+ segvCB(int sig)
+ {
diff --git a/x11/driver/xorg-input-vmmouse/pspec.xml b/x11/driver/xorg-input-vmmouse/pspec.xml
new file mode 100644
index 0000000000..5818027dc9
--- /dev/null
+++ b/x11/driver/xorg-input-vmmouse/pspec.xml
@@ -0,0 +1,104 @@
+
+
+
+
+ xorg-input-vmmouse
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org vmmouse input driver
+ xorg-input-vmmouse contains the X.Org driver for mice in VMware virtual machines.
+ mirrors://xorg/individual/driver/xf86-input-vmmouse-13.0.0.tar.bz2
+
+ xorg-server-devel
+
+
+ xf86-input-vmmouse-13.0.0-build_fix-1.patch
+
+
+
+
+ xorg-input-vmmouse
+
+ xorg-server
+
+
+ /lib/udev
+ /usr/bin
+ /usr/libexec
+ /usr/lib/xorg
+ /usr/share/X11
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 13.0.0
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-27
+ 13.0.0
+ Rebuild for xorg-server-1.16.3
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2014-09-01
+ 13.0.0
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 13.0.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 13.0.0
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 13.0.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 13.0.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 12.9.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-05-30
+ 12.9.0
+ First release
+ Erdem Artan
+ admins@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-vmmouse/translations.xml b/x11/driver/xorg-input-vmmouse/translations.xml
new file mode 100644
index 0000000000..78cd483ad2
--- /dev/null
+++ b/x11/driver/xorg-input-vmmouse/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-input-vmmouse
+ X.Org vmmouse giriş aygıtı sürücüsü
+ xorg-input-vmmouse, VMware sanal makinelerinde fare uyumu için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-input-void/actions.py b/x11/driver/xorg-input-void/actions.py
new file mode 100644
index 0000000000..f4da9d4a71
--- /dev/null
+++ b/x11/driver/xorg-input-void/actions.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import get
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
diff --git a/x11/driver/xorg-input-void/pspec.xml b/x11/driver/xorg-input-void/pspec.xml
new file mode 100644
index 0000000000..dfc6ab218e
--- /dev/null
+++ b/x11/driver/xorg-input-void/pspec.xml
@@ -0,0 +1,98 @@
+
+
+
+
+ xorg-input-void
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org void input driver
+ xorg-input-void is a null input driver which allows the X server to operate without a core pointer and/or core keyboard.
+ mirrors://xorg/individual/driver/xf86-input-void-1.4.1.tar.bz2
+
+
+ xorg-server-devel
+
+
+
+
+ xorg-input-void
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.4.1
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.4.0
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.4.0
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.4.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.4.0
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.4.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.4.0
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.4.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-05-30
+ 1.4.0
+ First release
+ Erdem Artan
+ admins@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-void/translations.xml b/x11/driver/xorg-input-void/translations.xml
new file mode 100644
index 0000000000..6265a44be4
--- /dev/null
+++ b/x11/driver/xorg-input-void/translations.xml
@@ -0,0 +1,13 @@
+
+
+
+ xorg-input-void
+ X.Org void giriş aygıtı sürücüsü
+ xorg-input-void, X sunucusunun herhangi bir ana işaretçi ve/veya ana klavye olmadan çalışabilmesini sağlayan işlevsiz bir giriş aygıtı sürücüsüdür.
+
+
+
+ xorg-input-void-devel
+ xorg-input-void için geliştirme dosyaları
+
+
diff --git a/x11/driver/xorg-input-wacom/actions.py b/x11/driver/xorg-input-wacom/actions.py
new file mode 100644
index 0000000000..cc7113d5e3
--- /dev/null
+++ b/x11/driver/xorg-input-wacom/actions.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/licenses/gpl.txt
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import get
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-silent-rules \
+ --with-udev-rules-dir=/lib/udev/rules.d \
+ --enable-debug \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
+ pisitools.removeDir("/lib/udev/rules.d")
+ pisitools.removeDir("/usr/lib/systemd")
+ pisitools.dodoc("AUTHORS", "ChangeLog", "GPL", "README")
diff --git a/x11/driver/xorg-input-wacom/files/70-wacom.rules b/x11/driver/xorg-input-wacom/files/70-wacom.rules
new file mode 100644
index 0000000000..7a15887c16
--- /dev/null
+++ b/x11/driver/xorg-input-wacom/files/70-wacom.rules
@@ -0,0 +1,16 @@
+ACTION!="add|change", GOTO="wacom_end"
+
+# Match all serial wacom tablets with a serial ID starting with WACf
+# Notes: We assign NAME though we shouldn't, but currently the server requires it
+# We assign the lot to subsystem pnp too because server reads NAME from
+# the parent device. Once all that's fixed, as simple SUBSYSTEM="tty"
+# will do and the ENV{NAME} can be removed.
+SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="WACf*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tablet $attr{id}"
+SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="FUJ*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tablet $attr{id}"
+
+# comment out the next line if your distribution does not provide systemd
+# If a /dev/ttySx device with the WACf name is detected, start the
+# wacom-inputattach service with the kernel name as parameter
+#SUBSYSTEM=="tty|pnp", KERNEL=="ttyS[0-9]*", ATTRS{id}=="WACf*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="wacom-inputattach@%k.service"
+
+LABEL="wacom_end"
diff --git a/x11/driver/xorg-input-wacom/pspec.xml b/x11/driver/xorg-input-wacom/pspec.xml
new file mode 100644
index 0000000000..57e472fc2d
--- /dev/null
+++ b/x11/driver/xorg-input-wacom/pspec.xml
@@ -0,0 +1,144 @@
+
+
+
+
+ xorg-input-wacom
+ http://linuxwacom.sourceforge.net/
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ GPLv2+
+ driver
+ Input driver for Wacom tablets and drawing devices
+ xorg-input-wacom includes the drivers and tools for Wacom devices.
+ mirrors://sourceforge/linuxwacom/xf86-input-wacom/xf86-input-wacom-0.29.0.tar.bz2
+
+ libXi-devel
+ libXrandr-devel
+ xorg-server-devel
+ libXinerama-devel
+
+
+
+
+ xorg-input-wacom
+
+ libXi
+ libXrandr
+ libXinerama
+ xorg-server
+
+
+ /lib/udev
+ /usr/bin
+ /usr/lib/xorg
+ /usr/share/X11
+ /usr/share/doc
+ /usr/share/man
+
+
+ 70-wacom.rules
+
+
+
+
+ xorg-input-wacom-devel
+ Development files for xorg-input-wacom
+
+ xorg-input-wacom
+
+
+ /usr/bin/isdv4-serial-debugger
+ /usr/include
+ /usr/lib/pkgconfig
+
+
+
+
+
+ 2015-05-08
+ 0.29.0
+ Version bump
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2015-01-23
+ 0.24.0
+ Version bump
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.24.0
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.24.0
+ version bump
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-09
+ 0.23.0
+ Rebuild for xserver 1.15.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2014-03-08
+ 0.23.0
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-11-05
+ 0.22.1
+ Fix deps.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 0.22.1
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-07-21
+ 0.22.1
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-06-21
+ 0.21.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.17.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 0.17.0
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-input-wacom/translations.xml b/x11/driver/xorg-input-wacom/translations.xml
new file mode 100644
index 0000000000..7e2aa28f13
--- /dev/null
+++ b/x11/driver/xorg-input-wacom/translations.xml
@@ -0,0 +1,13 @@
+
+
+
+ xorg-input-wacom
+ Wacom tabletleri ve çizim aygıtları için giriş sürücüsü
+ xorg-input-wacom, Wacom aygıtlarını kullanmak için sürücü ve araçları içerir.
+
+
+
+ xorg-input-wacom-devel
+ xorg-input-wacom için geliştirme dosyaları
+
+
diff --git a/x11/driver/xorg-video-apm/actions.py b/x11/driver/xorg-video-apm/actions.py
new file mode 100644
index 0000000000..29a3cd1003
--- /dev/null
+++ b/x11/driver/xorg-video-apm/actions.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-fiv")
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-apm/files/git-fix.diff b/x11/driver/xorg-video-apm/files/git-fix.diff
new file mode 100644
index 0000000000..e48d2c42d8
--- /dev/null
+++ b/x11/driver/xorg-video-apm/files/git-fix.diff
@@ -0,0 +1,23 @@
+From 9f67408e4f078e907fbf4feb45cfdcfd0cdebcca Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Thu, 10 Jan 2013 03:03:29 +0000
+Subject: Remove #include "mibstore.h"
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/apm.h b/src/apm.h
+index a3c06f8..365e5e2 100644
+--- a/src/apm.h
++++ b/src/apm.h
+@@ -33,9 +33,6 @@
+ /* All drivers initialising the SW cursor need this */
+ #include "mipointer.h"
+
+-/* All drivers implementing backing store need this */
+-#include "mibstore.h"
+-
+ /* I2C support */
+ #include "xf86i2c.h"
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-apm/pspec.xml b/x11/driver/xorg-video-apm/pspec.xml
new file mode 100644
index 0000000000..70204e41e2
--- /dev/null
+++ b/x11/driver/xorg-video-apm/pspec.xml
@@ -0,0 +1,108 @@
+
+
+
+
+ xorg-video-apm
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org apm video driver
+ xorg-video-apm contains the X.Org driver for Alliance Promotion cards.
+ mirrors://xorg/individual/driver/xf86-video-apm-1.2.5.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fix.diff
+
+
+
+
+ xorg-video-apm
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.2.5
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-21
+ 1.2.5
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.2.5
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.2.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.2.5
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.2.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.2.5
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.2.5
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.2.5
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.2.5
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-apm/translations.xml b/x11/driver/xorg-video-apm/translations.xml
new file mode 100644
index 0000000000..99409fc3f9
--- /dev/null
+++ b/x11/driver/xorg-video-apm/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-apm
+ X.Org apm ekran kartı sürücüsü
+ xorg-video-apm, Alliance Promotion ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-cirrus/actions.py b/x11/driver/xorg-video-cirrus/actions.py
new file mode 100644
index 0000000000..7fb463ec9f
--- /dev/null
+++ b/x11/driver/xorg-video-cirrus/actions.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-fiv")
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README*")
diff --git a/x11/driver/xorg-video-cirrus/pspec.xml b/x11/driver/xorg-video-cirrus/pspec.xml
new file mode 100644
index 0000000000..dbd894d363
--- /dev/null
+++ b/x11/driver/xorg-video-cirrus/pspec.xml
@@ -0,0 +1,106 @@
+
+
+
+
+ xorg-video-cirrus
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org cirrus video driver
+ xorg-video-cirrus contains the X.Org driver for Cirrus Logic cards.
+ mirrors://xorg/individual/driver/xf86-video-cirrus-1.5.3.tar.bz2
+
+ libpciaccess-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-cirrus
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.5.3
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 1.5.2
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.5.2
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.5.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.5.2
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.5.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.5.2
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.5.2
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.5.2
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.5.1
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-cirrus/translations.xml b/x11/driver/xorg-video-cirrus/translations.xml
new file mode 100644
index 0000000000..a99f99c57e
--- /dev/null
+++ b/x11/driver/xorg-video-cirrus/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-cirrus
+ X.Org cirrus ekran kartı sürücüsü
+ xorg-video-cirrus, Cirrus Logic ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-dummy/actions.py b/x11/driver/xorg-video-dummy/actions.py
new file mode 100644
index 0000000000..5ae2962112
--- /dev/null
+++ b/x11/driver/xorg-video-dummy/actions.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import autotools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README*")
diff --git a/x11/driver/xorg-video-dummy/files/git-fixes.diff b/x11/driver/xorg-video-dummy/files/git-fixes.diff
new file mode 100644
index 0000000000..4b0b46ef30
--- /dev/null
+++ b/x11/driver/xorg-video-dummy/files/git-fixes.diff
@@ -0,0 +1,31 @@
+From 44f04fd3046043ed31369025f34353c4e0e5c1cd Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:36 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/dummy_driver.c b/src/dummy_driver.c
+index 62066d6..6062c39 100644
+--- a/src/dummy_driver.c
++++ b/src/dummy_driver.c
+@@ -14,9 +14,6 @@
+ /* All drivers initialising the SW cursor need this */
+ #include "mipointer.h"
+
+-/* All drivers implementing backing store need this */
+-#include "mibstore.h"
+-
+ /* All drivers using the mi colormap manipulation need this */
+ #include "micmap.h"
+
+@@ -617,7 +614,6 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
+ , lines - pScrn->virtualY);
+ }
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-dummy/pspec.xml b/x11/driver/xorg-video-dummy/pspec.xml
new file mode 100644
index 0000000000..cb9880635e
--- /dev/null
+++ b/x11/driver/xorg-video-dummy/pspec.xml
@@ -0,0 +1,107 @@
+
+
+
+
+ xorg-video-dummy
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org dummy video driver
+ xorg-video-dummy is a dummy video driver for X.Org.
+ mirrors://xorg/individual/driver/xf86-video-dummy-0.3.7.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+
+
+
+ xorg-video-dummy
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+
+
+
+
+
+ 2015-05-08
+ 0.3.7
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 0.3.7
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.3.7
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.3.7
+ Version bump.
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-09
+ 0.3.6
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 0.3.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 0.3.6
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.3.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 0.3.6
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 0.3.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-dummy/translations.xml b/x11/driver/xorg-video-dummy/translations.xml
new file mode 100644
index 0000000000..652f922571
--- /dev/null
+++ b/x11/driver/xorg-video-dummy/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-dummy
+ X.Org dummy ekran kartı sürücüsü
+ xorg-video-dummy, X.Org için sahte bir ekran kartı sürücüsü içerir.
+
+
diff --git a/x11/driver/xorg-video-fbdev/actions.py b/x11/driver/xorg-video-fbdev/actions.py
new file mode 100644
index 0000000000..5c00a72888
--- /dev/null
+++ b/x11/driver/xorg-video-fbdev/actions.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-fbdev/files/git-fixes.diff b/x11/driver/xorg-video-fbdev/files/git-fixes.diff
new file mode 100644
index 0000000000..138d5bc2a1
--- /dev/null
+++ b/x11/driver/xorg-video-fbdev/files/git-fixes.diff
@@ -0,0 +1,29 @@
+From ac293412a01d87f87eb61f4adb9db7486a75d3fc Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:37 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/fbdev.c b/src/fbdev.c
+index cd7ebc5..f5a7378 100644
+--- a/src/fbdev.c
++++ b/src/fbdev.c
+@@ -14,7 +14,6 @@
+ #include "xf86_OSproc.h"
+
+ #include "mipointer.h"
+-#include "mibstore.h"
+ #include "micmap.h"
+ #include "colormapst.h"
+ #include "xf86cmap.h"
+@@ -845,7 +844,6 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
+ }
+
+ xf86SetBlackWhitePixels(pScreen);
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+
+ /* software cursor */
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-fbdev/pspec.xml b/x11/driver/xorg-video-fbdev/pspec.xml
new file mode 100644
index 0000000000..d99bbfd345
--- /dev/null
+++ b/x11/driver/xorg-video-fbdev/pspec.xml
@@ -0,0 +1,110 @@
+
+
+
+
+ xorg-video-fbdev
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org fbdev video driver
+ xorg-video-fbdev contains the X.Org driver for Linux framebuffer device.
+ mirrors://xorg/individual/driver/xf86-video-fbdev-0.4.4.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+
+
+
+
+
+ xorg-video-fbdev
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 0.4.4
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 0.4.4
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.4.4
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.4.4
+ Version bump.
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-09
+ 0.4.3
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 0.4.3
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 0.4.3
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.4.3
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 0.4.3
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 0.4.3
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-fbdev/translations.xml b/x11/driver/xorg-video-fbdev/translations.xml
new file mode 100644
index 0000000000..329b40e86e
--- /dev/null
+++ b/x11/driver/xorg-video-fbdev/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-fbdev
+ X.Org fbdev ekran kartı sürücüsü
+ xorg-video-fbdev, Linux framebuffer aygıtı için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-geode/actions.py b/x11/driver/xorg-video-geode/actions.py
new file mode 100644
index 0000000000..ff46368204
--- /dev/null
+++ b/x11/driver/xorg-video-geode/actions.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import shelltools
+
+def setup():
+ shelltools.export("LC_ALL", "C")
+ #autotools.autoreconf("-vif")
+ autotools.configure("\
+ --disable-static \
+ --enable-visibility\
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-geode/files/build-fix-1.17.patch b/x11/driver/xorg-video-geode/files/build-fix-1.17.patch
new file mode 100644
index 0000000000..9878c64c0b
--- /dev/null
+++ b/x11/driver/xorg-video-geode/files/build-fix-1.17.patch
@@ -0,0 +1,243 @@
+diff --git a/src/gx_driver.c b/src/gx_driver.c
+index 7f44e19..ab57df1 100644
+--- a/src/gx_driver.c
++++ b/src/gx_driver.c
+@@ -32,6 +32,9 @@
+ #endif
+
+ #include
++#include
++#include
++#include
+
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+@@ -322,7 +325,6 @@ map_pci_mem(ScrnInfoPtr pScrni, int vram,
+ struct pci_device *dev, int bar, int size)
+ {
+ void *ptr;
+- void **result = (void **) &ptr;
+ int map_size = size ? size : dev->regions[bar].size;
+
+ int err = pci_device_map_range(dev,
+@@ -330,12 +332,18 @@ map_pci_mem(ScrnInfoPtr pScrni, int vram,
+ map_size,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0),
+- result);
++ &ptr);
+
+ if (err)
+ return NULL;
+ return ptr;
+ }
++
++static inline int
++unmap_pci_mem(ScrnInfoPtr pScrni, struct pci_device *dev, void *ptr, int size)
++{
++ return pci_device_unmap_range(dev, ptr, size);
++}
+ #endif
+
+ extern unsigned long gfx_gx2_scratch_base;
+@@ -373,8 +381,19 @@ GXMapMem(ScrnInfoPtr pScrni)
+
+ gfx_gx2_scratch_base = pGeode->FBAvail - 0x4000;
+
++#ifndef XSERVER_LIBPCIACCESS
+ XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000);
+-
++#else
++ {
++ int fd = open("/dev/mem", O_RDWR);
++ if (fd < 0) {
++ xf86DrvMsg(index, X_ERROR, "Failed to open /dev/mem: %m\n");
++ return FALSE;
++ }
++ XpressROMPtr = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xF0000);
++ close(fd);
++ }
++#endif
+ pGeode->FBBase = gfx_virt_fbptr;
+
+ if ((!gfx_virt_regptr) || (!gfx_virt_gpptr) ||
+@@ -395,9 +414,9 @@ GXMapMem(ScrnInfoPtr pScrni)
+ */
+
+ static Bool
+-GXCheckVGA(ScrnInfoPtr pScrni)
++GXCheckVGA(ScrnInfoPtr pScrni, EntityInfoPtr pEnt)
+ {
+-
++#ifndef XSERVER_LIBPCIACCESS
+ unsigned char *ptr;
+ const char *vgasig = "IBM VGA Compatible";
+ int ret;
+@@ -413,6 +432,11 @@ GXCheckVGA(ScrnInfoPtr pScrni)
+ xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig));
+
+ return ret ? FALSE : TRUE;
++#else
++ pciVideoPtr pci = xf86GetPciInfoForEntity(pEnt->index);
++
++ return pci_device_is_boot_vga(pci);
++#endif
+ }
+
+ static Bool
+@@ -443,7 +467,7 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
+ if (pGeode == NULL)
+ return FALSE;
+
+- useVGA = GXCheckVGA(pScrni);
++ useVGA = GXCheckVGA(pScrni, pEnt);
+
+ if (flags & PROBE_DETECT) {
+ GeodeProbeDDC(pScrni, pEnt->index);
+@@ -591,12 +615,18 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
+ panelgeo = xf86GetOptValString(GeodeOptions, GX_OPTION_PANEL_GEOMETRY);
+
+ if ((s = xf86GetOptValString(GeodeOptions, GX_OPTION_ACCEL_METHOD))) {
++#if defined(XF86XAA) && defined(XF86EXA)
+ if (!xf86NameCmp(s, "XAA"))
+ pGeode->useEXA = FALSE;
+ else if (xf86NameCmp(s, "EXA"))
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Unknown accleration method %s. Defaulting to XAA.\n",
+ s);
++#elif defined(XF86EXA)
++ pGeode->useEXA = TRUE;
++#else
++ pGeode->useEXA = FALSE;
++#endif
+ }
+
+ xf86DrvMsg(pScrni->scrnIndex, X_INFO,
+@@ -752,11 +782,21 @@ GXUnmapMem(ScrnInfoPtr pScrni)
+ GeodeRec *pGeode = GEODEPTR(pScrni);
+
+ /* unmap all the memory map's */
+-
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_regptr, GX_CPU_REG_SIZE);
+ xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_gpptr, GX_GP_REG_SIZE);
+ xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_vidptr, GX_VID_REG_SIZE);
+ xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_fbptr, pGeode->FBAvail);
++#else
++ pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
++
++ unmap_pci_mem(pScrni, pci, gfx_virt_regptr, GX_CPU_REG_SIZE);
++ unmap_pci_mem(pScrni, pci, gfx_virt_gpptr, GX_GP_REG_SIZE);
++ unmap_pci_mem(pScrni, pci, gfx_virt_vidptr, GX_VID_REG_SIZE);
++ unmap_pci_mem(pScrni, pci, gfx_virt_fbptr, pGeode->FBAvail);
++
++ munmap(XpressROMPtr, 0x10000);
++#endif
+ return TRUE;
+ }
+
+diff --git a/src/lx_driver.c b/src/lx_driver.c
+index 146578e..c68f715 100644
+--- a/src/lx_driver.c
++++ b/src/lx_driver.c
+@@ -33,6 +33,9 @@
+
+ #include
+ #include
++#include
++#include
++#include
+
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+@@ -155,7 +158,6 @@ map_pci_mem(ScrnInfoPtr pScrni, int vram,
+ struct pci_device *dev, int bar, int size)
+ {
+ void *ptr;
+- void **result = (void **) &ptr;
+ int map_size = size ? size : dev->regions[bar].size;
+
+ int err = pci_device_map_range(dev,
+@@ -163,7 +165,7 @@ map_pci_mem(ScrnInfoPtr pScrni, int vram,
+ map_size,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0),
+- result);
++ &ptr);
+
+ if (err)
+ return NULL;
+@@ -235,7 +237,19 @@ LXMapMem(ScrnInfoPtr pScrni)
+ pGeode->FBAvail);
+ gp_set_command_buffer_base(cmd_bfr_phys, 0, pGeode->CmdBfrSize);
+
++#ifndef XSERVER_LIBPCIACCESS
+ XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000);
++#else
++ {
++ int fd = open("/dev/mem", O_RDWR);
++ if (fd < 0) {
++ xf86DrvMsg(index, X_ERROR, "Failed to open /dev/mem: %m\n");
++ return FALSE;
++ }
++ XpressROMPtr = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xF0000);
++ close(fd);
++ }
++#endif
+
+ pGeode->FBBase = cim_fb_ptr;
+
+@@ -253,9 +267,9 @@ LXMapMem(ScrnInfoPtr pScrni)
+ */
+
+ static Bool
+-LXCheckVGA(ScrnInfoPtr pScrni)
++LXCheckVGA(ScrnInfoPtr pScrni, EntityInfoPtr pEnt)
+ {
+-
++#ifndef XSERVER_LIBPCIACCESS
+ unsigned char *ptr;
+ const char *vgasig = "IBM VGA Compatible";
+ int ret;
+@@ -271,6 +285,11 @@ LXCheckVGA(ScrnInfoPtr pScrni)
+ xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig));
+
+ return ret ? FALSE : TRUE;
++#else
++ pciVideoPtr pci = xf86GetPciInfoForEntity(pEnt->index);
++
++ return pci_device_is_boot_vga(pci);
++#endif
+ }
+
+ static Bool
+@@ -310,7 +329,7 @@ LXPreInit(ScrnInfoPtr pScrni, int flags)
+ if (pGeode == NULL)
+ return FALSE;
+
+- pGeode->useVGA = LXCheckVGA(pScrni);
++ pGeode->useVGA = LXCheckVGA(pScrni, pEnt);
+ pGeode->VGAActive = FALSE;
+ pGeode->pEnt = pEnt;
+
+@@ -611,6 +630,8 @@ LXUnmapMem(ScrnInfoPtr pScrni)
+ xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vg_ptr, LX_VG_REG_SIZE);
+ xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vid_ptr, LX_VID_REG_SIZE);
+ xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vip_ptr, LX_VIP_REG_SIZE);
++
++ xf86UnMapVidMem(pScrni->scrnIndex, XpressROMPtr, 0x10000);
+ #else
+ GeodeRec *pGeode = GEODEPTR(pScrni);
+ pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
+@@ -620,9 +641,9 @@ LXUnmapMem(ScrnInfoPtr pScrni)
+ unmap_pci_mem(pScrni, pci, cim_vid_ptr, LX_VID_REG_SIZE);
+ unmap_pci_mem(pScrni, pci, cim_vip_ptr, LX_VIP_REG_SIZE);
+ unmap_pci_mem(pScrni, pci, cim_fb_ptr, pGeode->FBAvail + CIM_CMD_BFR_SZ);
+-#endif
+
+- xf86UnMapVidMem(pScrni->scrnIndex, XpressROMPtr, 0x10000);
++ munmap(XpressROMPtr, 0x10000);
++#endif
+
+ return TRUE;
+ }
diff --git a/x11/driver/xorg-video-geode/files/xf86-video-geode-2.11.16-glibc-2.20.patch b/x11/driver/xorg-video-geode/files/xf86-video-geode-2.11.16-glibc-2.20.patch
new file mode 100644
index 0000000000..b5ea6a121a
--- /dev/null
+++ b/x11/driver/xorg-video-geode/files/xf86-video-geode-2.11.16-glibc-2.20.patch
@@ -0,0 +1,14 @@
+--- xf86-video-geode-2.11.16/src/lx_memory.c.orig 2014-10-16 21:48:40.794858194 -0400
++++ xf86-video-geode-2.11.16/src/lx_memory.c 2014-10-16 21:49:10.025007547 -0400
+@@ -23,6 +23,10 @@
+ * software without specific prior written permission.
+ */
+
++#if HAVE_CONFIG_H
++#include "config.h"
++#endif
++
+ #include "xf86.h"
+ #include "geode.h"
+ #include "cim/cim_regs.h"
+
diff --git a/x11/driver/xorg-video-geode/pspec.xml b/x11/driver/xorg-video-geode/pspec.xml
new file mode 100644
index 0000000000..a7f918e0b0
--- /dev/null
+++ b/x11/driver/xorg-video-geode/pspec.xml
@@ -0,0 +1,108 @@
+
+
+
+
+ xorg-video-geode
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org geode video driver
+ xorg-video-geode contains the X.Org driver for AMD Geode video cards.
+ mirrors://xorg/individual/driver/xf86-video-geode-2.11.16.tar.bz2
+
+ xorg-server-devel
+
+
+ xf86-video-geode-2.11.16-glibc-2.20.patch
+ build-fix-1.17.patch
+
+
+
+
+ xorg-video-geode
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+
+
+
+
+
+ 2015-05-10
+ 2.11.16
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-02-10
+ 2.11.16
+ Rebuild xorg-server 1.6.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 2.11.16
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 2.11.15
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 2.11.15
+ Version bump.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 2.11.14
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 2.11.14
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 2.11.4
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 2.11.14
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-12
+ 2.11.13
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-geode/translations.xml b/x11/driver/xorg-video-geode/translations.xml
new file mode 100644
index 0000000000..048c5ff2c2
--- /dev/null
+++ b/x11/driver/xorg-video-geode/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-geode
+ X.Org geode ekran kartı sürücüsü
+ xorg-video-geode, AMD Geode ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-glint/actions.py b/x11/driver/xorg-video-glint/actions.py
new file mode 100644
index 0000000000..8d1fcaf1c5
--- /dev/null
+++ b/x11/driver/xorg-video-glint/actions.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-dri \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README*")
diff --git a/x11/driver/xorg-video-glint/files/git-fix.diff b/x11/driver/xorg-video-glint/files/git-fix.diff
new file mode 100644
index 0000000000..6bc5738c80
--- /dev/null
+++ b/x11/driver/xorg-video-glint/files/git-fix.diff
@@ -0,0 +1,30 @@
+From 073d5b0b392781bf4a6aa7f9e2dbe2ae51caed2c Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:38 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/glint_driver.c b/src/glint_driver.c
+index b6d20a9..aa78516 100644
+--- a/src/glint_driver.c
++++ b/src/glint_driver.c
+@@ -52,8 +52,6 @@
+ #include "compiler.h"
+ #include "mipointer.h"
+
+-#include "mibstore.h"
+-
+ #include "pm3_regs.h"
+ #include "glint_regs.h"
+ #include "IBM.h"
+@@ -2904,7 +2902,6 @@ GLINTScreenInit(SCREEN_INIT_ARGS_DECL)
+ }
+ }
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-glint/pspec.xml b/x11/driver/xorg-video-glint/pspec.xml
new file mode 100644
index 0000000000..c3549eeab4
--- /dev/null
+++ b/x11/driver/xorg-video-glint/pspec.xml
@@ -0,0 +1,110 @@
+
+
+
+
+ xorg-video-glint
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org glint video driver
+ xorg-video-glint contains the X.Org driver for 3DLabs Permedia cards.
+ mirrors://xorg/individual/driver/xf86-video-glint-1.2.8.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+ git-fix.diff
+
+
+
+
+ xorg-video-glint
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.2.8
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 1.2.8
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.2.8
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.2.8
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.2.8
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.2.8
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.2.8
+ Rebuild
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.2.8
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.2.8
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.2.8
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-glint/translations.xml b/x11/driver/xorg-video-glint/translations.xml
new file mode 100644
index 0000000000..1cd479ad92
--- /dev/null
+++ b/x11/driver/xorg-video-glint/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-glint
+ X.Org glint ekran kartı sürücüsü
+ xorg-video-glint, 3DLabs Permedia ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-i128/actions.py b/x11/driver/xorg-video-i128/actions.py
new file mode 100644
index 0000000000..5c00a72888
--- /dev/null
+++ b/x11/driver/xorg-video-i128/actions.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-i128/files/1600sw-range-hack.patch b/x11/driver/xorg-video-i128/files/1600sw-range-hack.patch
new file mode 100644
index 0000000000..5e3294659d
--- /dev/null
+++ b/x11/driver/xorg-video-i128/files/1600sw-range-hack.patch
@@ -0,0 +1,67 @@
+--- xf86-video-i128-1.2.0/src/i128_driver.c.1600sw-hack 2006-04-07 15:10:18.000000000 -0400
++++ xf86-video-i128-1.2.0/src/i128_driver.c 2006-08-28 14:15:22.000000000 -0400
+@@ -508,6 +508,45 @@ I128AvailableOptions(int chipid, int bus
+ return I128Options;
+ }
+
++#define MODEPREFIX(name) NULL, NULL, name, 0, M_T_DRIVER
++#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
++
++static DisplayModeRec sgi1600sw_modes[] = {
++ { MODEPREFIX("1600x1024"), 103125, 1600, 1600, 1656, 1664, 0,
++ 1024, 1024, 1029, 1030, 0,
++ V_PHSYNC | V_PVSYNC, MODESUFFIX },
++ { MODEPREFIX("800x512"), 54375, 800, 800, 840, 848, 0,
++ 512, 512, 514, 515, 0,
++ V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX }
++};
++
++static void
++add1600SWModes(ScrnInfoPtr pScrn)
++{
++ DisplayModePtr modes;
++ int hskew = 0;
++
++ modes = xnfcalloc(2, sizeof(*modes));
++
++ memcpy(modes, sgi1600sw_modes, 2 * sizeof(*modes));
++
++ switch (pScrn->bitsPerPixel) {
++ case 8:
++ hskew = 1; break;
++ case 16:
++ hskew = 5; break;
++ case 24: case 32:
++ hskew = 7; break;
++ default: break;
++ }
++
++ modes[0].HSkew = modes[1].HSkew = hskew;
++
++ modes[0].next = &modes[1];
++ modes[1].next = pScrn->monitor->Modes;
++
++ pScrn->monitor->Modes = modes;
++}
+
+ /* Mandatory
+ *
+@@ -1081,6 +1120,18 @@ I128PreInit(ScrnInfoPtr pScrn, int flags
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Digital flat panel forced\n");
+
++ if (pI128->FlatPanel && !mon) {
++ /* Since DDC can be unreliable, jam in known 1600SW data */
++ pScrn->monitor->nHsync = 1;
++ pScrn->monitor->hsync[0].lo = 30.0;
++ pScrn->monitor->hsync[0].hi = 72.0;
++ pScrn->monitor->nVrefresh = 1;
++ pScrn->monitor->vrefresh[0].lo = 58;
++ pScrn->monitor->vrefresh[0].hi = 62;
++ pScrn->monitor->maxPixClock = 104 * 1000;
++ add1600SWModes(pScrn);
++ }
++
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Using SilverHammer programmable clock (MCLK %1.3f MHz)\n",
+ mclk / 1000.0);
diff --git a/x11/driver/xorg-video-i128/files/git-fixes.diff b/x11/driver/xorg-video-i128/files/git-fixes.diff
new file mode 100644
index 0000000000..de3287d131
--- /dev/null
+++ b/x11/driver/xorg-video-i128/files/git-fixes.diff
@@ -0,0 +1,53 @@
+From 3226d66c951f3621fb940cc5844098d892089eb1 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Wed, 15 Aug 2012 17:03:11 +0000
+Subject: Don't bother to include vbe.h
+
+Just copied from xf86 boilerplate afaict.
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/i128_driver.c b/src/i128_driver.c
+index 66fdee0..a0f08c0 100644
+--- a/src/i128_driver.c
++++ b/src/i128_driver.c
+@@ -55,7 +55,6 @@
+ #include "micmap.h"
+
+ #include "xf86DDC.h"
+-#include "vbe.h"
+
+ #include "xf86cmap.h"
+ #include "fb.h"
+--
+cgit v0.9.0.2-2-gbebe
+From c87753733a6e1f85d1d037dced0b47ce0cf41658 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:40 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/i128_driver.c b/src/i128_driver.c
+index a0f08c0..51a4135 100644
+--- a/src/i128_driver.c
++++ b/src/i128_driver.c
+@@ -50,8 +50,6 @@
+ /* All drivers initialising the SW cursor need this */
+ #include "mipointer.h"
+
+-/* All drivers implementing backing store need this */
+-#include "mibstore.h"
+ #include "micmap.h"
+
+ #include "xf86DDC.h"
+@@ -1556,7 +1554,6 @@ I128ScreenInit(SCREEN_INIT_ARGS_DECL)
+ return FALSE;
+ }
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-i128/pspec.xml b/x11/driver/xorg-video-i128/pspec.xml
new file mode 100644
index 0000000000..b1e3026198
--- /dev/null
+++ b/x11/driver/xorg-video-i128/pspec.xml
@@ -0,0 +1,109 @@
+
+
+
+
+ xorg-video-i128
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org i128 video driver
+ xorg-video-i128 contains the X.Org driver for Number Nine chipsets.
+ mirrors://xorg/individual/driver/xf86-video-i128-1.3.6.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fixes.diff
+ 1600sw-range-hack.patch
+
+
+
+
+ xorg-video-i128
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.3.6
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 1.3.6
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.3.6
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.3.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.3.6
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.3.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.3.6
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.3.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.3.6
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.3.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-i128/translations.xml b/x11/driver/xorg-video-i128/translations.xml
new file mode 100644
index 0000000000..3acd80d9d6
--- /dev/null
+++ b/x11/driver/xorg-video-i128/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-i128
+ X.Org i128 ekran kartı sürücüsü
+ xorg-video-i128, Number Nine ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-i740/actions.py b/x11/driver/xorg-video-i740/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-i740/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-i740/files/git-fix.diff b/x11/driver/xorg-video-i740/files/git-fix.diff
new file mode 100644
index 0000000000..a33dc7e3db
--- /dev/null
+++ b/x11/driver/xorg-video-i740/files/git-fix.diff
@@ -0,0 +1,32 @@
+From 084aa23643bf4245c917e3d672576bc9e5717017 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Thu, 10 Jan 2013 03:21:52 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/i740_driver.c b/src/i740_driver.c
+index 1c82198..7c1051d 100644
+--- a/src/i740_driver.c
++++ b/src/i740_driver.c
+@@ -63,10 +63,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ #include "compiler.h"
+
+-/* Drivers using the mi implementation of backing store need: */
+-
+-#include "mibstore.h"
+-
+ /* All drivers using the vgahw module need this */
+ /* This driver needs to be modified to not use vgaHW for multihead operation */
+ #include "vgaHW.h"
+@@ -1558,7 +1554,6 @@ I740ScreenInit(SCREEN_INIT_ARGS_DECL) {
+ }
+ }
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-i740/pspec.xml b/x11/driver/xorg-video-i740/pspec.xml
new file mode 100644
index 0000000000..62b26abf97
--- /dev/null
+++ b/x11/driver/xorg-video-i740/pspec.xml
@@ -0,0 +1,108 @@
+
+
+
+
+ xorg-video-i740
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org i740 video driver
+ xorg-video-i740 contains the X.Org driver for Intel i740 cards.
+ mirrors://xorg/individual/driver/xf86-video-i740-1.3.4.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fix.diff
+
+
+
+
+ xorg-video-i740
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.3.4
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 1.3.4
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.3.4
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.3.4
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.3.4
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.3.4
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.3.4
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.3.4
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.3.4
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.3.4
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-i740/translations.xml b/x11/driver/xorg-video-i740/translations.xml
new file mode 100644
index 0000000000..6d4ccee05f
--- /dev/null
+++ b/x11/driver/xorg-video-i740/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-i740
+ X.Org i740 ekran kartı sürücüsü
+ xorg-video-i740, Intel i740 ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-intel/actions.py b/x11/driver/xorg-video-intel/actions.py
new file mode 100644
index 0000000000..ce93ed0f7d
--- /dev/null
+++ b/x11/driver/xorg-video-intel/actions.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+
+def setup():
+ # DRI3 has been known to be buggy with the current stack, so is disabled
+ autotools.configure("\
+ --disable-static \
+ --disable-dri3 \
+ --enable-glamor \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.rawInstall("DESTDIR=%s" % get.installDIR())
+
+ pisitools.dodoc("AUTHORS", "COPYING", "ChangeLog", "NEWS", "README")
diff --git a/x11/driver/xorg-video-intel/pspec.xml b/x11/driver/xorg-video-intel/pspec.xml
new file mode 100644
index 0000000000..0cf623ed48
--- /dev/null
+++ b/x11/driver/xorg-video-intel/pspec.xml
@@ -0,0 +1,154 @@
+
+
+
+
+ xorg-video-intel
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org intel video driver
+ xorg-video-intel contains the X.Org driver for Intel video chipsets.
+ mirrors://xorg/individual/driver/xf86-video-intel-2.99.917.tar.bz2
+
+ libXv-devel
+ libdrm-devel
+ pixman-devel
+ libXext-devel
+ libXtst-devel
+ libXvMC-devel
+ xcb-util-devel
+ libXrandr-devel
+ libXfixes-devel
+ libXcursor-devel
+ libXrender-devel
+ libXdamage-devel
+ libXinerama-devel
+ libdrm-intel
+ libpciaccess-devel
+ xorg-server-devel
+ libxshmfence-devel
+
+
+
+
+ xorg-video-intel
+
+ libXv
+ libdrm
+ pixman
+ libXext
+ libXtst
+ libXvMC
+ xcb-util
+ libXrandr
+ libXfixes
+ libXcursor
+ libXrender
+ libXdamage
+ libXinerama
+ libdrm-intel
+ libpciaccess
+ xorg-server
+ libxshmfence
+
+
+ /usr/bin
+ /usr/lib
+ /usr/libexec
+ /usr/share/doc
+ /usr/share/man
+ /usr/share
+
+
+
+
+
+ 2015-05-10
+ 2.99.917
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-21
+ 2.99.917
+ Version bump.
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 2.99.914
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 2.99.911
+ Version bump.
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-12
+ 2.21.15
+ Add xserver 1.15 xompat patch.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 2.21.15
+ Version bump for xorg-server 1.15.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-11-06
+ 2.21.9
+ Fix deps.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 2.21.9
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 2.21.9
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 2.21.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-04-08
+ 2.21.6
+ Version bump
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 2.20.9
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-intel/translations.xml b/x11/driver/xorg-video-intel/translations.xml
new file mode 100644
index 0000000000..f37ed93476
--- /dev/null
+++ b/x11/driver/xorg-video-intel/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-intel
+ X.Org intel ekran kartı sürücüsü
+ xorg-video-intel, Intel ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-mach64/actions.py b/x11/driver/xorg-video-mach64/actions.py
new file mode 100644
index 0000000000..b2e945262d
--- /dev/null
+++ b/x11/driver/xorg-video-mach64/actions.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-dri \
+ --disable-exa \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-mach64/pspec.xml b/x11/driver/xorg-video-mach64/pspec.xml
new file mode 100644
index 0000000000..88bb8d9f19
--- /dev/null
+++ b/x11/driver/xorg-video-mach64/pspec.xml
@@ -0,0 +1,100 @@
+
+
+
+
+ xorg-video-mach64
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org mach64 video driver
+ xorg-video-mach64 contains the X.Org driver for ATI Mach64 (Rage) video cards.
+ mirrors://xorg/individual/driver/xf86-video-mach64-6.9.5.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-mach64
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 6.9.5
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 6.9.4
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 6.9.4
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 6.9.4
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 6.9.4
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 6.9.4
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 6.9.4
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 6.9.3
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 6.9.3
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-mach64/translations.xml b/x11/driver/xorg-video-mach64/translations.xml
new file mode 100644
index 0000000000..786e39e9c8
--- /dev/null
+++ b/x11/driver/xorg-video-mach64/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-mach64
+ X.Org mach64 ekran kartı sürücüsü
+ xorg-video-mach64, ATI Mach64 (Rage) ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-mga/actions.py b/x11/driver/xorg-video-mga/actions.py
new file mode 100644
index 0000000000..8d1fcaf1c5
--- /dev/null
+++ b/x11/driver/xorg-video-mga/actions.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-dri \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README*")
diff --git a/x11/driver/xorg-video-mga/files/mga-1.4.12-bigendian.patch b/x11/driver/xorg-video-mga/files/mga-1.4.12-bigendian.patch
new file mode 100644
index 0000000000..3e556ea2d9
--- /dev/null
+++ b/x11/driver/xorg-video-mga/files/mga-1.4.12-bigendian.patch
@@ -0,0 +1,93 @@
+This is pretty lame, sticking INREG into the blit path is probably going
+to hurt performance. Which, whatever, G-series are old cards, but still.
+Redo me to put the needed bits in the pMga at init time instead. - ajax
+
+diff -up xf86-video-mga-1.4.12/src/mga_dri.c.jx xf86-video-mga-1.4.12/src/mga_dri.c
+--- xf86-video-mga-1.4.12/src/mga_dri.c.jx 2008-08-15 13:55:06.000000000 -0400
++++ xf86-video-mga-1.4.12/src/mga_dri.c 2011-06-20 12:04:43.047560274 -0400
+@@ -374,7 +374,8 @@ void MGAGetQuiescence( ScrnInfoPtr pScrn
+
+ pMga->SrcOrg = 0;
+ OUTREG( MGAREG_DSTORG, pMga->DstOrg );
+- OUTREG( MGAREG_OPMODE, MGAOPM_DMA_BLIT );
++ OUTREG( MGAREG_OPMODE,
++ (INREG(MGAREG_OPMODE) & ~MGAOPM_DMA_MASK) | MGAOPM_DMA_BLIT );
+ OUTREG( MGAREG_CXBNDRY, 0xFFFF0000 ); /* (maxX << 16) | minX */
+ OUTREG( MGAREG_YTOP, 0x00000000 ); /* minPixelPointer */
+ OUTREG( MGAREG_YBOT, 0x007FFFFF ); /* maxPixelPointer */
+diff -up xf86-video-mga-1.4.12/src/mga_exa.c.jx xf86-video-mga-1.4.12/src/mga_exa.c
+--- xf86-video-mga-1.4.12/src/mga_exa.c.jx 2009-04-27 11:47:42.000000000 -0400
++++ xf86-video-mga-1.4.12/src/mga_exa.c 2011-06-20 12:08:14.368304719 -0400
+@@ -701,7 +701,8 @@ mgaUploadToScreen(PixmapPtr pDst, int x,
+
+ mgaSetup(pMga, pDst, NULL, 10);
+
+- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
++ OUTREG(MGAREG_OPMODE,
++ (INREG(MGAREG_OPMODE) & ~MGAOPM_DMA_MASK) | MGAOPM_DMA_BLIT);
+ OUTREG(MGAREG_DSTORG, exaGetPixmapOffset(pDst));
+ OUTREG(MGAREG_PITCH, mgaGetPixmapPitch(pDst));
+ OUTREG(MGAREG_PLNWT, 0xffffffff);
+diff -up xf86-video-mga-1.4.12/src/mga_reg.h.jx xf86-video-mga-1.4.12/src/mga_reg.h
+--- xf86-video-mga-1.4.12/src/mga_reg.h.jx 2011-06-20 11:57:31.000000000 -0400
++++ xf86-video-mga-1.4.12/src/mga_reg.h 2011-06-20 12:01:22.891854925 -0400
+@@ -124,6 +124,7 @@
+ #define MGAOPM_DMA_GENERAL (0x00 << 2)
+ #define MGAOPM_DMA_BLIT (0x01 << 2)
+ #define MGAOPM_DMA_VECTOR (0x10 << 2)
++#define MGAOPM_DMA_MASK (0x11 << 2)
+
+ /* MACCESS register additives */
+ #define MGAMAC_PW8 0x00
+diff -up xf86-video-mga-1.4.12/src/mga_storm.c.jx xf86-video-mga-1.4.12/src/mga_storm.c
+--- xf86-video-mga-1.4.12/src/mga_storm.c.jx 2011-06-20 11:57:31.000000000 -0400
++++ xf86-video-mga-1.4.12/src/mga_storm.c 2011-06-20 12:11:51.721070061 -0400
+@@ -2192,6 +2192,7 @@ MGAFillSolidRectsDMA(
+ MGAPtr pMga = MGAPTR(pScrn);
+ XAAInfoRecPtr infoRec = pMga->AccelInfoRec;
+ CARD32 *base = (CARD32*)pMga->ILOADBase;
++ CARD32 opmode;
+
+ CHECK_DMA_QUIESCENT(pMga, pScrn);
+
+@@ -2207,7 +2208,8 @@ MGAFillSolidRectsDMA(
+
+ if(!nBox) return;
+
+- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_GENERAL);
++ opmode = INREG(MGAREG_OPMODE) & ~MGAOPM_DMA_MASK;
++ OUTREG(MGAREG_OPMODE, opmode | MGAOPM_DMA_GENERAL);
+ while(nBox) {
+ base[0] = DMAINDICES(MGAREG_FXBNDRY, MGAREG_YDSTLEN + MGAREG_EXEC,
+ MGAREG_FXBNDRY, MGAREG_YDSTLEN + MGAREG_EXEC);
+@@ -2219,7 +2221,7 @@ MGAFillSolidRectsDMA(
+ pBox++;
+ base += 5; nBox -= 2;
+ }
+- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
++ OUTREG(MGAREG_OPMODE, opmode | MGAOPM_DMA_BLIT);
+ }
+
+ static void
+@@ -2256,9 +2258,11 @@ MGAFillSolidSpansDMA(
+ }
+
+ if(n) {
++ CARD32 opmode;
+ if(n > 838860) n = 838860; /* maximum number we have room for */
+
+- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_GENERAL);
++ opmode = INREG(MGAREG_OPMODE) | MGAOPM_DMA_MASK;
++ OUTREG(MGAREG_OPMODE, opmode | MGAOPM_DMA_GENERAL);
+ while(n) {
+ base[0] = DMAINDICES(MGAREG_FXBNDRY, MGAREG_YDSTLEN + MGAREG_EXEC,
+ MGAREG_FXBNDRY, MGAREG_YDSTLEN + MGAREG_EXEC);
+@@ -2270,7 +2274,7 @@ MGAFillSolidSpansDMA(
+ ppt++;
+ base += 5; n -= 2;
+ }
+- OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT);
++ OUTREG(MGAREG_OPMODE, opmode | MGAOPM_DMA_BLIT);
+ }
+
+ if(infoRec->ClipBox) {
diff --git a/x11/driver/xorg-video-mga/files/mga-1.4.5-no-hal-advertising.patch b/x11/driver/xorg-video-mga/files/mga-1.4.5-no-hal-advertising.patch
new file mode 100644
index 0000000000..d025f40faf
--- /dev/null
+++ b/x11/driver/xorg-video-mga/files/mga-1.4.5-no-hal-advertising.patch
@@ -0,0 +1,12 @@
+--- xf86-video-mga-1.4.5/src/mga_driver.c.jx 2006-11-08 12:16:44.000000000 -0500
++++ xf86-video-mga-1.4.5/src/mga_driver.c 2006-12-04 16:27:38.000000000 -0500
+@@ -1329,8 +1329,7 @@
+ pMga->DualHeadEnabled = TRUE;
+ } else if (xf86IsPrimInitDone(pScrn->entityList[0])) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+- "This card requires the \"mga_hal\" module for dual-head operation\n"
+- "\tIt can be found at the Matrox web site \n");
++ "No open-source support for dualhead on this card, sorry\n");
+ }
+ }
+
diff --git a/x11/driver/xorg-video-mga/files/mga-1.6.2-shadowfb.patch b/x11/driver/xorg-video-mga/files/mga-1.6.2-shadowfb.patch
new file mode 100644
index 0000000000..61e98d82c7
--- /dev/null
+++ b/x11/driver/xorg-video-mga/files/mga-1.6.2-shadowfb.patch
@@ -0,0 +1,30 @@
+diff -up xf86-video-mga-1.6.2/src/mga_driver.c.jx xf86-video-mga-1.6.2/src/mga_driver.c
+--- xf86-video-mga-1.6.2/src/mga_driver.c.jx 2013-05-20 16:14:10.000000000 -0400
++++ xf86-video-mga-1.6.2/src/mga_driver.c 2013-05-20 16:14:48.381607479 -0400
+@@ -2004,7 +2004,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
+ pMga->HWCursor ? "HW" : "SW");
+
+- if (xf86ReturnOptValBool(pMga->Options, OPTION_NOACCEL, FALSE)) {
++ if (xf86ReturnOptValBool(pMga->Options, OPTION_SHADOW_FB, TRUE)) {
++ pMga->ShadowFB = TRUE;
++ pMga->NoAccel = TRUE;
++ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
++ "Using \"Shadow Framebuffer\" - acceleration disabled\n");
++ } else if (xf86ReturnOptValBool(pMga->Options, OPTION_NOACCEL, FALSE)) {
+ pMga->NoAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
+ } else {
+@@ -2051,12 +2056,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
+ (1 << pScrn->offset.green) |
+ (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
+ }
+- if (xf86ReturnOptValBool(pMga->Options, OPTION_SHADOW_FB, FALSE)) {
+- pMga->ShadowFB = TRUE;
+- pMga->NoAccel = TRUE;
+- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+- "Using \"Shadow Framebuffer\" - acceleration disabled\n");
+- }
+ if (xf86ReturnOptValBool(pMga->Options, OPTION_OVERCLOCK_MEM, FALSE)) {
+ pMga->OverclockMem = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overclocking memory\n");
diff --git a/x11/driver/xorg-video-mga/pspec.xml b/x11/driver/xorg-video-mga/pspec.xml
new file mode 100644
index 0000000000..393411466c
--- /dev/null
+++ b/x11/driver/xorg-video-mga/pspec.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ xorg-video-mga
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org mga video driver
+ xorg-video-mga contains the X.Org driver for Matrox cards.
+ mirrors://xorg/individual/driver/xf86-video-mga-1.6.3.tar.bz2
+
+ mga-1.4.5-no-hal-advertising.patch
+ mga-1.4.12-bigendian.patch
+ mga-1.6.2-shadowfb.patch
+
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-mga
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.6.3
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 1.6.3
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.6.3
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.6.3
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.6.3
+ Version bump.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 1.6.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.6.2
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.6.2
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.6.2
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.6.1
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-mga/translations.xml b/x11/driver/xorg-video-mga/translations.xml
new file mode 100644
index 0000000000..16333f8239
--- /dev/null
+++ b/x11/driver/xorg-video-mga/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-mga
+ X.Org mga ekran kartı sürücüsü
+ xorg-video-mga, Matrox ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-neomagic/actions.py b/x11/driver/xorg-video-neomagic/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-neomagic/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-neomagic/pspec.xml b/x11/driver/xorg-video-neomagic/pspec.xml
new file mode 100644
index 0000000000..d86748e311
--- /dev/null
+++ b/x11/driver/xorg-video-neomagic/pspec.xml
@@ -0,0 +1,105 @@
+
+
+
+
+ xorg-video-neomagic
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org neomagic video driver
+ xorg-video-neomagic contains the X.Org driver for NeoMagic cards.
+ mirrors://xorg/individual/driver/xf86-video-neomagic-1.2.9.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+ xorg-video-neomagic
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 1.2.9
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2014-01-23
+ 1.2.8
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.2.8
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.2.8
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.2.8
+ Version bump.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 1.2.7
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.2.7
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.2.7
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.2.7
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 1.2.7
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-neomagic/translations.xml b/x11/driver/xorg-video-neomagic/translations.xml
new file mode 100644
index 0000000000..e2b33fae8d
--- /dev/null
+++ b/x11/driver/xorg-video-neomagic/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-neomagic
+ X.Org neomagic ekran kartı sürücüsü
+ xorg-video-neomagic, NeoMagic ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-nouveau/actions.py b/x11/driver/xorg-video-nouveau/actions.py
new file mode 100644
index 0000000000..5c9a8b3748
--- /dev/null
+++ b/x11/driver/xorg-video-nouveau/actions.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog")
diff --git a/x11/driver/xorg-video-nouveau/pspec.xml b/x11/driver/xorg-video-nouveau/pspec.xml
new file mode 100644
index 0000000000..2132f08e61
--- /dev/null
+++ b/x11/driver/xorg-video-nouveau/pspec.xml
@@ -0,0 +1,123 @@
+
+
+
+
+ xorg-video-nouveau
+ http://nouveau.freedesktop.org/wiki/
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org nouveau video driver
+ xorg-video-nouveau contains the X.Org driver for NVIDIA cards.
+ mirrors://xorg/individual/driver/xf86-video-nouveau-1.0.11.tar.bz2
+
+ libdrm-nouveau
+ libpciaccess-devel
+ mesa-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-nouveau
+
+ libdrm
+ libdrm-nouveau
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.0.11
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-21
+ 1.0.11
+ Rebuild for xorg-server 1.6.3
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2014-09-04
+ 1.0.11
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-09-01
+ 1.0.10
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.0.10
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-08
+ 1.0.10
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-09-05
+ 1.0.9
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.0.8
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.0.8
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.0.7
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-04-14
+ 1.0.7
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-01-10
+ 1.0.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-nouveau/translations.xml b/x11/driver/xorg-video-nouveau/translations.xml
new file mode 100644
index 0000000000..2debac91a2
--- /dev/null
+++ b/x11/driver/xorg-video-nouveau/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-nouveau
+ X.Org nouveau ekran kartı sürücüsü
+ xorg-video-nouveau, NVIDIA ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-openchrome/actions.py b/x11/driver/xorg-video-openchrome/actions.py
new file mode 100644
index 0000000000..51ab08feac
--- /dev/null
+++ b/x11/driver/xorg-video-openchrome/actions.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-if")
+ autotools.configure("\
+ --disable-static \
+ --enable-dri \
+ --enable-viaregtool \
+ --enable-debug \
+ --enable-xv-debug \
+ ")
+
+ pisitools.dosed("libtool", " -shared ", " -Wl,-O1,--as-needed -shared ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "NEWS", "README")
diff --git a/x11/driver/xorg-video-openchrome/files/fixed.patch b/x11/driver/xorg-video-openchrome/files/fixed.patch
new file mode 100644
index 0000000000..f9fb5c7fb5
--- /dev/null
+++ b/x11/driver/xorg-video-openchrome/files/fixed.patch
@@ -0,0 +1,11 @@
+--- xf86-video-openchrome-0.3.3/src/via_3d.h.orig 2014-10-26 03:26:12.280985695 +0000
++++ xf86-video-openchrome-0.3.3/src/via_3d.h 2014-10-26 03:26:18.187511587 +0000
+@@ -24,6 +24,7 @@
+ #ifndef VIA_3D_H
+ #define VIA_3D_H
+
++#include
+ #include "xf86.h"
+ #include "via_dmabuffer.h"
+
+
diff --git a/x11/driver/xorg-video-openchrome/files/openchrome-0.2.904-fix_tvout_flickering.patch b/x11/driver/xorg-video-openchrome/files/openchrome-0.2.904-fix_tvout_flickering.patch
new file mode 100644
index 0000000000..18774b113f
--- /dev/null
+++ b/x11/driver/xorg-video-openchrome/files/openchrome-0.2.904-fix_tvout_flickering.patch
@@ -0,0 +1,35 @@
+Index: src/via_vt162x.c
+===================================================================
+--- src/via_vt162x.c (revision 787)
++++ src/via_vt162x.c (revision 786)
+@@ -684,30 +650,11 @@ VT1622ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mo
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x2B, Table.RGB[4]);
+ if (Table.RGB[5])
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x2C, Table.RGB[5]);
+- if (pBIOSInfo->TVEncoder == VIA_VT1625) {
+- if (pBIOSInfo->TVType < TVTYPE_480P) {
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x12);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x23, 0x7E);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4A, 0x85);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4B, 0x0A);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4E, 0x00);
+- } else {
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x12);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4A, 0x85);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4B, 0x0A);
+- }
+- }
+ } else if (pBIOSInfo->TVOutput == TVOUTPUT_YCBCR) {
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x02, 0x03);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x65, Table.YCbCr[0]);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x66, Table.YCbCr[1]);
+ xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x67, Table.YCbCr[2]);
+- if (pBIOSInfo->TVEncoder == VIA_VT1625) {
+- if (pBIOSInfo->TVType < TVTYPE_480P) {
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x23, 0x7E);
+- xf86I2CWriteByte(pBIOSInfo->TVI2CDev, 0x4E, 0x00);
+- }
+- }
+ }
+
+ /* Configure flicker filter. */
diff --git a/x11/driver/xorg-video-openchrome/pspec.xml b/x11/driver/xorg-video-openchrome/pspec.xml
new file mode 100644
index 0000000000..95d7c45c96
--- /dev/null
+++ b/x11/driver/xorg-video-openchrome/pspec.xml
@@ -0,0 +1,119 @@
+
+
+
+
+ xorg-video-openchrome
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org openchrome video driver
+ xorg-video-openchrome contains the X.Org driver for VIA video chipsets.
+ mirrors://xorg/individual/driver/xf86-video-openchrome-0.3.3.tar.bz2
+
+ libdrm-devel
+ libXext-devel
+ libXv-devel
+ libXvMC-devel
+ xorg-server-devel
+
+
+ openchrome-0.2.904-fix_tvout_flickering.patch
+ fixed.patch
+
+
+
+
+ xorg-video-openchrome
+
+ libdrm
+ libXext
+ libXv
+ libXvMC
+ xorg-server
+
+
+ /usr/bin
+ /usr/sbin
+ /usr/lib
+ /usr/share/man
+ /usr/share/doc
+
+
+
+
+
+ 2015-05-08
+ 0.3.3
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-02-10
+ 0.3.3
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.3.3
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.3.3
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 0.3.3
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-02-02
+ 0.3.3
+ Rebuild Unused
+ Varol Maksutoğlu
+ waroi@pisilinux.org
+
+
+ 2013-08-25
+ 0.3.3
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 0.3.3
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.3.1
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 0.3.1
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-openchrome/translations.xml b/x11/driver/xorg-video-openchrome/translations.xml
new file mode 100644
index 0000000000..fe585683df
--- /dev/null
+++ b/x11/driver/xorg-video-openchrome/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-openchrome
+ X.Org openchrome ekran kartı sürücüsü
+ xorg-video-openchrome, VIA ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-r128/actions.py b/x11/driver/xorg-video-r128/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-r128/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-r128/pspec.xml b/x11/driver/xorg-video-r128/pspec.xml
new file mode 100644
index 0000000000..f3f56ea79a
--- /dev/null
+++ b/x11/driver/xorg-video-r128/pspec.xml
@@ -0,0 +1,100 @@
+
+
+
+
+ xorg-video-r128
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org r128 video driver
+ xorg-video-r128 contains the X.Org driver for ATI Rage128 video cards.
+ mirrors://xorg/individual/driver/xf86-video-r128-6.10.0.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-r128
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 6.10.0
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 6.9.2
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 6.9.2
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 6.9.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 6.9.2
+ Version bump.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 6.9.1
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 6.9.1
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 6.8.4
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 6.8.4
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-r128/translations.xml b/x11/driver/xorg-video-r128/translations.xml
new file mode 100644
index 0000000000..4030c1a9c3
--- /dev/null
+++ b/x11/driver/xorg-video-r128/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-r128
+ X.Org r128 ekran kartı sürücüsü
+ xorg-video-r128, ATI Rage128 ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-radeon/actions.py b/x11/driver/xorg-video-radeon/actions.py
new file mode 100755
index 0000000000..0625b59509
--- /dev/null
+++ b/x11/driver/xorg-video-radeon/actions.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ # disable XAA to allow building against >=xorg-server-1.12.99.902
+ # pisitools.dosed("configure.ac", ".*USE_XAA, 1.*")
+ autotools.autoreconf("-vif")
+ autotools.configure()
+
+ pisitools.dosed("libtool", " -shared ", " -Wl,-O1,--as-needed -shared ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-radeon/pspec.xml b/x11/driver/xorg-video-radeon/pspec.xml
new file mode 100755
index 0000000000..5c9326bdc8
--- /dev/null
+++ b/x11/driver/xorg-video-radeon/pspec.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ xorg-video-radeon
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org radeon video driver
+ xorg-video-radeon contains the X.Org driver for ATI video chipsets.
+ mirrors://xorg/individual/driver/xf86-video-ati-7.5.0.tar.bz2
+
+ libdrm-devel
+ libpciaccess-devel
+ mesa-devel
+ pixman-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-radeon
+
+ libdrm-radeon
+ libpciaccess
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 7.5.0
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 7.5.0
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-10-18
+ 7.5.0
+ Version bump
+ Ergün Salman
+ poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 7.4.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 7.3.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-08
+ 7.3.0
+ Version bump.
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2014-02-02
+ 7.1.0
+ Rebuild Unused
+ Varol Maksutoğlu
+ waroi@pisilinux.org
+
+
+ 2013-11-06
+ 7.1.0
+ Fix deps.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 7.1.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 7.1.0
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 6.14.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 6.14.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-radeon/translations.xml b/x11/driver/xorg-video-radeon/translations.xml
new file mode 100755
index 0000000000..48c70f885d
--- /dev/null
+++ b/x11/driver/xorg-video-radeon/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-radeon
+ X.Org radeon ekran kartı sürücüsü
+ xorg-video-radeon, ATI ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-rendition/actions.py b/x11/driver/xorg-video-rendition/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-rendition/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-rendition/files/git-fixes.patch b/x11/driver/xorg-video-rendition/files/git-fixes.patch
new file mode 100644
index 0000000000..2dad6aa8ec
--- /dev/null
+++ b/x11/driver/xorg-video-rendition/files/git-fixes.patch
@@ -0,0 +1,125 @@
+From 3a3ee1c45e54a808947cc26ca11f0a5299571053 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:50 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/rendition.c b/src/rendition.c
+index 7c74f76..888bb4a 100644
+--- a/src/rendition.c
++++ b/src/rendition.c
+@@ -1173,7 +1173,6 @@ renditionScreenInit(SCREEN_INIT_ARGS_DECL)
+ fbPictureInit (pScreen, 0, 0);
+
+ xf86SetBlackWhitePixels(pScreen);
+- miInitializeBackingStore(pScreen);
+
+ /*********************************************************/
+ /* The actual setup of the driver-specific code */
+diff --git a/src/rendition.h b/src/rendition.h
+index f7f13d4..297117e 100644
+--- a/src/rendition.h
++++ b/src/rendition.h
+@@ -28,9 +28,6 @@
+ /* All drivers initialising the SW cursor need this */
+ #include "mipointer.h"
+
+-/* All drivers implementing backing store need this */
+-#include "mibstore.h"
+-
+ /* All drivers using the mi colormap manipulation need this */
+ #include "micmap.h"
+
+--
+cgit v0.9.0.2-2-gbebe
+From 30a4b73644ee22904824d4847e44ca69369fad02 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 30 Sep 2014 10:21:58 -0400
+Subject: Fix build against xserver 1.17
+
+Also port from pci_device_map_region to pci_device_map_range. Somewhat
+alarming that the previous code was using map_region but unmap_range...
+
+Signed-off-by: Adam Jackson
+
+diff --git a/src/rendition.c b/src/rendition.c
+index 888bb4a..9677850 100644
+--- a/src/rendition.c
++++ b/src/rendition.c
+@@ -1371,6 +1371,18 @@ renditionMapMem(ScrnInfoPtr pScreenInfo)
+ /* Override on users request */
+ WriteCombine
+ = xf86ReturnOptValBool(pRendition->Options, OPTION_FBWC, WriteCombine);
++#ifdef XSERVER_LIBPCIACCESS
++ mapOption = PCI_DEV_MAP_FLAG_WRITABLE;
++ if (WriteCombine)
++ mapOption |= PCI_DEV_MAP_FLAG_WRITE_COMBINE;
++
++ err = pci_device_map_range(pRendition->PciInfo,
++ pRendition->PciInfo->regions[0].base_addr,
++ pRendition->PciInfo->regions[0].size,
++ mapOption, (void *)&pRendition->board.vmem_base);
++
++ return (err == 0);
++#else
+ if (WriteCombine) {
+ xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG,
+ ("Requesting Write-Combined memory access\n"));
+@@ -1381,12 +1393,6 @@ renditionMapMem(ScrnInfoPtr pScreenInfo)
+ mapOption = VIDMEM_MMIO;
+ }
+
+-#ifdef XSERVER_LIBPCIACCESS
+- err = pci_device_map_region(pRendition->PciInfo, 0, TRUE);
+- pRendition->board.vmem_base = pRendition->PciInfo->regions[0].memory;
+-
+- return (err == 0);
+-#else
+ pRendition->board.vmem_base=
+ xf86MapPciMem(pScreenInfo->scrnIndex, mapOption,
+ pRendition->pcitag,
+@@ -1415,7 +1421,7 @@ renditionUnmapMem(ScrnInfoPtr pScreenInfo)
+ #else
+ pci_device_unmap_range(pRendition->PciInfo,
+ pRendition->board.vmem_base,
+- pScreenInfo->videoRam * 1024);
++ pRendition->PciInfo->regions[0].size);
+ #endif
+ return TRUE;
+ #ifdef DEBUG0
+--
+cgit v0.10.2
+From df5646745bf563bb36a0db1796c318fe64bf8efe Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 30 Sep 2014 10:24:18 -0400
+Subject: Remove dependency on xf86PciInfo.h
+
+Signed-off-by: Adam Jackson
+
+diff --git a/src/rendition.h b/src/rendition.h
+index 297117e..4ef03a7 100644
+--- a/src/rendition.h
++++ b/src/rendition.h
+@@ -14,9 +14,6 @@
+ /* Everything using inb/outb, etc needs "compiler.h" */
+ #include "compiler.h"
+
+-/* Drivers for PCI hardware need this */
+-#include "xf86PciInfo.h"
+-
+ /* Drivers that need to access the PCI config space directly need this */
+ #include "xf86Pci.h"
+
+@@ -66,4 +63,8 @@
+
+ #include "compat-api.h"
+ /* end of __RENDITION_H__ */
++
++#define PCI_CHIP_V1000 0x0001
++#define PCI_CHIP_V2x00 0x2000
++
+ #endif
+--
+cgit v0.10.2
+
diff --git a/x11/driver/xorg-video-rendition/pspec.xml b/x11/driver/xorg-video-rendition/pspec.xml
new file mode 100644
index 0000000000..79ab510daa
--- /dev/null
+++ b/x11/driver/xorg-video-rendition/pspec.xml
@@ -0,0 +1,109 @@
+
+
+
+
+ xorg-video-rendition
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org rendition video driver
+ xorg-video-rendition contains the X.Org driver for Rendition (Micron) cards.
+ mirrors://xorg/individual/driver/xf86-video-rendition-4.2.5.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fixes.patch
+
+
+
+
+ xorg-video-rendition
+
+ xorg-server
+
+
+ /usr/lib/xorg/modules/drivers
+ /usr/lib/xorg/modules/*.uc
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 4.2.5
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 4.2.5
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 4.2.5
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 4.2.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 4.2.5
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 4.2.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 4.2.5
+ Rebuild
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 4.2.5
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 4.2.5
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 4.2.5
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-rendition/translations.xml b/x11/driver/xorg-video-rendition/translations.xml
new file mode 100644
index 0000000000..898826f41d
--- /dev/null
+++ b/x11/driver/xorg-video-rendition/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-rendition
+ X.Org rendition ekran kartı sürücüsü
+ xorg-video-rendition, Rendition (Micron) ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-s3virge/actions.py b/x11/driver/xorg-video-s3virge/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-s3virge/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-s3virge/files/git-fixes.patch b/x11/driver/xorg-video-s3virge/files/git-fixes.patch
new file mode 100644
index 0000000000..f093d1cc98
--- /dev/null
+++ b/x11/driver/xorg-video-s3virge/files/git-fixes.patch
@@ -0,0 +1,90 @@
+From d74238ca2faddb2e1c0b48333664688a5079a856 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Wed, 21 May 2014 14:10:11 -0400
+Subject: Use own thunk function instead of vgaHW*Weak
+
+I plan to remove the Weak functions from a future server.
+
+Signed-off-by: Adam Jackson
+
+diff --git a/src/s3v_driver.c b/src/s3v_driver.c
+index 654884c..937717e 100644
+--- a/src/s3v_driver.c
++++ b/src/s3v_driver.c
+@@ -3760,6 +3760,12 @@ S3Vddc1Read(ScrnInfoPtr pScrn)
+ return ((unsigned int) (tmp & 0x08));
+ }
+
++static void
++S3Vddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
++{
++ vgaHWddc1SetSpeed(pScrn, speed);
++}
++
+ static Bool
+ S3Vddc1(ScrnInfoPtr pScrn)
+ {
+@@ -3773,7 +3779,7 @@ S3Vddc1(ScrnInfoPtr pScrn)
+ OUTREG(DDC_REG,(tmp | 0x12));
+
+ if ((pMon = xf86PrintEDID(
+- xf86DoEDID_DDC1(XF86_SCRN_ARG(pScrn),vgaHWddc1SetSpeedWeak(),
++ xf86DoEDID_DDC1(XF86_SCRN_ARG(pScrn), S3Vddc1SetSpeed,
+ S3Vddc1Read))) != NULL)
+ success = TRUE;
+ xf86SetDDCproperties(pScrn,pMon);
+--
+cgit v0.10.2
+From 69b9adea709922e53ba422dd7f00aa4ac90d232e Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 30 Sep 2014 10:26:17 -0400
+Subject: Fix build against xserver 1.17
+
+Signed-off-by: Adam Jackson
+
+diff --git a/src/s3v_driver.c b/src/s3v_driver.c
+index 937717e..e81ab72 100644
+--- a/src/s3v_driver.c
++++ b/src/s3v_driver.c
+@@ -3515,7 +3515,7 @@ S3VEnableMmio(ScrnInfoPtr pScrn)
+ {
+ vgaHWPtr hwp;
+ S3VPtr ps3v;
+- IOADDRESS vgaCRIndex, vgaCRReg;
++ unsigned int vgaCRIndex, vgaCRReg;
+ unsigned char val;
+ unsigned int PIOOffset = 0;
+
+@@ -3584,7 +3584,7 @@ S3VDisableMmio(ScrnInfoPtr pScrn)
+ {
+ vgaHWPtr hwp;
+ S3VPtr ps3v;
+- IOADDRESS vgaCRIndex, vgaCRReg;
++ unsigned int vgaCRIndex, vgaCRReg;
+
+ PVERB5(" S3VDisableMmio\n");
+
+--
+cgit v0.10.2
+From 211e2831dcf13c6e5847f6caf894f559d9104c3d Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 30 Sep 2014 10:27:13 -0400
+Subject: Remove call to miInitializeBackingStore
+
+Signed-off-by: Adam Jackson
+
+diff --git a/src/s3v_driver.c b/src/s3v_driver.c
+index e81ab72..d519dc8 100644
+--- a/src/s3v_driver.c
++++ b/src/s3v_driver.c
+@@ -2420,7 +2420,6 @@ S3VScreenInit(SCREEN_INIT_ARGS_DECL)
+ return FALSE;
+ }
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+ /* hardware cursor needs to wrap this layer */
+--
+cgit v0.10.2
+
diff --git a/x11/driver/xorg-video-s3virge/pspec.xml b/x11/driver/xorg-video-s3virge/pspec.xml
new file mode 100644
index 0000000000..672566c6e9
--- /dev/null
+++ b/x11/driver/xorg-video-s3virge/pspec.xml
@@ -0,0 +1,101 @@
+
+
+
+
+ xorg-video-s3virge
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org s3virge video driver
+ xorg-video-s3virge contains the X.Org driver for S3 Virge cards.
+ mirrors://xorg/individual/driver/xf86-video-s3virge-1.10.6.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fixes.patch
+
+
+
+
+ xorg-video-s3virge
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.10.6
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.10.6
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.10.6
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.10.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.10.6
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.10.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.10.6
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.10.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 1.10.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-s3virge/translations.xml b/x11/driver/xorg-video-s3virge/translations.xml
new file mode 100644
index 0000000000..28e952cb4b
--- /dev/null
+++ b/x11/driver/xorg-video-s3virge/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-s3virge
+ X.Org s3virge ekran kartı sürücüsü
+ xorg-video-s3virge, S3 Virge ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-savage/actions.py b/x11/driver/xorg-video-savage/actions.py
new file mode 100644
index 0000000000..9d2a342edf
--- /dev/null
+++ b/x11/driver/xorg-video-savage/actions.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-dri \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-savage/pspec.xml b/x11/driver/xorg-video-savage/pspec.xml
new file mode 100644
index 0000000000..1d77c5d295
--- /dev/null
+++ b/x11/driver/xorg-video-savage/pspec.xml
@@ -0,0 +1,100 @@
+
+
+
+
+ xorg-video-savage
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org savage video driver
+ xorg-video-savage contains the X.Org driver for S3 Savage cards.
+ mirrors://xorg/individual/driver/xf86-video-savage-2.3.8.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-savage
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 2.3.8
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 2.3.7
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 2.3.7
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 2.3.7
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 2.3.7
+ Version bump.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-25
+ 2.3.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 2.3.6
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 2.3.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 2.3.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-savage/translations.xml b/x11/driver/xorg-video-savage/translations.xml
new file mode 100644
index 0000000000..594ac11ecd
--- /dev/null
+++ b/x11/driver/xorg-video-savage/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-savage
+ X.Org savage ekran kartı sürücüsü
+ xorg-video-savage, S3 Savage ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-siliconmotion/actions.py b/x11/driver/xorg-video-siliconmotion/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-siliconmotion/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-siliconmotion/pspec.xml b/x11/driver/xorg-video-siliconmotion/pspec.xml
new file mode 100644
index 0000000000..b4f195264a
--- /dev/null
+++ b/x11/driver/xorg-video-siliconmotion/pspec.xml
@@ -0,0 +1,98 @@
+
+
+
+
+ xorg-video-siliconmotion
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org siliconmotion video driver
+ xorg-video-siliconmotion contains the X.Org driver for Silicon Motion cards.
+ mirrors://xorg/individual/driver/xf86-video-siliconmotion-1.7.8.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+ xorg-video-siliconmotion
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 1.7.8
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.7.7
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.7.7
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.7.7
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.7.7
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.7.7
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.7.7
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.7.7
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-11
+ 1.7.7
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-siliconmotion/translations.xml b/x11/driver/xorg-video-siliconmotion/translations.xml
new file mode 100644
index 0000000000..2dd06bd402
--- /dev/null
+++ b/x11/driver/xorg-video-siliconmotion/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-siliconmotion
+ X.Org siliconmotion ekran kartı sürücüsü
+ xorg-video-siliconmotion, Silicon Motion ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-sis/actions.py b/x11/driver/xorg-video-sis/actions.py
new file mode 100644
index 0000000000..9d2a342edf
--- /dev/null
+++ b/x11/driver/xorg-video-sis/actions.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-dri \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-sis/files/0001-Disable-UploadToScreen-and-DownloadFromScreen.patch b/x11/driver/xorg-video-sis/files/0001-Disable-UploadToScreen-and-DownloadFromScreen.patch
new file mode 100644
index 0000000000..90e93b4031
--- /dev/null
+++ b/x11/driver/xorg-video-sis/files/0001-Disable-UploadToScreen-and-DownloadFromScreen.patch
@@ -0,0 +1,66 @@
+From c0ff117d3e19e14829a21d89673e03f9d6389043 Mon Sep 17 00:00:00 2001
+From: Jan de Groot
+Date: Thu, 22 Nov 2012 15:04:42 +0100
+Subject: [PATCH] Disable UploadToScreen and DownloadFromScreen. These
+ functions use invalid pointers, causing crashes. As the
+ driver is technically unmaintained, it's better to rely on
+ software fallback than trying to fix the driver
+ implementation.
+
+---
+ src/sis300_accel.c | 2 ++
+ src/sis310_accel.c | 2 ++
+ src/sis_accel.c | 2 ++
+ 3 files changed, 6 insertions(+)
+
+diff --git a/src/sis300_accel.c b/src/sis300_accel.c
+index af0527d..2162d76 100644
+--- a/src/sis300_accel.c
++++ b/src/sis300_accel.c
+@@ -1273,9 +1273,11 @@ SiS300AccelInit(ScreenPtr pScreen)
+
+ /* Composite not supported */
+
++#if 0
+ /* Upload, download to/from Screen */
+ pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+ pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++#endif
+
+ } else {
+
+diff --git a/src/sis310_accel.c b/src/sis310_accel.c
+index 1a6f639..20106ce 100644
+--- a/src/sis310_accel.c
++++ b/src/sis310_accel.c
+@@ -2303,9 +2303,11 @@ SiS315AccelInit(ScreenPtr pScreen)
+ }
+ #endif
+
++#if 0
+ /* Upload, download to/from Screen */
+ pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+ pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++#endif
+
+ }
+ #endif
+diff --git a/src/sis_accel.c b/src/sis_accel.c
+index c2c24c7..bb08296 100644
+--- a/src/sis_accel.c
++++ b/src/sis_accel.c
+@@ -801,9 +801,11 @@ SiSAccelInit(ScreenPtr pScreen)
+
+ /* Composite not supported */
+
++#if 0
+ /* Upload, download to/from Screen */
+ pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+ pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++#endif
+
+ }
+ #endif /* EXA */
+--
+1.8.0
+
diff --git a/x11/driver/xorg-video-sis/files/Xi.patch b/x11/driver/xorg-video-sis/files/Xi.patch
new file mode 100644
index 0000000000..74732f33a8
--- /dev/null
+++ b/x11/driver/xorg-video-sis/files/Xi.patch
@@ -0,0 +1,19 @@
+--- xf86-video-sis-0.10.7/src/sis_driver.c 2013-03-10 13:57:50.000000000 +0100
++++ xf86-video-sis-0.10.7/src/sis_driver.c.new 2013-03-10 13:54:48.645203559 +0100
+@@ -9378,7 +9378,15 @@
+ }
+ if(doit) {
+ sigstate = xf86BlockSIGIO();
+-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 15
++#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 18
++ {
++ double dx = x, dy = y;
++ miPointerSetPosition(inputInfo.pointer, Absolute, &dx, &dy,
++ NULL, NULL);
++ x = (int)dx;
++ y = (int)dy;
++ }
++#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 15
+ {
+ double dx = x, dy = y;
+ miPointerSetPosition(inputInfo.pointer, Absolute, &dx, &dy);
diff --git a/x11/driver/xorg-video-sis/files/git-fixes.patch b/x11/driver/xorg-video-sis/files/git-fixes.patch
new file mode 100644
index 0000000000..f23888d6e2
--- /dev/null
+++ b/x11/driver/xorg-video-sis/files/git-fixes.patch
@@ -0,0 +1,389 @@
+From 339fb3bc032b9f35b07b90480ae82a0fd352e078 Mon Sep 17 00:00:00 2001
+From: Jan Lindemann
+Date: Thu, 30 Aug 2012 18:09:10 +0000
+Subject: Replace xf86UnMapVidMem with pci_device_unmap_range
+
+Mixing pci_device_map_range with xf86UnMapVidMem doesn't work too well.
+
+X.Org bug#18028
+
+Bug found by Bryan Henderson
+
+Signed-off-by: Julien Cristau
+---
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 61e8075..4c9b9cb 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -7344,7 +7344,11 @@ SISUnmapMem(ScrnInfoPtr pScrn)
+ if(pSiSEnt->MapCountIOBase) {
+ pSiSEnt->MapCountIOBase--;
+ if((pSiSEnt->MapCountIOBase == 0) || (pSiSEnt->forceUnmapIOBase)) {
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
++#else
++ pci_device_unmap_range(pSiS->PciInfo, pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
++#endif
+ pSiSEnt->IOBase = NULL;
+ pSiSEnt->MapCountIOBase = 0;
+ pSiSEnt->forceUnmapIOBase = FALSE;
+@@ -7355,7 +7359,11 @@ SISUnmapMem(ScrnInfoPtr pScrn)
+ if(pSiSEnt->MapCountIOBaseDense) {
+ pSiSEnt->MapCountIOBaseDense--;
+ if((pSiSEnt->MapCountIOBaseDense == 0) || (pSiSEnt->forceUnmapIOBaseDense)) {
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
++#else
++ pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
++#endif
+ pSiSEnt->IOBaseDense = NULL;
+ pSiSEnt->MapCountIOBaseDense = 0;
+ pSiSEnt->forceUnmapIOBaseDense = FALSE;
+@@ -7366,7 +7374,11 @@ SISUnmapMem(ScrnInfoPtr pScrn)
+ if(pSiSEnt->MapCountFbBase) {
+ pSiSEnt->MapCountFbBase--;
+ if((pSiSEnt->MapCountFbBase == 0) || (pSiSEnt->forceUnmapFbBase)) {
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
++#else
++ pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
++#endif
+ pSiSEnt->FbBase = pSiSEnt->RealFbBase = NULL;
+ pSiSEnt->MapCountFbBase = 0;
+ pSiSEnt->forceUnmapFbBase = FALSE;
+@@ -7376,13 +7388,25 @@ SISUnmapMem(ScrnInfoPtr pScrn)
+ }
+ } else {
+ #endif
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
++#else
++ pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
++#endif
+ pSiS->IOBase = NULL;
+ #ifdef __alpha__
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
++#else
++ pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
++#endif
+ pSiS->IOBaseDense = NULL;
+ #endif
++#ifndef XSERVER_LIBPCIACCESS
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
++#else
++ pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
++#endif
+ pSiS->FbBase = pSiS->RealFbBase = NULL;
+ #ifdef SISDUALHEAD
+ }
+--
+cgit v0.9.0.2-2-gbebe
+From 926d4f655c8491b68a338f50c810f6729686ec9f Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:51 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 4c9b9cb..46cfefd 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -57,7 +57,6 @@
+ #include "fb.h"
+ #include "micmap.h"
+ #include "mipointer.h"
+-#include "mibstore.h"
+ #include "edid.h"
+
+ #define SIS_NEED_inSISREG
+@@ -8883,7 +8882,6 @@ SISScreenInit(SCREEN_INIT_ARGS_DECL)
+ }
+ pSiS->SiSFastVidCopyDone = TRUE;
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
+--
+cgit v0.9.0.2-2-gbebe
+From 7d4402786b758de3e6ce2641e15a39d612d5c518 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Mon, 15 Oct 2012 23:11:30 +0000
+Subject: Stop including xf86Priv.h
+
+As the name might suggest, it's server-private.
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/sis.h b/src/sis.h
+index 46fca2a..20e6134 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -75,7 +75,6 @@
+
+ #include "compiler.h"
+ #include "xf86Pci.h"
+-#include "xf86Priv.h"
+ #include "xf86_OSproc.h"
+ #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86Resources.h"
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 46cfefd..cefe503 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -93,6 +93,10 @@
+ #include "dri.h"
+ #endif
+
++#ifndef DEFAULT_DPI
++#define DEFAULT_DPI 96
++#endif
++
+ /*
+ * LookupWindow was removed with video abi 11.
+ */
+--
+cgit v0.9.0.2-2-gbebe
+From 0a4336efaafac4c34d4287b5df586bbb418f7f76 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith
+Date: Sat, 26 Oct 2013 14:27:17 -0700
+Subject: Fix HDisplay/VDisplay typos
+
+Found by gcc -Wlogicalops:
+
+sis_driver.c: In function 'SiS_CheckModeCRT2':
+sis_driver.c:13754:5: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
+sis_driver.c:13755:6: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
+sis_driver.c:13756:6: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
+sis_driver.c:13758:5: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
+sis_driver.c:13759:6: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
+
+Signed-off-by: Alan Coopersmith
+Reviewed-by: Gaetan Nadon
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index cefe503..80b8d51 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -13751,12 +13751,12 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned int VBFlags,
+ if( ((mode->HDisplay <= pSiS->LCDwidth) &&
+ (mode->VDisplay <= pSiS->LCDheight)) ||
+ ((pSiS->SiS_Pr->SiS_CustomT == CUT_PANEL848) &&
+- (((mode->HDisplay == 1360) && (mode->HDisplay == 768)) ||
+- ((mode->HDisplay == 1024) && (mode->HDisplay == 768)) ||
+- ((mode->HDisplay == 800) && (mode->HDisplay == 600)))) ||
++ (((mode->HDisplay == 1360) && (mode->VDisplay == 768)) ||
++ ((mode->HDisplay == 1024) && (mode->VDisplay == 768)) ||
++ ((mode->HDisplay == 800) && (mode->VDisplay == 600)))) ||
+ ((pSiS->SiS_Pr->SiS_CustomT == CUT_PANEL856) &&
+- (((mode->HDisplay == 1024) && (mode->HDisplay == 768)) ||
+- ((mode->HDisplay == 800) && (mode->HDisplay == 600)))) ) {
++ (((mode->HDisplay == 1024) && (mode->VDisplay == 768)) ||
++ ((mode->HDisplay == 800) && (mode->VDisplay == 600)))) ) {
+
+ ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
+ pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight,
+--
+cgit v0.10.2
+From 49796d6a3274adc0250ee07faa6bc63e41c98740 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer
+Date: Fri, 22 Nov 2013 08:21:18 +1000
+Subject: Fix format-security warnings
+
+sis_driver.c: In function 'SISErrorLog':
+sis_driver.c:432:5: error: format not a string literal and no format arguments [-Werror=format-security]
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
+ ^
+sis_driver.c:439:5: error: format not a string literal and no format arguments [-Werror=format-security]
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
+ ^
+sis_driver.c: In function 'SiSUpdateXineramaScreenInfo':
+sis_driver.c:1917:4: error: format not a string literal and no format arguments [-Werror=format-security]
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine);
+ ^
+sis_driver.c:1924:8: error: format not a string literal and no format arguments [-Werror=format-security]
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine);
+
+Signed-off-by: Peter Hutterer
+Reviewed-by: Alan Coopersmith
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 80b8d51..bd9c4e1 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -429,14 +429,14 @@ SISErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
+ static const char *str = "**************************************************\n";
+
+ va_start(ap, format);
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " ERROR:\n");
+ xf86VDrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, format, ap);
+ va_end(ap);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " END OF MESSAGE\n");
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
+ }
+
+ static void
+@@ -1914,14 +1914,14 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
+ if(infochanged && !usenonrect) {
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Virtual screen size does not match maximum display modes...\n");
+- xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine);
++ xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "%s", rectxine);
+
+ }
+ } else if(infochanged && usenonrect) {
+ usenonrect = FALSE;
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Only clone modes available for this virtual screen size...\n");
+- xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine);
++ xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "%s", rectxine);
+ }
+
+ if(pSiS->maxCRT1_X1) { /* Means we have at least one non-clone mode */
+--
+cgit v0.10.2
+From d0550de19cacab3e591641ba358a72fbc798b231 Mon Sep 17 00:00:00 2001
+From: Dave Airlie
+Date: Mon, 22 Sep 2014 12:45:02 +1000
+Subject: sis: fix build against latest xserver
+
+
+diff --git a/src/sis.h b/src/sis.h
+index 20e6134..385b784 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -1004,7 +1004,9 @@ typedef struct {
+ ScrnInfoPtr pScrn;
+ pciVideoPtr PciInfo;
+ int PciBus, PciDevice, PciFunc;
++#ifndef XSERVER_LIBPCIACCESS
+ PCITAG PciTag;
++#endif
+ EntityInfoPtr pEnt;
+ int Chipset;
+ unsigned char ChipType;
+diff --git a/src/vstruct.h b/src/vstruct.h
+index 88f7eb6..5d7a98d 100644
+--- a/src/vstruct.h
++++ b/src/vstruct.h
+@@ -237,8 +237,10 @@ struct SiS_Private
+ unsigned char ChipType;
+ unsigned char ChipRevision;
+ #ifdef SIS_XORG_XF86
++#ifndef XSERVER_LIBPCIACCESS
+ PCITAG PciTag;
+ #endif
++#endif
+ #ifdef SIS_LINUX_KERNEL
+ void *ivideo;
+ #endif
+--
+cgit v0.10.2
+From d2597696ba81862d80ec17b978d8370c58572e27 Mon Sep 17 00:00:00 2001
+From: Dave Airlie
+Date: Wed, 12 Nov 2014 08:04:21 +1000
+Subject: sis: more build fixes against master X server.
+
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index bd9c4e1..125eee7 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -3279,9 +3279,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->PciDevice = PCI_CFG_DEV(pSiS->PciInfo); /*SIS_PCI_DEVICE(pSiS->PciInfo);*/
+ pSiS->PciFunc = PCI_CFG_FUNC(pSiS->PciInfo); /*SIS_PCI_FUNC(pSiS->PciInfo);*/
+
++#ifndef XSERVER_LIBPCIACCESS
+ pSiS->PciTag = pciTag(PCI_DEV_BUS(pSiS->PciInfo),
+ PCI_DEV_DEV(pSiS->PciInfo),
+ PCI_DEV_FUNC(pSiS->PciInfo));
++#endif
+
+ #ifdef SIS_NEED_MAP_IOP
+ /********************************************/
+@@ -3905,7 +3907,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ if(pSiSEnt) pSiSEnt->SiS_Pr = pSiS->SiS_Pr;
+ #endif
+ memset(pSiS->SiS_Pr, 0, sizeof(struct SiS_Private));
++#ifndef XSERVER_LIBPCIACCESS
+ pSiS->SiS_Pr->PciTag = pSiS->PciTag;
++#endif
+ pSiS->SiS_Pr->ChipType = pSiS->ChipType;
+ pSiS->SiS_Pr->ChipRevision = pSiS->ChipRev;
+ pSiS->SiS_Pr->SiS_Backup70xx = 0xff;
+@@ -7134,7 +7138,9 @@ static Bool
+ SISMapMem(ScrnInfoPtr pScrn)
+ {
+ SISPtr pSiS = SISPTR(pScrn);
++#ifndef XSERVER_LIBPCIACCESS
+ int mmioFlags = VIDMEM_MMIO;
++#endif
+ #ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ #endif
+@@ -7144,9 +7150,11 @@ SISMapMem(ScrnInfoPtr pScrn)
+ * (For Alpha, we need to map SPARSE memory, since we need
+ * byte/short access.)
+ */
++#ifndef XSERVER_LIBPCIACCESS
+ #if defined(__alpha__)
+ mmioFlags |= VIDMEM_SPARSE;
+ #endif
++#endif
+
+ #ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+@@ -14017,6 +14025,7 @@ SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, UShort offset, UChar value)
+ break;
+ }
+
++#ifndef XSERVER_LIBPCIACCESS
+ #ifdef SIS_USE_BIOS_SCRATCH
+ if(SISPTR(pScrn)->Primary) {
+ base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000);
+@@ -14035,6 +14044,7 @@ SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, UShort offset, UChar value)
+ xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000);
+ }
+ #endif
++#endif
+ return ret;
+ }
+
+--
+cgit v0.10.2
+From 0f50f8c3db2b9f1c9d4ecab8ad278e9db6418a92 Mon Sep 17 00:00:00 2001
+From: Dave Airlie
+Date: Wed, 12 Nov 2014 09:27:33 +1000
+Subject: sis: force build, who uses this crazy code anyways
+
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 125eee7..854cb54 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -9385,6 +9385,7 @@ SISMergedPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
+ }
+ }
+ if(doit) {
++#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 20 /* screw it */
+ sigstate = xf86BlockSIGIO();
+ #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 15
+ {
+@@ -9402,6 +9403,7 @@ SISMergedPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
+ miPointerAbsoluteCursor(x, y, currentTime.milliseconds);
+ #endif
+ xf86UnblockSIGIO(sigstate);
++#endif
+ return;
+ }
+ }
+--
+cgit v0.10.2
+
diff --git a/x11/driver/xorg-video-sis/pspec.xml b/x11/driver/xorg-video-sis/pspec.xml
new file mode 100644
index 0000000000..5512fb4a8c
--- /dev/null
+++ b/x11/driver/xorg-video-sis/pspec.xml
@@ -0,0 +1,105 @@
+
+
+
+
+ xorg-video-sis
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org sis video driver
+ xorg-video-sis contains the X.Org driver for SiS cards.
+ mirrors://xorg/individual/driver/xf86-video-sis-0.10.7.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+ 0001-Disable-UploadToScreen-and-DownloadFromScreen.patch
+ git-fixes.patch
+ Xi.patch
+
+
+
+
+ xorg-video-sis
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 0.10.7
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 0.10.7
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.10.7
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.10.7
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 0.10.7
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 0.10.7
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.10.7
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 0.10.7
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 0.10.7
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-sis/translations.xml b/x11/driver/xorg-video-sis/translations.xml
new file mode 100644
index 0000000000..e8333997b3
--- /dev/null
+++ b/x11/driver/xorg-video-sis/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-sis
+ X.Org sis ekran kartı sürücüsü
+ xorg-video-sis, SiS ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-sisimedia/actions.py b/x11/driver/xorg-video-sisimedia/actions.py
new file mode 100644
index 0000000000..3ec04b54e5
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/actions.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import get
+
+def setup():
+ pisitools.dosed("src/Makefile.am", "sis_drv", "sisimedia_drv")
+ pisitools.dosed("src/sis.h", '"sis"', '"sisimedia"')
+ pisitools.dosed("src/sis_driver.c", "sisModuleData", "sisimediaModuleData")
+
+ autotools.autoreconf("-vif")
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+
+ # Same as sis man page
+ pisitools.removeDir("/usr/share/man")
diff --git a/x11/driver/xorg-video-sisimedia/files/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch b/x11/driver/xorg-video-sisimedia/files/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
new file mode 100644
index 0000000000..fd87b6c8c2
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
@@ -0,0 +1,25 @@
+From e4f6a2fcd5712d0f994d3719b9c6c13f5b02bc7c Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith
+Date: Fri, 9 Jan 2009 16:34:01 -0800
+Subject: [PATCH 01/10] Remove xorgconfig & xorgcfg from See Also list in man page
+
+---
+ man/sis.man | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/man/sis.man b/man/sis.man
+index d743fe6..c321808 100644
+--- a/man/sis.man
++++ b/man/sis.man
+@@ -429,7 +429,7 @@ The amount is to be specified in megabyte, the default is 8.
+ none.
+ .SH "SEE ALSO"
+ #ifdef __xservername__
+-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
++__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+ #else
+ XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+ #endif
+--
+1.6.5.4
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0002-Remove-XFree86-Misc-PassMessage-support.patch b/x11/driver/xorg-video-sisimedia/files/0002-Remove-XFree86-Misc-PassMessage-support.patch
new file mode 100644
index 0000000000..860e593c6f
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0002-Remove-XFree86-Misc-PassMessage-support.patch
@@ -0,0 +1,91 @@
+diff -p -up xf86-video-sis-0.9.1/configure.ac.orig xf86-video-sis-0.9.1/configure.ac
+--- xf86-video-sis-0.9.1/configure.ac.orig 2010-01-27 15:34:26.000000000 -0500
++++ xf86-video-sis-0.9.1/configure.ac 2010-01-27 15:34:43.000000000 -0500
+@@ -58,7 +58,6 @@ XORG_DRIVER_CHECK_EXT(XINERAMA, xinerama
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+-XORG_DRIVER_CHECK_EXT(XF86MISC, xf86miscproto)
+ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+ # Checks for pkg-config packages
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.c.orig xf86-video-sis-0.9.1/src/sis_driver.c
+--- xf86-video-sis-0.9.1/src/sis_driver.c.orig 2010-01-27 15:35:05.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_driver.c 2010-01-27 15:35:39.000000000 -0500
+@@ -86,8 +86,6 @@
+ #include "mibank.h"
+ #include "mipointer.h"
+ #include "mibstore.h"
+-#define _XF86MISC_SERVER_
+-#include
+ #include "edid.h"
+
+ #define SIS_NEED_inSISREG
+@@ -506,11 +504,6 @@ xf86DrvMsg(0, X_INFO, "
+ pScrn->FreeScreen = SISFreeScreen;
+ pScrn->ValidMode = SISValidMode;
+ pScrn->PMEvent = SISPMEvent; /*add PM function for ACPI hotkey,Ivans*/
+-#ifdef X_XF86MiscPassMessage
+-// if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
+-// pScrn->HandleMessage = SISHandleMessage;
+-// }
+-#endif
+ foundScreen = TRUE;
+ }
+ #ifdef SISDUALHEAD
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.h.orig xf86-video-sis-0.9.1/src/sis_driver.h
+--- xf86-video-sis-0.9.1/src/sis_driver.h.orig 2010-01-27 15:35:49.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_driver.h 2010-01-27 15:36:04.000000000 -0500
+@@ -791,10 +791,6 @@ static Bool SISHotkeySwitchMode(ScrnInfo
+ #ifdef SISDUALHEAD
+ static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode);
+ #endif
+-#ifdef X_XF86MiscPassMessage
+-extern int SISHandleMessage(int scrnIndex, const char *msgtype,
+- const char *msgval, char **retmsg);
+-#endif
+ static void SISFreeScreen(int scrnIndex, int flags);
+ static ModeStatus SISValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
+diff -p -up xf86-video-sis-0.9.1/src/sis_utility.c.orig xf86-video-sis-0.9.1/src/sis_utility.c
+--- xf86-video-sis-0.9.1/src/sis_utility.c.orig 2010-01-27 15:36:23.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_utility.c 2010-01-27 15:36:59.000000000 -0500
+@@ -40,8 +40,6 @@
+ #define NEED_EVENTS
+ #include
+ #include "dixstruct.h"
+-#define _XF86MISC_SERVER_
+-#include
+
+ #include "sis_videostr.h"
+
+@@ -262,9 +260,6 @@ typedef struct {
+ int (*HandleSiSDirectCommand[SISCTRL_MAX_SCREENS])(xSiSCtrlCommandReply *);
+ } xSiSCtrlScreenTable;
+
+-#ifdef X_XF86MiscPassMessage
+-int SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **retmsg);
+-#endif
+ void SiSCtrlExtInit(ScrnInfoPtr pScrn);
+ void SiSCtrlExtUnregister(SISPtr pSiS, int index);
+
+@@ -975,19 +970,6 @@ unsigned int SISVGADetected(ScrnInfoPtr
+ }
+
+ /***********************************
+- * MessageHandler interface *
+- * (unused now; use extension) *
+- ***********************************/
+-
+-#ifdef X_XF86MiscPassMessage
+-int
+-SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **retmsg)
+-{
+- return BadMatch;
+-}
+-#endif
+-
+-/***********************************
+ * SiSCtrl extension interface *
+ ***********************************/
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0003-Fix-build-with-Werror-format-security.patch b/x11/driver/xorg-video-sisimedia/files/0003-Fix-build-with-Werror-format-security.patch
new file mode 100644
index 0000000000..4fc355bbb2
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0003-Fix-build-with-Werror-format-security.patch
@@ -0,0 +1,65 @@
+From 9b010b7db7f0c6730c1a1b3cd473d49b01ed5b5f Mon Sep 17 00:00:00 2001
+From: Ander Conselvan de Oliveira
+Date: Mon, 22 Jun 2009 16:07:26 -0400
+Subject: [PATCH] Fix build with -Werror=format-security
+
+---
+ src/sis_driver.c | 4 ++--
+ src/sis_mergedfb.c | 6 +++---
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index 5b91004..0a154db 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -831,14 +831,14 @@ SISErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
+ static const char *str = "**************************************************\n";
+
+ va_start(ap, format);
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " ERROR:\n");
+ xf86VDrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, format, ap);
+ va_end(ap);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " END OF MESSAGE\n");
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s", str);
+ }
+
+ static void
+diff --git a/src/sis_mergedfb.c b/src/sis_mergedfb.c
+index 61b4255..feca024 100644
+--- a/src/sis_mergedfb.c
++++ b/src/sis_mergedfb.c
+@@ -357,7 +357,7 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
+
+ strcat(printbuffer, namebuf1);
+
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO, printbuffer);
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s", printbuffer);
+ }
+
+ mode->next = mode;
+@@ -2137,7 +2137,7 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
+ if(infochanged && !usenonrect) {
+ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb,
+ "Current screen size does not match maximum display modes...\n");
+- xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, rectxine);
++ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, "%s", rectxine);
+ }
+
+ } else if(infochanged && usenonrect) {
+@@ -2145,7 +2145,7 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
+ usenonrect = FALSE;
+ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb,
+ "Only clone modes available for this screen size...\n");
+- xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, rectxine);
++ xf86DrvMsgVerb(pScrn1->scrnIndex, X_INFO, pSiS->XineVerb, "%s", rectxine);
+
+ }
+
+--
+1.6.2.4
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch b/x11/driver/xorg-video-sisimedia/files/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
new file mode 100644
index 0000000000..68ec63138d
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
@@ -0,0 +1,32 @@
+From 49c641b638ac36d2a559555c04a3bd2777c8d071 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith
+Date: Fri, 1 May 2009 16:52:10 -0700
+Subject: [PATCH 04/10] Make sisRegs3D4 big enough to hold all values written to it
+
+Increase size from 0xff to 0x100 since SiS315Save (sis_dac.c line 752)
+writes values into sisRegs3D4[0x00..0xff] if ChipType >= XGI_20
+
+[This bug was found by the Parfait bug checking tool.
+ For more information see http://research.sun.com/projects/parfait ]
+
+Signed-off-by: Alan Coopersmith
+---
+ src/sis.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/sis.h b/src/sis.h
+index 9bafd4b..773f709 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -747,7 +747,7 @@ typedef struct {
+ UChar sisRegsGR[10];
+ UChar sisDAC[768];
+ UChar sisRegs3C4[0x80];
+- UChar sisRegs3D4[0xff];
++ UChar sisRegs3D4[0x100];
+ UChar sisRegs3C2;
+ UChar sisCapt[0x60];
+ UChar sisVid[0x50];
+--
+1.6.5.4
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0005-Correct-bounds-check-of-blitClip-array-access.patch b/x11/driver/xorg-video-sisimedia/files/0005-Correct-bounds-check-of-blitClip-array-access.patch
new file mode 100644
index 0000000000..038322bf64
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0005-Correct-bounds-check-of-blitClip-array-access.patch
@@ -0,0 +1,38 @@
+From 933dd8f860883c613acb5bcdf6b66100dbdfa952 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith
+Date: Fri, 1 May 2009 16:57:22 -0700
+Subject: [PATCH 05/10] Correct bounds check of blitClip array access
+
+Array is defined as blitClip[NUM_BLIT_PORTS], so invalid indexes
+are >= NUM_BLIT_PORTS, not just > NUM_BLIT_PORTS
+
+[This bug was found by the Parfait bug checking tool.
+ For more information see http://research.sun.com/projects/parfait ]
+
+Signed-off-by: Alan Coopersmith
+---
+ src/sis_video.c | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: xf86-video-sis-0.9.1/src/sis_video.c
+===================================================================
+--- xf86-video-sis-0.9.1.orig/src/sis_video.c
++++ xf86-video-sis-0.9.1/src/sis_video.c
+@@ -4656,7 +4656,7 @@ SISStopVideoBlit(ScrnInfoPtr pScrn, ULon
+ * adapt->flags but we provide it anyway.
+ */
+
+- if(index > NUM_BLIT_PORTS) return;
++ if(index >= NUM_BLIT_PORTS) return;
+
+ REGION_EMPTY(pScrn->pScreen, &pPriv->blitClip[index]);
+
+@@ -4698,7 +4698,7 @@ SISPutImageBlit_671(
+ int xoffset = 0, yoffset = 0;
+ Bool first;
+
+- if(index > NUM_BLIT_PORTS)
++ if(index >= NUM_BLIT_PORTS)
+ return BadMatch;
+
+ if(!height || !width)
diff --git a/x11/driver/xorg-video-sisimedia/files/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch b/x11/driver/xorg-video-sisimedia/files/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
new file mode 100644
index 0000000000..f023c774eb
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
@@ -0,0 +1,25 @@
+From 910073e0ab3a7bf9e5c9d97437a879d97edc2714 Mon Sep 17 00:00:00 2001
+From: root
+Date: Wed, 1 Jul 2009 09:59:39 -0400
+Subject: [PATCH] Fix backlight off on SiS30x. video bridges.
+
+---
+ src/init301.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/init301.c b/src/init301.c
+index c179ae8..70a6aab 100644
+--- a/src/init301.c
++++ b/src/init301.c
+@@ -9261,7 +9261,7 @@ void
+ SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr)
+ {
+ /* Switch off LCD backlight on SiS30xLV */
+- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
++ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFC);
+ SiS_DDC2Delay(SiS_Pr,0xff00);
+ }
+
+--
+1.5.4.3
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0006-Add-IgnoreHotkeyFlag-driver-option.patch b/x11/driver/xorg-video-sisimedia/files/0006-Add-IgnoreHotkeyFlag-driver-option.patch
new file mode 100644
index 0000000000..8ebc799a7a
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0006-Add-IgnoreHotkeyFlag-driver-option.patch
@@ -0,0 +1,89 @@
+From 072af02d180c1965f30246ea269d208292ed6f05 Mon Sep 17 00:00:00 2001
+From: root
+Date: Wed, 1 Jul 2009 14:13:52 -0400
+Subject: [PATCH] Add IgnoreHotkeyFlag driver option.
+
+Some BIOSes do not set the hotkey flag correctly. Without this option
+set, the driver won't change the mirroring state of LCD and VGA
+connections if the BIOS did not set this flag.
+---
+ src/sis.h | 3 +++
+ src/sis_driver.c | 2 +-
+ src/sis_opt.c | 13 ++++++++++++-
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/src/sis.h b/src/sis.h
+index c50690b..c82c302 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -1565,6 +1565,9 @@ typedef struct {
+
+ /* Enable special 1366x768x60hz mode of LVDS panel. Ivans@090109 */
+ Bool EnablePanel_1366x768;
++
++ /* Ignore hotkey flag on capability changed APM events */
++ Bool IgnoreHotkeyFlag;
+
+ } SISRec, *SISPtr;
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index c935c11..2a5001c 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -11370,7 +11370,7 @@ SISPMEvent(int scrnIndex, pmEvent event, Bool undo)
+ inSISIDXREG(SISCR,0x3d,hotkeyflag);/*check device switch flag from BIOS CR 0x3d bit[2].*/
+
+
+- if(hotkeyflag & 0x04)
++ if(pSiS->IgnoreHotkeyFlag || (hotkeyflag & 0x04))
+ {
+
+ SISCRT1PreInit(pScrn); /*redetecting CRT1, pSiS->CRT1detected will update.*/
+diff --git a/src/sis_opt.c b/src/sis_opt.c
+index 4b79f7f..7f726ea 100644
+--- a/src/sis_opt.c
++++ b/src/sis_opt.c
+@@ -159,7 +159,8 @@ typedef enum {
+ OPTION_PSEUDO,
+ OPTION_FUTRO_TIMING, /*chaoyu's modified: for Fuji-Siemans specail timing*/
+ OPTION_TRACEVGAMISCW,
+- OPTION_USETIMING1366 /*option of enable 1366x768 timing for LVDS panel. Ivans@090109*/
++ OPTION_USETIMING1366, /*option of enable 1366x768 timing for LVDS panel. Ivans@090109*/
++ OPTION_IGNOREHOTKEYFLAG
+ } SISOpts;
+
+ static const OptionInfoRec SISOptions[] = {
+@@ -305,6 +306,7 @@ static const OptionInfoRec SISOptions[] = {
+ { OPTION_FUTRO_TIMING, "FutroTiming", OPTV_BOOLEAN, {0}, FALSE },/*chaoyu's modified: for Fuji-seimans special timing*/
+ { OPTION_TRACEVGAMISCW, "TraceVgaMISCW", OPTV_BOOLEAN, {0}, FALSE },/*Ivans added for helping detected CRT1 using BIOS setting.*/
+ { OPTION_USETIMING1366, "UseTiming1366", OPTV_BOOLEAN, {0}, FALSE },/*enable 1366 timing on LVDS, Ivans@090109*/
++ { OPTION_IGNOREHOTKEYFLAG, "IgnoreHotkeyFlag", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+ };
+
+@@ -624,6 +626,7 @@ SiSOptions(ScrnInfoPtr pScrn)
+ pSiS->CRT2IsScrn0 = FALSE;
+ #endif
+ #endif
++ pSiS->IgnoreHotkeyFlag = FALSE;
+
+ /* Chipset dependent defaults */
+
+@@ -2419,6 +2422,14 @@ SiSOptions(ScrnInfoPtr pScrn)
+ pSiS->EnablePanel_1366x768 = TRUE;
+ }
+ }
++ /* Ignore hotkey flag for video switch, switch on every
++ * XF86_APM_CAPABILITY_CHANGED event */
++ if(xf86GetOptValBool(pSiS->Options, OPTION_IGNOREHOTKEYFLAG, &val)){
++ if(val){
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"Ignoring hotkey flag\n");
++ pSiS->IgnoreHotkeyFlag = TRUE;
++ }
++ }
+
+ }
+
+--
+1.5.4.3
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0007-Remove-useless-loader-symbol-lists.patch b/x11/driver/xorg-video-sisimedia/files/0007-Remove-useless-loader-symbol-lists.patch
new file mode 100644
index 0000000000..3952133753
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0007-Remove-useless-loader-symbol-lists.patch
@@ -0,0 +1,249 @@
+From ae1a7dcebdac904c8068cc38fb77648c548f5075 Mon Sep 17 00:00:00 2001
+From: Paulo Ricardo Zanoni
+Date: Thu, 22 Apr 2010 11:19:29 -0300
+Subject: [PATCH] Remove useless loader symbol lists
+
+Adaption of xf86-video-sis patch 74553b5ee476a0dd28e136f5a33a546ea0c3ef28
+---
+ src/sis_driver.c | 150 +-----------------------------------------------------
+ 1 files changed, 1 insertions(+), 149 deletions(-)
+
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index d56182f..96255d3 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -227,126 +227,6 @@ static PciChipsets XGIPciChipsets[] = {
+ { -1, -1, RES_UNDEFINED }
+ };
+
+-#ifdef SIS_USE_XAA
+-static const char *xaaSymbols[] = {
+- "XAACreateInfoRec",
+- "XAADestroyInfoRec",
+- "XAAHelpPatternROP",
+- "XAAInit",
+- NULL
+-};
+-#endif
+-
+-#ifdef SIS_USE_EXA
+-static const char *exaSymbols[] = {
+- "exaGetVersion",
+- "exaDriverInit",
+- "exaDriverFini",
+- "exaOffscreenAlloc",
+- "exaOffscreenFree",
+- NULL
+-};
+-#endif
+-
+-static const char *fbSymbols[] = {
+- "fbPictureInit",
+- "fbScreenInit",
+- NULL
+-};
+-
+-static const char *shadowSymbols[] = {
+- "ShadowFBInit",
+- NULL
+-};
+-
+-static const char *ramdacSymbols[] = {
+- "xf86CreateCursorInfoRec",
+- "xf86DestroyCursorInfoRec",
+- "xf86InitCursor",
+- NULL
+-};
+-
+-static const char *ddcSymbols[] = {
+- "xf86PrintEDID",
+- "xf86InterpretEDID",
+- NULL
+-};
+-
+-static const char *int10Symbols[] = {
+- "xf86FreeInt10",
+- "xf86InitInt10",
+- NULL
+-};
+-
+-static const char *vbeSymbols[] = {
+-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
+- "VBEInit",
+-#else
+- "VBEExtendedInit",
+-#endif
+- "vbeDoEDID",
+- "vbeFree",
+- "VBEGetVBEInfo",
+- "VBEFreeVBEInfo",
+- "VBEGetModeInfo",
+- "VBEFreeModeInfo",
+- "VBESaveRestore",
+- "VBESetVBEMode",
+- "VBEGetVBEMode",
+- "VBESetDisplayStart",
+- "VBESetGetLogicalScanlineLength",
+- NULL
+-};
+-
+-#ifdef XF86DRI
+-static const char *drmSymbols[] = {
+- "drmAddMap",
+- "drmAgpAcquire",
+- "drmAgpRelease",
+- "drmAgpAlloc",
+- "drmAgpFree",
+- "drmAgpBase",
+- "drmAgpBind",
+- "drmAgpUnbind",
+- "drmAgpEnable",
+- "drmAgpGetMode",
+- "drmCtlInstHandler",
+- "drmCtlUninstHandler",
+- "drmGetInterruptFromBusID",
+-#ifndef SISHAVEDRMWRITE
+- "drmSiSAgpInit",
+-#else
+- "drmCommandWrite",
+-#endif
+-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+- "drmGetVersion",
+- "drmFreeVersion",
+-#endif
+- NULL
+-};
+-
+-static const char *driSymbols[] = {
+- "DRICreateInfoRec",
+- "DRIScreenInit",
+- "DRIFinishScreenInit",
+- "DRIDestroyInfoRec",
+- "DRICloseScreen",
+- "DRIGetSAREAPrivate",
+- "DRILock",
+- "DRIUnlock",
+- "DRIQueryVersion",
+- "GlxSetVisualConfigs",
+- NULL
+-};
+-
+-#ifdef XFree86LOADER
+-static const char *driRefSymbols[] = {
+- "DRICreatePCIBusID", /* not REQUIRED, but eventually referenced */
+- NULL
+-};
+-#endif
+-#endif /* XF86DRI */
+-
+ #ifdef XFree86LOADER
+
+ static MODULESETUPPROTO(sisSetup);
+@@ -382,19 +262,6 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ if(!setupDone) {
+ setupDone = TRUE;
+ xf86AddDriver(&SIS, module, SIS_HaveDriverFuncs);
+- LoaderRefSymLists(fbSymbols,
+-#ifdef SIS_USE_XAA
+- xaaSymbols,
+-#endif
+-#ifdef SIS_USE_EXA
+- exaSymbols,
+-#endif
+- shadowSymbols, ramdacSymbols,
+- vbeSymbols, int10Symbols,
+-#ifdef XF86DRI
+- drmSymbols, driSymbols, driRefSymbols,
+-#endif
+- NULL);
+ return (pointer)TRUE;
+ }
+
+@@ -1068,7 +935,6 @@ SiS_LoadInitVBE(ScrnInfoPtr pScrn)
+ return;
+
+ if(xf86LoadSubModule(pScrn, "vbe")) {
+- xf86LoaderReqSymLists(vbeSymbols, NULL);
+ #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
+ pSiS->pVbe = VBEInit(pSiS->pInt, pSiS->pEnt->index);
+ #else
+@@ -1092,7 +958,6 @@ SiSLoadInitDDCModule(ScrnInfoPtr pScrn)
+ return TRUE;
+
+ if(xf86LoadSubModule(pScrn, "ddc")) {
+- xf86LoaderReqSymLists(ddcSymbols, NULL);
+ pSiS->haveDDC = TRUE;
+ return TRUE;
+ }
+@@ -3586,7 +3451,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Initializing adapter through int10\n");
+ if(xf86LoadSubModule(pScrn, "int10")) {
+- xf86LoaderReqSymLists(int10Symbols, NULL);
+ pSiS->pInt = xf86InitInt10(pSiS->pEnt->index);
+ } else {
+ SISErrorLog(pScrn, "Failed to load int10 module\n");
+@@ -3683,7 +3547,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SISErrorLog(pScrn, "Could not load ramdac module\n");
+ goto my_error_1;
+ }
+- xf86LoaderReqSymLists(ramdacSymbols, NULL);
+
+ /* Set pScrn->monitor */
+ pScrn->monitor = pScrn->confScreen->monitor;
+@@ -5868,22 +5731,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SISErrorLog(pScrn, "Unsupported framebuffer bpp (%d)\n", pScrn->bitsPerPixel);
+ goto my_error_1;
+ }
+- xf86LoaderReqSymLists(fbSymbols, NULL);
+
+ /* Load XAA/EXA (if needed) */
+ if(!pSiS->NoAccel) {
+ char *modName = NULL;
+- const char **symNames = NULL;
+ #ifdef SIS_USE_XAA
+ if(!pSiS->useEXA) {
+ modName = "xaa";
+- symNames = xaaSymbols;
+ }
+ #endif
+ #ifdef SIS_USE_EXA
+ if(pSiS->useEXA) {
+ modName = "exa";
+- symNames = exaSymbols;
+ }
+ #endif
+ if(modName && (!xf86LoadSubModule(pScrn, modName))) {
+@@ -5894,9 +5753,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->NoXvideo = TRUE;
+ }
+ #endif
+- } else if(symNames) {
+- xf86LoaderReqSymLists(symNames, NULL);
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "2D acceleration enabled, modename %s\n",modName);
+ }
+ }
+
+@@ -5909,8 +5765,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pSiS->ShadowFB = FALSE;
+ pSiS->Rotate = pSiS->Reflect = 0;
+ }
+- } else {
+- xf86LoaderReqSymLists(shadowSymbols, NULL);
+ }
+ }
+
+@@ -5920,9 +5774,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
+ if(xf86LoadSubModule(pScrn, "dri")) {
+ if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
+- if(xf86LoadSubModule(pScrn, "glx")) {
+- xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
+- } else {
++ if(! xf86LoadSubModule(pScrn, "glx")) {
+ SISErrorLog(pScrn, "Failed to load glx module\n");
+ }
+ }
+--
+1.6.4.4
+
diff --git a/x11/driver/xorg-video-sisimedia/files/0008-update-to-xextproto-7-1-support.patch b/x11/driver/xorg-video-sisimedia/files/0008-update-to-xextproto-7-1-support.patch
new file mode 100644
index 0000000000..1dcbdf05c8
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0008-update-to-xextproto-7-1-support.patch
@@ -0,0 +1,45 @@
+From 59ea80738d22c69a2850fd7ff89bd75330cc310b Mon Sep 17 00:00:00 2001
+From: Peter Hutterer
+Date: Thu, 16 Jul 2009 01:55:25 +0000
+Subject: Update to xextproto 7.1 support.
+
+DPMS header was split into dpms.h (client) and dpmsconst.h (server). Drivers
+need to include dpmsconst.h if xextproto 7.1 is available.
+
+Signed-off-by: Peter Hutterer
+---
+diff --git a/configure.ac b/configure.ac
+index 089c5fa..f19c1b7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,6 +62,10 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
+
+ # Checks for pkg-config packages
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto xf86dgaproto $REQUIRED_MODULES])
++PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
++ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
++ HAVE_XEXTPROTO_71="no")
++AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
+ sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+
+ # Checks for libraries.
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index ef7b522..a1ced97 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -78,8 +78,13 @@
+
+ #include "globals.h"
+
++#ifdef HAVE_XEXTPROTO_71
++#include
++#else
+ #define DPMS_SERVER
+ #include
++#endif
++
+
+ #ifdef XF86DRI
+ #include "dri.h"
+--
+cgit v0.8.3-6-g21f6
diff --git a/x11/driver/xorg-video-sisimedia/files/0009-update-for-rac-removal.patch b/x11/driver/xorg-video-sisimedia/files/0009-update-for-rac-removal.patch
new file mode 100644
index 0000000000..df1421798d
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0009-update-for-rac-removal.patch
@@ -0,0 +1,69 @@
+From 9e1ebb9530bbb71be7fcab9e6f8f9a475be72efe Mon Sep 17 00:00:00 2001
+From: Dave Airlie
+Date: Tue, 28 Jul 2009 03:32:37 +0000
+Subject: sis: update for resources/RAC API removal
+
+---
+diff --git a/src/sis.h b/src/sis.h
+index 773f709..e859c78 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -77,7 +77,9 @@
+ #include "xf86Pci.h"
+ #include "xf86Priv.h"
+ #include "xf86_OSproc.h"
++#ifndef XSERVER_LIBPCIACCESS
+ #include "xf86Resources.h"
++#endif
+ #include "xf86.h"
+ #include "xf86PciInfo.h"
+ #include "xf86Cursor.h"
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index a1ced97..bb11cbb 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -49,7 +49,9 @@
+
+ #include "sis.h"
+
++#ifndef XSERVER_LIBPCIACCESS
+ #include "xf86RAC.h"
++#endif
+ #include "dixstruct.h"
+ #include "shadowfb.h"
+ #include "fb.h"
+@@ -3552,6 +3554,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SiS_MapVGAMem(pScrn);
+ #endif
+
++#ifndef XSERVER_LIBPCIACCESS
+ /* Set operating state */
+
+ /* 1. memory */
+@@ -3581,6 +3584,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ /* Operations for which I/O access is required */
+ pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+
++#endif
++
+ /* Load ramdac module */
+ if(!xf86LoadSubModule(pScrn, "ramdac")) {
+ SISErrorLog(pScrn, "Could not load ramdac module\n");
+@@ -4424,6 +4429,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX (size %ldK)\n",
+ (ULong)pSiS->IOAddress, pSiS->mmioSize);
+
++#ifndef XSERVER_LIBPCIACCESS
+ /* Register the PCI-assigned resources */
+ if(xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) {
+ SISErrorLog(pScrn, "PCI resource conflicts detected\n");
+@@ -4435,6 +4441,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ SISFreeRec(pScrn);
+ return FALSE;
+ }
++#endif
+
+ from = X_PROBED;
+ if(pSiS->pEnt->device->videoRam != 0) {
+--
+cgit v0.8.3-6-g21f6
diff --git a/x11/driver/xorg-video-sisimedia/files/0010-change-to-use-abi-version-check.patch b/x11/driver/xorg-video-sisimedia/files/0010-change-to-use-abi-version-check.patch
new file mode 100644
index 0000000000..cb9fd7ea5d
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0010-change-to-use-abi-version-check.patch
@@ -0,0 +1,34 @@
+From 8c3eca873717e877048c2bde345c02b1e9099e50 Mon Sep 17 00:00:00 2001
+From: Dave Airlie
+Date: Tue, 28 Jul 2009 05:22:41 +0000
+Subject: sis: change to using ABI version check
+
+---
+diff --git a/src/sis.h b/src/sis.h
+index e859c78..400b83f 100644
+--- a/src/sis.h
++++ b/src/sis.h
+@@ -77,7 +77,7 @@
+ #include "xf86Pci.h"
+ #include "xf86Priv.h"
+ #include "xf86_OSproc.h"
+-#ifndef XSERVER_LIBPCIACCESS
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86Resources.h"
+ #endif
+ #include "xf86.h"
+diff --git a/src/sis_driver.c b/src/sis_driver.c
+index bb11cbb..994b02d 100644
+--- a/src/sis_driver.c
++++ b/src/sis_driver.c
+@@ -49,7 +49,7 @@
+
+ #include "sis.h"
+
+-#ifndef XSERVER_LIBPCIACCESS
++#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86RAC.h"
+ #endif
+ #include "dixstruct.h"
+--
+cgit v0.8.3-6-g21f6
diff --git a/x11/driver/xorg-video-sisimedia/files/0011-more-rac-removal.patch b/x11/driver/xorg-video-sisimedia/files/0011-more-rac-removal.patch
new file mode 100644
index 0000000000..8175dea98d
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/0011-more-rac-removal.patch
@@ -0,0 +1,13 @@
+diff -Nrup xf86-video-sis-0.9.1/src/sis_hwmc.c patched/src/sis_hwmc.c
+--- xf86-video-sis-0.9.1/src/sis_hwmc.c 2008-03-04 14:31:10.000000000 -0300
++++ patched/src/sis_hwmc.c 2010-04-20 17:10:21.073690167 -0300
+@@ -43,7 +43,9 @@ THE USE OR OTHER DEALINGS IN THE SOFTWAR
+
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
++#ifndef GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+ #include "xf86Resources.h"
++#endif
+ #include "compiler.h"
+ #include "xf86PciInfo.h"
+ #include "xf86Pci.h"
diff --git a/x11/driver/xorg-video-sisimedia/files/Untangle-XF86DRI.patch b/x11/driver/xorg-video-sisimedia/files/Untangle-XF86DRI.patch
new file mode 100644
index 0000000000..55b9c9deb5
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/Untangle-XF86DRI.patch
@@ -0,0 +1,186 @@
+diff -aur xf86-video-sis-0.9.1.pristine/configure.ac xf86-video-sis-0.9.1.new/configure.ac
+--- xf86-video-sis-0.9.1.pristine/configure.ac 2012-03-17 04:52:35.410417514 +1100
++++ xf86-video-sis-0.9.1.new/configure.ac 2012-03-17 04:55:05.949412228 +1100
+@@ -97,8 +97,8 @@
+ AM_CONDITIONAL(DRI, test x$DRI = xyes)
+ if test "$DRI" = yes; then
+ PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto])
+- AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
+- AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
++ AC_DEFINE(SISDRI,1,[Enable DRI driver support])
++ AC_DEFINE(SISDRI_DEVEL,1,[Enable developmental DRI driver support])
+ fi
+
+ # technically this should be a configure flag. meh.
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_driver.c xf86-video-sis-0.9.1.new/src/sis_driver.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_driver.c 2012-03-17 04:52:35.380417061 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_driver.c 2012-03-17 04:57:54.118679619 +1100
+@@ -115,7 +115,7 @@
+ #endif
+
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ #include "dri.h"
+ #endif
+
+@@ -5779,7 +5779,7 @@
+ }
+
+ /* Load the dri and glx modules if requested. */
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->loadDRI) {
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
+ if(xf86LoadSubModule(pScrn, "dri")) {
+@@ -9469,7 +9469,7 @@
+
+ pSiS->cmdQueueLen = 0; /* Force an EngineIdle() at start */
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->loadDRI) {
+ #ifdef SISDUALHEAD
+ /* No DRI in dual head mode */
+@@ -9802,7 +9802,7 @@
+ #endif
+
+ /* Finish DRI initialisation */
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->loadDRI) {
+ if(pSiS->directRenderingEnabled) {
+ /* Now that mi, drm and others have done their thing,
+@@ -10359,7 +10359,7 @@
+ }
+ /* Mark for 3D full-screen bug */
+ /*
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ DRILock(screenInfo.screens[scrnIndex], DRM_LOCK_QUIESCENT);
+ }
+@@ -10388,7 +10388,7 @@
+ #endif
+ /* Mark for 3D full-screen bug */
+ /*
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ DRIUnlock(screenInfo.screens[scrnIndex]);
+ }
+@@ -10601,7 +10601,7 @@
+
+ /* Mark for 3D full-screen bug */
+ /*
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ DRIUnlock(screenInfo.screens[scrnIndex]);
+ }
+@@ -10629,7 +10629,7 @@
+ {
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+-#ifdef XF86DRI
++#ifdef SISDRI
+ ScreenPtr pScreen;
+
+ if(pSiS->directRenderingEnabled) {
+@@ -10715,7 +10715,7 @@
+ SiSCtrlExtUnregister(pSiS, pScrn->scrnIndex);
+ }
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ if(pSiS->directRenderingEnabled) {
+ SISDRICloseScreen(pScreen);
+ pSiS->directRenderingEnabled = FALSE;
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis.h xf86-video-sis-0.9.1.new/src/sis.h
+--- xf86-video-sis-0.9.1.pristine/src/sis.h 2012-03-17 04:52:35.357083354 +1100
++++ xf86-video-sis-0.9.1.new/src/sis.h 2012-03-17 04:56:36.814150836 +1100
+@@ -215,7 +215,13 @@
+
+ #undef SISHAVEDRMWRITE
+ #undef SISNEWDRI
+-#ifdef XF86DRI
++
++/* if the server was built without DRI support, force-disable DRI */
++#ifndef XF86DRI
++#undef SISDRI
++#endif
++
++#ifdef SISDRI
+ #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,3,0)
+ #define SISHAVEDRMWRITE
+ #endif
+@@ -229,7 +235,7 @@
+ #include "dri.h"
+ #include "GL/glxint.h"
+ #include "sis_dri.h"
+-#endif /* XF86DRI */
++#endif /* SISDRI */
+
+ #include "sis_config.h"
+
+@@ -884,7 +890,7 @@
+ ScrnInfoPtr pScrn_2;
+ UChar *BIOS;
+ struct SiS_Private *SiS_Pr;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ SISAGPHTYPE agpHandle;
+ ULong agpAddr;
+ UChar *agpBase;
+@@ -1291,7 +1297,7 @@
+ unsigned int cmdQueueSize_div2;
+ unsigned int cmdQueueSize_div4;
+ unsigned int cmdQueueSize_4_3;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ SISAGPHTYPE agpHandle;
+ ULong agpAddr;
+ UChar *agpBase;
+@@ -1351,7 +1357,7 @@
+ /* DRI */
+ Bool loadDRI;
+ Bool DRIEnabled;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ Bool directRenderingEnabled;
+ DRIInfoPtr pDRIInfo;
+ int drmSubFD;
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_hwmc.c xf86-video-sis-0.9.1.new/src/sis_hwmc.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_hwmc.c 2012-03-17 04:52:35.330416274 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_hwmc.c 2012-03-17 05:22:17.014636372 +1100
+@@ -53,7 +53,9 @@
+ #include "regionstr.h"
+
+ #include "sis.h"
++#ifdef SISDRI
+ #include "sis_dri.h"
++#endif
+
+ #include "xf86xv.h"
+ #include "xf86xvmc.h"
+diff -aur xf86-video-sis-0.9.1/src/sis_opt.c xf86-video-sis-0.9.1.new/src/sis_opt.c
+--- xf86-video-sis-0.9.1/src/sis_opt.c 2012-03-17 07:36:12.285566154 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_opt.c 2012-03-17 07:34:59.451106475 +1100
+@@ -494,7 +494,7 @@
+ pSiS->ShadowFB = FALSE;
+ pSiS->loadDRI = FALSE;
+ pSiS->DRIEnabled = FALSE;
+-#ifdef XF86DRI
++#ifdef SISDRI
+ pSiS->agpWantedPages = AGP_PAGES;
+ #endif
+ pSiS->VESA = -1;
+@@ -2160,7 +2160,7 @@
+ }
+
+
+-#ifdef XF86DRI
++#ifdef SISDRI
+ /* DRI */
+ from = X_DEFAULT;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_DRI, &pSiS->loadDRI)) {
diff --git a/x11/driver/xorg-video-sisimedia/files/deprecated-sym2.patch b/x11/driver/xorg-video-sisimedia/files/deprecated-sym2.patch
new file mode 100644
index 0000000000..f026823334
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/deprecated-sym2.patch
@@ -0,0 +1,1068 @@
+This patch for remove all depreceated / obselete symbol on compiling
+Contributor saa7_go < saa7.go@gmail.com >
+
+diff -u xf86-video-sismedia-0.9.1/src/initextx.c xf86-video-sismedia-0.9.1-dep-clean/src/initextx.c
+--- xf86-video-sismedia-0.9.1/src/initextx.c 2011-03-06 11:27:56.368767584 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/initextx.c 2011-03-06 11:34:50.298266877 +0700
+@@ -284,10 +284,10 @@
+ }
+ }
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(10))) {
+- xfree(new);
++ if(!(new->name = malloc(10))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+@@ -436,11 +436,11 @@
+ }
+ }
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(12))) {
+- xfree(new);
++ if(!(new->name = malloc(12))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+@@ -521,11 +521,11 @@
+
+ if(pSiS->SiS_Pr->CP_DataValid[i]) {
+
+- if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
++ if(!(new = malloc(sizeof(DisplayModeRec)))) return first;
+
+ memset(new, 0, sizeof(DisplayModeRec));
+- if(!(new->name = xalloc(10))) {
+- xfree(new);
++ if(!(new->name = malloc(10))) {
++ free(new);
+ return first;
+ }
+ if(!first) first = new;
+diff -u xf86-video-sismedia-0.9.1/src/sis6326_video.c xf86-video-sismedia-0.9.1-dep-clean/src/sis6326_video.c
+--- xf86-video-sismedia-0.9.1/src/sis6326_video.c 2011-03-06 11:27:56.376768671 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis6326_video.c 2011-03-06 12:24:06.324251591 +0700
+@@ -171,7 +171,7 @@
+ adaptors = &newAdaptor;
+ } else {
+ /* need to free this someplace */
+- newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
++ newAdaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(XF86VideoAdaptorPtr));
+@@ -186,7 +186,7 @@
+ xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if(newAdaptors)
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+
+ /* client libraries expect an encoding */
+@@ -532,7 +532,7 @@
+ return NULL;
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISPortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
+diff -u xf86-video-sismedia-0.9.1/src/sis_cursor.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_cursor.c
+--- xf86-video-sismedia-0.9.1/src/sis_cursor.c 2011-03-06 11:27:56.376768671 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_cursor.c 2011-03-06 12:24:06.400262694 +0700
+@@ -1253,11 +1253,11 @@
+ SISPtr pSiS = SISPTR(pScrn);
+ xf86CursorInfoPtr infoPtr;
+
+- if(!(pSiS->CursorScratch = xcalloc(1, max(2048, pSiS->CursorSize))))
++ if(!(pSiS->CursorScratch = calloc(1, max(2048, pSiS->CursorSize))))
+ return FALSE;
+
+ if(!(infoPtr = xf86CreateCursorInfoRec())) {
+- xfree(pSiS->CursorScratch);
++ free(pSiS->CursorScratch);
+ pSiS->CursorScratch = NULL;
+ return FALSE;
+ }
+diff -u xf86-video-sismedia-0.9.1/src/sis_dga.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_dga.c
+--- xf86-video-sismedia-0.9.1/src/sis_dga.c 2011-03-06 11:27:56.380769214 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_dga.c 2011-03-06 11:34:50.458289501 +0700
+@@ -156,18 +156,18 @@
+
+ if(pMode->HDisplay != otherPitch) {
+
+- newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (*num + 2) * sizeof(DGAModeRec));
+ oneMore = TRUE;
+
+ } else {
+
+- newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec));
++ newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec));
+ oneMore = FALSE;
+
+ }
+
+ if(!newmodes) {
+- xfree(modes);
++ free(modes);
+ return NULL;
+ }
+ modes = newmodes;
+@@ -353,12 +353,12 @@
+ newdgamodes = SISDGAMakeModes(pScrn, &newdgamodenum, TRUE);
+
+ if(DGAReInitModes(screenInfo.screens[pScrn->scrnIndex], newdgamodes, newdgamodenum)) {
+- xfree(pSiS->DGAModes);
++ free(pSiS->DGAModes);
+ pSiS->DGAModes = newdgamodes;
+ pSiS->numDGAModes = newdgamodenum;
+ return TRUE;
+ } else {
+- xfree(newdgamodes);
++ free(newdgamodes);
+ return FALSE;
+ }
+ #else
+diff -u xf86-video-sismedia-0.9.1/src/sis_dri.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_dri.c
+--- xf86-video-sismedia-0.9.1/src/sis_dri.c 2011-03-06 11:27:56.380769214 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_dri.c 2011-03-06 12:24:06.456270873 +0700
+@@ -156,19 +156,19 @@
+ case 32:
+ numConfigs = (useZ16) ? 8 : 16;
+
+- if(!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
++ if(!(pConfigs = (__GLXvisualConfig*)calloc(sizeof(__GLXvisualConfig),
+ numConfigs))) {
+ return FALSE;
+ }
+- if(!(pSISConfigs = (SISConfigPrivPtr)xcalloc(sizeof(SISConfigPrivRec),
++ if(!(pSISConfigs = (SISConfigPrivPtr)calloc(sizeof(SISConfigPrivRec),
+ numConfigs))) {
+- xfree(pConfigs);
++ free(pConfigs);
+ return FALSE;
+ }
+- if(!(pSISConfigPtrs = (SISConfigPrivPtr*)xcalloc(sizeof(SISConfigPrivPtr),
++ if(!(pSISConfigPtrs = (SISConfigPrivPtr*)calloc(sizeof(SISConfigPrivPtr),
+ numConfigs))) {
+- xfree(pConfigs);
+- xfree(pSISConfigs);
++ free(pConfigs);
++ free(pSISConfigs);
+ return FALSE;
+ }
+ for(i=0; ibusIdString = DRICreatePCIBusID(pSIS->PciInfo);
+ } else {
+ #endif
+- pDRIInfo->busIdString = xalloc(64);
++ pDRIInfo->busIdString = malloc(64);
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ pSIS->PciBus, pSIS->PciDevice, pSIS->PciFunc);
+ #ifdef SISHAVECREATEBUSID
+@@ -389,7 +389,7 @@
+ pDRIInfo->SAREASize = SAREA_MAX;
+ #endif
+
+- if(!(pSISDRI = (SISDRIPtr)xcalloc(sizeof(SISDRIRec), 1))) {
++ if(!(pSISDRI = (SISDRIPtr)calloc(sizeof(SISDRIRec), 1))) {
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo = 0;
+ return FALSE;
+@@ -407,7 +407,7 @@
+
+ if(!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling the DRI.\n");
+- xfree(pDRIInfo->devPrivate);
++ free(pDRIInfo->devPrivate);
+ pDRIInfo->devPrivate = 0;
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+ pSIS->pDRIInfo = 0;
+@@ -867,7 +867,7 @@
+
+ if(pSIS->pDRIInfo) {
+ if(pSIS->pDRIInfo->devPrivate) {
+- xfree(pSIS->pDRIInfo->devPrivate);
++ free(pSIS->pDRIInfo->devPrivate);
+ pSIS->pDRIInfo->devPrivate = NULL;
+ }
+ DRIDestroyInfoRec(pSIS->pDRIInfo);
+@@ -875,12 +875,12 @@
+ }
+
+ if(pSIS->pVisualConfigs) {
+- xfree(pSIS->pVisualConfigs);
++ free(pSIS->pVisualConfigs);
+ pSIS->pVisualConfigs = NULL;
+ }
+
+ if(pSIS->pVisualConfigsPriv) {
+- xfree(pSIS->pVisualConfigsPriv);
++ free(pSIS->pVisualConfigsPriv);
+ pSIS->pVisualConfigsPriv = NULL;
+ }
+
+diff -u xf86-video-sismedia-0.9.1/src/sis_driver.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_driver.c
+--- xf86-video-sismedia-0.9.1/src/sis_driver.c 2011-03-06 11:27:56.384769757 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_driver.c 2011-03-06 12:24:06.512279052 +0700
+@@ -497,7 +497,7 @@
+ numDevSections, drv, &usedChipsXGI);
+
+ /* Free it since we don't need that list after this */
+- xfree(devSections);
++ free(devSections);
+
+ numUsed = numUsedSiS + numUsedXGI;
+ xf86DrvMsg(0, X_INFO, "SISPRobe - test1\n");
+@@ -595,8 +595,8 @@
+
+ }
+
+- if(usedChipsSiS) xfree(usedChipsSiS);
+- if(usedChipsXGI) xfree(usedChipsXGI);
++ if(usedChipsSiS) free(usedChipsSiS);
++ if(usedChipsXGI) free(usedChipsXGI);
+ xf86DrvMsg(0, X_INFO, "SISProbe end\n");
+ return foundScreen;
+ }
+@@ -642,12 +642,12 @@
+ #endif
+
+ if(pSiS->pstate) {
+- xfree(pSiS->pstate);
++ free(pSiS->pstate);
+ pSiS->pstate = NULL;
+ }
+
+ if(pSiS->fonts) {
+- xfree(pSiS->fonts);
++ free(pSiS->fonts);
+ pSiS->fonts = NULL;
+ }
+
+@@ -660,15 +660,15 @@
+ * head.
+ */
+ if(pSiSEnt->BIOS)
+- xfree(pSiSEnt->BIOS);
++ free(pSiSEnt->BIOS);
+ pSiSEnt->BIOS = pSiS->BIOS = NULL;
+
+ if(pSiSEnt->SiS_Pr)
+- xfree(pSiSEnt->SiS_Pr);
++ free(pSiSEnt->SiS_Pr);
+ pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL;
+
+ if(pSiSEnt->RenderAccelArray)
+- xfree(pSiSEnt->RenderAccelArray);
++ free(pSiSEnt->RenderAccelArray);
+ pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray = NULL;
+
+ pSiSEnt->pScrn_1 = NULL;
+@@ -681,17 +681,17 @@
+ } else {
+ #endif
+ if(pSiS->BIOS) {
+- xfree(pSiS->BIOS);
++ free(pSiS->BIOS);
+ pSiS->BIOS = NULL;
+ }
+
+ if(pSiS->SiS_Pr) {
+- xfree(pSiS->SiS_Pr);
++ free(pSiS->SiS_Pr);
+ pSiS->SiS_Pr = NULL;
+ }
+
+ if(pSiS->RenderAccelArray) {
+- xfree(pSiS->RenderAccelArray);
++ free(pSiS->RenderAccelArray);
+ pSiS->RenderAccelArray = NULL;
+ }
+ #ifdef SISDUALHEAD
+@@ -699,17 +699,17 @@
+ #endif
+ #ifdef SISMERGED
+ if(pSiS->CRT2HSync) {
+- xfree(pSiS->CRT2HSync);
++ free(pSiS->CRT2HSync);
+ pSiS->CRT2HSync = NULL;
+ }
+
+ if(pSiS->CRT2VRefresh) {
+- xfree(pSiS->CRT2VRefresh);
++ free(pSiS->CRT2VRefresh);
+ pSiS->CRT2VRefresh = NULL;
+ }
+
+ if(pSiS->MetaModes) {
+- xfree(pSiS->MetaModes);
++ free(pSiS->MetaModes);
+ pSiS->MetaModes = NULL;
+ }
+
+@@ -721,9 +721,9 @@
+ while(pSiS->CRT2pScrn->monitor->Modes) {
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ }
+- xfree(pSiS->CRT2pScrn->monitor);
++ free(pSiS->CRT2pScrn->monitor);
+ }
+- xfree(pSiS->CRT2pScrn);
++ free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ }
+
+@@ -735,10 +735,10 @@
+ do {
+ DisplayModePtr p = pScrn->currentMode->next;
+ if(pScrn->currentMode->Private)
+- xfree(pScrn->currentMode->Private);
++ free(pScrn->currentMode->Private);
+ if(pScrn->currentMode->name)
+- xfree(pScrn->currentMode->name);
+- xfree(pScrn->currentMode);
++ free(pScrn->currentMode->name);
++ free(pScrn->currentMode);
+ pScrn->currentMode = p;
+ } while(pScrn->currentMode != pScrn->modes);
+ }
+@@ -758,22 +758,22 @@
+ }
+
+ if(pSiS->currcrt1analogedid) {
+- xfree(pSiS->currcrt1analogedid);
++ free(pSiS->currcrt1analogedid);
+ pSiS->currcrt1analogedid = NULL;
+ }
+
+ if(pSiS->currcrt1digitaledid) {
+- xfree(pSiS->currcrt1digitaledid);
++ free(pSiS->currcrt1digitaledid);
+ pSiS->currcrt1digitaledid = NULL;
+ }
+
+ if(pSiS->currcrt2analogedid) {
+- xfree(pSiS->currcrt2analogedid);
++ free(pSiS->currcrt2analogedid);
+ pSiS->currcrt2analogedid = NULL;
+ }
+
+ if(pSiS->currcrt2digitaledid) {
+- xfree(pSiS->currcrt2digitaledid);
++ free(pSiS->currcrt2digitaledid);
+ pSiS->currcrt2digitaledid = NULL;
+ }
+
+@@ -784,7 +784,7 @@
+
+ while(pSiS->SISVESAModeList) {
+ sisModeInfoPtr mp = pSiS->SISVESAModeList->next;
+- xfree(pSiS->SISVESAModeList);
++ free(pSiS->SISVESAModeList);
+ pSiS->SISVESAModeList = mp;
+ }
+
+@@ -801,7 +801,7 @@
+ if(pScrn->driverPrivate == NULL)
+ return;
+
+- xfree(pScrn->driverPrivate);
++ free(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+ }
+
+@@ -1017,22 +1017,22 @@
+ Bool gotit = FALSE;
+
+ if(!ioctl(fd, SISFB_GET_INFO_SIZE, &sisfbinfosize)) {
+- if((mysisfbinfo = xalloc(sisfbinfosize))) {
++ if((mysisfbinfo = malloc(sisfbinfosize))) {
+ if(!ioctl(fd, (SISFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) {
+ gotit = TRUE;
+ } else {
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+ } else {
+- if((mysisfbinfo = xalloc(sizeof(*mysisfbinfo) + 16))) {
++ if((mysisfbinfo = malloc(sizeof(*mysisfbinfo) + 16))) {
+ if(!ioctl(fd, SISFB_GET_INFO_OLD, mysisfbinfo)) {
+ gotit = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Possibly old version of sisfb detected. Please update.\n");
+ } else {
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+@@ -1171,7 +1171,7 @@
+ }
+ }
+ }
+- xfree(mysisfbinfo);
++ free(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ close (fd);
+@@ -1250,7 +1250,7 @@
+ }
+ #endif
+ if(!pSiS->BIOS) {
+- if(!(pSiS->BIOS = xcalloc(1, BIOS_SIZE))) {
++ if(!(pSiS->BIOS = calloc(1, BIOS_SIZE))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Could not allocate memory for video BIOS image\n");
+ } else {
+@@ -1352,7 +1352,7 @@
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Could not find/read video BIOS\n");
+- xfree(pSiS->BIOS);
++ free(pSiS->BIOS);
+ pSiS->BIOS = NULL;
+ }
+ }
+@@ -1851,7 +1851,7 @@
+ {
+ if((*ptr)) {
+ memcpy((*ptr), pMonitor, sizeof(xf86Monitor));
+- xfree(pMonitor);
++ free(pMonitor);
+ } else {
+ (*ptr) = pMonitor;
+ }
+@@ -1882,7 +1882,7 @@
+ }
+ #endif
+
+- xfree((*ptr));
++ free((*ptr));
+ *ptr = NULL;
+
+ }
+@@ -2158,7 +2158,7 @@
+ xf86PrintEDID(pMonitor);
+ if(pMonitor->rawData) {
+ /* Get rid of raw data */
+- xfree(pMonitor->rawData);
++ free(pMonitor->rawData);
+ pMonitor->rawData = NULL;
+ }
+ pScrn->monitor->DDC = pMonitor = SiSSetEDIDPtr(&pSiS->currcrt1analogedid, pMonitor);
+@@ -2821,12 +2821,12 @@
+ DisplayModePtr dest = NULL;
+
+ if(source) {
+- if((dest = xalloc(sizeof(DisplayModeRec)))) {
++ if((dest = malloc(sizeof(DisplayModeRec)))) {
+ memcpy(dest, source, sizeof(DisplayModeRec));
+ dest->name = NULL;
+ dest->next = dest->prev = NULL;
+- if(!(dest->name = xalloc(strlen(source->name) + 1))) {
+- xfree(dest);
++ if(!(dest->name = malloc(strlen(source->name) + 1))) {
++ free(dest);
+ dest = NULL;
+ } else {
+ strcpy(dest->name, source->name);
+@@ -5256,7 +5256,7 @@
+ /* MergedFB: Create CRT2 pScrn and make it a copy of pScrn */
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+- pSiS->CRT2pScrn = xalloc(sizeof(ScrnInfoRec));
++ pSiS->CRT2pScrn = malloc(sizeof(ScrnInfoRec));
+ if(!pSiS->CRT2pScrn) {
+ SISErrorLog(pScrn, "Failed to allocate memory for 2nd pScrn, %s\n", mergeddisstr);
+ pSiS->MergedFB = FALSE;
+@@ -5292,7 +5292,7 @@
+ } else {
+ SISErrorLog(pScrn, mergednocrt1, mergeddisstr);
+ }
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -5341,7 +5341,7 @@
+ } else {
+ SISErrorLog(pScrn, mergednocrt2, mergeddisstr);
+ }
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+ }
+@@ -5711,7 +5711,7 @@
+ #endif
+
+ /* Don't need the clock ranges from here on */
+- xfree(clockRanges);
++ free(clockRanges);
+
+ /* Set display resolution */
+ #ifdef SISMERGED
+@@ -6719,7 +6719,7 @@
+ (function == MODE_SAVE)) {
+ /* don't rely on the memory not being touched */
+ if(!pSiS->pstate) {
+- pSiS->pstate = xalloc(pSiS->stateSize);
++ pSiS->pstate = malloc(pSiS->stateSize);
+ }
+ memcpy(pSiS->pstate, pSiS->state, pSiS->stateSize);
+ }
+@@ -9086,10 +9086,10 @@
+ if(!(nramp = xf86GetGammaRampSize(pScreen))) return;
+
+ for(i=0; i<3; i++) {
+- ramp[i] = (UShort *)xalloc(nramp * sizeof(UShort));
++ ramp[i] = (UShort *)malloc(nramp * sizeof(UShort));
+ if(!ramp[i]) {
+- if(ramp[0]) { xfree(ramp[0]); ramp[0] = NULL; }
+- if(ramp[1]) { xfree(ramp[1]); ramp[1] = NULL; }
++ if(ramp[0]) { free(ramp[0]); ramp[0] = NULL; }
++ if(ramp[1]) { free(ramp[1]); ramp[1] = NULL; }
+ return;
+ }
+ }
+@@ -9149,9 +9149,9 @@
+
+ xf86ChangeGammaRamp(pScreen, nramp, ramp[0], ramp[1], ramp[2]);
+
+- xfree(ramp[0]);
+- xfree(ramp[1]);
+- xfree(ramp[2]);
++ free(ramp[0]);
++ free(ramp[1]);
++ free(ramp[2]);
+ ramp[0] = ramp[1] = ramp[2] = NULL;
+ }
+ #endif
+@@ -9442,7 +9442,7 @@
+
+ if(pSiS->ShadowFB) {
+ pSiS->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
+- pSiS->ShadowPtr = xalloc(pSiS->ShadowPitch * height);
++ pSiS->ShadowPtr = malloc(pSiS->ShadowPitch * height);
+ displayWidth = pSiS->ShadowPitch / (pScrn->bitsPerPixel >> 3);
+ FBStart = pSiS->ShadowPtr;
+ } else {
+@@ -9626,14 +9626,14 @@
+
+ pSiS->CRT2ColNum = 1 << pScrn->rgbBits;
+
+- if((pSiS->crt2gcolortable = xalloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
++ if((pSiS->crt2gcolortable = malloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
+ pSiS->crt2colors = &pSiS->crt2gcolortable[pSiS->CRT2ColNum];
+- if((pSiS->crt2cindices = xalloc(256 * sizeof(int)))) {
++ if((pSiS->crt2cindices = malloc(256 * sizeof(int)))) {
+ int i = pSiS->CRT2ColNum;
+ SISCalculateGammaRampCRT2(pScrn);
+ while(i--) pSiS->crt2cindices[i] = i;
+ } else {
+- xfree(pSiS->crt2gcolortable);
++ free(pSiS->crt2gcolortable);
+ pSiS->crt2gcolortable = NULL;
+ pSiS->CRT2SepGamma = FALSE;
+ }
+@@ -10810,7 +10810,7 @@
+ if(pSiS->useEXA) {
+ if(pSiS->EXADriverPtr) {
+ exaDriverFini(pScreen);
+- xfree(pSiS->EXADriverPtr);
++ free(pSiS->EXADriverPtr);
+ pSiS->EXADriverPtr = NULL;
+ pSiS->exa_scratch = NULL;
+ }
+@@ -10823,38 +10823,38 @@
+ }
+
+ if(pSiS->CursorScratch) {
+- xfree(pSiS->CursorScratch);
++ free(pSiS->CursorScratch);
+ pSiS->CursorScratch = NULL;
+ }
+
+ if(pSiS->ShadowPtr) {
+- xfree(pSiS->ShadowPtr);
++ free(pSiS->ShadowPtr);
+ pSiS->ShadowPtr = NULL;
+ }
+
+ if(pSiS->DGAModes) {
+- xfree(pSiS->DGAModes);
++ free(pSiS->DGAModes);
+ pSiS->DGAModes = NULL;
+ }
+
+ if(pSiS->adaptor) {
+- xfree(pSiS->adaptor);
++ free(pSiS->adaptor);
+ pSiS->adaptor = NULL;
+ pSiS->ResetXv = pSiS->ResetXvGamma = pSiS->ResetXvDisplay = NULL;
+ }
+
+ if(pSiS->blitadaptor) {
+- xfree(pSiS->blitadaptor);
++ free(pSiS->blitadaptor);
+ pSiS->blitadaptor = NULL;
+ }
+
+ if(pSiS->crt2gcolortable) {
+- xfree(pSiS->crt2gcolortable);
++ free(pSiS->crt2gcolortable);
+ pSiS->crt2gcolortable = NULL;
+ }
+
+ if(pSiS->crt2cindices) {
+- xfree(pSiS->crt2cindices);
++ free(pSiS->crt2cindices);
+ pSiS->crt2cindices = NULL;
+ }
+
+diff -u xf86-video-sismedia-0.9.1/src/sis_hwmc.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_hwmc.c
+--- xf86-video-sismedia-0.9.1/src/sis_hwmc.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_hwmc.c 2011-03-06 12:24:06.612293658 +0700
+@@ -274,7 +274,7 @@
+ * Set *num_priv to the number of 32bit words that make up the size of
+ * of the data that priv will point to.
+ *
+- * *priv = (long *) xcalloc (elements, sizeof(element))
++ * *priv = (long *) calloc (elements, sizeof(element))
+ * *num_priv = (elements * sizeof(element)) >> 2;
+ *
+ **************************************************************************/
+@@ -310,7 +310,7 @@
+ return BadAlloc;
+ }
+
+- *priv = xcalloc(1,sizeof(SiSXvMCCreateContextRec));
++ *priv = calloc(1,sizeof(SiSXvMCCreateContextRec));
+ contextRec = (SiSXvMCCreateContextRec *)*priv;
+
+ if(!*priv) {
+@@ -322,7 +322,7 @@
+ if(drmCreateContext(pSiS->drmSubFD, &(contextRec->drmcontext) ) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "[MC] SiSXvMCCreateContext: Unable to create DRMContext!\n");
+- xfree(*priv);
++ free(*priv);
+ return BadAlloc;
+ }
+
+@@ -336,7 +336,7 @@
+ DRM_FRAME_BUFFER, 0, &pSiS->fb_handle) < 0){
+
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"[MC] Frame buffer AddMap failed!\n");
+- xfree(*priv);
++ free(*priv);
+ *num_priv = 0;
+ return BadAlloc;
+ }
+@@ -357,7 +357,7 @@
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR," [MC] XvMC is not supposted on this chip! Stop.\n");
+- xfree(*priv);
++ free(*priv);
+ *num_priv = 0;
+ return BadValue;
+ }
+@@ -408,7 +408,7 @@
+ #endif
+
+
+- *priv = xcalloc(1,sizeof(SiSXvMCCreateSurfaceRec));
++ *priv = calloc(1,sizeof(SiSXvMCCreateSurfaceRec));
+
+
+ if(!*priv) {
+@@ -435,7 +435,7 @@
+ }
+
+
+- xfree(*priv);
++ free(*priv);
+ return BadAlloc;
+
+ }
+@@ -454,7 +454,7 @@
+ __FUNCTION__, __FILE__);
+ #endif
+
+- *priv = (long *)xcalloc(1,sizeof(long));
++ *priv = (long *)calloc(1,sizeof(long));
+
+ if(!*priv) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+diff -u xf86-video-sismedia-0.9.1/src/sis_memcpy.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_memcpy.c
+--- xf86-video-sismedia-0.9.1/src/sis_memcpy.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_memcpy.c 2011-03-06 11:34:50.694322870 +0700
+@@ -637,13 +637,13 @@
+ (*buf1) = (UChar *)pSiS->FbBase + offset;
+ (*buf1) = (UChar *)(((ULong)(*buf1) + 31) & ~31);
+
+- if(!((*buf2) = (UChar *)xalloc(BUFFERSIZE + 15))) {
++ if(!((*buf2) = (UChar *)malloc(BUFFERSIZE + 15))) {
+ SISFreeFBMemory(pScrn, &handle);
+ return NULL;
+ }
+
+- if(!((*buf3) = (UChar *)xalloc(BUFFERSIZE + 15))) {
+- xfree((*buf2));
++ if(!((*buf3) = (UChar *)malloc(BUFFERSIZE + 15))) {
++ free((*buf2));
+ SISFreeFBMemory(pScrn, &handle);
+ return NULL;
+ }
+@@ -1101,8 +1101,8 @@
+
+ /* Free buffers */
+ SISFreeFBMemory(pScrn, &fbhandle);
+- xfree(buf2);
+- xfree(buf3);
++ free(buf2);
++ free(buf3);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Using %s method for aligned data transfers %s video RAM\n",
+diff -u xf86-video-sismedia-0.9.1/src/sis_mergedfb.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_mergedfb.c
+--- xf86-video-sismedia-0.9.1/src/sis_mergedfb.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_mergedfb.c 2011-03-06 22:18:01.785310903 +0700
+@@ -170,13 +170,13 @@
+ char namebuffer[32], namebuf1[64], namebuf2[64];
+ char printbuffer[256];
+
+- if(!((mode = xalloc(sizeof(DisplayModeRec)))))
++ if(!((mode = malloc(sizeof(DisplayModeRec)))))
+ return dest;
+
+ memcpy(mode, i, sizeof(DisplayModeRec));
+
+- if(!((mode->Private = xalloc(sizeof(SiSMergedDisplayModeRec))))) {
+- xfree(mode);
++ if(!((mode->Private = malloc(sizeof(SiSMergedDisplayModeRec))))) {
++ free(mode);
+ return dest;
+ }
+
+@@ -265,8 +265,8 @@
+ "Skipped \"%s\" (%dx%d), not enough video RAM or beyond hardware specs\n",
+ mode->name, mode->HDisplay, mode->VDisplay);
+ }
+- xfree(mode->Private);
+- xfree(mode);
++ free(mode->Private);
++ free(mode);
+
+ return dest;
+ }
+@@ -306,7 +306,7 @@
+
+ /* Generate a mode name */
+ sprintf(namebuffer, "%dx%d", mode->HDisplay, mode->VDisplay);
+- if((mode->name = xalloc(strlen(namebuffer) + 1))) {
++ if((mode->name = malloc(strlen(namebuffer) + 1))) {
+ strcpy(mode->name, namebuffer);
+ }
+
+@@ -849,7 +849,7 @@
+
+ if(pSiS->MergedFB) {
+
+- pSiS->CRT2pScrn->monitor = xalloc(sizeof(MonRec));
++ pSiS->CRT2pScrn->monitor = malloc(sizeof(MonRec));
+
+ if(pSiS->CRT2pScrn->monitor) {
+
+@@ -889,7 +889,7 @@
+ } else {
+
+ SISErrorLog(pScrn, "Failed to allocate memory for CRT2 monitor, MergedFB mode disabled.\n");
+- if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
++ if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ pSiS->MergedFB = FALSE;
+
+@@ -911,9 +911,9 @@
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ }
+ pSiS->CRT2pScrn->monitor->DDC = NULL;
+- xfree(pSiS->CRT2pScrn->monitor);
++ free(pSiS->CRT2pScrn->monitor);
+ }
+- xfree(pSiS->CRT2pScrn);
++ free(pSiS->CRT2pScrn);
+ pSiS->CRT2pScrn = NULL;
+ }
+ }
+@@ -1917,7 +1917,7 @@
+ ClientPtr client;
+ xXineramaLayoutChangeNotifyEvent se;
+
+- pHead = (SiSXineramaEventPtr *)LookupIDByType(pWin->drawable.id, EventType);
++ dixLookupResourceByType((pointer) &pHead, pWin->drawable.id, EventType, NullClient, DixUnknownAccess);
+ if(!pHead) {
+ return WT_WALKCHILDREN;
+ }
+@@ -2628,6 +2628,7 @@
+ WindowPtr pWin;
+ SiSXineramaEventPtr pXineramaEvent, pNewXineramaEvent, *pHead;
+ XID clientResource;
++ int lookup_ret;
+
+ REQUEST_SIZE_MATCH(xXineramaSelectInputReq);
+ /*IvansLee define NEW_XORG_VERSION.*/
+@@ -2640,9 +2641,10 @@
+ if(!pWin)
+ return BadWindow;
+ #if NEW_XORG_VERSION == 1 /*New Xorg Version >= 1.4 */
+- pHead = (SiSXineramaEventPtr *)SecurityLookupIDByType(client,
+- pWin->drawable.id, EventType,
+- DixWriteAccess);
++ lookup_ret = dixLookupResourceByType((pointer) &pHead,
++ pWin->drawable.id, EventType,
++ client, DixWriteAccess);
++ pHead = (lookup_ret == Success ? pHead : NULL);
+ #else
+ pHead = (SiSXineramaEventPtr *)SecurityLookupIDByType(client,
+ pWin->drawable.id, EventType,
+@@ -2661,7 +2663,7 @@
+ }
+
+ /* Build a new entry */
+- if(!(pNewXineramaEvent = (SiSXineramaEventPtr)xalloc(sizeof(SiSXineramaEventRec)))) {
++ if(!(pNewXineramaEvent = (SiSXineramaEventPtr)malloc(sizeof(SiSXineramaEventRec)))) {
+ return BadAlloc;
+ }
+ pNewXineramaEvent->next = 0;
+@@ -2686,7 +2688,7 @@
+ * done through the resource database.
+ */
+ if(!pHead) {
+- pHead = (SiSXineramaEventPtr *)xalloc(sizeof(SiSXineramaEventPtr));
++ pHead = (SiSXineramaEventPtr *)malloc(sizeof(SiSXineramaEventPtr));
+ if(!pHead || !AddResource(pWin->drawable.id, EventType, (pointer)pHead)) {
+ FreeResource(clientResource, RT_NONE);
+ return BadAlloc;
+@@ -2715,7 +2717,7 @@
+ } else {
+ *pHead = pXineramaEvent->next;
+ }
+- xfree(pXineramaEvent);
++ free(pXineramaEvent);
+ SiSXineramaClientsListening--;
+ }
+ }
+@@ -2854,7 +2856,7 @@
+ {
+ /* Called by CloseDownExtensions() */
+ if(SiSXineramadataPtr) {
+- Xfree(SiSXineramadataPtr);
++ free(SiSXineramadataPtr);
+ SiSXineramadataPtr = NULL;
+ }
+ }
+@@ -2866,7 +2868,7 @@
+ SiSXineramaEventPtr *pHead, pCur, pPrev;
+ WindowPtr pWin = pXineramaEvent->window;
+
+- pHead = (SiSXineramaEventPtr *)LookupIDByType(pWin->drawable.id, EventType);
++ dixLookupResourceByType((pointer) &pHead, pWin->drawable.id, EventType, NullClient, DixUnknownAccess);
+ if(pHead) {
+ pPrev = NULL;
+ for(pCur = *pHead; pCur && pCur != pXineramaEvent; pCur = pCur->next) {
+@@ -2877,7 +2879,7 @@
+ else *pHead = pXineramaEvent->next;
+ }
+ }
+- xfree((pointer)pXineramaEvent);
++ free((pointer)pXineramaEvent);
+ return 1;
+ }
+
+@@ -2890,9 +2892,9 @@
+ for(pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, ClientType);
+- xfree((pointer)pCur);
++ free((pointer)pCur);
+ }
+- xfree((pointer)pHead);
++ free((pointer)pHead);
+ return 1;
+ }
+
+@@ -2965,7 +2967,7 @@
+ if(!pSiS->XineramaExtEntry) break;
+
+ if(!(SiSXineramadataPtr = (SiSXineramaData *)
+- xcalloc(SiSXineramaNumScreens, sizeof(SiSXineramaData)))) break;
++ calloc(SiSXineramaNumScreens, sizeof(SiSXineramaData)))) break;
+
+ SiSXineramaEventbase = pSiS->XineramaExtEntry->eventBase;
+ EventSwapVector[SiSXineramaEventbase + XineramaLayoutChangeNotify] =
+diff -u xf86-video-sismedia-0.9.1/src/sis_opt.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_opt.c
+--- xf86-video-sismedia-0.9.1/src/sis_opt.c 2011-03-06 11:27:56.388770300 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_opt.c 2011-03-06 11:34:50.818340404 +0700
+@@ -459,7 +459,7 @@
+ xf86CollectOptions(pScrn, NULL);
+
+ /* Process the options */
+- if(!(pSiS->Options = xalloc(sizeof(SISOptions)))) return;
++ if(!(pSiS->Options = malloc(sizeof(SISOptions)))) return;
+
+ memcpy(pSiS->Options, SISOptions, sizeof(SISOptions));
+
+@@ -920,7 +920,7 @@
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS))) {
+ int result;
+ Bool valid = FALSE;
+- char *tempstr = xalloc(strlen(strptr) + 1);
++ char *tempstr = malloc(strlen(strptr) + 1);
+ result = sscanf(strptr, "%s %d", tempstr, &ival);
+ if(result >= 1) {
+ if(!xf86NameCmp(tempstr,"LeftOf")) {
+@@ -978,18 +978,18 @@
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Except for \"Clone\", the parameter may be followed by an integer.\n");
+ }
+- xfree(tempstr);
++ free(tempstr);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_METAMODES))) {
+- pSiS->MetaModes = xalloc(strlen(strptr) + 1);
++ pSiS->MetaModes = malloc(strlen(strptr) + 1);
+ if(pSiS->MetaModes) memcpy(pSiS->MetaModes, strptr, strlen(strptr) + 1);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC))) {
+- pSiS->CRT2HSync = xalloc(strlen(strptr) + 1);
++ pSiS->CRT2HSync = malloc(strlen(strptr) + 1);
+ if(pSiS->CRT2HSync) memcpy(pSiS->CRT2HSync, strptr, strlen(strptr) + 1);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH))) {
+- pSiS->CRT2VRefresh = xalloc(strlen(strptr) + 1);
++ pSiS->CRT2VRefresh = malloc(strlen(strptr) + 1);
+ if(pSiS->CRT2VRefresh) memcpy(pSiS->CRT2VRefresh, strptr, strlen(strptr) + 1);
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDDPI))) {
+@@ -1009,8 +1009,8 @@
+ }
+ if(pSiS->UseSiSXinerama) {
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SCR0))) {
+- char *tempstr1 = xalloc(strlen(strptr) + 1);
+- char *tempstr2 = xalloc(strlen(strptr) + 1);
++ char *tempstr1 = malloc(strlen(strptr) + 1);
++ char *tempstr2 = malloc(strlen(strptr) + 1);
+ char *tempstr;
+ int i, result;
+ pSiS->MFBScr0LR = pSiS->MFBScr0TB = -1;
+@@ -1037,8 +1037,8 @@
+ "Bad or incomplete argument(s) for Option \"%s\"\n",
+ pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_SCR0)].name);
+ }
+- xfree(tempstr1);
+- xfree(tempstr2);
++ free(tempstr1);
++ free(tempstr2);
+ } else if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Option \"%s\" is deprecated, use \"%s\"\n",
+diff -u xf86-video-sismedia-0.9.1/src/sis_utility.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_utility.c
+--- xf86-video-sismedia-0.9.1/src/sis_utility.c 2011-03-06 11:27:56.392770842 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_utility.c 2011-03-06 12:24:06.740312353 +0700
+@@ -2185,7 +2185,7 @@
+ * in SiSCtrlExtUnregister())
+ */
+ if(extEntry->extPrivate) {
+- xfree(extEntry->extPrivate);
++ free(extEntry->extPrivate);
+ extEntry->extPrivate = NULL;
+ }
+ }
+@@ -2206,7 +2206,7 @@
+
+ if(!(myext = CheckExtension(SISCTRL_PROTOCOL_NAME))) {
+
+- if(!(myctrl = xcalloc(sizeof(xSiSCtrlScreenTable), 1)))
++ if(!(myctrl = calloc(sizeof(xSiSCtrlScreenTable), 1)))
+ return;
+
+ if(!(myext = AddExtension(SISCTRL_PROTOCOL_NAME, 0, 0,
+@@ -2216,7 +2216,7 @@
+ StandardMinorOpcode))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to add SISCTRL extension\n");
+- xfree(myctrl);
++ free(myctrl);
+ return;
+ }
+
+diff -u xf86-video-sismedia-0.9.1/src/sis_vga.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_vga.c
+--- xf86-video-sismedia-0.9.1/src/sis_vga.c 2011-03-06 11:27:56.396771384 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_vga.c 2011-03-06 11:34:51.038371506 +0700
+@@ -1450,7 +1450,7 @@
+ attr10 = SiS_ReadAttr(pSiS, 0x10);
+ if(attr10 & 0x01) return;
+
+- if(!(pSiS->fonts = xalloc(SIS_FONTS_SIZE * 2))) {
++ if(!(pSiS->fonts = malloc(SIS_FONTS_SIZE * 2))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Could not save console fonts, mem allocation failed\n");
+ return;
+diff -u xf86-video-sismedia-0.9.1/src/sis_video.c xf86-video-sismedia-0.9.1-dep-clean/src/sis_video.c
+--- xf86-video-sismedia-0.9.1/src/sis_video.c 2011-03-06 11:27:56.396771384 +0700
++++ xf86-video-sismedia-0.9.1-dep-clean/src/sis_video.c 2011-03-06 12:24:06.824324624 +0700
+@@ -349,7 +349,7 @@
+ if(newAdaptor) size++;
+ if(newBlitAdaptor) size++;
+
+- newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*));
++ newAdaptors = malloc(size * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ if(num_adaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
+@@ -379,7 +379,7 @@
+ }
+
+ if(newAdaptors) {
+- xfree(newAdaptors);
++ free(newAdaptors);
+ }
+
+ #ifdef ENABLEXvMC
+@@ -1049,7 +1049,7 @@
+ }
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ sizeof(SISPortPrivRec) +
+ sizeof(DevUnion)))) {
+ return NULL;
+@@ -4543,7 +4543,7 @@
+ }
+ #endif
+
+- if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
++ if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
+ (sizeof(DevUnion) * NUM_BLIT_PORTS) +
+ sizeof(SISBPortPrivRec)))) {
+ return NULL;
+Common subdirectories: xf86-video-sismedia-0.9.1/src/xvmc and xf86-video-sismedia-0.9.1-dep-clean/src/xvmc
diff --git a/x11/driver/xorg-video-sisimedia/files/disable-UploadToScreen-DownloadFromScreen.patch b/x11/driver/xorg-video-sisimedia/files/disable-UploadToScreen-DownloadFromScreen.patch
new file mode 100644
index 0000000000..4cc75989fa
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/disable-UploadToScreen-DownloadFromScreen.patch
@@ -0,0 +1,64 @@
+diff -ruN xf86-video-sis-0.9.1.orig/src/sis300_accel.c xf86-video-sis-0.9.1/src/sis300_accel.c
+--- xf86-video-sis-0.9.1.orig/src/sis300_accel.c 2012-11-26 12:27:14.151119857 +0100
++++ xf86-video-sis-0.9.1/src/sis300_accel.c 2012-11-26 12:36:19.227926454 +0100
+@@ -1284,8 +1284,8 @@
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
+ }
+ #else /*xorg>7.0*/
+
+@@ -1332,8 +1332,8 @@
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
+
+ }
+ #endif
+diff -ruN xf86-video-sis-0.9.1.orig/src/sis310_accel.c xf86-video-sis-0.9.1/src/sis310_accel.c
+--- xf86-video-sis-0.9.1.orig/src/sis310_accel.c 2012-11-26 12:27:14.151119857 +0100
++++ xf86-video-sis-0.9.1/src/sis310_accel.c 2012-11-26 12:35:58.597921440 +0100
+@@ -1819,8 +1819,8 @@
+ #endif
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
+
+ #else /*Xorg>= 7.0*/
+
+@@ -1869,8 +1869,8 @@
+ #endif
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
+ #endif /*end of Xorg>=7.0*/
+
+ }
+diff -ruN xf86-video-sis-0.9.1.orig/src/sis_accel.c xf86-video-sis-0.9.1/src/sis_accel.c
+--- xf86-video-sis-0.9.1.orig/src/sis_accel.c 2012-11-26 12:27:14.154453191 +0100
++++ xf86-video-sis-0.9.1/src/sis_accel.c 2012-11-26 12:36:44.464598873 +0100
+@@ -862,8 +862,8 @@
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
++ //pSiS->EXADriverPtr->UploadToScreen = SiSUploadToScreen;
++ //pSiS->EXADriverPtr->DownloadFromScreen = SiSDownloadFromScreen;
+
+ #endif /*end of Xorg>=7.0 EXA Setting*/
+ }
diff --git a/x11/driver/xorg-video-sisimedia/files/pciTag-removal-workaround.patch b/x11/driver/xorg-video-sisimedia/files/pciTag-removal-workaround.patch
new file mode 100644
index 0000000000..b41f3c71ba
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/pciTag-removal-workaround.patch
@@ -0,0 +1,39 @@
+diff -aur xf86-video-sis-0.9.1.pristine/src/sispcirename.h xf86-video-sis-0.9.1.new/src/sispcirename.h
+--- xf86-video-sis-0.9.1.pristine/src/sispcirename.h 2012-03-17 04:45:58.280942665 +1100
++++ xf86-video-sis-0.9.1.new/src/sispcirename.h 2012-03-17 04:48:28.539933065 +1100
+@@ -29,11 +29,35 @@
+ #ifndef SISPCIRENAME_H
+ #define SISPCIRENAME_H
+
++#include
++
+ enum region_type {
+ REGION_MEM,
+ REGION_IO
+ };
+
++#if (defined(__alpha__) || defined(__ia64__)) && defined (linux)
++#define PCI_DOM_MASK 0x01fful
++#else
++#define PCI_DOM_MASK 0x0ffu
++#endif
++
++#ifndef PCI_DOM_MASK
++# define PCI_DOM_MASK 0x0ffu
++#endif
++#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
++
++static inline uint32_t
++pciTag(int busnum, int devnum, int funcnum)
++{
++ uint32_t tag;
++ tag = (busnum & (PCI_DOMBUS_MASK)) << 16;
++ tag |= (devnum & 0x00001fu) << 11;
++ tag |= (funcnum & 0x000007u) << 8;
++
++ return tag;
++}
++
+ #ifndef XSERVER_LIBPCIACCESS
+
+ /* pciVideoPtr */
diff --git a/x11/driver/xorg-video-sisimedia/files/remove_mibstore.h.patch b/x11/driver/xorg-video-sisimedia/files/remove_mibstore.h.patch
new file mode 100644
index 0000000000..ebfa74f5a2
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/remove_mibstore.h.patch
@@ -0,0 +1,18 @@
+--- xf86-video-sis-0.9.1/src/sis_driver.c 2013-03-10 13:02:25.000000000 +0100
++++ xf86-video-sis-0.9.1/src/sis_driver.c.new 2013-03-10 13:04:24.349309791 +0100
+@@ -86,7 +86,6 @@
+ #include "fb.h"
+ #include "micmap.h"
+ #include "mipointer.h"
+-#include "mibstore.h"
+ #include "edid.h"
+
+ #define SIS_NEED_inSISREG
+@@ -9637,7 +9636,6 @@
+ }
+ pSiS->SiSFastVidCopyDone = TRUE;
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
diff --git a/x11/driver/xorg-video-sisimedia/files/sisimedia-no-xaa.patch b/x11/driver/xorg-video-sisimedia/files/sisimedia-no-xaa.patch
new file mode 100644
index 0000000000..d97ca5a2b7
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/sisimedia-no-xaa.patch
@@ -0,0 +1,11 @@
+--- xf86-video-sis-0.9.1/src/Makefile.am.0202~ 2007-05-30 04:12:02.000000000 +0200
++++ xf86-video-sis-0.9.1/src/Makefile.am 2012-10-19 23:24:31.954954666 +0200
+@@ -23,7 +23,7 @@
+ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
+ # _ladir passes a dummy rpath to libtool so the thing will actually link
+ # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+-AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@
++AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -DSIS_USE_EXA
+ sis_drv_la_LTLIBRARIES = sis_drv.la
+ sis_drv_la_LDFLAGS = -module -avoid-version
+ sis_drv_ladir = @moduledir@/drivers
diff --git a/x11/driver/xorg-video-sisimedia/files/sisimedia-xorg-1.13.patch b/x11/driver/xorg-video-sisimedia/files/sisimedia-xorg-1.13.patch
new file mode 100644
index 0000000000..25cc94fb1d
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/sisimedia-xorg-1.13.patch
@@ -0,0 +1,654 @@
+diff -ur xf86-video-sis-0.9.1/src/sis_config.h xf86-video-sis-0.9.1-bero/src/sis_config.h
+--- xf86-video-sis-0.9.1/src/sis_config.h 2007-05-30 04:12:02.000000000 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_config.h 2012-10-19 23:27:16.178901583 +0200
+@@ -67,7 +67,7 @@
+ #endif
+
+ #if 1
+-#define SIS_USE_XAA /* Include support for XAA */
++#undef SIS_USE_XAA /* Don't include support for XAA, current xorg servers don't support it */
+ #endif
+
+ #ifdef SISVRAMQ
+diff -ur xf86-video-sis-0.9.1/src/sis_dga.c xf86-video-sis-0.9.1-bero/src/sis_dga.c
+--- xf86-video-sis-0.9.1/src/sis_dga.c 2012-10-20 00:10:10.325720321 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_dga.c 2012-10-19 23:34:00.514846689 +0200
+@@ -421,8 +421,8 @@
+ pScrn->currentMode = pSiS->CurrentLayout.mode;
+ pSiS->DGAactive = FALSE;
+
+- (*pScrn->SwitchMode)(index, pScrn->currentMode, 0);
+- (*pScrn->AdjustFrame)(index, pScrn->frameX0, pScrn->frameY0, 0);
++ (*pScrn->SwitchMode)(pScrn, pScrn->currentMode);
++ (*pScrn->AdjustFrame)(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ } else { /* set new mode */
+
+@@ -444,10 +444,10 @@
+ pSiS->CurrentLayout.displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3);
+ pSiS->CurrentLayout.displayHeight = pMode->imageHeight;
+
+- (*pScrn->SwitchMode)(index, pMode->mode, 0);
++ (*pScrn->SwitchMode)(pScrn, pMode->mode);
+ /* Adjust viewport to 0/0 after mode switch */
+ /* This fixes the vmware-in-dualhead problems */
+- (*pScrn->AdjustFrame)(index, 0, 0, 0);
++ (*pScrn->AdjustFrame)(pScrn, 0, 0);
+ pSiS->CurrentLayout.DGAViewportX = pSiS->CurrentLayout.DGAViewportY = 0;
+ }
+
+@@ -471,7 +471,7 @@
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+
+- (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags);
++ (*pScrn->AdjustFrame)(pScrn, x, y);
+ pSiS->DGAViewportStatus = 0; /* There are never pending Adjusts */
+ pSiS->CurrentLayout.DGAViewportX = x;
+ pSiS->CurrentLayout.DGAViewportY = y;
+diff -ur xf86-video-sis-0.9.1/src/sis_driver.c xf86-video-sis-0.9.1-bero/src/sis_driver.c
+--- xf86-video-sis-0.9.1/src/sis_driver.c 2012-10-20 00:10:10.379719645 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_driver.c 2012-10-20 00:06:35.196409807 +0200
+@@ -8546,9 +8546,9 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pSiSEnt->pScrn_2->scrnIndex,
++ SISAdjustFrame(pSiSEnt->pScrn_2,
+ pSiSEnt->pScrn_2->frameX0,
+- pSiSEnt->pScrn_2->frameY0, 0);
++ pSiSEnt->pScrn_2->frameY0);
+ }
+ } else {
+ /* Head 2 (slave) is always CRT1 */
+@@ -8565,9 +8565,9 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pSiSEnt->pScrn_1->scrnIndex,
++ SISAdjustFrame(pSiSEnt->pScrn_1,
+ pSiSEnt->pScrn_1->frameX0,
+- pSiSEnt->pScrn_1->frameY0, 0);
++ pSiSEnt->pScrn_1->frameY0);
+ }
+ }
+
+@@ -8613,7 +8613,7 @@
+
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+
+- (*pScrn->AdjustFrame)(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ (*pScrn->AdjustFrame)(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ } else {
+ #endif
+@@ -8723,14 +8723,13 @@
+ /*******************************************************/
+
+ static void
+-SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
++SISBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask)
+ {
+- ScreenPtr pScreen = screenInfo.screens[i];
+- ScrnInfoPtr pScrn = xf86Screens[i];
++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ SISPtr pSiS = SISPTR(pScrn);
+
+ pScreen->BlockHandler = pSiS->BlockHandler;
+- (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
++ (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
+ pScreen->BlockHandler = SISBlockHandler;
+
+ #ifdef SISDUALHEAD
+@@ -8747,7 +8746,7 @@
+ #endif
+
+ if(pSiS->AdjustFramePending && pSiS->AdjustFrame) {
+- (*pSiS->AdjustFrame)(i, pSiS->AdjustFrameX, pSiS->AdjustFrameY, pSiS->AdjustFrameFlags);
++ (*pSiS->AdjustFrame)(pScrn, pSiS->AdjustFrameX, pSiS->AdjustFrameY);
+ /* Reset it since Xv insists on installing its own every time. */
+ pScrn->AdjustFrame = SISNewAdjustFrame;
+ pSiS->AdjustFramePending = FALSE;
+@@ -9230,7 +9229,7 @@
+ * depth, bitsPerPixel)
+ */
+ static Bool
+-SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
++SISScreenInit(ScreenPtr pScreen, int argc, char **argv)
+ {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SISPtr pSiS = SISPTR(pScrn);
+@@ -9409,7 +9408,7 @@
+ pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
+ }
+ }
+- SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ /* Reset visual list. */
+ miClearVisualTypes();
+@@ -9841,7 +9840,7 @@
+ pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA;
+ if(pSiS->HaveNonRect) {
+ /* Reset the viewport (now eventually non-recangular) */
+- SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+ }
+ }
+ } else {
+@@ -10177,9 +10176,8 @@
+ }
+
+ static ModeStatus
+-SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
++SISValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(pSiS->UseVESA) {
+@@ -10335,9 +10333,8 @@
+ #endif
+
+ Bool
+-SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
++SISSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ /* This is part 2 of the ugly hack in sis_shadow.c:
+ * There we set pScrn->currentMode to something
+@@ -10353,7 +10350,7 @@
+ */
+
+ if(!pSiS->skipswitchcheck) {
+- if(SISValidMode(scrnIndex, mode, TRUE, flags) != MODE_OK) {
++ if(SISValidMode(pScrn, mode, TRUE, 0) != MODE_OK) {
+ return FALSE;
+ }
+ }
+@@ -10368,7 +10365,7 @@
+
+ (*pSiS->SyncAccel)(pScrn);
+
+- if(!(SISModeInit(xf86Screens[scrnIndex], mode)))
++ if(!(SISModeInit(pScrn, mode)))
+ return FALSE;
+
+ /* Since RandR (indirectly) uses SwitchMode(), we need to
+@@ -10485,21 +10482,18 @@
+ }
+
+ static void
+-SISNewAdjustFrame(int scrnIndex, int x, int y, int flags)
++SISNewAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ pSiS->AdjustFramePending = TRUE;
+ pSiS->AdjustFrameX = x;
+ pSiS->AdjustFrameY = y;
+- pSiS->AdjustFrameFlags = flags;
+ }
+
+ void
+-SISAdjustFrame(int scrnIndex, int x, int y, int flags)
++SISAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ UChar temp, cr11backup;
+ ULong base;
+@@ -10511,7 +10505,7 @@
+
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+- SISMFBAdjustFrame(scrnIndex, x, y, flags);
++ SISMFBAdjustFrame(pScrn, x, y);
+ return;
+ }
+ #endif
+@@ -10578,9 +10572,8 @@
+
+
+ static Bool
+-SISEnterVT(int scrnIndex, int flags)
++SISEnterVT(ScrnInfoPtr pScrn)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ SiS_SiSFB_Lock(pScrn, TRUE);
+
+@@ -10596,7 +10589,7 @@
+ /* No need to go through pScrn->AdjustFrame; Xv's
+ * EnterVT handles the overlay(s) anyway.
+ */
+- SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+
+ /* Mark for 3D full-screen bug */
+@@ -10625,15 +10618,14 @@
+
+
+ static void
+-SISLeaveVT(int scrnIndex, int flags)
++SISLeaveVT(ScrnInfoPtr pScrn)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ #ifdef SISDRI
+ ScreenPtr pScreen;
+
+ if(pSiS->directRenderingEnabled) {
+- pScreen = screenInfo.screens[scrnIndex];
++ pScreen = xf86ScreenToScrn(pScrn);
+ /* Mark for 3D full-screen bug */
+ /* DRILock(pScreen, 0); */
+ }
+@@ -10702,9 +10694,9 @@
+
+
+ static Bool
+-SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
++SISCloseScreen(ScreenPtr pScreen)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ SISPtr pSiS = SISPTR(pScrn);
+ #ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+@@ -10872,7 +10864,7 @@
+
+ pScreen->CloseScreen = pSiS->CloseScreen;
+
+- return(*pScreen->CloseScreen)(scrnIndex, pScreen);
++ return(*pScreen->CloseScreen)(pScreen);
+ }
+
+
+@@ -10883,10 +10875,9 @@
+ /* Free up any per-generation data structures */
+
+ static void
+-SISFreeScreen(int scrnIndex, int flags)
++SISFreeScreen(ScrnInfoPtr pScrn)
+ {
+ #ifdef SIS_NEED_MAP_IOP
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(pSiS) {
+@@ -10900,7 +10891,7 @@
+ }
+ #endif
+
+- SISFreeRec(xf86Screens[scrnIndex]);
++ SISFreeRec(pScrn);
+ }
+
+
+@@ -11134,7 +11125,7 @@
+ pSiS->VBFlags3 = pSiS->VBFlags_backup3 = newvbflags3;
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex,pScrn->currentMode,0)))
++ if(!((*pScrn->SwitchMode)(pScrn,pScrn->currentMode)))
+ {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+@@ -11143,7 +11134,7 @@
+
+ /*xf86DrvMsg(0,X_INFO,"frameX0=%d, frameY0=%d.\n",pScrn->frameX0,pScrn->frameY0);*/
+
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0,0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+
+@@ -11204,14 +11195,14 @@
+ (*pSiS->SyncAccel)(pScrn);
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex,pScrn->currentMode,0)))
++ if(!((*pScrn->SwitchMode)(pScrn,pScrn->currentMode)))
+ {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+ pSiS->skipswitchcheck = FALSE;
+
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0,0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+ }
+@@ -11259,7 +11250,7 @@
+
+ xf86ZoomViewport(pScreen,1);
+
+- SISAdjustFrame(pScrn->scrnIndex,0,0,0);
++ SISAdjustFrame(pScrn,0,0);
+
+
+ return TRUE;
+@@ -11268,9 +11259,8 @@
+
+ /**************************************************************************/
+ static Bool
+-SISPMEvent(int scrnIndex, pmEvent event, Bool undo)
++SISPMEvent(ScrnInfoPtr pScrn, pmEvent event, Bool undo)
+ {
+- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+ unsigned char hotkeyflag = 0;/*check BIOS flag.*/
+ unsigned char checkflag = 0;/*just for test using.*/
+@@ -11287,13 +11277,13 @@
+ {
+ xf86DrvMsg(0,X_INFO,"PM_EVENT:event=%d,undo=%d.\n",event,undo);
+ if (!undo && !pSiS->suspended) {
+- pScrn->LeaveVT(scrnIndex, 0);
++ pScrn->LeaveVT(pScrn);
+ pSiS->suspended = TRUE;
+ sleep(0);
+ }
+ else if (undo && pSiS->suspended) {
+ sleep(0);
+- pScrn->EnterVT(scrnIndex, 0);
++ pScrn->EnterVT(pScrn);
+ pSiS->suspended = FALSE;
+ }
+ }
+@@ -11305,7 +11295,7 @@
+ {
+ if (pSiS->suspended) {
+ sleep(0);
+- pScrn->EnterVT(scrnIndex, 0);
++ pScrn->EnterVT(pScrn);
+ pSiS->suspended = FALSE;
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ }
+diff -ur xf86-video-sis-0.9.1/src/sis_driver.h xf86-video-sis-0.9.1-bero/src/sis_driver.h
+--- xf86-video-sis-0.9.1/src/sis_driver.h 2012-10-20 00:10:10.296720683 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_driver.h 2012-10-20 00:04:47.586755113 +0200
+@@ -770,14 +770,14 @@
+ static void SISIdentify(int flags);
+ static Bool SISProbe(DriverPtr drv, int flags);
+ static Bool SISPreInit(ScrnInfoPtr pScrn, int flags);
+-static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
+-static Bool SISEnterVT(int scrnIndex, int flags);
+-static void SISLeaveVT(int scrnIndex, int flags);
+-static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen);
++static Bool SISScreenInit(ScreenPtr pScreen, int argc, char **argv);
++static Bool SISEnterVT(ScrnInfoPtr pScrn);
++static void SISLeaveVT(ScrnInfoPtr pScrn);
++static Bool SISCloseScreen(ScreenPtr pScreen);
+ static Bool SISSaveScreen(ScreenPtr pScreen, int mode);
+-static Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+-static void SISNewAdjustFrame(int scrnIndex, int x, int y, int flags);
+-static Bool SISPMEvent(int scrnIndex, pmEvent event, Bool undo);/*APM-ACPI, adding by Ivans.*/
++static Bool SISSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
++static void SISNewAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
++static Bool SISPMEvent(ScrnInfoPtr pScrn, pmEvent event, Bool undo);/*APM-ACPI, adding by Ivans.*/
+
+ #if XSERVER_LIBPCIACCESS
+ static Bool SIS_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data);
+@@ -791,8 +791,8 @@
+ #ifdef SISDUALHEAD
+ static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode);
+ #endif
+-static void SISFreeScreen(int scrnIndex, int flags);
+-static ModeStatus SISValidMode(int scrnIndex, DisplayModePtr mode,
++static void SISFreeScreen(ScrnInfoPtr pScrn);
++static ModeStatus SISValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ Bool verbose, int flags);
+ #ifdef SIS_HAVE_RR_FUNC
+ #ifdef SIS_HAVE_DRIVER_FUNC
+@@ -811,7 +811,7 @@
+ static Bool SISMapIOPMem(ScrnInfoPtr pScrn);
+ static Bool SISUnmapIOPMem(ScrnInfoPtr pScrn);
+ #endif
+-void SISAdjustFrame(int scrnIndex, int x, int y, int flags);
++void SISAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+ UChar SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode);
+ UShort SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ unsigned int VBFlags, unsigned int VBFlags3, Bool hcm);
+@@ -858,7 +858,7 @@
+ extern Bool SiSVGASaveScreen(ScreenPtr pScreen, int mode);
+
+ /* shadow, randr, randr-rotation */
+-extern void SISPointerMoved(int index, int x, int y);
++extern void SISPointerMoved(ScrnInfoPtr pScrn, int x, int y);
+ extern void SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+ extern void SISRefreshAreaReflect(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+ extern void SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+@@ -922,8 +922,8 @@
+ extern Bool SiSMFBRebuildModelist(ScrnInfoPtr pScrn, ClockRangePtr clockRanges);
+ extern Bool SiSMFBRevalidateModelist(ScrnInfoPtr pScrn, ClockRangePtr clockRanges);
+ extern void SiSMFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, SiSScrn2Rel srel);
+-extern void SISMFBPointerMoved(int scrnIndex, int x, int y);
+-extern void SISMFBAdjustFrame(int scrnIndex, int x, int y, int flags);
++extern void SISMFBPointerMoved(ScrnInfoPtr pScrn, int x, int y);
++extern void SISMFBAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+ #ifdef SISXINERAMA
+ extern void SiSXineramaExtensionInit(ScrnInfoPtr pScrn);
+ extern Bool SiSnoPanoramiXExtension;
+diff -ur xf86-video-sis-0.9.1/src/sis.h xf86-video-sis-0.9.1-bero/src/sis.h
+--- xf86-video-sis-0.9.1/src/sis.h 2012-10-20 00:10:10.361719870 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis.h 2012-10-19 23:56:46.635767827 +0200
+@@ -73,6 +73,7 @@
+ #include "xf86Cursor.h"
+ #include "xf86cmap.h"
+ #include "vbe.h"
++#include "xf86fbman.h"
+
+ /*I.L. modified*/
+ #include "sispcirename.h"
+@@ -241,7 +242,7 @@
+ #define SIS_MAX_SUBPICTURES 2
+
+ #if !defined(SIS_USE_XAA) && !defined(SIS_USE_EXA)
+-#define SIS_USE_XAA
++#define SIS_USE_EXA
+ #endif
+
+ #ifdef SIS_USE_XAA
+@@ -1319,8 +1320,8 @@
+ #ifdef SIS_USE_XAA
+ void (*RenderCallback)(ScrnInfoPtr);
+ Time RenderTime;
+- FBLinearPtr AccelLinearScratch;
+ #endif
++ FBLinearPtr AccelLinearScratch;
+ #ifdef SIS_USE_EXA
+ void (*ExaRenderCallback)(ScrnInfoPtr);
+ Time ExaRenderTime;
+@@ -1342,7 +1343,7 @@
+ int SiSDPIVX, SiSDPIVY;
+ int virtualX, virtualY;
+ int Rotate, Reflect;
+- void (*PointerMoved)(int index, int x, int y);
++ void (*PointerMoved)(ScrnInfoPtr pScrn, int x, int y);
+
+ /* ShadowFB support */
+ Bool ShadowFB;
+@@ -1420,7 +1421,6 @@
+ Bool AdjustFramePending;
+ int AdjustFrameX;
+ int AdjustFrameY;
+- int AdjustFrameFlags;
+
+ /* DGA */
+ DGAModePtr DGAModes;
+diff -ur xf86-video-sis-0.9.1/src/sis_hwmc.c xf86-video-sis-0.9.1-bero/src/sis_hwmc.c
+--- xf86-video-sis-0.9.1/src/sis_hwmc.c 2012-10-20 00:10:10.348720033 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_hwmc.c 2012-10-19 23:38:25.482534137 +0200
+@@ -58,8 +58,10 @@
+ #include "xf86xvmc.h"
+ #include
+ #include
++#ifdef SIS_USE_XAA
+ #include "xaa.h"
+ #include "xaalocal.h"
++#endif
+ #include "dixstruct.h"
+ #include "fourcc.h"
+ #include "sis_common.h"
+diff -ur xf86-video-sis-0.9.1/src/sis_mergedfb.c xf86-video-sis-0.9.1-bero/src/sis_mergedfb.c
+--- xf86-video-sis-0.9.1/src/sis_mergedfb.c 2012-10-20 00:10:10.351719996 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_mergedfb.c 2012-10-20 00:07:08.475993754 +0200
+@@ -1706,7 +1706,7 @@
+ /* Need to go the official way to avoid hw access and
+ * to update Xv's overlays
+ */
+- (pScrn1->AdjustFrame)(scrnIndex, pScrn1->frameX0, pScrn1->frameY0, 0);
++ (pScrn1->AdjustFrame)(pScrn1, pScrn1->frameX0, pScrn1->frameY0);
+ }
+ }
+
+diff -ur xf86-video-sis-0.9.1/src/sis_shadow.c xf86-video-sis-0.9.1-bero/src/sis_shadow.c
+--- xf86-video-sis-0.9.1/src/sis_shadow.c 2007-05-30 04:12:02.000000000 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_shadow.c 2012-10-20 00:08:12.018199367 +0200
+@@ -81,11 +81,11 @@
+ }
+
+ if(framechanged && pScrn->AdjustFrame)
+- pScrn->AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ pScrn->AdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ } else {
+
+- (*pSiS->PointerMoved)(index, x, y);
++ (*pSiS->PointerMoved)(pScrn, x, y);
+
+ }
+ }
+diff -ur xf86-video-sis-0.9.1/src/sis_utility.c xf86-video-sis-0.9.1-bero/src/sis_utility.c
+--- xf86-video-sis-0.9.1/src/sis_utility.c 2012-10-20 00:10:10.352719983 +0200
++++ xf86-video-sis-0.9.1-bero/src/sis_utility.c 2012-10-20 00:09:45.884025883 +0200
+@@ -273,7 +273,7 @@
+ unsigned int VBFlags, unsigned int VBFlags3, Bool hcm);
+ extern UShort SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ unsigned int VBFlags, unsigned int VBFlags3, Bool hcm);
+-extern void SISAdjustFrame(int scrnIndex, int x, int y, int flags);
++extern void SISAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+ extern float SiSCalcVRate(DisplayModePtr mode);
+ extern void SiS_UpdateGammaCRT2(ScrnInfoPtr pScrn);
+ #ifdef SISGAMMARAMP
+@@ -427,7 +427,7 @@
+ (*pSiS->SyncAccel)(pScrn);
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex, pScrn->currentMode, 0))) {
++ if(!((*pScrn->SwitchMode)(pScrn, pScrn->currentMode))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+@@ -436,7 +436,7 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+ }
+@@ -480,7 +480,7 @@
+ /* Sync the accelerators */
+ (*pSiS->SyncAccel)(pScrn);
+ pSiS->skipswitchcheck = TRUE;
+- if(!((*pScrn->SwitchMode)(pScrn->scrnIndex, pScrn->currentMode, 0))) {
++ if(!((*pScrn->SwitchMode)(pScrn, pScrn->currentMode))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+@@ -489,7 +489,7 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+ }
+
+ return TRUE;
+@@ -624,7 +624,7 @@
+ pSiS->VBFlags3 = pSiS->VBFlags_backup3 = newvbflags3;
+
+ pSiS->skipswitchcheck = TRUE;
+- if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) {
++ if(!(pScrn->SwitchMode(pScrn, pScrn->currentMode))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+@@ -633,7 +633,7 @@
+ /* No need to go through pScrn->AdjustFrame; the coords
+ * didn't change
+ */
+- SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
++ SISAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
+
+ return TRUE;
+ }
+--- xf86-video-sis-0.9.1/src/sis6326_video.c.bero 2012-10-20 00:13:59.712852587 +0200
++++ xf86-video-sis-0.9.1/src/sis6326_video.c 2012-10-20 00:15:51.035460862 +0200
+@@ -72,7 +72,7 @@ static void SIS6326QueryBestSize(ScrnIn
+ short, unsigned int *,unsigned int *, pointer);
+ static int SIS6326PutImage( ScrnInfoPtr,
+ short, short, short, short, short, short, short, short,
+- int, unsigned char*, short, short, Bool, RegionPtr, pointer);
++ int, unsigned char*, short, short, Bool, RegionPtr, pointer, DrawablePtr);
+ static int SIS6326QueryImageAttributes(ScrnInfoPtr,
+ int, unsigned short *, unsigned short *, int *, int *);
+ static void SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now);
+@@ -1231,7 +1231,7 @@ SIS6326PutImage(
+ int id, unsigned char* buf,
+ short width, short height,
+ Bool sync,
+- RegionPtr clipBoxes, pointer data
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+--- xf86-video-sis-0.9.1/src/sis_video.c.bero 2012-10-20 00:16:13.212183614 +0200
++++ xf86-video-sis-0.9.1/src/sis_video.c 2012-10-20 00:20:38.099872064 +0200
+@@ -3948,7 +3948,7 @@ SISPutImage(
+ int id, UChar *buf,
+ short width, short height,
+ Bool sync,
+- RegionPtr clipBoxes, pointer data
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+@@ -4089,8 +4089,11 @@ SISPutImage(
+ static int
+ SISReputImage(
+ ScrnInfoPtr pScrn,
++ short src_x, short src_y,
+ short drw_x, short drw_y,
+- RegionPtr clipBoxes, pointer data
++ short src_w, short src_h,
++ short drw_w, short drw_h,
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw
+ ){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+--- xf86-video-sis-0.9.1/src/sis_video.h.bero 2012-10-20 00:16:58.076622733 +0200
++++ xf86-video-sis-0.9.1/src/sis_video.h 2012-10-20 00:20:18.443117807 +0200
+@@ -107,10 +107,13 @@ static void SISQueryBestSize(ScrnInfoPt
+ short, unsigned int *,unsigned int *, pointer);
+ static int SISPutImage(ScrnInfoPtr,
+ short, short, short, short, short, short, short, short,
+- int, UChar *, short, short, Bool, RegionPtr, pointer);
++ int, UChar *, short, short, Bool, RegionPtr, pointer, DrawablePtr);
+ static int SISReputImage(ScrnInfoPtr pScrn,
++ short src_x, short src_y,
+ short drw_x, short drw_y,
+- RegionPtr clipBoxes, pointer data);
++ short src_w, short src_h,
++ short drw_w, short drw_h,
++ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw);
+ static int SISQueryImageAttributes(ScrnInfoPtr,
+ int, UShort *, UShort *, int *, int *);
+ static void SISVideoTimerCallback(ScrnInfoPtr pScrn, Time now);
diff --git a/x11/driver/xorg-video-sisimedia/files/sisimedia.ids b/x11/driver/xorg-video-sisimedia/files/sisimedia.ids
new file mode 100644
index 0000000000..a5792e1bd4
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/sisimedia.ids
@@ -0,0 +1,2 @@
+10396350
+10396351
diff --git a/x11/driver/xorg-video-sisimedia/files/swap-func-rename.patch b/x11/driver/xorg-video-sisimedia/files/swap-func-rename.patch
new file mode 100644
index 0000000000..e22b388966
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/swap-func-rename.patch
@@ -0,0 +1,256 @@
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis.h xf86-video-sis-0.9.1.new/src/sis.h
+--- xf86-video-sis-0.9.1.pristine/src/sis.h 2012-03-17 05:32:39.414261430 +1100
++++ xf86-video-sis-0.9.1.new/src/sis.h 2012-03-17 05:28:34.100467696 +1100
+@@ -35,6 +35,10 @@
+ #ifndef _SIS_H_
+ #define _SIS_H_
+
++// XXX!!!
++#define _swapl(x, n) swapl(x)
++#define _swaps(x, n) swaps(x)
++
+ #define SISDRIVERVERSIONYEAR 6
+ #define SISDRIVERVERSIONMONTH 10
+ #define SISDRIVERVERSIONDAY 17
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_mergedfb.c xf86-video-sis-0.9.1.new/src/sis_mergedfb.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_mergedfb.c 2012-03-17 05:42:19.423231119 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_mergedfb.c 2012-03-17 06:01:18.070840068 +1100
+@@ -2472,10 +2472,10 @@
+ rep.majorVersion = SIS_XINERAMA_MAJOR_VERSION;
+ rep.minorVersion = SIS_XINERAMA_MINOR_VERSION;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.majorVersion, n);
+- swaps(&rep.minorVersion, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swaps(&rep.majorVersion, n);
++ _swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+@@ -2498,9 +2498,9 @@
+ rep.sequenceNumber = client->sequence;
+ rep.state = !SiSnoPanoramiXExtension;
+ if(client->swapped) {
+- swaps (&rep.sequenceNumber, n);
+- swapl (&rep.length, n);
+- swaps (&rep.state, n);
++ _swaps (&rep.sequenceNumber, n);
++ _swapl (&rep.length, n);
++ //_swaps (&rep.state, n); // XXX???
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
+ return client->noClientException;
+@@ -2523,9 +2523,9 @@
+ rep.sequenceNumber = client->sequence;
+ rep.ScreenCount = SiSXineramaNumScreens;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.ScreenCount, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ //_swaps(&rep.ScreenCount, n); // XXX???
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ return client->noClientException;
+@@ -2549,10 +2549,10 @@
+ rep.width = SiSXineramadataPtr[stuff->screen].width;
+ rep.height = SiSXineramadataPtr[stuff->screen].height;
+ if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.width, n);
+- swaps(&rep.height, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.width, n);
++ _swapl(&rep.height, n);
+ }
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ return client->noClientException;
+@@ -2571,9 +2571,9 @@
+ rep.state = !SiSnoPanoramiXExtension;
+ if(client->swapped) {
+ register int n;
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.state, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.state, n);
+ }
+ WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
+ return client->noClientException;
+@@ -2592,9 +2592,9 @@
+ rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ if(client->swapped) {
+ register int n;
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.number, n);
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.number, n);
+ }
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep);
+
+@@ -2609,10 +2609,10 @@
+ scratch.height = SiSXineramadataPtr[i].height;
+ if(client->swapped) {
+ register int n;
+- swaps(&scratch.x_org, n);
+- swaps(&scratch.y_org, n);
+- swaps(&scratch.width, n);
+- swaps(&scratch.height, n);
++ _swaps(&scratch.x_org, n);
++ _swaps(&scratch.y_org, n);
++ _swaps(&scratch.width, n);
++ _swaps(&scratch.height, n);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
+ }
+@@ -2763,7 +2763,7 @@
+ {
+ REQUEST(xPanoramiXQueryVersionReq);
+ register int n;
+- swaps(&stuff->length,n);
++ _swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return SiSProcXineramaQueryVersion(client);
+ }
+@@ -2773,7 +2773,7 @@
+ {
+ REQUEST(xPanoramiXGetStateReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return SiSProcXineramaGetState(client);
+ }
+@@ -2783,7 +2783,7 @@
+ {
+ REQUEST(xPanoramiXGetScreenCountReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return SiSProcXineramaGetScreenCount(client);
+ }
+@@ -2793,7 +2793,7 @@
+ {
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return SiSProcXineramaGetScreenSize(client);
+ }
+@@ -2803,7 +2803,7 @@
+ {
+ REQUEST(xXineramaIsActiveReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return SiSProcXineramaIsActive(client);
+ }
+@@ -2813,7 +2813,7 @@
+ {
+ REQUEST(xXineramaQueryScreensReq);
+ register int n;
+- swaps (&stuff->length, n);
++ _swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return SiSProcXineramaQueryScreens(client);
+ }
+@@ -2823,8 +2823,8 @@
+ {
+ REQUEST(xXineramaSelectInputReq);
+ register int n;
+- swaps(&stuff->length, n);
+- swapl(&stuff->window, n);
++ _swaps(&stuff->length, n);
++ _swapl(&stuff->window, n);
+ return SiSProcXineramaSelectInput(client);
+ }
+
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_utility.c xf86-video-sis-0.9.1.new/src/sis_utility.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_utility.c 2012-03-17 07:34:54.727700088 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_utility.c 2012-03-17 08:06:48.570630477 +1100
+@@ -2059,11 +2059,11 @@
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = SISCTRL_MAJOR_VERSION;
+ rep.minorVersion = SISCTRL_MINOR_VERSION;
+- if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swaps(&rep.majorVersion, n);
+- swaps(&rep.minorVersion, n);
++ if(client->swapped) {
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swaps(&rep.majorVersion, n);
++ _swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xSiSCtrlQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+@@ -2103,16 +2103,16 @@
+ rep.length = (sizeof(xSiSCtrlCommandReply) - sizeof(xGenericReply)) >> 2;
+ rep.sequenceNumber = client->sequence;
+
+- if(client->swapped) {
+- swaps(&rep.sequenceNumber, n);
+- swapl(&rep.length, n);
+- swapl(&rep.screen, n);
+- swapl(&rep.sdc_id, n);
+- swapl(&rep.sdc_command, n);
+- swapl(&rep.sdc_result_header, n);
++ if(client->swapped) {
++ _swaps(&rep.sequenceNumber, n);
++ _swapl(&rep.length, n);
++ _swapl(&rep.screen, n);
++ _swapl(&rep.sdc_id, n);
++ _swapl(&rep.sdc_command, n);
++ _swapl(&rep.sdc_result_header, n);
+ for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
+- swapl(&rep.sdc_parm[i], n);
+- swapl(&rep.sdc_result[i], n);
++ _swapl(&rep.sdc_parm[i], n);
++ _swapl(&rep.sdc_result[i], n);
+ }
+ }
+ WriteToClient(client, sizeof(xSiSCtrlCommandReply), (char *)&rep);
+@@ -2139,7 +2139,7 @@
+ {
+ REQUEST(xSiSCtrlQueryVersionReq);
+ register int n;
+- swaps(&stuff->length, n);
++ _swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xSiSCtrlQueryVersionReq);
+ return SiSProcSiSCtrlQueryVersion(client);
+ }
+@@ -2150,14 +2150,14 @@
+ REQUEST(xSiSCtrlCommandReq);
+ register int n;
+ int i;
+- swaps(&stuff->length, n);
+- swapl(&stuff->screen, n);
+- swapl(&stuff->sdc_id, n);
+- swapl(&stuff->sdc_command, n);
+- swapl(&stuff->sdc_result_header, n);
++ _swaps(&stuff->length, n);
++ _swapl(&stuff->screen, n);
++ _swapl(&stuff->sdc_id, n);
++ _swapl(&stuff->sdc_command, n);
++ _swapl(&stuff->sdc_result_header, n);
+ for(i = 0; i < SDC_NUM_PARM_RESULT; i++) {
+- swapl(&stuff->sdc_parm[i], n);
+- swapl(&stuff->sdc_result[i], n);
++ _swapl(&stuff->sdc_parm[i], n);
++ _swapl(&stuff->sdc_result[i], n);
+ }
+ REQUEST_SIZE_MATCH(xSiSCtrlCommandReq);
+ return SiSProcSiSCtrlCommand(client);
diff --git a/x11/driver/xorg-video-sisimedia/files/sync-with-freedesktop.patch b/x11/driver/xorg-video-sisimedia/files/sync-with-freedesktop.patch
new file mode 100644
index 0000000000..eb15814ff2
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/sync-with-freedesktop.patch
@@ -0,0 +1,63 @@
+diff -daur xf86-video-sis-0.9.1.pristine/configure.ac xf86-video-sis-0.9.1.new/configure.ac
+--- xf86-video-sis-0.9.1.pristine/configure.ac 2012-03-17 14:38:50.324387997 +1100
++++ xf86-video-sis-0.9.1.new/configure.ac 2012-03-17 15:02:13.142748894 +1100
+@@ -21,7 +21,7 @@
+ # Process this file with autoconf to produce a configure script
+
+ # Initialize Autoconf
+-AC_PREREQ(2.60)
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-sis],
+ 0.9.1,
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+@@ -31,7 +31,7 @@
+ AC_CONFIG_AUX_DIR(.)
+
+ # Initialize Automake
+-AM_INIT_AUTOMAKE([dist-bzip2])
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+ # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+@@ -40,10 +40,9 @@
+ XORG_MACROS_VERSION(1.8)
+ XORG_DEFAULT_OPTIONS
+
+-# Checks for programs.
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+ XORG_PROG_RAWCPP
+
+ AH_TOP([#include "xorg-server.h"])
+@@ -76,9 +75,6 @@
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+ if test "$DRI" != no; then
+ AC_CHECK_FILE([${sdkdir}/dri.h],
+ [have_dri_h="yes"], [have_dri_h="no"])
+@@ -123,8 +119,6 @@
+ fi
+ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
+
+-AC_SUBST([DRI_CFLAGS])
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=sis
+diff -daur xf86-video-sis-0.9.1.pristine/Makefile.am xf86-video-sis-0.9.1.new/Makefile.am
+--- xf86-video-sis-0.9.1.pristine/Makefile.am 2012-03-17 14:38:50.304387685 +1100
++++ xf86-video-sis-0.9.1.new/Makefile.am 2012-03-17 15:01:44.442304963 +1100
+@@ -18,7 +18,6 @@
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = src man
+
+ if BUILD_LINUXDOC
diff --git a/x11/driver/xorg-video-sisimedia/files/xf86-video-sis-0.9.1-20102701.patch b/x11/driver/xorg-video-sisimedia/files/xf86-video-sis-0.9.1-20102701.patch
new file mode 100644
index 0000000000..944eceb12b
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/xf86-video-sis-0.9.1-20102701.patch
@@ -0,0 +1,1376 @@
+diff -p -up xf86-video-sis-0.9.1/src/sis.h.orig xf86-video-sis-0.9.1/src/sis.h
+--- xf86-video-sis-0.9.1/src/sis.h.orig 2010-01-27 15:27:11.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis.h 2010-01-27 15:22:42.000000000 -0500
+@@ -98,6 +98,7 @@
+ #define XF86_VERSION_CURRENT XF86_VERSION_NUMERIC(4,3,99,902,0)
+ #endif
+
++#if 0
+ /*** Xorg Version Path <= X-Server 2.0 ***/
+ /* K.T for xorg 1.3 */
+ #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(2,0,0,0,0)
+@@ -109,33 +110,36 @@
+ #define NEW_XORG_VERSION 1
+ #endif
+ #endif
++#endif
++#define NEW_XORG_VERSION 1
+
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,0,0,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,0,0,0)
+ #define SIS_HAVE_RR_FUNC
+ #ifdef HaveDriverFuncs
+ #undef SIS_HaveDriverFuncs
+ #define SIS_HaveDriverFuncs HaveDriverFuncs
+ #define SIS_HAVE_DRIVER_FUNC
+ #endif /* HaveDriverFuncs */
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,900,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,900,0)
+ #define SISISXORG6899900
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,901,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,901,0)
+ #define SISISXORG6899901
+ #ifdef RANDR
+ #define SIS_HAVE_RR_GET_MODE_MM
+ #define SIS_HAVE_RANDR_SIZE_PATCH
+ #endif /* RANDR */
+-#endif /* >= 6.8.99.901 */
+-#endif /* >= 6.8.99.900 */
+-#endif /* >= 6.8.0.0 */
+-#else /* XORG_VERSION_CURRENT */
+-#include "xf86Version.h"
+-#define SISMYSERVERNAME "XFree86"
++//#endif /* >= 6.8.99.901 */
++//#endif /* >= 6.8.99.900 */
++//#endif /* >= 6.8.0.0 */
++//#else /* XORG_VERSION_CURRENT */
++//#include "xf86Version.h"
++//#define SISMYSERVERNAME "XFree86"
+ #endif
+
+ /*I.L. modified*/
+ //#define NEC_CASE /*It used the old Xorg_Version with new PCI structure.*/
+
++#if 0
+ #ifdef XSERVER_LIBPCIACCESS
+ #ifdef NEC_CASE
+ #define XORG_VERSION_CURRENT (((7) * 10000000) + ((1) * 100000) + ((0) * 1000) + 0)
+@@ -143,6 +147,7 @@
+ #define XORG_VERSION_CURRENT (((7) * 10000000) + ((4) * 100000) + ((0) * 1000) + 0)
+ #endif
+ #endif
++#endif
+
+
+ #define SIS_NAME "SIS"
+@@ -268,16 +273,16 @@
+
+ #undef SISCHECKOSSSE
+ #ifdef XORG_VERSION_CURRENT
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
+ #define SISCHECKOSSSE /* Automatic check OS for SSE; requires SigIll facility */
+-#endif
++//#endif
+ #endif
+
+ #undef SISGAMMARAMP
+ #ifdef XORG_VERSION_CURRENT
+-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
++//#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
+ #define SISGAMMARAMP /* Driver can set gamma ramp; requires additional symbols in xf86sym.h */
+-#endif
++//#endif
+ #endif
+
+ #if 0 /* Perhaps for future use */
+@@ -1031,6 +1036,7 @@ typedef struct {
+ #endif
+
+ PCITAG PciTag;
++
+ int PciBus, PciDevice, PciFunc;
+ EntityInfoPtr pEnt;
+ int Chipset;
+diff -p -up xf86-video-sis-0.9.1/src/sis300_accel.c.orig xf86-video-sis-0.9.1/src/sis300_accel.c
+--- xf86-video-sis-0.9.1/src/sis300_accel.c.orig 2007-05-29 22:12:02.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis300_accel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -1231,8 +1231,8 @@ SiS300AccelInit(ScreenPtr pScreen)
+
+ #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */
+ if(pSiS->useEXA) {
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+-
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++#if 0
+ if(pSiS->scrnOffset < 8192) {
+ int obase = 0;
+ /* data */
+@@ -1430,7 +1430,8 @@ SiS300AccelInit(ScreenPtr pScreen)
+ pSiS->exa_scratch = exaOffscreenAlloc(pScreen, 128 * 1024, 16, TRUE,
+ SiSScratchSave, pSiS);
+
+- #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++// #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++ #if 0
+ if(pSiS->exa_scratch) {
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+ pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
+diff -p -up xf86-video-sis-0.9.1/src/sis310_accel.c.orig xf86-video-sis-0.9.1/src/sis310_accel.c
+--- xf86-video-sis-0.9.1/src/sis310_accel.c.orig 2007-09-29 05:13:12.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis310_accel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -65,9 +65,9 @@
+ # define SIS_NEED_ARRAY
+ # undef SISNEWRENDER
+ # ifdef XORG_VERSION_CURRENT
+-# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
++//# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
+ # define SISNEWRENDER
+-# endif
++//# endif
+ # endif
+ # endif
+ #endif
+@@ -1463,7 +1463,7 @@ SiSUploadToScratch(PixmapPtr pSrc, Pixma
+ int dst_pitch, size, w, h, bytes;
+
+ w = pSrc->drawable.width;
+-
++/*
+ #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
+ dst_pitch = ((w * (pSrc->drawable.bitsPerPixel >> 3)) +
+ pSiS->EXADriverPtr->card.offscreenPitch - 1) &
+@@ -1472,17 +1472,17 @@ SiSUploadToScratch(PixmapPtr pSrc, Pixma
+ dst_pitch = ((w * (pSrc->drawable.bitsPerPixel >> 3)) +
+ pSiS->EXADriverPtr->card.pixmapPitchAlign - 1) &
+ ~(pSiS->EXADriverPtr->card.pixmapPitchAlign - 1);
+-#else
++#else*/
+ dst_pitch = ((w * (pSrc->drawable.bitsPerPixel >> 3)) +
+ pSiS->EXADriverPtr->pixmapPitchAlign - 1) &
+ ~(pSiS->EXADriverPtr->pixmapPitchAlign - 1);
+
+-#endif
++//#endif
+ size = dst_pitch * pSrc->drawable.height;
+
+ if(size > pSiS->exa_scratch->size)
+ return FALSE;
+-
++/*
+ #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
+ pSiS->exa_scratch_next = (pSiS->exa_scratch_next +
+ pSiS->EXADriverPtr->card.offscreenByteAlign - 1) &
+@@ -1491,34 +1491,34 @@ SiSUploadToScratch(PixmapPtr pSrc, Pixma
+ pSiS->exa_scratch_next = (pSiS->exa_scratch_next +
+ pSiS->EXADriverPtr->card.pixmapOffsetAlign - 1) &
+ ~(pSiS->EXADriverPtr->card.pixmapOffsetAlign - 1);
+-#else
++#else*/
+ pSiS->exa_scratch_next = (pSiS->exa_scratch_next +
+ pSiS->EXADriverPtr->pixmapOffsetAlign - 1) &
+ ~(pSiS->EXADriverPtr->pixmapOffsetAlign - 1);
+-#endif
+-
++//#endif
++/*
+ #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+ if(pSiS->exa_scratch_next + size >
+ pSiS->exa_scratch->offset + pSiS->exa_scratch->size) {
+ (pSiS->EXADriverPtr->accel.WaitMarker)(pSrc->drawable.pScreen, 0);
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+ }
+-#else
++#else*/
+ if(pSiS->exa_scratch_next + size >
+ pSiS->exa_scratch->offset + pSiS->exa_scratch->size) {
+ (pSiS->EXADriverPtr->WaitMarker)(pSrc->drawable.pScreen, 0);
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+ }
+-#endif
++//#endif
+
+ memcpy(pDst, pSrc, sizeof(*pDst));
+ pDst->devKind = dst_pitch;
+
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+- pDst->devPrivate.ptr = pSiS->EXADriverPtr->card.memoryBase + pSiS->exa_scratch_next;
+-#else
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++// pDst->devPrivate.ptr = pSiS->EXADriverPtr->card.memoryBase + pSiS->exa_scratch_next;
++//#else
+ pDst->devPrivate.ptr = pSiS->EXADriverPtr->memoryBase + pSiS->exa_scratch_next;
+-#endif
++//#endif
+
+ pSiS->exa_scratch_next += size;
+
+@@ -1762,7 +1762,8 @@ SiS315AccelInit(ScreenPtr pScreen)
+
+ #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */
+ if(pSiS->useEXA) {
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++#if 0
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+
+ int obase = 0;
+
+@@ -1952,11 +1953,11 @@ SiS315AccelInit(ScreenPtr pScreen)
+ SiSScratchSave, pSiS);
+ if(pSiS->exa_scratch) {
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+- #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+- pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
+- #else
++ //#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++ // pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
++ //#else
+ pSiS->EXADriverPtr->UploadToScratch = SiSUploadToScratch;
+- #endif
++ //#endif
+ }
+
+ } else {
+diff -p -up xf86-video-sis-0.9.1/src/sis_3daccel.c.orig xf86-video-sis-0.9.1/src/sis_3daccel.c
+--- xf86-video-sis-0.9.1/src/sis_3daccel.c.orig 2007-08-10 04:22:16.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_3daccel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -64,9 +64,9 @@
+ # define SIS_NEED_ARRAY
+ # undef SISNEWRENDER
+ # ifdef XORG_VERSION_CURRENT
+-# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
++//# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
+ # define SISNEWRENDER
+-# endif
++//# endif
+ # endif
+ # endif
+ #endif
+diff -p -up xf86-video-sis-0.9.1/src/sis_accel.c.orig xf86-video-sis-0.9.1/src/sis_accel.c
+--- xf86-video-sis-0.9.1/src/sis_accel.c.orig 2007-05-29 22:12:02.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_accel.c 2010-01-27 15:21:54.000000000 -0500
+@@ -781,50 +781,50 @@ SiSAccelInit(ScreenPtr pScreen)
+
+ #ifdef SIS_USE_EXA /* ----------------------- EXA ----------------------- */
+ if(pSiS->useEXA) {
+-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++//#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+
+ /* data */
+- pSiS->EXADriverPtr->card.memoryBase = pSiS->FbBase;
+- pSiS->EXADriverPtr->card.memorySize = pSiS->maxxfbmem;
+- pSiS->EXADriverPtr->card.offScreenBase = pScrn->displayWidth * pScrn->virtualY
+- * (pScrn->bitsPerPixel >> 3);
+- if(pSiS->EXADriverPtr->card.memorySize > pSiS->EXADriverPtr->card.offScreenBase) {
+- pSiS->EXADriverPtr->card.flags = EXA_OFFSCREEN_PIXMAPS;
+- } else {
+- pSiS->NoXvideo = TRUE;
+- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+- "Not enough video RAM for offscreen memory manager. Xv disabled\n");
+- }
+-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
+- pSiS->EXADriverPtr->card.offscreenByteAlign = 8; /* src/dst: double quad word boundary */
+- pSiS->EXADriverPtr->card.offscreenPitch = 1;
+-#else
+- pSiS->EXADriverPtr->card.pixmapOffsetAlign = 8; /* src/dst: double quad word boundary */
+- pSiS->EXADriverPtr->card.pixmapPitchAlign = 8; /* could possibly be 1, but who knows for sure */
+-#endif
+- pSiS->EXADriverPtr->card.maxX = 2047;
+- pSiS->EXADriverPtr->card.maxY = 2047;
++// pSiS->EXADriverPtr->card.memoryBase = pSiS->FbBase;
++// pSiS->EXADriverPtr->card.memorySize = pSiS->maxxfbmem;
++// pSiS->EXADriverPtr->card.offScreenBase = pScrn->displayWidth * pScrn->virtualY
++// * (pScrn->bitsPerPixel >> 3);
++// if(pSiS->EXADriverPtr->card.memorySize > pSiS->EXADriverPtr->card.offScreenBase) {
++// pSiS->EXADriverPtr->card.flags = EXA_OFFSCREEN_PIXMAPS;
++// } else {
++// pSiS->NoXvideo = TRUE;
++// xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++// "Not enough video RAM for offscreen memory manager. Xv disabled\n");
++// }
++//#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,8,2,0,0)
++// pSiS->EXADriverPtr->card.offscreenByteAlign = 8; /* src/dst: double quad word boundary */
++// pSiS->EXADriverPtr->card.offscreenPitch = 1;
++//#else
++// pSiS->EXADriverPtr->card.pixmapOffsetAlign = 8; /* src/dst: double quad word boundary */
++// pSiS->EXADriverPtr->card.pixmapPitchAlign = 8; /* could possibly be 1, but who knows for sure */
++//#endif
++// pSiS->EXADriverPtr->card.maxX = 2047;
++// pSiS->EXADriverPtr->card.maxY = 2047;
+
+ /* Sync */
+- pSiS->EXADriverPtr->accel.WaitMarker = SiSEXASync;
++// pSiS->EXADriverPtr->accel.WaitMarker = SiSEXASync;
+
+ /* Solid fill */
+- pSiS->EXADriverPtr->accel.PrepareSolid = SiSPrepareSolid;
+- pSiS->EXADriverPtr->accel.Solid = SiSSolid;
+- pSiS->EXADriverPtr->accel.DoneSolid = SiSDoneSolid;
++// pSiS->EXADriverPtr->accel.PrepareSolid = SiSPrepareSolid;
++// pSiS->EXADriverPtr->accel.Solid = SiSSolid;
++// pSiS->EXADriverPtr->accel.DoneSolid = SiSDoneSolid;
+
+ /* Copy */
+- pSiS->EXADriverPtr->accel.PrepareCopy = SiSPrepareCopy;
+- pSiS->EXADriverPtr->accel.Copy = SiSCopy;
+- pSiS->EXADriverPtr->accel.DoneCopy = SiSDoneCopy;
++// pSiS->EXADriverPtr->accel.PrepareCopy = SiSPrepareCopy;
++// pSiS->EXADriverPtr->accel.Copy = SiSCopy;
++// pSiS->EXADriverPtr->accel.DoneCopy = SiSDoneCopy;
+
+ /* Composite not supported */
+
+ /* Upload, download to/from Screen */
+- pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
+- pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
++// pSiS->EXADriverPtr->accel.UploadToScreen = SiSUploadToScreen;
++// pSiS->EXADriverPtr->accel.DownloadFromScreen = SiSDownloadFromScreen;
+
+-#else /*xorg>=7.0*/
++//#else /*xorg>=7.0*/
+
+ pSiS->EXADriverPtr->exa_major = 2;
+ pSiS->EXADriverPtr->exa_minor = 0;
+@@ -867,7 +867,7 @@ SiSAccelInit(ScreenPtr pScreen)
+
+ #endif /*end of Xorg>=7.0 EXA Setting*/
+ }
+-#endif /* EXA */
++//#endif /* EXA */
+
+ } /* NoAccel */
+
+@@ -946,11 +946,11 @@ SiSAccelInit(ScreenPtr pScreen)
+ SiSScratchSave, pSiS);
+ if(pSiS->exa_scratch) {
+ pSiS->exa_scratch_next = pSiS->exa_scratch->offset;
+- #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
+- pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
+- #else
++ //#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,0,0,0,0)
++ // pSiS->EXADriverPtr->accel.UploadToScratch = SiSUploadToScratch;
++ //#else
+ pSiS->EXADriverPtr->UploadToScratch = SiSUploadToScratch;
+- #endif
++ //#endif
+ }
+
+ } else {
+diff -p -up xf86-video-sis-0.9.1/src/sis_dri.c.orig xf86-video-sis-0.9.1/src/sis_dri.c
+--- xf86-video-sis-0.9.1/src/sis_dri.c.orig 2008-11-04 08:27:14.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_dri.c 2010-01-27 15:21:54.000000000 -0500
+@@ -56,7 +56,8 @@ extern Bool drmSiSAgpInit(int driSubFD,
+
+ #ifdef XORG_VERSION_CURRENT
+ #define SISHAVECREATEBUSID
+-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,7,99,1,0)
++#if 0
++//#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,7,99,1,0)
+ /*I.L. modified*/
+ #ifndef XSERVER_LIBPCIACCESS
+ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.c.orig xf86-video-sis-0.9.1/src/sis_driver.c
+--- xf86-video-sis-0.9.1/src/sis_driver.c.orig 2009-06-22 08:15:54.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_driver.c 2010-01-27 15:21:54.000000000 -0500
+@@ -140,6 +140,17 @@ static int pix24bpp = 0;
+ * an upper-case version of the driver name.
+ */
+
++#if XSERVER_LIBPCIACCESS
++#define SIS_DEVICE_MATCH(d, i)\
++ {PCI_VENDOR_SIS, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
++
++static const struct pci_id_match SIS_device_match[] = {
++ SIS_DEVICE_MATCH (PCI_CHIP_SIS670, 0),
++ SIS_DEVICE_MATCH (PCI_CHIP_SIS671, 0),
++ {0, 0, 0 },
++ };
++#endif
++
+ #ifdef _X_EXPORT
+ _X_EXPORT
+ #endif
+@@ -147,7 +158,11 @@ DriverRec SIS = {
+ SIS_CURRENT_VERSION,
+ SIS_DRIVER_NAME,
+ SISIdentify,
++#if XSERVER_LIBPCIACCESS
++ NULL,
++#else
+ SISProbe,
++#endif
+ SISAvailableOptions,
+ NULL,
+ 0
+@@ -155,6 +170,11 @@ DriverRec SIS = {
+ ,
+ SISDriverFunc
+ #endif
++#if XSERVER_LIBPCIACCESS
++ ,
++ SIS_device_match,
++ SIS_pci_probe
++#endif
+ };
+
+ static SymTabRec SISChipsets[] = {
+@@ -453,7 +473,94 @@ SISDriverFunc(ScrnInfoPtr pScrn, SISDRIV
+ /****************************************************/
+ /* Probe() */
+ /****************************************************/
++static Bool SIS_pci_probe (DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data)
++{
++ ScrnInfoPtr pScrn;
++#ifdef SISDUALHEAD
++ EntityInfoPtr pEnt;
++ Bool foundScreen = FALSE;
++#endif
++xf86DrvMsg(0, X_INFO, "SIS_pci_probe - begin, entity_num=%d\n", entity_num);
++xf86DrvMsg(0, X_INFO, " vendor_id=0x%x\n", device->vendor_id);
++xf86DrvMsg(0, X_INFO, " device_id=0x%x\n", device->device_id);
++xf86DrvMsg(0, X_INFO, " bus=%d\n", device->bus);
++xf86DrvMsg(0, X_INFO, " dev=%d\n", device->dev);
++xf86DrvMsg(0, X_INFO, " func=%d\n", device->func);
++ pScrn = NULL;
++ if((pScrn = xf86ConfigPciEntity(pScrn, 0,
++ entity_num,
++ SISPciChipsets,
++ NULL, NULL, NULL, NULL, NULL))) {
++ xf86DrvMsg(0, X_INFO, "SIS_pci_probe - ConfigPciEntity found\n");
++ /* Fill in what we can of the ScrnInfoRec */
++ pScrn->driverVersion = SIS_CURRENT_VERSION;
++ pScrn->driverName = SIS_DRIVER_NAME;
++ pScrn->name = SIS_NAME;
++ pScrn->Probe = NULL;//SISProbe;
++ pScrn->PreInit = SISPreInit;
++ pScrn->ScreenInit = SISScreenInit;
++ pScrn->SwitchMode = SISSwitchMode;
++ pScrn->AdjustFrame = SISAdjustFrame;
++ pScrn->EnterVT = SISEnterVT;
++ pScrn->LeaveVT = SISLeaveVT;
++ pScrn->FreeScreen = SISFreeScreen;
++ pScrn->ValidMode = SISValidMode;
++ pScrn->PMEvent = SISPMEvent; /*add PM function for ACPI hotkey,Ivans*/
++#ifdef X_XF86MiscPassMessage
++// if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
++// pScrn->HandleMessage = SISHandleMessage;
++// }
++#endif
++ foundScreen = TRUE;
++ }
++ #ifdef SISDUALHEAD
++ pEnt = xf86GetEntityInfo(entity_num);
++xf86DrvMsg(0, X_INFO, "SIS_pci_probe - GetEntityInfo chipset is 0x%x\n",pEnt->chipset);
++ switch(pEnt->chipset) {
++ case PCI_CHIP_SIS300:
++ case PCI_CHIP_SIS540:
++ case PCI_CHIP_SIS630:
++ case PCI_CHIP_SIS550:
++ case PCI_CHIP_SIS315:
++ case PCI_CHIP_SIS315H:
++ case PCI_CHIP_SIS315PRO:
++ case PCI_CHIP_SIS650:
++ case PCI_CHIP_SIS330:
++ case PCI_CHIP_SIS660:
++ case PCI_CHIP_SIS340:
++ case PCI_CHIP_SIS670:
++ case PCI_CHIP_SIS671:
++ case PCI_CHIP_XGIXG40:
++ {
++ SISEntPtr pSiSEnt = NULL;
++ DevUnion *pPriv;
++
++ xf86SetEntitySharable(entity_num);
++ if(SISEntityIndex < 0) {
++ SISEntityIndex = xf86AllocateEntityPrivateIndex();
++ }
++ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], SISEntityIndex);
++ if(!pPriv->ptr) {
++ pPriv->ptr = xnfcalloc(sizeof(SISEntRec), 1);
++ pSiSEnt = pPriv->ptr;
++ memset(pSiSEnt, 0, sizeof(SISEntRec));
++ pSiSEnt->lastInstance = -1;
++ } else {
++ pSiSEnt = pPriv->ptr;
++ }
++ pSiSEnt->lastInstance++;
++ xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0],
++ pSiSEnt->lastInstance);
++ }
++ break;
+
++ default:
++ break;
++ }
++#endif /* DUALHEAD */
++xf86DrvMsg(0, X_INFO, "SIS_pci_probe - end\n");
++ return foundScreen;
++}
+
+ static Bool
+ SISProbe(DriverPtr drv, int flags)
+@@ -464,7 +571,7 @@ SISProbe(DriverPtr drv, int flags)
+ int numDevSections;
+ int numUsed, numUsedSiS, numUsedXGI;
+ Bool foundScreen = FALSE;
+-
++xf86DrvMsg(0, X_INFO, "SISPRobe() begin, flags=%d\n", flags);
+ /*
+ * The aim here is to find all cards that this driver can handle,
+ * and for the ones not already claimed by another driver, claim
+@@ -490,6 +597,7 @@ SISProbe(DriverPtr drv, int flags)
+ * There's no matching device section in the config file, so quit
+ * now.
+ */
++ xf86DrvMsg(0, X_INFO, "SISProbe - MatchDevice fail\n");
+ return FALSE;
+ }
+
+@@ -526,14 +634,16 @@ SISProbe(DriverPtr drv, int flags)
+ xfree(devSections);
+
+ numUsed = numUsedSiS + numUsedXGI;
+-
+- if(numUsed <= 0)
++xf86DrvMsg(0, X_INFO, "SISPRobe - test1\n");
++ if(numUsed <= 0) {
++ xf86DrvMsg(0, X_INFO, "SISProbe - MatchPciInstances fail\n");
+ return FALSE;
++ }
+
+ if(flags & PROBE_DETECT) {
+
+ foundScreen = TRUE;
+-
++ xf86DrvMsg(0, X_INFO, "SISProbe - flags already probe");
+ } else for(i = 0; i < numUsed; i++) {
+
+ ScrnInfoPtr pScrn;
+@@ -548,6 +658,7 @@ SISProbe(DriverPtr drv, int flags)
+ (i < numUsedSiS) ? usedChipsSiS[i] : usedChipsXGI[i-numUsedSiS],
+ (i < numUsedSiS) ? SISPciChipsets : XGIPciChipsets,
+ NULL, NULL, NULL, NULL, NULL))) {
++ xf86DrvMsg(0, X_INFO, "SISProbe - ConfigPciEntity found\n");
+ /* Fill in what we can of the ScrnInfoRec */
+ pScrn->driverVersion = SIS_CURRENT_VERSION;
+ pScrn->driverName = SIS_DRIVER_NAME;
+@@ -563,16 +674,16 @@ SISProbe(DriverPtr drv, int flags)
+ pScrn->ValidMode = SISValidMode;
+ pScrn->PMEvent = SISPMEvent; /*add PM function for ACPI hotkey,Ivans*/
+ #ifdef X_XF86MiscPassMessage
+- if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
+- pScrn->HandleMessage = SISHandleMessage;
++ if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
++// pScrn->HandleMessage = SISHandleMessage;
+ }
+ #endif
+ foundScreen = TRUE;
+ }
+-
++xf86DrvMsg(0, X_INFO, "SISProbe - test2\n");
+ #ifdef SISDUALHEAD
+ pEnt = xf86GetEntityInfo((i < numUsedSiS) ? usedChipsSiS[i] : usedChipsXGI[i-numUsedSiS]);
+-
++ xf86DrvMsg(0, X_INFO, "SISProbe - GetEntityInfo done\n");
+ switch(pEnt->chipset) {
+ case PCI_CHIP_SIS300:
+ case PCI_CHIP_SIS540:
+@@ -620,7 +731,7 @@ SISProbe(DriverPtr drv, int flags)
+
+ if(usedChipsSiS) xfree(usedChipsSiS);
+ if(usedChipsXGI) xfree(usedChipsXGI);
+-
++xf86DrvMsg(0, X_INFO, "SISProbe end\n");
+ return foundScreen;
+ }
+
+@@ -1306,7 +1417,11 @@ SiSReadROM(ScrnInfoPtr pScrn)
+ }
+
+ if(readpci) {
++#ifndef XSERVER_LIBPCIACCESS
+ xf86ReadPciBIOS(0, pSiS->PciTag, 0, pSiS->BIOS, biossize);
++#else
++ pci_device_read_rom(pSiS->PciInfo, pSiS->BIOS);
++#endif
+ if(SISCheckBIOS(pSiS, mypciid, mypcivendor, biossize)) {
+ found = TRUE;
+ }
+@@ -2224,8 +2339,7 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScr
+ { 2, 0x04, 56.6 },
+ { 2, 0x02, 60.1 },
+ { 2, 0x01, 80.1 }
+- };
+-
++ };
+ const myvddctiming myvtiming[11] = {
+ { 1, 0x02, 56 },
+ { 1, 0x01, 60 },
+@@ -2240,11 +2354,6 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScr
+ { 2, 0x01, 75 }
+ };
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSSetSyncRangeFromEdid\n");
+-#endif
+-
+ if(flag) { /* HSync */
+
+ for(i = 0; i < 4; i++) {
+@@ -2350,12 +2459,6 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScr
+ static Bool
+ SiSAllowSyncOverride(SISPtr pSiS, Bool fromDDC, int mfbcrt)
+ {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSAllowSyncOverride\n");
+-#endif
+-// return TRUE;
+-
+ if(!(pSiS->VBFlags2 & VB2_VIDEOBRIDGE)) return FALSE;
+
+ #ifdef SISDUALHEAD
+@@ -2382,11 +2485,10 @@ SiSAllowSyncOverride(SISPtr pSiS, Bool f
+ }
+ #endif
+
+-// PCF
+-// if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
++ if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
+ if( (pSiS->VBFlags & CRT2_TV) ||
+ ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) return TRUE;
+-// } else if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
++ } else if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
+
+ return FALSE;
+ }
+@@ -2394,8 +2496,6 @@ SiSAllowSyncOverride(SISPtr pSiS, Bool f
+ static Bool
+ SiSCheckForH(float hsync, MonPtr monitor)
+ {
+-
+-
+ int i;
+ for(i = 0; i < monitor->nHsync; i++) {
+ if((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+@@ -2409,7 +2509,6 @@ SiSCheckForH(float hsync, MonPtr monitor
+ static Bool
+ SiSCheckForV(float vrefresh, MonPtr monitor)
+ {
+-
+ int i;
+ for(i = 0; i < monitor->nVrefresh; i++) {
+ if((vrefresh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+@@ -2424,21 +2523,11 @@ static Bool
+ SiSCheckAndOverruleH(ScrnInfoPtr pScrn, MonPtr monitor)
+ {
+ DisplayModePtr mode = monitor->Modes;
+-// PCF
+ float mymin = 30.0, mymax = 80.0, hsync;
+-
+ Bool doit = FALSE;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSCheckAndOverruleH\n");
+-#endif
+-
+ for(hsync = mymin; hsync <= mymax; hsync += .5) {
+- if(!SiSCheckForH(hsync, monitor))
+- {
+- doit = TRUE;
+- }
++ if(!SiSCheckForH(hsync, monitor)) doit = TRUE;
+ }
+
+ if(mode) {
+@@ -2461,7 +2550,6 @@ SiSCheckAndOverruleH(ScrnInfoPtr pScrn,
+ return TRUE;
+ }
+
+-
+ return FALSE;
+ }
+
+@@ -2469,20 +2557,11 @@ static Bool
+ SiSCheckAndOverruleV(ScrnInfoPtr pScrn, MonPtr monitor)
+ {
+ DisplayModePtr mode = monitor->Modes;
+-// PCF
+- float mymin = 57.0, mymax = 63.0, vrefresh;
++ float mymin = 59.0, mymax = 61.0, vrefresh;
+ Bool doit = FALSE, ret = FALSE;
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSCheckAndOverruleV\n");
+-#endif
+
+ for(vrefresh = mymin; vrefresh <= mymax; vrefresh += 1.0) {
+- if(!SiSCheckForV(vrefresh, monitor))
+- {
+- doit = TRUE;
+- }
++ if(!SiSCheckForV(vrefresh, monitor)) doit = TRUE;
+ }
+
+ if(mode) {
+@@ -2515,7 +2594,6 @@ SiSCheckAndOverruleV(ScrnInfoPtr pScrn,
+ monitor->nVrefresh++;
+ ret = TRUE;
+ }
+-
+ return ret;
+ }
+
+@@ -2529,11 +2607,6 @@ SiSFixupHVRanges(ScrnInfoPtr pScrn, int
+ static const char *saneh = "Correcting %s CRT%d monitor HSync range\n";
+ static const char *sanev = "Correcting %s CRT%d monitor VRefresh range\n";
+ int crtnum;
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSFixupHVRanges\n");
+-#endif
+
+ #ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+@@ -2610,8 +2683,7 @@ SiSFixupHVRanges(ScrnInfoPtr pScrn, int
+ }
+ }
+ }
+-// PCF
+-// return TRUE;
++
+ return freqoverruled;
+ }
+
+@@ -2623,11 +2695,6 @@ SiSMakeOwnModeList(ScrnInfoPtr pScrn, Bo
+ Bool isfordvi, Bool *havecustommodes, Bool fakecrt2modes, Bool IsForCRT2)
+ {
+ DisplayModePtr tempmode, delmode, mymodes;
+-
+- // PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSMakeOwnModeList\n");
+-#endif
+
+ if((mymodes = SiSBuildBuiltInModeList(pScrn, includelcdmodes, isfordvi, fakecrt2modes, IsForCRT2))) {
+ if(!acceptcustommodes) {
+@@ -2676,11 +2743,6 @@ SiSSetupModeListParmsCRT1(SISPtr pSiS, u
+ Bool *acceptcustommodes, Bool *includelcdmodes, Bool *isfordvi,
+ Bool *fakecrt2modes, Bool *IsForCRT2, Bool *AllowInterlace)
+ {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSSetupModeListParmsCRT1\n");
+-#endif
+-
+ (*acceptcustommodes) = TRUE; /* Accept user modelines */
+ (*includelcdmodes) = TRUE; /* Include modes reported by DDC */
+ (*isfordvi) = FALSE; /* Is for digital DVI output */
+@@ -2815,11 +2877,6 @@ SiSReplaceModeList(ScrnInfoPtr pScrn, Cl
+ * -) crt2 device is not TV, and
+ * -) crt1 is not LCDA, unless bridge is TMDS/LCDA capable (301C)
+ */
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSReplaceModeList\n");
+-#endif
+-
+
+ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+
+@@ -2881,11 +2938,6 @@ SiSClearModesPrivate(DisplayModePtr mode
+ {
+ DisplayModePtr tempmode;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSClearModesPrivate\n");
+-#endif
+-
+ /* Make sure that the Private field is NULL */
+ /* (This way we don't have to care for MergedFB
+ * when freeing the mode; just check the Private
+@@ -2904,11 +2956,6 @@ SiSDuplicateMode(DisplayModePtr source)
+ {
+ DisplayModePtr dest = NULL;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSDuplicateMode\n");
+-#endif
+-
+ if(source) {
+ if((dest = xalloc(sizeof(DisplayModeRec)))) {
+ memcpy(dest, source, sizeof(DisplayModeRec));
+@@ -2972,11 +3019,6 @@ SiSBuildVesaModeList(ScrnInfoPtr pScrn,
+ SISPtr pSiS = SISPTR(pScrn);
+ int i = 0;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSBuildVesaModeList\n");
+-#endif
+-
+ while(vbe->VideoModePtr[i] != 0xffff) {
+ sisModeInfoPtr m;
+ VbeModeInfoBlock *mode;
+@@ -3014,7 +3056,7 @@ SiSSetMinMaxPixelClock(ScrnInfoPtr pScrn
+ {
+ SISPtr pSiS = SISPTR(pScrn);
+ MessageType from;
+-
++
+ /* Set the min pixel clock */
+ pSiS->MinClock = 5000;
+ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+@@ -3061,11 +3103,6 @@ SiSRemoveUnsuitableModes(ScrnInfoPtr pSc
+ int maxUsedClock = 0;
+ static const char *notsuitablestr = "Not using mode \"%s\" (not suitable for %s mode)\n";
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiSRemoveUnsuitableModes\n");
+-#endif
+-
+ if((p = first = initial)) {
+
+ do {
+@@ -3222,11 +3259,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ static const char *crtsetupstr = "*************************** CRT%d setup ***************************\n";
+ #endif
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SISPreInit Start\n");
+-#endif
+-
+ if(flags & PROBE_DETECT) {
+
+ vbeInfoPtr pVbe;
+@@ -4716,10 +4748,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ mymax = 8192 * 1024;
+ else if(total <= 32768) /* <= 32MB: Use 16MB for X */
+ mymax = 16384 * 1024;
+- else
+-// PCF /* Otherwise: Use 20MB for X */
+-// mymax = 20 * 1024 * 1024;
+- mymax = 20 * 1024 *1024;
++ else /* Otherwise: Use 20MB for X */
++ mymax = 20 * 1024 * 1024;
+ /* availMem is right now adjusted to not use the UMA
+ * area. Make sure that our default doesn't reach
+ * into the UMA area either.
+@@ -4758,9 +4788,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ if(pScrn->videoRam <= 65536)
+ pSiS->maxxfbmem = 16384 * 1024; /* On >=315 series and <=64MB, use 16MB */
+ else
+-// PCF
+-// pSiS->maxxfbmem = 20 * 1024 * 1024; /* On >=315 series and > 64MB, use 20MB */
+- pSiS->maxxfbmem = 20 * 1024 * 1024;
++ pSiS->maxxfbmem = 20 * 1024 * 1024; /* On >=315 series and > 64MB, use 20MB */
+ } else
+ pSiS->maxxfbmem = 12288 * 1024; /* On <315 series, use 12MB */
+
+@@ -4980,7 +5008,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ * via CRT2.)
+ * (TODO: This might need some modification for the
+ * 307 bridges, if these are capable of driving
+- * LCDs > via channel B)
++ * LCDs > 1600 via channel B)
+ */
+ if((pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) &&
+ (pSiS->VBFlags & CRT2_LCD) &&
+@@ -4995,10 +5023,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ */
+ if(pSiS->ChipType < SIS_662 || pSiS->ChipType >= XGI_20) pSiS->ForceCRT1Type = CRT1_LCDA;
+ pSiS->ForceCRT2Type = CRT2_TV;
+-// PCF
+-// } else if(pSiS->LCDwidth > 1600) {
+- } else if(pSiS->LCDwidth > 1920) {
+-
++ } else if(pSiS->LCDwidth > 1600) {
+ /* If LCD is > 1600, default to LCDA if we don't need CRT1/VGA for other head */
+ Bool NeedCRT1VGA = FALSE;
+ #ifdef SISDUALHEAD
+@@ -5591,11 +5616,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ clockRanges->minClock = pSiS->MinClock;
+ clockRanges->maxClock = pSiS->MaxClock;
+ clockRanges->clockIndex = -1; /* programmable */
+-// PCF
+-// clockRanges->interlaceAllowed = TRUE;
+-// clockRanges->doubleScanAllowed = TRUE;
+- clockRanges->interlaceAllowed = FALSE;
+- clockRanges->doubleScanAllowed = FALSE;
++ clockRanges->interlaceAllowed = TRUE;
++ clockRanges->doubleScanAllowed = TRUE;
+
+ /* Replace default mode list */
+ SiSReplaceModeList(pScrn, clockRanges, FALSE);
+@@ -5623,11 +5645,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ break;
+ case SIS_300_VGA:
+ case SIS_315_VGA:
+-// PCF
+ maxpitch = 4088;
+- maxheight = 4096;
+-// maxpitch = 1600;
+-// maxheight = 1200;
++ maxheight = 4096;
+ break;
+ default:
+ maxpitch = 2048;
+@@ -5688,12 +5707,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pScrn->monitor->DDC = NULL;
+ }
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86ValidateModes Start\n");
+- xf86DrvMsg(0, X_INFO,"virtualX = %d, virtualY = %d, maxpitch = %d, maxheight = %d, maxxfbmem = %ld \n",
+- pScrn->display->virtualX,pScrn->display->virtualY,maxpitch,maxheight,pSiS->maxxfbmem/1024);
+-#endif
++
+ i = xf86ValidateModes(pScrn,
+ pScrn->monitor->Modes,
+ pScrn->display->modes,
+@@ -5703,13 +5717,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ pScrn->bitsPerPixel * 8,
+ minheight, maxheight,
+ pScrn->display->virtualX,
+- pScrn->display->virtualY,
++ pScrn->display->virtualY,
+ pSiS->maxxfbmem,
+ LOOKUP_BEST_REFRESH);
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86ValidateModes End\n");
+-#endif
+
+ pScrn->monitor->DDC = backupddc;
+ }
+@@ -5745,28 +5755,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ #endif
+
+ /* Prune the modes marked as invalid */
+-// PCF
+-// xf86DrvMsg(0, X_INFO,"xf86PruneDriverModes Start\n");
+ xf86PruneDriverModes(pScrn);
+-// xf86DrvMsg(0, X_INFO,"xf86PruneDriverModes End\n");
+-
+
+ if(i == 0 || pScrn->modes == NULL) {
+ SISErrorLog(pScrn, "No valid modes found - check VertRefresh/HorizSync\n");
+ goto my_error_1;
+ }
+
+-// PCF
+-// xf86DrvMsg(0, X_INFO,"xf86SetCrtcForModes Start\n");
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+-// xf86DrvMsg(0, X_INFO,"xf86SetCrtcForModes End\n");
+-
+
+ /* Clear the modes' Private field */
+-// PCF
+-// xf86DrvMsg(0, X_INFO,"SiSClearModesPrivate Start\n");
+ SiSClearModesPrivate(pScrn->modes);
+-// xf86DrvMsg(0, X_INFO,"SiSClearModesPrivate End\n");
+
+ /* Save virtualX/Y calculated by ValidateModes
+ * and overwrite them with our values assumed to
+@@ -5823,23 +5822,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+ }
+
+ if(usemyprint) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SiSPrintModes Start\n");
+-#endif
+ SiSPrintModes(pScrn, printfreq);
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SiSPrintModes End\n");
+-#endif
+ } else {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86PrintModes Start\n");
+-#endif
+ xf86PrintModes(pScrn);
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"xf86PrintModes End\n");
+-#endif
+ }
+ }
+
+@@ -6072,10 +6057,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
+
+ /*xf86DrvMsg(0,X_INFO,"CurrentMode=%d. \n",pSiS->Hkey_Device_Switch_State);
+ xf86DrvMsg(0,X_INFO,"Init_VBFlags=0X%x. \n",pSiS->VBFlags);*/
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"SISPreInit End\n");
+-#endif
++
+ return TRUE;
+
+ /* ---- */
+@@ -7523,9 +7505,7 @@ SiSPreSetMode(ScrnInfoPtr pScrn, Display
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, SISVERBLEVEL, "VBFlags=0x%x\n", pSiS->VBFlags);
+
+ CR30 = 0x00;
+-// PCF
+-// CR31 &= ~0x60; /* Clear VB_Drivermode & VB_OutputDisable */
+- CR31 &= ~0x20; /* Clear VB_Drivermode & VB_OutputDisable */
++ CR31 &= ~0x60; /* Clear VB_Drivermode & VB_OutputDisable */
+ CR31 |= 0x04; /* Set VB_NotSimuMode (not for 30xB/1400x1050?) */
+ CR35 = 0x00;
+
+@@ -8633,11 +8613,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISEntPtr pSiSEnt = NULL;
+ #endif
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit\n");
+-#endif
+-
+ andSISIDXREG(SISCR,0x11,0x7f); /* Unlock CRTC registers */
+
+ SISModifyModeInfo(mode); /* Quick check of the mode parameters */
+@@ -8647,14 +8622,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ }
+
+ if(pSiS->UseVESA) { /* With VESA: */
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit UseVESA\n");
+-#endif
+
+ #ifdef SISDUALHEAD
+ /* No dual head mode when using VESA */
+@@ -8679,7 +8646,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSSetVESAMode() failed\n");
+ return FALSE;
+ }
+-
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+ if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
+ SiSPreSetMode(pScrn, mode, SIS_MODE_SIMU);
+@@ -8697,21 +8663,11 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SiSVGAProtect(pScrn, TRUE);
+ (*pSiS->SiSRestore)(pScrn, &pSiS->ModeReg);
+ SiSVGAProtect(pScrn, FALSE);
+-// xf86DrvMsg(0, X_INFO,"VESA DualHeadMode SetMode\n");
++
+ } else { /* Without VESA: */
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Without VESA\n");
+-#endif
+
+ #ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+-
+- xf86DrvMsg(0, X_INFO,"SISModeInit DualHeadMode\n");
+
+ if(!(*pSiS->ModeInit)(pScrn, mode)) {
+ SISErrorLog(pScrn, "ModeInit() failed\n");
+@@ -8730,10 +8686,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"DualHeadMode SetCRT2\n");
+-#endif
+ SiSPostSetMode(pScrn, &pSiS->ModeReg);
+ if(pSiSEnt->pScrn_2) {
+ /* No need to go through pScrn->AdjustFrame; the coords
+@@ -8752,11 +8704,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"DualHeadMode SetCRT1\n");
+-#endif
+-
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+ SiSPostSetMode(pScrn, &pSiS->ModeReg);
+ if(pSiSEnt->pScrn_1) {
+@@ -8771,20 +8718,8 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+
+ } else {
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+- xf86DrvMsg(0, X_INFO,"SISModeInit Other\n");
+-#endif
+
+ if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit SIS_315_VGA\n");
+-#endif
+
+ if(!(*pSiS->ModeInit)(pScrn, mode)) {
+ SISErrorLog(pScrn, "ModeInit() failed\n");
+@@ -8795,10 +8730,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+
+ #ifdef SISMERGED
+ if(pSiS->MergedFB) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit SISMERGED\n");
+-#endif
++
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting MergedFB mode %dx%d\n",
+ mode->HDisplay, mode->VDisplay);
+
+@@ -8813,10 +8745,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISMERGED SetCRT1\n");
+-#endif
+
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT2);
+
+@@ -8827,10 +8755,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISMERGED SetCRT2\n");
+-#endif
+
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+
+@@ -8838,25 +8762,9 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+
+ } else {
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Not SISMERGED\n");
+-#endif
+
+ if((pSiS->VBFlags & CRT1_LCDA) || (!(mode->type & M_T_DEFAULT))) {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit #1\n");
+- if(pSiS->VBFlags & CRT1_LCDA)
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #1 LCDA\n");
+-
+- }
+- else
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #1 LCDB\n");
+- }
+-#endif
++
+ pSiS->SiS_Pr->SiS_EnableBackLight = FALSE;
+
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
+@@ -8867,10 +8775,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"NoVESA SetCRT1\n");
+-#endif
+
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT2);
+
+@@ -8880,28 +8784,10 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ return FALSE;
+ }
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"NoVESA SetCRT2\n");
+-#endif
+-
+
+ SiS_SiSLVDSBackLight(pSiS, TRUE);
+
+ } else {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit #2\n");
+-
+- if(pSiS->VBFlags & CRT1_LCDA)
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #2 LCDA\n");
+- }
+- else
+- {
+- xf86DrvMsg(0, X_INFO,"SISModeInit #2 LCDB\n");
+- }
+-#endif
+
+ pSiS->SiS_Pr->SiS_EnableBackLight = TRUE;
+
+@@ -8918,11 +8804,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ #ifdef SISMERGED
+ }
+ #endif
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit #3\n");
+-#endif
+-
+ SiSPostSetMode(pScrn, &pSiS->ModeReg);
+ #ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %lx\n", pSiS->VBFlags);
+@@ -8932,10 +8813,6 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayMo
+ #endif
+
+ } else {
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO,"SISModeInit Old method\n");
+-#endif
+
+ /* For other chipsets, use the old method */
+
+@@ -9147,7 +9024,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int m
+ static void
+ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
+ {
+- SISPtr pSiS = SISPTR(pScrn);
++ SISPtr pSiS = SISPTR(pScrn);
+ Bool docrt1 = TRUE, docrt2 = TRUE, backlight = TRUE;
+ UChar sr1=0, cr17=0, cr63=0, pmreg=0, sr7=0;
+ UChar p1_13=0, p2_0=0, oldpmreg=0;
+@@ -10237,7 +10114,6 @@ SISScreenInit(int scrnIndex, ScreenPtr p
+ static Bool
+ SiSValidLCDUserMode(SISPtr pSiS, unsigned int VBFlags, DisplayModePtr mode, Bool isforlcda)
+ {
+-
+ if(mode->Flags & V_INTERLACE) return FALSE;
+
+ if(mode->HDisplay > 2048) return FALSE;
+@@ -10352,7 +10228,7 @@ SiS_CheckModeCRT1(ScrnInfoPtr pScrn, Dis
+ }
+
+ }
+-
++
+ return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
+ i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight));
+ }
+@@ -10370,12 +10246,8 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, Dis
+ xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %lx, mode %dx%d)\n",
+ VBFlags,mode->HDisplay, mode->VDisplay);
+ #endif
++
+ if(VBFlags & CRT2_LCD) { /* CRT2 is LCD */
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0, X_INFO, "SiS_CheckModeCRT2 LCDwidth= %d, LCDheight= %d\n",pSiS->LCDwidth,pSiS->LCDheight);
+-#endif
+
+ if((pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) && (!(pSiS->VBFlags2 & VB2_30xBDH))) {
+
+@@ -10403,7 +10275,6 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, Dis
+ return 0xfe;
+
+ }
+-// PCF
+
+ if( ((mode->HDisplay <= pSiS->LCDwidth) &&
+ (mode->VDisplay <= pSiS->LCDheight)) ||
+@@ -10415,15 +10286,11 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, Dis
+ (((mode->HDisplay == 1024) && (mode->HDisplay == 768)) ||
+ ((mode->HDisplay == 800) && (mode->HDisplay == 600)))) ||
+ ((pSiS->EnablePanel_1366x768)&&(pSiS->LCDwidth==1366)&&(mode->HDisplay==1368))) {/*let 1366x768 mode valid. Ivans@090109*/
+-/*
+- if( (mode->HDisplay <= pSiS->LCDwidth) &&
+- (mode->VDisplay <= pSiS->LCDheight)) {
+-*/
++
+ ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
+ pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight,
+ pSiS->VBFlags2);
+-// PCF
+-// xf86DrvMsg(0, X_INFO, "SiS_CheckModeCRT2 LCDwidth= %d, LCDheight= %d, ModeID= %x\n",pSiS->LCDwidth,pSiS->LCDheight,ModeIndex);
++
+ }
+
+ } else if(VBFlags & CRT2_TV) { /* CRT2 is TV */
+@@ -10514,7 +10381,7 @@ SISValidMode(int scrnIndex, DisplayModeP
+ if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags,
+ pSiS->VBFlags3, pSiS->HaveCustomModes) < 0x14){
+ #ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"[SISValidMode()]: else condition. passing CheckModeCRT2 and MODE_Fail.\n");
++ xf86DrvMsg(0,X_INFO,"[SISValidMode()]: else condition. passing CheckModeCRT2 and MODE_OK.\n");
+ #endif
+ return MODE_BAD;
+ }
+@@ -10629,18 +10496,12 @@ SISSwitchMode(int scrnIndex, DisplayMode
+ * (In non-MergedFB mode this is also here in order
+ * to get a cheap update of the HWCursor image)
+ */
+-
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"SISSwitchMode\n");
+-#endif
+
+ if(!pSiS->skipswitchcheck) {
+ if(SISValidMode(scrnIndex, mode, TRUE, flags) != MODE_OK) {
+ return FALSE;
+ }
+ }
+-
+ /* Mark for 3D full-screen bug */
+ /*
+ #ifdef XF86DRI
+@@ -11510,12 +11371,6 @@ SISHotkeySwitchMode(ScrnInfoPtr pScrn, B
+ int dotclock=65146;
+ int hdisplay=1024;
+
+-// PCF
+-#ifdef TWDEBUG
+- xf86DrvMsg(0,X_INFO,"SISHotkeySwitchMode\n");
+-#endif
+-
+-
+ if(!VidModeGetCurrentModeline(pScrn->scrnIndex,&hkeymode,&dotClock))
+ return FALSE;
+
+diff -p -up xf86-video-sis-0.9.1/src/sis_driver.h.orig xf86-video-sis-0.9.1/src/sis_driver.h
+--- xf86-video-sis-0.9.1/src/sis_driver.h.orig 2008-09-02 10:19:02.000000000 -0400
++++ xf86-video-sis-0.9.1/src/sis_driver.h 2010-01-27 15:21:54.000000000 -0500
+@@ -779,6 +779,9 @@ static Bool SISSwitchMode(int scrnIndex,
+ static void SISNewAdjustFrame(int scrnIndex, int x, int y, int flags);
+ static Bool SISPMEvent(int scrnIndex, pmEvent event, Bool undo);/*APM-ACPI, adding by Ivans.*/
+
++#if XSERVER_LIBPCIACCESS
++static Bool SIS_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data);
++#endif
+ /* ACPI Device Switch functions */
+ static Bool SISHotkeySwitchCRT1Status(ScrnInfoPtr pScrn,int onoff);/*hotkey pressing: switch CRT1 on/off*/
+ static Bool SISHotkeySwitchCRT2Status(ScrnInfoPtr pScrn,ULong newvbflags ,ULong newvbflags3);/*LCD on/off*/
diff --git a/x11/driver/xorg-video-sisimedia/files/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch b/x11/driver/xorg-video-sisimedia/files/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
new file mode 100644
index 0000000000..4159859210
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
@@ -0,0 +1,89 @@
+--- xf86-video-sis-0.9.1/src/sis_driver.c.orig 2010-01-18 13:17:56.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_driver.c 2010-01-25 16:35:40.000000000 -0500
+@@ -11677,7 +11677,64 @@ SISPMEvent(int scrnIndex, pmEvent event,
+ return 1;/*TRUE*/
+ }
+
++void
++sis_print_registers(SISPtr pSiS)
++{
++#define print(...) xf86ErrorFVerb(1, __VA_ARGS__)
++ auto void print_range(char *name, int base, int first, int last) {
++ int i, j;
++ unsigned char c;
++ char buffer[9];
++ print("%s:\n", name);
++ buffer[8] = 0;
++ for (i = first; i <= last; i++) {
++ inSISIDXREG(base, i, c);
++ for (j = 0; j < 8; j++)
++ buffer[7 - j] = c & (1 << j) ? '1' : '0';
++ print("\t%02x: %02x:%s\n", i, c, buffer);
++ }
++ }
+
++ auto void print_range_int(char *name, int base, int first, int last) {
++ int i, j;
++ unsigned int l;
++ char buffer[33];
++ print("%s:\n", name);
++ buffer[32] = 0;
++ for (i = first; i <= last; i += 4) {
++ l = inSISREGL(base + i);
++ for (j = 0; j < 32; j++)
++ buffer[31 - j] = l & (1 << j) ? '1' : '0';
++ print("\t%02x: %08x:%s\n", i, l, buffer);
++ }
++ }
+
+-
+-
++ print_range_int ("PCI: CNF00 - CNF1B", pSiS->RelIO, 0x00, 0x1b);
++ print_range_int ("PCI: CNF2C - CNF47", pSiS->RelIO, 0x2C, 0x47);
++ print_range_int ("AGP: CNF50 - CNF5B", pSiS->RelIO, 0x50, 0x5B);
++ print_range ("CRT1: SR05 - SR12", SISSR, 0x05, 0x12);
++ print_range ("CRT1: SR13 - SR16 (reserved)", SISSR, 0x13, 0x16);
++ print ("CRT1: SR19 - SR1A (reserved)\n");
++ print_range ("CRT1: SR1B - SR3A", SISSR, 0x1b, 0x3a);
++ print ("CRT1: SR3B (reserved)\n");
++ print_range ("CRT1: SR3C - SR3F", SISSR, 0x3c, 0x3f);
++ print_range ("CRT1: CR19 - CR1A", SISCR, 0x19, 0x1a);
++ print ("CRT1: CR1B - CR27 (undocumented?)\n");
++ print_range ("CRT1: CR28 - CR2E", SISCR, 0x28, 0x2e);
++ print ("CRT1: CR2F (reserved)\n");
++ print_range ("VGA BIOS: CR30 - CR3F", SISCR, 0x30, 0x3f);
++ print_range ("CRT1: CR40 - CR43", SISCR, 0x40, 0x43);
++ print ("CRT1: CR44 - CR45 (reserved)\n");
++ print_range ("CRT1: CR46 - CR67", SISCR, 0x46, 0x67);
++ print ("CRT1: CR68 - CR6F (DRAM registers reserved for backward compatibility with 760)\n");
++ print ("CRT1: CR70 - CR77 (undocumented?)\n");
++ print_range ("SMA BIOS: CR78 - CR7F", SISCR, 0x78, 0x7f);
++ print_range_int ("CRT1: CR80 - CR9B", SISCR, 0x80, 0xb3);
++ print_range_int ("CRT1: CRC0 - CRF3", SISCR, 0xc0, 0xf3);
++ print_range ("CRT2: SIGNAL REGISTERS, PART1 00 - 45", SISPART1, 0x00, 0x45);
++ print_range ("CRT2: TV SIGNAL REGISTERS, PART2 00 - 4d", SISPART2, 0x00, 0x4d);
++ print_range ("CRT2: TV COPY PROTECTION, PART3 00 - 40", SISPART3, 0x00, 0x40);
++ print_range ("CRT2: SIGNAL REGISTERS, PART4 00 - 3A", SISPART4, 0x00, 0x3a);
++ print_range ("CRT2: PALETTE SIGNAL REGISTERS, PART5 00 - 00 (?)", SISPART5, 0x00, 0x00);
++#undef print
++}
+--- xf86-video-sis-0.9.1/src/sis_video.c.orig 2010-01-18 13:17:56.000000000 -0500
++++ xf86-video-sis-0.9.1/src/sis_video.c 2010-01-26 13:38:13.000000000 -0500
+@@ -129,6 +129,8 @@
+
+ #include "sis_video.h"
+
++extern void sis_print_registers(SISPtr pSiS);
++
+ void SiSInitMC(ScreenPtr pScreen);
+
+ /*********************************
+@@ -712,6 +714,8 @@ SISResetVideo(ScrnInfoPtr pScrn)
+ #ifdef SISMERGED
+ pPriv->mustresettap2 = TRUE;
+ #endif
++
++ sis_print_registers(pSiS);
+ }
+
+
diff --git a/x11/driver/xorg-video-sisimedia/files/xf86MapDomainMemory-pci_device_map_legacy.patch b/x11/driver/xorg-video-sisimedia/files/xf86MapDomainMemory-pci_device_map_legacy.patch
new file mode 100644
index 0000000000..7a39cf2df5
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/xf86MapDomainMemory-pci_device_map_legacy.patch
@@ -0,0 +1,205 @@
+diff -aur xf86-video-sis-0.9.1.pristine/configure.ac xf86-video-sis-0.9.1.new/configure.ac
+--- xf86-video-sis-0.9.1.pristine/configure.ac 2012-03-17 08:23:42.346308237 +1100
++++ xf86-video-sis-0.9.1.new/configure.ac 2012-03-17 08:40:04.821501949 +1100
+@@ -20,20 +20,26 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ(2.60)
+ AC_INIT([xf86-video-sis],
+ 0.9.1,
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+ xf86-video-sis)
+-
+ AC_CONFIG_SRCDIR([Makefile.am])
+ AM_CONFIG_HEADER([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
++# Initialize Automake
+ AM_INIT_AUTOMAKE([dist-bzip2])
+-
+ AM_MAINTAINER_MODE
+
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
++m4_ifndef([XORG_MACROS_VERSION],
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
++XORG_DEFAULT_OPTIONS
++
+ # Checks for programs.
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+@@ -66,7 +72,7 @@
+ HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
+ HAVE_XEXTPROTO_71="no")
+ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
+-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
++sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
+
+ # Checks for libraries.
+
+@@ -104,6 +110,19 @@
+ # technically this should be a configure flag. meh.
+ AC_DEFINE(XF86EXA, 1, [Build support for Exa])
+
++SAVE_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
++AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
++ [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
++ [#include "xorg-server.h"])
++CPPFLAGS="$SAVE_CPPFLAGS"
++
++if test "x$XSERVER_LIBPCIACCESS" = xyes; then
++ PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.12.901])
++ XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
++fi
++AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
++
+ AC_SUBST([DRI_CFLAGS])
+ AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_vga.c xf86-video-sis-0.9.1.new/src/sis_vga.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_vga.c 2012-03-17 08:23:42.329641291 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_vga.c 2012-03-17 08:28:25.020679715 +1100
+@@ -1740,8 +1740,8 @@
+
+ #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ #if XSERVER_LIBPCIACCESS
+- pSiS->VGAMemBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,
+- pSiS->PciInfo, pSiS->VGAMapPhys, pSiS->VGAMapSize);
++ (void) pci_device_map_legacy(pSiS->PciInfo, pSiS->VGAMapPhys, pSiS->VGAMapSize,
++ PCI_DEV_MAP_FLAG_WRITABLE, &pSiS->VGAMemBase);
+ #else
+ pSiS->VGAMemBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,
+ pSiS->PciTag, pSiS->VGAMapPhys, pSiS->VGAMapSize);
+@@ -1761,7 +1761,12 @@
+
+ if(pSiS->VGAMemBase == NULL) return;
+
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, pSiS->VGAMemBase, pSiS->VGAMapSize);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, pSiS->VGAMemBase, pSiS->VGAMapSize);
++#endif
++
+ pSiS->VGAMemBase = NULL;
+ }
+ #endif
+diff -daur xf86-video-sis-0.9.1.pristine/src/sis_driver.c xf86-video-sis-0.9.1.new/src/sis_driver.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_driver.c 2012-03-17 08:23:42.336308093 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_driver.c 2012-03-17 09:35:33.766316476 +1100
+@@ -6014,7 +6014,11 @@
+ if(pSiSEnt->MapCountIOPBase) {
+ pSiSEnt->MapCountIOPBase--;
+ if((pSiSEnt->MapCountIOPBase == 0) || (pSiSEnt->forceUnmapIOPBase)) {
+- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->IOPBase, 2048);
++#else
++ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
++#endif
+ pSiSEnt->IOPBase = NULL;
+ pSiSEnt->MapCountIOPBase = 0;
+ pSiSEnt->forceUnmapIOPBase = FALSE;
+@@ -6023,7 +6027,11 @@
+ }
+ } else {
+ #endif
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->IOPBase, 2048);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOPBase, 2048);
++#endif
+ pSiS->IOPBase = NULL;
+ #ifdef SISDUALHEAD
+ }
+@@ -6248,7 +6256,11 @@
+ if(pSiSEnt->MapCountIOBase) {
+ pSiSEnt->MapCountIOBase--;
+ if((pSiSEnt->MapCountIOBase == 0) || (pSiSEnt->forceUnmapIOBase)) {
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
++#endif
+ pSiSEnt->IOBase = NULL;
+ pSiSEnt->MapCountIOBase = 0;
+ pSiSEnt->forceUnmapIOBase = FALSE;
+@@ -6259,7 +6271,11 @@
+ if(pSiSEnt->MapCountIOBaseDense) {
+ pSiSEnt->MapCountIOBaseDense--;
+ if((pSiSEnt->MapCountIOBaseDense == 0) || (pSiSEnt->forceUnmapIOBaseDense)) {
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
++#endif
+ pSiSEnt->IOBaseDense = NULL;
+ pSiSEnt->MapCountIOBaseDense = 0;
+ pSiSEnt->forceUnmapIOBaseDense = FALSE;
+@@ -6270,7 +6286,11 @@
+ if(pSiSEnt->MapCountFbBase) {
+ pSiSEnt->MapCountFbBase--;
+ if((pSiSEnt->MapCountFbBase == 0) || (pSiSEnt->forceUnmapFbBase)) {
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
++#endif
+ pSiSEnt->FbBase = pSiSEnt->RealFbBase = NULL;
+ pSiSEnt->MapCountFbBase = 0;
+ pSiSEnt->forceUnmapFbBase = FALSE;
+@@ -6280,13 +6300,25 @@
+ }
+ } else {
+ #endif
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
++#endif
+ pSiS->IOBase = NULL;
+ #ifdef __alpha__
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
++#endif
+ pSiS->IOBaseDense = NULL;
+ #endif
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(pSiS->PciInfo, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
++#endif
+ pSiS->FbBase = pSiS->RealFbBase = NULL;
+ #ifdef SISDUALHEAD
+ }
+@@ -10940,7 +10972,13 @@
+
+ #ifdef SIS_USE_BIOS_SCRATCH
+ if(SISPTR(pScrn)->Primary) {
++
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_map_legacy(SISPTR(pScrn)->PciInfo, 0, 0x2000, 1, &base); // HA HA HA MAGIC NUMBER
++#else
+ base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000);
++#endif
++
+ if(!base) {
+ SISErrorLog(pScrn, "(Could not map BIOS scratch area)\n");
+ return ret;
+@@ -10953,7 +10991,11 @@
+ *(base + offset) = value;
+ }
+
++#if XSERVER_LIBPCIACCESS
++ (void) pci_device_unmap_legacy(SISPTR(pScrn)->PciInfo, base, 0x2000);
++#else
+ xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000);
++#endif
+ }
+ #endif
+ return ret;
diff --git a/x11/driver/xorg-video-sisimedia/files/xserver112.patch b/x11/driver/xorg-video-sisimedia/files/xserver112.patch
new file mode 100644
index 0000000000..f0dff46b5e
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/xserver112.patch
@@ -0,0 +1,12 @@
+diff -aur xf86-video-sis-0.9.1.pristine/src/sis_driver.c xf86-video-sis-0.9.1.new/src/sis_driver.c
+--- xf86-video-sis-0.9.1.pristine/src/sis_driver.c 2012-03-17 03:06:21.148507957 +1100
++++ xf86-video-sis-0.9.1.new/src/sis_driver.c 2012-03-17 03:18:57.373535928 +1100
+@@ -3278,7 +3278,7 @@
+ pSiS->pInt = NULL;
+
+ /* Save PCI Domain Base */
+-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
++#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) || GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 12
+ pSiS->IODBase = 0;
+ #else
+ pSiS->IODBase = pScrn->domainIOBase;
diff --git a/x11/driver/xorg-video-sisimedia/files/xserver19.patch b/x11/driver/xorg-video-sisimedia/files/xserver19.patch
new file mode 100644
index 0000000000..67ef6f585e
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/files/xserver19.patch
@@ -0,0 +1,30 @@
+Index: xf86-video-sis-0.9.1/src/sis_driver.c
+===================================================================
+--- xf86-video-sis-0.9.1.orig/src/sis_driver.c
++++ xf86-video-sis-0.9.1/src/sis_driver.c
+@@ -85,7 +85,6 @@
+ #include "shadowfb.h"
+ #include "fb.h"
+ #include "micmap.h"
+-#include "mibank.h"
+ #include "mipointer.h"
+ #include "mibstore.h"
+ #include "edid.h"
+Index: xf86-video-sis-0.9.1/src/sis_mergedfb.c
+===================================================================
+--- xf86-video-sis-0.9.1.orig/src/sis_mergedfb.c
++++ xf86-video-sis-0.9.1/src/sis_mergedfb.c
+@@ -2948,11 +2948,11 @@ SiSXineramaExtensionInit(ScrnInfoPtr pSc
+
+ while(SiSXineramaGeneration != serverGeneration) {
+
+- ClientType = CreateNewResourceType(SiSXineramaFreeClient);
++ ClientType = CreateNewResourceType(SiSXineramaFreeClient, "XineramaClient");
+ if(!ClientType)
+ break;
+
+- EventType = CreateNewResourceType(SiSXineramaFreeEvents);
++ EventType = CreateNewResourceType(SiSXineramaFreeEvents, "XineramaEvents");
+ if(!EventType)
+ break;
+
diff --git a/x11/driver/xorg-video-sisimedia/pspec.xml b/x11/driver/xorg-video-sisimedia/pspec.xml
new file mode 100644
index 0000000000..bc85ebe157
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/pspec.xml
@@ -0,0 +1,130 @@
+
+
+
+
+ xorg-video-sisimedia
+ http://www.linuxconsulting.ro/xorg-drivers
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org sisimedia video driver
+ xorg-video-sisimedia contains the X.Org driver for SiS 670 / 671 cards.
+ ftp://ftp.archlinux.org/other/xf86-video-sisimedia/xf86-video-sisimedia-0.9.1_20091203.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+ xf86-video-sis-0.9.1-20102701.patch
+ 0002-Remove-XFree86-Misc-PassMessage-support.patch
+ 0007-Remove-useless-loader-symbol-lists.patch
+ Untangle-XF86DRI.patch
+ disable-UploadToScreen-DownloadFromScreen.patch
+ swap-func-rename.patch
+ 0003-Fix-build-with-Werror-format-security.patch
+ 0005-Fix-backlight-off-on-SiS30x.-video-bridges.patch
+ 0006-Add-IgnoreHotkeyFlag-driver-option.patch
+ xf86-video-sis-0.9.1-dump-regs-after-video-init.patch
+ 0008-update-to-xextproto-7-1-support.patch
+ 0009-update-for-rac-removal.patch
+ 0010-change-to-use-abi-version-check.patch
+ 0011-more-rac-removal.patch
+ 0001-Remove-xorgconfig-xorgcfg-from-See-Also-list-in-man-.patch
+ 0004-Make-sisRegs3D4-big-enough-to-hold-all-values-writte.patch
+ 0005-Correct-bounds-check-of-blitClip-array-access.patch
+ xserver19.patch
+ xserver112.patch
+ pciTag-removal-workaround.patch
+ xf86MapDomainMemory-pci_device_map_legacy.patch
+ sync-with-freedesktop.patch
+ remove_mibstore.h.patch
+ deprecated-sym2.patch
+ sisimedia-no-xaa.patch
+ sisimedia-xorg-1.13.patch
+
+
+
+
+ xorg-video-sisimedia
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/X11
+
+
+ sisimedia.ids
+
+
+
+
+
+ 2015-05-08
+ 0.9.1
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 0.9.1
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.9.1
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.9.1
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 0.9.1
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 0.9.1
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.9.1
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 0.9.1
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-01-30
+ 0.10.7
+ First release
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-sisimedia/translations.xml b/x11/driver/xorg-video-sisimedia/translations.xml
new file mode 100644
index 0000000000..d39a70a3f1
--- /dev/null
+++ b/x11/driver/xorg-video-sisimedia/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-sisimedia
+ X.Org sisimedia ekran kartı sürücüsü
+ xorg-video-sisimedia, SiS 670 / 671 ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-sisusb/actions.py b/x11/driver/xorg-video-sisusb/actions.py
new file mode 100644
index 0000000000..1ff0abfd46
--- /dev/null
+++ b/x11/driver/xorg-video-sisusb/actions.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+WorkDir = "xf86-video-sisusb-%s" % get.srcVERSION()
+
+def setup():
+ autotools.configure()
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-sisusb/files/git-fixes.patch b/x11/driver/xorg-video-sisusb/files/git-fixes.patch
new file mode 100644
index 0000000000..dc920dabdc
--- /dev/null
+++ b/x11/driver/xorg-video-sisusb/files/git-fixes.patch
@@ -0,0 +1,29 @@
+From 293d0902705c272b83432a955fb6a3c96dd6cea7 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:54:52 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/sisusb_driver.c b/src/sisusb_driver.c
+index 539b9f1..0fdc8e9 100644
+--- a/src/sisusb_driver.c
++++ b/src/sisusb_driver.c
+@@ -39,7 +39,6 @@
+ #include "shadowfb.h"
+ #include "micmap.h"
+ #include "mipointer.h"
+-#include "mibstore.h"
+
+ #include "sisusb_regs.h"
+ #include "sisusb_dac.h"
+@@ -1907,7 +1906,6 @@ SISUSBScreenInit(SCREEN_INIT_ARGS_DECL)
+ /* Initialize the accelerators */
+ SiSUSBAccelInit(pScreen);
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+
+ /* NO SilkenMouse. Never. Ever. */
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-sisusb/pspec.xml b/x11/driver/xorg-video-sisusb/pspec.xml
new file mode 100644
index 0000000000..0407c98255
--- /dev/null
+++ b/x11/driver/xorg-video-sisusb/pspec.xml
@@ -0,0 +1,102 @@
+
+
+
+
+ xorg-video-sisusb
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org sisusb video driver
+ xorg-video-sisusb contains the X.Org driver for SiS video chips connected via a Net2280-based USB dongle.
+ mirrors://xorg/individual/driver/xf86-video-sisusb-0.9.6.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fixes.patch
+
+
+
+
+
+ xorg-video-sisusb
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 0.9.6
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 0.9.6
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.9.6
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.9.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 0.9.6
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 0.9.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.9.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 0.9.6
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 0.9.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-sisusb/translations.xml b/x11/driver/xorg-video-sisusb/translations.xml
new file mode 100644
index 0000000000..649380df6f
--- /dev/null
+++ b/x11/driver/xorg-video-sisusb/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-sisusb
+ X.Org sisusb ekran kartı sürücüsü
+ xorg-video-sisusb, Net2280 tabanlı USB dongle ile bağlı SiS ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-tdfx/actions.py b/x11/driver/xorg-video-tdfx/actions.py
new file mode 100644
index 0000000000..7127310587
--- /dev/null
+++ b/x11/driver/xorg-video-tdfx/actions.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import shelltools
+
+def setup():
+ autotools.configure("\
+ --disable-static \
+ --disable-dri \
+ ")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-tdfx/pspec.xml b/x11/driver/xorg-video-tdfx/pspec.xml
new file mode 100644
index 0000000000..7e699f3758
--- /dev/null
+++ b/x11/driver/xorg-video-tdfx/pspec.xml
@@ -0,0 +1,107 @@
+
+
+
+
+ xorg-video-tdfx
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org tdfx video driver
+ xorg-video-tdfx contains the X.Org driver for Voodoo cards.
+ mirrors://xorg/individual/driver/xf86-video-tdfx-1.4.6.tar.bz2
+
+ libdrm-devel
+ mesa-devel
+ xorg-server-devel
+
+
+
+
+ xorg-video-tdfx
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 1.4.6
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.4.5
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.4.5
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.4.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.4.5
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.4.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.4.5
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.4.5
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.4.5
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-12
+ 1.4.5
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-tdfx/translations.xml b/x11/driver/xorg-video-tdfx/translations.xml
new file mode 100644
index 0000000000..19a3568c87
--- /dev/null
+++ b/x11/driver/xorg-video-tdfx/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-tdfx
+ X.Org tdfx ekran kartı sürücüsü
+ xorg-video-tdfx, Voodoo ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-tga/actions.py b/x11/driver/xorg-video-tga/actions.py
new file mode 100644
index 0000000000..e77e59a7e3
--- /dev/null
+++ b/x11/driver/xorg-video-tga/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure()
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-tga/files/xf86-video-tga-1.2.2-remove-mibstore_h.patch b/x11/driver/xorg-video-tga/files/xf86-video-tga-1.2.2-remove-mibstore_h.patch
new file mode 100644
index 0000000000..8114441475
--- /dev/null
+++ b/x11/driver/xorg-video-tga/files/xf86-video-tga-1.2.2-remove-mibstore_h.patch
@@ -0,0 +1,42 @@
+From b7022db0559cd1b6cd3eb6b5abf6896a607b478d Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 12:55:00 +0000
+Subject: Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+diff --git a/src/tga_accel.c b/src/tga_accel.c
+index 35af1a4..b414df5 100644
+--- a/src/tga_accel.c
++++ b/src/tga_accel.c
+@@ -37,7 +37,6 @@
+ #include "xf86cmap.h"
+ #include "mipointer.h"
+
+-#include "mibstore.h"
+ #include "miline.h"
+
+ #include "tga_regs.h"
+diff --git a/src/tga_driver.c b/src/tga_driver.c
+index dd4f3e6..90d2660 100644
+--- a/src/tga_driver.c
++++ b/src/tga_driver.c
+@@ -46,8 +46,6 @@
+
+ /* software cursor */
+ #include "mipointer.h"
+-/* backing store */
+-#include "mibstore.h"
+
+ /* #include "mibank.h" */
+ /* colormap manipulation */
+@@ -1451,7 +1449,6 @@ TGAScreenInit(SCREEN_INIT_ARGS_DECL)
+
+ fbPictureInit (pScreen, 0, 0);
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11/driver/xorg-video-tga/pspec.xml b/x11/driver/xorg-video-tga/pspec.xml
new file mode 100644
index 0000000000..beeb2f09e9
--- /dev/null
+++ b/x11/driver/xorg-video-tga/pspec.xml
@@ -0,0 +1,100 @@
+
+
+
+
+ xorg-video-tga
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org tga video driver
+ xorg-video-tga contains the X.Org driver for DEC Tga cards.
+ mirrors://xorg/individual/driver/xf86-video-tga-1.2.2.tar.bz2
+
+ xorg-server-devel
+
+
+ xf86-video-tga-1.2.2-remove-mibstore_h.patch
+
+
+
+
+ xorg-video-tga
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+
+
+
+
+
+ 2015-05-08
+ 1.2.2
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.2.2
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.2.2
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.2.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.2.2
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.2.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.2.2
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.2.2
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-12
+ 1.2.2
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-tga/translations.xml b/x11/driver/xorg-video-tga/translations.xml
new file mode 100644
index 0000000000..552e2ca7d1
--- /dev/null
+++ b/x11/driver/xorg-video-tga/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-tga
+ X.Org tga ekran kartı sürücüsü
+ xorg-video-tga, DEC Tga ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-trident/actions.py b/x11/driver/xorg-video-trident/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-trident/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-trident/files/0001-Remove-mibstore.h.patch b/x11/driver/xorg-video-trident/files/0001-Remove-mibstore.h.patch
new file mode 100644
index 0000000000..e8d43d7456
--- /dev/null
+++ b/x11/driver/xorg-video-trident/files/0001-Remove-mibstore.h.patch
@@ -0,0 +1,33 @@
+From 30787294c837aefa8820b6f76f00fe30d4e54181 Mon Sep 17 00:00:00 2001
+From: Adam Jackson
+Date: Tue, 25 Sep 2012 08:55:01 -0400
+Subject: [PATCH 1/2] Remove mibstore.h
+
+Signed-off-by: Adam Jackson
+---
+ src/trident_driver.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/trident_driver.c b/src/trident_driver.c
+index dc12b76..408c870 100644
+--- a/src/trident_driver.c
++++ b/src/trident_driver.c
+@@ -56,7 +56,6 @@
+
+ #include "mipointer.h"
+
+-#include "mibstore.h"
+ #include "shadow.h"
+ #include "trident.h"
+ #include "trident_regs.h"
+@@ -3037,7 +3036,6 @@ TRIDENTScreenInit(SCREEN_INIT_ARGS_DECL)
+ TridentAccelInit(pScreen);
+ }
+
+- miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+
+ /* Initialise cursor functions */
+--
+1.8.0.2
+
diff --git a/x11/driver/xorg-video-trident/files/0002-Fix-loading-the-driver-without-XAA.patch b/x11/driver/xorg-video-trident/files/0002-Fix-loading-the-driver-without-XAA.patch
new file mode 100644
index 0000000000..4720ff9750
--- /dev/null
+++ b/x11/driver/xorg-video-trident/files/0002-Fix-loading-the-driver-without-XAA.patch
@@ -0,0 +1,38 @@
+From 48c15909691e28ad2c188a2978b1c8ef3d9d8760 Mon Sep 17 00:00:00 2001
+From: Timo Aaltonen
+Date: Wed, 26 Sep 2012 11:01:26 +0300
+Subject: [PATCH 2/2] Fix loading the driver without XAA
+
+---
+ src/trident_dga.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/trident_dga.c b/src/trident_dga.c
+index 0263aa7..c4b5b9a 100644
+--- a/src/trident_dga.c
++++ b/src/trident_dga.c
+@@ -37,10 +37,10 @@
+ static Bool TRIDENT_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
+ int *, int *, int *);
+ static Bool TRIDENT_SetMode(ScrnInfoPtr, DGAModePtr);
+-static void TRIDENT_Sync(ScrnInfoPtr);
+ static int TRIDENT_GetViewport(ScrnInfoPtr);
+ static void TRIDENT_SetViewport(ScrnInfoPtr, int, int, int);
+ #ifdef HAVE_XAA_H
++static void TRIDENT_Sync(ScrnInfoPtr);
+ static void TRIDENT_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
+ static void TRIDENT_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+ #if 0
+@@ -56,8 +56,8 @@ DGAFunctionRec TRIDENTDGAFuncs = {
+ TRIDENT_SetMode,
+ TRIDENT_SetViewport,
+ TRIDENT_GetViewport,
+- TRIDENT_Sync,
+ #ifdef HAVE_XAA_H
++ TRIDENT_Sync,
+ TRIDENT_FillRect,
+ TRIDENT_BlitRect,
+ #if 0
+--
+1.8.0.2
+
diff --git a/x11/driver/xorg-video-trident/pspec.xml b/x11/driver/xorg-video-trident/pspec.xml
new file mode 100644
index 0000000000..2aa652d469
--- /dev/null
+++ b/x11/driver/xorg-video-trident/pspec.xml
@@ -0,0 +1,105 @@
+
+
+
+
+ xorg-video-trident
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org trident video driver
+ xorg-video-trident contains the X.Org driver for Trident cards.
+ mirrors://xorg/individual/driver/xf86-video-trident-1.3.7.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+ xorg-video-trident
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 1.3.7
+ Version bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.3.6
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.3.6
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.3.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.3.6
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.3.6
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.3.6
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.3.6
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 1.3.6
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-12
+ 1.3.6
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-trident/translations.xml b/x11/driver/xorg-video-trident/translations.xml
new file mode 100644
index 0000000000..ddc18e2545
--- /dev/null
+++ b/x11/driver/xorg-video-trident/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-trident
+ X.Org trident ekran kartı sürücüsü
+ xorg-video-trident, Trident ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-v4l/actions.py b/x11/driver/xorg-video-v4l/actions.py
new file mode 100644
index 0000000000..8bb03e06f7
--- /dev/null
+++ b/x11/driver/xorg-video-v4l/actions.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.autoreconf("-vif")
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "README")
diff --git a/x11/driver/xorg-video-v4l/files/git-fixes.patch b/x11/driver/xorg-video-v4l/files/git-fixes.patch
new file mode 100644
index 0000000000..2f752fc8c7
--- /dev/null
+++ b/x11/driver/xorg-video-v4l/files/git-fixes.patch
@@ -0,0 +1,4362 @@
+diff --git a/ChangeLog b/ChangeLog
+deleted file mode 100644
+index 02fc6fa..0000000
+--- a/ChangeLog
++++ /dev/null
+@@ -1,57 +0,0 @@
+-2006-04-07 Adam Jackson
+-
+- * configure.ac:
+- * src/v4l.c:
+- Bump to 0.1.1 for Xv changes.
+-
+-2006-04-07 Aaron Plattner
+-
+- * src/v4l.c: (V4lPutVideo), (V4lPutStill):
+- Add a DrawablePtr argument to the XV functions to pave the way for
+- redirected video.
+-
+-2006-04-07 Adam Jackson
+-
+- * configure.ac:
+- * src/v4l.c:
+- Unlibcwrap. Bump server version requirement. Bump to 0.1.0.
+-
+-2005-12-20 Kevin E. Martin
+-
+- * configure.ac:
+- Update package version for X11R7 release.
+-
+-2005-12-14 Kevin E. Martin
+-
+- * configure.ac:
+- Update package version number for final X11R7 release candidate.
+-
+-2005-12-06 Kevin E. Martin
+-
+- * man/Makefile.am:
+- Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
+-
+-2005-12-03 Kevin E. Martin
+-
+- * configure.ac:
+- Update package version number for X11R7 RC3 release.
+-
+-2005-12-01 Kevin E. Martin
+-
+- * configure.ac:
+- Remove extraneous AC_MSG_RESULT.
+-
+-2005-11-29 Adam Jackson
+-
+- * configure.ac:
+- Only build dlloader modules by default.
+-
+-2005-11-09 Kevin E. Martin
+-
+- * configure.ac:
+- Update package version number for X11R7 RC2 release.
+-
+-2005-11-01 Kevin E. Martin
+-
+- * configure.ac:
+- Update pkgcheck dependencies to work with separate build roots.
+diff --git a/Makefile.am b/Makefile.am
+index 3ae2692..4c278ba 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -18,6 +18,15 @@
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = src man
+-EXTRA_DIST = README
++MAINTAINERCLEANFILES = ChangeLog INSTALL
++
++.PHONY: ChangeLog INSTALL
++
++INSTALL:
++ $(INSTALL_CMD)
++
++ChangeLog:
++ $(CHANGELOG_CMD)
++
++dist-hook: ChangeLog INSTALL
+diff --git a/configure.ac b/configure.ac
+index d9ac542..c490919 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,57 +20,56 @@
+ #
+ # Process this file with autoconf to produce a configure script
+
+-AC_PREREQ(2.57)
++# Initialize Autoconf
++AC_PREREQ([2.60])
+ AC_INIT([xf86-video-v4l],
+- 0.2.0,
++ [0.2.0],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+- xf86-video-v4l)
+-
++ [xf86-video-v4l])
+ AC_CONFIG_SRCDIR([Makefile.am])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_AUX_DIR(.)
+
+-AM_INIT_AUTOMAKE([dist-bzip2])
+-
++# Initialize Automake
++AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ AM_MAINTAINER_MODE
+
+-# Checks for programs.
++# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
++m4_ifndef([XORG_MACROS_VERSION],
++ [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
++XORG_MACROS_VERSION(1.8)
++XORG_DEFAULT_OPTIONS
++
++# Initialize libtool
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+-AC_PROG_CC
+
+ AH_TOP([#include "xorg-server.h"])
+
++# Define a configure option for an alternate module directory
+ AC_ARG_WITH(xorg-module-dir,
+- AC_HELP_STRING([--with-xorg-module-dir=DIR],
++ AS_HELP_STRING([--with-xorg-module-dir=DIR],
+ [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+ [moduledir="$withval"],
+ [moduledir="$libdir/xorg/modules"])
+
+-# Checks for extensions
++# Store the list of server defined optional extensions in REQUIRED_MODULES
+ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+ XORG_DRIVER_CHECK_EXT(XV, videoproto)
+
+-# Checks for pkg-config packages
++# Obtain compiler/linker options for the driver dependencies
+ PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto $REQUIRED_MODULES])
+-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+
+ # Checks for libraries.
+
+-# Checks for header files.
+-AC_HEADER_STDC
+-
+-AC_SUBST([XORG_CFLAGS])
+ AC_SUBST([moduledir])
+
+ DRIVER_NAME=v4l
+ AC_SUBST([DRIVER_NAME])
+
+-XORG_MANPAGE_SECTIONS
+-XORG_RELEASE_VERSION
+-
+-AC_OUTPUT([
+- Makefile
+- src/Makefile
+- man/Makefile
++AC_CONFIG_FILES([
++ Makefile
++ src/Makefile
++ man/Makefile
+ ])
++AC_OUTPUT
+diff --git a/man/Makefile.am b/man/Makefile.am
+index f0eb29b..b3688ce 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -1,27 +1,24 @@
+ #
+ # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+-#
+-# Permission to use, copy, modify, distribute, and sell this software and its
+-# documentation for any purpose is hereby granted without fee, provided that
+-# the above copyright notice appear in all copies and that both that
+-# copyright notice and this permission notice appear in supporting
+-# documentation.
+-#
+-# The above copyright notice and this permission notice shall be included
+-# in all copies or substantial portions of the Software.
+-#
+-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+-# IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+-# OTHER DEALINGS IN THE SOFTWARE.
+-#
+-# Except as contained in this notice, the name of the copyright holders shall
+-# not be used in advertising or otherwise to promote the sale, use or
+-# other dealings in this Software without prior written authorization
+-# from the copyright holders.
++#
++# Permission is hereby granted, free of charge, to any person obtaining a
++# copy of this software and associated documentation files (the "Software"),
++# to deal in the Software without restriction, including without limitation
++# the rights to use, copy, modify, merge, publish, distribute, sublicense,
++# and/or sell copies of the Software, and to permit persons to whom the
++# Software is furnished to do so, subject to the following conditions:
++#
++# The above copyright notice and this permission notice (including the next
++# paragraph) shall be included in all copies or substantial portions of the
++# Software.
++#
++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++# DEALINGS IN THE SOFTWARE.
+ #
+
+ drivermandir = $(DRIVER_MAN_DIR)
+@@ -34,25 +31,11 @@ EXTRA_DIST = @DRIVER_NAME@.man
+
+ CLEANFILES = $(driverman_DATA)
+
+-SED = sed
+
+-# Strings to replace in man pages
+-XORGRELSTRING = @PACKAGE_STRING@
+- XORGMANNAME = X Version 11
++# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+
+-MAN_SUBSTS = \
+- -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+- -e 's|__xservername__|Xorg|g' \
+- -e 's|__xconfigfile__|xorg.conf|g' \
+- -e 's|__projectroot__|$(prefix)|g' \
+- -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+- -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
+- -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+- -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+- -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+ SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+ .man.$(DRIVER_MAN_SUFFIX):
+- sed $(MAN_SUBSTS) < $< > $@
++ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+diff --git a/man/v4l.man b/man/v4l.man
+index 7d35b86..dc1e201 100644
+--- a/man/v4l.man
++++ b/man/v4l.man
+@@ -34,6 +34,6 @@ Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+ details. This section only covers configuration details specific to this
+ driver.
+ .SH "SEE ALSO"
+-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
++__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+ .SH AUTHORS
+ Authors include: Gerd Knorr
+diff --git a/src/Makefile.am b/src/Makefile.am
+index ed30a80..08afe60 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -28,7 +28,6 @@ v4l_drv_la_LTLIBRARIES = v4l_drv.la
+ v4l_drv_la_LDFLAGS = -module -avoid-version
+ v4l_drv_ladir = @moduledir@/drivers
+
+-v4l_drv_la_SOURCES = \
+- v4l.c
+-
+-EXTRA_DIST = videodev.h
++v4l_drv_la_SOURCES = \
++ v4l.c \
++ videodev.h
+diff --git a/src/v4l.c b/src/v4l.c
+index b827f80..10e782b 100644
+--- a/src/v4l.c
++++ b/src/v4l.c
+@@ -1,6 +1,9 @@
+ /*
+- * video4linux Xv Driver
++ * video4linux Xv Driver
+ * based on Michael Schimek's permedia 2 driver.
++ *
++ * Copyright (c) 2011 Mauro Carvalho Chehab for:
++ * - Major rewrite, as driver got ported to V4L2 API
+ */
+
+ #ifdef HAVE_CONFIG_H
+@@ -9,12 +12,16 @@
+
+ #include
+ #include
++#include
++
+ #include
+ #include
+ #include
+ #include
++#include
++#include
+
+-#include "videodev.h"
++#include "videodev2.h"
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+ #include "xf86Pci.h"
+@@ -25,8 +32,9 @@
+ #include "regionstr.h"
+ #include "dgaproc.h"
+ #include "xf86str.h"
++#include "fourcc.h"
+
+-#include /* _IORW(xxx) #defines are here */
++#include /* _IORW(xxx) #defines are here */
+
+ #if 0
+ # define DEBUG(x) (x)
+@@ -34,20 +42,22 @@
+ # define DEBUG(x)
+ #endif
+
++/***************************************************************************/
++
+ static void V4LIdentify(int flags);
+ static Bool V4LProbe(DriverPtr drv, int flags);
+ static const OptionInfoRec * V4LAvailableOptions(int chipid, int busid);
+
+ _X_EXPORT DriverRec V4L = {
+- 40000,
+- "v4l",
+- V4LIdentify, /* Identify*/
+- V4LProbe, /* Probe */
+- V4LAvailableOptions,
+- NULL,
+- 0
+-};
+-
++ .driverVersion = 50000,
++ .driverName = "v4l",
++ .Identify = V4LIdentify,
++ .Probe = V4LProbe,
++ .AvailableOptions = V4LAvailableOptions,
++ .module = NULL,
++ .refCount = 0,
++ .driverFunc = NULL, /* FIXME: Need to implement for new probing mode */
++};
+
+ #ifdef XFree86LOADER
+
+@@ -55,16 +65,16 @@ static MODULESETUPPROTO(v4lSetup);
+
+ static XF86ModuleVersionInfo v4lVersRec =
+ {
+- "v4l",
+- MODULEVENDORSTRING,
+- MODINFOSTRING1,
+- MODINFOSTRING2,
+- XORG_VERSION_CURRENT,
+- 0, 1, 1,
+- ABI_CLASS_VIDEODRV,
+- ABI_VIDEODRV_VERSION,
+- MOD_CLASS_NONE,
+- {0,0,0,0}
++ "v4l",
++ MODULEVENDORSTRING,
++ MODINFOSTRING1,
++ MODINFOSTRING2,
++ XORG_VERSION_CURRENT,
++ 0, 1, 1,
++ ABI_CLASS_VIDEODRV,
++ ABI_VIDEODRV_VERSION,
++ MOD_CLASS_NONE,
++ {0,0,0,0}
+ };
+
+ _X_EXPORT XF86ModuleData v4lModuleData = { &v4lVersRec, v4lSetup, NULL };
+@@ -72,32 +82,32 @@ _X_EXPORT XF86ModuleData v4lModuleData = { &v4lVersRec, v4lSetup, NULL };
+ static pointer
+ v4lSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ {
+- const char *osname;
+- static Bool setupDone = FALSE;
+-
+- if (setupDone) {
+- if (errmaj)
+- *errmaj = LDR_ONCEONLY;
+- return NULL;
+- }
+-
+- setupDone = TRUE;
+-
+- /* Check that we're being loaded on a Linux system */
+- LoaderGetOS(&osname, NULL, NULL, NULL);
+- if (!osname || strcmp(osname, "linux") != 0) {
+- if (errmaj)
+- *errmaj = LDR_BADOS;
+- if (errmin)
+- *errmin = 0;
+- return NULL;
+- } else {
+- /* OK */
+-
+- xf86AddDriver (&V4L, module, 0);
+-
+- return (pointer)1;
+- }
++ const char *osname;
++ static Bool setupDone = FALSE;
++
++ if (setupDone) {
++ if (errmaj)
++ *errmaj = LDR_ONCEONLY;
++ return NULL;
++ }
++
++ setupDone = TRUE;
++
++ /* Check that we're being loaded on a Linux system */
++ LoaderGetOS(&osname, NULL, NULL, NULL);
++ if (!osname || strcmp(osname, "linux") != 0) {
++ if (errmaj)
++ *errmaj = LDR_BADOS;
++ if (errmin)
++ *errmin = 0;
++ return NULL;
++ } else {
++ /* OK */
++
++ xf86AddDriver (&V4L, module, 0);
++
++ return (pointer)1;
++ }
+ }
+
+ #else
+@@ -112,25 +122,28 @@ v4lSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ #define VIDEO_YUV 2 /* yuv overlay (to offscreen memory + hw scaling) */
+ #define VIDEO_RECLIP 3 /* temporarly off, window clipping changes */
+
++typedef struct _XvV4LCtrlRec {
++ struct v4l2_queryctrl qctrl;
++ Atom xv;
++} XvV4LCtrlRec, *XvV4LCtrlPtr;
++
+ typedef struct _PortPrivRec {
+ ScrnInfoPtr pScrn;
+- FBAreaPtr pFBArea[2];
+- int VideoOn;
+- Bool StreamOn;
++ FBAreaPtr pFBArea[2];
++ int VideoOn;
++ Bool StreamOn;
+
+ /* file handle */
+- int nr;
+- struct video_capability cap;
++ int nr;
++ struct v4l2_capability cap;
+
+ /* RGB overlay */
+- struct video_buffer rgb_fbuf;
+- struct video_window rgb_win;
+- int rgbpalette;
++ struct v4l2_framebuffer rgb_fbuf;
++ struct v4l2_window rgb_win;
+ int rgbdepth;
+
+ /* attributes */
+- struct video_picture pict;
+- struct video_audio audio;
++ CARD32 pixelformat;
+
+ XF86VideoEncodingPtr enc;
+ int *input;
+@@ -145,24 +158,21 @@ typedef struct _PortPrivRec {
+
+ int yuv_width,yuv_height;
+ XF86SurfacePtr surface;
+- struct video_buffer yuv_fbuf;
+- struct video_window yuv_win;
+-} PortPrivRec, *PortPrivPtr;
++ struct v4l2_framebuffer yuv_fbuf;
++ struct v4l2_window yuv_win;
++
++ struct v4l2_standard *standard; /* FIXME: can be removed */
+
+-#define XV_ENCODING "XV_ENCODING"
+-#define XV_BRIGHTNESS "XV_BRIGHTNESS"
+-#define XV_CONTRAST "XV_CONTRAST"
+-#define XV_SATURATION "XV_SATURATION"
+-#define XV_HUE "XV_HUE"
++ XvV4LCtrlPtr XvV4LCtrl;
++ int n_qctrl;
++} PortPrivRec, *PortPrivPtr;
+
+-#define XV_FREQ "XV_FREQ"
+-#define XV_MUTE "XV_MUTE"
+-#define XV_VOLUME "XV_VOLUME"
++#define XV_ENCODING "XV_ENCODING"
++#define XV_FREQ "XV_FREQ"
+
+-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
++#define MAKE_ATOM(a) MakeAtom(a, strlen(a), TRUE)
+
+-static Atom xvEncoding, xvBrightness, xvContrast, xvSaturation, xvHue;
+-static Atom xvFreq, xvMute, xvVolume;
++static Atom xvEncoding, xvFreq;
+
+ static XF86VideoFormatRec
+ InputVideoFormats[] = {
+@@ -176,16 +186,8 @@ InputVideoFormats[] = {
+
+ static const XF86AttributeRec Attributes[] = {
+ {XvSettable | XvGettable, -1000, 1000, XV_ENCODING},
+- {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS},
+- {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST},
+- {XvSettable | XvGettable, -1000, 1000, XV_SATURATION},
+- {XvSettable | XvGettable, -1000, 1000, XV_HUE},
+ };
+-static const XF86AttributeRec VolumeAttr =
+- {XvSettable | XvGettable, -1000, 1000, XV_VOLUME};
+-static const XF86AttributeRec MuteAttr =
+- {XvSettable | XvGettable, 0, 1, XV_MUTE};
+-static const XF86AttributeRec FreqAttr =
++static const XF86AttributeRec FreqAttr =
+ {XvSettable | XvGettable, 0, 16*1000, XV_FREQ};
+
+
+@@ -206,59 +208,247 @@ static struct V4L_DEVICE {
+ };
+
+ /* ---------------------------------------------------------------------- */
+-/* forward decl */
+
+-static void V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+- short vid_w, short vid_h, short drw_w, short drw_h,
+- unsigned int *p_w, unsigned int *p_h, pointer data);
++static int SetV4LFmt(int fd, CARD32 pixelformat)
++{
++ struct v4l2_framebuffer fbuf;
++ char *p = (char *)&pixelformat;
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ if (fbuf.fmt.pixelformat != pixelformat) {
++ fbuf.fmt.pixelformat = pixelformat;
++ if (ioctl(fd, VIDIOC_S_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't set FBUF to %c%c%c%c\n",
++ errno, p[0], p[1], p[2], p[3]);
++ return errno;
++ }
++ }
++ DEBUG(xf86Msg(X_INFO, "v4l: Set overlay format to %c%c%c%c\n",
++ p[0], p[1], p[2], p[3]));
++ return 0;
++}
++static int GetV4LFmt(int fd, CARD32 *pixelformat)
++{
++ struct v4l2_framebuffer fbuf;
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++
++ *pixelformat = fbuf.fmt.pixelformat;
++
++ return 0;
++}
++
++#define ATTR_NAME_PREFIX "XV_"
++static int AddControl(PortPrivPtr p, XF86AttributeRec **list, int *count,
++ struct v4l2_queryctrl *qctrl, int *n)
++{
++ char *ptr;
++
++/* v4l_add_attr */
++ if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED)
++ return 0;
++ switch (qctrl->type) {
++ case V4L2_CTRL_TYPE_INTEGER:
++ case V4L2_CTRL_TYPE_BOOLEAN:
++ case V4L2_CTRL_TYPE_MENU:
++ case V4L2_CTRL_TYPE_BUTTON:
++ break;
++ default:
++ return 0;
++ }
++
++ p->XvV4LCtrl = realloc(p->XvV4LCtrl, sizeof(XvV4LCtrlRec) * (*n + 1));
++ if (!p->XvV4LCtrl) {
++ if (*list) {
++ free (*list);
++ *count = 0;
++ *n = 0;
++ }
++ return -1;
++ }
++
++ *list = realloc(*list, sizeof(XF86AttributeRec) * (*count + 1));
++ if (NULL == *list) {
++ if (p->XvV4LCtrl)
++ free (p->XvV4LCtrl);
++ *count = 0;
++ return -1;
++ }
++
++ memset(*list + *count, 0, sizeof(XF86AttributeRec));
++ (*list)[*count].flags = XvSettable | XvGettable;
++
++ if (qctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
++ (*list)[*count].flags &= ~XvSettable;
++ if (qctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
++ (*list)[*count].flags &= ~XvGettable;
++ (*list)[*count].min_value = qctrl->minimum;
++ (*list)[*count].max_value = qctrl->maximum;
++ (*list)[*count].name = malloc(strlen((char *)qctrl->name) + 1 + sizeof (ATTR_NAME_PREFIX));
++ strcpy((*list)[*count].name, ATTR_NAME_PREFIX);
++ strcat((*list)[*count].name, (char *)qctrl->name);
++ for (ptr = (*list)[*count].name; *ptr; ptr++) {
++ *ptr = toupper(*ptr);
++ if (*ptr == ' ')
++ *ptr = '_';
++ }
++
++ p->XvV4LCtrl[*n].xv = MAKE_ATOM((*list)[*count].name);
++ memcpy(&p->XvV4LCtrl[*n].qctrl, qctrl, sizeof(*qctrl));
++
++ xf86Msg(X_INFO, "v4l: add attr %s (Xv/GPA %d) (%d to %d)\n",
++ (*list)[*count].name, (int)p->XvV4LCtrl[*n].xv,
++ p->XvV4LCtrl[*n].qctrl.minimum,
++ p->XvV4LCtrl[*n].qctrl.maximum);
++
++ (*count)++;
++ (*n)++;
++
++ return 0;
++}
++
++static void AddAllV4LControls(PortPrivPtr p, XF86AttributeRec **list,
++ int *count, int fd)
++{
++ int entries = 0;
++ CARD32 id;
++ struct v4l2_queryctrl qctrl;
++
++ memset(&qctrl, 0, sizeof(qctrl));
++ qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
++ while (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
++ }
++ if (qctrl.id != V4L2_CTRL_FLAG_NEXT_CTRL)
++ return;
++ for (id = V4L2_CID_USER_BASE; id < V4L2_CID_LASTP1; id++) {
++ qctrl.id = id;
++ if (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ }
++ }
++ qctrl.id = V4L2_CID_PRIVATE_BASE;
++ while (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ qctrl.id++;
++ }
++ p->n_qctrl = entries;
++}
+
+ /* ---------------------------------------------------------------------- */
+
++/* setup yuv overlay + hw scaling: look if we find some common video
++ format which both v4l driver and the X-Server can handle */
++static int v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
++ char *dev, int fd)
++{
++ static const struct {
++ CARD32 v4l_palette;
++ unsigned int xv_id;
++ unsigned int xv_format;
++ } yuvlist[] = {
++ { V4L2_PIX_FMT_YUYV, FOURCC_YUY2, XvPacked },
++ { V4L2_PIX_FMT_UYVY, FOURCC_UYVY, XvPacked },
++ { 0 /* end of list */ },
++ };
++ /* FIXME: Why pScrn->scrnIndex? */
++ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
++ int fmt,i;
++
++ pPPriv->format = xf86XVQueryOffscreenImages(pScreen, &pPPriv->nformat);
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "v4l: Number of Xv formats: %d\n", pPPriv->nformat);
++ if (!pPPriv->nformat)
++ return FALSE;
++
++ for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
++ pPPriv->pixelformat = yuvlist[fmt].v4l_palette;
++ if (-1 == SetV4LFmt(fd, pPPriv->pixelformat))
++ continue;
++ GetV4LFmt(fd, &pPPriv->pixelformat);
++ if (pPPriv->pixelformat != yuvlist[fmt].v4l_palette)
++ continue;
++ /* ... works, check available offscreen image formats now ... */
++ for (i = 0; i < pPPriv->nformat; i++) {
++ if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id &&
++ pPPriv->format[i].image->format == yuvlist[fmt].xv_format) {
++ /* ... match found, good. */
++ pPPriv->yuv_format = yuvlist[fmt].v4l_palette;
++ pPPriv->myfmt = pPPriv->format+i;
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
++ "v4l[%s]: using hw video scaling [%4.4s].\n",
++ dev,(char*)&(pPPriv->format[i].image->id));
++ return TRUE;
++ }
++ }
++ }
++ return TRUE;
++}
++
+ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
+ {
+ static int first = 1;
+
++#if 0
++ /*
++ * It may be a good idea to probe here, but this would break
++ * some things, as initialization uses yuv_format
++ */
++ if (!pPPriv->yuv_format && first)
++ v4l_check_yuv(pScrn, pPPriv, V4L_NAME, V4L_FD);
++#endif
+ if (-1 == V4L_FD) {
+- V4L_FD = open(V4L_NAME, O_RDWR, 0);
+-
+- pPPriv->rgb_fbuf.width = pScrn->virtualX;
+- pPPriv->rgb_fbuf.height = pScrn->virtualY;
+- pPPriv->rgb_fbuf.depth = pScrn->bitsPerPixel;
+- pPPriv->rgb_fbuf.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8);
+- pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset);
+- if (first) {
+- first = 0;
+- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "v4l: memPhysBase=0x%lx\n", pScrn->memPhysBase);
+- }
+-
+- switch (pScrn->bitsPerPixel) {
+- case 16:
+- if (pScrn->weight.green == 5) {
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB555;
+- pPPriv->rgbdepth = 16;
+- } else {
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB565;
+- pPPriv->rgbdepth = 16;
+- }
+- break;
+- case 24:
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB24;
+- pPPriv->rgbdepth = 24;
+- break;
+- case 32:
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB32;
+- pPPriv->rgbdepth = 32;
+- break;
+- }
++ V4L_FD = open(V4L_NAME, O_RDWR, 0);
++
++ if (-1 == V4L_FD)
++ return errno;
++
++ if (-1 == ioctl(V4L_FD, VIDIOC_G_FBUF, &pPPriv->rgb_fbuf)) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ pPPriv->rgb_fbuf.fmt.width = pScrn->virtualX;
++ pPPriv->rgb_fbuf.fmt.height = pScrn->virtualY;
++ pPPriv->rgb_fbuf.fmt.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8);
++ pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset);
++ if (first) {
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "v4l: memPhysBase=0x%lx\n", pScrn->memPhysBase);
++ first = 0;
++ }
++
++ switch (pScrn->bitsPerPixel) {
++ case 16:
++ if (pScrn->weight.green == 5) {
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555;
++ } else {
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565;
++ }
++ break;
++ case 24:
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24;
++ break;
++ case 32:
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32;
++ break;
++ }
+ }
+
+- if (-1 == V4L_FD)
+- return errno;
+-
+ V4L_REF++;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/open: refcount=%d\n",V4L_REF));
++ "Xv/open: refcount=%d\n",V4L_REF));
+
+ return 0;
+ }
+@@ -267,10 +457,10 @@ static void V4lCloseDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
+ {
+ V4L_REF--;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/close: refcount=%d\n",V4L_REF));
++ "Xv/close: refcount=%d\n",V4L_REF));
+ if (0 == V4L_REF && -1 != V4L_FD) {
+- close(V4L_FD);
+- V4L_FD = -1;
++ close(V4L_FD);
++ V4L_FD = -1;
+ }
+ }
+
+@@ -280,8 +470,10 @@ V4lPutVideo(ScrnInfoPtr pScrn,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw)
+ {
++ struct v4l2_format fmt;
++
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+- struct video_clip *clip;
++ struct v4l2_clip *clip;
+ BoxPtr pBox;
+ RegionRec newReg;
+ BoxRec newBox;
+@@ -291,179 +483,214 @@ V4lPutVideo(ScrnInfoPtr pScrn,
+
+ /* Open a file handle to the device */
+ if (VIDEO_OFF == pPPriv->VideoOn) {
+- if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ if (V4lOpenDevice(pPPriv, pScrn))
++ return Success;
+ }
+
+ if (0 != pPPriv->yuv_format) {
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n"));
+- width = pPPriv->enc[pPPriv->cenc].width;
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n"));
++ width = pPPriv->enc[pPPriv->cenc].width;
+ height = pPPriv->enc[pPPriv->cenc].height/2; /* no interlace */
+- if (drw_w < width)
+- width = drw_w;
+- if (drw_h < height)
+- height = drw_h;
+- if ((height != pPPriv->yuv_height) || (width != pPPriv->yuv_width)) {
+- /* new size -- free old surface */
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface resize\n"));
+- if (pPPriv->surface) {
+- pPPriv->VideoOn = VIDEO_OFF;
+- pPPriv->myfmt->stop(pPPriv->surface);
+- pPPriv->myfmt->free_surface(pPPriv->surface);
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- }
+- pPPriv->yuv_width = width;
+- pPPriv->yuv_height = height;
+- }
+- if (!pPPriv->surface) {
+- /* allocate + setup offscreen surface */
+- if (NULL == (pPPriv->surface = xalloc(sizeof(XF86SurfaceRec))))
+- return FALSE;
+- if (Success != pPPriv->myfmt->alloc_surface
+- (pScrn,pPPriv->myfmt->image->id,
+- pPPriv->yuv_width,pPPriv->yuv_height,pPPriv->surface)) {
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- goto fallback_to_rgb;
+- }
+- pPPriv->yuv_fbuf.width = pPPriv->surface->width;
+- pPPriv->yuv_fbuf.height = pPPriv->surface->height;
+- pPPriv->yuv_fbuf.depth = 16;
+- pPPriv->yuv_fbuf.bytesperline = pPPriv->surface->pitches[0];
+- pPPriv->yuv_fbuf.base =
+- (pointer)(pScrn->memPhysBase + pPPriv->surface->offsets[0]);
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface: %p+%d = %p, %dx%d, pitch %d\n",
+- pScrn->memPhysBase,pPPriv->surface->offsets[0],
+- pScrn->memPhysBase+pPPriv->surface->offsets[0],
+- pPPriv->surface->width,pPPriv->surface->height,
+- pPPriv->surface->pitches[0]));
+- pPPriv->yuv_win.width = pPPriv->surface->width;
+- pPPriv->yuv_win.height = pPPriv->surface->height;
+- }
+-
+- /* program driver */
+- if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->yuv_fbuf)))
+- perror("ioctl VIDIOCSFBUF");
+- if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCGPICT");
+- pPPriv->pict.palette = pPPriv->yuv_format;
+- pPPriv->pict.depth = 16;
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->yuv_win)))
+- perror("ioctl VIDIOCSWIN");
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+- perror("ioctl VIDIOCCAPTURE(1)");
+-
+- if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
+- /* invert cliplist */
+- newBox.x1 = drw_x;
+- newBox.y1 = drw_y;
+- newBox.x2 = drw_x + drw_w;
+- newBox.y2 = drw_y + drw_h;
+-
+- if (pPPriv->myfmt->flags & VIDEO_CLIP_TO_VIEWPORT) {
+- /* trim to the viewport */
+- if(newBox.x1 < pScrn->frameX0)
+- newBox.x1 = pScrn->frameX0;
+- if(newBox.x2 > pScrn->frameX1)
+- newBox.x2 = pScrn->frameX1;
+-
+- if(newBox.y1 < pScrn->frameY0)
+- newBox.y1 = pScrn->frameY0;
+- if(newBox.y2 > pScrn->frameY1)
+- newBox.y2 = pScrn->frameY1;
+- }
++ if (drw_w < width)
++ width = drw_w;
++ if (drw_h < height)
++ height = drw_h;
++ if ((height != pPPriv->yuv_height) || (width != pPPriv->yuv_width)) {
++ /* new size -- free old surface */
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface resize\n"));
++ if (pPPriv->surface) {
++ pPPriv->VideoOn = VIDEO_OFF;
++ pPPriv->myfmt->stop(pPPriv->surface);
++ pPPriv->myfmt->free_surface(pPPriv->surface);
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ }
++ pPPriv->yuv_width = width;
++ pPPriv->yuv_height = height;
++ }
++ if (!pPPriv->surface) {
++ /* allocate + setup offscreen surface */
++ if (NULL == (pPPriv->surface = malloc(sizeof(XF86SurfaceRec))))
++ return FALSE;
++ if (Success != pPPriv->myfmt->alloc_surface
++ (pScrn,pPPriv->myfmt->image->id,
++ pPPriv->yuv_width,pPPriv->yuv_height,pPPriv->surface)) {
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ goto fallback_to_rgb;
++ }
++
++ if (-1 == ioctl(V4L_FD, VIDIOC_G_FBUF, &pPPriv->yuv_fbuf)) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ pPPriv->yuv_fbuf.fmt.width = pPPriv->surface->width;
++ pPPriv->yuv_fbuf.fmt.height = pPPriv->surface->height;
++ pPPriv->yuv_fbuf.fmt.bytesperline = pPPriv->surface->pitches[0];
++ pPPriv->yuv_fbuf.fmt.pixelformat = pPPriv->yuv_format;
++ pPPriv->yuv_fbuf.base =
++ (pointer)(pScrn->memPhysBase + pPPriv->surface->offsets[0]);
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ " surface: %p+%d = %p, %dx%d, pitch %d\n",
++ (void *)pScrn->memPhysBase, pPPriv->surface->offsets[0],
++ (void *)pScrn->memPhysBase+pPPriv->surface->offsets[0],
++ pPPriv->surface->width, pPPriv->surface->height,
++ pPPriv->surface->pitches[0]));
++ memset(&pPPriv->yuv_win, 0, sizeof(pPPriv->yuv_win));
++ pPPriv->yuv_win.w.left = 0;
++ pPPriv->yuv_win.w.top = 0;
++ pPPriv->yuv_win.w.width = pPPriv->surface->width;
++ pPPriv->yuv_win.w.height = pPPriv->surface->height;
++ }
+
+- REGION_INIT(pScrn->pScreen, &newReg, &newBox, 1);
+- REGION_SUBTRACT(pScrn->pScreen, &newReg, &newReg, clipBoxes);
+- clipBoxes = &newReg;
+- }
+-
+- /* start overlay */
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "over: - %d,%d -> %d,%d (%dx%d) (yuv=%dx%d)\n",
+- drw_x, drw_y,
+- drw_x+drw_w, drw_y+drw_h,
+- drw_w, drw_h,
+- pPPriv->surface->width,pPPriv->surface->height));
+- pPPriv->myfmt->display(pPPriv->surface,
+- 0, 0, drw_x, drw_y,
+- pPPriv->surface->width,
+- pPPriv->surface->height,
+- drw_w, drw_h,
+- clipBoxes);
+- if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
+- REGION_UNINIT(pScrn->pScreen, &newReg);
+- }
+- pPPriv->VideoOn = VIDEO_YUV;
+- return Success;
++ /* program driver */
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FBUF, &pPPriv->yuv_fbuf)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FBUF\n", errno);
++ return BadValue;
++ }
++ pPPriv->pixelformat = pPPriv->yuv_format;
++ if (-1 == SetV4LFmt(V4L_FD, pPPriv->pixelformat))
++ return BadValue;
++
++ memset(&fmt, 0, sizeof(fmt));
++ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
++ memcpy(&fmt.fmt.win, &pPPriv->yuv_win, sizeof(pPPriv->yuv_win));
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FMT, &fmt)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FMT\n", errno);
++ return BadValue;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &one)) {
++ xf86Msg(X_ERROR, "v4l: Error %d while enabling Overlay\n", errno);
++ return BadValue;
++ }
++
++ if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
++ /* invert cliplist */
++ newBox.x1 = drw_x;
++ newBox.y1 = drw_y;
++ newBox.x2 = drw_x + drw_w;
++ newBox.y2 = drw_y + drw_h;
++
++ if (pPPriv->myfmt->flags & VIDEO_CLIP_TO_VIEWPORT) {
++ /* trim to the viewport */
++ if(newBox.x1 < pScrn->frameX0)
++ newBox.x1 = pScrn->frameX0;
++ if(newBox.x2 > pScrn->frameX1)
++ newBox.x2 = pScrn->frameX1;
++
++ if(newBox.y1 < pScrn->frameY0)
++ newBox.y1 = pScrn->frameY0;
++ if(newBox.y2 > pScrn->frameY1)
++ newBox.y2 = pScrn->frameY1;
++ }
++
++ REGION_INIT(pScrn->pScreen, &newReg, &newBox, 1);
++ REGION_SUBTRACT(pScrn->pScreen, &newReg, &newReg, clipBoxes);
++ clipBoxes = &newReg;
++ }
++
++ /* start overlay */
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "over: - %d,%d -> %d,%d (%dx%d) (yuv=%dx%d)\n",
++ drw_x, drw_y,
++ drw_x+drw_w, drw_y+drw_h,
++ drw_w, drw_h,
++ pPPriv->surface->width,pPPriv->surface->height));
++ pPPriv->myfmt->display(pPPriv->surface,
++ 0, 0, drw_x, drw_y,
++ pPPriv->surface->width,
++ pPPriv->surface->height,
++ drw_w, drw_h,
++ clipBoxes);
++ if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
++ REGION_UNINIT(pScrn->pScreen, &newReg);
++ }
++ pPPriv->VideoOn = VIDEO_YUV;
++ return Success;
+ }
+
+- fallback_to_rgb:
++fallback_to_rgb:
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV rgb\n"));
+ /* FIXME: vid-* is ignored for now, not supported by v4l */
+
+ dw = (drw_w < pPPriv->enc[pPPriv->cenc].width) ?
+- drw_w : pPPriv->enc[pPPriv->cenc].width;
++ drw_w : pPPriv->enc[pPPriv->cenc].width;
+ dh = (drw_h < pPPriv->enc[pPPriv->cenc].height) ?
+- drw_h : pPPriv->enc[pPPriv->cenc].height;
++ drw_h : pPPriv->enc[pPPriv->cenc].height;
+ /* if the window is too big, center the video */
+ dx = drw_x + (drw_w - dw)/2;
+ dy = drw_y + (drw_h - dh)/2;
+ /* bttv prefeares aligned addresses */
+ dx &= ~3;
+- if (dx < drw_x) dx += 4;
+- if (dx+dw > drw_x+drw_w) dw -= 4;
++ if (dx < drw_x)
++ dx += 4;
++ if (dx+dw > drw_x+drw_w)
++ dw -= 4;
+
+ /* window */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " win: %dx%d+%d+%d\n",
+- drw_w,drw_h,drw_x,drw_y));
++ drw_w,drw_h,drw_x,drw_y));
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " use: %dx%d+%d+%d\n",
+- dw,dh,dx,dy));
+- pPPriv->rgb_win.x = dx;
+- pPPriv->rgb_win.y = dy;
+- pPPriv->rgb_win.width = dw;
+- pPPriv->rgb_win.height = dh;
+- pPPriv->rgb_win.flags = 0;
+-
++ dw,dh,dx,dy));
++ memset(&pPPriv->rgb_win, 0, sizeof(pPPriv->rgb_win));
++ pPPriv->rgb_win.w.left = dx;
++ pPPriv->rgb_win.w.top = dy;
++ pPPriv->rgb_win.w.width = dw;
++ pPPriv->rgb_win.w.height = dh;
++
+ /* clipping */
+ if (pPPriv->rgb_win.clips) {
+- xfree(pPPriv->rgb_win.clips);
+- pPPriv->rgb_win.clips = NULL;
++ free(pPPriv->rgb_win.clips);
++ pPPriv->rgb_win.clips = NULL;
+ }
+ pPPriv->rgb_win.clipcount = REGION_NUM_RECTS(clipBoxes);
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2," clip: have #%d\n",
+- pPPriv->rgb_win.clipcount));
++ pPPriv->rgb_win.clipcount));
+ if (0 != pPPriv->rgb_win.clipcount) {
+- pPPriv->rgb_win.clips = xalloc(pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+- if (NULL != pPPriv->rgb_win.clips) {
+- memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+- pBox = REGION_RECTS(clipBoxes);
+- clip = pPPriv->rgb_win.clips;
+- for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
+- clip->x = pBox->x1 - dx;
+- clip->y = pBox->y1 - dy;
+- clip->width = pBox->x2 - pBox->x1;
+- clip->height = pBox->y2 - pBox->y1;
+- }
+- }
++ pPPriv->rgb_win.clips = malloc(pPPriv->rgb_win.clipcount*sizeof(struct v4l2_clip));
++ if (NULL != pPPriv->rgb_win.clips) {
++ memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct v4l2_clip));
++ pBox = REGION_RECTS(clipBoxes);
++ clip = pPPriv->rgb_win.clips;
++
++ /*
++ * FIXME: This code currently does nothing, as we don't emulate
++ * The V4L1 clipping stuff
++ */
++ for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
++ clip->c.left = pBox->x1 - dx;
++ clip->c.top = pBox->y1 - dy;
++ clip->c.width = pBox->x2 - pBox->x1;
++ clip->c.height = pBox->y2 - pBox->y1;
++ }
++ }
+ }
+
+ /* start */
+- if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->rgb_fbuf)))
+- perror("ioctl VIDIOCSFBUF");
+- if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCGPICT");
+- pPPriv->pict.palette = pPPriv->rgbpalette;
+- pPPriv->pict.depth = pPPriv->rgbdepth;
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->rgb_win)))
+- perror("ioctl VIDIOCSWIN");
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+- perror("ioctl VIDIOCCAPTURE(1)");
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FBUF, &pPPriv->rgb_fbuf)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FBUF\n", errno);
++ return BadValue;
++ }
++ if (-1 == GetV4LFmt(V4L_FD, &pPPriv->pixelformat)) {
++ xf86Msg(X_ERROR, "Error %d getting pixelformat\n", errno);
++ return BadValue;
++ }
++ pPPriv->pixelformat = pPPriv->rgb_fbuf.fmt.pixelformat;
++ if (-1 == SetV4LFmt(V4L_FD, pPPriv->pixelformat)) {
++ xf86Msg(X_ERROR, "Error %d getting pixelformat\n", errno);
++ return BadValue;
++ }
++ memset(&fmt, 0, sizeof(fmt));
++ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
++ memcpy(&fmt.fmt.win, &pPPriv->rgb_win, sizeof(pPPriv->rgb_win));
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FMT, &fmt)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FMT\n", errno);
++ return BadValue;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &one)) {
++ xf86Msg(X_ERROR, "v4l: Error %d while enabling Overlay\n", errno);
++ return BadValue;
++ }
+ pPPriv->VideoOn = VIDEO_RGB;
+
+ return Success;
+@@ -476,7 +703,7 @@ V4lPutStill(ScrnInfoPtr pScrn,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw)
+ {
+ #if 0
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ #endif
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PS\n"));
+@@ -488,177 +715,152 @@ V4lPutStill(ScrnInfoPtr pScrn,
+ static void
+ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
+ {
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ int zero=0;
+
+ if (VIDEO_OFF == pPPriv->VideoOn) {
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/StopVideo called with video already off\n"));
+- return;
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "Xv/StopVideo called with video already off\n"));
++ return;
+ }
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/StopVideo shutdown=%d\n",shutdown));
+
+ if (!shutdown) {
+- /* just reclipping, we have to stop DMA transfers to the visible screen */
+- if (VIDEO_RGB == pPPriv->VideoOn) {
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
+- perror("ioctl VIDIOCCAPTURE(0)");
+- pPPriv->VideoOn = VIDEO_RECLIP;
+- }
++ /* just reclipping, we have to stop DMA transfers to the visible screen */
++ if (VIDEO_RGB == pPPriv->VideoOn) {
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &zero))
++ xf86Msg(X_ERROR, "v4l: Error %d while disabling Overlay\n", errno);
++ pPPriv->VideoOn = VIDEO_RECLIP;
++ }
+ } else {
+- /* video stop - turn off and free everything */
+- if (VIDEO_YUV == pPPriv->VideoOn) {
+- pPPriv->myfmt->stop(pPPriv->surface);
+- pPPriv->myfmt->free_surface(pPPriv->surface);
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- }
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
+- perror("ioctl VIDIOCCAPTURE(0)");
+-
+- V4lCloseDevice(pPPriv,pScrn);
+- pPPriv->VideoOn = VIDEO_OFF;
+- }
+-}
++ /* video stop - turn off and free everything */
++ if (VIDEO_YUV == pPPriv->VideoOn) {
++ pPPriv->myfmt->stop(pPPriv->surface);
++ pPPriv->myfmt->free_surface(pPPriv->surface);
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &zero))
++ xf86Msg(X_ERROR, "v4l: Error %d while disabling Overlay\n", errno);
+
+-/* v4l uses range 0 - 65535; Xv uses -1000 - 1000 */
+-static int
+-v4l_to_xv(int val) {
+- val = val * 2000 / 65536 - 1000;
+- if (val < -1000) val = -1000;
+- if (val > 1000) val = 1000;
+- return val;
+-}
+-static int
+-xv_to_v4l(int val) {
+- val = val * 65536 / 2000 + 32768;
+- if (val < -0) val = 0;
+- if (val > 65535) val = 65535;
+- return val;
++ V4lCloseDevice(pPPriv,pScrn);
++ pPPriv->VideoOn = VIDEO_OFF;
++ }
+ }
+
+ static int
+ V4lSetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 value, pointer data)
+ {
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
+- struct video_channel chan;
+- int ret = Success;
++ struct v4l2_control ctrl;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
++ int i, ret = BadValue;
+
+ if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ return Success;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/SPA %d, %d\n",
+- attribute, value));
++ (int)attribute, (int)value));
+
+ if (-1 == V4L_FD) {
+- ret = Success;
++ ret = Success;
+ } else if (attribute == xvEncoding) {
+- if (value >= 0 && value < pPPriv->nenc) {
+- pPPriv->cenc = value;
+- chan.channel = pPPriv->input[value];
+- chan.norm = pPPriv->norm[value];
+- if (-1 == ioctl(V4L_FD,VIDIOCSCHAN,&chan))
+- perror("ioctl VIDIOCSCHAN");
+- } else {
+- ret = BadValue;
+- }
+- } else if (attribute == xvBrightness ||
+- attribute == xvContrast ||
+- attribute == xvSaturation ||
+- attribute == xvHue) {
+- ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
+- if (attribute == xvBrightness) pPPriv->pict.brightness = xv_to_v4l(value);
+- if (attribute == xvContrast) pPPriv->pict.contrast = xv_to_v4l(value);
+- if (attribute == xvSaturation) pPPriv->pict.colour = xv_to_v4l(value);
+- if (attribute == xvHue) pPPriv->pict.hue = xv_to_v4l(value);
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- } else if (attribute == xvMute ||
+- attribute == xvVolume) {
+- ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
+- if (attribute == xvMute) {
+- if (value)
+- pPPriv->audio.flags |= VIDEO_AUDIO_MUTE;
+- else
+- pPPriv->audio.flags &= ~VIDEO_AUDIO_MUTE;
+- } else if (attribute == xvVolume) {
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- pPPriv->audio.volume = xv_to_v4l(value);
+- } else {
+- ret = BadValue;
+- }
+- if (ret != BadValue)
+- if (-1 == ioctl(V4L_FD,VIDIOCSAUDIO,&pPPriv->audio))
+- perror("ioctl VIDIOCSAUDIO");
++ if (value < 0 || value >= pPPriv->nenc)
++ goto err;
++ if (ioctl(V4L_FD, VIDIOC_S_INPUT, &pPPriv->input[value]) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d while setting input\n", errno);
++ goto err;
++ }
++ if (ioctl(V4L_FD, VIDIOC_S_STD, &pPPriv->norm[value]) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d while setting standard\n", errno);
++ goto err;
++ }
++ pPPriv->cenc = value;
++ ret = Success;
+ } else if (attribute == xvFreq) {
+- unsigned long freq = value;
+- if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&freq))
+- perror("ioctl VIDIOCSFREQ");
+- } else if (0 != pPPriv->yuv_format &&
+- pPPriv->myfmt->setAttribute) {
+- /* not mine -> pass to yuv scaler driver */
+- ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value);
++ struct v4l2_frequency freq;
++ memset(&freq, 0, sizeof(freq));
++ ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq);
++ freq.frequency = value;
++ if (ioctl(V4L_FD, VIDIOC_S_FREQUENCY, &freq) == -1)
++ xf86Msg(X_ERROR, "v4l: Error %d while setting frequency\n", errno);
++ else
++ ret = Success;
+ } else {
+- ret = BadValue;
++ for (i = 0; i < pPPriv->n_qctrl; i++)
++ if (pPPriv->XvV4LCtrl[i].xv == attribute)
++ break;
++ if (i == pPPriv->n_qctrl) {
++ /* not mine -> pass to yuv scaler driver */
++ if (0 != pPPriv->yuv_format && pPPriv->myfmt->setAttribute)
++ ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value);
++ else
++ ret = BadMatch;
++ goto err;
++ }
++ if (pPPriv->XvV4LCtrl[i].qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
++ goto err;
++ ctrl.id = pPPriv->XvV4LCtrl[i].qctrl.id;
++ ctrl.value = value;
++ if (ioctl(V4L_FD, VIDIOC_S_CTRL, &ctrl) != 1)
++ ret = Success;
+ }
+
++err:
+ V4lCloseDevice(pPPriv,pScrn);
+ return ret;
+ }
+
+ static int
+-V4lGetPortAttribute(ScrnInfoPtr pScrn,
++V4lGetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 *value, pointer data)
+ {
++ struct v4l2_control ctrl;
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+- int ret = Success;
++ int i, ret = BadValue;
+
+ if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ return Success;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d\n",
+- attribute));
++ (int)attribute));
+
+ if (-1 == V4L_FD) {
+- ret = Success;
++ ret = Success;
+ } else if (attribute == xvEncoding) {
+- *value = pPPriv->cenc;
+- } else if (attribute == xvBrightness ||
+- attribute == xvContrast ||
+- attribute == xvSaturation ||
+- attribute == xvHue) {
+- ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
+- if (attribute == xvBrightness) *value = v4l_to_xv(pPPriv->pict.brightness);
+- if (attribute == xvContrast) *value = v4l_to_xv(pPPriv->pict.contrast);
+- if (attribute == xvSaturation) *value = v4l_to_xv(pPPriv->pict.colour);
+- if (attribute == xvHue) *value = v4l_to_xv(pPPriv->pict.hue);
+- } else if (attribute == xvMute ||
+- attribute == xvVolume) {
+- ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
+- if (attribute == xvMute) {
+- *value = (pPPriv->audio.flags & VIDEO_AUDIO_MUTE) ? 1 : 0;
+- } else if (attribute == xvVolume) {
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- *value = v4l_to_xv(pPPriv->audio.volume);
+- } else {
+- ret = BadValue;
+- }
++ *value = pPPriv->cenc;
++ ret = Success;
+ } else if (attribute == xvFreq) {
+- unsigned long freq;
+- ioctl(V4L_FD,VIDIOCGFREQ,&freq);
+- *value = freq;
+- } else if (0 != pPPriv->yuv_format &&
+- pPPriv->myfmt->getAttribute) {
+- /* not mine -> pass to yuv scaler driver */
+- ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value);
++ struct v4l2_frequency freq;
++ memset(&freq, 0, sizeof(freq));
++ if (ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq) != -1) {
++ *value = freq.frequency;
++ ret = Success;
++ }
+ } else {
+- ret = BadValue;
++ for (i = 0; i < pPPriv->n_qctrl; i++)
++ if (pPPriv->XvV4LCtrl[i].xv == attribute)
++ break;
++ if (i == pPPriv->n_qctrl) {
++ /* not mine -> pass to yuv scaler driver */
++ if (0 != pPPriv->yuv_format && pPPriv->myfmt->getAttribute)
++ ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value);
++ else
++ ret = BadMatch;
++ goto err;
++ }
++ if (pPPriv->XvV4LCtrl[i].qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
++ goto err;
++ ctrl.id = pPPriv->XvV4LCtrl[i].qctrl.id;
++ if (ioctl(V4L_FD, VIDIOC_G_CTRL, &ctrl) != -1) {
++ *value = ctrl.value;
++ ret = Success;
++ }
+ }
+-
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n",
+- attribute, *value));
++ (int)attribute, (int)*value));
+
++err:
+ V4lCloseDevice(pPPriv,pScrn);
+ return ret;
+ }
+@@ -673,15 +875,15 @@ V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+ int maxy = pPPriv->enc[pPPriv->cenc].height;
+
+ if (0 != pPPriv->yuv_format) {
+- *p_w = pPPriv->myfmt->max_width;
+- *p_h = pPPriv->myfmt->max_height;
++ *p_w = pPPriv->myfmt->max_width;
++ *p_h = pPPriv->myfmt->max_height;
+ } else {
+- *p_w = (drw_w < maxx) ? drw_w : maxx;
+- *p_h = (drw_h < maxy) ? drw_h : maxy;
++ *p_w = (drw_w < maxx) ? drw_w : maxx;
++ *p_h = (drw_h < maxy) ? drw_h : maxy;
+ }
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/BS %d %dx%d %dx%d\n",
+- pPPriv->cenc,drw_w,drw_h,*p_w,*p_h));
++ pPPriv->cenc,drw_w,drw_h,*p_w,*p_h));
+ }
+
+ static const OptionInfoRec *
+@@ -693,132 +895,198 @@ V4LAvailableOptions(int chipid, int busid)
+ static void
+ V4LIdentify(int flags)
+ {
+- xf86Msg(X_INFO, "v4l driver for Video4Linux\n");
+-}
++ xf86Msg(X_INFO, "v4l driver for Video4Linux overlay mode (V4L2)\n");
++}
+
+ static char*
+ fixname(char *str)
+ {
+ int s,d;
+ for (s=0, d=0;; s++) {
+- if (str[s] == '-')
+- continue;
+- str[d++] = tolower(str[s]);
+- if (0 == str[s])
+- break;
++ if (str[s] == '-')
++ continue;
++ str[d++] = tolower(str[s]);
++ if (0 == str[s])
++ break;
+ }
+ return str;
+ }
+
+ static int
+-v4l_add_enc(XF86VideoEncodingPtr enc, int i,
+- char *norm, char *input, int width, int height, int n, int d)
++AddV4LEnc(XF86VideoEncodingPtr enc, int entry,
++ char *norm, char *input, int width, int height, int n, int d)
+ {
+- enc[i].id = i;
+- enc[i].name = xalloc(strlen(norm)+strlen(input)+2);
+- if (NULL == enc[i].name)
+- return -1;
+- enc[i].width = width;
+- enc[i].height = height;
+- enc[i].rate.numerator = n;
+- enc[i].rate.denominator = d;
+- sprintf(enc[i].name,"%s-%s",norm,fixname(input));
++ enc->id = entry;
++ enc->name = malloc(strlen(norm) + strlen(input) + 2);
++ if (!enc->name)
++ return -1;
++
++ enc->width = width;
++ enc->height = height;
++ enc->rate.numerator = n;
++ enc->rate.denominator = d * 2; /* Refresh rate is twice, due to interlace */
++ sprintf(enc->name,"%s-%s",norm,fixname(input));
++
++ xf86Msg(X_INFO, "v4l: adding input %s, %dx%d %d fps\n",
++ enc->name, enc->width, enc->height, (d + n - 1)/n);
++
+ return 0;
+ }
+
++static int
++V4LGetStd(PortPrivPtr p, int fd)
++{
++ struct v4l2_standard standard;
++ int entries = 0;
++
++ /*
++ * 128 is just an arbitrary large number. There aren't that many video stds
++ * The max value is there just to avoid an endless loop, if the driver is
++ * broken.
++ */
++ for (entries = 0; entries < 128; entries++) {
++ memset(&standard, 0, sizeof(standard));
++ standard.index = entries;
++ if (-1 == ioctl(fd,VIDIOC_ENUMSTD, &standard))
++ break;
++ p->standard = realloc(p->standard, sizeof(standard) * (entries + 1));
++ memcpy(&p->standard[entries], &standard, sizeof(standard));
++ }
++
++ /*
++ * Some webcam drivers don't implement VIDIOC_ENUMSTD. Fake it
++ * This is currently unused, as no webcam driver allows OVERLAY mode,
++ * but the code is here, in the case some webcam driver starts allowing
++ * overlay.
++ * FIXME: Webcam drivers may use VIDIOC_ENUM_FRAMESIZES and
++ * VIDIOC_ENUM_FRAMEINTERVALS ioctl's that may help to fine-tune
++ * their needs. Those ioctl's could be used here in order to better
++ * support webcams.
++ */
++ if (!entries) {
++ xf86Msg(X_INFO, "v4l: VIDIOC_ENUMSTD error %d.\n",errno);
++ p->standard = realloc(p->standard, sizeof(standard) * (entries + 1));
++ p->standard[0].id = V4L2_STD_ALL;
++ strcpy((char *)p->standard[0].name, "CAMERA");
++ p->standard[0].frameperiod.numerator = 1001;
++ p->standard[0].frameperiod.denominator = 300001;
++ p->standard[0].framelines = 480;
++ entries++;
++ }
++ return entries;
++}
++
+ static void
+-V4LBuildEncodings(PortPrivPtr p, int fd, int channels)
++V4LBuildEncodings(PortPrivPtr p, int fd)
+ {
+- static struct video_channel channel;
+- int i,entries,have_bttv,bttv_ver;
+-
+-#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
+- have_bttv = 0;
+- if (-1 != ioctl(fd,BTTV_VERSION,&bttv_ver))
+- have_bttv = 1;
+-
+- entries = (have_bttv ? 7 : 3) * channels;
+- p->enc = xalloc(sizeof(XF86VideoEncodingRec) * entries);
+- if (NULL == p->enc)
+- goto fail;
+- memset(p->enc,0,sizeof(XF86VideoEncodingRec) * entries);
+- p->norm = xalloc(sizeof(int) * entries);
+- if (NULL == p->norm)
+- goto fail;
+- memset(p->norm,0,sizeof(int) * entries);
+- p->input = xalloc(sizeof(int) * entries);
+- if (NULL == p->input)
+- goto fail;
+- memset(p->input,0,sizeof(int) * entries);
++ unsigned int inp, std, num_std;
++
++ num_std = V4LGetStd(p, fd);
+
+ p->nenc = 0;
+- for (i = 0; i < channels; i++) {
+- channel.channel = i;
+- if (-1 == ioctl(fd,VIDIOCGCHAN,&channel)) {
+- perror("ioctl VIDIOCGCHAN");
+- continue;
+- }
+-
+- v4l_add_enc(p->enc, p->nenc,"PAL", channel.name, 768,576, 1,50);
+- p->norm[p->nenc] = VIDEO_MODE_PAL;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- v4l_add_enc(p->enc,p->nenc,"NTSC", channel.name, 640,480, 1001,60000);
+- p->norm[p->nenc] = VIDEO_MODE_NTSC;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- v4l_add_enc(p->enc,p->nenc,"SECAM",channel.name, 768,576, 1,50);
+- p->norm[p->nenc] = VIDEO_MODE_SECAM;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (have_bttv) {
+- /* workaround for a v4l design flaw: The v4l API knows just pal,
+- ntsc and secam. But there are a few more norms (pal versions
+- with a different timings used in south america for example).
+- The bttv driver can handle these too. */
+- if (0 != v4l_add_enc(p->enc,p->nenc,"PAL-Nc",channel.name,
+- 640, 576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 3;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc,p->nenc,"PAL-M",channel.name,
+- 640, 576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 4;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc, p->nenc,"PAL-N", channel.name,
+- 768,576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 5;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc,p->nenc,"NTSC-JP", channel.name,
+- 640,480, 1001,60000))
+- goto fail;
+- p->norm[p->nenc] = 6;
+- p->input[p->nenc] = i;
+- p->nenc++;
+- }
++
++ /*
++ * 256 is just an arbitrary large number. There aren't that many video
++ * inputs on any driver. The max value is there just to avoid an endless
++ * loop, if the driver is broken.
++ */
++ for (inp = 0; inp < 256; inp++) {
++ struct v4l2_input input;
++
++ memset(&input, 0, sizeof(input));
++ input.index = inp;
++ if (ioctl(fd, VIDIOC_ENUMINPUT, &input) == -1)
++ break;
++
++ for (std = 0; std < num_std; std++) {
++ int width, height;
++
++ /*
++ * Currently, this code is not reliable, due to driver
++ * non-compliance on both saa7134 and bttv. So, instead,
++ * just use the video standard information
++ */
++#if 0
++ struct v4l2_framebuffer fbuf;
++
++ /* Some webcam drivers will fail here, but that's OK */
++ ioctl(fd, VIDIOC_S_STD, &p->standard[std].id);
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_INFO, "v4l: Error %d: Can't get FBUF\n", errno);
++ return;
++ }
++ height = fbuf.fmt.height;
++ width = fbuf.fmt.width;
++
++ /*
++ * If the overlay method fails, get the resolution
++ * via checking V4L2_BUF_TYPE_VIDEO_CAPTURE
++ */
++ if (!height || !width) {
++ struct v4l2_format format;
++
++ format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
++ if (ioctl(fd, VIDIOC_G_FMT, &format) == -1) {
++ /* Hmm... device doesn't support capture. */
++ height = p->standard[std].framelines;
++ if (height == 480)
++ width = 640;
++ else if (height == 576)
++ width = 768;
++ else
++ continue;
++ } else {
++ height = format.fmt.pix.height;
++ width = format.fmt.pix.width;
++ }
++ }
++#else
++ if (p->standard[std].id & V4L2_STD_525_60) {
++ height = 480;
++ width = 640;
++ } else {
++ height = 576;
++ width = 768;
++ }
++
++#endif
++ /* Fixup for some driver bug */
++ if ((p->standard[std].id & V4L2_STD_525_60) && (height == 576))
++ height = 480;
++
++ p->enc = realloc(p->enc, sizeof(XF86VideoEncodingRec) * (p->nenc + 1));
++ p->norm = realloc(p->norm, sizeof(int) * (p->nenc + 1));
++ p->input = realloc(p->input, sizeof(int) * (p->nenc + 1));
++ if (!p->enc || !p->norm || !p->input)
++ goto fail;
++ if (AddV4LEnc(&p->enc[p->nenc], p->nenc,
++ (char *)p->standard[std].name,
++ (char *)input.name, width, height,
++ p->standard[std].frameperiod.numerator,
++ p->standard[std].frameperiod.denominator))
++ goto fail;
++ p->norm[p->nenc] = p->standard[std].id;
++ p->input[p->nenc] = inp;
++ p->nenc++;
++ }
+ }
++
++ if (!p->nenc)
++ xf86Msg(X_ERROR, "v4l: couldn't detect any valid input/standard\n");
+ return;
+-
+- fail:
++
++fail:
++ xf86Msg(X_ERROR, "v4l: Fail to get standards: %d\n", errno);
+ if (p->input)
+- xfree(p->input);
++ free(p->input);
+ p->input = NULL;
+ if (p->norm)
+- xfree(p->norm);
++ free(p->norm);
+ p->norm = NULL;
+ if (p->enc)
+- xfree(p->enc);
++ free(p->enc);
+ p->enc = NULL;
+ p->nenc = 0;
+ }
+@@ -826,73 +1094,33 @@ V4LBuildEncodings(PortPrivPtr p, int fd, int channels)
+ /* add a attribute a list */
+ static void
+ v4l_add_attr(XF86AttributeRec **list, int *count,
+- const XF86AttributeRec *attr)
++ const XF86AttributeRec *attr)
+ {
+ XF86AttributeRec *oldlist = *list;
+ int i;
++ Atom gpa;
+
+ for (i = 0; i < *count; i++) {
+- if (0 == strcmp((*list)[i].name,attr->name)) {
+- DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
+- return;
+- }
++ if (0 == strcmp((*list)[i].name,attr->name)) {
++ DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
++ return;
++ }
+ }
+-
+- DEBUG(xf86Msg(X_INFO, "v4l: add attr %s\n",attr->name));
+- *list = xalloc((*count + 1) * sizeof(XF86AttributeRec));
++
++ *list = malloc((*count + 1) * sizeof(XF86AttributeRec));
+ if (NULL == *list) {
+- *count = 0;
+- return;
++ *count = 0;
++ return;
+ }
+ if (*count)
+- memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
++ memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
+ memcpy(*list + *count, attr, sizeof(XF86AttributeRec));
+- (*count)++;
+-}
+
+-/* setup yuv overlay + hw scaling: look if we find some common video
+- format which both v4l driver and the X-Server can handle */
+-static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
+- char *dev, int fd)
+-{
+- static const struct {
+- unsigned int v4l_palette;
+- unsigned int v4l_depth;
+- unsigned int xv_id;
+- unsigned int xv_format;
+- } yuvlist[] = {
+- { VIDEO_PALETTE_YUV422, 16, 0x32595559, XvPacked },
+- { VIDEO_PALETTE_UYVY, 16, 0x59565955, XvPacked },
+- { 0 /* end of list */ },
+- };
+- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+- int fmt,i;
++ gpa = MAKE_ATOM((*list)[*count].name);
++ xf86Msg(X_INFO, "v4l: add attr %s (Xv/GPA %d) (%d to %d)\n",
++ attr->name, (int)gpa, attr->min_value, attr->max_value);
+
+- pPPriv->format = xf86XVQueryOffscreenImages(pScreen,&pPPriv->nformat);
+- for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
+- /* check v4l ... */
+- ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
+- pPPriv->pict.palette = yuvlist[fmt].v4l_palette;
+- pPPriv->pict.depth = yuvlist[fmt].v4l_depth;
+- if (-1 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict))
+- continue;
+- ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
+- if (pPPriv->pict.palette != yuvlist[fmt].v4l_palette)
+- continue;
+- /* ... works, check available offscreen image formats now ... */
+- for (i = 0; i < pPPriv->nformat; i++) {
+- if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id &&
+- pPPriv->format[i].image->format == yuvlist[fmt].xv_format) {
+- /* ... match found, good. */
+- pPPriv->yuv_format = yuvlist[fmt].v4l_palette;
+- pPPriv->myfmt = pPPriv->format+i;
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+- "v4l[%s]: using hw video scaling [%4.4s].\n",
+- dev,(char*)&(pPPriv->format[i].image->id));
+- return;
+- }
+- }
+- }
++ (*count)++;
+ }
+
+ static int
+@@ -904,118 +1132,114 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
+ char dev[18];
+ int fd,i,j,d;
+
+- DEBUG(xf86Msg(X_INFO, "v4l: init start\n"));
+-
+ for (i = 0, d = 0; d < MAX_V4L_DEVICES; d++) {
+- sprintf(dev, "/dev/video%d", d);
+- fd = open(dev, O_RDWR, 0);
+- if (fd == -1) {
+- sprintf(dev, "/dev/v4l/video%d", d);
+- fd = open(dev, O_RDWR, 0);
+- if (fd == -1)
+- break;
+- }
+- DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
+-
+- /* our private data */
+- pPPriv = xalloc(sizeof(PortPrivRec));
+- if (!pPPriv)
+- return FALSE;
+- memset(pPPriv,0,sizeof(PortPrivRec));
+- pPPriv->nr = d;
+-
+- /* check device */
+- if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) ||
+- 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) {
+- DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev));
+- xfree(pPPriv);
+- close(fd);
+- continue;
+- }
+- strncpy(V4L_NAME, dev, 16);
+- V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels);
+- if (NULL == pPPriv->enc)
+- return FALSE;
+- v4l_check_yuv(pScrn,pPPriv,dev,fd);
+-
+- /* alloc VideoAdaptorRec */
+- VAR = xrealloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1));
+- VAR[i] = xalloc(sizeof(XF86VideoAdaptorRec));
+- if (!VAR[i])
+- return FALSE;
+- memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
+-
+-
+- /* build attribute list */
+- for (j = 0; j < V4L_ATTR; j++) {
+- /* video attributes */
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &Attributes[j]);
+- }
+- if (0 == ioctl(fd,VIDIOCGAUDIO,&pPPriv->audio)) {
+- /* audio attributes */
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &VolumeAttr);
+- if (pPPriv->audio.flags & VIDEO_AUDIO_MUTABLE)
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &MuteAttr);
+- }
+- if (pPPriv->cap.type & VID_TYPE_TUNER) {
+- /* tuner attributes */
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &FreqAttr);
+- }
+- if (0 != pPPriv->yuv_format) {
+- /* pass throuth scaler attributes */
+- for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- pPPriv->myfmt->attributes+j);
+- }
+- }
+-
+-
+- /* hook in private data */
+- Private = xalloc(sizeof(DevUnion));
+- if (!Private)
+- return FALSE;
+- memset(Private,0,sizeof(DevUnion));
+- Private->ptr = (pointer)pPPriv;
+- VAR[i]->pPortPrivates = Private;
+- VAR[i]->nPorts = 1;
+-
+- /* init VideoAdaptorRec */
+- VAR[i]->type = XvInputMask | XvWindowMask | XvVideoMask;
+- VAR[i]->name = "video4linux";
+- VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
+-
+- VAR[i]->PutVideo = V4lPutVideo;
+- VAR[i]->PutStill = V4lPutStill;
+- VAR[i]->StopVideo = V4lStopVideo;
+- VAR[i]->SetPortAttribute = V4lSetPortAttribute;
+- VAR[i]->GetPortAttribute = V4lGetPortAttribute;
+- VAR[i]->QueryBestSize = V4lQueryBestSize;
+-
+- VAR[i]->nEncodings = pPPriv->nenc;
+- VAR[i]->pEncodings = pPPriv->enc;
+- VAR[i]->nFormats =
+- sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
+- VAR[i]->pFormats = InputVideoFormats;
+-
+- if (fd != -1)
+- close(fd);
+- i++;
++ sprintf(dev, "/dev/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1) {
++ sprintf(dev, "/dev/v4l/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1)
++ break;
++ }
++ DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
++
++ /* our private data */
++ pPPriv = malloc(sizeof(PortPrivRec));
++ if (!pPPriv)
++ return FALSE;
++ memset(pPPriv,0,sizeof(PortPrivRec));
++ pPPriv->nr = d;
++
++ /* check device capabilities */
++ memset(&pPPriv->cap, 0, sizeof(&pPPriv->cap));
++ if (-1 == ioctl(fd, VIDIOC_QUERYCAP, &pPPriv->cap) ||
++ 0 == (pPPriv->cap.capabilities & V4L2_CAP_VIDEO_OVERLAY)) {
++ xf86Msg(X_ERROR, "v4l: %s: no overlay support\n",dev);
++ free(pPPriv);
++ close(fd);
++ continue;
++ }
++
++ if (v4l_check_yuv(pScrn, pPPriv, dev, fd) == FALSE) {
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "Xv Overlay not supported. Can't use v4l driver\n");
++ free(pPPriv);
++ close(fd);
++ continue;
++ }
++
++ xf86Msg(X_INFO, "v4l: enabling overlay mode for %s.\n", dev);
++ strncpy(V4L_NAME, dev, 16);
++ V4LBuildEncodings(pPPriv, fd);
++ if (NULL == pPPriv->enc)
++ return FALSE;
++
++ /* alloc VideoAdaptorRec */
++ VAR = realloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1));
++ VAR[i] = malloc(sizeof(XF86VideoAdaptorRec));
++ if (!VAR[i])
++ return FALSE;
++ memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
++
++ /* build attribute list */
++ AddAllV4LControls(pPPriv, &VAR[i]->pAttributes, &VAR[i]->nAttributes, fd);
++
++ for (j = 0; j < V4L_ATTR; j++) {
++ /* Other video attributes */
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ &Attributes[j]);
++ }
++ if (pPPriv->cap.capabilities & V4L2_CAP_TUNER) {
++ /* tuner attributes */
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ &FreqAttr);
++ }
++
++ /* Initialize yuv_format */
++ if (0 != pPPriv->yuv_format) {
++ /* pass throuth scaler attributes */
++ for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ pPPriv->myfmt->attributes+j);
++ }
++ }
++
++ DEBUG(xf86Msg(X_INFO, "v4l: saving config into driver data\n"));
++ /* hook in private data */
++ Private = malloc(sizeof(DevUnion));
++ if (!Private)
++ return FALSE;
++ memset(Private,0,sizeof(DevUnion));
++ Private->ptr = (pointer)pPPriv;
++ VAR[i]->pPortPrivates = Private;
++ VAR[i]->nPorts = 1;
++
++ /* init VideoAdaptorRec */
++ VAR[i]->type = XvInputMask | XvWindowMask | XvVideoMask;
++ VAR[i]->name = "video4linux";
++ VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
++
++ VAR[i]->PutVideo = V4lPutVideo;
++ VAR[i]->PutStill = V4lPutStill;
++ VAR[i]->StopVideo = V4lStopVideo;
++ VAR[i]->SetPortAttribute = V4lSetPortAttribute;
++ VAR[i]->GetPortAttribute = V4lGetPortAttribute;
++ VAR[i]->QueryBestSize = V4lQueryBestSize;
++
++ VAR[i]->nEncodings = pPPriv->nenc;
++ VAR[i]->pEncodings = pPPriv->enc;
++ VAR[i]->nFormats = sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
++ VAR[i]->pFormats = InputVideoFormats;
++
++ if (fd != -1) {
++ DEBUG(xf86Msg(X_INFO, "v4l: %s init finished.\n",dev));
++ close(fd);
++ }
++ i++;
+ }
+
+ xvEncoding = MAKE_ATOM(XV_ENCODING);
+- xvHue = MAKE_ATOM(XV_HUE);
+- xvSaturation = MAKE_ATOM(XV_SATURATION);
+- xvBrightness = MAKE_ATOM(XV_BRIGHTNESS);
+- xvContrast = MAKE_ATOM(XV_CONTRAST);
+-
+ xvFreq = MAKE_ATOM(XV_FREQ);
+- xvMute = MAKE_ATOM(XV_MUTE);
+- xvVolume = MAKE_ATOM(XV_VOLUME);
+
+ DEBUG(xf86Msg(X_INFO, "v4l: init done, %d device(s) found\n",i));
+
+@@ -1024,10 +1248,43 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
+ }
+
+ static Bool
++V4LDetect(void)
++{
++ struct v4l2_capability cap;
++ int fd, d, n = 0;
++ char dev[18];
++
++ for (d = 0; d < MAX_V4L_DEVICES; d++) {
++ sprintf(dev, "/dev/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1) {
++ sprintf(dev, "/dev/v4l/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1)
++ break;
++ }
++ close (fd);
++ memset(&cap, 0, sizeof(cap));
++ if (!ioctl(fd, VIDIOC_QUERYCAP, &cap) &&
++ (cap.capabilities & V4L2_CAP_VIDEO_OVERLAY))
++ n++;
++ }
++ xf86Msg(X_INFO, "v4l: %d video adapters with overlay support detected\n", n);
++
++ return (n > 0) ? TRUE : FALSE;
++}
++
++static Bool
+ V4LProbe(DriverPtr drv, int flags)
+ {
+- if (flags & PROBE_DETECT)
+- return TRUE;
++ /*
++ * Don't try to register adapter at the detection phase, as Xv
++ * extensions won't be there
++ */
++ if (flags == PROBE_DETECT)
++ return V4LDetect();
++
++ DEBUG(xf86Msg(X_INFO, "v4l: Initiating device probe\n"));
+
+ xf86XVRegisterGenericAdaptorDriver(V4LInit);
+ drv->refCount++;
+diff --git a/src/videodev.h b/src/videodev.h
+deleted file mode 100644
+index 3c9a7d8..0000000
+--- a/src/videodev.h
++++ /dev/null
+@@ -1,254 +0,0 @@
+-#ifndef __LINUX_VIDEODEV_H
+-#define __LINUX_VIDEODEV_H
+-
+-/* Linux V4L API, Version 1
+- * videodev.h from v4l driver in Linux 2.2.3
+- *
+- * Used here with the explicit permission of the original author, Alan Cox.
+- *
+- */
+-
+-#include
+-
+-#define VID_TYPE_CAPTURE 1 /* Can capture */
+-#define VID_TYPE_TUNER 2 /* Can tune */
+-#define VID_TYPE_TELETEXT 4 /* Does teletext */
+-#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
+-#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
+-#define VID_TYPE_CLIPPING 32 /* Can clip */
+-#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
+-#define VID_TYPE_SCALES 128 /* Scalable */
+-#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
+-#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
+-
+-struct video_capability
+-{
+- char name[32];
+- int type;
+- int channels; /* Num channels */
+- int audios; /* Num audio devices */
+- int maxwidth; /* Supported width */
+- int maxheight; /* And height */
+- int minwidth; /* Supported width */
+- int minheight; /* And height */
+-};
+-
+-
+-struct video_channel
+-{
+- int channel;
+- char name[32];
+- int tuners;
+- CARD32 flags;
+-#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
+-#define VIDEO_VC_AUDIO 2 /* Channel has audio */
+- CARD16 type;
+-#define VIDEO_TYPE_TV 1
+-#define VIDEO_TYPE_CAMERA 2
+- CARD16 norm; /* Norm set by channel */
+-};
+-
+-struct video_tuner
+-{
+- int tuner;
+- char name[32];
+- unsigned long rangelow, rangehigh; /* Tuner range */
+- CARD32 flags;
+-#define VIDEO_TUNER_PAL 1
+-#define VIDEO_TUNER_NTSC 2
+-#define VIDEO_TUNER_SECAM 4
+-#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
+-#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
+-#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
+- CARD16 mode; /* PAL/NTSC/SECAM/OTHER */
+-#define VIDEO_MODE_PAL 0
+-#define VIDEO_MODE_NTSC 1
+-#define VIDEO_MODE_SECAM 2
+-#define VIDEO_MODE_AUTO 3
+- CARD16 signal; /* Signal strength 16bit scale */
+-};
+-
+-struct video_picture
+-{
+- CARD16 brightness;
+- CARD16 hue;
+- CARD16 colour;
+- CARD16 contrast;
+- CARD16 whiteness; /* Black and white only */
+- CARD16 depth; /* Capture depth */
+- CARD16 palette; /* Palette in use */
+-#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
+-#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
+-#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
+-#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
+-#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
+-#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
+-#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
+-#define VIDEO_PALETTE_YUYV 8
+-#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
+-#define VIDEO_PALETTE_YUV420 10
+-#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
+-#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
+-#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
+-#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
+-#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
+-#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
+-#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
+-#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
+-};
+-
+-struct video_audio
+-{
+- int audio; /* Audio channel */
+- CARD16 volume; /* If settable */
+- CARD16 bass, treble;
+- CARD32 flags;
+-#define VIDEO_AUDIO_MUTE 1
+-#define VIDEO_AUDIO_MUTABLE 2
+-#define VIDEO_AUDIO_VOLUME 4
+-#define VIDEO_AUDIO_BASS 8
+-#define VIDEO_AUDIO_TREBLE 16
+- char name[16];
+-#define VIDEO_SOUND_MONO 1
+-#define VIDEO_SOUND_STEREO 2
+-#define VIDEO_SOUND_LANG1 4
+-#define VIDEO_SOUND_LANG2 8
+- CARD16 mode;
+- CARD16 balance; /* Stereo balance */
+- CARD16 step; /* Step actual volume uses */
+-};
+-
+-struct video_clip
+-{
+- INT32 x,y;
+- INT32 width, height;
+- struct video_clip *next; /* For user use/driver use only */
+-};
+-
+-struct video_window
+-{
+- CARD32 x,y; /* Position of window */
+- CARD32 width,height; /* Its size */
+- CARD32 chromakey;
+- CARD32 flags;
+- struct video_clip *clips; /* Set only */
+- int clipcount;
+-#define VIDEO_WINDOW_INTERLACE 1
+-#define VIDEO_CLIP_BITMAP -1
+-/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
+-#define VIDEO_CLIPMAP_SIZE (128 * 625)
+-};
+-
+-struct video_capture
+-{
+- CARD32 x,y; /* Offsets into image */
+- CARD32 width, height; /* Area to capture */
+- CARD16 decimation; /* Decimation divder */
+- CARD16 flags; /* Flags for capture */
+-#define VIDEO_CAPTURE_ODD 0 /* Temporal */
+-#define VIDEO_CAPTURE_EVEN 1
+-};
+-
+-struct video_buffer
+-{
+- void *base;
+- int height,width;
+- int depth;
+- int bytesperline;
+-};
+-
+-struct video_mmap
+-{
+- unsigned int frame; /* Frame (0 - n) for double buffer */
+- int height,width;
+- unsigned int format; /* should be VIDEO_PALETTE_* */
+-};
+-
+-struct video_key
+-{
+- CARD8 key[8];
+- CARD32 flags;
+-};
+-
+-
+-#define VIDEO_MAX_FRAME 32
+-
+-struct video_mbuf
+-{
+- int size; /* Total memory to map */
+- int frames; /* Frames */
+- int offsets[VIDEO_MAX_FRAME];
+-};
+-
+-
+-#define VIDEO_NO_UNIT (-1)
+-
+-
+-struct video_unit
+-{
+- int video; /* Video minor */
+- int vbi; /* VBI minor */
+- int radio; /* Radio minor */
+- int audio; /* Audio minor */
+- int teletext; /* Teletext minor */
+-};
+-
+-#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
+-#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
+-#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
+-#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
+-#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
+-#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
+-#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
+-#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
+-#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Set the video overlay window */
+-#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
+-#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
+-#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
+-#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
+-#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
+-#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
+-#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
+-#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
+-#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
+-#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
+-#define VIDIOCGMBUF _IOR('v', 20, struct video_mbuf) /* Memory map buffer info */
+-#define VIDIOCGUNIT _IOR('v', 21, struct video_unit) /* Get attached units */
+-#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get frame buffer */
+-#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set frame buffer - root only */
+-
+-#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
+-
+-
+-#define VID_HARDWARE_BT848 1
+-#define VID_HARDWARE_QCAM_BW 2
+-#define VID_HARDWARE_PMS 3
+-#define VID_HARDWARE_QCAM_C 4
+-#define VID_HARDWARE_PSEUDO 5
+-#define VID_HARDWARE_SAA5249 6
+-#define VID_HARDWARE_AZTECH 7
+-#define VID_HARDWARE_SF16MI 8
+-#define VID_HARDWARE_RTRACK 9
+-#define VID_HARDWARE_ZOLTRIX 10
+-#define VID_HARDWARE_SAA7146 11
+-#define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
+-#define VID_HARDWARE_RTRACK2 13
+-#define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
+-#define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
+-#define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
+-#define VID_HARDWARE_BROADWAY 17 /* Broadway project */
+-#define VID_HARDWARE_GEMTEK 18
+-#define VID_HARDWARE_TYPHOON 19
+-#define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */
+-
+-/*
+- * Initialiser list
+- */
+-
+-struct video_init
+-{
+- char *name;
+- int (*init)(struct video_init *);
+-};
+-
+-#endif
+diff --git a/src/videodev2.h b/src/videodev2.h
+new file mode 100644
+index 0000000..bf6dde2
+--- /dev/null
++++ b/src/videodev2.h
+@@ -0,0 +1,1929 @@
++/*
++ * Video for Linux Two header file
++ *
++ * Copyright (C) 1999-2007 the contributors
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * Alternatively you can redistribute this file under the terms of the
++ * BSD license as stated below:
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ * 3. The names of its contributors may not be used to endorse or promote
++ * products derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
++ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ * Header file for v4l or V4L2 drivers and applications
++ * with public API.
++ * All kernel-specific stuff were moved to media/v4l2-dev.h, so
++ * no #if __KERNEL tests are allowed here
++ *
++ * See http://linuxtv.org for more info
++ *
++ * Author: Bill Dirks
++ * Justin Schoeman
++ * Hans Verkuil
++ * et al.
++ */
++#ifndef __LINUX_VIDEODEV2_H
++#define __LINUX_VIDEODEV2_H
++
++#include
++#include
++#include
++
++/*
++ * Common stuff for both V4L1 and V4L2
++ * Moved from videodev.h
++ */
++#define VIDEO_MAX_FRAME 32
++#define VIDEO_MAX_PLANES 8
++
++/* These defines are V4L1 specific and should not be used with the V4L2 API!
++ They will be removed from this header in the future. */
++
++#define VID_TYPE_CAPTURE 1 /* Can capture */
++#define VID_TYPE_TUNER 2 /* Can tune */
++#define VID_TYPE_TELETEXT 4 /* Does teletext */
++#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
++#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
++#define VID_TYPE_CLIPPING 32 /* Can clip */
++#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
++#define VID_TYPE_SCALES 128 /* Scalable */
++#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
++#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
++#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
++#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
++#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
++#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
++
++/*
++ * M I S C E L L A N E O U S
++ */
++
++/* Four-character-code (FOURCC) */
++#define v4l2_fourcc(a, b, c, d)\
++ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
++
++/*
++ * E N U M S
++ */
++enum v4l2_field {
++ V4L2_FIELD_ANY = 0, /* driver can choose from none,
++ top, bottom, interlaced
++ depending on whatever it thinks
++ is approximate ... */
++ V4L2_FIELD_NONE = 1, /* this device has no fields ... */
++ V4L2_FIELD_TOP = 2, /* top field only */
++ V4L2_FIELD_BOTTOM = 3, /* bottom field only */
++ V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
++ V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
++ buffer, top-bottom order */
++ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
++ V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
++ separate buffers */
++ V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
++ first and the top field is
++ transmitted first */
++ V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
++ first and the bottom field is
++ transmitted first */
++};
++#define V4L2_FIELD_HAS_TOP(field) \
++ ((field) == V4L2_FIELD_TOP ||\
++ (field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++#define V4L2_FIELD_HAS_BOTTOM(field) \
++ ((field) == V4L2_FIELD_BOTTOM ||\
++ (field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++#define V4L2_FIELD_HAS_BOTH(field) \
++ ((field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++
++enum v4l2_buf_type {
++ V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
++ V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
++ V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
++ V4L2_BUF_TYPE_VBI_CAPTURE = 4,
++ V4L2_BUF_TYPE_VBI_OUTPUT = 5,
++ V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
++ V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
++#if 1
++ /* Experimental */
++ V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
++#endif
++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
++ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
++ V4L2_BUF_TYPE_PRIVATE = 0x80,
++};
++
++#define V4L2_TYPE_IS_MULTIPLANAR(type) \
++ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
++
++#define V4L2_TYPE_IS_OUTPUT(type) \
++ ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
++ || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
++ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
++
++enum v4l2_tuner_type {
++ V4L2_TUNER_RADIO = 1,
++ V4L2_TUNER_ANALOG_TV = 2,
++ V4L2_TUNER_DIGITAL_TV = 3,
++};
++
++enum v4l2_memory {
++ V4L2_MEMORY_MMAP = 1,
++ V4L2_MEMORY_USERPTR = 2,
++ V4L2_MEMORY_OVERLAY = 3,
++};
++
++/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
++enum v4l2_colorspace {
++ /* ITU-R 601 -- broadcast NTSC/PAL */
++ V4L2_COLORSPACE_SMPTE170M = 1,
++
++ /* 1125-Line (US) HDTV */
++ V4L2_COLORSPACE_SMPTE240M = 2,
++
++ /* HD and modern captures. */
++ V4L2_COLORSPACE_REC709 = 3,
++
++ /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
++ V4L2_COLORSPACE_BT878 = 4,
++
++ /* These should be useful. Assume 601 extents. */
++ V4L2_COLORSPACE_470_SYSTEM_M = 5,
++ V4L2_COLORSPACE_470_SYSTEM_BG = 6,
++
++ /* I know there will be cameras that send this. So, this is
++ * unspecified chromaticities and full 0-255 on each of the
++ * Y'CbCr components
++ */
++ V4L2_COLORSPACE_JPEG = 7,
++
++ /* For RGB colourspaces, this is probably a good start. */
++ V4L2_COLORSPACE_SRGB = 8,
++};
++
++enum v4l2_priority {
++ V4L2_PRIORITY_UNSET = 0, /* not initialized */
++ V4L2_PRIORITY_BACKGROUND = 1,
++ V4L2_PRIORITY_INTERACTIVE = 2,
++ V4L2_PRIORITY_RECORD = 3,
++ V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE,
++};
++
++struct v4l2_rect {
++ __s32 left;
++ __s32 top;
++ __s32 width;
++ __s32 height;
++};
++
++struct v4l2_fract {
++ __u32 numerator;
++ __u32 denominator;
++};
++
++/*
++ * D R I V E R C A P A B I L I T I E S
++ */
++struct v4l2_capability {
++ __u8 driver[16]; /* i.e. "bttv" */
++ __u8 card[32]; /* i.e. "Hauppauge WinTV" */
++ __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
++ __u32 version; /* should use KERNEL_VERSION() */
++ __u32 capabilities; /* Device capabilities */
++ __u32 reserved[4];
++};
++
++/* Values for 'capabilities' field */
++#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
++#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
++#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
++#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
++#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
++#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
++#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
++#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
++#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
++#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
++#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
++
++/* Is a video capture device that supports multiplanar formats */
++#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
++/* Is a video output device that supports multiplanar formats */
++#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
++
++#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
++#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
++#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
++#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
++
++#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
++#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
++#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
++
++/*
++ * V I D E O I M A G E F O R M A T
++ */
++struct v4l2_pix_format {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ enum v4l2_field field;
++ __u32 bytesperline; /* for padding, zero if unused */
++ __u32 sizeimage;
++ enum v4l2_colorspace colorspace;
++ __u32 priv; /* private data, depends on pixelformat */
++};
++
++/* Pixel format FOURCC depth Description */
++
++/* RGB formats */
++#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
++#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
++#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
++#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
++#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
++#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
++#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
++#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
++#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
++#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
++#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
++
++/* Grey formats */
++#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
++#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
++#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
++#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
++#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
++
++/* Palette formats */
++#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
++
++/* Luminance+Chrominance formats */
++#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
++#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
++#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
++#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
++#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
++#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
++#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
++#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
++#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
++#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
++#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
++#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
++#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
++#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
++
++/* two planes -- one Y, one Cr + Cb interleaved */
++#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
++#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
++#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
++#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
++
++/* two non contiguous planes - one Y, one Cr + Cb interleaved */
++#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
++#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
++
++/* three non contiguous planes - Y, Cb, Cr */
++#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
++
++/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
++#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
++#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
++#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
++#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
++#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */
++#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
++#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
++#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
++ /* 10bit raw bayer DPCM compressed to 8 bits */
++#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
++ /*
++ * 10bit raw bayer, expanded to 16 bits
++ * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
++ */
++#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
++
++/* compressed formats */
++#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
++#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
++#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
++#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
++
++/* Vendor-specific formats */
++#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
++#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
++#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
++#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
++#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
++#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
++#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
++#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
++#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
++#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
++#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
++#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
++#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
++#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
++#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
++#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
++#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
++#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
++#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
++#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
++#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
++#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
++
++/*
++ * F O R M A T E N U M E R A T I O N
++ */
++struct v4l2_fmtdesc {
++ __u32 index; /* Format number */
++ enum v4l2_buf_type type; /* buffer type */
++ __u32 flags;
++ __u8 description[32]; /* Description string */
++ __u32 pixelformat; /* Format fourcc */
++ __u32 reserved[4];
++};
++
++#define V4L2_FMT_FLAG_COMPRESSED 0x0001
++#define V4L2_FMT_FLAG_EMULATED 0x0002
++
++#if 1
++ /* Experimental Frame Size and frame rate enumeration */
++/*
++ * F R A M E S I Z E E N U M E R A T I O N
++ */
++enum v4l2_frmsizetypes {
++ V4L2_FRMSIZE_TYPE_DISCRETE = 1,
++ V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
++ V4L2_FRMSIZE_TYPE_STEPWISE = 3,
++};
++
++struct v4l2_frmsize_discrete {
++ __u32 width; /* Frame width [pixel] */
++ __u32 height; /* Frame height [pixel] */
++};
++
++struct v4l2_frmsize_stepwise {
++ __u32 min_width; /* Minimum frame width [pixel] */
++ __u32 max_width; /* Maximum frame width [pixel] */
++ __u32 step_width; /* Frame width step size [pixel] */
++ __u32 min_height; /* Minimum frame height [pixel] */
++ __u32 max_height; /* Maximum frame height [pixel] */
++ __u32 step_height; /* Frame height step size [pixel] */
++};
++
++struct v4l2_frmsizeenum {
++ __u32 index; /* Frame size number */
++ __u32 pixel_format; /* Pixel format */
++ __u32 type; /* Frame size type the device supports. */
++
++ union { /* Frame size */
++ struct v4l2_frmsize_discrete discrete;
++ struct v4l2_frmsize_stepwise stepwise;
++ };
++
++ __u32 reserved[2]; /* Reserved space for future use */
++};
++
++/*
++ * F R A M E R A T E E N U M E R A T I O N
++ */
++enum v4l2_frmivaltypes {
++ V4L2_FRMIVAL_TYPE_DISCRETE = 1,
++ V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
++ V4L2_FRMIVAL_TYPE_STEPWISE = 3,
++};
++
++struct v4l2_frmival_stepwise {
++ struct v4l2_fract min; /* Minimum frame interval [s] */
++ struct v4l2_fract max; /* Maximum frame interval [s] */
++ struct v4l2_fract step; /* Frame interval step size [s] */
++};
++
++struct v4l2_frmivalenum {
++ __u32 index; /* Frame format index */
++ __u32 pixel_format; /* Pixel format */
++ __u32 width; /* Frame width */
++ __u32 height; /* Frame height */
++ __u32 type; /* Frame interval type the device supports. */
++
++ union { /* Frame interval */
++ struct v4l2_fract discrete;
++ struct v4l2_frmival_stepwise stepwise;
++ };
++
++ __u32 reserved[2]; /* Reserved space for future use */
++};
++#endif
++
++/*
++ * T I M E C O D E
++ */
++struct v4l2_timecode {
++ __u32 type;
++ __u32 flags;
++ __u8 frames;
++ __u8 seconds;
++ __u8 minutes;
++ __u8 hours;
++ __u8 userbits[4];
++};
++
++/* Type */
++#define V4L2_TC_TYPE_24FPS 1
++#define V4L2_TC_TYPE_25FPS 2
++#define V4L2_TC_TYPE_30FPS 3
++#define V4L2_TC_TYPE_50FPS 4
++#define V4L2_TC_TYPE_60FPS 5
++
++/* Flags */
++#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
++#define V4L2_TC_FLAG_COLORFRAME 0x0002
++#define V4L2_TC_USERBITS_field 0x000C
++#define V4L2_TC_USERBITS_USERDEFINED 0x0000
++#define V4L2_TC_USERBITS_8BITCHARS 0x0008
++/* The above is based on SMPTE timecodes */
++
++struct v4l2_jpegcompression {
++ int quality;
++
++ int APPn; /* Number of APP segment to be written,
++ * must be 0..15 */
++ int APP_len; /* Length of data in JPEG APPn segment */
++ char APP_data[60]; /* Data in the JPEG APPn segment. */
++
++ int COM_len; /* Length of data in JPEG COM segment */
++ char COM_data[60]; /* Data in JPEG COM segment */
++
++ __u32 jpeg_markers; /* Which markers should go into the JPEG
++ * output. Unless you exactly know what
++ * you do, leave them untouched.
++ * Inluding less markers will make the
++ * resulting code smaller, but there will
++ * be fewer applications which can read it.
++ * The presence of the APP and COM marker
++ * is influenced by APP_len and COM_len
++ * ONLY, not by this property! */
++
++#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
++#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
++#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
++#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
++#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
++ * allways use APP0 */
++};
++
++/*
++ * M E M O R Y - M A P P I N G B U F F E R S
++ */
++struct v4l2_requestbuffers {
++ __u32 count;
++ enum v4l2_buf_type type;
++ enum v4l2_memory memory;
++ __u32 reserved[2];
++};
++
++/**
++ * struct v4l2_plane - plane info for multi-planar buffers
++ * @bytesused: number of bytes occupied by data in the plane (payload)
++ * @length: size of this plane (NOT the payload) in bytes
++ * @mem_offset: when memory in the associated struct v4l2_buffer is
++ * V4L2_MEMORY_MMAP, equals the offset from the start of
++ * the device memory for this plane (or is a "cookie" that
++ * should be passed to mmap() called on the video node)
++ * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
++ * pointing to this plane
++ * @data_offset: offset in the plane to the start of data; usually 0,
++ * unless there is a header in front of the data
++ *
++ * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
++ * with two planes can have one plane for Y, and another for interleaved CbCr
++ * components. Each plane can reside in a separate memory buffer, or even in
++ * a completely separate memory node (e.g. in embedded devices).
++ */
++struct v4l2_plane {
++ __u32 bytesused;
++ __u32 length;
++ union {
++ __u32 mem_offset;
++ unsigned long userptr;
++ } m;
++ __u32 data_offset;
++ __u32 reserved[11];
++};
++
++/**
++ * struct v4l2_buffer - video buffer info
++ * @index: id number of the buffer
++ * @type: buffer type (type == *_MPLANE for multiplanar buffers)
++ * @bytesused: number of bytes occupied by data in the buffer (payload);
++ * unused (set to 0) for multiplanar buffers
++ * @flags: buffer informational flags
++ * @field: field order of the image in the buffer
++ * @timestamp: frame timestamp
++ * @timecode: frame timecode
++ * @sequence: sequence count of this frame
++ * @memory: the method, in which the actual video data is passed
++ * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
++ * offset from the start of the device memory for this plane,
++ * (or a "cookie" that should be passed to mmap() as offset)
++ * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
++ * a userspace pointer pointing to this buffer
++ * @planes: for multiplanar buffers; userspace pointer to the array of plane
++ * info structs for this buffer
++ * @length: size in bytes of the buffer (NOT its payload) for single-plane
++ * buffers (when type != *_MPLANE); number of elements in the
++ * planes array for multi-plane buffers
++ * @input: input number from which the video data has has been captured
++ *
++ * Contains data exchanged by application and driver using one of the Streaming
++ * I/O methods.
++ */
++struct v4l2_buffer {
++ __u32 index;
++ enum v4l2_buf_type type;
++ __u32 bytesused;
++ __u32 flags;
++ enum v4l2_field field;
++ struct timeval timestamp;
++ struct v4l2_timecode timecode;
++ __u32 sequence;
++
++ /* memory location */
++ enum v4l2_memory memory;
++ union {
++ __u32 offset;
++ unsigned long userptr;
++ struct v4l2_plane *planes;
++ } m;
++ __u32 length;
++ __u32 input;
++ __u32 reserved;
++};
++
++/* Flags for 'flags' field */
++#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
++#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
++#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
++#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
++#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
++#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
++/* Buffer is ready, but the data contained within is corrupted. */
++#define V4L2_BUF_FLAG_ERROR 0x0040
++#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
++#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
++
++/*
++ * O V E R L A Y P R E V I E W
++ */
++struct v4l2_framebuffer {
++ __u32 capability;
++ __u32 flags;
++/* FIXME: in theory we should pass something like PCI device + memory
++ * region + offset instead of some physical address */
++ void *base;
++ struct v4l2_pix_format fmt;
++};
++/* Flags for the 'capability' field. Read only */
++#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
++#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
++#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
++#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
++#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
++#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
++#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
++#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080
++/* Flags for the 'flags' field. */
++#define V4L2_FBUF_FLAG_PRIMARY 0x0001
++#define V4L2_FBUF_FLAG_OVERLAY 0x0002
++#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
++#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
++#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
++#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
++#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
++
++struct v4l2_clip {
++ struct v4l2_rect c;
++ struct v4l2_clip *next;
++};
++
++struct v4l2_window {
++ struct v4l2_rect w;
++ enum v4l2_field field;
++ __u32 chromakey;
++ struct v4l2_clip *clips;
++ __u32 clipcount;
++ void *bitmap;
++ __u8 global_alpha;
++};
++
++/*
++ * C A P T U R E P A R A M E T E R S
++ */
++struct v4l2_captureparm {
++ __u32 capability; /* Supported modes */
++ __u32 capturemode; /* Current mode */
++ struct v4l2_fract timeperframe; /* Time per frame in .1us units */
++ __u32 extendedmode; /* Driver-specific extensions */
++ __u32 readbuffers; /* # of buffers for read */
++ __u32 reserved[4];
++};
++
++/* Flags for 'capability' and 'capturemode' fields */
++#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
++#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
++
++struct v4l2_outputparm {
++ __u32 capability; /* Supported modes */
++ __u32 outputmode; /* Current mode */
++ struct v4l2_fract timeperframe; /* Time per frame in seconds */
++ __u32 extendedmode; /* Driver-specific extensions */
++ __u32 writebuffers; /* # of buffers for write */
++ __u32 reserved[4];
++};
++
++/*
++ * I N P U T I M A G E C R O P P I N G
++ */
++struct v4l2_cropcap {
++ enum v4l2_buf_type type;
++ struct v4l2_rect bounds;
++ struct v4l2_rect defrect;
++ struct v4l2_fract pixelaspect;
++};
++
++struct v4l2_crop {
++ enum v4l2_buf_type type;
++ struct v4l2_rect c;
++};
++
++/*
++ * A N A L O G V I D E O S T A N D A R D
++ */
++
++typedef __u64 v4l2_std_id;
++
++/* one bit for each */
++#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
++#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
++#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
++#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
++#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
++#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
++#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
++#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
++
++#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
++#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
++#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
++#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
++
++#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
++#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
++#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
++#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
++
++#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
++#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
++#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
++#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
++#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
++#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
++#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
++#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
++
++/* ATSC/HDTV */
++#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
++#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
++
++/* FIXME:
++ Although std_id is 64 bits, there is an issue on PPC32 architecture that
++ makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
++ this value to 32 bits.
++ As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
++ it should work fine. However, if needed to add more than two standards,
++ v4l2-common.c should be fixed.
++ */
++
++/* some merged standards */
++#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
++#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
++#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
++#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
++
++/* some common needed stuff */
++#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
++ V4L2_STD_PAL_B1 |\
++ V4L2_STD_PAL_G)
++#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
++ V4L2_STD_PAL_D1 |\
++ V4L2_STD_PAL_K)
++#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
++ V4L2_STD_PAL_DK |\
++ V4L2_STD_PAL_H |\
++ V4L2_STD_PAL_I)
++#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
++ V4L2_STD_NTSC_M_JP |\
++ V4L2_STD_NTSC_M_KR)
++#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
++ V4L2_STD_SECAM_K |\
++ V4L2_STD_SECAM_K1)
++#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
++ V4L2_STD_SECAM_G |\
++ V4L2_STD_SECAM_H |\
++ V4L2_STD_SECAM_DK |\
++ V4L2_STD_SECAM_L |\
++ V4L2_STD_SECAM_LC)
++
++#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
++ V4L2_STD_PAL_60 |\
++ V4L2_STD_NTSC |\
++ V4L2_STD_NTSC_443)
++#define V4L2_STD_625_50 (V4L2_STD_PAL |\
++ V4L2_STD_PAL_N |\
++ V4L2_STD_PAL_Nc |\
++ V4L2_STD_SECAM)
++#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
++ V4L2_STD_ATSC_16_VSB)
++
++#define V4L2_STD_UNKNOWN 0
++#define V4L2_STD_ALL (V4L2_STD_525_60 |\
++ V4L2_STD_625_50)
++
++struct v4l2_standard {
++ __u32 index;
++ v4l2_std_id id;
++ __u8 name[24];
++ struct v4l2_fract frameperiod; /* Frames, not fields */
++ __u32 framelines;
++ __u32 reserved[4];
++};
++
++/*
++ * V I D E O T I M I N G S D V P R E S E T
++ */
++struct v4l2_dv_preset {
++ __u32 preset;
++ __u32 reserved[4];
++};
++
++/*
++ * D V P R E S E T S E N U M E R A T I O N
++ */
++struct v4l2_dv_enum_preset {
++ __u32 index;
++ __u32 preset;
++ __u8 name[32]; /* Name of the preset timing */
++ __u32 width;
++ __u32 height;
++ __u32 reserved[4];
++};
++
++/*
++ * D V P R E S E T V A L U E S
++ */
++#define V4L2_DV_INVALID 0
++#define V4L2_DV_480P59_94 1 /* BT.1362 */
++#define V4L2_DV_576P50 2 /* BT.1362 */
++#define V4L2_DV_720P24 3 /* SMPTE 296M */
++#define V4L2_DV_720P25 4 /* SMPTE 296M */
++#define V4L2_DV_720P30 5 /* SMPTE 296M */
++#define V4L2_DV_720P50 6 /* SMPTE 296M */
++#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
++#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
++#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
++#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
++#define V4L2_DV_1080I25 11 /* BT.1120 */
++#define V4L2_DV_1080I50 12 /* SMPTE 296M */
++#define V4L2_DV_1080I60 13 /* SMPTE 296M */
++#define V4L2_DV_1080P24 14 /* SMPTE 296M */
++#define V4L2_DV_1080P25 15 /* SMPTE 296M */
++#define V4L2_DV_1080P30 16 /* SMPTE 296M */
++#define V4L2_DV_1080P50 17 /* BT.1120 */
++#define V4L2_DV_1080P60 18 /* BT.1120 */
++
++/*
++ * D V B T T I M I N G S
++ */
++
++/* BT.656/BT.1120 timing data */
++struct v4l2_bt_timings {
++ __u32 width; /* width in pixels */
++ __u32 height; /* height in lines */
++ __u32 interlaced; /* Interlaced or progressive */
++ __u32 polarities; /* Positive or negative polarity */
++ __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
++ __u32 hfrontporch; /* Horizpontal front porch in pixels */
++ __u32 hsync; /* Horizontal Sync length in pixels */
++ __u32 hbackporch; /* Horizontal back porch in pixels */
++ __u32 vfrontporch; /* Vertical front porch in pixels */
++ __u32 vsync; /* Vertical Sync length in lines */
++ __u32 vbackporch; /* Vertical back porch in lines */
++ __u32 il_vfrontporch; /* Vertical front porch for bottom field of
++ * interlaced field formats
++ */
++ __u32 il_vsync; /* Vertical sync length for bottom field of
++ * interlaced field formats
++ */
++ __u32 il_vbackporch; /* Vertical back porch for bottom field of
++ * interlaced field formats
++ */
++ __u32 reserved[16];
++} __attribute__ ((packed));
++
++/* Interlaced or progressive format */
++#define V4L2_DV_PROGRESSIVE 0
++#define V4L2_DV_INTERLACED 1
++
++/* Polarities. If bit is not set, it is assumed to be negative polarity */
++#define V4L2_DV_VSYNC_POS_POL 0x00000001
++#define V4L2_DV_HSYNC_POS_POL 0x00000002
++
++
++/* DV timings */
++struct v4l2_dv_timings {
++ __u32 type;
++ union {
++ struct v4l2_bt_timings bt;
++ __u32 reserved[32];
++ };
++} __attribute__ ((packed));
++
++/* Values for the type field */
++#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
++
++/*
++ * V I D E O I N P U T S
++ */
++struct v4l2_input {
++ __u32 index; /* Which input */
++ __u8 name[32]; /* Label */
++ __u32 type; /* Type of input */
++ __u32 audioset; /* Associated audios (bitfield) */
++ __u32 tuner; /* Associated tuner */
++ v4l2_std_id std;
++ __u32 status;
++ __u32 capabilities;
++ __u32 reserved[3];
++};
++
++/* Values for the 'type' field */
++#define V4L2_INPUT_TYPE_TUNER 1
++#define V4L2_INPUT_TYPE_CAMERA 2
++
++/* field 'status' - general */
++#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
++#define V4L2_IN_ST_NO_SIGNAL 0x00000002
++#define V4L2_IN_ST_NO_COLOR 0x00000004
++
++/* field 'status' - sensor orientation */
++/* If sensor is mounted upside down set both bits */
++#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
++#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
++
++/* field 'status' - analog */
++#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
++#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
++
++/* field 'status' - digital */
++#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
++#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
++#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
++
++/* field 'status' - VCR and set-top box */
++#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
++#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
++#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
++
++/* capabilities flags */
++#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
++#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
++#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
++
++/*
++ * V I D E O O U T P U T S
++ */
++struct v4l2_output {
++ __u32 index; /* Which output */
++ __u8 name[32]; /* Label */
++ __u32 type; /* Type of output */
++ __u32 audioset; /* Associated audios (bitfield) */
++ __u32 modulator; /* Associated modulator */
++ v4l2_std_id std;
++ __u32 capabilities;
++ __u32 reserved[3];
++};
++/* Values for the 'type' field */
++#define V4L2_OUTPUT_TYPE_MODULATOR 1
++#define V4L2_OUTPUT_TYPE_ANALOG 2
++#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
++
++/* capabilities flags */
++#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
++#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
++#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
++
++/*
++ * C O N T R O L S
++ */
++struct v4l2_control {
++ __u32 id;
++ __s32 value;
++};
++
++struct v4l2_ext_control {
++ __u32 id;
++ __u32 size;
++ __u32 reserved2[1];
++ union {
++ __s32 value;
++ __s64 value64;
++ char *string;
++ };
++} __attribute__ ((packed));
++
++struct v4l2_ext_controls {
++ __u32 ctrl_class;
++ __u32 count;
++ __u32 error_idx;
++ __u32 reserved[2];
++ struct v4l2_ext_control *controls;
++};
++
++/* Values for ctrl_class field */
++#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
++#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
++#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
++#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
++
++#define V4L2_CTRL_ID_MASK (0x0fffffff)
++#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
++#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
++
++enum v4l2_ctrl_type {
++ V4L2_CTRL_TYPE_INTEGER = 1,
++ V4L2_CTRL_TYPE_BOOLEAN = 2,
++ V4L2_CTRL_TYPE_MENU = 3,
++ V4L2_CTRL_TYPE_BUTTON = 4,
++ V4L2_CTRL_TYPE_INTEGER64 = 5,
++ V4L2_CTRL_TYPE_CTRL_CLASS = 6,
++ V4L2_CTRL_TYPE_STRING = 7,
++};
++
++/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
++struct v4l2_queryctrl {
++ __u32 id;
++ enum v4l2_ctrl_type type;
++ __u8 name[32]; /* Whatever */
++ __s32 minimum; /* Note signedness */
++ __s32 maximum;
++ __s32 step;
++ __s32 default_value;
++ __u32 flags;
++ __u32 reserved[2];
++};
++
++/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
++struct v4l2_querymenu {
++ __u32 id;
++ __u32 index;
++ __u8 name[32]; /* Whatever */
++ __u32 reserved;
++};
++
++/* Control flags */
++#define V4L2_CTRL_FLAG_DISABLED 0x0001
++#define V4L2_CTRL_FLAG_GRABBED 0x0002
++#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
++#define V4L2_CTRL_FLAG_UPDATE 0x0008
++#define V4L2_CTRL_FLAG_INACTIVE 0x0010
++#define V4L2_CTRL_FLAG_SLIDER 0x0020
++#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
++
++/* Query flag, to be ORed with the control ID */
++#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
++
++/* User-class control IDs defined by V4L2 */
++#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
++#define V4L2_CID_USER_BASE V4L2_CID_BASE
++/* IDs reserved for driver specific controls */
++#define V4L2_CID_PRIVATE_BASE 0x08000000
++
++#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
++#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
++#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
++#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
++#define V4L2_CID_HUE (V4L2_CID_BASE+3)
++#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
++#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
++#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
++#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
++#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
++#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
++#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
++#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
++#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
++#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
++#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
++#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
++#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
++#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
++#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
++#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
++#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
++#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
++
++/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
++#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
++#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
++
++#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
++enum v4l2_power_line_frequency {
++ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
++ V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
++ V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
++};
++#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
++#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
++#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
++#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
++#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
++#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
++#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
++enum v4l2_colorfx {
++ V4L2_COLORFX_NONE = 0,
++ V4L2_COLORFX_BW = 1,
++ V4L2_COLORFX_SEPIA = 2,
++ V4L2_COLORFX_NEGATIVE = 3,
++ V4L2_COLORFX_EMBOSS = 4,
++ V4L2_COLORFX_SKETCH = 5,
++ V4L2_COLORFX_SKY_BLUE = 6,
++ V4L2_COLORFX_GRASS_GREEN = 7,
++ V4L2_COLORFX_SKIN_WHITEN = 8,
++ V4L2_COLORFX_VIVID = 9,
++};
++#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
++#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
++
++#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
++#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
++
++#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
++
++#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
++#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
++
++/* last CID + 1 */
++#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39)
++
++/* MPEG-class control IDs defined by V4L2 */
++#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
++#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
++
++/* MPEG streams */
++#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
++enum v4l2_mpeg_stream_type {
++ V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
++};
++#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
++#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
++#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
++#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
++#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
++#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
++#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
++enum v4l2_mpeg_stream_vbi_fmt {
++ V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
++ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
++};
++
++/* MPEG audio */
++#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
++enum v4l2_mpeg_audio_sampling_freq {
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
++};
++#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
++enum v4l2_mpeg_audio_encoding {
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
++ V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
++ V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
++};
++#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
++enum v4l2_mpeg_audio_l1_bitrate {
++ V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
++ V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
++ V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
++ V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
++ V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
++ V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
++ V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
++ V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
++ V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
++ V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
++ V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
++ V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
++ V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
++enum v4l2_mpeg_audio_l2_bitrate {
++ V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
++ V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
++ V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
++ V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
++ V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
++ V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
++ V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
++ V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
++ V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
++ V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
++ V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
++ V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
++ V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
++enum v4l2_mpeg_audio_l3_bitrate {
++ V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
++ V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
++ V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
++ V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
++ V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
++ V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
++ V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
++ V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
++ V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
++ V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
++ V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
++ V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
++ V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
++enum v4l2_mpeg_audio_mode {
++ V4L2_MPEG_AUDIO_MODE_STEREO = 0,
++ V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
++ V4L2_MPEG_AUDIO_MODE_DUAL = 2,
++ V4L2_MPEG_AUDIO_MODE_MONO = 3,
++};
++#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
++enum v4l2_mpeg_audio_mode_extension {
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
++};
++#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
++enum v4l2_mpeg_audio_emphasis {
++ V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
++ V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
++ V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
++};
++#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
++enum v4l2_mpeg_audio_crc {
++ V4L2_MPEG_AUDIO_CRC_NONE = 0,
++ V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
++};
++#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
++#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
++#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
++enum v4l2_mpeg_audio_ac3_bitrate {
++ V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
++};
++
++/* MPEG video */
++#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
++enum v4l2_mpeg_video_encoding {
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
++};
++#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
++enum v4l2_mpeg_video_aspect {
++ V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
++ V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
++ V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
++ V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
++};
++#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
++#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
++#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
++#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
++#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
++enum v4l2_mpeg_video_bitrate_mode {
++ V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
++ V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
++};
++#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
++#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
++#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
++#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
++#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
++
++/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
++#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
++enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
++ V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
++ V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
++enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
++enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
++enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
++ V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
++ V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
++enum v4l2_mpeg_cx2341x_video_median_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
++#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
++
++/* Camera class control IDs */
++#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
++#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
++
++#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
++enum v4l2_exposure_auto_type {
++ V4L2_EXPOSURE_AUTO = 0,
++ V4L2_EXPOSURE_MANUAL = 1,
++ V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
++ V4L2_EXPOSURE_APERTURE_PRIORITY = 3
++};
++#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
++#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
++
++#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
++#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
++#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
++#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
++
++#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
++#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
++
++#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
++#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
++#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
++
++#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
++#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
++#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
++
++#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
++
++#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
++#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
++
++/* FM Modulator class control IDs */
++#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
++#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
++
++#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
++#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
++#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
++#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
++#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
++
++#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
++#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
++#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
++
++#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
++#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
++#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
++#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
++#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
++
++#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
++#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
++#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
++
++#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
++enum v4l2_preemphasis {
++ V4L2_PREEMPHASIS_DISABLED = 0,
++ V4L2_PREEMPHASIS_50_uS = 1,
++ V4L2_PREEMPHASIS_75_uS = 2,
++};
++#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
++#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
++
++/*
++ * T U N I N G
++ */
++struct v4l2_tuner {
++ __u32 index;
++ __u8 name[32];
++ enum v4l2_tuner_type type;
++ __u32 capability;
++ __u32 rangelow;
++ __u32 rangehigh;
++ __u32 rxsubchans;
++ __u32 audmode;
++ __s32 signal;
++ __s32 afc;
++ __u32 reserved[4];
++};
++
++struct v4l2_modulator {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 rangelow;
++ __u32 rangehigh;
++ __u32 txsubchans;
++ __u32 reserved[4];
++};
++
++/* Flags for the 'capability' field */
++#define V4L2_TUNER_CAP_LOW 0x0001
++#define V4L2_TUNER_CAP_NORM 0x0002
++#define V4L2_TUNER_CAP_STEREO 0x0010
++#define V4L2_TUNER_CAP_LANG2 0x0020
++#define V4L2_TUNER_CAP_SAP 0x0020
++#define V4L2_TUNER_CAP_LANG1 0x0040
++#define V4L2_TUNER_CAP_RDS 0x0080
++#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100
++#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
++
++/* Flags for the 'rxsubchans' field */
++#define V4L2_TUNER_SUB_MONO 0x0001
++#define V4L2_TUNER_SUB_STEREO 0x0002
++#define V4L2_TUNER_SUB_LANG2 0x0004
++#define V4L2_TUNER_SUB_SAP 0x0004
++#define V4L2_TUNER_SUB_LANG1 0x0008
++#define V4L2_TUNER_SUB_RDS 0x0010
++
++/* Values for the 'audmode' field */
++#define V4L2_TUNER_MODE_MONO 0x0000
++#define V4L2_TUNER_MODE_STEREO 0x0001
++#define V4L2_TUNER_MODE_LANG2 0x0002
++#define V4L2_TUNER_MODE_SAP 0x0002
++#define V4L2_TUNER_MODE_LANG1 0x0003
++#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
++
++struct v4l2_frequency {
++ __u32 tuner;
++ enum v4l2_tuner_type type;
++ __u32 frequency;
++ __u32 reserved[8];
++};
++
++struct v4l2_hw_freq_seek {
++ __u32 tuner;
++ enum v4l2_tuner_type type;
++ __u32 seek_upward;
++ __u32 wrap_around;
++ __u32 spacing;
++ __u32 reserved[7];
++};
++
++/*
++ * R D S
++ */
++
++struct v4l2_rds_data {
++ __u8 lsb;
++ __u8 msb;
++ __u8 block;
++} __attribute__ ((packed));
++
++#define V4L2_RDS_BLOCK_MSK 0x7
++#define V4L2_RDS_BLOCK_A 0
++#define V4L2_RDS_BLOCK_B 1
++#define V4L2_RDS_BLOCK_C 2
++#define V4L2_RDS_BLOCK_D 3
++#define V4L2_RDS_BLOCK_C_ALT 4
++#define V4L2_RDS_BLOCK_INVALID 7
++
++#define V4L2_RDS_BLOCK_CORRECTED 0x40
++#define V4L2_RDS_BLOCK_ERROR 0x80
++
++/*
++ * A U D I O
++ */
++struct v4l2_audio {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 mode;
++ __u32 reserved[2];
++};
++
++/* Flags for the 'capability' field */
++#define V4L2_AUDCAP_STEREO 0x00001
++#define V4L2_AUDCAP_AVL 0x00002
++
++/* Flags for the 'mode' field */
++#define V4L2_AUDMODE_AVL 0x00001
++
++struct v4l2_audioout {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 mode;
++ __u32 reserved[2];
++};
++
++/*
++ * M P E G S E R V I C E S
++ *
++ * NOTE: EXPERIMENTAL API
++ */
++#if 1
++#define V4L2_ENC_IDX_FRAME_I (0)
++#define V4L2_ENC_IDX_FRAME_P (1)
++#define V4L2_ENC_IDX_FRAME_B (2)
++#define V4L2_ENC_IDX_FRAME_MASK (0xf)
++
++struct v4l2_enc_idx_entry {
++ __u64 offset;
++ __u64 pts;
++ __u32 length;
++ __u32 flags;
++ __u32 reserved[2];
++};
++
++#define V4L2_ENC_IDX_ENTRIES (64)
++struct v4l2_enc_idx {
++ __u32 entries;
++ __u32 entries_cap;
++ __u32 reserved[4];
++ struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
++};
++
++
++#define V4L2_ENC_CMD_START (0)
++#define V4L2_ENC_CMD_STOP (1)
++#define V4L2_ENC_CMD_PAUSE (2)
++#define V4L2_ENC_CMD_RESUME (3)
++
++/* Flags for V4L2_ENC_CMD_STOP */
++#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
++
++struct v4l2_encoder_cmd {
++ __u32 cmd;
++ __u32 flags;
++ union {
++ struct {
++ __u32 data[8];
++ } raw;
++ };
++};
++
++#endif
++
++
++/*
++ * D A T A S E R V I C E S ( V B I )
++ *
++ * Data services API by Michael Schimek
++ */
++
++/* Raw VBI */
++struct v4l2_vbi_format {
++ __u32 sampling_rate; /* in 1 Hz */
++ __u32 offset;
++ __u32 samples_per_line;
++ __u32 sample_format; /* V4L2_PIX_FMT_* */
++ __s32 start[2];
++ __u32 count[2];
++ __u32 flags; /* V4L2_VBI_* */
++ __u32 reserved[2]; /* must be zero */
++};
++
++/* VBI flags */
++#define V4L2_VBI_UNSYNC (1 << 0)
++#define V4L2_VBI_INTERLACED (1 << 1)
++
++/* Sliced VBI
++ *
++ * This implements is a proposal V4L2 API to allow SLICED VBI
++ * required for some hardware encoders. It should change without
++ * notice in the definitive implementation.
++ */
++
++struct v4l2_sliced_vbi_format {
++ __u16 service_set;
++ /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
++ service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
++ (equals frame lines 313-336 for 625 line video
++ standards, 263-286 for 525 line standards) */
++ __u16 service_lines[2][24];
++ __u32 io_size;
++ __u32 reserved[2]; /* must be zero */
++};
++
++/* Teletext World System Teletext
++ (WST), defined on ITU-R BT.653-2 */
++#define V4L2_SLICED_TELETEXT_B (0x0001)
++/* Video Program System, defined on ETS 300 231*/
++#define V4L2_SLICED_VPS (0x0400)
++/* Closed Caption, defined on EIA-608 */
++#define V4L2_SLICED_CAPTION_525 (0x1000)
++/* Wide Screen System, defined on ITU-R BT1119.1 */
++#define V4L2_SLICED_WSS_625 (0x4000)
++
++#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
++#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
++
++struct v4l2_sliced_vbi_cap {
++ __u16 service_set;
++ /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
++ service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
++ (equals frame lines 313-336 for 625 line video
++ standards, 263-286 for 525 line standards) */
++ __u16 service_lines[2][24];
++ enum v4l2_buf_type type;
++ __u32 reserved[3]; /* must be 0 */
++};
++
++struct v4l2_sliced_vbi_data {
++ __u32 id;
++ __u32 field; /* 0: first field, 1: second field */
++ __u32 line; /* 1-23 */
++ __u32 reserved; /* must be 0 */
++ __u8 data[48];
++};
++
++/*
++ * Sliced VBI data inserted into MPEG Streams
++ */
++
++/*
++ * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
++ *
++ * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
++ * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
++ * data
++ *
++ * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
++ * definitions are not included here. See the MPEG-2 specifications for details
++ * on these headers.
++ */
++
++/* Line type IDs */
++#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
++#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
++#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
++#define V4L2_MPEG_VBI_IVTV_VPS (7)
++
++struct v4l2_mpeg_vbi_itv0_line {
++ __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
++ __u8 data[42]; /* Sliced VBI data for the line */
++} __attribute__ ((packed));
++
++struct v4l2_mpeg_vbi_itv0 {
++ __le32 linemask[2]; /* Bitmasks of VBI service lines present */
++ struct v4l2_mpeg_vbi_itv0_line line[35];
++} __attribute__ ((packed));
++
++struct v4l2_mpeg_vbi_ITV0 {
++ struct v4l2_mpeg_vbi_itv0_line line[36];
++} __attribute__ ((packed));
++
++#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
++#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
++
++struct v4l2_mpeg_vbi_fmt_ivtv {
++ __u8 magic[4];
++ union {
++ struct v4l2_mpeg_vbi_itv0 itv0;
++ struct v4l2_mpeg_vbi_ITV0 ITV0;
++ };
++} __attribute__ ((packed));
++
++/*
++ * A G G R E G A T E S T R U C T U R E S
++ */
++
++/**
++ * struct v4l2_plane_pix_format - additional, per-plane format definition
++ * @sizeimage: maximum size in bytes required for data, for which
++ * this plane will be used
++ * @bytesperline: distance in bytes between the leftmost pixels in two
++ * adjacent lines
++ */
++struct v4l2_plane_pix_format {
++ __u32 sizeimage;
++ __u16 bytesperline;
++ __u16 reserved[7];
++} __attribute__ ((packed));
++
++/**
++ * struct v4l2_pix_format_mplane - multiplanar format definition
++ * @width: image width in pixels
++ * @height: image height in pixels
++ * @pixelformat: little endian four character code (fourcc)
++ * @field: field order (for interlaced video)
++ * @colorspace: supplemental to pixelformat
++ * @plane_fmt: per-plane information
++ * @num_planes: number of planes for this format
++ */
++struct v4l2_pix_format_mplane {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ enum v4l2_field field;
++ enum v4l2_colorspace colorspace;
++
++ struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
++ __u8 num_planes;
++ __u8 reserved[11];
++} __attribute__ ((packed));
++
++/**
++ * struct v4l2_format - stream data format
++ * @type: type of the data stream
++ * @pix: definition of an image format
++ * @pix_mp: definition of a multiplanar image format
++ * @win: definition of an overlaid image
++ * @vbi: raw VBI capture or output parameters
++ * @sliced: sliced VBI capture or output parameters
++ * @raw_data: placeholder for future extensions and custom formats
++ */
++struct v4l2_format {
++ enum v4l2_buf_type type;
++ union {
++ struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
++ struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
++ struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
++ struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
++ struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
++ __u8 raw_data[200]; /* user-defined */
++ } fmt;
++};
++
++/* Stream type-dependent parameters
++ */
++struct v4l2_streamparm {
++ enum v4l2_buf_type type;
++ union {
++ struct v4l2_captureparm capture;
++ struct v4l2_outputparm output;
++ __u8 raw_data[200]; /* user-defined */
++ } parm;
++};
++
++/*
++ * E V E N T S
++ */
++
++#define V4L2_EVENT_ALL 0
++#define V4L2_EVENT_VSYNC 1
++#define V4L2_EVENT_EOS 2
++#define V4L2_EVENT_PRIVATE_START 0x08000000
++
++/* Payload for V4L2_EVENT_VSYNC */
++struct v4l2_event_vsync {
++ /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
++ __u8 field;
++} __attribute__ ((packed));
++
++struct v4l2_event {
++ __u32 type;
++ union {
++ struct v4l2_event_vsync vsync;
++ __u8 data[64];
++ } u;
++ __u32 pending;
++ __u32 sequence;
++ struct timespec timestamp;
++ __u32 reserved[9];
++};
++
++struct v4l2_event_subscription {
++ __u32 type;
++ __u32 reserved[7];
++};
++
++/*
++ * A D V A N C E D D E B U G G I N G
++ *
++ * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
++ * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
++ */
++
++/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
++
++#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
++#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
++#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
++#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
++
++struct v4l2_dbg_match {
++ __u32 type; /* Match type */
++ union { /* Match this chip, meaning determined by type */
++ __u32 addr;
++ char name[32];
++ };
++} __attribute__ ((packed));
++
++struct v4l2_dbg_register {
++ struct v4l2_dbg_match match;
++ __u32 size; /* register size in bytes */
++ __u64 reg;
++ __u64 val;
++} __attribute__ ((packed));
++
++/* VIDIOC_DBG_G_CHIP_IDENT */
++struct v4l2_dbg_chip_ident {
++ struct v4l2_dbg_match match;
++ __u32 ident; /* chip identifier as specified in */
++ __u32 revision; /* chip revision, chip specific */
++} __attribute__ ((packed));
++
++/*
++ * I O C T L C O D E S F O R V I D E O D E V I C E S
++ *
++ */
++#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
++#define VIDIOC_RESERVED _IO('V', 1)
++#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
++#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
++#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
++#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
++#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
++#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
++#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
++#define VIDIOC_OVERLAY _IOW('V', 14, int)
++#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
++#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
++#define VIDIOC_STREAMON _IOW('V', 18, int)
++#define VIDIOC_STREAMOFF _IOW('V', 19, int)
++#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
++#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
++#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
++#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
++#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
++#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
++#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
++#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
++#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
++#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
++#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
++#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
++#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
++#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
++#define VIDIOC_G_INPUT _IOR('V', 38, int)
++#define VIDIOC_S_INPUT _IOWR('V', 39, int)
++#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
++#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
++#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
++#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
++#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
++#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
++#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
++#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
++#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
++#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
++#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
++#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
++#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
++#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
++#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
++#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
++#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
++#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
++#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority)
++#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority)
++#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
++#define VIDIOC_LOG_STATUS _IO('V', 70)
++#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
++#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
++#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
++#if 1
++#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
++#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
++#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
++#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
++#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
++#endif
++
++#if 1
++/* Experimental, meant for debugging, testing and internal use.
++ Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
++ You must be root to use these ioctls. Never use these in applications! */
++#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
++#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
++
++/* Experimental, meant for debugging, testing and internal use.
++ Never use this ioctl in applications! */
++#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
++#endif
++
++#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
++#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
++#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
++#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
++#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
++#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
++#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
++#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
++#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
++#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
++
++#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
++
++#endif /* __LINUX_VIDEODEV2_H */
diff --git a/x11/driver/xorg-video-v4l/files/xf86-video-v4l-0.2.0-build-fix.patch b/x11/driver/xorg-video-v4l/files/xf86-video-v4l-0.2.0-build-fix.patch
new file mode 100644
index 0000000000..febba2c687
--- /dev/null
+++ b/x11/driver/xorg-video-v4l/files/xf86-video-v4l-0.2.0-build-fix.patch
@@ -0,0 +1,14 @@
+diff -up xf86-video-v4l-0.2.0/src/v4l.c~ xf86-video-v4l-0.2.0/src/v4l.c
+--- xf86-video-v4l-0.2.0/src/v4l.c~ 2015-02-11 17:42:55.000000000 +0100
++++ xf86-video-v4l-0.2.0/src/v4l.c 2015-02-11 17:44:33.432706357 +0100
+@@ -42,6 +42,10 @@
+ # define DEBUG(x)
+ #endif
+
++#ifndef VIDEO_INVERT_CLIPLIST
++#define VIDEO_INVERT_CLIPLIST 0x00000002
++#endif
++
+ /***************************************************************************/
+
+ static void V4LIdentify(int flags);
diff --git a/x11/driver/xorg-video-v4l/files/xorg-x11-drv-v4l-support_v4l2_only_drivers.patch b/x11/driver/xorg-video-v4l/files/xorg-x11-drv-v4l-support_v4l2_only_drivers.patch
new file mode 100644
index 0000000000..3a2ec418e9
--- /dev/null
+++ b/x11/driver/xorg-video-v4l/files/xorg-x11-drv-v4l-support_v4l2_only_drivers.patch
@@ -0,0 +1,4068 @@
+diff --git a/src/v4l.c b/src/v4l.c
+--- a/src/v4l.c
++++ b/src/v4l.c
+@@ -1,6 +1,9 @@
+ /*
+- * video4linux Xv Driver
++ * video4linux Xv Driver
+ * based on Michael Schimek's permedia 2 driver.
++ *
++ * Copyright (c) 2011 Mauro Carvalho Chehab for:
++ * - Major rewrite, as driver got ported to V4L2 API
+ */
+
+ #ifdef HAVE_CONFIG_H
+@@ -9,12 +12,16 @@
+
+ #include
+ #include
++#include
++
+ #include
+ #include
+ #include
+ #include
++#include
++#include
+
+-#include "videodev.h"
++#include "videodev2.h"
+ #include "xf86.h"
+ #include "xf86_OSproc.h"
+ #include "xf86Pci.h"
+@@ -25,29 +32,32 @@
+ #include "regionstr.h"
+ #include "dgaproc.h"
+ #include "xf86str.h"
++#include "fourcc.h"
+
+-#include /* _IORW(xxx) #defines are here */
++#include /* _IORW(xxx) #defines are here */
+
+-#if 0
++#if 1
+ # define DEBUG(x) (x)
+ #else
+ # define DEBUG(x)
+ #endif
+
++/***************************************************************************/
++
+ static void V4LIdentify(int flags);
+ static Bool V4LProbe(DriverPtr drv, int flags);
+ static const OptionInfoRec * V4LAvailableOptions(int chipid, int busid);
+
+ _X_EXPORT DriverRec V4L = {
+- 40000,
+- "v4l",
+- V4LIdentify, /* Identify*/
+- V4LProbe, /* Probe */
+- V4LAvailableOptions,
+- NULL,
+- 0
+-};
+-
++ .driverVersion = 50000,
++ .driverName = "v4l",
++ .Identify = V4LIdentify,
++ .Probe = V4LProbe,
++ .AvailableOptions = V4LAvailableOptions,
++ .module = NULL,
++ .refCount = 0,
++ .driverFunc = NULL, /* FIXME: Need to implement for new probing mode */
++};
+
+ #ifdef XFree86LOADER
+
+@@ -55,16 +65,16 @@ static MODULESETUPPROTO(v4lSetup);
+
+ static XF86ModuleVersionInfo v4lVersRec =
+ {
+- "v4l",
+- MODULEVENDORSTRING,
+- MODINFOSTRING1,
+- MODINFOSTRING2,
+- XORG_VERSION_CURRENT,
+- 0, 1, 1,
+- ABI_CLASS_VIDEODRV,
+- ABI_VIDEODRV_VERSION,
+- MOD_CLASS_NONE,
+- {0,0,0,0}
++ "v4l",
++ MODULEVENDORSTRING,
++ MODINFOSTRING1,
++ MODINFOSTRING2,
++ XORG_VERSION_CURRENT,
++ 0, 1, 1,
++ ABI_CLASS_VIDEODRV,
++ ABI_VIDEODRV_VERSION,
++ MOD_CLASS_NONE,
++ {0,0,0,0}
+ };
+
+ _X_EXPORT XF86ModuleData v4lModuleData = { &v4lVersRec, v4lSetup, NULL };
+@@ -72,32 +82,32 @@ _X_EXPORT XF86ModuleData v4lModuleData =
+ static pointer
+ v4lSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+ {
+- const char *osname;
+- static Bool setupDone = FALSE;
++ const char *osname;
++ static Bool setupDone = FALSE;
+
+- if (setupDone) {
+- if (errmaj)
+- *errmaj = LDR_ONCEONLY;
+- return NULL;
+- }
+-
+- setupDone = TRUE;
++ if (setupDone) {
++ if (errmaj)
++ *errmaj = LDR_ONCEONLY;
++ return NULL;
++ }
+
+- /* Check that we're being loaded on a Linux system */
+- LoaderGetOS(&osname, NULL, NULL, NULL);
+- if (!osname || strcmp(osname, "linux") != 0) {
+- if (errmaj)
+- *errmaj = LDR_BADOS;
+- if (errmin)
+- *errmin = 0;
+- return NULL;
+- } else {
+- /* OK */
++ setupDone = TRUE;
+
+- xf86AddDriver (&V4L, module, 0);
+-
+- return (pointer)1;
+- }
++ /* Check that we're being loaded on a Linux system */
++ LoaderGetOS(&osname, NULL, NULL, NULL);
++ if (!osname || strcmp(osname, "linux") != 0) {
++ if (errmaj)
++ *errmaj = LDR_BADOS;
++ if (errmin)
++ *errmin = 0;
++ return NULL;
++ } else {
++ /* OK */
++
++ xf86AddDriver (&V4L, module, 0);
++
++ return (pointer)1;
++ }
+ }
+
+ #else
+@@ -112,25 +122,28 @@ v4lSetup(pointer module, pointer opts, i
+ #define VIDEO_YUV 2 /* yuv overlay (to offscreen memory + hw scaling) */
+ #define VIDEO_RECLIP 3 /* temporarly off, window clipping changes */
+
++typedef struct _XvV4LCtrlRec {
++ struct v4l2_queryctrl qctrl;
++ Atom xv;
++} XvV4LCtrlRec, *XvV4LCtrlPtr;
++
+ typedef struct _PortPrivRec {
+ ScrnInfoPtr pScrn;
+- FBAreaPtr pFBArea[2];
+- int VideoOn;
+- Bool StreamOn;
++ FBAreaPtr pFBArea[2];
++ int VideoOn;
++ Bool StreamOn;
+
+ /* file handle */
+- int nr;
+- struct video_capability cap;
++ int nr;
++ struct v4l2_capability cap;
+
+ /* RGB overlay */
+- struct video_buffer rgb_fbuf;
+- struct video_window rgb_win;
+- int rgbpalette;
++ struct v4l2_framebuffer rgb_fbuf;
++ struct v4l2_window rgb_win;
+ int rgbdepth;
+
+ /* attributes */
+- struct video_picture pict;
+- struct video_audio audio;
++ CARD32 pixelformat;
+
+ XF86VideoEncodingPtr enc;
+ int *input;
+@@ -145,24 +158,21 @@ typedef struct _PortPrivRec {
+
+ int yuv_width,yuv_height;
+ XF86SurfacePtr surface;
+- struct video_buffer yuv_fbuf;
+- struct video_window yuv_win;
++ struct v4l2_framebuffer yuv_fbuf;
++ struct v4l2_window yuv_win;
++
++ struct v4l2_standard *standard; /* FIXME: can be removed */
++
++ XvV4LCtrlPtr XvV4LCtrl;
++ int n_qctrl;
+ } PortPrivRec, *PortPrivPtr;
+
+-#define XV_ENCODING "XV_ENCODING"
+-#define XV_BRIGHTNESS "XV_BRIGHTNESS"
+-#define XV_CONTRAST "XV_CONTRAST"
+-#define XV_SATURATION "XV_SATURATION"
+-#define XV_HUE "XV_HUE"
++#define XV_ENCODING "XV_ENCODING"
++#define XV_FREQ "XV_FREQ"
+
+-#define XV_FREQ "XV_FREQ"
+-#define XV_MUTE "XV_MUTE"
+-#define XV_VOLUME "XV_VOLUME"
++#define MAKE_ATOM(a) MakeAtom(a, strlen(a), TRUE)
+
+-#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+-
+-static Atom xvEncoding, xvBrightness, xvContrast, xvSaturation, xvHue;
+-static Atom xvFreq, xvMute, xvVolume;
++static Atom xvEncoding, xvFreq;
+
+ static XF86VideoFormatRec
+ InputVideoFormats[] = {
+@@ -176,16 +186,8 @@ InputVideoFormats[] = {
+
+ static const XF86AttributeRec Attributes[] = {
+ {XvSettable | XvGettable, -1000, 1000, XV_ENCODING},
+- {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS},
+- {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST},
+- {XvSettable | XvGettable, -1000, 1000, XV_SATURATION},
+- {XvSettable | XvGettable, -1000, 1000, XV_HUE},
+ };
+-static const XF86AttributeRec VolumeAttr =
+- {XvSettable | XvGettable, -1000, 1000, XV_VOLUME};
+-static const XF86AttributeRec MuteAttr =
+- {XvSettable | XvGettable, 0, 1, XV_MUTE};
+-static const XF86AttributeRec FreqAttr =
++static const XF86AttributeRec FreqAttr =
+ {XvSettable | XvGettable, 0, 16*1000, XV_FREQ};
+
+
+@@ -206,59 +208,247 @@ static struct V4L_DEVICE {
+ };
+
+ /* ---------------------------------------------------------------------- */
+-/* forward decl */
+
+-static void V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+- short vid_w, short vid_h, short drw_w, short drw_h,
+- unsigned int *p_w, unsigned int *p_h, pointer data);
++static int SetV4LFmt(int fd, CARD32 pixelformat)
++{
++ struct v4l2_framebuffer fbuf;
++ char *p = (char *)&pixelformat;
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ if (fbuf.fmt.pixelformat != pixelformat) {
++ fbuf.fmt.pixelformat = pixelformat;
++ if (ioctl(fd, VIDIOC_S_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't set FBUF to %c%c%c%c\n",
++ errno, p[0], p[1], p[2], p[3]);
++ return errno;
++ }
++ }
++ DEBUG(xf86Msg(X_INFO, "v4l: Set overlay format to %c%c%c%c\n",
++ p[0], p[1], p[2], p[3]));
++ return 0;
++}
++static int GetV4LFmt(int fd, CARD32 *pixelformat)
++{
++ struct v4l2_framebuffer fbuf;
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++
++ *pixelformat = fbuf.fmt.pixelformat;
++
++ return 0;
++}
++
++#define ATTR_NAME_PREFIX "XV_"
++static int AddControl(PortPrivPtr p, XF86AttributeRec **list, int *count,
++ struct v4l2_queryctrl *qctrl, int *n)
++{
++ char *ptr;
++
++/* v4l_add_attr */
++ if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED)
++ return 0;
++ switch (qctrl->type) {
++ case V4L2_CTRL_TYPE_INTEGER:
++ case V4L2_CTRL_TYPE_BOOLEAN:
++ case V4L2_CTRL_TYPE_MENU:
++ case V4L2_CTRL_TYPE_BUTTON:
++ break;
++ default:
++ return 0;
++ }
++
++ p->XvV4LCtrl = realloc(p->XvV4LCtrl, sizeof(XvV4LCtrlRec) * (*n + 1));
++ if (!p->XvV4LCtrl) {
++ if (*list) {
++ free (*list);
++ *count = 0;
++ *n = 0;
++ }
++ return -1;
++ }
++
++ *list = realloc(*list, sizeof(XF86AttributeRec) * (*count + 1));
++ if (NULL == *list) {
++ if (p->XvV4LCtrl)
++ free (p->XvV4LCtrl);
++ *count = 0;
++ return -1;
++ }
++
++ memset(*list + *count, 0, sizeof(XF86AttributeRec));
++ (*list)[*count].flags = XvSettable | XvGettable;
++
++ if (qctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
++ (*list)[*count].flags &= ~XvSettable;
++ if (qctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
++ (*list)[*count].flags &= ~XvGettable;
++ (*list)[*count].min_value = qctrl->minimum;
++ (*list)[*count].max_value = qctrl->maximum;
++ (*list)[*count].name = malloc(strlen((char *)qctrl->name) + 1 + sizeof (ATTR_NAME_PREFIX));
++ strcpy((*list)[*count].name, ATTR_NAME_PREFIX);
++ strcat((*list)[*count].name, (char *)qctrl->name);
++ for (ptr = (*list)[*count].name; *ptr; ptr++) {
++ *ptr = toupper(*ptr);
++ if (*ptr == ' ')
++ *ptr = '_';
++ }
++
++ p->XvV4LCtrl[*n].xv = MAKE_ATOM((*list)[*count].name);
++ memcpy(&p->XvV4LCtrl[*n].qctrl, qctrl, sizeof(*qctrl));
++
++ xf86Msg(X_INFO, "v4l: add attr %s (Xv/GPA %d) (%d to %d)\n",
++ (*list)[*count].name, (int)p->XvV4LCtrl[*n].xv,
++ p->XvV4LCtrl[*n].qctrl.minimum,
++ p->XvV4LCtrl[*n].qctrl.maximum);
++
++ (*count)++;
++ (*n)++;
++
++ return 0;
++}
++
++static void AddAllV4LControls(PortPrivPtr p, XF86AttributeRec **list,
++ int *count, int fd)
++{
++ int entries = 0;
++ CARD32 id;
++ struct v4l2_queryctrl qctrl;
++
++ memset(&qctrl, 0, sizeof(qctrl));
++ qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
++ while (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
++ }
++ if (qctrl.id != V4L2_CTRL_FLAG_NEXT_CTRL)
++ return;
++ for (id = V4L2_CID_USER_BASE; id < V4L2_CID_LASTP1; id++) {
++ qctrl.id = id;
++ if (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ }
++ }
++ qctrl.id = V4L2_CID_PRIVATE_BASE;
++ while (!ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) {
++ if (AddControl(p, list, count, &qctrl, &entries))
++ return;
++ qctrl.id++;
++ }
++ p->n_qctrl = entries;
++}
+
+ /* ---------------------------------------------------------------------- */
+
++/* setup yuv overlay + hw scaling: look if we find some common video
++ format which both v4l driver and the X-Server can handle */
++static int v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
++ char *dev, int fd)
++{
++ static const struct {
++ CARD32 v4l_palette;
++ unsigned int xv_id;
++ unsigned int xv_format;
++ } yuvlist[] = {
++ { V4L2_PIX_FMT_YUYV, FOURCC_YUY2, XvPacked },
++ { V4L2_PIX_FMT_UYVY, FOURCC_UYVY, XvPacked },
++ { 0 /* end of list */ },
++ };
++ /* FIXME: Why pScrn->scrnIndex? */
++ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
++ int fmt,i;
++
++ pPPriv->format = xf86XVQueryOffscreenImages(pScreen, &pPPriv->nformat);
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "v4l: Number of Xv formats: %d\n", pPPriv->nformat);
++ if (!pPPriv->nformat)
++ return FALSE;
++
++ for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
++ pPPriv->pixelformat = yuvlist[fmt].v4l_palette;
++ if (-1 == SetV4LFmt(fd, pPPriv->pixelformat))
++ continue;
++ GetV4LFmt(fd, &pPPriv->pixelformat);
++ if (pPPriv->pixelformat != yuvlist[fmt].v4l_palette)
++ continue;
++ /* ... works, check available offscreen image formats now ... */
++ for (i = 0; i < pPPriv->nformat; i++) {
++ if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id &&
++ pPPriv->format[i].image->format == yuvlist[fmt].xv_format) {
++ /* ... match found, good. */
++ pPPriv->yuv_format = yuvlist[fmt].v4l_palette;
++ pPPriv->myfmt = pPPriv->format+i;
++ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
++ "v4l[%s]: using hw video scaling [%4.4s].\n",
++ dev,(char*)&(pPPriv->format[i].image->id));
++ return TRUE;
++ }
++ }
++ }
++ return TRUE;
++}
++
+ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
+ {
+ static int first = 1;
+
++#if 0
++ /*
++ * It may be a good idea to probe here, but this would break
++ * some things, as initialization uses yuv_format
++ */
++ if (!pPPriv->yuv_format && first)
++ v4l_check_yuv(pScrn, pPPriv, V4L_NAME, V4L_FD);
++#endif
+ if (-1 == V4L_FD) {
+- V4L_FD = open(V4L_NAME, O_RDWR, 0);
++ V4L_FD = open(V4L_NAME, O_RDWR, 0);
+
+- pPPriv->rgb_fbuf.width = pScrn->virtualX;
+- pPPriv->rgb_fbuf.height = pScrn->virtualY;
+- pPPriv->rgb_fbuf.depth = pScrn->bitsPerPixel;
+- pPPriv->rgb_fbuf.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8);
+- pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset);
+- if (first) {
+- first = 0;
+- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "v4l: memPhysBase=0x%lx\n", pScrn->memPhysBase);
+- }
++ if (-1 == V4L_FD)
++ return errno;
+
+- switch (pScrn->bitsPerPixel) {
+- case 16:
+- if (pScrn->weight.green == 5) {
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB555;
+- pPPriv->rgbdepth = 16;
+- } else {
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB565;
+- pPPriv->rgbdepth = 16;
+- }
+- break;
+- case 24:
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB24;
+- pPPriv->rgbdepth = 24;
+- break;
+- case 32:
+- pPPriv->rgbpalette = VIDEO_PALETTE_RGB32;
+- pPPriv->rgbdepth = 32;
+- break;
+- }
++ if (-1 == ioctl(V4L_FD, VIDIOC_G_FBUF, &pPPriv->rgb_fbuf)) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ pPPriv->rgb_fbuf.fmt.width = pScrn->virtualX;
++ pPPriv->rgb_fbuf.fmt.height = pScrn->virtualY;
++ pPPriv->rgb_fbuf.fmt.bytesperline = pScrn->displayWidth * ((pScrn->bitsPerPixel + 7)/8);
++ pPPriv->rgb_fbuf.base = (pointer)(pScrn->memPhysBase + pScrn->fbOffset);
++ if (first) {
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "v4l: memPhysBase=0x%lx\n", pScrn->memPhysBase);
++ first = 0;
++ }
++
++ switch (pScrn->bitsPerPixel) {
++ case 16:
++ if (pScrn->weight.green == 5) {
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555;
++ } else {
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565;
++ }
++ break;
++ case 24:
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24;
++ break;
++ case 32:
++ pPPriv->rgb_fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32;
++ break;
++ }
+ }
+
+- if (-1 == V4L_FD)
+- return errno;
+-
+ V4L_REF++;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/open: refcount=%d\n",V4L_REF));
++ "Xv/open: refcount=%d\n",V4L_REF));
+
+ return 0;
+ }
+@@ -267,10 +457,10 @@ static void V4lCloseDevice(PortPrivPtr p
+ {
+ V4L_REF--;
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/close: refcount=%d\n",V4L_REF));
++ "Xv/close: refcount=%d\n",V4L_REF));
+ if (0 == V4L_REF && -1 != V4L_FD) {
+- close(V4L_FD);
+- V4L_FD = -1;
++ close(V4L_FD);
++ V4L_FD = -1;
+ }
+ }
+
+@@ -280,8 +470,10 @@ V4lPutVideo(ScrnInfoPtr pScrn,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw)
+ {
++ struct v4l2_format fmt;
++
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+- struct video_clip *clip;
++ struct v4l2_clip *clip;
+ BoxPtr pBox;
+ RegionRec newReg;
+ BoxRec newBox;
+@@ -291,179 +483,214 @@ V4lPutVideo(ScrnInfoPtr pScrn,
+
+ /* Open a file handle to the device */
+ if (VIDEO_OFF == pPPriv->VideoOn) {
+- if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ if (V4lOpenDevice(pPPriv, pScrn))
++ return Success;
+ }
+
+ if (0 != pPPriv->yuv_format) {
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n"));
+- width = pPPriv->enc[pPPriv->cenc].width;
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV yuv\n"));
++ width = pPPriv->enc[pPPriv->cenc].width;
+ height = pPPriv->enc[pPPriv->cenc].height/2; /* no interlace */
+- if (drw_w < width)
+- width = drw_w;
+- if (drw_h < height)
+- height = drw_h;
+- if ((height != pPPriv->yuv_height) || (width != pPPriv->yuv_width)) {
+- /* new size -- free old surface */
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface resize\n"));
+- if (pPPriv->surface) {
+- pPPriv->VideoOn = VIDEO_OFF;
+- pPPriv->myfmt->stop(pPPriv->surface);
+- pPPriv->myfmt->free_surface(pPPriv->surface);
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- }
+- pPPriv->yuv_width = width;
+- pPPriv->yuv_height = height;
+- }
+- if (!pPPriv->surface) {
+- /* allocate + setup offscreen surface */
+- if (NULL == (pPPriv->surface = xalloc(sizeof(XF86SurfaceRec))))
+- return FALSE;
+- if (Success != pPPriv->myfmt->alloc_surface
+- (pScrn,pPPriv->myfmt->image->id,
+- pPPriv->yuv_width,pPPriv->yuv_height,pPPriv->surface)) {
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- goto fallback_to_rgb;
+- }
+- pPPriv->yuv_fbuf.width = pPPriv->surface->width;
+- pPPriv->yuv_fbuf.height = pPPriv->surface->height;
+- pPPriv->yuv_fbuf.depth = 16;
+- pPPriv->yuv_fbuf.bytesperline = pPPriv->surface->pitches[0];
+- pPPriv->yuv_fbuf.base =
+- (pointer)(pScrn->memPhysBase + pPPriv->surface->offsets[0]);
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface: %p+%d = %p, %dx%d, pitch %d\n",
+- pScrn->memPhysBase,pPPriv->surface->offsets[0],
+- pScrn->memPhysBase+pPPriv->surface->offsets[0],
+- pPPriv->surface->width,pPPriv->surface->height,
+- pPPriv->surface->pitches[0]));
+- pPPriv->yuv_win.width = pPPriv->surface->width;
+- pPPriv->yuv_win.height = pPPriv->surface->height;
+- }
++ if (drw_w < width)
++ width = drw_w;
++ if (drw_h < height)
++ height = drw_h;
++ if ((height != pPPriv->yuv_height) || (width != pPPriv->yuv_width)) {
++ /* new size -- free old surface */
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " surface resize\n"));
++ if (pPPriv->surface) {
++ pPPriv->VideoOn = VIDEO_OFF;
++ pPPriv->myfmt->stop(pPPriv->surface);
++ pPPriv->myfmt->free_surface(pPPriv->surface);
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ }
++ pPPriv->yuv_width = width;
++ pPPriv->yuv_height = height;
++ }
++ if (!pPPriv->surface) {
++ /* allocate + setup offscreen surface */
++ if (NULL == (pPPriv->surface = malloc(sizeof(XF86SurfaceRec))))
++ return FALSE;
++ if (Success != pPPriv->myfmt->alloc_surface
++ (pScrn,pPPriv->myfmt->image->id,
++ pPPriv->yuv_width,pPPriv->yuv_height,pPPriv->surface)) {
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ goto fallback_to_rgb;
++ }
+
+- /* program driver */
+- if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->yuv_fbuf)))
+- perror("ioctl VIDIOCSFBUF");
+- if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCGPICT");
+- pPPriv->pict.palette = pPPriv->yuv_format;
+- pPPriv->pict.depth = 16;
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->yuv_win)))
+- perror("ioctl VIDIOCSWIN");
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+- perror("ioctl VIDIOCCAPTURE(1)");
++ if (-1 == ioctl(V4L_FD, VIDIOC_G_FBUF, &pPPriv->yuv_fbuf)) {
++ xf86Msg(X_ERROR, "v4l: Error %d: Can't get FBUF\n", errno);
++ return errno;
++ }
++ pPPriv->yuv_fbuf.fmt.width = pPPriv->surface->width;
++ pPPriv->yuv_fbuf.fmt.height = pPPriv->surface->height;
++ pPPriv->yuv_fbuf.fmt.bytesperline = pPPriv->surface->pitches[0];
++ pPPriv->yuv_fbuf.fmt.pixelformat = pPPriv->yuv_format;
++ pPPriv->yuv_fbuf.base =
++ (pointer)(pScrn->memPhysBase + pPPriv->surface->offsets[0]);
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ " surface: %p+%d = %p, %dx%d, pitch %d\n",
++ (void *)pScrn->memPhysBase, pPPriv->surface->offsets[0],
++ (void *)pScrn->memPhysBase+pPPriv->surface->offsets[0],
++ pPPriv->surface->width, pPPriv->surface->height,
++ pPPriv->surface->pitches[0]));
++ memset(&pPPriv->yuv_win, 0, sizeof(pPPriv->yuv_win));
++ pPPriv->yuv_win.w.left = 0;
++ pPPriv->yuv_win.w.top = 0;
++ pPPriv->yuv_win.w.width = pPPriv->surface->width;
++ pPPriv->yuv_win.w.height = pPPriv->surface->height;
++ }
+
+- if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
+- /* invert cliplist */
+- newBox.x1 = drw_x;
+- newBox.y1 = drw_y;
+- newBox.x2 = drw_x + drw_w;
+- newBox.y2 = drw_y + drw_h;
++ /* program driver */
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FBUF, &pPPriv->yuv_fbuf)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FBUF\n", errno);
++ return BadValue;
++ }
++ pPPriv->pixelformat = pPPriv->yuv_format;
++ if (-1 == SetV4LFmt(V4L_FD, pPPriv->pixelformat))
++ return BadValue;
+
+- if (pPPriv->myfmt->flags & VIDEO_CLIP_TO_VIEWPORT) {
+- /* trim to the viewport */
+- if(newBox.x1 < pScrn->frameX0)
+- newBox.x1 = pScrn->frameX0;
+- if(newBox.x2 > pScrn->frameX1)
+- newBox.x2 = pScrn->frameX1;
+-
+- if(newBox.y1 < pScrn->frameY0)
+- newBox.y1 = pScrn->frameY0;
+- if(newBox.y2 > pScrn->frameY1)
+- newBox.y2 = pScrn->frameY1;
+- }
++ memset(&fmt, 0, sizeof(fmt));
++ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
++ memcpy(&fmt.fmt.win, &pPPriv->yuv_win, sizeof(pPPriv->yuv_win));
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FMT, &fmt)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FMT\n", errno);
++ return BadValue;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &one)) {
++ xf86Msg(X_ERROR, "v4l: Error %d while enabling Overlay\n", errno);
++ return BadValue;
++ }
+
+- REGION_INIT(pScrn->pScreen, &newReg, &newBox, 1);
+- REGION_SUBTRACT(pScrn->pScreen, &newReg, &newReg, clipBoxes);
+- clipBoxes = &newReg;
+- }
+-
+- /* start overlay */
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "over: - %d,%d -> %d,%d (%dx%d) (yuv=%dx%d)\n",
+- drw_x, drw_y,
+- drw_x+drw_w, drw_y+drw_h,
+- drw_w, drw_h,
+- pPPriv->surface->width,pPPriv->surface->height));
+- pPPriv->myfmt->display(pPPriv->surface,
+- 0, 0, drw_x, drw_y,
+- pPPriv->surface->width,
+- pPPriv->surface->height,
+- drw_w, drw_h,
+- clipBoxes);
+- if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
+- REGION_UNINIT(pScrn->pScreen, &newReg);
+- }
+- pPPriv->VideoOn = VIDEO_YUV;
+- return Success;
++ if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
++ /* invert cliplist */
++ newBox.x1 = drw_x;
++ newBox.y1 = drw_y;
++ newBox.x2 = drw_x + drw_w;
++ newBox.y2 = drw_y + drw_h;
++
++ if (pPPriv->myfmt->flags & VIDEO_CLIP_TO_VIEWPORT) {
++ /* trim to the viewport */
++ if(newBox.x1 < pScrn->frameX0)
++ newBox.x1 = pScrn->frameX0;
++ if(newBox.x2 > pScrn->frameX1)
++ newBox.x2 = pScrn->frameX1;
++
++ if(newBox.y1 < pScrn->frameY0)
++ newBox.y1 = pScrn->frameY0;
++ if(newBox.y2 > pScrn->frameY1)
++ newBox.y2 = pScrn->frameY1;
++ }
++
++ REGION_INIT(pScrn->pScreen, &newReg, &newBox, 1);
++ REGION_SUBTRACT(pScrn->pScreen, &newReg, &newReg, clipBoxes);
++ clipBoxes = &newReg;
++ }
++
++ /* start overlay */
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "over: - %d,%d -> %d,%d (%dx%d) (yuv=%dx%d)\n",
++ drw_x, drw_y,
++ drw_x+drw_w, drw_y+drw_h,
++ drw_w, drw_h,
++ pPPriv->surface->width,pPPriv->surface->height));
++ pPPriv->myfmt->display(pPPriv->surface,
++ 0, 0, drw_x, drw_y,
++ pPPriv->surface->width,
++ pPPriv->surface->height,
++ drw_w, drw_h,
++ clipBoxes);
++ if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) {
++ REGION_UNINIT(pScrn->pScreen, &newReg);
++ }
++ pPPriv->VideoOn = VIDEO_YUV;
++ return Success;
+ }
+
+- fallback_to_rgb:
++fallback_to_rgb:
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PV rgb\n"));
+ /* FIXME: vid-* is ignored for now, not supported by v4l */
+
+ dw = (drw_w < pPPriv->enc[pPPriv->cenc].width) ?
+- drw_w : pPPriv->enc[pPPriv->cenc].width;
++ drw_w : pPPriv->enc[pPPriv->cenc].width;
+ dh = (drw_h < pPPriv->enc[pPPriv->cenc].height) ?
+- drw_h : pPPriv->enc[pPPriv->cenc].height;
++ drw_h : pPPriv->enc[pPPriv->cenc].height;
+ /* if the window is too big, center the video */
+ dx = drw_x + (drw_w - dw)/2;
+ dy = drw_y + (drw_h - dh)/2;
+ /* bttv prefeares aligned addresses */
+ dx &= ~3;
+- if (dx < drw_x) dx += 4;
+- if (dx+dw > drw_x+drw_w) dw -= 4;
++ if (dx < drw_x)
++ dx += 4;
++ if (dx+dw > drw_x+drw_w)
++ dw -= 4;
+
+ /* window */
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " win: %dx%d+%d+%d\n",
+- drw_w,drw_h,drw_x,drw_y));
++ drw_w,drw_h,drw_x,drw_y));
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, " use: %dx%d+%d+%d\n",
+- dw,dh,dx,dy));
+- pPPriv->rgb_win.x = dx;
+- pPPriv->rgb_win.y = dy;
+- pPPriv->rgb_win.width = dw;
+- pPPriv->rgb_win.height = dh;
+- pPPriv->rgb_win.flags = 0;
+-
++ dw,dh,dx,dy));
++ memset(&pPPriv->rgb_win, 0, sizeof(pPPriv->rgb_win));
++ pPPriv->rgb_win.w.left = dx;
++ pPPriv->rgb_win.w.top = dy;
++ pPPriv->rgb_win.w.width = dw;
++ pPPriv->rgb_win.w.height = dh;
++
+ /* clipping */
+ if (pPPriv->rgb_win.clips) {
+- xfree(pPPriv->rgb_win.clips);
+- pPPriv->rgb_win.clips = NULL;
++ free(pPPriv->rgb_win.clips);
++ pPPriv->rgb_win.clips = NULL;
+ }
+ pPPriv->rgb_win.clipcount = REGION_NUM_RECTS(clipBoxes);
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2," clip: have #%d\n",
+- pPPriv->rgb_win.clipcount));
++ pPPriv->rgb_win.clipcount));
+ if (0 != pPPriv->rgb_win.clipcount) {
+- pPPriv->rgb_win.clips = xalloc(pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+- if (NULL != pPPriv->rgb_win.clips) {
+- memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip));
+- pBox = REGION_RECTS(clipBoxes);
+- clip = pPPriv->rgb_win.clips;
+- for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
+- clip->x = pBox->x1 - dx;
+- clip->y = pBox->y1 - dy;
+- clip->width = pBox->x2 - pBox->x1;
+- clip->height = pBox->y2 - pBox->y1;
+- }
+- }
++ pPPriv->rgb_win.clips = malloc(pPPriv->rgb_win.clipcount*sizeof(struct v4l2_clip));
++ if (NULL != pPPriv->rgb_win.clips) {
++ memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct v4l2_clip));
++ pBox = REGION_RECTS(clipBoxes);
++ clip = pPPriv->rgb_win.clips;
++
++ /*
++ * FIXME: This code currently does nothing, as we don't emulate
++ * The V4L1 clipping stuff
++ */
++ for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) {
++ clip->c.left = pBox->x1 - dx;
++ clip->c.top = pBox->y1 - dy;
++ clip->c.width = pBox->x2 - pBox->x1;
++ clip->c.height = pBox->y2 - pBox->y1;
++ }
++ }
+ }
+
+ /* start */
+- if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->rgb_fbuf)))
+- perror("ioctl VIDIOCSFBUF");
+- if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCGPICT");
+- pPPriv->pict.palette = pPPriv->rgbpalette;
+- pPPriv->pict.depth = pPPriv->rgbdepth;
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->rgb_win)))
+- perror("ioctl VIDIOCSWIN");
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one))
+- perror("ioctl VIDIOCCAPTURE(1)");
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FBUF, &pPPriv->rgb_fbuf)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FBUF\n", errno);
++ return BadValue;
++ }
++ if (-1 == GetV4LFmt(V4L_FD, &pPPriv->pixelformat)) {
++ xf86Msg(X_ERROR, "Error %d getting pixelformat\n", errno);
++ return BadValue;
++ }
++ pPPriv->pixelformat = pPPriv->rgb_fbuf.fmt.pixelformat;
++ if (-1 == SetV4LFmt(V4L_FD, pPPriv->pixelformat)) {
++ xf86Msg(X_ERROR, "Error %d getting pixelformat\n", errno);
++ return BadValue;
++ }
++ memset(&fmt, 0, sizeof(fmt));
++ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
++ memcpy(&fmt.fmt.win, &pPPriv->rgb_win, sizeof(pPPriv->rgb_win));
++ if (-1 == ioctl(V4L_FD, VIDIOC_S_FMT, &fmt)) {
++ xf86Msg(X_ERROR, "Error %d at VIDIOC_S_FMT\n", errno);
++ return BadValue;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &one)) {
++ xf86Msg(X_ERROR, "v4l: Error %d while enabling Overlay\n", errno);
++ return BadValue;
++ }
+ pPPriv->VideoOn = VIDEO_RGB;
+
+ return Success;
+@@ -476,7 +703,7 @@ V4lPutStill(ScrnInfoPtr pScrn,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw)
+ {
+ #if 0
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ #endif
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/PS\n"));
+@@ -488,177 +715,152 @@ V4lPutStill(ScrnInfoPtr pScrn,
+ static void
+ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
+ {
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
+ int zero=0;
+
+ if (VIDEO_OFF == pPPriv->VideoOn) {
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+- "Xv/StopVideo called with video already off\n"));
+- return;
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "Xv/StopVideo called with video already off\n"));
++ return;
+ }
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/StopVideo shutdown=%d\n",shutdown));
+
+ if (!shutdown) {
+- /* just reclipping, we have to stop DMA transfers to the visible screen */
+- if (VIDEO_RGB == pPPriv->VideoOn) {
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
+- perror("ioctl VIDIOCCAPTURE(0)");
+- pPPriv->VideoOn = VIDEO_RECLIP;
+- }
++ /* just reclipping, we have to stop DMA transfers to the visible screen */
++ if (VIDEO_RGB == pPPriv->VideoOn) {
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &zero))
++ xf86Msg(X_ERROR, "v4l: Error %d while disabling Overlay\n", errno);
++ pPPriv->VideoOn = VIDEO_RECLIP;
++ }
+ } else {
+- /* video stop - turn off and free everything */
+- if (VIDEO_YUV == pPPriv->VideoOn) {
+- pPPriv->myfmt->stop(pPPriv->surface);
+- pPPriv->myfmt->free_surface(pPPriv->surface);
+- xfree(pPPriv->surface);
+- pPPriv->surface = NULL;
+- }
+- if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero))
+- perror("ioctl VIDIOCCAPTURE(0)");
+-
+- V4lCloseDevice(pPPriv,pScrn);
+- pPPriv->VideoOn = VIDEO_OFF;
++ /* video stop - turn off and free everything */
++ if (VIDEO_YUV == pPPriv->VideoOn) {
++ pPPriv->myfmt->stop(pPPriv->surface);
++ pPPriv->myfmt->free_surface(pPPriv->surface);
++ free(pPPriv->surface);
++ pPPriv->surface = NULL;
++ }
++ if (-1 == ioctl(V4L_FD, VIDIOC_OVERLAY, &zero))
++ xf86Msg(X_ERROR, "v4l: Error %d while disabling Overlay\n", errno);
++
++ V4lCloseDevice(pPPriv,pScrn);
++ pPPriv->VideoOn = VIDEO_OFF;
+ }
+ }
+
+-/* v4l uses range 0 - 65535; Xv uses -1000 - 1000 */
+-static int
+-v4l_to_xv(int val) {
+- val = val * 2000 / 65536 - 1000;
+- if (val < -1000) val = -1000;
+- if (val > 1000) val = 1000;
+- return val;
+-}
+-static int
+-xv_to_v4l(int val) {
+- val = val * 65536 / 2000 + 32768;
+- if (val < -0) val = 0;
+- if (val > 65535) val = 65535;
+- return val;
+-}
+-
+ static int
+ V4lSetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 value, pointer data)
+ {
+- PortPrivPtr pPPriv = (PortPrivPtr) data;
+- struct video_channel chan;
+- int ret = Success;
++ struct v4l2_control ctrl;
++ PortPrivPtr pPPriv = (PortPrivPtr) data;
++ int i, ret = BadValue;
+
+ if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ return Success;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/SPA %d, %d\n",
+- attribute, value));
++ (int)attribute, (int)value));
+
+ if (-1 == V4L_FD) {
+- ret = Success;
++ ret = Success;
+ } else if (attribute == xvEncoding) {
+- if (value >= 0 && value < pPPriv->nenc) {
+- pPPriv->cenc = value;
+- chan.channel = pPPriv->input[value];
+- chan.norm = pPPriv->norm[value];
+- if (-1 == ioctl(V4L_FD,VIDIOCSCHAN,&chan))
+- perror("ioctl VIDIOCSCHAN");
+- } else {
+- ret = BadValue;
+- }
+- } else if (attribute == xvBrightness ||
+- attribute == xvContrast ||
+- attribute == xvSaturation ||
+- attribute == xvHue) {
+- ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
+- if (attribute == xvBrightness) pPPriv->pict.brightness = xv_to_v4l(value);
+- if (attribute == xvContrast) pPPriv->pict.contrast = xv_to_v4l(value);
+- if (attribute == xvSaturation) pPPriv->pict.colour = xv_to_v4l(value);
+- if (attribute == xvHue) pPPriv->pict.hue = xv_to_v4l(value);
+- if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict))
+- perror("ioctl VIDIOCSPICT");
+- } else if (attribute == xvMute ||
+- attribute == xvVolume) {
+- ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
+- if (attribute == xvMute) {
+- if (value)
+- pPPriv->audio.flags |= VIDEO_AUDIO_MUTE;
+- else
+- pPPriv->audio.flags &= ~VIDEO_AUDIO_MUTE;
+- } else if (attribute == xvVolume) {
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- pPPriv->audio.volume = xv_to_v4l(value);
+- } else {
+- ret = BadValue;
+- }
+- if (ret != BadValue)
+- if (-1 == ioctl(V4L_FD,VIDIOCSAUDIO,&pPPriv->audio))
+- perror("ioctl VIDIOCSAUDIO");
++ if (value < 0 || value >= pPPriv->nenc)
++ goto err;
++ if (ioctl(V4L_FD, VIDIOC_S_INPUT, &pPPriv->input[value]) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d while setting input\n", errno);
++ goto err;
++ }
++ if (ioctl(V4L_FD, VIDIOC_S_STD, &pPPriv->norm[value]) == -1) {
++ xf86Msg(X_ERROR, "v4l: Error %d while setting standard\n", errno);
++ goto err;
++ }
++ pPPriv->cenc = value;
++ ret = Success;
+ } else if (attribute == xvFreq) {
+- unsigned long freq = value;
+- if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&freq))
+- perror("ioctl VIDIOCSFREQ");
+- } else if (0 != pPPriv->yuv_format &&
+- pPPriv->myfmt->setAttribute) {
+- /* not mine -> pass to yuv scaler driver */
+- ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value);
++ struct v4l2_frequency freq;
++ memset(&freq, 0, sizeof(freq));
++ ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq);
++ freq.frequency = value;
++ if (ioctl(V4L_FD, VIDIOC_S_FREQUENCY, &freq) == -1)
++ xf86Msg(X_ERROR, "v4l: Error %d while setting frequency\n", errno);
++ else
++ ret = Success;
+ } else {
+- ret = BadValue;
++ for (i = 0; i < pPPriv->n_qctrl; i++)
++ if (pPPriv->XvV4LCtrl[i].xv == attribute)
++ break;
++ if (i == pPPriv->n_qctrl) {
++ /* not mine -> pass to yuv scaler driver */
++ if (0 != pPPriv->yuv_format && pPPriv->myfmt->setAttribute)
++ ret = pPPriv->myfmt->setAttribute(pScrn, attribute, value);
++ else
++ ret = BadMatch;
++ goto err;
++ }
++ if (pPPriv->XvV4LCtrl[i].qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
++ goto err;
++ ctrl.id = pPPriv->XvV4LCtrl[i].qctrl.id;
++ ctrl.value = value;
++ if (ioctl(V4L_FD, VIDIOC_S_CTRL, &ctrl) != 1)
++ ret = Success;
+ }
+
++err:
+ V4lCloseDevice(pPPriv,pScrn);
+ return ret;
+ }
+
+ static int
+-V4lGetPortAttribute(ScrnInfoPtr pScrn,
++V4lGetPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 *value, pointer data)
+ {
++ struct v4l2_control ctrl;
+ PortPrivPtr pPPriv = (PortPrivPtr) data;
+- int ret = Success;
++ int i, ret = BadValue;
+
+ if (V4lOpenDevice(pPPriv, pScrn))
+- return Success;
++ return Success;
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d\n",
+- attribute));
++ (int)attribute));
+
+ if (-1 == V4L_FD) {
+- ret = Success;
++ ret = Success;
+ } else if (attribute == xvEncoding) {
+- *value = pPPriv->cenc;
+- } else if (attribute == xvBrightness ||
+- attribute == xvContrast ||
+- attribute == xvSaturation ||
+- attribute == xvHue) {
+- ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict);
+- if (attribute == xvBrightness) *value = v4l_to_xv(pPPriv->pict.brightness);
+- if (attribute == xvContrast) *value = v4l_to_xv(pPPriv->pict.contrast);
+- if (attribute == xvSaturation) *value = v4l_to_xv(pPPriv->pict.colour);
+- if (attribute == xvHue) *value = v4l_to_xv(pPPriv->pict.hue);
+- } else if (attribute == xvMute ||
+- attribute == xvVolume) {
+- ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio);
+- if (attribute == xvMute) {
+- *value = (pPPriv->audio.flags & VIDEO_AUDIO_MUTE) ? 1 : 0;
+- } else if (attribute == xvVolume) {
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- *value = v4l_to_xv(pPPriv->audio.volume);
+- } else {
+- ret = BadValue;
+- }
++ *value = pPPriv->cenc;
++ ret = Success;
+ } else if (attribute == xvFreq) {
+- unsigned long freq;
+- ioctl(V4L_FD,VIDIOCGFREQ,&freq);
+- *value = freq;
+- } else if (0 != pPPriv->yuv_format &&
+- pPPriv->myfmt->getAttribute) {
+- /* not mine -> pass to yuv scaler driver */
+- ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value);
++ struct v4l2_frequency freq;
++ memset(&freq, 0, sizeof(freq));
++ if (ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq) != -1) {
++ *value = freq.frequency;
++ ret = Success;
++ }
+ } else {
+- ret = BadValue;
++ for (i = 0; i < pPPriv->n_qctrl; i++)
++ if (pPPriv->XvV4LCtrl[i].xv == attribute)
++ break;
++ if (i == pPPriv->n_qctrl) {
++ /* not mine -> pass to yuv scaler driver */
++ if (0 != pPPriv->yuv_format && pPPriv->myfmt->getAttribute)
++ ret = pPPriv->myfmt->getAttribute(pScrn, attribute, value);
++ else
++ ret = BadMatch;
++ goto err;
++ }
++ if (pPPriv->XvV4LCtrl[i].qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
++ goto err;
++ ctrl.id = pPPriv->XvV4LCtrl[i].qctrl.id;
++ if (ioctl(V4L_FD, VIDIOC_G_CTRL, &ctrl) != -1) {
++ *value = ctrl.value;
++ ret = Success;
++ }
+ }
++ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n",
++ (int)attribute, (int)*value));
+
+- DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n",
+- attribute, *value));
+-
++err:
+ V4lCloseDevice(pPPriv,pScrn);
+ return ret;
+ }
+@@ -673,15 +875,15 @@ V4lQueryBestSize(ScrnInfoPtr pScrn, Bool
+ int maxy = pPPriv->enc[pPPriv->cenc].height;
+
+ if (0 != pPPriv->yuv_format) {
+- *p_w = pPPriv->myfmt->max_width;
+- *p_h = pPPriv->myfmt->max_height;
++ *p_w = pPPriv->myfmt->max_width;
++ *p_h = pPPriv->myfmt->max_height;
+ } else {
+- *p_w = (drw_w < maxx) ? drw_w : maxx;
+- *p_h = (drw_h < maxy) ? drw_h : maxy;
++ *p_w = (drw_w < maxx) ? drw_w : maxx;
++ *p_h = (drw_h < maxy) ? drw_h : maxy;
+ }
+
+ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/BS %d %dx%d %dx%d\n",
+- pPPriv->cenc,drw_w,drw_h,*p_w,*p_h));
++ pPPriv->cenc,drw_w,drw_h,*p_w,*p_h));
+ }
+
+ static const OptionInfoRec *
+@@ -693,132 +895,198 @@ V4LAvailableOptions(int chipid, int busi
+ static void
+ V4LIdentify(int flags)
+ {
+- xf86Msg(X_INFO, "v4l driver for Video4Linux\n");
+-}
++ xf86Msg(X_INFO, "v4l driver for Video4Linux overlay mode (V4L2)\n");
++}
+
+ static char*
+ fixname(char *str)
+ {
+ int s,d;
+ for (s=0, d=0;; s++) {
+- if (str[s] == '-')
+- continue;
+- str[d++] = tolower(str[s]);
+- if (0 == str[s])
+- break;
++ if (str[s] == '-')
++ continue;
++ str[d++] = tolower(str[s]);
++ if (0 == str[s])
++ break;
+ }
+ return str;
+ }
+
+ static int
+-v4l_add_enc(XF86VideoEncodingPtr enc, int i,
+- char *norm, char *input, int width, int height, int n, int d)
++AddV4LEnc(XF86VideoEncodingPtr enc, int entry,
++ char *norm, char *input, int width, int height, int n, int d)
+ {
+- enc[i].id = i;
+- enc[i].name = xalloc(strlen(norm)+strlen(input)+2);
+- if (NULL == enc[i].name)
+- return -1;
+- enc[i].width = width;
+- enc[i].height = height;
+- enc[i].rate.numerator = n;
+- enc[i].rate.denominator = d;
+- sprintf(enc[i].name,"%s-%s",norm,fixname(input));
++ enc->id = entry;
++ enc->name = malloc(strlen(norm) + strlen(input) + 2);
++ if (!enc->name)
++ return -1;
++
++ enc->width = width;
++ enc->height = height;
++ enc->rate.numerator = n;
++ enc->rate.denominator = d * 2; /* Refresh rate is twice, due to interlace */
++ sprintf(enc->name,"%s-%s",norm,fixname(input));
++
++ xf86Msg(X_INFO, "v4l: adding input %s, %dx%d %d fps\n",
++ enc->name, enc->width, enc->height, (d + n - 1)/n);
++
+ return 0;
+ }
+
++static int
++V4LGetStd(PortPrivPtr p, int fd)
++{
++ struct v4l2_standard standard;
++ int entries = 0;
++
++ /*
++ * 128 is just an arbitrary large number. There aren't that many video stds
++ * The max value is there just to avoid an endless loop, if the driver is
++ * broken.
++ */
++ for (entries = 0; entries < 128; entries++) {
++ memset(&standard, 0, sizeof(standard));
++ standard.index = entries;
++ if (-1 == ioctl(fd,VIDIOC_ENUMSTD, &standard))
++ break;
++ p->standard = realloc(p->standard, sizeof(standard) * (entries + 1));
++ memcpy(&p->standard[entries], &standard, sizeof(standard));
++ }
++
++ /*
++ * Some webcam drivers don't implement VIDIOC_ENUMSTD. Fake it
++ * This is currently unused, as no webcam driver allows OVERLAY mode,
++ * but the code is here, in the case some webcam driver starts allowing
++ * overlay.
++ * FIXME: Webcam drivers may use VIDIOC_ENUM_FRAMESIZES and
++ * VIDIOC_ENUM_FRAMEINTERVALS ioctl's that may help to fine-tune
++ * their needs. Those ioctl's could be used here in order to better
++ * support webcams.
++ */
++ if (!entries) {
++ xf86Msg(X_INFO, "v4l: VIDIOC_ENUMSTD error %d.\n",errno);
++ p->standard = realloc(p->standard, sizeof(standard) * (entries + 1));
++ p->standard[0].id = V4L2_STD_ALL;
++ strcpy((char *)p->standard[0].name, "CAMERA");
++ p->standard[0].frameperiod.numerator = 1001;
++ p->standard[0].frameperiod.denominator = 300001;
++ p->standard[0].framelines = 480;
++ entries++;
++ }
++ return entries;
++}
++
+ static void
+-V4LBuildEncodings(PortPrivPtr p, int fd, int channels)
++V4LBuildEncodings(PortPrivPtr p, int fd)
+ {
+- static struct video_channel channel;
+- int i,entries,have_bttv,bttv_ver;
++ unsigned int inp, std, num_std;
+
+-#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
+- have_bttv = 0;
+- if (-1 != ioctl(fd,BTTV_VERSION,&bttv_ver))
+- have_bttv = 1;
+-
+- entries = (have_bttv ? 7 : 3) * channels;
+- p->enc = xalloc(sizeof(XF86VideoEncodingRec) * entries);
+- if (NULL == p->enc)
+- goto fail;
+- memset(p->enc,0,sizeof(XF86VideoEncodingRec) * entries);
+- p->norm = xalloc(sizeof(int) * entries);
+- if (NULL == p->norm)
+- goto fail;
+- memset(p->norm,0,sizeof(int) * entries);
+- p->input = xalloc(sizeof(int) * entries);
+- if (NULL == p->input)
+- goto fail;
+- memset(p->input,0,sizeof(int) * entries);
++ num_std = V4LGetStd(p, fd);
+
+ p->nenc = 0;
+- for (i = 0; i < channels; i++) {
+- channel.channel = i;
+- if (-1 == ioctl(fd,VIDIOCGCHAN,&channel)) {
+- perror("ioctl VIDIOCGCHAN");
+- continue;
+- }
+-
+- v4l_add_enc(p->enc, p->nenc,"PAL", channel.name, 768,576, 1,50);
+- p->norm[p->nenc] = VIDEO_MODE_PAL;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- v4l_add_enc(p->enc,p->nenc,"NTSC", channel.name, 640,480, 1001,60000);
+- p->norm[p->nenc] = VIDEO_MODE_NTSC;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- v4l_add_enc(p->enc,p->nenc,"SECAM",channel.name, 768,576, 1,50);
+- p->norm[p->nenc] = VIDEO_MODE_SECAM;
+- p->input[p->nenc] = i;
+- p->nenc++;
+
+- if (have_bttv) {
+- /* workaround for a v4l design flaw: The v4l API knows just pal,
+- ntsc and secam. But there are a few more norms (pal versions
+- with a different timings used in south america for example).
+- The bttv driver can handle these too. */
+- if (0 != v4l_add_enc(p->enc,p->nenc,"PAL-Nc",channel.name,
+- 640, 576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 3;
+- p->input[p->nenc] = i;
+- p->nenc++;
++ /*
++ * 256 is just an arbitrary large number. There aren't that many video
++ * inputs on any driver. The max value is there just to avoid an endless
++ * loop, if the driver is broken.
++ */
++ for (inp = 0; inp < 256; inp++) {
++ struct v4l2_input input;
+
+- if (0 != v4l_add_enc(p->enc,p->nenc,"PAL-M",channel.name,
+- 640, 576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 4;
+- p->input[p->nenc] = i;
+- p->nenc++;
++ memset(&input, 0, sizeof(input));
++ input.index = inp;
++ if (ioctl(fd, VIDIOC_ENUMINPUT, &input) == -1)
++ break;
+
+- if (0 != v4l_add_enc(p->enc, p->nenc,"PAL-N", channel.name,
+- 768,576, 1,50))
+- goto fail;
+- p->norm[p->nenc] = 5;
+- p->input[p->nenc] = i;
+- p->nenc++;
+-
+- if (0 != v4l_add_enc(p->enc,p->nenc,"NTSC-JP", channel.name,
+- 640,480, 1001,60000))
+- goto fail;
+- p->norm[p->nenc] = 6;
+- p->input[p->nenc] = i;
+- p->nenc++;
+- }
++ for (std = 0; std < num_std; std++) {
++ int width, height;
++
++ /*
++ * Currently, this code is not reliable, due to driver
++ * non-compliance on both saa7134 and bttv. So, instead,
++ * just use the video standard information
++ */
++#if 0
++ struct v4l2_framebuffer fbuf;
++
++ /* Some webcam drivers will fail here, but that's OK */
++ ioctl(fd, VIDIOC_S_STD, &p->standard[std].id);
++
++ memset(&fbuf, 0, sizeof(fbuf));
++ if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
++ xf86Msg(X_INFO, "v4l: Error %d: Can't get FBUF\n", errno);
++ return;
++ }
++ height = fbuf.fmt.height;
++ width = fbuf.fmt.width;
++
++ /*
++ * If the overlay method fails, get the resolution
++ * via checking V4L2_BUF_TYPE_VIDEO_CAPTURE
++ */
++ if (!height || !width) {
++ struct v4l2_format format;
++
++ format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
++ if (ioctl(fd, VIDIOC_G_FMT, &format) == -1) {
++ /* Hmm... device doesn't support capture. */
++ height = p->standard[std].framelines;
++ if (height == 480)
++ width = 640;
++ else if (height == 576)
++ width = 768;
++ else
++ continue;
++ } else {
++ height = format.fmt.pix.height;
++ width = format.fmt.pix.width;
++ }
++ }
++#else
++ if (p->standard[std].id & V4L2_STD_525_60) {
++ height = 480;
++ width = 640;
++ } else {
++ height = 576;
++ width = 768;
++ }
++
++#endif
++ /* Fixup for some driver bug */
++ if ((p->standard[std].id & V4L2_STD_525_60) && (height == 576))
++ height = 480;
++
++ p->enc = realloc(p->enc, sizeof(XF86VideoEncodingRec) * (p->nenc + 1));
++ p->norm = realloc(p->norm, sizeof(int) * (p->nenc + 1));
++ p->input = realloc(p->input, sizeof(int) * (p->nenc + 1));
++ if (!p->enc || !p->norm || !p->input)
++ goto fail;
++ if (AddV4LEnc(&p->enc[p->nenc], p->nenc,
++ (char *)p->standard[std].name,
++ (char *)input.name, width, height,
++ p->standard[std].frameperiod.numerator,
++ p->standard[std].frameperiod.denominator))
++ goto fail;
++ p->norm[p->nenc] = p->standard[std].id;
++ p->input[p->nenc] = inp;
++ p->nenc++;
++ }
+ }
++
++ if (!p->nenc)
++ xf86Msg(X_ERROR, "v4l: couldn't detect any valid input/standard\n");
+ return;
+-
+- fail:
++
++fail:
++ xf86Msg(X_ERROR, "v4l: Fail to get standards: %d\n", errno);
+ if (p->input)
+- xfree(p->input);
++ free(p->input);
+ p->input = NULL;
+ if (p->norm)
+- xfree(p->norm);
++ free(p->norm);
+ p->norm = NULL;
+ if (p->enc)
+- xfree(p->enc);
++ free(p->enc);
+ p->enc = NULL;
+ p->nenc = 0;
+ }
+@@ -826,75 +1094,35 @@ V4LBuildEncodings(PortPrivPtr p, int fd,
+ /* add a attribute a list */
+ static void
+ v4l_add_attr(XF86AttributeRec **list, int *count,
+- const XF86AttributeRec *attr)
++ const XF86AttributeRec *attr)
+ {
+ XF86AttributeRec *oldlist = *list;
+ int i;
++ Atom gpa;
+
+ for (i = 0; i < *count; i++) {
+- if (0 == strcmp((*list)[i].name,attr->name)) {
+- DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
+- return;
+- }
++ if (0 == strcmp((*list)[i].name,attr->name)) {
++ DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name));
++ return;
++ }
+ }
+-
+- DEBUG(xf86Msg(X_INFO, "v4l: add attr %s\n",attr->name));
+- *list = xalloc((*count + 1) * sizeof(XF86AttributeRec));
++
++ *list = malloc((*count + 1) * sizeof(XF86AttributeRec));
+ if (NULL == *list) {
+- *count = 0;
+- return;
++ *count = 0;
++ return;
+ }
+ if (*count)
+- memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
++ memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec));
+ memcpy(*list + *count, attr, sizeof(XF86AttributeRec));
++
++ gpa = MAKE_ATOM((*list)[*count].name);
++ xf86Msg(X_INFO, "v4l: add attr %s (Xv/GPA %d) (%d to %d)\n",
++ attr->name, (int)gpa, attr->min_value, attr->max_value);
++
+ (*count)++;
+ }
+
+-/* setup yuv overlay + hw scaling: look if we find some common video
+- format which both v4l driver and the X-Server can handle */
+-static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
+- char *dev, int fd)
+-{
+- static const struct {
+- unsigned int v4l_palette;
+- unsigned int v4l_depth;
+- unsigned int xv_id;
+- unsigned int xv_format;
+- } yuvlist[] = {
+- { VIDEO_PALETTE_YUV422, 16, 0x32595559, XvPacked },
+- { VIDEO_PALETTE_UYVY, 16, 0x59565955, XvPacked },
+- { 0 /* end of list */ },
+- };
+- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+- int fmt,i;
+-
+- pPPriv->format = xf86XVQueryOffscreenImages(pScreen,&pPPriv->nformat);
+- for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
+- /* check v4l ... */
+- ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
+- pPPriv->pict.palette = yuvlist[fmt].v4l_palette;
+- pPPriv->pict.depth = yuvlist[fmt].v4l_depth;
+- if (-1 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict))
+- continue;
+- ioctl(fd,VIDIOCGPICT,&pPPriv->pict);
+- if (pPPriv->pict.palette != yuvlist[fmt].v4l_palette)
+- continue;
+- /* ... works, check available offscreen image formats now ... */
+- for (i = 0; i < pPPriv->nformat; i++) {
+- if (pPPriv->format[i].image->id == yuvlist[fmt].xv_id &&
+- pPPriv->format[i].image->format == yuvlist[fmt].xv_format) {
+- /* ... match found, good. */
+- pPPriv->yuv_format = yuvlist[fmt].v4l_palette;
+- pPPriv->myfmt = pPPriv->format+i;
+- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+- "v4l[%s]: using hw video scaling [%4.4s].\n",
+- dev,(char*)&(pPPriv->format[i].image->id));
+- return;
+- }
+- }
+- }
+-}
+-
+ static int
+ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
+ {
+@@ -904,118 +1132,114 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdap
+ char dev[18];
+ int fd,i,j,d;
+
+- DEBUG(xf86Msg(X_INFO, "v4l: init start\n"));
++ for (i = 0, d = 0; d < MAX_V4L_DEVICES; d++) {
++ sprintf(dev, "/dev/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1) {
++ sprintf(dev, "/dev/v4l/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1)
++ break;
++ }
++ DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
+
+- for (i = 0, d = 0; d < MAX_V4L_DEVICES; d++) {
+- sprintf(dev, "/dev/video%d", d);
+- fd = open(dev, O_RDWR, 0);
+- if (fd == -1) {
+- sprintf(dev, "/dev/v4l/video%d", d);
+- fd = open(dev, O_RDWR, 0);
+- if (fd == -1)
+- break;
+- }
+- DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev));
++ /* our private data */
++ pPPriv = malloc(sizeof(PortPrivRec));
++ if (!pPPriv)
++ return FALSE;
++ memset(pPPriv,0,sizeof(PortPrivRec));
++ pPPriv->nr = d;
+
+- /* our private data */
+- pPPriv = xalloc(sizeof(PortPrivRec));
+- if (!pPPriv)
+- return FALSE;
+- memset(pPPriv,0,sizeof(PortPrivRec));
+- pPPriv->nr = d;
++ /* check device capabilities */
++ memset(&pPPriv->cap, 0, sizeof(&pPPriv->cap));
++ if (-1 == ioctl(fd, VIDIOC_QUERYCAP, &pPPriv->cap) ||
++ 0 == (pPPriv->cap.capabilities & V4L2_CAP_VIDEO_OVERLAY)) {
++ xf86Msg(X_ERROR, "v4l: %s: no overlay support\n",dev);
++ free(pPPriv);
++ close(fd);
++ continue;
++ }
+
+- /* check device */
+- if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) ||
+- 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) {
+- DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev));
+- xfree(pPPriv);
+- close(fd);
+- continue;
+- }
+- strncpy(V4L_NAME, dev, 16);
+- V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels);
+- if (NULL == pPPriv->enc)
+- return FALSE;
+- v4l_check_yuv(pScrn,pPPriv,dev,fd);
+-
+- /* alloc VideoAdaptorRec */
+- VAR = xrealloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1));
+- VAR[i] = xalloc(sizeof(XF86VideoAdaptorRec));
+- if (!VAR[i])
+- return FALSE;
+- memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
++ if (v4l_check_yuv(pScrn, pPPriv, dev, fd) == FALSE) {
++ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
++ "Xv Overlay not supported. Can't use v4l driver\n");
++ free(pPPriv);
++ close(fd);
++ continue;
++ }
+
++ xf86Msg(X_INFO, "v4l: enabling overlay mode for %s.\n", dev);
++ strncpy(V4L_NAME, dev, 16);
++ V4LBuildEncodings(pPPriv, fd);
++ if (NULL == pPPriv->enc)
++ return FALSE;
+
+- /* build attribute list */
+- for (j = 0; j < V4L_ATTR; j++) {
+- /* video attributes */
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &Attributes[j]);
+- }
+- if (0 == ioctl(fd,VIDIOCGAUDIO,&pPPriv->audio)) {
+- /* audio attributes */
+- if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME)
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &VolumeAttr);
+- if (pPPriv->audio.flags & VIDEO_AUDIO_MUTABLE)
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &MuteAttr);
+- }
+- if (pPPriv->cap.type & VID_TYPE_TUNER) {
+- /* tuner attributes */
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- &FreqAttr);
+- }
+- if (0 != pPPriv->yuv_format) {
+- /* pass throuth scaler attributes */
+- for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
+- v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
+- pPPriv->myfmt->attributes+j);
+- }
+- }
+-
+-
+- /* hook in private data */
+- Private = xalloc(sizeof(DevUnion));
+- if (!Private)
+- return FALSE;
+- memset(Private,0,sizeof(DevUnion));
+- Private->ptr = (pointer)pPPriv;
+- VAR[i]->pPortPrivates = Private;
+- VAR[i]->nPorts = 1;
++ /* alloc VideoAdaptorRec */
++ VAR = realloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1));
++ VAR[i] = malloc(sizeof(XF86VideoAdaptorRec));
++ if (!VAR[i])
++ return FALSE;
++ memset(VAR[i],0,sizeof(XF86VideoAdaptorRec));
+
+- /* init VideoAdaptorRec */
+- VAR[i]->type = XvInputMask | XvWindowMask | XvVideoMask;
+- VAR[i]->name = "video4linux";
+- VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
++ /* build attribute list */
++ AddAllV4LControls(pPPriv, &VAR[i]->pAttributes, &VAR[i]->nAttributes, fd);
+
+- VAR[i]->PutVideo = V4lPutVideo;
+- VAR[i]->PutStill = V4lPutStill;
+- VAR[i]->StopVideo = V4lStopVideo;
+- VAR[i]->SetPortAttribute = V4lSetPortAttribute;
+- VAR[i]->GetPortAttribute = V4lGetPortAttribute;
+- VAR[i]->QueryBestSize = V4lQueryBestSize;
++ for (j = 0; j < V4L_ATTR; j++) {
++ /* Other video attributes */
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ &Attributes[j]);
++ }
++ if (pPPriv->cap.capabilities & V4L2_CAP_TUNER) {
++ /* tuner attributes */
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ &FreqAttr);
++ }
+
+- VAR[i]->nEncodings = pPPriv->nenc;
+- VAR[i]->pEncodings = pPPriv->enc;
+- VAR[i]->nFormats =
+- sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
+- VAR[i]->pFormats = InputVideoFormats;
++ /* Initialize yuv_format */
++ if (0 != pPPriv->yuv_format) {
++ /* pass throuth scaler attributes */
++ for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {
++ v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes,
++ pPPriv->myfmt->attributes+j);
++ }
++ }
+
+- if (fd != -1)
+- close(fd);
+- i++;
++ DEBUG(xf86Msg(X_INFO, "v4l: saving config into driver data\n"));
++ /* hook in private data */
++ Private = malloc(sizeof(DevUnion));
++ if (!Private)
++ return FALSE;
++ memset(Private,0,sizeof(DevUnion));
++ Private->ptr = (pointer)pPPriv;
++ VAR[i]->pPortPrivates = Private;
++ VAR[i]->nPorts = 1;
++
++ /* init VideoAdaptorRec */
++ VAR[i]->type = XvInputMask | XvWindowMask | XvVideoMask;
++ VAR[i]->name = "video4linux";
++ VAR[i]->flags = VIDEO_INVERT_CLIPLIST;
++
++ VAR[i]->PutVideo = V4lPutVideo;
++ VAR[i]->PutStill = V4lPutStill;
++ VAR[i]->StopVideo = V4lStopVideo;
++ VAR[i]->SetPortAttribute = V4lSetPortAttribute;
++ VAR[i]->GetPortAttribute = V4lGetPortAttribute;
++ VAR[i]->QueryBestSize = V4lQueryBestSize;
++
++ VAR[i]->nEncodings = pPPriv->nenc;
++ VAR[i]->pEncodings = pPPriv->enc;
++ VAR[i]->nFormats = sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]);
++ VAR[i]->pFormats = InputVideoFormats;
++
++ if (fd != -1) {
++ DEBUG(xf86Msg(X_INFO, "v4l: %s init finished.\n",dev));
++ close(fd);
++ }
++ i++;
+ }
+
+ xvEncoding = MAKE_ATOM(XV_ENCODING);
+- xvHue = MAKE_ATOM(XV_HUE);
+- xvSaturation = MAKE_ATOM(XV_SATURATION);
+- xvBrightness = MAKE_ATOM(XV_BRIGHTNESS);
+- xvContrast = MAKE_ATOM(XV_CONTRAST);
+-
+ xvFreq = MAKE_ATOM(XV_FREQ);
+- xvMute = MAKE_ATOM(XV_MUTE);
+- xvVolume = MAKE_ATOM(XV_VOLUME);
+
+ DEBUG(xf86Msg(X_INFO, "v4l: init done, %d device(s) found\n",i));
+
+@@ -1024,10 +1248,43 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdap
+ }
+
+ static Bool
++V4LDetect(void)
++{
++ struct v4l2_capability cap;
++ int fd, d, n = 0;
++ char dev[18];
++
++ for (d = 0; d < MAX_V4L_DEVICES; d++) {
++ sprintf(dev, "/dev/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1) {
++ sprintf(dev, "/dev/v4l/video%d", d);
++ fd = open(dev, O_RDWR, 0);
++ if (fd == -1)
++ break;
++ }
++ close (fd);
++ memset(&cap, 0, sizeof(cap));
++ if (!ioctl(fd, VIDIOC_QUERYCAP, &cap) &&
++ (cap.capabilities & V4L2_CAP_VIDEO_OVERLAY))
++ n++;
++ }
++ xf86Msg(X_INFO, "v4l: %d video adapters with overlay support detected\n", n);
++
++ return (n > 0) ? TRUE : FALSE;
++}
++
++static Bool
+ V4LProbe(DriverPtr drv, int flags)
+ {
+- if (flags & PROBE_DETECT)
+- return TRUE;
++ /*
++ * Don't try to register adapter at the detection phase, as Xv
++ * extensions won't be there
++ */
++ if (flags == PROBE_DETECT)
++ return V4LDetect();
++
++ DEBUG(xf86Msg(X_INFO, "v4l: Initiating device probe\n"));
+
+ xf86XVRegisterGenericAdaptorDriver(V4LInit);
+ drv->refCount++;
+diff --git a/src/videodev.h b/src/videodev.h
+deleted file mode 100644
+--- a/src/videodev.h
++++ /dev/null
+@@ -1,254 +0,0 @@
+-#ifndef __LINUX_VIDEODEV_H
+-#define __LINUX_VIDEODEV_H
+-
+-/* Linux V4L API, Version 1
+- * videodev.h from v4l driver in Linux 2.2.3
+- *
+- * Used here with the explicit permission of the original author, Alan Cox.
+- *
+- */
+-
+-#include
+-
+-#define VID_TYPE_CAPTURE 1 /* Can capture */
+-#define VID_TYPE_TUNER 2 /* Can tune */
+-#define VID_TYPE_TELETEXT 4 /* Does teletext */
+-#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
+-#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
+-#define VID_TYPE_CLIPPING 32 /* Can clip */
+-#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
+-#define VID_TYPE_SCALES 128 /* Scalable */
+-#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
+-#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
+-
+-struct video_capability
+-{
+- char name[32];
+- int type;
+- int channels; /* Num channels */
+- int audios; /* Num audio devices */
+- int maxwidth; /* Supported width */
+- int maxheight; /* And height */
+- int minwidth; /* Supported width */
+- int minheight; /* And height */
+-};
+-
+-
+-struct video_channel
+-{
+- int channel;
+- char name[32];
+- int tuners;
+- CARD32 flags;
+-#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
+-#define VIDEO_VC_AUDIO 2 /* Channel has audio */
+- CARD16 type;
+-#define VIDEO_TYPE_TV 1
+-#define VIDEO_TYPE_CAMERA 2
+- CARD16 norm; /* Norm set by channel */
+-};
+-
+-struct video_tuner
+-{
+- int tuner;
+- char name[32];
+- unsigned long rangelow, rangehigh; /* Tuner range */
+- CARD32 flags;
+-#define VIDEO_TUNER_PAL 1
+-#define VIDEO_TUNER_NTSC 2
+-#define VIDEO_TUNER_SECAM 4
+-#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
+-#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
+-#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
+- CARD16 mode; /* PAL/NTSC/SECAM/OTHER */
+-#define VIDEO_MODE_PAL 0
+-#define VIDEO_MODE_NTSC 1
+-#define VIDEO_MODE_SECAM 2
+-#define VIDEO_MODE_AUTO 3
+- CARD16 signal; /* Signal strength 16bit scale */
+-};
+-
+-struct video_picture
+-{
+- CARD16 brightness;
+- CARD16 hue;
+- CARD16 colour;
+- CARD16 contrast;
+- CARD16 whiteness; /* Black and white only */
+- CARD16 depth; /* Capture depth */
+- CARD16 palette; /* Palette in use */
+-#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
+-#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
+-#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
+-#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
+-#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
+-#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
+-#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
+-#define VIDEO_PALETTE_YUYV 8
+-#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
+-#define VIDEO_PALETTE_YUV420 10
+-#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
+-#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
+-#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
+-#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
+-#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
+-#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
+-#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
+-#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
+-};
+-
+-struct video_audio
+-{
+- int audio; /* Audio channel */
+- CARD16 volume; /* If settable */
+- CARD16 bass, treble;
+- CARD32 flags;
+-#define VIDEO_AUDIO_MUTE 1
+-#define VIDEO_AUDIO_MUTABLE 2
+-#define VIDEO_AUDIO_VOLUME 4
+-#define VIDEO_AUDIO_BASS 8
+-#define VIDEO_AUDIO_TREBLE 16
+- char name[16];
+-#define VIDEO_SOUND_MONO 1
+-#define VIDEO_SOUND_STEREO 2
+-#define VIDEO_SOUND_LANG1 4
+-#define VIDEO_SOUND_LANG2 8
+- CARD16 mode;
+- CARD16 balance; /* Stereo balance */
+- CARD16 step; /* Step actual volume uses */
+-};
+-
+-struct video_clip
+-{
+- INT32 x,y;
+- INT32 width, height;
+- struct video_clip *next; /* For user use/driver use only */
+-};
+-
+-struct video_window
+-{
+- CARD32 x,y; /* Position of window */
+- CARD32 width,height; /* Its size */
+- CARD32 chromakey;
+- CARD32 flags;
+- struct video_clip *clips; /* Set only */
+- int clipcount;
+-#define VIDEO_WINDOW_INTERLACE 1
+-#define VIDEO_CLIP_BITMAP -1
+-/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
+-#define VIDEO_CLIPMAP_SIZE (128 * 625)
+-};
+-
+-struct video_capture
+-{
+- CARD32 x,y; /* Offsets into image */
+- CARD32 width, height; /* Area to capture */
+- CARD16 decimation; /* Decimation divder */
+- CARD16 flags; /* Flags for capture */
+-#define VIDEO_CAPTURE_ODD 0 /* Temporal */
+-#define VIDEO_CAPTURE_EVEN 1
+-};
+-
+-struct video_buffer
+-{
+- void *base;
+- int height,width;
+- int depth;
+- int bytesperline;
+-};
+-
+-struct video_mmap
+-{
+- unsigned int frame; /* Frame (0 - n) for double buffer */
+- int height,width;
+- unsigned int format; /* should be VIDEO_PALETTE_* */
+-};
+-
+-struct video_key
+-{
+- CARD8 key[8];
+- CARD32 flags;
+-};
+-
+-
+-#define VIDEO_MAX_FRAME 32
+-
+-struct video_mbuf
+-{
+- int size; /* Total memory to map */
+- int frames; /* Frames */
+- int offsets[VIDEO_MAX_FRAME];
+-};
+-
+-
+-#define VIDEO_NO_UNIT (-1)
+-
+-
+-struct video_unit
+-{
+- int video; /* Video minor */
+- int vbi; /* VBI minor */
+- int radio; /* Radio minor */
+- int audio; /* Audio minor */
+- int teletext; /* Teletext minor */
+-};
+-
+-#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
+-#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
+-#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
+-#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
+-#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
+-#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
+-#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
+-#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
+-#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Set the video overlay window */
+-#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
+-#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
+-#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
+-#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
+-#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
+-#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
+-#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
+-#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
+-#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
+-#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
+-#define VIDIOCGMBUF _IOR('v', 20, struct video_mbuf) /* Memory map buffer info */
+-#define VIDIOCGUNIT _IOR('v', 21, struct video_unit) /* Get attached units */
+-#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get frame buffer */
+-#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set frame buffer - root only */
+-
+-#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
+-
+-
+-#define VID_HARDWARE_BT848 1
+-#define VID_HARDWARE_QCAM_BW 2
+-#define VID_HARDWARE_PMS 3
+-#define VID_HARDWARE_QCAM_C 4
+-#define VID_HARDWARE_PSEUDO 5
+-#define VID_HARDWARE_SAA5249 6
+-#define VID_HARDWARE_AZTECH 7
+-#define VID_HARDWARE_SF16MI 8
+-#define VID_HARDWARE_RTRACK 9
+-#define VID_HARDWARE_ZOLTRIX 10
+-#define VID_HARDWARE_SAA7146 11
+-#define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
+-#define VID_HARDWARE_RTRACK2 13
+-#define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
+-#define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
+-#define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
+-#define VID_HARDWARE_BROADWAY 17 /* Broadway project */
+-#define VID_HARDWARE_GEMTEK 18
+-#define VID_HARDWARE_TYPHOON 19
+-#define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */
+-
+-/*
+- * Initialiser list
+- */
+-
+-struct video_init
+-{
+- char *name;
+- int (*init)(struct video_init *);
+-};
+-
+-#endif
+diff --git a/src/videodev2.h b/src/videodev2.h
+new file mode 100644
+--- /dev/null
++++ b/src/videodev2.h
+@@ -0,0 +1,1929 @@
++/*
++ * Video for Linux Two header file
++ *
++ * Copyright (C) 1999-2007 the contributors
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * Alternatively you can redistribute this file under the terms of the
++ * BSD license as stated below:
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in
++ * the documentation and/or other materials provided with the
++ * distribution.
++ * 3. The names of its contributors may not be used to endorse or promote
++ * products derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
++ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ * Header file for v4l or V4L2 drivers and applications
++ * with public API.
++ * All kernel-specific stuff were moved to media/v4l2-dev.h, so
++ * no #if __KERNEL tests are allowed here
++ *
++ * See http://linuxtv.org for more info
++ *
++ * Author: Bill Dirks
++ * Justin Schoeman
++ * Hans Verkuil
++ * et al.
++ */
++#ifndef __LINUX_VIDEODEV2_H
++#define __LINUX_VIDEODEV2_H
++
++#include
++#include
++#include
++
++/*
++ * Common stuff for both V4L1 and V4L2
++ * Moved from videodev.h
++ */
++#define VIDEO_MAX_FRAME 32
++#define VIDEO_MAX_PLANES 8
++
++/* These defines are V4L1 specific and should not be used with the V4L2 API!
++ They will be removed from this header in the future. */
++
++#define VID_TYPE_CAPTURE 1 /* Can capture */
++#define VID_TYPE_TUNER 2 /* Can tune */
++#define VID_TYPE_TELETEXT 4 /* Does teletext */
++#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
++#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
++#define VID_TYPE_CLIPPING 32 /* Can clip */
++#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
++#define VID_TYPE_SCALES 128 /* Scalable */
++#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
++#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
++#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
++#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
++#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
++#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
++
++/*
++ * M I S C E L L A N E O U S
++ */
++
++/* Four-character-code (FOURCC) */
++#define v4l2_fourcc(a, b, c, d)\
++ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
++
++/*
++ * E N U M S
++ */
++enum v4l2_field {
++ V4L2_FIELD_ANY = 0, /* driver can choose from none,
++ top, bottom, interlaced
++ depending on whatever it thinks
++ is approximate ... */
++ V4L2_FIELD_NONE = 1, /* this device has no fields ... */
++ V4L2_FIELD_TOP = 2, /* top field only */
++ V4L2_FIELD_BOTTOM = 3, /* bottom field only */
++ V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
++ V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
++ buffer, top-bottom order */
++ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
++ V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
++ separate buffers */
++ V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
++ first and the top field is
++ transmitted first */
++ V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
++ first and the bottom field is
++ transmitted first */
++};
++#define V4L2_FIELD_HAS_TOP(field) \
++ ((field) == V4L2_FIELD_TOP ||\
++ (field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++#define V4L2_FIELD_HAS_BOTTOM(field) \
++ ((field) == V4L2_FIELD_BOTTOM ||\
++ (field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++#define V4L2_FIELD_HAS_BOTH(field) \
++ ((field) == V4L2_FIELD_INTERLACED ||\
++ (field) == V4L2_FIELD_INTERLACED_TB ||\
++ (field) == V4L2_FIELD_INTERLACED_BT ||\
++ (field) == V4L2_FIELD_SEQ_TB ||\
++ (field) == V4L2_FIELD_SEQ_BT)
++
++enum v4l2_buf_type {
++ V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
++ V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
++ V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
++ V4L2_BUF_TYPE_VBI_CAPTURE = 4,
++ V4L2_BUF_TYPE_VBI_OUTPUT = 5,
++ V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
++ V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
++#if 1
++ /* Experimental */
++ V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
++#endif
++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
++ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
++ V4L2_BUF_TYPE_PRIVATE = 0x80,
++};
++
++#define V4L2_TYPE_IS_MULTIPLANAR(type) \
++ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
++
++#define V4L2_TYPE_IS_OUTPUT(type) \
++ ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
++ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
++ || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
++ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
++
++enum v4l2_tuner_type {
++ V4L2_TUNER_RADIO = 1,
++ V4L2_TUNER_ANALOG_TV = 2,
++ V4L2_TUNER_DIGITAL_TV = 3,
++};
++
++enum v4l2_memory {
++ V4L2_MEMORY_MMAP = 1,
++ V4L2_MEMORY_USERPTR = 2,
++ V4L2_MEMORY_OVERLAY = 3,
++};
++
++/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
++enum v4l2_colorspace {
++ /* ITU-R 601 -- broadcast NTSC/PAL */
++ V4L2_COLORSPACE_SMPTE170M = 1,
++
++ /* 1125-Line (US) HDTV */
++ V4L2_COLORSPACE_SMPTE240M = 2,
++
++ /* HD and modern captures. */
++ V4L2_COLORSPACE_REC709 = 3,
++
++ /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
++ V4L2_COLORSPACE_BT878 = 4,
++
++ /* These should be useful. Assume 601 extents. */
++ V4L2_COLORSPACE_470_SYSTEM_M = 5,
++ V4L2_COLORSPACE_470_SYSTEM_BG = 6,
++
++ /* I know there will be cameras that send this. So, this is
++ * unspecified chromaticities and full 0-255 on each of the
++ * Y'CbCr components
++ */
++ V4L2_COLORSPACE_JPEG = 7,
++
++ /* For RGB colourspaces, this is probably a good start. */
++ V4L2_COLORSPACE_SRGB = 8,
++};
++
++enum v4l2_priority {
++ V4L2_PRIORITY_UNSET = 0, /* not initialized */
++ V4L2_PRIORITY_BACKGROUND = 1,
++ V4L2_PRIORITY_INTERACTIVE = 2,
++ V4L2_PRIORITY_RECORD = 3,
++ V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE,
++};
++
++struct v4l2_rect {
++ __s32 left;
++ __s32 top;
++ __s32 width;
++ __s32 height;
++};
++
++struct v4l2_fract {
++ __u32 numerator;
++ __u32 denominator;
++};
++
++/*
++ * D R I V E R C A P A B I L I T I E S
++ */
++struct v4l2_capability {
++ __u8 driver[16]; /* i.e. "bttv" */
++ __u8 card[32]; /* i.e. "Hauppauge WinTV" */
++ __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
++ __u32 version; /* should use KERNEL_VERSION() */
++ __u32 capabilities; /* Device capabilities */
++ __u32 reserved[4];
++};
++
++/* Values for 'capabilities' field */
++#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
++#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
++#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
++#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
++#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
++#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
++#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
++#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
++#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
++#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
++#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
++
++/* Is a video capture device that supports multiplanar formats */
++#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
++/* Is a video output device that supports multiplanar formats */
++#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
++
++#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
++#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
++#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
++#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
++
++#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
++#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
++#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
++
++/*
++ * V I D E O I M A G E F O R M A T
++ */
++struct v4l2_pix_format {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ enum v4l2_field field;
++ __u32 bytesperline; /* for padding, zero if unused */
++ __u32 sizeimage;
++ enum v4l2_colorspace colorspace;
++ __u32 priv; /* private data, depends on pixelformat */
++};
++
++/* Pixel format FOURCC depth Description */
++
++/* RGB formats */
++#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
++#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
++#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
++#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
++#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
++#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
++#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
++#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
++#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
++#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
++#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
++
++/* Grey formats */
++#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
++#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
++#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
++#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
++#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
++
++/* Palette formats */
++#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
++
++/* Luminance+Chrominance formats */
++#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
++#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
++#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
++#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
++#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
++#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
++#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
++#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
++#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
++#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
++#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
++#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
++#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
++#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
++#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
++
++/* two planes -- one Y, one Cr + Cb interleaved */
++#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
++#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
++#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
++#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
++
++/* two non contiguous planes - one Y, one Cr + Cb interleaved */
++#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
++#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
++
++/* three non contiguous planes - Y, Cb, Cr */
++#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
++
++/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
++#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
++#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
++#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
++#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
++#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */
++#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
++#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
++#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
++ /* 10bit raw bayer DPCM compressed to 8 bits */
++#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
++ /*
++ * 10bit raw bayer, expanded to 16 bits
++ * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
++ */
++#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
++
++/* compressed formats */
++#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
++#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
++#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
++#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
++
++/* Vendor-specific formats */
++#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
++#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
++#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
++#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
++#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
++#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
++#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
++#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
++#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
++#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
++#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
++#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
++#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
++#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
++#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
++#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
++#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
++#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
++#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
++#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
++#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
++#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
++
++/*
++ * F O R M A T E N U M E R A T I O N
++ */
++struct v4l2_fmtdesc {
++ __u32 index; /* Format number */
++ enum v4l2_buf_type type; /* buffer type */
++ __u32 flags;
++ __u8 description[32]; /* Description string */
++ __u32 pixelformat; /* Format fourcc */
++ __u32 reserved[4];
++};
++
++#define V4L2_FMT_FLAG_COMPRESSED 0x0001
++#define V4L2_FMT_FLAG_EMULATED 0x0002
++
++#if 1
++ /* Experimental Frame Size and frame rate enumeration */
++/*
++ * F R A M E S I Z E E N U M E R A T I O N
++ */
++enum v4l2_frmsizetypes {
++ V4L2_FRMSIZE_TYPE_DISCRETE = 1,
++ V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
++ V4L2_FRMSIZE_TYPE_STEPWISE = 3,
++};
++
++struct v4l2_frmsize_discrete {
++ __u32 width; /* Frame width [pixel] */
++ __u32 height; /* Frame height [pixel] */
++};
++
++struct v4l2_frmsize_stepwise {
++ __u32 min_width; /* Minimum frame width [pixel] */
++ __u32 max_width; /* Maximum frame width [pixel] */
++ __u32 step_width; /* Frame width step size [pixel] */
++ __u32 min_height; /* Minimum frame height [pixel] */
++ __u32 max_height; /* Maximum frame height [pixel] */
++ __u32 step_height; /* Frame height step size [pixel] */
++};
++
++struct v4l2_frmsizeenum {
++ __u32 index; /* Frame size number */
++ __u32 pixel_format; /* Pixel format */
++ __u32 type; /* Frame size type the device supports. */
++
++ union { /* Frame size */
++ struct v4l2_frmsize_discrete discrete;
++ struct v4l2_frmsize_stepwise stepwise;
++ };
++
++ __u32 reserved[2]; /* Reserved space for future use */
++};
++
++/*
++ * F R A M E R A T E E N U M E R A T I O N
++ */
++enum v4l2_frmivaltypes {
++ V4L2_FRMIVAL_TYPE_DISCRETE = 1,
++ V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
++ V4L2_FRMIVAL_TYPE_STEPWISE = 3,
++};
++
++struct v4l2_frmival_stepwise {
++ struct v4l2_fract min; /* Minimum frame interval [s] */
++ struct v4l2_fract max; /* Maximum frame interval [s] */
++ struct v4l2_fract step; /* Frame interval step size [s] */
++};
++
++struct v4l2_frmivalenum {
++ __u32 index; /* Frame format index */
++ __u32 pixel_format; /* Pixel format */
++ __u32 width; /* Frame width */
++ __u32 height; /* Frame height */
++ __u32 type; /* Frame interval type the device supports. */
++
++ union { /* Frame interval */
++ struct v4l2_fract discrete;
++ struct v4l2_frmival_stepwise stepwise;
++ };
++
++ __u32 reserved[2]; /* Reserved space for future use */
++};
++#endif
++
++/*
++ * T I M E C O D E
++ */
++struct v4l2_timecode {
++ __u32 type;
++ __u32 flags;
++ __u8 frames;
++ __u8 seconds;
++ __u8 minutes;
++ __u8 hours;
++ __u8 userbits[4];
++};
++
++/* Type */
++#define V4L2_TC_TYPE_24FPS 1
++#define V4L2_TC_TYPE_25FPS 2
++#define V4L2_TC_TYPE_30FPS 3
++#define V4L2_TC_TYPE_50FPS 4
++#define V4L2_TC_TYPE_60FPS 5
++
++/* Flags */
++#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
++#define V4L2_TC_FLAG_COLORFRAME 0x0002
++#define V4L2_TC_USERBITS_field 0x000C
++#define V4L2_TC_USERBITS_USERDEFINED 0x0000
++#define V4L2_TC_USERBITS_8BITCHARS 0x0008
++/* The above is based on SMPTE timecodes */
++
++struct v4l2_jpegcompression {
++ int quality;
++
++ int APPn; /* Number of APP segment to be written,
++ * must be 0..15 */
++ int APP_len; /* Length of data in JPEG APPn segment */
++ char APP_data[60]; /* Data in the JPEG APPn segment. */
++
++ int COM_len; /* Length of data in JPEG COM segment */
++ char COM_data[60]; /* Data in JPEG COM segment */
++
++ __u32 jpeg_markers; /* Which markers should go into the JPEG
++ * output. Unless you exactly know what
++ * you do, leave them untouched.
++ * Inluding less markers will make the
++ * resulting code smaller, but there will
++ * be fewer applications which can read it.
++ * The presence of the APP and COM marker
++ * is influenced by APP_len and COM_len
++ * ONLY, not by this property! */
++
++#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
++#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
++#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
++#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
++#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
++ * allways use APP0 */
++};
++
++/*
++ * M E M O R Y - M A P P I N G B U F F E R S
++ */
++struct v4l2_requestbuffers {
++ __u32 count;
++ enum v4l2_buf_type type;
++ enum v4l2_memory memory;
++ __u32 reserved[2];
++};
++
++/**
++ * struct v4l2_plane - plane info for multi-planar buffers
++ * @bytesused: number of bytes occupied by data in the plane (payload)
++ * @length: size of this plane (NOT the payload) in bytes
++ * @mem_offset: when memory in the associated struct v4l2_buffer is
++ * V4L2_MEMORY_MMAP, equals the offset from the start of
++ * the device memory for this plane (or is a "cookie" that
++ * should be passed to mmap() called on the video node)
++ * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
++ * pointing to this plane
++ * @data_offset: offset in the plane to the start of data; usually 0,
++ * unless there is a header in front of the data
++ *
++ * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
++ * with two planes can have one plane for Y, and another for interleaved CbCr
++ * components. Each plane can reside in a separate memory buffer, or even in
++ * a completely separate memory node (e.g. in embedded devices).
++ */
++struct v4l2_plane {
++ __u32 bytesused;
++ __u32 length;
++ union {
++ __u32 mem_offset;
++ unsigned long userptr;
++ } m;
++ __u32 data_offset;
++ __u32 reserved[11];
++};
++
++/**
++ * struct v4l2_buffer - video buffer info
++ * @index: id number of the buffer
++ * @type: buffer type (type == *_MPLANE for multiplanar buffers)
++ * @bytesused: number of bytes occupied by data in the buffer (payload);
++ * unused (set to 0) for multiplanar buffers
++ * @flags: buffer informational flags
++ * @field: field order of the image in the buffer
++ * @timestamp: frame timestamp
++ * @timecode: frame timecode
++ * @sequence: sequence count of this frame
++ * @memory: the method, in which the actual video data is passed
++ * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
++ * offset from the start of the device memory for this plane,
++ * (or a "cookie" that should be passed to mmap() as offset)
++ * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
++ * a userspace pointer pointing to this buffer
++ * @planes: for multiplanar buffers; userspace pointer to the array of plane
++ * info structs for this buffer
++ * @length: size in bytes of the buffer (NOT its payload) for single-plane
++ * buffers (when type != *_MPLANE); number of elements in the
++ * planes array for multi-plane buffers
++ * @input: input number from which the video data has has been captured
++ *
++ * Contains data exchanged by application and driver using one of the Streaming
++ * I/O methods.
++ */
++struct v4l2_buffer {
++ __u32 index;
++ enum v4l2_buf_type type;
++ __u32 bytesused;
++ __u32 flags;
++ enum v4l2_field field;
++ struct timeval timestamp;
++ struct v4l2_timecode timecode;
++ __u32 sequence;
++
++ /* memory location */
++ enum v4l2_memory memory;
++ union {
++ __u32 offset;
++ unsigned long userptr;
++ struct v4l2_plane *planes;
++ } m;
++ __u32 length;
++ __u32 input;
++ __u32 reserved;
++};
++
++/* Flags for 'flags' field */
++#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
++#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
++#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
++#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
++#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
++#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
++/* Buffer is ready, but the data contained within is corrupted. */
++#define V4L2_BUF_FLAG_ERROR 0x0040
++#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
++#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
++
++/*
++ * O V E R L A Y P R E V I E W
++ */
++struct v4l2_framebuffer {
++ __u32 capability;
++ __u32 flags;
++/* FIXME: in theory we should pass something like PCI device + memory
++ * region + offset instead of some physical address */
++ void *base;
++ struct v4l2_pix_format fmt;
++};
++/* Flags for the 'capability' field. Read only */
++#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
++#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
++#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
++#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
++#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
++#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
++#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
++#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080
++/* Flags for the 'flags' field. */
++#define V4L2_FBUF_FLAG_PRIMARY 0x0001
++#define V4L2_FBUF_FLAG_OVERLAY 0x0002
++#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
++#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
++#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
++#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
++#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
++
++struct v4l2_clip {
++ struct v4l2_rect c;
++ struct v4l2_clip *next;
++};
++
++struct v4l2_window {
++ struct v4l2_rect w;
++ enum v4l2_field field;
++ __u32 chromakey;
++ struct v4l2_clip *clips;
++ __u32 clipcount;
++ void *bitmap;
++ __u8 global_alpha;
++};
++
++/*
++ * C A P T U R E P A R A M E T E R S
++ */
++struct v4l2_captureparm {
++ __u32 capability; /* Supported modes */
++ __u32 capturemode; /* Current mode */
++ struct v4l2_fract timeperframe; /* Time per frame in .1us units */
++ __u32 extendedmode; /* Driver-specific extensions */
++ __u32 readbuffers; /* # of buffers for read */
++ __u32 reserved[4];
++};
++
++/* Flags for 'capability' and 'capturemode' fields */
++#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
++#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
++
++struct v4l2_outputparm {
++ __u32 capability; /* Supported modes */
++ __u32 outputmode; /* Current mode */
++ struct v4l2_fract timeperframe; /* Time per frame in seconds */
++ __u32 extendedmode; /* Driver-specific extensions */
++ __u32 writebuffers; /* # of buffers for write */
++ __u32 reserved[4];
++};
++
++/*
++ * I N P U T I M A G E C R O P P I N G
++ */
++struct v4l2_cropcap {
++ enum v4l2_buf_type type;
++ struct v4l2_rect bounds;
++ struct v4l2_rect defrect;
++ struct v4l2_fract pixelaspect;
++};
++
++struct v4l2_crop {
++ enum v4l2_buf_type type;
++ struct v4l2_rect c;
++};
++
++/*
++ * A N A L O G V I D E O S T A N D A R D
++ */
++
++typedef __u64 v4l2_std_id;
++
++/* one bit for each */
++#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
++#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
++#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
++#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
++#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
++#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
++#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
++#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
++
++#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
++#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
++#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
++#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
++
++#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
++#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
++#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
++#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
++
++#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
++#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
++#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
++#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
++#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
++#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
++#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
++#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
++
++/* ATSC/HDTV */
++#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
++#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
++
++/* FIXME:
++ Although std_id is 64 bits, there is an issue on PPC32 architecture that
++ makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
++ this value to 32 bits.
++ As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
++ it should work fine. However, if needed to add more than two standards,
++ v4l2-common.c should be fixed.
++ */
++
++/* some merged standards */
++#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
++#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
++#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
++#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
++
++/* some common needed stuff */
++#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
++ V4L2_STD_PAL_B1 |\
++ V4L2_STD_PAL_G)
++#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
++ V4L2_STD_PAL_D1 |\
++ V4L2_STD_PAL_K)
++#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
++ V4L2_STD_PAL_DK |\
++ V4L2_STD_PAL_H |\
++ V4L2_STD_PAL_I)
++#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
++ V4L2_STD_NTSC_M_JP |\
++ V4L2_STD_NTSC_M_KR)
++#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
++ V4L2_STD_SECAM_K |\
++ V4L2_STD_SECAM_K1)
++#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
++ V4L2_STD_SECAM_G |\
++ V4L2_STD_SECAM_H |\
++ V4L2_STD_SECAM_DK |\
++ V4L2_STD_SECAM_L |\
++ V4L2_STD_SECAM_LC)
++
++#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
++ V4L2_STD_PAL_60 |\
++ V4L2_STD_NTSC |\
++ V4L2_STD_NTSC_443)
++#define V4L2_STD_625_50 (V4L2_STD_PAL |\
++ V4L2_STD_PAL_N |\
++ V4L2_STD_PAL_Nc |\
++ V4L2_STD_SECAM)
++#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
++ V4L2_STD_ATSC_16_VSB)
++
++#define V4L2_STD_UNKNOWN 0
++#define V4L2_STD_ALL (V4L2_STD_525_60 |\
++ V4L2_STD_625_50)
++
++struct v4l2_standard {
++ __u32 index;
++ v4l2_std_id id;
++ __u8 name[24];
++ struct v4l2_fract frameperiod; /* Frames, not fields */
++ __u32 framelines;
++ __u32 reserved[4];
++};
++
++/*
++ * V I D E O T I M I N G S D V P R E S E T
++ */
++struct v4l2_dv_preset {
++ __u32 preset;
++ __u32 reserved[4];
++};
++
++/*
++ * D V P R E S E T S E N U M E R A T I O N
++ */
++struct v4l2_dv_enum_preset {
++ __u32 index;
++ __u32 preset;
++ __u8 name[32]; /* Name of the preset timing */
++ __u32 width;
++ __u32 height;
++ __u32 reserved[4];
++};
++
++/*
++ * D V P R E S E T V A L U E S
++ */
++#define V4L2_DV_INVALID 0
++#define V4L2_DV_480P59_94 1 /* BT.1362 */
++#define V4L2_DV_576P50 2 /* BT.1362 */
++#define V4L2_DV_720P24 3 /* SMPTE 296M */
++#define V4L2_DV_720P25 4 /* SMPTE 296M */
++#define V4L2_DV_720P30 5 /* SMPTE 296M */
++#define V4L2_DV_720P50 6 /* SMPTE 296M */
++#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
++#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
++#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
++#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
++#define V4L2_DV_1080I25 11 /* BT.1120 */
++#define V4L2_DV_1080I50 12 /* SMPTE 296M */
++#define V4L2_DV_1080I60 13 /* SMPTE 296M */
++#define V4L2_DV_1080P24 14 /* SMPTE 296M */
++#define V4L2_DV_1080P25 15 /* SMPTE 296M */
++#define V4L2_DV_1080P30 16 /* SMPTE 296M */
++#define V4L2_DV_1080P50 17 /* BT.1120 */
++#define V4L2_DV_1080P60 18 /* BT.1120 */
++
++/*
++ * D V B T T I M I N G S
++ */
++
++/* BT.656/BT.1120 timing data */
++struct v4l2_bt_timings {
++ __u32 width; /* width in pixels */
++ __u32 height; /* height in lines */
++ __u32 interlaced; /* Interlaced or progressive */
++ __u32 polarities; /* Positive or negative polarity */
++ __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
++ __u32 hfrontporch; /* Horizpontal front porch in pixels */
++ __u32 hsync; /* Horizontal Sync length in pixels */
++ __u32 hbackporch; /* Horizontal back porch in pixels */
++ __u32 vfrontporch; /* Vertical front porch in pixels */
++ __u32 vsync; /* Vertical Sync length in lines */
++ __u32 vbackporch; /* Vertical back porch in lines */
++ __u32 il_vfrontporch; /* Vertical front porch for bottom field of
++ * interlaced field formats
++ */
++ __u32 il_vsync; /* Vertical sync length for bottom field of
++ * interlaced field formats
++ */
++ __u32 il_vbackporch; /* Vertical back porch for bottom field of
++ * interlaced field formats
++ */
++ __u32 reserved[16];
++} __attribute__ ((packed));
++
++/* Interlaced or progressive format */
++#define V4L2_DV_PROGRESSIVE 0
++#define V4L2_DV_INTERLACED 1
++
++/* Polarities. If bit is not set, it is assumed to be negative polarity */
++#define V4L2_DV_VSYNC_POS_POL 0x00000001
++#define V4L2_DV_HSYNC_POS_POL 0x00000002
++
++
++/* DV timings */
++struct v4l2_dv_timings {
++ __u32 type;
++ union {
++ struct v4l2_bt_timings bt;
++ __u32 reserved[32];
++ };
++} __attribute__ ((packed));
++
++/* Values for the type field */
++#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
++
++/*
++ * V I D E O I N P U T S
++ */
++struct v4l2_input {
++ __u32 index; /* Which input */
++ __u8 name[32]; /* Label */
++ __u32 type; /* Type of input */
++ __u32 audioset; /* Associated audios (bitfield) */
++ __u32 tuner; /* Associated tuner */
++ v4l2_std_id std;
++ __u32 status;
++ __u32 capabilities;
++ __u32 reserved[3];
++};
++
++/* Values for the 'type' field */
++#define V4L2_INPUT_TYPE_TUNER 1
++#define V4L2_INPUT_TYPE_CAMERA 2
++
++/* field 'status' - general */
++#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
++#define V4L2_IN_ST_NO_SIGNAL 0x00000002
++#define V4L2_IN_ST_NO_COLOR 0x00000004
++
++/* field 'status' - sensor orientation */
++/* If sensor is mounted upside down set both bits */
++#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
++#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
++
++/* field 'status' - analog */
++#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
++#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
++
++/* field 'status' - digital */
++#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
++#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
++#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
++
++/* field 'status' - VCR and set-top box */
++#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
++#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
++#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
++
++/* capabilities flags */
++#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
++#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
++#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
++
++/*
++ * V I D E O O U T P U T S
++ */
++struct v4l2_output {
++ __u32 index; /* Which output */
++ __u8 name[32]; /* Label */
++ __u32 type; /* Type of output */
++ __u32 audioset; /* Associated audios (bitfield) */
++ __u32 modulator; /* Associated modulator */
++ v4l2_std_id std;
++ __u32 capabilities;
++ __u32 reserved[3];
++};
++/* Values for the 'type' field */
++#define V4L2_OUTPUT_TYPE_MODULATOR 1
++#define V4L2_OUTPUT_TYPE_ANALOG 2
++#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
++
++/* capabilities flags */
++#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
++#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
++#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
++
++/*
++ * C O N T R O L S
++ */
++struct v4l2_control {
++ __u32 id;
++ __s32 value;
++};
++
++struct v4l2_ext_control {
++ __u32 id;
++ __u32 size;
++ __u32 reserved2[1];
++ union {
++ __s32 value;
++ __s64 value64;
++ char *string;
++ };
++} __attribute__ ((packed));
++
++struct v4l2_ext_controls {
++ __u32 ctrl_class;
++ __u32 count;
++ __u32 error_idx;
++ __u32 reserved[2];
++ struct v4l2_ext_control *controls;
++};
++
++/* Values for ctrl_class field */
++#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
++#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
++#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
++#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
++
++#define V4L2_CTRL_ID_MASK (0x0fffffff)
++#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
++#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
++
++enum v4l2_ctrl_type {
++ V4L2_CTRL_TYPE_INTEGER = 1,
++ V4L2_CTRL_TYPE_BOOLEAN = 2,
++ V4L2_CTRL_TYPE_MENU = 3,
++ V4L2_CTRL_TYPE_BUTTON = 4,
++ V4L2_CTRL_TYPE_INTEGER64 = 5,
++ V4L2_CTRL_TYPE_CTRL_CLASS = 6,
++ V4L2_CTRL_TYPE_STRING = 7,
++};
++
++/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
++struct v4l2_queryctrl {
++ __u32 id;
++ enum v4l2_ctrl_type type;
++ __u8 name[32]; /* Whatever */
++ __s32 minimum; /* Note signedness */
++ __s32 maximum;
++ __s32 step;
++ __s32 default_value;
++ __u32 flags;
++ __u32 reserved[2];
++};
++
++/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
++struct v4l2_querymenu {
++ __u32 id;
++ __u32 index;
++ __u8 name[32]; /* Whatever */
++ __u32 reserved;
++};
++
++/* Control flags */
++#define V4L2_CTRL_FLAG_DISABLED 0x0001
++#define V4L2_CTRL_FLAG_GRABBED 0x0002
++#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
++#define V4L2_CTRL_FLAG_UPDATE 0x0008
++#define V4L2_CTRL_FLAG_INACTIVE 0x0010
++#define V4L2_CTRL_FLAG_SLIDER 0x0020
++#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
++
++/* Query flag, to be ORed with the control ID */
++#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
++
++/* User-class control IDs defined by V4L2 */
++#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
++#define V4L2_CID_USER_BASE V4L2_CID_BASE
++/* IDs reserved for driver specific controls */
++#define V4L2_CID_PRIVATE_BASE 0x08000000
++
++#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
++#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
++#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
++#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
++#define V4L2_CID_HUE (V4L2_CID_BASE+3)
++#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
++#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
++#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
++#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
++#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
++#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
++#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
++#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
++#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
++#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
++#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
++#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
++#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
++#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
++#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
++#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
++#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
++#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
++
++/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
++#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
++#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
++
++#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
++enum v4l2_power_line_frequency {
++ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
++ V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
++ V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
++};
++#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
++#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
++#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
++#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
++#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
++#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
++#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
++enum v4l2_colorfx {
++ V4L2_COLORFX_NONE = 0,
++ V4L2_COLORFX_BW = 1,
++ V4L2_COLORFX_SEPIA = 2,
++ V4L2_COLORFX_NEGATIVE = 3,
++ V4L2_COLORFX_EMBOSS = 4,
++ V4L2_COLORFX_SKETCH = 5,
++ V4L2_COLORFX_SKY_BLUE = 6,
++ V4L2_COLORFX_GRASS_GREEN = 7,
++ V4L2_COLORFX_SKIN_WHITEN = 8,
++ V4L2_COLORFX_VIVID = 9,
++};
++#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
++#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
++
++#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
++#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
++
++#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
++
++#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
++#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
++
++/* last CID + 1 */
++#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39)
++
++/* MPEG-class control IDs defined by V4L2 */
++#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
++#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
++
++/* MPEG streams */
++#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
++enum v4l2_mpeg_stream_type {
++ V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
++ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
++};
++#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
++#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
++#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
++#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
++#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
++#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
++#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
++enum v4l2_mpeg_stream_vbi_fmt {
++ V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
++ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
++};
++
++/* MPEG audio */
++#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
++enum v4l2_mpeg_audio_sampling_freq {
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
++ V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
++};
++#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
++enum v4l2_mpeg_audio_encoding {
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
++ V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
++ V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
++ V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
++};
++#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
++enum v4l2_mpeg_audio_l1_bitrate {
++ V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
++ V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
++ V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
++ V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
++ V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
++ V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
++ V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
++ V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
++ V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
++ V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
++ V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
++ V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
++ V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
++enum v4l2_mpeg_audio_l2_bitrate {
++ V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
++ V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
++ V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
++ V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
++ V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
++ V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
++ V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
++ V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
++ V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
++ V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
++ V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
++ V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
++ V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
++enum v4l2_mpeg_audio_l3_bitrate {
++ V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
++ V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
++ V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
++ V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
++ V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
++ V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
++ V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
++ V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
++ V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
++ V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
++ V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
++ V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
++ V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
++};
++#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
++enum v4l2_mpeg_audio_mode {
++ V4L2_MPEG_AUDIO_MODE_STEREO = 0,
++ V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
++ V4L2_MPEG_AUDIO_MODE_DUAL = 2,
++ V4L2_MPEG_AUDIO_MODE_MONO = 3,
++};
++#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
++enum v4l2_mpeg_audio_mode_extension {
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
++ V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
++};
++#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
++enum v4l2_mpeg_audio_emphasis {
++ V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
++ V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
++ V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
++};
++#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
++enum v4l2_mpeg_audio_crc {
++ V4L2_MPEG_AUDIO_CRC_NONE = 0,
++ V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
++};
++#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
++#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
++#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
++enum v4l2_mpeg_audio_ac3_bitrate {
++ V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
++ V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
++};
++
++/* MPEG video */
++#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
++enum v4l2_mpeg_video_encoding {
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
++ V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
++};
++#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
++enum v4l2_mpeg_video_aspect {
++ V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
++ V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
++ V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
++ V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
++};
++#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
++#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
++#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
++#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
++#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
++enum v4l2_mpeg_video_bitrate_mode {
++ V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
++ V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
++};
++#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
++#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
++#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
++#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
++#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
++
++/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
++#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
++enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
++ V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
++ V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
++enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
++ V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
++enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
++enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
++ V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
++ V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
++enum v4l2_mpeg_cx2341x_video_median_filter_type {
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
++ V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
++};
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
++#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
++#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
++
++/* Camera class control IDs */
++#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
++#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
++
++#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
++enum v4l2_exposure_auto_type {
++ V4L2_EXPOSURE_AUTO = 0,
++ V4L2_EXPOSURE_MANUAL = 1,
++ V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
++ V4L2_EXPOSURE_APERTURE_PRIORITY = 3
++};
++#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
++#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
++
++#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
++#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
++#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
++#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
++
++#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
++#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
++
++#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
++#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
++#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
++
++#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
++#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
++#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
++
++#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
++
++#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
++#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
++
++/* FM Modulator class control IDs */
++#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
++#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
++
++#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
++#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
++#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
++#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
++#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
++
++#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
++#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
++#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
++
++#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
++#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
++#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
++#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
++#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
++
++#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
++#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
++#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
++
++#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
++enum v4l2_preemphasis {
++ V4L2_PREEMPHASIS_DISABLED = 0,
++ V4L2_PREEMPHASIS_50_uS = 1,
++ V4L2_PREEMPHASIS_75_uS = 2,
++};
++#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
++#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
++
++/*
++ * T U N I N G
++ */
++struct v4l2_tuner {
++ __u32 index;
++ __u8 name[32];
++ enum v4l2_tuner_type type;
++ __u32 capability;
++ __u32 rangelow;
++ __u32 rangehigh;
++ __u32 rxsubchans;
++ __u32 audmode;
++ __s32 signal;
++ __s32 afc;
++ __u32 reserved[4];
++};
++
++struct v4l2_modulator {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 rangelow;
++ __u32 rangehigh;
++ __u32 txsubchans;
++ __u32 reserved[4];
++};
++
++/* Flags for the 'capability' field */
++#define V4L2_TUNER_CAP_LOW 0x0001
++#define V4L2_TUNER_CAP_NORM 0x0002
++#define V4L2_TUNER_CAP_STEREO 0x0010
++#define V4L2_TUNER_CAP_LANG2 0x0020
++#define V4L2_TUNER_CAP_SAP 0x0020
++#define V4L2_TUNER_CAP_LANG1 0x0040
++#define V4L2_TUNER_CAP_RDS 0x0080
++#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100
++#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
++
++/* Flags for the 'rxsubchans' field */
++#define V4L2_TUNER_SUB_MONO 0x0001
++#define V4L2_TUNER_SUB_STEREO 0x0002
++#define V4L2_TUNER_SUB_LANG2 0x0004
++#define V4L2_TUNER_SUB_SAP 0x0004
++#define V4L2_TUNER_SUB_LANG1 0x0008
++#define V4L2_TUNER_SUB_RDS 0x0010
++
++/* Values for the 'audmode' field */
++#define V4L2_TUNER_MODE_MONO 0x0000
++#define V4L2_TUNER_MODE_STEREO 0x0001
++#define V4L2_TUNER_MODE_LANG2 0x0002
++#define V4L2_TUNER_MODE_SAP 0x0002
++#define V4L2_TUNER_MODE_LANG1 0x0003
++#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
++
++struct v4l2_frequency {
++ __u32 tuner;
++ enum v4l2_tuner_type type;
++ __u32 frequency;
++ __u32 reserved[8];
++};
++
++struct v4l2_hw_freq_seek {
++ __u32 tuner;
++ enum v4l2_tuner_type type;
++ __u32 seek_upward;
++ __u32 wrap_around;
++ __u32 spacing;
++ __u32 reserved[7];
++};
++
++/*
++ * R D S
++ */
++
++struct v4l2_rds_data {
++ __u8 lsb;
++ __u8 msb;
++ __u8 block;
++} __attribute__ ((packed));
++
++#define V4L2_RDS_BLOCK_MSK 0x7
++#define V4L2_RDS_BLOCK_A 0
++#define V4L2_RDS_BLOCK_B 1
++#define V4L2_RDS_BLOCK_C 2
++#define V4L2_RDS_BLOCK_D 3
++#define V4L2_RDS_BLOCK_C_ALT 4
++#define V4L2_RDS_BLOCK_INVALID 7
++
++#define V4L2_RDS_BLOCK_CORRECTED 0x40
++#define V4L2_RDS_BLOCK_ERROR 0x80
++
++/*
++ * A U D I O
++ */
++struct v4l2_audio {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 mode;
++ __u32 reserved[2];
++};
++
++/* Flags for the 'capability' field */
++#define V4L2_AUDCAP_STEREO 0x00001
++#define V4L2_AUDCAP_AVL 0x00002
++
++/* Flags for the 'mode' field */
++#define V4L2_AUDMODE_AVL 0x00001
++
++struct v4l2_audioout {
++ __u32 index;
++ __u8 name[32];
++ __u32 capability;
++ __u32 mode;
++ __u32 reserved[2];
++};
++
++/*
++ * M P E G S E R V I C E S
++ *
++ * NOTE: EXPERIMENTAL API
++ */
++#if 1
++#define V4L2_ENC_IDX_FRAME_I (0)
++#define V4L2_ENC_IDX_FRAME_P (1)
++#define V4L2_ENC_IDX_FRAME_B (2)
++#define V4L2_ENC_IDX_FRAME_MASK (0xf)
++
++struct v4l2_enc_idx_entry {
++ __u64 offset;
++ __u64 pts;
++ __u32 length;
++ __u32 flags;
++ __u32 reserved[2];
++};
++
++#define V4L2_ENC_IDX_ENTRIES (64)
++struct v4l2_enc_idx {
++ __u32 entries;
++ __u32 entries_cap;
++ __u32 reserved[4];
++ struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
++};
++
++
++#define V4L2_ENC_CMD_START (0)
++#define V4L2_ENC_CMD_STOP (1)
++#define V4L2_ENC_CMD_PAUSE (2)
++#define V4L2_ENC_CMD_RESUME (3)
++
++/* Flags for V4L2_ENC_CMD_STOP */
++#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
++
++struct v4l2_encoder_cmd {
++ __u32 cmd;
++ __u32 flags;
++ union {
++ struct {
++ __u32 data[8];
++ } raw;
++ };
++};
++
++#endif
++
++
++/*
++ * D A T A S E R V I C E S ( V B I )
++ *
++ * Data services API by Michael Schimek
++ */
++
++/* Raw VBI */
++struct v4l2_vbi_format {
++ __u32 sampling_rate; /* in 1 Hz */
++ __u32 offset;
++ __u32 samples_per_line;
++ __u32 sample_format; /* V4L2_PIX_FMT_* */
++ __s32 start[2];
++ __u32 count[2];
++ __u32 flags; /* V4L2_VBI_* */
++ __u32 reserved[2]; /* must be zero */
++};
++
++/* VBI flags */
++#define V4L2_VBI_UNSYNC (1 << 0)
++#define V4L2_VBI_INTERLACED (1 << 1)
++
++/* Sliced VBI
++ *
++ * This implements is a proposal V4L2 API to allow SLICED VBI
++ * required for some hardware encoders. It should change without
++ * notice in the definitive implementation.
++ */
++
++struct v4l2_sliced_vbi_format {
++ __u16 service_set;
++ /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
++ service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
++ (equals frame lines 313-336 for 625 line video
++ standards, 263-286 for 525 line standards) */
++ __u16 service_lines[2][24];
++ __u32 io_size;
++ __u32 reserved[2]; /* must be zero */
++};
++
++/* Teletext World System Teletext
++ (WST), defined on ITU-R BT.653-2 */
++#define V4L2_SLICED_TELETEXT_B (0x0001)
++/* Video Program System, defined on ETS 300 231*/
++#define V4L2_SLICED_VPS (0x0400)
++/* Closed Caption, defined on EIA-608 */
++#define V4L2_SLICED_CAPTION_525 (0x1000)
++/* Wide Screen System, defined on ITU-R BT1119.1 */
++#define V4L2_SLICED_WSS_625 (0x4000)
++
++#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
++#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
++
++struct v4l2_sliced_vbi_cap {
++ __u16 service_set;
++ /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
++ service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
++ (equals frame lines 313-336 for 625 line video
++ standards, 263-286 for 525 line standards) */
++ __u16 service_lines[2][24];
++ enum v4l2_buf_type type;
++ __u32 reserved[3]; /* must be 0 */
++};
++
++struct v4l2_sliced_vbi_data {
++ __u32 id;
++ __u32 field; /* 0: first field, 1: second field */
++ __u32 line; /* 1-23 */
++ __u32 reserved; /* must be 0 */
++ __u8 data[48];
++};
++
++/*
++ * Sliced VBI data inserted into MPEG Streams
++ */
++
++/*
++ * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
++ *
++ * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
++ * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
++ * data
++ *
++ * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
++ * definitions are not included here. See the MPEG-2 specifications for details
++ * on these headers.
++ */
++
++/* Line type IDs */
++#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
++#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
++#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
++#define V4L2_MPEG_VBI_IVTV_VPS (7)
++
++struct v4l2_mpeg_vbi_itv0_line {
++ __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
++ __u8 data[42]; /* Sliced VBI data for the line */
++} __attribute__ ((packed));
++
++struct v4l2_mpeg_vbi_itv0 {
++ __le32 linemask[2]; /* Bitmasks of VBI service lines present */
++ struct v4l2_mpeg_vbi_itv0_line line[35];
++} __attribute__ ((packed));
++
++struct v4l2_mpeg_vbi_ITV0 {
++ struct v4l2_mpeg_vbi_itv0_line line[36];
++} __attribute__ ((packed));
++
++#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
++#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
++
++struct v4l2_mpeg_vbi_fmt_ivtv {
++ __u8 magic[4];
++ union {
++ struct v4l2_mpeg_vbi_itv0 itv0;
++ struct v4l2_mpeg_vbi_ITV0 ITV0;
++ };
++} __attribute__ ((packed));
++
++/*
++ * A G G R E G A T E S T R U C T U R E S
++ */
++
++/**
++ * struct v4l2_plane_pix_format - additional, per-plane format definition
++ * @sizeimage: maximum size in bytes required for data, for which
++ * this plane will be used
++ * @bytesperline: distance in bytes between the leftmost pixels in two
++ * adjacent lines
++ */
++struct v4l2_plane_pix_format {
++ __u32 sizeimage;
++ __u16 bytesperline;
++ __u16 reserved[7];
++} __attribute__ ((packed));
++
++/**
++ * struct v4l2_pix_format_mplane - multiplanar format definition
++ * @width: image width in pixels
++ * @height: image height in pixels
++ * @pixelformat: little endian four character code (fourcc)
++ * @field: field order (for interlaced video)
++ * @colorspace: supplemental to pixelformat
++ * @plane_fmt: per-plane information
++ * @num_planes: number of planes for this format
++ */
++struct v4l2_pix_format_mplane {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ enum v4l2_field field;
++ enum v4l2_colorspace colorspace;
++
++ struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
++ __u8 num_planes;
++ __u8 reserved[11];
++} __attribute__ ((packed));
++
++/**
++ * struct v4l2_format - stream data format
++ * @type: type of the data stream
++ * @pix: definition of an image format
++ * @pix_mp: definition of a multiplanar image format
++ * @win: definition of an overlaid image
++ * @vbi: raw VBI capture or output parameters
++ * @sliced: sliced VBI capture or output parameters
++ * @raw_data: placeholder for future extensions and custom formats
++ */
++struct v4l2_format {
++ enum v4l2_buf_type type;
++ union {
++ struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
++ struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
++ struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
++ struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
++ struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
++ __u8 raw_data[200]; /* user-defined */
++ } fmt;
++};
++
++/* Stream type-dependent parameters
++ */
++struct v4l2_streamparm {
++ enum v4l2_buf_type type;
++ union {
++ struct v4l2_captureparm capture;
++ struct v4l2_outputparm output;
++ __u8 raw_data[200]; /* user-defined */
++ } parm;
++};
++
++/*
++ * E V E N T S
++ */
++
++#define V4L2_EVENT_ALL 0
++#define V4L2_EVENT_VSYNC 1
++#define V4L2_EVENT_EOS 2
++#define V4L2_EVENT_PRIVATE_START 0x08000000
++
++/* Payload for V4L2_EVENT_VSYNC */
++struct v4l2_event_vsync {
++ /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
++ __u8 field;
++} __attribute__ ((packed));
++
++struct v4l2_event {
++ __u32 type;
++ union {
++ struct v4l2_event_vsync vsync;
++ __u8 data[64];
++ } u;
++ __u32 pending;
++ __u32 sequence;
++ struct timespec timestamp;
++ __u32 reserved[9];
++};
++
++struct v4l2_event_subscription {
++ __u32 type;
++ __u32 reserved[7];
++};
++
++/*
++ * A D V A N C E D D E B U G G I N G
++ *
++ * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
++ * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
++ */
++
++/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
++
++#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
++#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
++#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
++#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
++
++struct v4l2_dbg_match {
++ __u32 type; /* Match type */
++ union { /* Match this chip, meaning determined by type */
++ __u32 addr;
++ char name[32];
++ };
++} __attribute__ ((packed));
++
++struct v4l2_dbg_register {
++ struct v4l2_dbg_match match;
++ __u32 size; /* register size in bytes */
++ __u64 reg;
++ __u64 val;
++} __attribute__ ((packed));
++
++/* VIDIOC_DBG_G_CHIP_IDENT */
++struct v4l2_dbg_chip_ident {
++ struct v4l2_dbg_match match;
++ __u32 ident; /* chip identifier as specified in */
++ __u32 revision; /* chip revision, chip specific */
++} __attribute__ ((packed));
++
++/*
++ * I O C T L C O D E S F O R V I D E O D E V I C E S
++ *
++ */
++#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
++#define VIDIOC_RESERVED _IO('V', 1)
++#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
++#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
++#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
++#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
++#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
++#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
++#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
++#define VIDIOC_OVERLAY _IOW('V', 14, int)
++#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
++#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
++#define VIDIOC_STREAMON _IOW('V', 18, int)
++#define VIDIOC_STREAMOFF _IOW('V', 19, int)
++#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
++#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
++#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
++#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
++#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
++#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
++#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
++#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
++#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
++#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
++#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
++#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
++#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
++#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
++#define VIDIOC_G_INPUT _IOR('V', 38, int)
++#define VIDIOC_S_INPUT _IOWR('V', 39, int)
++#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
++#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
++#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
++#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
++#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
++#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
++#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
++#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
++#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
++#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
++#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
++#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
++#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
++#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
++#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
++#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
++#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
++#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
++#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority)
++#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority)
++#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
++#define VIDIOC_LOG_STATUS _IO('V', 70)
++#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
++#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
++#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
++#if 1
++#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
++#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
++#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
++#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
++#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
++#endif
++
++#if 1
++/* Experimental, meant for debugging, testing and internal use.
++ Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
++ You must be root to use these ioctls. Never use these in applications! */
++#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
++#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
++
++/* Experimental, meant for debugging, testing and internal use.
++ Never use this ioctl in applications! */
++#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
++#endif
++
++#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
++#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
++#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
++#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
++#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
++#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
++#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
++#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
++#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
++#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
++
++#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
++
++#endif /* __LINUX_VIDEODEV2_H */
diff --git a/x11/driver/xorg-video-v4l/pspec.xml b/x11/driver/xorg-video-v4l/pspec.xml
new file mode 100644
index 0000000000..96e180079b
--- /dev/null
+++ b/x11/driver/xorg-video-v4l/pspec.xml
@@ -0,0 +1,103 @@
+
+
+
+
+ xorg-video-v4l
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org v4l video driver
+ v4l is an Xorg driver for video4linux cards. It provides a Xvideo extension port for video overlay.
+ mirrors://xorg/individual/driver/xf86-video-v4l-0.2.0.tar.bz2
+
+ xorg-server-devel
+
+
+
+ xorg-x11-drv-v4l-support_v4l2_only_drivers.patch
+ xf86-video-v4l-0.2.0-build-fix.patch
+
+
+
+
+ xorg-video-v4l
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-15
+ 0.2.0
+ Release bump.
+ Osman Erkan
+ osman.erkan@pisilinux.org
+
+
+ 2015-01-23
+ 0.2.0
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.2.0
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.2.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 0.2.0
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 0.2.0
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 0.2.0
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.2.0
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-05-31
+ 0.2.0
+ First release
+ Erdem Artan
+ admins@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-v4l/translations.xml b/x11/driver/xorg-video-v4l/translations.xml
new file mode 100644
index 0000000000..2519b15d46
--- /dev/null
+++ b/x11/driver/xorg-video-v4l/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-v4l
+ X.Org v4l ekran kartı sürücüsü
+ v4l, video4linux kartları için Xorg sürücüsü içerir. Video yerpaylaşımı (overlay) için bir Xvideo kapısı sağlar.
+
+
diff --git a/x11/driver/xorg-video-vesa/actions.py b/x11/driver/xorg-video-vesa/actions.py
new file mode 100644
index 0000000000..de35af820d
--- /dev/null
+++ b/x11/driver/xorg-video-vesa/actions.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import get
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+WorkDir = "xf86-video-vesa-%s" % get.srcVERSION()
+
+def setup():
+ autotools.configure()
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
\ No newline at end of file
diff --git a/x11/driver/xorg-video-vesa/pspec.xml b/x11/driver/xorg-video-vesa/pspec.xml
new file mode 100644
index 0000000000..c003d9e866
--- /dev/null
+++ b/x11/driver/xorg-video-vesa/pspec.xml
@@ -0,0 +1,105 @@
+
+
+
+
+ xorg-video-vesa
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org vesa video driver
+ xorg-input-vesa contains the X.Org driver for Generic VESA cards.
+ mirrors://xorg/individual/driver/xf86-video-vesa-2.3.3.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+ xorg-video-vesa
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 2.3.3
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 2.3.3
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 2.3.3
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 2.3.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 2.3.2
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 2.3.2
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 2.3.2
+ Rebuild
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 2.3.2
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 2.3.2
+ Fix build with xorg-server-1.14.x
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-11
+ 2.3.2
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-vesa/translations.xml b/x11/driver/xorg-video-vesa/translations.xml
new file mode 100644
index 0000000000..235c30a790
--- /dev/null
+++ b/x11/driver/xorg-video-vesa/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-vesa
+ X.Org vesa ekran kartı sürücüsü
+ xorg-input-vesa, VESA uyumlu ekran kartları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-vmware/actions.py b/x11/driver/xorg-video-vmware/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-vmware/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-vmware/files/xatracker-v2-fixes.patch b/x11/driver/xorg-video-vmware/files/xatracker-v2-fixes.patch
new file mode 100644
index 0000000000..9b8ed54a59
--- /dev/null
+++ b/x11/driver/xorg-video-vmware/files/xatracker-v2-fixes.patch
@@ -0,0 +1,1583 @@
+From 0945bea5fc32eacb7bf42639efbd45dcd43e7ab5 Mon Sep 17 00:00:00 2001
+From: Rob Clark
+Date: Mon, 10 Jun 2013 13:31:31 -0400
+Subject: [PATCH 01/11] vmwgfx: update for XA API changes
+
+Signed-off-by: Rob Clark
+Signed-off-by: Jakob Bornecrantz
+Reviewed-by: Jakob Bornecrantz
+Tested-by: Jakob Bornecrantz
+---
+ configure.ac | 2 +-
+ vmwgfx/vmwgfx_dri2.c | 5 +++--
+ vmwgfx/vmwgfx_driver.c | 3 ++-
+ vmwgfx/vmwgfx_saa.c | 20 ++++++++++++++------
+ vmwgfx/vmwgfx_tex_video.c | 5 +++--
+ 5 files changed, 23 insertions(+), 12 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0631bcc..dccfb27 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -118,7 +118,7 @@ if test x$BUILD_VMWGFX = xyes; then
+ PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no])
+ fi
+ if test x$BUILD_VMWGFX = xyes; then
+- PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],[],[BUILD_VMWGFX=no])
++ PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no])
+ fi
+
+ DRIVER_NAME=vmware
+diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c
+index 7de0772..2f007f0 100644
+--- a/vmwgfx/vmwgfx_dri2.c
++++ b/vmwgfx/vmwgfx_dri2.c
+@@ -201,7 +201,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
+ }
+
+ private->srf = srf;
+- if (xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0)
++ if (xa_surface_handle(srf, xa_handle_type_shared,
++ &buffer->name, &buffer->pitch) != 0)
+ return FALSE;
+
+ buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8;
+@@ -222,7 +223,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap);
+
+ if (--private->refcount == 0 && srf) {
+- xa_surface_destroy(srf);
++ xa_surface_unref(srf);
+ }
+
+ /*
+diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
+index 7863ba2..3002285 100644
+--- a/vmwgfx/vmwgfx_driver.c
++++ b/vmwgfx/vmwgfx_driver.c
+@@ -617,7 +617,8 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd,
+ return FALSE;
+ }
+
+- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) {
++ if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
++ &handle, &dummy) != 0) {
+ LogMessage(X_ERROR, "Could not get present surface handle.\n");
+ return FALSE;
+ }
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index 63df3a1..ed3c1ee 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -140,7 +140,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix)
+ vpix->malloc = NULL;
+ }
+ if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) {
+- xa_surface_destroy(vpix->hw);
++ xa_surface_unref(vpix->hw);
+ vpix->hw = NULL;
+ }
+ if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) {
+@@ -286,7 +286,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
+ if (vpix->gmr && vsaa->can_optimize_dma) {
+ uint32_t handle, dummy;
+
+- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0)
++ if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
++ &handle, &dummy) != 0)
+ goto out_err;
+ if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle,
+ to_hw) != 0)
+@@ -305,6 +306,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
+ (int) to_hw,
+ (struct xa_box *) REGION_RECTS(reg),
+ REGION_NUM_RECTS(reg));
++ if (to_hw)
++ xa_context_flush(vsaa->xa_ctx);
+ if (vpix->gmr)
+ vmwgfx_dmabuf_unmap(vpix->gmr);
+ if (ret)
+@@ -441,7 +444,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
+ &spix->dirty_hw))
+ return FALSE;
+
+- xa_surface_destroy(vpix->hw);
++ xa_surface_unref(vpix->hw);
+ vpix->hw = NULL;
+
+ /*
+@@ -683,7 +686,8 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa,
+
+ (void) pScreen;
+ if (src_vpix == dst_vpix || !src_vpix->hw ||
+- xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0)
++ xa_surface_handle(src_vpix->hw, xa_handle_type_shared,
++ &vsaa->src_handle, &dummy) != 0)
+ return FALSE;
+
+ REGION_NULL(pScreen, &vsaa->present_region);
+@@ -784,7 +788,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa,
+ return TRUE;
+
+ out_no_damage:
+- xa_surface_destroy(hw);
++ xa_surface_unref(hw);
+ return FALSE;
+ }
+
+@@ -929,6 +933,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver,
+
+ if (!vmwgfx_hw_validate(src_pixmap, src_reg)) {
+ xa_copy_done(vsaa->xa_ctx);
++ xa_context_flush(vsaa->xa_ctx);
+ return FALSE;
+ }
+
+@@ -1029,6 +1034,7 @@ vmwgfx_copy_done(struct saa_driver *driver)
+ return;
+ }
+ xa_copy_done(vsaa->xa_ctx);
++ xa_context_flush(vsaa->xa_ctx);
+ }
+
+ static Bool
+@@ -1175,6 +1181,7 @@ vmwgfx_composite_done(struct saa_driver *driver)
+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
+
+ xa_composite_done(vsaa->xa_ctx);
++ xa_context_flush(vsaa->xa_ctx);
+ }
+
+ static void
+@@ -1436,7 +1443,8 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry)
+ */
+ if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL))
+ goto out_err;
+- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0)
++ if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
++ &handle, &dummy) != 0)
+ goto out_err;
+ depth = xa_format_depth(xa_surface_format(vpix->hw));
+
+diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
+index 449266b..2971ed7 100644
+--- a/vmwgfx/vmwgfx_tex_video.c
++++ b/vmwgfx/vmwgfx_tex_video.c
+@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
+
+ for (i=0; i<3; ++i) {
+ if (priv->yuv[i]) {
+- xa_surface_destroy(priv->yuv[i]);
++ xa_surface_unref(priv->yuv[i]);
+ priv->yuv[i] = NULL;
+ }
+ for (j=0; j<2; ++j) {
+@@ -539,7 +539,8 @@ copy_packed_data(ScrnInfoPtr pScrn,
+ REGION_RESET(pScrn->pScreen, ®, &box);
+ }
+
+- if (xa_surface_handle(srf, &handle, &stride) != 0) {
++ if (xa_surface_handle(srf, xa_handle_type_shared,
++ &handle, &stride) != 0) {
+ ret = BadAlloc;
+ break;
+ }
+--
+1.8.5.1
+
+
+From 835ce4698f916ba080f4132988fd4caf898e0b1e Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Thu, 26 Sep 2013 01:25:33 -0700
+Subject: [PATCH 02/11] vmwgfx: Avoid HW operations when not master
+
+Note that for DRI2, a dri2_copy_region becomes a NOP when not master.
+Additionally, all dri2 operations that lead to a potential kernel
+access will return FALSE.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Jakob Bornecrantz
+---
+ vmwgfx/vmwgfx_dri2.c | 13 +++++++++++++
+ vmwgfx/vmwgfx_driver.c | 3 +++
+ vmwgfx/vmwgfx_saa.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
+ vmwgfx/vmwgfx_saa.h | 8 ++++++++
+ vmwgfx/vmwgfx_saa_priv.h | 2 ++
+ vmwgfx/vmwgfx_xa_surface.c | 6 ++++++
+ 6 files changed, 75 insertions(+), 1 deletion(-)
+
+diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c
+index 2f007f0..57f2d9d 100644
+--- a/vmwgfx/vmwgfx_dri2.c
++++ b/vmwgfx/vmwgfx_dri2.c
+@@ -138,6 +138,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
+ return TRUE;
+ case DRI2BufferStencil:
+ case DRI2BufferDepthStencil:
++ if (!pScrn->vtSema)
++ return FALSE;
+
+ depth = (format) ? vmwgfx_zs_format_to_depth(format) : 32;
+
+@@ -155,6 +157,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
+
+ break;
+ case DRI2BufferDepth:
++ if (!pScrn->vtSema)
++ return FALSE;
++
+ depth = (format) ? vmwgfx_z_format_to_depth(format) :
+ pDraw->bitsPerPixel;
+
+@@ -291,6 +296,14 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
+ DrawablePtr dst_draw;
+ RegionPtr myClip;
+ GCPtr gc;
++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
++
++ /*
++ * This is a fragile protection against HW operations when not master.
++ * Needs to be blocked higher up in the dri2 code.
++ */
++ if (!pScrn->vtSema)
++ return;
+
+ /*
+ * In driCreateBuffers we dewrap windows into the
+diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
+index 3002285..eeaea4b 100644
+--- a/vmwgfx/vmwgfx_driver.c
++++ b/vmwgfx/vmwgfx_driver.c
+@@ -1116,6 +1116,7 @@ drv_leave_vt(VT_FUNC_ARGS_DECL)
+
+ vmwgfx_cursor_bypass(ms->fd, 0, 0);
+ vmwgfx_disable_scanout(pScrn);
++ vmwgfx_saa_drop_master(pScrn->pScreen);
+
+ if (drmDropMaster(ms->fd))
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+@@ -1136,6 +1137,8 @@ drv_enter_vt(VT_FUNC_ARGS_DECL)
+ if (!drv_set_master(pScrn))
+ return FALSE;
+
++ vmwgfx_saa_set_master(pScrn->pScreen);
++
+ if (!xf86SetDesiredModes(pScrn))
+ return FALSE;
+
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index ed3c1ee..5534ca3 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -423,6 +423,7 @@ vmwgfx_create_pixmap(struct saa_driver *driver, struct saa_pixmap *spix,
+
+ WSBMINITLISTHEAD(&vpix->sync_x_head);
+ WSBMINITLISTHEAD(&vpix->scanout_list);
++ WSBMINITLISTHEAD(&vpix->pixmap_list);
+
+ return TRUE;
+ }
+@@ -499,6 +500,7 @@ vmwgfx_destroy_pixmap(struct saa_driver *driver, PixmapPtr pixmap)
+ */
+
+ vmwgfx_pixmap_remove_present(vpix);
++ WSBMLISTDELINIT(&vpix->pixmap_list);
+ WSBMLISTDELINIT(&vpix->sync_x_head);
+
+ if (vpix->hw_is_dri2_fronts)
+@@ -627,6 +629,8 @@ vmwgfx_modify_pixmap_header (PixmapPtr pixmap, int w, int h, int depth,
+ int bpp, int devkind, void *pixdata)
+ {
+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap);
++ ScreenPtr pScreen = pixmap->drawable.pScreen;
++ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
+ unsigned int old_height;
+ unsigned int old_width;
+ unsigned int old_pitch;
+@@ -670,6 +674,8 @@ vmwgfx_modify_pixmap_header (PixmapPtr pixmap, int w, int h, int depth,
+
+ vmwgfx_pix_resize(pixmap, old_pitch, old_height, old_width);
+ vmwgfx_pixmap_free_storage(vpix);
++ WSBMLISTADDTAIL(&vpix->pixmap_list, &vsaa->pixmaps);
++
+ return TRUE;
+
+ out_no_modify:
+@@ -860,7 +866,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver,
+ Bool has_valid_hw;
+
+ if (!vsaa->xat || !SAA_PM_IS_SOLID(&dst_pixmap->drawable, plane_mask) ||
+- alu != GXcopy)
++ alu != GXcopy || !vsaa->is_master)
+ return FALSE;
+
+ src_vpix = vmwgfx_saa_pixmap(src_pixmap);
+@@ -1057,6 +1063,9 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op,
+ RegionRec empty;
+ struct xa_composite *xa_comp;
+
++ if (!vsaa->is_master)
++ return FALSE;
++
+ REGION_NULL(pScreen, &empty);
+
+ /*
+@@ -1367,7 +1376,9 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
+ vsaa->use_present_opt = direct_presents;
+ vsaa->only_hw_presents = only_hw_presents;
+ vsaa->rendercheck = rendercheck;
++ vsaa->is_master = TRUE;
+ WSBMINITLISTHEAD(&vsaa->sync_x_list);
++ WSBMINITLISTHEAD(&vsaa->pixmaps);
+
+ vsaa->driver = vmwgfx_saa_driver;
+ vsaa->vcomp = vmwgfx_alloc_composite();
+@@ -1518,3 +1529,34 @@ vmwgfx_scanout_unref(struct vmwgfx_screen_entry *entry)
+ entry->pixmap = NULL;
+ pixmap->drawable.pScreen->DestroyPixmap(pixmap);
+ }
++
++void
++vmwgfx_saa_set_master(ScreenPtr pScreen)
++{
++ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
++
++ vsaa->is_master = TRUE;
++}
++
++void
++vmwgfx_saa_drop_master(ScreenPtr pScreen)
++{
++ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
++ struct _WsbmListHead *list;
++ struct vmwgfx_saa_pixmap *vpix;
++ struct saa_pixmap *spix;
++
++ WSBMLISTFOREACH(list, &vsaa->pixmaps) {
++ vpix = WSBMLISTENTRY(list, struct vmwgfx_saa_pixmap, pixmap_list);
++ spix = &vpix->base;
++
++ if (!vpix->hw)
++ continue;
++
++ (void) vmwgfx_download_from_hw(&vsaa->driver, spix->pixmap,
++ &spix->dirty_hw);
++ REGION_EMPTY(draw->pScreen, &spix->dirty_hw);
++ }
++
++ vsaa->is_master = FALSE;
++}
+diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h
+index bb8ec96..d8aa3d3 100644
+--- a/vmwgfx/vmwgfx_saa.h
++++ b/vmwgfx/vmwgfx_saa.h
+@@ -54,6 +54,7 @@ struct vmwgfx_saa_pixmap {
+ int hw_is_dri2_fronts;
+ struct _WsbmListHead sync_x_head;
+ struct _WsbmListHead scanout_list;
++ struct _WsbmListHead pixmap_list;
+
+ uint32_t xa_flags;
+ uint32_t staging_add_flags;
+@@ -107,4 +108,11 @@ Bool
+ vmwgfx_hw_accel_validate(PixmapPtr pixmap, unsigned int depth,
+ uint32_t add_flags, uint32_t remove_flags,
+ RegionPtr region);
++
++void
++vmwgfx_saa_set_master(ScreenPtr pScreen);
++
++void
++vmwgfx_saa_drop_master(ScreenPtr pScreen);
++
+ #endif
+diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h
+index 5f46dee..16583b0 100644
+--- a/vmwgfx/vmwgfx_saa_priv.h
++++ b/vmwgfx/vmwgfx_saa_priv.h
+@@ -54,8 +54,10 @@ struct vmwgfx_saa {
+ Bool use_present_opt;
+ Bool only_hw_presents;
+ Bool rendercheck;
++ Bool is_master;
+ void (*present_flush) (ScreenPtr pScreen);
+ struct _WsbmListHead sync_x_list;
++ struct _WsbmListHead pixmaps;
+ struct vmwgfx_composite *vcomp;
+ };
+
+diff --git a/vmwgfx/vmwgfx_xa_surface.c b/vmwgfx/vmwgfx_xa_surface.c
+index 8b30e45..2f23c57 100644
+--- a/vmwgfx/vmwgfx_xa_surface.c
++++ b/vmwgfx/vmwgfx_xa_surface.c
+@@ -362,6 +362,12 @@ vmwgfx_hw_accel_validate(PixmapPtr pixmap, unsigned int depth,
+ Bool
+ vmwgfx_hw_dri2_validate(PixmapPtr pixmap, unsigned int depth)
+ {
++ struct vmwgfx_saa *vsaa =
++ to_vmwgfx_saa(saa_get_driver(pixmap->drawable.pScreen));
++
++ if (!vsaa->is_master)
++ return FALSE;
++
+ return (vmwgfx_hw_dri2_stage(pixmap, depth) &&
+ vmwgfx_hw_commit(pixmap) &&
+ vmwgfx_hw_validate(pixmap, NULL));
+--
+1.8.5.1
+
+
+From 7192acf9f0bf8e7176ab0b803b861a858623f709 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Wed, 19 Sep 2012 20:36:57 +0200
+Subject: [PATCH 03/11] vmwgfx: Implement textured video completely on top of
+ XA.
+
+Remove device-specific hacks. This may increase resource usage a little
+on old hardware revisions, but we don't need separate code paths on
+different hardware revisions.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Zack Rusin
+---
+ vmwgfx/vmwgfx_tex_video.c | 109 ++++++----------------------------------------
+ 1 file changed, 14 insertions(+), 95 deletions(-)
+
+diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
+index 2971ed7..a0a4f4a 100644
+--- a/vmwgfx/vmwgfx_tex_video.c
++++ b/vmwgfx/vmwgfx_tex_video.c
+@@ -111,8 +111,7 @@ struct xorg_xv_port_priv {
+ int hue;
+
+ int current_set;
+- struct vmwgfx_dmabuf *bounce[2][3];
+- struct xa_surface *yuv[3];
++ struct xa_surface *yuv[2][3];
+
+ int drm_fd;
+
+@@ -198,14 +197,10 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
+ priv->fence = NULL;
+
+ for (i=0; i<3; ++i) {
+- if (priv->yuv[i]) {
+- xa_surface_unref(priv->yuv[i]);
+- priv->yuv[i] = NULL;
+- }
+ for (j=0; j<2; ++j) {
+- if (priv->bounce[j][i]) {
+- vmwgfx_dmabuf_destroy(priv->bounce[j][i]);
+- priv->bounce[0][i] = NULL;
++ if (priv->yuv[i]) {
++ xa_surface_unref(priv->yuv[j][i]);
++ priv->yuv[j][i] = NULL;
+ }
+ }
+ }
+@@ -297,11 +292,9 @@ static int
+ check_yuv_surfaces(struct xorg_xv_port_priv *priv, int id,
+ int width, int height)
+ {
+- struct xa_surface **yuv = priv->yuv;
+- struct vmwgfx_dmabuf **bounce = priv->bounce[priv->current_set];
++ struct xa_surface **yuv = priv->yuv[priv->current_set];
+ int ret = 0;
+ int i;
+- size_t size;
+
+ for (i=0; i<3; ++i) {
+
+@@ -334,19 +327,6 @@ check_yuv_surfaces(struct xorg_xv_port_priv *priv, int id,
+ if (ret || !yuv[i])
+ return BadAlloc;
+
+- size = width * height;
+-
+- if (bounce[i] && (bounce[i]->size < size ||
+- bounce[i]->size > 2*size)) {
+- vmwgfx_dmabuf_destroy(bounce[i]);
+- bounce[i] = NULL;
+- }
+-
+- if (!bounce[i]) {
+- bounce[i] = vmwgfx_dmabuf_alloc(priv->drm_fd, size);
+- if (!bounce[i])
+- return BadAlloc;
+- }
+ }
+ return Success;
+ }
+@@ -413,28 +393,20 @@ copy_packed_data(ScrnInfoPtr pScrn,
+ unsigned short w, unsigned short h)
+ {
+ int i;
+- struct vmwgfx_dmabuf **bounce = port->bounce[port->current_set];
++ struct xa_surface **yuv = port->yuv[port->current_set];
+ char *ymap, *vmap, *umap;
+ unsigned char y1, y2, u, v;
+ int yidx, uidx, vidx;
+ int y_array_size = w * h;
+ int ret = BadAlloc;
+
+- /*
+- * Here, we could use xa_surface_[map|unmap], but given the size of
+- * the yuv textures, that could stress the xa tracker dma buffer pool,
+- * particularaly with multiple videos rendering simultaneously.
+- *
+- * Instead, cheat and allocate vmwgfx dma buffers directly.
+- */
+-
+- ymap = (char *)vmwgfx_dmabuf_map(bounce[0]);
++ ymap = xa_surface_map(port->r, yuv[0], XA_MAP_WRITE);
+ if (!ymap)
+ return BadAlloc;
+- umap = (char *)vmwgfx_dmabuf_map(bounce[1]);
++ umap = xa_surface_map(port->r, yuv[1], XA_MAP_WRITE);
+ if (!umap)
+ goto out_no_umap;
+- vmap = (char *)vmwgfx_dmabuf_map(bounce[2]);
++ vmap = xa_surface_map(port->r, yuv[2], XA_MAP_WRITE);
+ if (!vmap)
+ goto out_no_vmap;
+
+@@ -493,65 +465,11 @@ copy_packed_data(ScrnInfoPtr pScrn,
+ }
+
+ ret = Success;
+- vmwgfx_dmabuf_unmap(bounce[2]);
++ xa_surface_unmap(yuv[2]);
+ out_no_vmap:
+- vmwgfx_dmabuf_unmap(bounce[1]);
++ xa_surface_unmap(yuv[1]);
+ out_no_umap:
+- vmwgfx_dmabuf_unmap(bounce[0]);
+-
+- if (ret == Success) {
+- struct xa_surface *srf;
+- struct vmwgfx_dmabuf *buf;
+- uint32_t handle;
+- unsigned int stride;
+- BoxRec box;
+- RegionRec reg;
+-
+- box.x1 = 0;
+- box.x2 = w;
+- box.y1 = 0;
+- box.y2 = h;
+-
+- REGION_INIT(pScrn->pScreen, ®, &box, 1);
+-
+- for (i=0; i<3; ++i) {
+- srf = port->yuv[i];
+- buf = bounce[i];
+-
+- if (i == 1) {
+- switch(id) {
+- case FOURCC_YV12:
+- h /= 2;
+- /* Fall through */
+- case FOURCC_YUY2:
+- case FOURCC_UYVY:
+- w /= 2;
+- break;
+- default:
+- break;
+- }
+-
+- box.x1 = 0;
+- box.x2 = w;
+- box.y1 = 0;
+- box.y2 = h;
+-
+- REGION_RESET(pScrn->pScreen, ®, &box);
+- }
+-
+- if (xa_surface_handle(srf, xa_handle_type_shared,
+- &handle, &stride) != 0) {
+- ret = BadAlloc;
+- break;
+- }
+-
+- if (vmwgfx_dma(0, 0, ®, buf, w, handle, 1) != 0) {
+- ret = BadAlloc;
+- break;
+- }
+- }
+- REGION_UNINIT(pScrn->pScreen, ®);
+- }
++ xa_surface_unmap(yuv[0]);
+
+ return ret;
+ }
+@@ -610,7 +528,8 @@ display_video(ScreenPtr pScreen, struct xorg_xv_port_priv *pPriv, int id,
+ (struct xa_box *)REGION_RECTS(dstRegion),
+ REGION_NUM_RECTS(dstRegion),
+ pPriv->cm,
+- vpix->hw, pPriv->yuv);
++ vpix->hw,
++ pPriv->yuv[pPriv->current_set ]);
+
+ saa_pixmap_dirty(pPixmap, TRUE, dstRegion);
+ DamageRegionProcessPending(&pPixmap->drawable);
+--
+1.8.5.1
+
+
+From 45b2457516a9db4bd1d60fbb24a1efbe2d9dd932 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Wed, 19 Sep 2012 21:50:40 +0200
+Subject: [PATCH 04/11] vmwgfx: Get rid of device-specific DMA code
+
+It's rarely used and things seem to work well enough on top of XA.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Zack Rusin
+---
+ vmwgfx/vmwgfx_drmi.c | 103 -----------------------------------------------
+ vmwgfx/vmwgfx_drmi.h | 5 ---
+ vmwgfx/vmwgfx_saa.c | 53 ++++++++++++------------
+ vmwgfx/vmwgfx_saa_priv.h | 1 -
+ 4 files changed, 26 insertions(+), 136 deletions(-)
+
+diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c
+index 496a16b..1e23f4a 100644
+--- a/vmwgfx/vmwgfx_drmi.c
++++ b/vmwgfx/vmwgfx_drmi.c
+@@ -284,109 +284,6 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf)
+ }
+
+ int
+-vmwgfx_dma(unsigned int host_x, unsigned int host_y,
+- RegionPtr region, struct vmwgfx_dmabuf *buf,
+- uint32_t buf_pitch, uint32_t surface_handle, int to_surface)
+-{
+- BoxPtr clips = REGION_RECTS(region);
+- unsigned int num_clips = REGION_NUM_RECTS(region);
+- struct drm_vmw_execbuf_arg arg;
+- struct drm_vmw_fence_rep rep;
+- int ret;
+- unsigned int size;
+- unsigned i;
+- SVGA3dCopyBox *cb;
+- SVGA3dCmdSurfaceDMASuffix *suffix;
+- SVGA3dCmdSurfaceDMA *body;
+- struct vmwgfx_int_dmabuf *ibuf = vmwgfx_int_dmabuf(buf);
+-
+- struct {
+- SVGA3dCmdHeader header;
+- SVGA3dCmdSurfaceDMA body;
+- SVGA3dCopyBox cb;
+- } *cmd;
+-
+- if (num_clips == 0)
+- return 0;
+-
+- size = sizeof(*cmd) + (num_clips - 1) * sizeof(cmd->cb) +
+- sizeof(*suffix);
+- cmd = malloc(size);
+- if (!cmd)
+- return -1;
+-
+- cmd->header.id = SVGA_3D_CMD_SURFACE_DMA;
+- cmd->header.size = sizeof(cmd->body) + num_clips * sizeof(cmd->cb) +
+- sizeof(*suffix);
+- cb = &cmd->cb;
+-
+- suffix = (SVGA3dCmdSurfaceDMASuffix *) &cb[num_clips];
+- suffix->suffixSize = sizeof(*suffix);
+- suffix->maximumOffset = (uint32_t) -1;
+- suffix->flags.discard = 0;
+- suffix->flags.unsynchronized = 0;
+- suffix->flags.reserved = 0;
+-
+- body = &cmd->body;
+- body->guest.ptr.gmrId = buf->gmr_id;
+- body->guest.ptr.offset = buf->gmr_offset;
+- body->guest.pitch = buf_pitch;
+- body->host.sid = surface_handle;
+- body->host.face = 0;
+- body->host.mipmap = 0;
+-
+- body->transfer = (to_surface ? SVGA3D_WRITE_HOST_VRAM :
+- SVGA3D_READ_HOST_VRAM);
+-
+-
+- for (i=0; i < num_clips; i++, cb++, clips++) {
+- cb->x = (uint16_t) clips->x1 + host_x;
+- cb->y = (uint16_t) clips->y1 + host_y;
+- cb->z = 0;
+- cb->srcx = (uint16_t) clips->x1;
+- cb->srcy = (uint16_t) clips->y1;
+- cb->srcz = 0;
+- cb->w = (uint16_t) (clips->x2 - clips->x1);
+- cb->h = (uint16_t) (clips->y2 - clips->y1);
+- cb->d = 1;
+-#if 0
+- LogMessage(X_INFO, "DMA! x: %u y: %u srcx: %u srcy: %u w: %u h: %u %s\n",
+- cb->x, cb->y, cb->srcx, cb->srcy, cb->w, cb->h,
+- to_surface ? "to" : "from");
+-#endif
+-
+- }
+-
+- memset(&arg, 0, sizeof(arg));
+- memset(&rep, 0, sizeof(rep));
+-
+- rep.error = -EFAULT;
+- arg.fence_rep = ((to_surface) ? 0UL : (unsigned long)&rep);
+- arg.commands = (unsigned long)cmd;
+- arg.command_size = size;
+- arg.throttle_us = 0;
+- arg.version = DRM_VMW_EXECBUF_VERSION;
+-
+- ret = drmCommandWrite(ibuf->drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg));
+- if (ret) {
+- LogMessage(X_ERROR, "DMA error %s.\n", strerror(-ret));
+- }
+-
+- free(cmd);
+-
+- if (rep.error == 0) {
+- ret = vmwgfx_fence_wait(ibuf->drm_fd, rep.handle, TRUE);
+- if (ret) {
+- LogMessage(X_ERROR, "DMA from host fence wait error %s.\n",
+- strerror(-ret));
+- vmwgfx_fence_unref(ibuf->drm_fd, rep.handle);
+- }
+- }
+-
+- return 0;
+-}
+-
+-int
+ vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out)
+ {
+ struct drm_vmw_getparam_arg gp_arg;
+diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h
+index 2435009..fff728a 100644
+--- a/vmwgfx/vmwgfx_drmi.h
++++ b/vmwgfx/vmwgfx_drmi.h
+@@ -60,11 +60,6 @@ extern void
+ vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf);
+
+ extern int
+-vmwgfx_dma(unsigned int host_x, unsigned int host_y,
+- RegionPtr region, struct vmwgfx_dmabuf *buf,
+- uint32_t buf_pitch, uint32_t surface_handle, int to_surface);
+-
+-extern int
+ vmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree);
+
+ extern int
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index 5534ca3..fd80682 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -279,40 +279,40 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
+ Bool to_hw)
+ {
+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap);
++ void *data = vpix->malloc;
++ int ret;
+
+ if (!vpix->hw || (!vpix->gmr && !vpix->malloc))
+ return TRUE;
+
+- if (vpix->gmr && vsaa->can_optimize_dma) {
+- uint32_t handle, dummy;
+
+- if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+- &handle, &dummy) != 0)
+- goto out_err;
+- if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle,
+- to_hw) != 0)
++ if (vpix->gmr) {
++ data = vmwgfx_dmabuf_map(vpix->gmr);
++ if (!data)
+ goto out_err;
+- } else {
+- void *data = vpix->malloc;
+- int ret;
++ }
+
+- if (vpix->gmr) {
+- data = vmwgfx_dmabuf_map(vpix->gmr);
+- if (!data)
+- goto out_err;
+- }
++ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind,
++ (int) to_hw,
++ (struct xa_box *) REGION_RECTS(reg),
++ REGION_NUM_RECTS(reg));
++ if (vpix->gmr)
++ vmwgfx_dmabuf_unmap(vpix->gmr);
++
++ if (ret)
++ goto out_err;
++
++ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind,
++ (int) to_hw,
++ (struct xa_box *) REGION_RECTS(reg),
++ REGION_NUM_RECTS(reg));
++ if (to_hw)
++ xa_context_flush(vsaa->xa_ctx);
++ if (vpix->gmr)
++ vmwgfx_dmabuf_unmap(vpix->gmr);
++ if (ret)
++ goto out_err;
+
+- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind,
+- (int) to_hw,
+- (struct xa_box *) REGION_RECTS(reg),
+- REGION_NUM_RECTS(reg));
+- if (to_hw)
+- xa_context_flush(vsaa->xa_ctx);
+- if (vpix->gmr)
+- vmwgfx_dmabuf_unmap(vpix->gmr);
+- if (ret)
+- goto out_err;
+- }
+ return TRUE;
+ out_err:
+ LogMessage(X_ERROR, "DMA %s surface failed.\n",
+@@ -1372,7 +1372,6 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
+ vsaa->xa_ctx = xa_context_default(xat);
+ vsaa->drm_fd = drm_fd;
+ vsaa->present_flush = present_flush;
+- vsaa->can_optimize_dma = FALSE;
+ vsaa->use_present_opt = direct_presents;
+ vsaa->only_hw_presents = only_hw_presents;
+ vsaa->rendercheck = rendercheck;
+diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h
+index 16583b0..f5f45ba 100644
+--- a/vmwgfx/vmwgfx_saa_priv.h
++++ b/vmwgfx/vmwgfx_saa_priv.h
+@@ -50,7 +50,6 @@ struct vmwgfx_saa {
+ int ydiff;
+ RegionRec present_region;
+ uint32_t src_handle;
+- Bool can_optimize_dma;
+ Bool use_present_opt;
+ Bool only_hw_presents;
+ Bool rendercheck;
+--
+1.8.5.1
+
+
+From e26dec8f5278df74a102493bf6d2d8444dab5d6d Mon Sep 17 00:00:00 2001
+From: Gaetan Nadon
+Date: Mon, 28 Oct 2013 18:21:29 -0400
+Subject: [PATCH 05/11] vmwgfx: handle changes of DamageUnregister API in
+ 1.14.99.2
+
+Fix is inspired from the intel driver.
+
+Reviewed-by: Jakob Bornecrantz
+Signed-off-by: Gaetan Nadon
+Signed-off-by: Jakob Bornecrantz
+---
+ vmwgfx/vmwgfx_saa.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index fd80682..346e7f4 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -26,6 +26,7 @@
+ */
+
+ #include
++#include
+ #include
+ #include
+ #include
+@@ -76,7 +77,12 @@ vmwgfx_pixmap_remove_damage(PixmapPtr pixmap)
+ if (!spix->damage || vpix->hw || vpix->gmr || vpix->malloc)
+ return;
+
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
++ DamageUnregister(spix->damage);
++#else
+ DamageUnregister(&pixmap->drawable, spix->damage);
++#endif
++
+ DamageDestroy(spix->damage);
+ spix->damage = NULL;
+ }
+--
+1.8.5.1
+
+
+From 7ac45326eccbf3bea9a4a8f95b9662a36ab58eb0 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Thu, 28 Nov 2013 02:02:20 -0800
+Subject: [PATCH 06/11] vmwgfx: Fix some compilation warnings and indentations
+
+Most of the compilation warnings we're seeing are due to bad xorg headers,
+but fix the ones we can fix in the driver. Some indentation fixes as well.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Jakob Bornecrantz
+---
+ src/vmware_bootstrap.c | 2 --
+ src/vmwarevideo.c | 4 ++--
+ vmwgfx/vmwgfx_driver.c | 1 -
+ vmwgfx/vmwgfx_output.c | 2 +-
+ vmwgfx/vmwgfx_overlay.c | 4 ++--
+ vmwgfx/vmwgfx_tex_video.c | 26 +++++++++++++-------------
+ 6 files changed, 18 insertions(+), 21 deletions(-)
+
+diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
+index ea5be19..bb58325 100644
+--- a/src/vmware_bootstrap.c
++++ b/src/vmware_bootstrap.c
+@@ -256,7 +256,6 @@ VMwarePciProbe (DriverPtr drv,
+ intptr_t match_data)
+ {
+ ScrnInfoPtr scrn = NULL;
+- EntityInfoPtr entity;
+
+ scrn = xf86ConfigPciEntity(scrn, 0, entity_num, VMWAREPciChipsets,
+ NULL, NULL, NULL, NULL, NULL);
+@@ -267,7 +266,6 @@ VMwarePciProbe (DriverPtr drv,
+ scrn->Probe = NULL;
+ }
+
+- entity = xf86GetEntityInfo(entity_num);
+ switch (DEVICE_ID(device)) {
+ case PCI_DEVICE_ID_VMWARE_SVGA2:
+ case PCI_DEVICE_ID_VMWARE_SVGA:
+diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c
+index 745c71f..8d7d171 100644
+--- a/src/vmwarevideo.c
++++ b/src/vmwarevideo.c
+@@ -82,7 +82,7 @@
+ #define VMWARE_VID_MAX_HEIGHT 2048
+
+ #define VMWARE_VID_NUM_ENCODINGS 1
+-static XF86VideoEncodingRec vmwareVideoEncodings[] =
++static const XF86VideoEncodingRec vmwareVideoEncodings[] =
+ {
+ {
+ 0,
+@@ -108,7 +108,7 @@ static XF86ImageRec vmwareVideoImages[] =
+ };
+
+ #define VMWARE_VID_NUM_ATTRIBUTES 2
+-static XF86AttributeRec vmwareVideoAttributes[] =
++static const XF86AttributeRec vmwareVideoAttributes[] =
+ {
+ {
+ XvGettable | XvSettable,
+diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
+index eeaea4b..bfc07f8 100644
+--- a/vmwgfx/vmwgfx_driver.c
++++ b/vmwgfx/vmwgfx_driver.c
+@@ -658,7 +658,6 @@ void xorg_flush(ScreenPtr pScreen)
+ if (crtc->enabled) {
+ pixmap = crtc_get_scanout(crtc);
+ if (pixmap) {
+- unsigned int j;
+
+ /*
+ * Remove duplicates.
+diff --git a/vmwgfx/vmwgfx_output.c b/vmwgfx/vmwgfx_output.c
+index 4f52f1d..f9e4263 100644
+--- a/vmwgfx/vmwgfx_output.c
++++ b/vmwgfx/vmwgfx_output.c
+@@ -60,7 +60,7 @@ struct output_private
+ Bool is_implicit;
+ };
+
+-static char *output_enum_list[] = {
++static const char *output_enum_list[] = {
+ "Unknown",
+ "VGA",
+ "DVI",
+diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c
+index 6624a10..986dd06 100644
+--- a/vmwgfx/vmwgfx_overlay.c
++++ b/vmwgfx/vmwgfx_overlay.c
+@@ -84,7 +84,7 @@ typedef uint8_t uint8;
+ #define VMWARE_VID_MAX_HEIGHT 2048
+
+ #define VMWARE_VID_NUM_ENCODINGS 1
+-static XF86VideoEncodingRec vmwareVideoEncodings[] =
++static const XF86VideoEncodingRec vmwareVideoEncodings[] =
+ {
+ {
+ 0,
+@@ -110,7 +110,7 @@ static XF86ImageRec vmwareVideoImages[] =
+ };
+
+ #define VMWARE_VID_NUM_ATTRIBUTES 2
+-static XF86AttributeRec vmwareVideoAttributes[] =
++static const XF86AttributeRec vmwareVideoAttributes[] =
+ {
+ {
+ XvGettable | XvSettable,
+diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
+index a0a4f4a..3ba40ef 100644
+--- a/vmwgfx/vmwgfx_tex_video.c
++++ b/vmwgfx/vmwgfx_tex_video.c
+@@ -70,11 +70,11 @@ static const float bt_709[] = {
+ static Atom xvBrightness, xvContrast, xvSaturation, xvHue;
+
+ #define NUM_TEXTURED_ATTRIBUTES 4
+-static XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = {
+- {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
+- {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"},
+- {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"},
+- {XvSettable | XvGettable, -1000, 1000, "XV_HUE"}
++static const XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = {
++ {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
++ {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"},
++ {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"},
++ {XvSettable | XvGettable, -1000, 1000, "XV_HUE"}
+ };
+
+ #define NUM_FORMATS 3
+@@ -82,7 +82,7 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] = {
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+ };
+
+-static XF86VideoEncodingRec DummyEncoding[1] = {
++static const XF86VideoEncodingRec DummyEncoding[1] = {
+ {
+ 0,
+ "XV_IMAGE",
+@@ -416,16 +416,16 @@ copy_packed_data(ScrnInfoPtr pScrn,
+ switch (id) {
+ case FOURCC_YV12: {
+ int pitches[3], offsets[3];
+- unsigned char *y, *u, *v;
++ unsigned char *yp, *up, *vp;
+ query_image_attributes(pScrn, FOURCC_YV12,
+ &w, &h, pitches, offsets);
+
+- y = buf + offsets[0];
+- v = buf + offsets[1];
+- u = buf + offsets[2];
+- memcpy(ymap, y, w*h);
+- memcpy(vmap, v, w*h/4);
+- memcpy(umap, u, w*h/4);
++ yp = buf + offsets[0];
++ vp = buf + offsets[1];
++ up = buf + offsets[2];
++ memcpy(ymap, yp, w*h);
++ memcpy(vmap, vp, w*h/4);
++ memcpy(umap, up, w*h/4);
+ break;
+ }
+ case FOURCC_UYVY:
+--
+1.8.5.1
+
+
+From a40cbd7b4fa19219849b4b0a48f07538772c3e22 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Thu, 5 Dec 2013 02:58:47 -0800
+Subject: [PATCH 07/11] vmwgfx: Support also XA version 1 v2
+
+We need to support also XA version 1, since we want to be backwards
+compatible with older mesa releases.
+Unfortunately, the intended way of detecting XA major version at
+compile-time was broken on mesa 10 so we need a workaround that tests
+for XA version 2 at config time.
+
+v2: Update the test for XA version 2.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Jakob Bornecrantz
+---
+ configure.ac | 10 +++++++++-
+ vmwgfx/vmwgfx_dri2.c | 5 ++---
+ vmwgfx/vmwgfx_driver.c | 3 +--
+ vmwgfx/vmwgfx_saa.c | 12 +++++-------
+ vmwgfx/vmwgfx_saa.h | 12 ++++++++++++
+ vmwgfx/vmwgfx_tex_video.c | 2 +-
+ 6 files changed, 30 insertions(+), 14 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dccfb27..123356c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -118,7 +118,15 @@ if test x$BUILD_VMWGFX = xyes; then
+ PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no])
+ fi
+ if test x$BUILD_VMWGFX = xyes; then
+- PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no])
++#
++# Early versions of mesa 10 forgot to bump the XA major version number in
++# the xa_tracker.h header
++#
++ PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],
++ [PKG_CHECK_EXISTS([xatracker = 2.0.0],
++ [AC_DEFINE([HAVE_XA_2], 1,
++ [Has version 2 of XA])])],
++ [],[BUILD_VMWGFX=no])
+ fi
+
+ DRIVER_NAME=vmware
+diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c
+index 57f2d9d..4c74a6b 100644
+--- a/vmwgfx/vmwgfx_dri2.c
++++ b/vmwgfx/vmwgfx_dri2.c
+@@ -206,8 +206,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
+ }
+
+ private->srf = srf;
+- if (xa_surface_handle(srf, xa_handle_type_shared,
+- &buffer->name, &buffer->pitch) != 0)
++ if (_xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0)
+ return FALSE;
+
+ buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8;
+@@ -228,7 +227,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap);
+
+ if (--private->refcount == 0 && srf) {
+- xa_surface_unref(srf);
++ xa_surface_destroy(srf);
+ }
+
+ /*
+diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
+index bfc07f8..6301c29 100644
+--- a/vmwgfx/vmwgfx_driver.c
++++ b/vmwgfx/vmwgfx_driver.c
+@@ -617,8 +617,7 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd,
+ return FALSE;
+ }
+
+- if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+- &handle, &dummy) != 0) {
++ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) {
+ LogMessage(X_ERROR, "Could not get present surface handle.\n");
+ return FALSE;
+ }
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index 346e7f4..1459933 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -146,7 +146,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix)
+ vpix->malloc = NULL;
+ }
+ if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) {
+- xa_surface_unref(vpix->hw);
++ xa_surface_destroy(vpix->hw);
+ vpix->hw = NULL;
+ }
+ if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) {
+@@ -451,7 +451,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
+ &spix->dirty_hw))
+ return FALSE;
+
+- xa_surface_unref(vpix->hw);
++ xa_surface_destroy(vpix->hw);
+ vpix->hw = NULL;
+
+ /*
+@@ -698,8 +698,7 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa,
+
+ (void) pScreen;
+ if (src_vpix == dst_vpix || !src_vpix->hw ||
+- xa_surface_handle(src_vpix->hw, xa_handle_type_shared,
+- &vsaa->src_handle, &dummy) != 0)
++ _xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0)
+ return FALSE;
+
+ REGION_NULL(pScreen, &vsaa->present_region);
+@@ -800,7 +799,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa,
+ return TRUE;
+
+ out_no_damage:
+- xa_surface_unref(hw);
++ xa_surface_destroy(hw);
+ return FALSE;
+ }
+
+@@ -1459,8 +1458,7 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry)
+ */
+ if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL))
+ goto out_err;
+- if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+- &handle, &dummy) != 0)
++ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0)
+ goto out_err;
+ depth = xa_format_depth(xa_surface_format(vpix->hw));
+
+diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h
+index d8aa3d3..5e1f40c 100644
+--- a/vmwgfx/vmwgfx_saa.h
++++ b/vmwgfx/vmwgfx_saa.h
+@@ -115,4 +115,16 @@ vmwgfx_saa_set_master(ScreenPtr pScreen);
+ void
+ vmwgfx_saa_drop_master(ScreenPtr pScreen);
+
++#if (XA_TRACKER_VERSION_MAJOR <= 1) && !defined(HAVE_XA_2)
++
++#define _xa_surface_handle(_a, _b, _c) xa_surface_handle(_a, _b, _c)
++#define xa_context_flush(_a)
++
++#else
++
++#define xa_surface_destroy(_a) xa_surface_unref(_a)
++#define _xa_surface_handle(_a, _b, _c) \
++ xa_surface_handle(_a, xa_handle_type_shared, _b, _c)
++
++#endif /* (XA_TRACKER_VERSION_MAJOR <= 1) */
+ #endif
+diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
+index 3ba40ef..9fd8f22 100644
+--- a/vmwgfx/vmwgfx_tex_video.c
++++ b/vmwgfx/vmwgfx_tex_video.c
+@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
+ for (i=0; i<3; ++i) {
+ for (j=0; j<2; ++j) {
+ if (priv->yuv[i]) {
+- xa_surface_unref(priv->yuv[j][i]);
++ xa_surface_destroy(priv->yuv[j][i]);
+ priv->yuv[j][i] = NULL;
+ }
+ }
+--
+1.8.5.1
+
+
+From c36cbcefb8526944141eb431e1e736dc4485a36e Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Mon, 9 Dec 2013 00:19:55 -0800
+Subject: [PATCH 08/11] vmwgfx: Remove stray 1
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Jakob Bornecrantz
+---
+ vmwgfx/vmwgfx_saa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index 1459933..28819c1 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -1230,7 +1230,7 @@ vmwgfx_operation_complete(struct saa_driver *driver,
+ */
+
+ if (vpix->hw && vpix->hw_is_dri2_fronts) {
+- if (1 && pScrn->vtSema &&
++ if (pScrn->vtSema &&
+ vmwgfx_upload_to_hw(driver, pixmap, &spix->dirty_shadow)) {
+
+ REGION_EMPTY(vsaa->pScreen, &spix->dirty_shadow);
+--
+1.8.5.1
+
+
+From 4af6062ce281a7f4aaa50985fe757e9569208ee1 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Wed, 11 Dec 2013 04:59:49 -0800
+Subject: [PATCH 09/11] Revert "vmwgfx: Get rid of device-specific DMA code"
+
+This reverts commit 45b2457516a9db4bd1d60fbb24a1efbe2d9dd932.
+
+Reverting this because using direct DMA for shared pixmaps should
+boost performance. It should be usable both in a composited environment
+and when running hosted. Need to retest the DMA flaws I saw before disabling
+this code.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Jakob Bornecrantz
+---
+ vmwgfx/vmwgfx_drmi.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++
+ vmwgfx/vmwgfx_drmi.h | 5 +++
+ vmwgfx/vmwgfx_saa.c | 53 ++++++++++++------------
+ vmwgfx/vmwgfx_saa_priv.h | 1 +
+ 4 files changed, 136 insertions(+), 26 deletions(-)
+
+diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c
+index 1e23f4a..496a16b 100644
+--- a/vmwgfx/vmwgfx_drmi.c
++++ b/vmwgfx/vmwgfx_drmi.c
+@@ -284,6 +284,109 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf)
+ }
+
+ int
++vmwgfx_dma(unsigned int host_x, unsigned int host_y,
++ RegionPtr region, struct vmwgfx_dmabuf *buf,
++ uint32_t buf_pitch, uint32_t surface_handle, int to_surface)
++{
++ BoxPtr clips = REGION_RECTS(region);
++ unsigned int num_clips = REGION_NUM_RECTS(region);
++ struct drm_vmw_execbuf_arg arg;
++ struct drm_vmw_fence_rep rep;
++ int ret;
++ unsigned int size;
++ unsigned i;
++ SVGA3dCopyBox *cb;
++ SVGA3dCmdSurfaceDMASuffix *suffix;
++ SVGA3dCmdSurfaceDMA *body;
++ struct vmwgfx_int_dmabuf *ibuf = vmwgfx_int_dmabuf(buf);
++
++ struct {
++ SVGA3dCmdHeader header;
++ SVGA3dCmdSurfaceDMA body;
++ SVGA3dCopyBox cb;
++ } *cmd;
++
++ if (num_clips == 0)
++ return 0;
++
++ size = sizeof(*cmd) + (num_clips - 1) * sizeof(cmd->cb) +
++ sizeof(*suffix);
++ cmd = malloc(size);
++ if (!cmd)
++ return -1;
++
++ cmd->header.id = SVGA_3D_CMD_SURFACE_DMA;
++ cmd->header.size = sizeof(cmd->body) + num_clips * sizeof(cmd->cb) +
++ sizeof(*suffix);
++ cb = &cmd->cb;
++
++ suffix = (SVGA3dCmdSurfaceDMASuffix *) &cb[num_clips];
++ suffix->suffixSize = sizeof(*suffix);
++ suffix->maximumOffset = (uint32_t) -1;
++ suffix->flags.discard = 0;
++ suffix->flags.unsynchronized = 0;
++ suffix->flags.reserved = 0;
++
++ body = &cmd->body;
++ body->guest.ptr.gmrId = buf->gmr_id;
++ body->guest.ptr.offset = buf->gmr_offset;
++ body->guest.pitch = buf_pitch;
++ body->host.sid = surface_handle;
++ body->host.face = 0;
++ body->host.mipmap = 0;
++
++ body->transfer = (to_surface ? SVGA3D_WRITE_HOST_VRAM :
++ SVGA3D_READ_HOST_VRAM);
++
++
++ for (i=0; i < num_clips; i++, cb++, clips++) {
++ cb->x = (uint16_t) clips->x1 + host_x;
++ cb->y = (uint16_t) clips->y1 + host_y;
++ cb->z = 0;
++ cb->srcx = (uint16_t) clips->x1;
++ cb->srcy = (uint16_t) clips->y1;
++ cb->srcz = 0;
++ cb->w = (uint16_t) (clips->x2 - clips->x1);
++ cb->h = (uint16_t) (clips->y2 - clips->y1);
++ cb->d = 1;
++#if 0
++ LogMessage(X_INFO, "DMA! x: %u y: %u srcx: %u srcy: %u w: %u h: %u %s\n",
++ cb->x, cb->y, cb->srcx, cb->srcy, cb->w, cb->h,
++ to_surface ? "to" : "from");
++#endif
++
++ }
++
++ memset(&arg, 0, sizeof(arg));
++ memset(&rep, 0, sizeof(rep));
++
++ rep.error = -EFAULT;
++ arg.fence_rep = ((to_surface) ? 0UL : (unsigned long)&rep);
++ arg.commands = (unsigned long)cmd;
++ arg.command_size = size;
++ arg.throttle_us = 0;
++ arg.version = DRM_VMW_EXECBUF_VERSION;
++
++ ret = drmCommandWrite(ibuf->drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg));
++ if (ret) {
++ LogMessage(X_ERROR, "DMA error %s.\n", strerror(-ret));
++ }
++
++ free(cmd);
++
++ if (rep.error == 0) {
++ ret = vmwgfx_fence_wait(ibuf->drm_fd, rep.handle, TRUE);
++ if (ret) {
++ LogMessage(X_ERROR, "DMA from host fence wait error %s.\n",
++ strerror(-ret));
++ vmwgfx_fence_unref(ibuf->drm_fd, rep.handle);
++ }
++ }
++
++ return 0;
++}
++
++int
+ vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out)
+ {
+ struct drm_vmw_getparam_arg gp_arg;
+diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h
+index fff728a..2435009 100644
+--- a/vmwgfx/vmwgfx_drmi.h
++++ b/vmwgfx/vmwgfx_drmi.h
+@@ -60,6 +60,11 @@ extern void
+ vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf);
+
+ extern int
++vmwgfx_dma(unsigned int host_x, unsigned int host_y,
++ RegionPtr region, struct vmwgfx_dmabuf *buf,
++ uint32_t buf_pitch, uint32_t surface_handle, int to_surface);
++
++extern int
+ vmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree);
+
+ extern int
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index 28819c1..96275a5 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -285,40 +285,40 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
+ Bool to_hw)
+ {
+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap);
+- void *data = vpix->malloc;
+- int ret;
+
+ if (!vpix->hw || (!vpix->gmr && !vpix->malloc))
+ return TRUE;
+
++ if (vpix->gmr && vsaa->can_optimize_dma) {
++ uint32_t handle, dummy;
+
+- if (vpix->gmr) {
+- data = vmwgfx_dmabuf_map(vpix->gmr);
+- if (!data)
++ if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
++ &handle, &dummy) != 0)
+ goto out_err;
+- }
+-
+- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind,
+- (int) to_hw,
+- (struct xa_box *) REGION_RECTS(reg),
+- REGION_NUM_RECTS(reg));
+- if (vpix->gmr)
+- vmwgfx_dmabuf_unmap(vpix->gmr);
+-
+- if (ret)
+- goto out_err;
++ if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle,
++ to_hw) != 0)
++ goto out_err;
++ } else {
++ void *data = vpix->malloc;
++ int ret;
+
+- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind,
+- (int) to_hw,
+- (struct xa_box *) REGION_RECTS(reg),
+- REGION_NUM_RECTS(reg));
+- if (to_hw)
+- xa_context_flush(vsaa->xa_ctx);
+- if (vpix->gmr)
+- vmwgfx_dmabuf_unmap(vpix->gmr);
+- if (ret)
+- goto out_err;
++ if (vpix->gmr) {
++ data = vmwgfx_dmabuf_map(vpix->gmr);
++ if (!data)
++ goto out_err;
++ }
+
++ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind,
++ (int) to_hw,
++ (struct xa_box *) REGION_RECTS(reg),
++ REGION_NUM_RECTS(reg));
++ if (to_hw)
++ xa_context_flush(vsaa->xa_ctx);
++ if (vpix->gmr)
++ vmwgfx_dmabuf_unmap(vpix->gmr);
++ if (ret)
++ goto out_err;
++ }
+ return TRUE;
+ out_err:
+ LogMessage(X_ERROR, "DMA %s surface failed.\n",
+@@ -1377,6 +1377,7 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
+ vsaa->xa_ctx = xa_context_default(xat);
+ vsaa->drm_fd = drm_fd;
+ vsaa->present_flush = present_flush;
++ vsaa->can_optimize_dma = FALSE;
+ vsaa->use_present_opt = direct_presents;
+ vsaa->only_hw_presents = only_hw_presents;
+ vsaa->rendercheck = rendercheck;
+diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h
+index f5f45ba..16583b0 100644
+--- a/vmwgfx/vmwgfx_saa_priv.h
++++ b/vmwgfx/vmwgfx_saa_priv.h
+@@ -50,6 +50,7 @@ struct vmwgfx_saa {
+ int ydiff;
+ RegionRec present_region;
+ uint32_t src_handle;
++ Bool can_optimize_dma;
+ Bool use_present_opt;
+ Bool only_hw_presents;
+ Bool rendercheck;
+--
+1.8.5.1
+
+
+From 93228f3dd3355a25583d22dbb96791678b93be3e Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Wed, 11 Dec 2013 06:54:02 -0800
+Subject: [PATCH 10/11] vmwgfx: Really allow XA version 2.
+
+When XA starts to correctly advertise version 2, we didn't allow it.
+Fix this.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: Jakob Bornecrantz
+---
+ vmwgfx/vmwgfx_driver.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
+index 6301c29..4e28097 100644
+--- a/vmwgfx/vmwgfx_driver.c
++++ b/vmwgfx/vmwgfx_driver.c
+@@ -79,7 +79,7 @@ typedef uint8_t uint8;
+
+ #define XA_VERSION_MINOR_REQUIRED 0
+ #define XA_VERSION_MAJOR_REQUIRED 1
+-#define XA_VERSION_MAJOR_COMPAT 1
++#define XA_VERSION_MAJOR_COMPAT 2
+
+ #define DRM_VERSION_MAJOR_REQUIRED 2
+ #define DRM_VERSION_MINOR_REQUIRED 3
+--
+1.8.5.1
+
+
+From f45a551e9b70ccec8f92df02747d4e2af299cf8c Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom
+Date: Mon, 16 Dec 2013 10:38:21 +0100
+Subject: [PATCH 11/11] vmwgfx: Fix compile breakage on XA version 1.
+
+A recent revert brought back code that assumed XA version 2.
+
+Signed-off-by: Thomas Hellstrom
+Reviewed-by: trivial
+---
+ vmwgfx/vmwgfx_saa.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
+index 96275a5..e76bd09 100644
+--- a/vmwgfx/vmwgfx_saa.c
++++ b/vmwgfx/vmwgfx_saa.c
+@@ -292,8 +292,7 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
+ if (vpix->gmr && vsaa->can_optimize_dma) {
+ uint32_t handle, dummy;
+
+- if (xa_surface_handle(vpix->hw, xa_handle_type_shared,
+- &handle, &dummy) != 0)
++ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0)
+ goto out_err;
+ if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle,
+ to_hw) != 0)
+--
+1.8.5.1
+
diff --git a/x11/driver/xorg-video-vmware/pspec.xml b/x11/driver/xorg-video-vmware/pspec.xml
new file mode 100644
index 0000000000..b7e077fd82
--- /dev/null
+++ b/x11/driver/xorg-video-vmware/pspec.xml
@@ -0,0 +1,118 @@
+
+
+
+
+ xorg-video-vmware
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org vmware video driver
+ xorg-video-vmware contains the X.Org driver for VMWare virtual machines.
+ mirrors://xorg/individual/driver/xf86-video-vmware-13.1.0.tar.bz2
+
+ xorg-server-devel
+
+
+
+
+
+
+
+ xorg-video-vmware
+
+ mesa
+ libdrm
+ xorg-server
+
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-08
+ 13.1.0
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 13.1.0
+ Version bump.
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 13.0.2
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 13.0.2
+ Version bump.
+ Kamil Atlı
+ suvarice@gmail.com
+
+
+ 2014-03-09
+ 13.0.1
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 13.0.1
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-07-30
+ 13.0.1
+ Rebuild
+ Osman Erkan
+ osman.erkan@pisilinux.org
+
+
+ 2013-06-21
+ 13.0.1
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 13.0.1
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2013-05-03
+ 13.0.1
+ Version bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2012-10-12
+ 12.0.2
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-vmware/translations.xml b/x11/driver/xorg-video-vmware/translations.xml
new file mode 100644
index 0000000000..2c0c4dc03b
--- /dev/null
+++ b/x11/driver/xorg-video-vmware/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-vmware
+ X.Org vmware ekran kartı sürücüsü
+ xorg-video-vmware, VMWare sanal makineleri için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xorg-video-voodoo/actions.py b/x11/driver/xorg-video-voodoo/actions.py
new file mode 100644
index 0000000000..1594855f18
--- /dev/null
+++ b/x11/driver/xorg-video-voodoo/actions.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/copyleft/gpl.txt.
+
+from pisi.actionsapi import autotools
+from pisi.actionsapi import pisitools
+
+def setup():
+ autotools.configure("--disable-static")
+
+def build():
+ autotools.make()
+
+def install():
+ autotools.install()
+ pisitools.dodoc("COPYING", "ChangeLog", "README")
diff --git a/x11/driver/xorg-video-voodoo/files/git-fixes.patch b/x11/driver/xorg-video-voodoo/files/git-fixes.patch
new file mode 100644
index 0000000000..7316f755b1
--- /dev/null
+++ b/x11/driver/xorg-video-voodoo/files/git-fixes.patch
@@ -0,0 +1,12 @@
+--- xf86-video-voodoo-1.2.5.orig/src/voodoo.h 2012-07-17 08:21:17.000000000 +0300
++++ xf86-video-voodoo-1.2.5/src/voodoo.h 2015-05-10 17:57:53.748577130 +0300
+@@ -23,7 +23,9 @@
+
+ Bool Voodoo2; /* Set if Voodoo2 */
+ pciVideoPtr PciInfo; /* PCI data */
++#ifndef XSERVER_LIBPCIACCESS
+ PCITAG PciTag;
++#endif
+ CARD32 PhysBase;
+
+ CARD32 Width; /* Current width */
diff --git a/x11/driver/xorg-video-voodoo/pspec.xml b/x11/driver/xorg-video-voodoo/pspec.xml
new file mode 100644
index 0000000000..09a466c5d2
--- /dev/null
+++ b/x11/driver/xorg-video-voodoo/pspec.xml
@@ -0,0 +1,101 @@
+
+
+
+
+ xorg-video-voodoo
+ http://www.x.org
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ MIT
+ driver
+ X.Org voodoo video driver
+ xorg-video-voodoo contains the X.Org driver for Voodoo1 and Voodoo2 video adapters.
+ mirrors://xorg/individual/driver/xf86-video-voodoo-1.2.5.tar.bz2
+
+ xorg-server-devel
+
+
+ git-fixes.patch
+
+
+
+
+ xorg-video-voodoo
+
+ xorg-server
+
+
+ /usr/lib/xorg
+ /usr/share/doc
+ /usr/share/man
+
+
+
+
+
+ 2015-05-10
+ 1.2.5
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 1.2.5
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 1.2.5
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 1.2.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 1.2.5
+ Rebuild for xserver 1.15.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-08-25
+ 1.2.5
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-06-21
+ 1.2.5
+ Rebuild.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 1.2.5
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-10-12
+ 1.2.5
+ First release
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+
diff --git a/x11/driver/xorg-video-voodoo/translations.xml b/x11/driver/xorg-video-voodoo/translations.xml
new file mode 100644
index 0000000000..0125ad65fc
--- /dev/null
+++ b/x11/driver/xorg-video-voodoo/translations.xml
@@ -0,0 +1,8 @@
+
+
+
+ xorg-video-voodoo
+ X.Org voodoo ekran kartı sürücüsü
+ xorg-video-voodoo, Voodoo1 ve Voodoo2 video bağdaştırıcıları için X.Org sürücüsünü içerir.
+
+
diff --git a/x11/driver/xvba-video/actions.py b/x11/driver/xvba-video/actions.py
new file mode 100644
index 0000000000..d94254645f
--- /dev/null
+++ b/x11/driver/xvba-video/actions.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed under the GNU General Public License, version 3.
+# See the file http://www.gnu.org/licenses/gpl.txt
+
+from pisi.actionsapi import pisitools
+from pisi.actionsapi import get
+
+WorkDir = "%s-%s.%s" % (get.srcNAME(), get.srcVERSION(), get.ARCH())
+
+def install():
+ if get.buildTYPE() == "emul32":
+ pisitools.insinto("/usr/lib32", "../%s-%s.i686/usr/lib/*" % (get.srcNAME(), get.srcVERSION()))
+ return
+ else:
+ pisitools.insinto("/usr/lib", "usr/lib/*")
+
+ pisitools.dodoc("AUTHORS", "COPYING", "NEWS", "README")
diff --git a/x11/driver/xvba-video/pspec.xml b/x11/driver/xvba-video/pspec.xml
new file mode 100644
index 0000000000..32053a7b65
--- /dev/null
+++ b/x11/driver/xvba-video/pspec.xml
@@ -0,0 +1,111 @@
+
+
+
+
+ xvba-video
+ http://www.splitted-desktop.com/~gbeauchesne/xvba-video/
+
+ PisiLinux Community
+ admins@pisilinux.org
+
+ freedist
+ driver
+ XvBA backend for VA API
+ xvba-video is a backend for the VA API in order to use XvBA video acceleration drivers available for some ATI cards.
+ http://source.pisilinux.org/1.0/xvba-video-0.7.8.i686.tar.gz
+ http://source.pisilinux.org/1.0/xvba-video-0.7.8.x86_64.tar.gz
+
+
+
+ xvba-video
+
+ libva
+ libXext
+ mesa
+
+
+ /usr/lib
+ /usr/share/doc
+
+
+
+
+ xvba-video-32bit
+ emul32
+ 32-bit shared libraries for xvba-video
+ emul32
+
+ mesa-32bit
+ libX11-32bit
+ libXext-32bit
+
+
+ mesa-32bit
+ xvba-video
+ libX11-32bit
+ libXext-32bit
+
+
+ /usr/lib32
+
+
+
+
+
+ 2015-05-08
+ 0.7.8
+ Release bump.
+ Burak Ertürk
+ burakerturk@pisilinux.org
+
+
+ 2015-01-23
+ 0.7.8
+ Rebuild for xorg-server-1.16.3
+ Ergün Salman
+ Poyraz76@pisilinux.org
+
+
+ 2014-09-01
+ 0.7.8
+ Rebuild for xorg-server-1.16.0
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-05-16
+ 0.7.8
+ Release bump.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2014-03-09
+ 0.7.8
+ Rebuild for xserver 1.15.
+ Serdar Soytetir
+ kaptan@pisilinux.org
+
+
+ 2013-08-26
+ 0.7.8
+ Fix emul32.
+ Marcin Bojara
+ marcin@pisilinux.org
+
+
+ 2013-05-29
+ 0.7.8
+ build for xorg 1.14
+ Yusuf Aydemir
+ yusuf.aydemir@pisilinux.org
+
+
+ 2012-05-31
+ 0.7.8
+ First release
+ Fatih Turgel
+ admins@pisilinux.org
+
+
+
diff --git a/x11/driver/xvba-video/translations.xml b/x11/driver/xvba-video/translations.xml
new file mode 100644
index 0000000000..19fd41088b
--- /dev/null
+++ b/x11/driver/xvba-video/translations.xml
@@ -0,0 +1,13 @@
+
+
+
+ xvba-video
+ VA API için XvBA arka ucu
+ xvba-video, bazı ATI kartlar için mevcut olan XvBA video hızlandırma sürücülerini kullanmak için bir VA API arka ucudur.
+
+
+
+ xvba-video-32bit
+ xvba-video için 32-bit paylaşımlı kitaplıklar
+
+