From ef17357a9745e05e301b724d13a341067ddb3d5b Mon Sep 17 00:00:00 2001 From: root Date: Mon, 11 Mar 2013 00:04:02 -0700 Subject: Mon Mar 11 00:04:02 PDT 2013 --- community/cinnamon/PKGBUILD | 15 +- community/fcitx-mozc/PKGBUILD | 14 +- community/fwbuilder/PKGBUILD | 7 +- community/fwbuilder/fwbuilder.install | 2 + community/fwbuilder/fwbuilder.xml | 11 + community/geany-plugins/PKGBUILD | 21 +- community/geany/PKGBUILD | 27 +- community/gtk2hs-buildtools/PKGBUILD | 15 +- community/kyotocabinet/PKGBUILD | 4 +- community/libcec/PKGBUILD | 9 +- community/rsyslog/PKGBUILD | 12 +- community/squeak-vm/PKGBUILD | 11 +- community/sysstat/PKGBUILD | 6 +- core/logrotate/PKGBUILD | 30 +- core/openldap/PKGBUILD | 19 +- core/openldap/slapd | 49 - core/openldap/slapd.default | 6 - ...GS-and-LDFLAGS-to-their-Config.pm-counter.patch | 83 - core/perl/CVE-2013-1667.patch | 50 + core/perl/PKGBUILD | 8 +- extra/glamor-egl/PKGBUILD | 55 + extra/glamor-egl/compat-api.h | 107 ++ extra/glamor-egl/compiler.h | 59 + extra/glamor-egl/git-fixes.patch | 177 ++ extra/glamor-egl/glamor_debug.h | 116 ++ extra/glamor-egl/glamor_gl_dispatch.h | 137 ++ extra/glamor-egl/glamor_glext.h | 64 + extra/glamor-egl/glamor_priv.h | 1016 +++++++++++ extra/glamor-egl/glamor_utils.h | 1836 ++++++++++++++++++++ extra/glamor-egl/glapi.h | 121 ++ extra/gnome-shell/PKGBUILD | 12 +- extra/gnome-shell/nm-libexecdir.patch | 12 + extra/gparted/PKGBUILD | 12 +- extra/kwebkitpart/PKGBUILD | 12 +- extra/libkdcraw/PKGBUILD | 9 +- extra/xfdesktop/PKGBUILD | 16 +- ...images-are-no-longer-pixilated-when-scale.patch | 108 -- libre/calibre-libre/PKGBUILD | 4 +- libre/cgminer-libre/PKGBUILD | 4 +- libre/file-roller-libre/PKGBUILD | 4 +- libre/icecat-noscript/PKGBUILD | 4 +- libre/iceweasel-noscript/PKGBUILD | 4 +- 42 files changed, 3907 insertions(+), 381 deletions(-) create mode 100644 community/fwbuilder/fwbuilder.xml delete mode 100755 core/openldap/slapd delete mode 100644 core/openldap/slapd.default delete mode 100644 core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch create mode 100644 core/perl/CVE-2013-1667.patch create mode 100644 extra/glamor-egl/PKGBUILD create mode 100644 extra/glamor-egl/compat-api.h create mode 100644 extra/glamor-egl/compiler.h create mode 100644 extra/glamor-egl/git-fixes.patch create mode 100644 extra/glamor-egl/glamor_debug.h create mode 100644 extra/glamor-egl/glamor_gl_dispatch.h create mode 100644 extra/glamor-egl/glamor_glext.h create mode 100644 extra/glamor-egl/glamor_priv.h create mode 100644 extra/glamor-egl/glamor_utils.h create mode 100644 extra/glamor-egl/glapi.h create mode 100644 extra/gnome-shell/nm-libexecdir.patch delete mode 100644 extra/xfdesktop/revert-SVG-images-are-no-longer-pixilated-when-scale.patch diff --git a/community/cinnamon/PKGBUILD b/community/cinnamon/PKGBUILD index 9f6dd5dab..2e6f950a5 100644 --- a/community/cinnamon/PKGBUILD +++ b/community/cinnamon/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 85928 2013-03-09 00:52:51Z faidoc $ +# $Id: PKGBUILD 85957 2013-03-10 08:53:34Z bgyorgy $ # Maintainer: Alexandre Filgueira # Contributor: M0Rf30 # Contributor: unifiedlinux @@ -6,7 +6,7 @@ pkgname=cinnamon pkgver=1.7.2 -pkgrel=1 +pkgrel=2 pkgdesc="Linux desktop which provides advanced innovative features and a traditional user experience" arch=('i686' 'x86_64') url="http://cinnamon.linuxmint.com/" @@ -64,6 +64,17 @@ package() { cd ${srcdir}/linuxmint-Cinnamon* make DESTDIR="${pkgdir}" install + # Install autostart files for gnome-fallback-mount-helper + install -Dm644 /etc/xdg/autostart/gnome-fallback-mount-helper.desktop \ + "${pkgdir}/etc/xdg/autostart/gnome-fallback-mount-helper-cinnamon.desktop" + sed -i 's/^AutostartCondition=.*/AutostartCondition=GNOME3 if-session cinnamon/' \ + "${pkgdir}/etc/xdg/autostart/gnome-fallback-mount-helper-cinnamon.desktop" + + install -Dm644 /etc/xdg/autostart/gnome-fallback-mount-helper.desktop \ + "${pkgdir}/etc/xdg/autostart/gnome-fallback-mount-helper-cinnamon2d.desktop" + sed -i 's/^AutostartCondition=.*/AutostartCondition=GNOME3 if-session cinnamon2d/' \ + "${pkgdir}/etc/xdg/autostart/gnome-fallback-mount-helper-cinnamon2d.desktop" + # Python2 fix sed -i 's|#! /usr/bin/python|#! /usr/bin/python2|' \ "${pkgdir}/usr/bin/$pkgname-menu-editor" \ diff --git a/community/fcitx-mozc/PKGBUILD b/community/fcitx-mozc/PKGBUILD index 2e80d2c6f..5099cf551 100644 --- a/community/fcitx-mozc/PKGBUILD +++ b/community/fcitx-mozc/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 85344 2013-03-01 10:30:17Z andrea $ +# $Id: PKGBUILD 85959 2013-03-10 09:27:14Z fyan $ # Maintainer: Felix Yan # Contributor: ponsfoot ## Mozc compile option _bldtype=Release -_zipcoderel=201301 +_zipcoderel=201302 _protobuf_ver=2.4.1 _pkgbase=mozc @@ -13,7 +13,7 @@ pkgname=fcitx-mozc pkgdesc="Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)" pkgver=1.6.1187.102 _patchver=${pkgver}.3 -pkgrel=7 +pkgrel=8 arch=('i686' 'x86_64') url="http://code.google.com/p/mozc/" license=('custom') @@ -49,8 +49,8 @@ build() { patch -Np2 -i ${srcdir}/fcitx-mozc-${_patchver}.patch # Fix qt4 binary path - sed -i 's$<(qt_dir)/bin$/usr/lib/qt4/bin$' gui/*.gyp gui/*.gypi - sed -i 's$<(qt_dir_env)/bin$/usr/lib/qt4/bin$' gui/*.gyp gui/*.gypi + sed -i 's|(qt_dir)/bin|(qt_dir)/lib/qt4/bin|' gui/*.gyp{,i} + sed -i 's|(qt_dir_env)/bin|(qt_dir_env)/lib/qt4/bin|' gui/*.gyp{,i} # Generate zip code seed msg "Generating zip code seed..." @@ -106,7 +106,7 @@ package() { } md5sums=('e5246d17a81d2e942e9e8de0c3240c95' - '06bae0169219637b497054fb335017db' - '8121af1e16aea2a3899314db15679e7f' + '0ce9bd1663e320dc63bd2afffc475ab9' + 'e2a4bdf2d1384b124492a175d35b7867' 'ed436802019c9e1f40cc750eaf78f318' '3c947ef02d9bf3341192ba22916f3605') diff --git a/community/fwbuilder/PKGBUILD b/community/fwbuilder/PKGBUILD index 9192a79fa..cf0fc5819 100644 --- a/community/fwbuilder/PKGBUILD +++ b/community/fwbuilder/PKGBUILD @@ -2,10 +2,11 @@ # Maintainer: BlackIkeEagle # Contributor: Kevin Piche # Contributor: Tom Newsom +# vim: set ft=sh: pkgname=fwbuilder pkgver=5.1.0.3599 -pkgrel=3 +pkgrel=4 pkgdesc="Object-oriented GUI and set of compilers for various firewall platforms" url="http://www.fwbuilder.org/" arch=('i686' 'x86_64') @@ -14,8 +15,10 @@ depends=('libxslt' 'net-snmp' 'qt4') conflicts=('libfwbuilder') install=fwbuilder.install source=("http://sourceforge.net/projects/fwbuilder/files/Current_Packages/${pkgver%.*}/fwbuilder-${pkgver}.tar.gz" + 'fwbuilder.xml' 'fwbuilder-gcc47.patch') sha256sums=('452514a1ec0be1416bfca93603e6c89deb91d1a3a19671c64b5a8868a3743daf' + 'f8eacaa9895b17af3a1c148064b5ad8381b83f7983acb14687faef488ac8fede' 'd7c602d5b99c6e40403c0b02e34abf15de83802257ca5ce80ad53d486b692f27') build() { @@ -30,4 +33,6 @@ build() { package() { cd "${srcdir}/fwbuilder-${pkgver}" make INSTALL_ROOT="${pkgdir}" install + echo "MimeType=text/x-xml-fwbuilder;" >> "$pkgdir/usr/share/applications/${pkgname}.desktop" + install -Dm644 "$srcdir/fwbuilder.xml" "$pkgdir/usr/share/mime/packages/fwbuilder.xml" } diff --git a/community/fwbuilder/fwbuilder.install b/community/fwbuilder/fwbuilder.install index 45f0c2242..b2d479931 100644 --- a/community/fwbuilder/fwbuilder.install +++ b/community/fwbuilder/fwbuilder.install @@ -1,5 +1,7 @@ post_install() { xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q /usr/share/applications &> /dev/null + update-mime-database usr/share/mime &> /dev/null } post_upgrade() { diff --git a/community/fwbuilder/fwbuilder.xml b/community/fwbuilder/fwbuilder.xml new file mode 100644 index 000000000..31db9f1f1 --- /dev/null +++ b/community/fwbuilder/fwbuilder.xml @@ -0,0 +1,11 @@ + + + + + FWBuilder configuration file + + + + + + diff --git a/community/geany-plugins/PKGBUILD b/community/geany-plugins/PKGBUILD index 97746241d..f9d4876e8 100644 --- a/community/geany-plugins/PKGBUILD +++ b/community/geany-plugins/PKGBUILD @@ -1,29 +1,30 @@ -# $Id: PKGBUILD 81735 2012-12-27 22:27:45Z arodseth $ +# $Id: PKGBUILD 86001 2013-03-10 22:54:56Z arodseth $ # Maintainer: Alexander Rødseth # Contributor: Angel 'angvp' Velasquez # Contributor: djgera # Contributor: Patrick Melo pkgname=geany-plugins -pkgver=1.22 -pkgrel=5 -pkgdesc='Combined plugins release for Geany' +pkgver=1.23 +pkgrel=1 +pkgdesc='Plugins for Geany' arch=('x86_64' 'i686') url='http://plugins.geany.org/' license=('GPL') -depends=('geany=1.22' 'lua51' 'gtkspell' 'libwebkit' 'ctpl' 'gpgme' 'vte' 'desktop-file-utils' 'gtk-update-icon-cache') +depends=("geany=$pkgver" 'gtkspell' 'libwebkit' 'ctpl' 'gpgme' 'vte' + 'desktop-file-utils' 'gtk-update-icon-cache' 'lua51') makedepends=('intltool' 'vala' 'gdb' 'cppcheck') optdepends=('hspell: hebrew spell checker') options=('!libtool') -install=geany-plugins.install -source=("http://plugins.geany.org/geany-plugins/$pkgname-$pkgver.tar.bz2") -sha256sums=('a0dcf0cb00ac260670ef8fae682aade60c7c3075c88121fd21f3aecdff84e1ce') +install="$pkgname.install" +source=("http://plugins.geany.org/$pkgname/$pkgname-$pkgver.tar.bz2") +sha256sums=('ff26860edd1cbaea88c73bd8c2bd02f9ba04046674f05d3696baf66582e2bf58') build() { cd "$srcdir/$pkgname-$pkgver" - # the geanylua plugin currently doesn't work with lua 5.2, only 5.1 - ./configure --prefix=/usr --libexecdir=/usr/lib # --disable-geanylua + # The geanylua plugin currently doesn't work with lua 5.2, only 5.1 + ./configure --prefix=/usr --libexecdir=/usr/lib make } diff --git a/community/geany/PKGBUILD b/community/geany/PKGBUILD index 90c379711..b6a270944 100644 --- a/community/geany/PKGBUILD +++ b/community/geany/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 83915 2013-02-06 14:27:16Z arodseth $ +# $Id: PKGBUILD 86000 2013-03-10 22:54:45Z arodseth $ # Maintainer: Alexander Rødseth # Contributor: Angel Velasquez # Contributor: Ionut Biru @@ -6,32 +6,35 @@ # Contributor: Allan McRae pkgname=geany -pkgver=1.22 -pkgrel=3 +pkgver=1.23 +pkgrel=1 pkgdesc='Fast and lightweight IDE' arch=('x86_64' 'i686') url="http://www.geany.org/" license=('GPL') depends=('gtk2' 'hicolor-icon-theme' 'desktop-file-utils') makedepends=('perlxml' 'setconf' 'intltool') -optdepends=('vte: for terminal support' 'python2') -install=geany.install -source=("http://download.geany.org/$pkgname-$pkgver.tar.bz2") +optdepends=('vte: for terminal support' + 'geany-plugins: various extra features' + 'python2') +install="$pkgname.install" options=('!libtool') -sha256sums=('901a35a7395ef10a80fb10b3ab63bae3871693a4e82d56388e9521a27877577e') +source=("http://download.geany.org/$pkgname-$pkgver.tar.bz2") +sha256sums=('cdd4a772694803c837ae59e56f7bdc2faba174509317211f522e7d25dfcbe8b0') build() { cd "$srcdir/$pkgname-$pkgver" - msg2 "Configuring..." ./configure --prefix=/usr - msg2 "Compiling..." make - msg2 "Python2 fix..." + + # Python2 fix sed -i '0,/on/s//on2/' data/templates/files/main.py - msg2 "Fixing FS#10318..." + + # Fix for FS#10318 setconf geany.desktop MimeType '' - msg2 "Enabling syntax highlighting for PKGBUILD files..." + + # Syntax highlighting for PKGBUILD files sed -i 's/Sh=/Sh=PKGBUILD;/' data/filetype_extensions.conf } diff --git a/community/gtk2hs-buildtools/PKGBUILD b/community/gtk2hs-buildtools/PKGBUILD index f9d02a1fa..be7cbc78a 100644 --- a/community/gtk2hs-buildtools/PKGBUILD +++ b/community/gtk2hs-buildtools/PKGBUILD @@ -1,9 +1,9 @@ -# $Id: PKGBUILD 83991 2013-02-08 04:15:23Z td123 $ +# $Id: PKGBUILD 85986 2013-03-10 20:14:17Z spupykin $ # Maintainer: Sergej Pupykin pkgname=gtk2hs-buildtools -pkgver=0.12.3.1 -pkgrel=4 +pkgver=0.12.4 +pkgrel=1 pkgdesc="Tools to build the Gtk2Hs suite of User Interface libraries." url="http://hackage.haskell.org/package/gtk2hs-buildtools" license=('GPL2') @@ -12,16 +12,11 @@ makedepends=('ghc' 'alex' 'happy' 'haskell-random') depends=('gmp') options=('strip') provides=('haskell-gtk2hs-buildtools') -source=(http://hackage.haskell.org/packages/archive/gtk2hs-buildtools/$pkgver/gtk2hs-buildtools-$pkgver.tar.gz - '0001-fix-for-ghc-7.6.1-changes.patch') -md5sums=('612611d831635024c953d2817b124e29' - 'b6551d8085c97bc2c6600ab397833101') +source=(http://hackage.haskell.org/packages/archive/gtk2hs-buildtools/$pkgver/gtk2hs-buildtools-$pkgver.tar.gz) +md5sums=('ad3d78bf7c25fdb4c713c3528d137a81') build() { cd ${srcdir}/gtk2hs-buildtools-$pkgver - - patch -Np1 -i ${srcdir}/0001-fix-for-ghc-7.6.1-changes.patch - runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname} runhaskell Setup build } diff --git a/community/kyotocabinet/PKGBUILD b/community/kyotocabinet/PKGBUILD index 34cb5c73a..4a748bee2 100644 --- a/community/kyotocabinet/PKGBUILD +++ b/community/kyotocabinet/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 80585 2012-11-26 11:05:40Z fyan $ +# $Id: PKGBUILD 85954 2013-03-10 07:13:55Z fyan $ # Maintainer: Felix Yan # Contributor: Alexander Duscheleit # Contributor: Joaquim Pedro (osmano807) pkgname=kyotocabinet pkgver=1.2.76 -pkgrel=1 +pkgrel=2 pkgdesc="a modern implementation of DBM in C++" arch=('i686' 'x86_64') url="http://fallabs.com/kyotocabinet" diff --git a/community/libcec/PKGBUILD b/community/libcec/PKGBUILD index 8eac02749..32c493e01 100644 --- a/community/libcec/PKGBUILD +++ b/community/libcec/PKGBUILD @@ -1,9 +1,10 @@ -# $Id: PKGBUILD 85731 2013-03-05 21:06:38Z idevolder $ +# $Id: PKGBUILD 85975 2013-03-10 17:23:41Z idevolder $ # Maintainer: BlackIkeEagle # Contributor: Philippe Cherel +# vim: ft=sh: pkgname=libcec -pkgver=2.1.0 +pkgver=2.1.1 pkgrel=1 pkgdesc="Pulse-Eight's libcec for the Pulse-Eight USB-CEC adapter" arch=('i686' 'x86_64') @@ -11,9 +12,9 @@ url="https://github.com/Pulse-Eight/libcec" license=('GPL') depends=('udev' 'lockdev') source=("$pkgname-$pkgver.tar.gz::https://github.com/Pulse-Eight/libcec/tarball/$pkgname-$pkgver") -_srcfolder=Pulse-Eight-libcec-5984da4 +_srcfolder=Pulse-Eight-libcec-605d913 options=(!libtool) -sha256sums=('b0589450a25566d34b84aff6bc899fd823dba8ffebcfe11a3f58924c252367fe') +sha256sums=('085cabf38bbe82c0a1c78fc4a0cc318b3c4f5fadae325b3d648821d2a4bf694d') build() { mv "$_srcfolder" "$pkgname-$pkgver" diff --git a/community/rsyslog/PKGBUILD b/community/rsyslog/PKGBUILD index 8d3ca9f28..711137734 100644 --- a/community/rsyslog/PKGBUILD +++ b/community/rsyslog/PKGBUILD @@ -1,17 +1,17 @@ -# $Id: PKGBUILD 81219 2012-12-13 11:58:39Z spupykin $ +# $Id: PKGBUILD 85988 2013-03-10 20:14:44Z spupykin $ # Maintainer: Sergej Pupykin pkgname=rsyslog -pkgver=7.2.4 +pkgver=7.2.6 pkgrel=1 pkgdesc="An enhanced multi-threaded syslogd with a focus on security and reliability" url="http://www.rsyslog.com/" arch=('i686' 'x86_64') license=('GPL3') depends=('zlib' 'libestr' 'libee' 'json-c') -makedepends=('postgresql-libs>=8.4.1' 'libmysqlclient' 'net-snmp' 'gnutls') +makedepends=('postgresql-libs>=8.4.1' 'libmariadbclient' 'net-snmp' 'gnutls') optdepends=('postgresql-libs: PostgreSQL Database Support' - 'libmysqlclient: MySQL Database Support' + 'libmariadbclient: MySQL Database Support' 'net-snmp' 'gnutls') backup=('etc/rsyslog.conf' @@ -22,7 +22,7 @@ source=("http://www.rsyslog.com/files/download/rsyslog/rsyslog-$pkgver.tar.gz" 'rsyslog' 'rsyslog.logrotate' 'rsyslog.conf.d') -md5sums=('7fb607313ec534a4352da7aa2e0084ec' +md5sums=('2b2bfbc3f87fe85add651dc07a6f21ea' 'a18bbcbb6ebdaa13a6ec6d9f3d9eb2da' '8065db4bef3061a4f000ba58779f6829' '18565f38a4445136446a31a3c95ffc3e') @@ -46,7 +46,7 @@ package() { make install DESTDIR=${pkgdir} # Install Daemons and Configuration Files install -D -m755 ${srcdir}/${pkgname} ${pkgdir}/etc/rc.d/${pkgname}d - install -D -m644 ${pkgname}.conf ${pkgdir}/etc/${pkgname}.conf + install -D -m644 doc/${pkgname}-example.conf ${pkgdir}/etc/${pkgname}.conf install -D -m644 $srcdir/${pkgname}.logrotate ${pkgdir}/etc/logrotate.d/${pkgname} install -D -m644 ${srcdir}/${pkgname}.conf.d ${pkgdir}/etc/conf.d/${pkgname} diff --git a/community/squeak-vm/PKGBUILD b/community/squeak-vm/PKGBUILD index 58fba3e21..2ff380d0c 100644 --- a/community/squeak-vm/PKGBUILD +++ b/community/squeak-vm/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 76322 2012-09-15 22:08:09Z jsteel $ +# $Id: PKGBUILD 85994 2013-03-10 21:24:51Z jsteel $ # Maintainer: Jonathan Steel # Contributor: Piero Sartini # Contributor: Cilyan Olowen @@ -6,10 +6,9 @@ # Contributor: kxmd pkgname=squeak-vm -pkgver=4.10.2.2602 +pkgver=4.10.2.2614 pkgrel=1 -pkgdesc="A full-featured implementation of the Smalltalk programming language - and environment" +pkgdesc="Full-featured implementation of the Smalltalk programming language and environment" arch=('i686' 'x86_64') url="http://squeakvm.org" license=('custom:MIT' 'APACHE') @@ -21,7 +20,7 @@ optdepends=('speex: for ogg plugin' 'gstreamer0.10: for gstreamer plugin' 'libpulse: for pulse plugin' 'squeak-image: for the full Squeak environment') source=(http://squeakvm.org/unix/release/Squeak-$pkgver-src.tar.gz) -md5sums=('23b48480581c5a1c1bccf12e93611faf') +md5sums=('8a5cb1d6899d55df56154fab8716e034') build() { cd "$srcdir"/Squeak-$pkgver-src/ @@ -35,7 +34,7 @@ build() { package() { cd "$srcdir"/Squeak-$pkgver-src - make DESTDIR="$pkgdir" install + make DESTDIR="$pkgdir"/ install install -Dm644 "$srcdir"/Squeak-$pkgver-src/unix/doc/LICENSE \ "$pkgdir"/usr/share/licenses/squeak-vm/LICENSE diff --git a/community/sysstat/PKGBUILD b/community/sysstat/PKGBUILD index 12bb3329e..41dab2565 100644 --- a/community/sysstat/PKGBUILD +++ b/community/sysstat/PKGBUILD @@ -1,9 +1,9 @@ -# $Id: PKGBUILD 81587 2012-12-24 15:03:05Z spupykin $ +# $Id: PKGBUILD 85990 2013-03-10 20:15:07Z spupykin $ # Maintainer: Sergej Pupykin # Contributor: Martin Devera pkgname=sysstat -pkgver=10.1.3 +pkgver=10.1.4 pkgrel=1 pkgdesc="a collection of performance monitoring tools (iostat,isag,mpstat,pidstat,sadf,sar)" arch=('i686' 'x86_64') @@ -18,7 +18,7 @@ backup=('etc/conf.d/sysstat' source=(http://pagesperso-orange.fr/sebastien.godard/$pkgname-$pkgver.tar.gz sysstat sysstat.service) -md5sums=('e08b5665956930ad12b10ed6e0a08b10' +md5sums=('0a8e9f69c66fc6737e6645e22eed3275' '3ce41ebf7330aba01e70b38658afed1f' '12ba479c606620193e8b7c6e982d5088') diff --git a/core/logrotate/PKGBUILD b/core/logrotate/PKGBUILD index 821ecfa71..431a6901a 100644 --- a/core/logrotate/PKGBUILD +++ b/core/logrotate/PKGBUILD @@ -1,15 +1,15 @@ -# $Id: PKGBUILD 171604 2012-11-20 02:56:24Z allan $ +# $Id: PKGBUILD 179845 2013-03-10 12:44:09Z bluewind $ # Maintainer: Pierre Schmitz pkgname=logrotate -pkgver=3.8.2 -pkgrel=2 +pkgver=3.8.3 +pkgrel=1 pkgdesc="Rotates system logs automatically" arch=('i686' 'x86_64') url="https://fedorahosted.org/logrotate/" license=('GPL') groups=('base') -depends=('popt' 'cron' 'gzip') +depends=('popt' 'gzip' 'acl') optdepends=('cron: scheduled log rotation') backup=('etc/logrotate.conf') source=("https://fedorahosted.org/releases/l/o/logrotate/logrotate-${pkgver}.tar.gz" @@ -17,30 +17,30 @@ source=("https://fedorahosted.org/releases/l/o/logrotate/logrotate-${pkgver}.tar 'paths.patch' 'logrotate.conf' 'logrotate.cron.daily') -md5sums=('ddd4dcf28c38b3ac6bc6ff4e0148308a' +md5sums=('df67c8bda9139131d919931da443794d' 'cd76976b5ce37d328b452c806b55a015' 'e76526bcd6fc33c9d921e1cb1eff1ffb' '86209d257c8b8bc0ae34d6f6ef057c0f' 'aa8ac8283908b6114483a293adcb650f') build() { - cd "$srcdir/${pkgname}-${pkgver}" + cd "$srcdir/${pkgname}-${pkgver}" - patch -p0 -i "$srcdir/noasprintf.patch" - patch -p0 -i "$srcdir/paths.patch" + patch -p0 -i "$srcdir/noasprintf.patch" + patch -p0 -i "$srcdir/paths.patch" - make RPM_OPT_FLAGS="$CFLAGS" EXTRA_LDFLAGS="$LDFLAGS" + make WITH_ACL=yes RPM_OPT_FLAGS="$CFLAGS" EXTRA_LDFLAGS="$LDFLAGS" } check() { - cd "$srcdir/${pkgname}-${pkgver}" - make test + cd "$srcdir/${pkgname}-${pkgver}" + make test } package() { - cd "$srcdir/${pkgname}-${pkgver}" - make PREFIX="$pkgdir" MANDIR="/usr/share/man" install + cd "$srcdir/${pkgname}-${pkgver}" + make PREFIX="$pkgdir" MANDIR="/usr/share/man" install - install -Dm644 "$srcdir/logrotate.conf" "$pkgdir/etc/logrotate.conf" - install -Dm744 "$srcdir/logrotate.cron.daily" "$pkgdir/etc/cron.daily/logrotate" + install -Dm644 "$srcdir/logrotate.conf" "$pkgdir/etc/logrotate.conf" + install -Dm744 "$srcdir/logrotate.cron.daily" "$pkgdir/etc/cron.daily/logrotate" } diff --git a/core/openldap/PKGBUILD b/core/openldap/PKGBUILD index 3da92bf98..283f230f8 100644 --- a/core/openldap/PKGBUILD +++ b/core/openldap/PKGBUILD @@ -1,21 +1,18 @@ -# $Id: PKGBUILD 176949 2013-02-03 00:16:48Z eric $ +# $Id: PKGBUILD 179825 2013-03-10 01:22:10Z eric $ # Maintainer: pkgbase=openldap pkgname=('libldap' 'openldap') -pkgver=2.4.33 -pkgrel=3 +pkgver=2.4.34 +pkgrel=1 arch=('i686' 'x86_64') url="http://www.openldap.org/" license=('custom') makedepends=('libltdl' 'libsasl' 'e2fsprogs' 'util-linux') options=('!makeflags') source=(ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${pkgbase}-${pkgver}.tgz - slapd slapd.default slapd.service slapd.tmpfiles - ntlm.patch) -sha1sums=('0cea642ba2dae1eb719da41bfedb9eba72ad504d' - 'b684038a7f5bc7d2ba470b2d16ee47b5aae64c65' - 'd89b8a533045123f1ab46c9c430cf132d58a20a4' + slapd.service slapd.tmpfiles ntlm.patch) +sha1sums=('39c81f32b8c7af1e20047535f0b9ea894235c588' '9c7f3441e6a6ee13cdcfe8d965081c7a574c3393' 'f86a82e35ebe15026980467c9dee4007e686b795' 'e4afd9f1c810ef4c4cd8fe1101dfe5887f2b7eef') @@ -71,8 +68,8 @@ package_libldap() { package_openldap() { pkgdesc="Lightweight Directory Access Protocol (LDAP) client and server" - depends=("libldap>=${pkgver}" 'libltdl' 'util-linux') - backup=('etc/openldap/slapd.conf' 'etc/conf.d/slapd') + depends=("libldap>=${pkgver}" 'libltdl') + backup=('etc/openldap/slapd.conf') options=('!libtool' 'emptydirs') install=openldap.install @@ -95,8 +92,6 @@ package_openldap() { install -dm700 -o 439 -g 439 "${pkgdir}"/var/lib/openldap install -dm700 -o 439 -g 439 "${pkgdir}"/etc/openldap/slapd.d - install -Dm755 "${srcdir}"/slapd "${pkgdir}"/etc/rc.d/slapd - install -Dm644 "${srcdir}"/slapd.default "${pkgdir}"/etc/conf.d/slapd install -Dm644 "${srcdir}"/slapd.service "${pkgdir}"/usr/lib/systemd/system/slapd.service install -Dm644 "${srcdir}"/slapd.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/slapd.conf install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE diff --git a/core/openldap/slapd b/core/openldap/slapd deleted file mode 100755 index 604f6b275..000000000 --- a/core/openldap/slapd +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions - -[ -f "/etc/conf.d/slapd" ] && . /etc/conf.d/slapd - -PID=`pidof -o %PPID /usr/sbin/slapd` -case "$1" in - start) - stat_busy "Starting OpenLDAP" - [ ! -d /run/openldap ] && install -d -m755 -o ldap -g ldap /run/openldap - if [ -z "$PID" ]; then - if [ -z "$SLAPD_SERVICES" ]; then - /usr/sbin/slapd -u ldap -g ldap $SLAPD_OPTIONS - else - /usr/sbin/slapd -u ldap -g ldap -h "$SLAPD_SERVICES" $SLAPD_OPTIONS - fi - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon slapd - stat_done - fi - else - stat_fail - fi - ;; - stop) - stat_busy "Stopping OpenLDAP" - [ ! -z "$PID" ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm -f /run/openldap/slapd.pid - rm -f /run/openldap/slapd.args - rm_daemon slapd - stat_done - fi - ;; - restart) - $0 stop - sleep 3 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" -esac -exit 0 diff --git a/core/openldap/slapd.default b/core/openldap/slapd.default deleted file mode 100644 index 72ae2a6a7..000000000 --- a/core/openldap/slapd.default +++ /dev/null @@ -1,6 +0,0 @@ -# slapd normally serves ldap only on all TCP-ports 389. slapd can also -# service requests on TCP-port 636 (ldaps) and requests via unix -# sockets. -# Example usage: -#SLAPD_SERVICES="ldap://127.0.0.1:389/ ldaps:/// ldapi:///" -SLAPD_OPTIONS="" diff --git a/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch b/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch deleted file mode 100644 index 1404460df..000000000 --- a/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch +++ /dev/null @@ -1,83 +0,0 @@ -From bb249b0b26c2e79a6f55355ef94889070f07fd21 Mon Sep 17 00:00:00 2001 -From: Niko Tyni -Date: Thu, 28 Apr 2011 09:18:54 +0300 -Subject: [PATCH] Append CFLAGS and LDFLAGS to their Config.pm counterparts in - EU::CBuilder - -Since ExtUtils::CBuilder 0.27_04 (bleadperl commit 06e8058f27e4), -CFLAGS and LDFLAGS from the environment have overridden the Config.pm -ccflags and ldflags settings. This can cause binary incompatibilities -between the core Perl and extensions built with EU::CBuilder. - -Append to the Config.pm values rather than overriding them. ---- - .../lib/ExtUtils/CBuilder/Base.pm | 6 +++- - dist/ExtUtils-CBuilder/t/04-base.t | 25 +++++++++++++++++++- - 2 files changed, 28 insertions(+), 3 deletions(-) - -diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm -index b572312..2255c51 100644 ---- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm -+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm -@@ -40,11 +40,13 @@ sub new { - $self->{config}{$k} = $v unless exists $self->{config}{$k}; - } - $self->{config}{cc} = $ENV{CC} if defined $ENV{CC}; -- $self->{config}{ccflags} = $ENV{CFLAGS} if defined $ENV{CFLAGS}; -+ $self->{config}{ccflags} = join(" ", $self->{config}{ccflags}, $ENV{CFLAGS}) -+ if defined $ENV{CFLAGS}; - $self->{config}{cxx} = $ENV{CXX} if defined $ENV{CXX}; - $self->{config}{cxxflags} = $ENV{CXXFLAGS} if defined $ENV{CXXFLAGS}; - $self->{config}{ld} = $ENV{LD} if defined $ENV{LD}; -- $self->{config}{ldflags} = $ENV{LDFLAGS} if defined $ENV{LDFLAGS}; -+ $self->{config}{ldflags} = join(" ", $self->{config}{ldflags}, $ENV{LDFLAGS}) -+ if defined $ENV{LDFLAGS}; - - unless ( exists $self->{config}{cxx} ) { - my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/); -diff --git a/dist/ExtUtils-CBuilder/t/04-base.t b/dist/ExtUtils-CBuilder/t/04-base.t -index c3bf6b5..1bb15aa 100644 ---- a/dist/ExtUtils-CBuilder/t/04-base.t -+++ b/dist/ExtUtils-CBuilder/t/04-base.t -@@ -1,7 +1,7 @@ - #! perl -w - - use strict; --use Test::More tests => 50; -+use Test::More tests => 64; - use Config; - use Cwd; - use File::Path qw( mkpath ); -@@ -326,6 +326,29 @@ is_deeply( $mksymlists_args, - "_prepare_mksymlists_args(): got expected arguments for Mksymlists", - ); - -+my %testvars = ( -+ CFLAGS => 'ccflags', -+ LDFLAGS => 'ldflags', -+); -+ -+while (my ($VAR, $var) = each %testvars) { -+ local $ENV{$VAR}; -+ $base = ExtUtils::CBuilder::Base->new( quiet => 1 ); -+ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" ); -+ isa_ok( $base, 'ExtUtils::CBuilder::Base' ); -+ like($base->{config}{$var}, qr/\Q$Config{$var}/, -+ "honours $var from Config.pm"); -+ -+ $ENV{$VAR} = "-foo -bar"; -+ $base = ExtUtils::CBuilder::Base->new( quiet => 1 ); -+ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" ); -+ isa_ok( $base, 'ExtUtils::CBuilder::Base' ); -+ like($base->{config}{$var}, qr/\Q$ENV{$VAR}/, -+ "honours $VAR from the environment"); -+ like($base->{config}{$var}, qr/\Q$Config{$var}/, -+ "doesn't override $var from Config.pm with $VAR from the environment"); -+} -+ - ##### - - for ($source_file, $object_file, $lib_file) { --- -1.7.4.4 - diff --git a/core/perl/CVE-2013-1667.patch b/core/perl/CVE-2013-1667.patch new file mode 100644 index 000000000..8a8f98d32 --- /dev/null +++ b/core/perl/CVE-2013-1667.patch @@ -0,0 +1,50 @@ +commit 9ec0b001b87d32f1d39b038b72846a5c20417be3 (refs/remotes/origin/maint-5.16) +Author: Andy Dougherty +Date: Wed Jan 16 12:30:43 2013 -0500 + + Avoid wraparound when casting unsigned size_t to signed ssize_t. + + Practically, this only affects a perl compiled with 64-bit IVs on a 32-bit + system. In that instance a value of count >= 2**31 would turn negative + when cast to (ssize_t). + +diff --git a/perlio.c b/perlio.c +index 7782728..cccfdcd 100644 +--- a/perlio.c ++++ b/perlio.c +@@ -2164,7 +2164,7 @@ PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) + SSize_t avail = PerlIO_get_cnt(f); + SSize_t take = 0; + if (avail > 0) +- take = ((SSize_t)count < avail) ? (SSize_t)count : avail; ++ take = (((SSize_t) count >= 0) && ((SSize_t)count < avail)) ? (SSize_t)count : avail; + if (take > 0) { + STDCHAR *ptr = PerlIO_get_ptr(f); + Copy(ptr, buf, take, STDCHAR); +@@ -4098,7 +4098,7 @@ PerlIOBuf_unread(pTHX_ PerlIO *f, const void *vbuf, Size_t count) + */ + b->posn -= b->bufsiz; + } +- if (avail > (SSize_t) count) { ++ if ((SSize_t) count >= 0 && avail > (SSize_t) count) { + /* + * If we have space for more than count, just move count + */ +@@ -4148,7 +4148,7 @@ PerlIOBuf_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) + } + while (count > 0) { + SSize_t avail = b->bufsiz - (b->ptr - b->buf); +- if ((SSize_t) count < avail) ++ if ((SSize_t) count >= 0 && (SSize_t) count < avail) + avail = count; + if (flushptr > buf && flushptr <= buf + avail) + avail = flushptr - buf; +@@ -4423,7 +4423,7 @@ PerlIOPending_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) + { + SSize_t avail = PerlIO_get_cnt(f); + SSize_t got = 0; +- if ((SSize_t)count < avail) ++ if ((SSize_t) count >= 0 && (SSize_t)count < avail) + avail = count; + if (avail > 0) + got = PerlIOBuf_read(aTHX_ f, vbuf, avail); diff --git a/core/perl/PKGBUILD b/core/perl/PKGBUILD index 40f3545bc..31f7520d3 100644 --- a/core/perl/PKGBUILD +++ b/core/perl/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 177560 2013-02-07 09:32:23Z bluewind $ +# $Id: PKGBUILD 179840 2013-03-10 11:43:57Z bluewind $ # Maintainer: Florian Pritz # Contributor: Angel Velasquez # Contributor: kevin @@ -7,7 +7,7 @@ pkgname=perl pkgver=5.16.2 -pkgrel=3 +pkgrel=4 pkgdesc="A highly capable, feature-rich programming language" arch=(i686 x86_64) license=('GPL' 'PerlArtistic') @@ -16,6 +16,7 @@ groups=('base') depends=('gdbm' 'db' 'coreutils' 'glibc' 'sh') source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2 cgi-cr-escaping.diff + CVE-2013-1667.patch perlbin.sh perlbin.csh provides.pl) @@ -23,10 +24,10 @@ install=perl.install options=('makeflags' '!purge') md5sums=('2818ab01672f005a4e552a713aa27b08' '0486659c9eefe682364a3e364d814296' + '3725d479a42547c6bae33b793b948054' '5ed2542fdb9a60682f215bd33701e61a' '1f0cbbee783e8a6d32f01be5118e0d5e' '999c3eea6464860704abbb055a0f0896') - # workaround to let the integrity check find the correct provides array if [[ ${0##*/} = "parse_pkgbuilds.sh" ]]; then true && provides=($(bsdtar -q -O -xf "/srv/ftp/pool/packages/$pkgname-$pkgver-$pkgrel-$CARCH.pkg.tar.xz" .PKGINFO | sed -rn 's#^provides = (.*)#\1#p')) @@ -36,6 +37,7 @@ build() { cd ${srcdir}/${pkgname}-${pkgver} patch -i "$srcdir/cgi-cr-escaping.diff" -p1 + patch -i "$srcdir/CVE-2013-1667.patch" -p1 if [ "${CARCH}" = "x86_64" ]; then # for x86_64 diff --git a/extra/glamor-egl/PKGBUILD b/extra/glamor-egl/PKGBUILD new file mode 100644 index 000000000..32ea75b3d --- /dev/null +++ b/extra/glamor-egl/PKGBUILD @@ -0,0 +1,55 @@ +# $Id: PKGBUILD 179700 2013-03-09 11:48:07Z andyrtr $ +# Maintainer: Jan de Groot +# Contributor: Eugeni Dodonov + +pkgname=glamor-egl +pkgver=0.5.0 +pkgrel=1 +pkgdesc='OpenGL based 2D rendering acceleration library ' +arch=('i686' 'x86_64') +url="http://xorg.freedesktop.org/" +license=('custom') +depends=('mesa-libgl') +makedepends=('xorg-server-devel') +source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2 + glamor_utils.h glamor_priv.h glapi.h + compat-api.h compiler.h glamor_debug.h glamor_gl_dispatch.h glamor_glext.h + git-fixes.patch) +conflicts=('glamir-git') +options=('!libtool') +sha256sums=('5dc8679ccb3e42bf431b6316c7907b9df2db89745d523e04721f34aee6c84991' + 'fb7db610451d8bb0baaabe3ac618794f535924ac08f62159b08a82ac90a1ed4a' + '6ad1b6349325be84aa9fe6f0b3224128f11bcf00a91a7080e40cd7b58a83137c' + '5c148a18607f94fcdfebe2838aa77d190cb913e05579a9676c2520219a5e2a6a' + '1a5c1059a3757047de064ccd952ab637b73e7e2d55cbccd6dafc60b57aaed1d0' + 'f883c329e7ec94afafa646b866eaab8a5616761b5ffe2b2837c75d403917944a' + 'fc3d937f2cb996586d3a9cc7427050d04d2d19d3f745055cc9d3556428a7cf93' + 'a7fac65474af636995d0181dbf7f8f091d8657260162eb172ae816b75ad98b54' + 'dcf38a7ac303c1636a3b1b7810dcb6ee65ba7e81b6e590840e164ce0e28010dc' + '5c0d1dd79a8b50f6720ba2d4dbe288dca11cc19131bb502c6ad2920298ccf843') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + + # add missing headers - tarball creation buggy + cp $srcdir/*.h src/ + + patch -Np1 -i ${srcdir}/git-fixes.patch + + autoreconf -vfi + + ./configure --prefix=/usr \ + --disable-static \ + --enable-glamor-gles2 \ + --enable-glx-tls \ + #--help + + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make "DESTDIR=${pkgdir}" install + install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}" + install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/" +} diff --git a/extra/glamor-egl/compat-api.h b/extra/glamor-egl/compat-api.h new file mode 100644 index 000000000..1608478f8 --- /dev/null +++ b/extra/glamor-egl/compat-api.h @@ -0,0 +1,107 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * 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. + * + * Author: Dave Airlie + */ + +/* this file provides API compat between server post 1.13 and pre it, + it should be reused inside as many drivers as possible */ +#ifndef COMPAT_API_H +#define COMPAT_API_H + +#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR +#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum] +#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p +#endif + +#ifndef XF86_HAS_SCRN_CONV +#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum] +#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex] +#endif + +#ifndef XF86_SCRN_INTERFACE + +#define SCRN_ARG_TYPE int +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr scrn = xf86Screens[(arg1)] + +#define SCREEN_ARG_TYPE int +#define SCREEN_PTR(arg1) ScreenPtr screen = screenInfo.screens[(arg1)] + +#define SCREEN_INIT_ARGS_DECL int scrnIndex, ScreenPtr screen, int argc, char **argv + +#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer timeout, pointer read_mask +#define BLOCKHANDLER_ARGS arg, blockData, timeout, read_mask + +#define WAKEUPHANDLER_ARGS_DECL int arg, pointer wakeupData, unsigned long result, pointer read_mask +#define WAKEUPHANDLER_ARGS arg, wakeupData, result, read_mask + +#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr screen +#define CLOSE_SCREEN_ARGS scrnIndex, screen + +#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags +#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0 + +#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags +#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0 + +#define FREE_SCREEN_ARGS_DECL int arg, int flags +#define FREE_SCREEN_ARGS arg, flags + +#define VT_FUNC_ARGS_DECL int arg, int flags +#define VT_FUNC_ARGS(flags) scrn->scrnIndex, (flags) + +#define XF86_ENABLEDISABLEFB_ARG(x) ((x)->scrnIndex) + +#else +#define SCRN_ARG_TYPE ScrnInfoPtr +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr scrn = (arg1) + +#define SCREEN_ARG_TYPE ScreenPtr +#define SCREEN_PTR(arg1) ScreenPtr screen = (arg1) + +#define SCREEN_INIT_ARGS_DECL ScreenPtr screen, int argc, char **argv + +#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer timeout, pointer read_mask +#define BLOCKHANDLER_ARGS arg, timeout, read_mask + +#define WAKEUPHANDLER_ARGS_DECL ScreenPtr arg, unsigned long result, pointer read_mask +#define WAKEUPHANDLER_ARGS arg, result, read_mask + +#define CLOSE_SCREEN_ARGS_DECL ScreenPtr screen +#define CLOSE_SCREEN_ARGS screen + +#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y +#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y + +#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode +#define SWITCH_MODE_ARGS(arg, m) arg, m + +#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg +#define FREE_SCREEN_ARGS arg + +#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg +#define VT_FUNC_ARGS(flags) scrn + +#define XF86_ENABLEDISABLEFB_ARG(x) (x) + +#endif +#endif diff --git a/extra/glamor-egl/compiler.h b/extra/glamor-egl/compiler.h new file mode 100644 index 000000000..fa2895976 --- /dev/null +++ b/extra/glamor-egl/compiler.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Intel Corporation + * + * 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. + * + * Authors: + * Chris Wilson + * + * Copied from sna + * + */ + +#ifndef _GLAMOR_COMPILER_H_ +#define _GLAMOR_COMPILER_H_ + +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define likely(expr) (__builtin_expect (!!(expr), 1)) +#define unlikely(expr) (__builtin_expect (!!(expr), 0)) +#define noinline __attribute__((noinline)) +#define fastcall __attribute__((regparm(3))) +#define must_check __attribute__((warn_unused_result)) +#define constant __attribute__((const)) +#else +#define likely(expr) (expr) +#define unlikely(expr) (expr) +#define noinline +#define fastcall +#define must_check +#define constant +#endif + +#ifdef HAVE_VALGRIND +#define VG(x) x +#else +#define VG(x) +#endif + +#define VG_CLEAR(s) VG(memset(&s, 0, sizeof(s))) + +#define COMPILE_TIME_ASSERT(E) ((void)sizeof(char[1 - 2*!(E)])) + +#endif /* _SNA_COMPILER_H_ */ diff --git a/extra/glamor-egl/git-fixes.patch b/extra/glamor-egl/git-fixes.patch new file mode 100644 index 000000000..4cf1b9fa0 --- /dev/null +++ b/extra/glamor-egl/git-fixes.patch @@ -0,0 +1,177 @@ +From beeddaae1da253d1a442228a75f80ef40a0204ac Mon Sep 17 00:00:00 2001 +From: Michel Dänzer +Date: Wed, 31 Oct 2012 15:56:00 +0000 +Subject: Don't use glBlitFramebufferEXT for overlapping copies. + +According to the GL_EXT_framebuffer_blit spec, the result of doing so is +undefined. But we need well-defined results. :) + +Signed-off-by: Michel Dänzer +--- +diff --git a/src/glamor_copyarea.c b/src/glamor_copyarea.c +index 7d06833..4e6f953 100644 +--- a/src/glamor_copyarea.c ++++ b/src/glamor_copyarea.c +@@ -318,7 +318,8 @@ __glamor_copy_n_to_n(DrawablePtr src, + dx, dy, + src_pixmap, dst_pixmap); + #ifndef GLAMOR_GLES2 +- if ((overlaped || glamor_priv->state != RENDER_STATE ++ if (!overlaped && ++ (glamor_priv->state != RENDER_STATE + || !src_pixmap_priv->base.gl_tex || !dst_pixmap_priv->base.gl_tex) + && glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx, + dy)) { +-- +cgit v0.9.0.2-2-gbebe +From f1457c1c59efdadbad25f01dce9433643d688844 Mon Sep 17 00:00:00 2001 +From: Zhigang Gong +Date: Tue, 13 Nov 2012 02:08:02 +0000 +Subject: glamor_compositerects: Need to initialize region before fallback. + +As we need to call DamageRegionAppend even for fallback path, +we must initialize the region before do that. Pointed by +Igor Vagulin. + +https://bugs.freedesktop.org/show_bug.cgi?id=56940 + +Signed-off-by: Zhigang Gong +--- +diff --git a/src/glamor_compositerects.c b/src/glamor_compositerects.c +index 5fe1bbf..f1564a2 100644 +--- a/src/glamor_compositerects.c ++++ b/src/glamor_compositerects.c +@@ -131,16 +131,6 @@ glamor_composite_rectangles(CARD8 op, + return; + } + +- pixmap = glamor_get_drawable_pixmap(dst->pDrawable); +- priv = glamor_get_pixmap_private(pixmap); +- +- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) +- goto fallback; +- if (dst->alphaMap) { +- DEBUGF("%s: fallback, dst has an alpha-map\n", __FUNCTION__); +- goto fallback; +- } +- + if ((color->red|color->green|color->blue|color->alpha) <= 0x00ff) { + switch (op) { + case PictOpOver: +@@ -204,6 +194,16 @@ glamor_composite_rectangles(CARD8 op, + return; + } + ++ pixmap = glamor_get_drawable_pixmap(dst->pDrawable); ++ priv = glamor_get_pixmap_private(pixmap); ++ ++ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) ++ goto fallback; ++ if (dst->alphaMap) { ++ DEBUGF("%s: fallback, dst has an alpha-map\n", __FUNCTION__); ++ goto fallback; ++ } ++ + need_free_region = TRUE; + + DEBUGF("%s: drawable extents (%d, %d),(%d, %d) x %d\n", +-- +cgit v0.9.0.2-2-gbebe +From 4a0ac3ff00d70b13e8483d50657187c7abdfc110 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Sat, 29 Dec 2012 06:28:17 +0000 +Subject: glamor: fix make distcheck part 1 + +This just adds the headers, then it falls over on the sdk_HEADERS +as it overrides proper install paths by the looks of it. + +Signed-off-by: Dave Airlie +--- +diff --git a/src/Makefile.am b/src/Makefile.am +index 766aac7..e1ee86d 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -20,10 +20,13 @@ AM_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) $(DIX_CFLAGS) $(LIBDRM_CFLAGS) + libglamor_la_LDFLAGS = -avoid-version + + libglamor_la_SOURCES = \ ++ compat-api.h \ + glamor.c \ + glamor_copyarea.c \ + glamor_copywindow.c \ + glamor_core.c \ ++ glamor_debug.h \ ++ glamor_gl_dispatch.h \ + glamor_fill.c \ + glamor_fillspans.c \ + glamor_getspans.c \ +@@ -42,6 +45,7 @@ libglamor_la_SOURCES = \ + glamor_copyplane.c\ + glamor_glyphblt.c\ + glamor_polyops.c\ ++ glamor_priv.h\ + glamor_pixmap.c\ + glamor_largepixmap.c\ + glamor_picture.c\ +@@ -49,7 +53,9 @@ libglamor_la_SOURCES = \ + glamor_gl_dispatch.c\ + glamor_fbo.c\ + glamor_compositerects.c\ +- glamor.h ++ glamor_utils.h\ ++ glamor.h\ ++ glapi.h + + sdk_HEADERS = glamor.h + +-- +cgit v0.9.0.2-2-gbebe +From c6d9cb1eb4962a15f8bbc869e9fef6d1464165af Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Sat, 29 Dec 2012 06:42:10 +0000 +Subject: glamor: add compiler.h + +This is also required for distchecking. + +Signed-off-by: Dave Airlie +--- +diff --git a/src/Makefile.am b/src/Makefile.am +index e1ee86d..55721f6 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -21,6 +21,7 @@ libglamor_la_LDFLAGS = -avoid-version + + libglamor_la_SOURCES = \ + compat-api.h \ ++ compiler.h \ + glamor.c \ + glamor_copyarea.c \ + glamor_copywindow.c \ +-- +cgit v0.9.0.2-2-gbebe +From c0729336ae35dcc7e46bcf840d6e9a056d5cdd26 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Sat, 29 Dec 2012 06:42:30 +0000 +Subject: glamor_utils: fix unlikely define use + +using a define across a split line expression is failure, compiling +with warnings shows this up. + +Signed-off-by: Dave Airlie +--- +diff --git a/src/glamor_utils.h b/src/glamor_utils.h +index 36beb49..d307838 100644 +--- a/src/glamor_utils.h ++++ b/src/glamor_utils.h +@@ -80,8 +80,7 @@ + + #define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \ + do { \ +- if (unlikely(_priv_ && (_priv_)->type \ +- == GLAMOR_TEXTURE_LARGE)) { \ ++ if (unlikely(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \ + *(_xoff_) = - (_priv_)->large.box.x1; \ + *(_yoff_) = - (_priv_)->large.box.y1; \ + } else { \ +-- +cgit v0.9.0.2-2-gbebe diff --git a/extra/glamor-egl/glamor_debug.h b/extra/glamor-egl/glamor_debug.h new file mode 100644 index 000000000..f0c969b11 --- /dev/null +++ b/extra/glamor-egl/glamor_debug.h @@ -0,0 +1,116 @@ +/* + * Copyright © 2009 Intel Corporation + * Copyright © 1998 Keith Packard + * + * 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. + * + * Authors: + * Zhigang Gong + * + */ + +#ifndef __GLAMOR_DEBUG_H__ +#define __GLAMOR_DEBUG_H__ + + +#define GLAMOR_DELAYED_STRING_MAX 64 + +#define GLAMOR_DEBUG_NONE 0 +#define GLAMOR_DEBUG_UNIMPL 0 +#define GLAMOR_DEBUG_FALLBACK 1 +#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD 2 +#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD 3 + +extern void +AbortServer(void) + _X_NORETURN; + +#define GLAMOR_PANIC(_format_, ...) \ + do { \ + LogMessageVerb(X_NONE, 0, "Glamor Fatal Error" \ + " at %32s line %d: " _format_ "\n", \ + __FUNCTION__, __LINE__, \ + ##__VA_ARGS__ ); \ + exit(1); \ + } while(0) + + + + +#define __debug_output_message(_format_, _prefix_, ...) \ + LogMessageVerb(X_NONE, 0, \ + "%32s:\t" _format_ , \ + /*_prefix_,*/ \ + __FUNCTION__, \ + ##__VA_ARGS__) + +#define glamor_debug_output(_level_, _format_,...) \ + do { \ + if (glamor_debug_level >= _level_) \ + __debug_output_message(_format_, \ + "Glamor debug", \ + ##__VA_ARGS__); \ + } while(0) + + +#define glamor_fallback(_format_,...) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) \ + __debug_output_message(_format_, \ + "Glamor fallback", \ + ##__VA_ARGS__);} while(0) + + + +#define glamor_delayed_fallback(_screen_, _format_,...) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \ + glamor_screen_private *_glamor_priv_; \ + _glamor_priv_ = glamor_get_screen_private(_screen_); \ + _glamor_priv_->delayed_fallback_pending = 1; \ + snprintf(_glamor_priv_->delayed_fallback_string, \ + GLAMOR_DELAYED_STRING_MAX, \ + "glamor delayed fallback: \t%s " _format_ , \ + __FUNCTION__, ##__VA_ARGS__); } } while(0) + + +#define glamor_clear_delayed_fallbacks(_screen_) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \ + glamor_screen_private *_glamor_priv_; \ + _glamor_priv_ = glamor_get_screen_private(_screen_); \ + _glamor_priv_->delayed_fallback_pending = 0; } } while(0) + +#define glamor_report_delayed_fallbacks(_screen_) \ + do { \ + if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) { \ + glamor_screen_private *_glamor_priv_; \ + _glamor_priv_ = glamor_get_screen_private(_screen_); \ + LogMessageVerb(X_INFO, 0, "%s", \ + _glamor_priv_->delayed_fallback_string); \ + _glamor_priv_->delayed_fallback_pending = 0; } } while(0) + +#define DEBUGF(str, ...) do {} while(0) +//#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) +#define DEBUGRegionPrint(x) do {} while (0) +//#define DEBUGRegionPrint RegionPrint + + +#endif diff --git a/extra/glamor-egl/glamor_gl_dispatch.h b/extra/glamor-egl/glamor_gl_dispatch.h new file mode 100644 index 000000000..b3fc3a629 --- /dev/null +++ b/extra/glamor-egl/glamor_gl_dispatch.h @@ -0,0 +1,137 @@ +typedef struct glamor_gl_dispatch { + /* Transformation functions */ + void (*glMatrixMode) (GLenum mode); + void (*glLoadIdentity) (void); + void (*glViewport) (GLint x, GLint y, GLsizei width, + GLsizei height); + /* Drawing functions */ + void (*glRasterPos2i) (GLint x, GLint y); + + /* Vertex Array */ + void (*glDrawArrays) (GLenum mode, GLint first, GLsizei count); + + /* Elements Array*/ + void (*glDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); + + /* Raster functions */ + void (*glReadPixels) (GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid * pixels); + + void (*glDrawPixels) (GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid * pixels); + void (*glPixelStorei) (GLenum pname, GLint param); + /* Texture Mapping */ + + void (*glTexParameteri) (GLenum target, GLenum pname, GLint param); + void (*glTexImage2D) (GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid * pixels); + /* 1.1 */ + void (*glGenTextures) (GLsizei n, GLuint * textures); + void (*glDeleteTextures) (GLsizei n, const GLuint * textures); + void (*glBindTexture) (GLenum target, GLuint texture); + void (*glTexSubImage2D) (GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid * pixels); + /* MISC */ + void (*glFlush) (void); + void (*glFinish) (void); + void (*glGetIntegerv) (GLenum pname, GLint * params); + const GLubyte *(*glGetString) (GLenum name); + void (*glScissor) (GLint x, GLint y, GLsizei width, + GLsizei height); + void (*glEnable) (GLenum cap); + void (*glDisable) (GLenum cap); + void (*glBlendFunc) (GLenum sfactor, GLenum dfactor); + void (*glLogicOp) (GLenum opcode); + + /* 1.3 */ + void (*glActiveTexture) (GLenum texture); + + /* GL Extentions */ + void (*glGenBuffers) (GLsizei n, GLuint * buffers); + void (*glBufferData) (GLenum target, GLsizeiptr size, + const GLvoid * data, GLenum usage); + GLvoid *(*glMapBuffer) (GLenum target, GLenum access); + GLvoid *(*glMapBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + GLboolean (*glUnmapBuffer) (GLenum target); + void (*glBindBuffer) (GLenum target, GLuint buffer); + void (*glDeleteBuffers) (GLsizei n, const GLuint * buffers); + + void (*glFramebufferTexture2D) (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level); + void (*glBindFramebuffer) (GLenum target, GLuint framebuffer); + void (*glDeleteFramebuffers) (GLsizei n, + const GLuint * framebuffers); + void (*glGenFramebuffers) (GLsizei n, GLuint * framebuffers); + GLenum (*glCheckFramebufferStatus) (GLenum target); + void (*glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, + GLint srcY1, GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + + void (*glVertexAttribPointer) (GLuint index, GLint size, + GLenum type, GLboolean normalized, + GLsizei stride, + const GLvoid * pointer); + void (*glDisableVertexAttribArray) (GLuint index); + void (*glEnableVertexAttribArray) (GLuint index); + void (*glBindAttribLocation) (GLuint program, GLuint index, + const GLchar * name); + + void (*glLinkProgram) (GLuint program); + void (*glShaderSource) (GLuint shader, GLsizei count, + const GLchar * *string, + const GLint * length); + void (*glUseProgram) (GLuint program); + void (*glUniform1i) (GLint location, GLint v0); + void (*glUniform1f) (GLint location, GLfloat v0); + void (*glUniform4f) (GLint location, GLfloat v0, GLfloat v1, + GLfloat v2, GLfloat v3); + void (*glUniform1fv) (GLint location, GLsizei count, + const GLfloat * value); + void (*glUniform2fv) (GLint location, GLsizei count, + const GLfloat * value); + void (*glUniform4fv) (GLint location, GLsizei count, + const GLfloat * value); + void (*glUniformMatrix3fv) (GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value); + GLuint (*glCreateProgram) (void); + GLuint (*glDeleteProgram) (GLuint); + GLuint (*glCreateShader) (GLenum type); + void (*glCompileShader) (GLuint shader); + void (*glAttachShader) (GLuint program, GLuint shader); + void (*glDeleteShader) (GLuint shader); + void (*glGetShaderiv) (GLuint shader, GLenum pname, + GLint * params); + void (*glGetShaderInfoLog) (GLuint shader, GLsizei bufSize, + GLsizei * length, GLchar * infoLog); + void (*glGetProgramiv) (GLuint program, GLenum pname, + GLint * params); + void (*glGetProgramInfoLog) (GLuint program, GLsizei bufSize, + GLsizei * length, GLchar * infoLog); + GLint (*glGetUniformLocation) (GLuint program, + const GLchar * name); + +} glamor_gl_dispatch; + + +typedef void *(*get_proc_address_t) (const char *); + +_X_EXPORT Bool +glamor_gl_dispatch_init_impl(struct glamor_gl_dispatch *dispatch, + int gl_version, + get_proc_address_t get_proc_address); + + +_X_EXPORT Bool +glamor_gl_dispatch_init(ScreenPtr screen, + struct glamor_gl_dispatch *dispatch, + int gl_version); diff --git a/extra/glamor-egl/glamor_glext.h b/extra/glamor-egl/glamor_glext.h new file mode 100644 index 000000000..1f7206b99 --- /dev/null +++ b/extra/glamor-egl/glamor_glext.h @@ -0,0 +1,64 @@ +/* + * Copyright © 2001 Keith Packard + * Copyright © 2008 Intel Corporation + * + * 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. + * + * Authors: + * Zhigang Gong + * + */ + + +#ifdef GLAMOR_GLES2 + +#define GL_BGRA GL_BGRA_EXT +#define GL_COLOR_INDEX 0x1900 +#define GL_BITMAP 0x1A00 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 + +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_CLAMP_TO_BORDER 0x812D + +#define GL_READ_WRITE 0x88BA +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 + +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 + +#define GL_PACK_INVERT_MESA 0x8758 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 + +#endif diff --git a/extra/glamor-egl/glamor_priv.h b/extra/glamor-egl/glamor_priv.h new file mode 100644 index 000000000..6e80ebdf9 --- /dev/null +++ b/extra/glamor-egl/glamor_priv.h @@ -0,0 +1,1016 @@ +/* + * Copyright © 2008 Intel Corporation + * + * 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. + * + * Authors: + * Eric Anholt + * + */ +#ifndef GLAMOR_PRIV_H +#define GLAMOR_PRIV_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "compiler.h" + +#include +#ifndef DEBUG +#define NDEBUG +#endif +#include "glamor.h" +#include "compat-api.h" + +#define GL_GLEXT_PROTOTYPES + +#ifdef GLAMOR_GLES2 +#include +#include + +#define GLAMOR_DEFAULT_PRECISION "precision mediump float;\n" +#include "glamor_glext.h" +#else +#include +#include +#define GLAMOR_DEFAULT_PRECISION +#endif + +#ifdef RENDER +#include "glyphstr.h" +#endif + +#include "glamor_debug.h" + +#include +/* The list.h rename all the function to add xorg_ prefix. + We add hack here to avoid the compile error when using + old version xserver header file. + These will be removed in future. */ +#ifndef xorg_list_entry +#define xorg_list list +#define xorg_list_for_each_entry list_for_each_entry +#define xorg_list_for_each_entry_safe list_for_each_entry_safe +#define xorg_list_del list_del +#define xorg_list_add list_add +#define xorg_list_append list_append +#define xorg_list_init list_init +#endif + +struct glamor_pixmap_private; + +typedef struct glamor_composite_shader { + GLuint prog; + GLint dest_to_dest_uniform_location; + GLint dest_to_source_uniform_location; + GLint dest_to_mask_uniform_location; + GLint source_uniform_location; + GLint mask_uniform_location; + GLint source_wh; + GLint mask_wh; + GLint source_repeat_mode; + GLint mask_repeat_mode; + union { + float source_solid_color[4]; + struct { + struct glamor_pixmap_private *source_priv; + PicturePtr source; + }; + }; + + union { + float mask_solid_color[4]; + struct { + struct glamor_pixmap_private *mask_priv; + PicturePtr mask; + }; + }; +} glamor_composite_shader; + +enum shader_source { + SHADER_SOURCE_SOLID, + SHADER_SOURCE_TEXTURE, + SHADER_SOURCE_TEXTURE_ALPHA, + SHADER_SOURCE_COUNT, +}; + +enum shader_mask { + SHADER_MASK_NONE, + SHADER_MASK_SOLID, + SHADER_MASK_TEXTURE, + SHADER_MASK_TEXTURE_ALPHA, + SHADER_MASK_COUNT, +}; + +enum shader_in { + SHADER_IN_SOURCE_ONLY, + SHADER_IN_NORMAL, + SHADER_IN_CA_SOURCE, + SHADER_IN_CA_ALPHA, + SHADER_IN_COUNT, +}; + +struct shader_key { + enum shader_source source; + enum shader_mask mask; + enum shader_in in; +}; + +struct blendinfo { + Bool dest_alpha; + Bool source_alpha; + GLenum source_blend; + GLenum dest_blend; +}; + +typedef struct { + INT16 x_src; + INT16 y_src; + INT16 x_mask; + INT16 y_mask; + INT16 x_dst; + INT16 y_dst; + INT16 width; + INT16 height; +} glamor_composite_rect_t; + + +enum glamor_vertex_type { + GLAMOR_VERTEX_POS, + GLAMOR_VERTEX_SOURCE, + GLAMOR_VERTEX_MASK +}; + + +enum gradient_shader { + SHADER_GRADIENT_LINEAR, + SHADER_GRADIENT_RADIAL, + SHADER_GRADIENT_CONICAL, + SHADER_GRADIENT_COUNT, +}; + +enum gradient_shader_prog { + SHADER_GRADIENT_VS_PROG, + SHADER_GRADIENT_FS_MAIN_PROG, + SHADER_GRADIENT_FS_GETCOLOR_PROG, + SHADER_GRADIENT_PROG_COUNT, +}; + +struct glamor_screen_private; +struct glamor_pixmap_private; + +enum glamor_gl_flavor { + GLAMOR_GL_DESKTOP, // OPENGL API + GLAMOR_GL_ES2 // OPENGL ES2.0 API +}; + +#define GLAMOR_CREATE_PIXMAP_CPU 0x100 +#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101 +#define GLAMOR_CREATE_FBO_NO_FBO 0x103 +#define GLAMOR_CREATE_PIXMAP_MAP 0x104 + +#define GLAMOR_CREATE_TEXTURE_EXACT_SIZE 0x104 + +#define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2 + +#define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024) + +typedef struct { + PicturePtr picture; /* Where the glyphs of the cache are stored */ + GlyphPtr *glyphs; + uint16_t count; + uint16_t evict; +} glamor_glyph_cache_t; + +#include "glamor_gl_dispatch.h" + +struct glamor_saved_procs { + CloseScreenProcPtr close_screen; + CreateGCProcPtr create_gc; + CreatePixmapProcPtr create_pixmap; + DestroyPixmapProcPtr destroy_pixmap; + GetSpansProcPtr get_spans; + GetImageProcPtr get_image; + CompositeProcPtr composite; + CompositeRectsProcPtr composite_rects; + TrapezoidsProcPtr trapezoids; + GlyphsProcPtr glyphs; + ChangeWindowAttributesProcPtr change_window_attributes; + CopyWindowProcPtr copy_window; + BitmapToRegionProcPtr bitmap_to_region; + TrianglesProcPtr triangles; + AddTrapsProcPtr addtraps; + CreatePictureProcPtr create_picture; + DestroyPictureProcPtr destroy_picture; + UnrealizeGlyphProcPtr unrealize_glyph; +}; + +#ifdef GLAMOR_GLES2 +#define CACHE_FORMAT_COUNT 3 +#else +#define CACHE_FORMAT_COUNT 2 +#endif + +#define CACHE_BUCKET_WCOUNT 4 +#define CACHE_BUCKET_HCOUNT 4 + +#define GLAMOR_TICK_AFTER(t0, t1) \ + (((int)(t1) - (int)(t0)) < 0) + +#define IDLE_STATE 0 +#define RENDER_STATE 1 +#define BLIT_STATE 2 +#define RENDER_IDEL_MAX 32 + +typedef struct glamor_screen_private { + struct glamor_gl_dispatch _dispatch; + int yInverted; + unsigned int tick; + enum glamor_gl_flavor gl_flavor; + int has_pack_invert; + int has_fbo_blit; + int max_fbo_size; + + struct xorg_list fbo_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT]; + unsigned long fbo_cache_watermark; + + /* glamor_solid */ + GLint solid_prog; + GLint solid_color_uniform_location; + + /* vertext/elment_index buffer object for render */ + GLuint vbo, ebo; + int vbo_offset; + int vbo_size; + char *vb; + int vb_stride; + Bool has_source_coords, has_mask_coords; + int render_nr_verts; + glamor_composite_shader composite_shader[SHADER_SOURCE_COUNT] + [SHADER_MASK_COUNT] + [SHADER_IN_COUNT]; + glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS]; + Bool glyph_cache_initialized; + + /* shaders to restore a texture to another texture.*/ + GLint finish_access_prog[2]; + GLint finish_access_revert[2]; + GLint finish_access_swap_rb[2]; + + /* glamor_tile */ + GLint tile_prog; + GLint tile_wh; + + /* glamor gradient, 0 for small nstops, 1 for + large nstops and 2 for dynamic generate. */ + GLint gradient_prog[SHADER_GRADIENT_COUNT][3]; + GLint linear_gradient_shaders[SHADER_GRADIENT_PROG_COUNT][3]; + int linear_max_nstops; + GLint radial_gradient_shaders[SHADER_GRADIENT_PROG_COUNT][3]; + int radial_max_nstops; + + /* glamor trapezoid shader. */ + GLint trapezoid_prog; + + /* glamor_putimage */ + GLint put_image_xybitmap_prog; + GLint put_image_xybitmap_fg_uniform_location; + GLint put_image_xybitmap_bg_uniform_location; + + PixmapPtr *back_pixmap; + int screen_fbo; + struct glamor_saved_procs saved_procs; + char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1]; + int delayed_fallback_pending; + int flags; + int state; + unsigned int render_idle_cnt; + ScreenPtr screen; +} glamor_screen_private; + +typedef enum glamor_access { + GLAMOR_ACCESS_RO, + GLAMOR_ACCESS_RW, + GLAMOR_ACCESS_WO, +} glamor_access_t; + +#define GLAMOR_FBO_NORMAL 1 +#define GLAMOR_FBO_DOWNLOADED 2 +/* glamor_pixmap_fbo: + * @list: to be used to link to the cache pool list. + * @expire: when push to cache pool list, set a expire count. + * will be freed when glamor_priv->tick is equal or + * larger than this expire count in block handler. + * @pbo_valid: The pbo has a valid copy of the pixmap's data. + * @tex: attached texture. + * @fb: attached fbo. + * @pbo: attached pbo. + * @width: width of this fbo. + * @height: height of this fbo. + * @format: internal format of this fbo's texture. + * @type: internal type of this fbo's texture. + * @glamor_priv: point to glamor private data. + */ +typedef struct glamor_pixmap_fbo { + struct xorg_list list; + unsigned int expire; + unsigned char pbo_valid; + GLuint tex; + GLuint fb; + GLuint pbo; + int width; + int height; + GLenum format; + GLenum type; + glamor_screen_private *glamor_priv; +} glamor_pixmap_fbo; + +/* + * glamor_pixmap_private - glamor pixmap's private structure. + * @gl_fbo: + * 0 - The pixmap doesn't has a fbo attached to it. + * GLAMOR_FBO_NORMAL - The pixmap has a fbo and can be accessed normally. + * GLAMOR_FBO_DOWNLOADED - The pixmap has a fbo and already downloaded to + * CPU, so it can only be treated as a in-memory pixmap + * if this bit is set. + * @gl_tex: The pixmap is in a gl texture originally. + * @is_picture: The drawable is attached to a picture. + * @pict_format: the corresponding picture's format. + * @pixmap: The corresponding pixmap's pointer. + * + * For GLAMOR_TEXTURE_LARGE, nbox should larger than 1. + * And the box and fbo will both have nbox elements. + * and box[i] store the relatively coords in this pixmap + * of the fbo[i]. The reason why use boxes not region to + * represent this structure is we may need to use overlapped + * boxes for one pixmap for some special reason. + * + * pixmap + * ****************** + * * fbo0 * fbo1 * + * * * * + * ****************** + * * fbo2 * fbo3 * + * * * * + * ****************** + * + * Let's assume the texture has size of 1024x1024 + * box[0] = {0,0,1024,1024} + * box[1] = {1024,0,2048,2048} + * ... + * + * For GLAMOR_TEXTURE_ATLAS nbox should be 1. And box + * and fbo both has one elements, and the box store + * the relatively coords in the fbo of this pixmap: + * + * fbo + * ****************** + * * pixmap * + * * ********* * + * * * * * + * * ********* * + * * * + * ****************** + * + * Assume the pixmap is at the (100,100) relatively to + * the fbo's origin. + * box[0]={100, 100, 1124, 1124}; + * + * Considering large pixmap is not a normal case, to keep + * it simple, I designe it as the following way. + * When deal with a large pixmap, it split the working + * rectangle into serval boxes, and each box fit into a + * corresponding fbo. And then the rendering function will + * loop from the left-top box to the right-bottom box, + * each time, we will set current box and current fbo + * to the box and fbo elements. Thus the inner routines + * can handle it as normal, only the coords calculation need + * to aware of it's large pixmap. + * + * Currently, we haven't implemented the atlas pixmap. + * + **/ + +typedef struct glamor_pixmap_clipped_regions{ + int block_idx; + RegionPtr region; +} glamor_pixmap_clipped_regions; + +#define SET_PIXMAP_FBO_CURRENT(priv, idx) \ + do { \ + if (priv->type == GLAMOR_TEXTURE_LARGE) { \ + (priv)->large.base.fbo = priv->large.fbo_array[idx]; \ + (priv)->large.box = priv->large.box_array[idx]; \ + } \ + } while(0) + +typedef struct glamor_pixmap_private_base { + glamor_pixmap_type_t type; + unsigned char gl_fbo:2; + unsigned char is_picture:1; + unsigned char gl_tex:1; + glamor_pixmap_fbo *fbo; + PixmapPtr pixmap; + int drm_stride; + glamor_screen_private *glamor_priv; + PicturePtr picture; +}glamor_pixmap_private_base_t; + +/* + * @base.fbo: current fbo. + * @box: current fbo's coords in the whole pixmap. + * @block_w: block width of this large pixmap. + * @block_h: block height of this large pixmap. + * @block_wcnt: block count in one block row. + * @block_hcnt: block count in one block column. + * @nbox: total block count. + * @box_array: contains each block's corresponding box. + * @fbo_array: contains each block's fbo pointer. + * + **/ +typedef struct glamor_pixmap_private_large { + union { + glamor_pixmap_type_t type; + glamor_pixmap_private_base_t base; + }; + BoxRec box; + int block_w; + int block_h; + int block_wcnt; + int block_hcnt; + int nbox; + BoxPtr box_array; + glamor_pixmap_fbo **fbo_array; +}glamor_pixmap_private_large_t; + +/* + * @box: the relative coords in the corresponding fbo. + */ +typedef struct glamor_pixmap_private_atlas { + union { + glamor_pixmap_type_t type; + glamor_pixmap_private_base_t base; + }; + BoxRec box; +}glamor_pixmap_private_atlas_t; + +typedef struct glamor_pixmap_private { + union { + glamor_pixmap_type_t type; + glamor_pixmap_private_base_t base; + glamor_pixmap_private_large_t large; + glamor_pixmap_private_atlas_t atlas; + }; +}glamor_pixmap_private; + +/* + * Pixmap dynamic status, used by dynamic upload feature. + * + * GLAMOR_NONE: initial status, don't need to do anything. + * GLAMOR_UPLOAD_PENDING: marked as need to be uploaded to gl texture. + * GLAMOR_UPLOAD_DONE: the pixmap has been uploaded successfully. + * GLAMOR_UPLOAD_FAILED: fail to upload the pixmap. + * + * */ +typedef enum glamor_pixmap_status { + GLAMOR_NONE, + GLAMOR_UPLOAD_PENDING, + GLAMOR_UPLOAD_DONE, + GLAMOR_UPLOAD_FAILED +} glamor_pixmap_status_t; + +extern DevPrivateKey glamor_screen_private_key; +extern DevPrivateKey glamor_pixmap_private_key; +static inline glamor_screen_private * +glamor_get_screen_private(ScreenPtr screen) +{ + return (glamor_screen_private *) + dixLookupPrivate(&screen->devPrivates, + glamor_screen_private_key); +} + +static inline void +glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv) +{ + dixSetPrivate(&screen->devPrivates, + glamor_screen_private_key, + priv); +} + + + +static inline glamor_pixmap_private * +glamor_get_pixmap_private(PixmapPtr pixmap) +{ + glamor_pixmap_private *priv; + priv = dixLookupPrivate(&pixmap->devPrivates, + glamor_pixmap_private_key); + if (!priv) { + glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY); + priv = dixLookupPrivate(&pixmap->devPrivates, + glamor_pixmap_private_key); + } + return priv; +} + +void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv); + +/** + * Returns TRUE if the given planemask covers all the significant bits in the + * pixel values for pDrawable. + */ +static inline Bool +glamor_pm_is_solid(DrawablePtr drawable, unsigned long planemask) +{ + return (planemask & FbFullMask(drawable->depth)) == + FbFullMask(drawable->depth); +} + +extern int glamor_debug_level; + +/* glamor.c */ +PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable); + +Bool glamor_destroy_pixmap(PixmapPtr pixmap); + +glamor_pixmap_fbo* glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv); +void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo); +glamor_pixmap_fbo * glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, GLint tex, int flag); +glamor_pixmap_fbo * glamor_create_fbo(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, int flag); +void glamor_destroy_fbo(glamor_pixmap_fbo *fbo); +void glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv); +void glamor_purge_fbo(glamor_pixmap_fbo *fbo); + +void glamor_init_pixmap_fbo(ScreenPtr screen); +void glamor_fini_pixmap_fbo(ScreenPtr screen); +Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap); +void glamor_fbo_expire(glamor_screen_private *glamor_priv); + +glamor_pixmap_fbo * +glamor_create_fbo_array(glamor_screen_private *glamor_priv, + int w, int h, GLenum format, int flag, + int block_w, int block_h, glamor_pixmap_private *); + +/* glamor_copyarea.c */ +RegionPtr +glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc, + int srcx, int srcy, int width, int height, int dstx, + int dsty); +void glamor_copy_n_to_n(DrawablePtr src, DrawablePtr dst, GCPtr gc, + BoxPtr box, int nbox, int dx, int dy, Bool reverse, + Bool upsidedown, Pixel bitplane, void *closure); + +/* glamor_copywindow.c */ +void glamor_copy_window(WindowPtr win, DDXPointRec old_origin, + RegionPtr src_region); + +/* glamor_core.c */ +Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access); +void glamor_finish_access(DrawablePtr drawable, glamor_access_t access); +Bool glamor_prepare_access_window(WindowPtr window); +void glamor_finish_access_window(WindowPtr window); +Bool glamor_prepare_access_gc(GCPtr gc); +void glamor_finish_access_gc(GCPtr gc); +void glamor_init_finish_access_shaders(ScreenPtr screen); +void glamor_fini_finish_access_shaders(ScreenPtr screen); +const Bool glamor_get_drawable_location(const DrawablePtr drawable); +void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, + int *x, int *y); +Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, + int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + unsigned long fg_pixel, unsigned long bg_pixel, + int stipple_x, int stipple_y); +GLint glamor_compile_glsl_prog(glamor_gl_dispatch * dispatch, GLenum type, + const char *source); +void glamor_link_glsl_prog(glamor_gl_dispatch * dispatch, GLint prog); +void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, + unsigned long fg_pixel, + GLfloat * color); + +int glamor_set_destination_pixmap(PixmapPtr pixmap); +int glamor_set_destination_pixmap_priv(glamor_pixmap_private * + pixmap_priv); +void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *, int, int, int, int); + +/* nc means no check. caller must ensure this pixmap has valid fbo. + * usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly. + * */ +void glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private * + pixmap_priv); + +glamor_pixmap_fbo * +glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLenum format, + GLenum type, int no_alpha, int revert, int swap_rb); + +Bool glamor_set_alu(struct glamor_gl_dispatch *dispatch, + unsigned char alu); +Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask); +Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask); +RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap); +Bool glamor_gl_has_extension(const char *extension); +int glamor_gl_get_version(void); + +#define GLAMOR_GL_VERSION_ENCODE(major, minor) ( \ + ((major) * 256) \ + + ((minor) * 1)) + + + + +/* glamor_fill.c */ +Bool glamor_fill(DrawablePtr drawable, + GCPtr gc, int x, int y, int width, int height, Bool fallback); +Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + unsigned long fg_pixel); +Bool +glamor_solid_boxes(PixmapPtr pixmap, + BoxPtr box, int nbox, + unsigned long fg_pixel); + +/* glamor_fillspans.c */ +void glamor_fill_spans(DrawablePtr drawable, + GCPtr gc, + int n, DDXPointPtr points, int *widths, int sorted); + +void glamor_init_solid_shader(ScreenPtr screen); +void glamor_fini_solid_shader(ScreenPtr screen); + +/* glamor_getspans.c */ +void + +glamor_get_spans(DrawablePtr drawable, + int wmax, + DDXPointPtr points, + int *widths, int nspans, char *dst_start); + +/* glamor_glyphs.c */ +void glamor_glyphs_fini(ScreenPtr screen); +void glamor_glyphs(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, int nlist, GlyphListPtr list, + GlyphPtr * glyphs); + +/* glamor_setspans.c */ +void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int n, int sorted); + +/* glamor_polyfillrect.c */ +void +glamor_poly_fill_rect(DrawablePtr drawable, + GCPtr gc, int nrect, xRectangle * prect); + +/* glamor_polylines.c */ +void + +glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n, + DDXPointPtr points); + +/* glamor_putimage.c */ +void + +glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, + int w, int h, int leftPad, int format, char *bits); +void glamor_init_putimage_shaders(ScreenPtr screen); +void glamor_fini_putimage_shaders(ScreenPtr screen); + +/* glamor_render.c */ +Bool +glamor_composite_clipped_region(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *soruce_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + RegionPtr region, + int x_source, + int y_source, + int x_mask, + int y_mask, + int x_dest, + int y_dest); + +void glamor_composite(CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); + +void glamor_init_composite_shaders(ScreenPtr screen); +void glamor_fini_composite_shaders(ScreenPtr screen); +void glamor_composite_glyph_rects(CARD8 op, + PicturePtr src, PicturePtr mask, + PicturePtr dst, int nrect, + glamor_composite_rect_t * rects); +void glamor_composite_rects (CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, + xRectangle *rects); +void glamor_init_trapezoid_shader(ScreenPtr screen); +void glamor_fini_trapezoid_shader(ScreenPtr screen); +PicturePtr glamor_convert_gradient_picture(ScreenPtr screen, + PicturePtr source, + int x_source, + int y_source, int width, int height); + +Bool glamor_composite_choose_shader(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private *source_pixmap_priv, + glamor_pixmap_private *mask_pixmap_priv, + glamor_pixmap_private *dest_pixmap_priv, + struct shader_key *s_key, + glamor_composite_shader **shader, + struct blendinfo *op_info, + PictFormatShort *psaved_source_format); + +void +glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, + struct shader_key *key, + glamor_composite_shader *shader, + struct blendinfo *op_info); + +void glamor_setup_composite_vbo(ScreenPtr screen, int n_verts); +void glamor_emit_composite_vert(ScreenPtr screen, + const float *src_coords, + const float *mask_coords, + const float *dst_coords, int i); + +/* glamor_trapezoid.c */ +void glamor_trapezoids(CARD8 op, + PicturePtr src, PicturePtr dst, + PictFormatPtr mask_format, INT16 x_src, INT16 y_src, + int ntrap, xTrapezoid * traps); + +/* glamor_tile.c */ +Bool glamor_tile(PixmapPtr pixmap, PixmapPtr tile, + int x, int y, int width, int height, + unsigned char alu, unsigned long planemask, + int tile_x, int tile_y); +void glamor_init_tile_shader(ScreenPtr screen); +void glamor_fini_tile_shader(ScreenPtr screen); + +/* glamor_gradient.c */ +void glamor_init_gradient_shader(ScreenPtr screen); +void glamor_fini_gradient_shader(ScreenPtr screen); +PicturePtr glamor_generate_linear_gradient_picture(ScreenPtr screen, + PicturePtr src_picture, + int x_source, int y_source, + int width, int height, + PictFormatShort format); +PicturePtr glamor_generate_radial_gradient_picture(ScreenPtr screen, + PicturePtr src_picture, + int x_source, int y_source, + int width, int height, + PictFormatShort format); + +/* glamor_triangles.c */ +void + +glamor_triangles(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris); + +/* glamor_pixmap.c */ + +void glamor_pixmap_init(ScreenPtr screen); +void glamor_pixmap_fini(ScreenPtr screen); +/** + * Download a pixmap's texture to cpu memory. If success, + * One copy of current pixmap's texture will be put into + * the pixmap->devPrivate.ptr. Will use pbo to map to + * the pointer if possible. + * The pixmap must be a gl texture pixmap. gl_fbo and + * gl_tex must be 1. Used by glamor_prepare_access. + * + */ +Bool glamor_download_pixmap_to_cpu(PixmapPtr pixmap, + glamor_access_t access); + +void * +glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h, + int stride, void *bits, int pbo, glamor_access_t access); + + +/** + * Restore a pixmap's data which is downloaded by + * glamor_download_pixmap_to_cpu to its original + * gl texture. Used by glamor_finish_access. + * + * The pixmap must be + * in texture originally. In other word, the gl_fbo + * must be 1. + **/ +void glamor_restore_pixmap_to_texture(PixmapPtr pixmap); + +/** + * According to the flag, + * if the flag is GLAMOR_CREATE_FBO_NO_FBO then just ensure + * the fbo has a valid texture. Otherwise, it will ensure + * the fbo has valid texture and attach to a valid fb. + * If the fbo already has a valid glfbo then do nothing. + */ +Bool +glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag); + +/** + * Upload a pixmap to gl texture. Used by dynamic pixmap + * uploading feature. The pixmap must be a software pixmap. + * This function will change current FBO and current shaders. + */ +enum glamor_pixmap_status glamor_upload_pixmap_to_texture(PixmapPtr + pixmap); + +Bool +glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w, int h, + int stride, void *bits, int pbo); + +PixmapPtr +glamor_get_sub_pixmap(PixmapPtr pixmap, int x, int y, + int w, int h, glamor_access_t access); +void +glamor_put_sub_pixmap(PixmapPtr sub_pixmap, PixmapPtr pixmap, int x, int y, + int w, int h, glamor_access_t access); + +glamor_pixmap_clipped_regions * +glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region, + int *clipped_nbox, int repeat_type, + int reverse, int upsidedown); + +glamor_pixmap_clipped_regions * +glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv, + RegionPtr region, + int *n_region, + int inner_block_w, int inner_block_h, + int reverse, int upsidedown); + +glamor_pixmap_clipped_regions * +glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, struct pixman_transform *transform, + RegionPtr region, int *n_region, int dx, int dy, int repeat_type, + int reverse, int upsidedown); + +Bool +glamor_composite_largepixmap_region(CARD8 op, + PicturePtr source, + PicturePtr mask, + PicturePtr dest, + glamor_pixmap_private * source_pixmap_priv, + glamor_pixmap_private * mask_pixmap_priv, + glamor_pixmap_private * dest_pixmap_priv, + RegionPtr region, Bool force_clip, + INT16 x_source, + INT16 y_source, + INT16 x_mask, + INT16 y_mask, + INT16 x_dest, INT16 y_dest, + CARD16 width, CARD16 height); + +Bool +glamor_get_transform_block_size(struct pixman_transform *transform, + int block_w, int block_h, + int *transformed_block_w, + int *transformed_block_h); + +void +glamor_get_transform_extent_from_box(struct pixman_box32 *temp_box, + struct pixman_transform *transform); + +/** + * Upload a picture to gl texture. Similar to the + * glamor_upload_pixmap_to_texture. Used in rendering. + **/ +enum glamor_pixmap_status + glamor_upload_picture_to_texture(PicturePtr picture); + +/** + * Upload bits to a pixmap's texture. This function will + * convert the bits to the specified format/type format + * if the conversion is unavoidable. + **/ +Bool glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, GLenum type, + int no_alpha, int revert, int swap_rb, void *bits); + +/** + * Destroy all the resources allocated on the uploading + * phase, includs the tex and fbo. + **/ +void glamor_destroy_upload_pixmap(PixmapPtr pixmap); + +int glamor_create_picture(PicturePtr picture); + +Bool +glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access); + +void glamor_finish_access_picture(PicturePtr picture, glamor_access_t access); + +void glamor_destroy_picture(PicturePtr picture); + +/* fixup a fbo to the exact size as the pixmap. */ +Bool +glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv); + +void +glamor_picture_format_fixup(PicturePtr picture, + glamor_pixmap_private * pixmap_priv); + +void +glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int format, unsigned long planeMask, char *d); + +void +glamor_add_traps(PicturePtr pPicture, + INT16 x_off, + INT16 y_off, int ntrap, xTrap * traps); + +RegionPtr +glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty, + unsigned long bitPlane); + +void +glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr * ppci, pointer pglyphBase); + +void +glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr * ppci, pointer pglyphBase); + +void +glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int w, int h, int x, int y); + +void +glamor_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + DDXPointPtr ppt); + +void +glamor_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg, + xSegment *pSeg); + +void +glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + DDXPointPtr ppt); + +void +glamor_composite_rectangles(CARD8 op, + PicturePtr dst, + xRenderColor *color, + int num_rects, + xRectangle *rects); + +#include"glamor_utils.h" + +/* Dynamic pixmap upload to texture if needed. + * Sometimes, the target is a gl texture pixmap/picture, + * but the source or mask is in cpu memory. In that case, + * upload the source/mask to gl texture and then avoid + * fallback the whole process to cpu. Most of the time, + * this will increase performance obviously. */ + +#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD +#define GLAMOR_GRADIENT_SHADER +#define GLAMOR_TRAPEZOID_SHADER +#define GLAMOR_TEXTURED_LARGE_PIXMAP 1 +#define WALKAROUND_LARGE_TEXTURE_MAP +#if 0 +#define MAX_FBO_SIZE 32 /* For test purpose only. */ +#endif +//#define GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK +#define GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK + +#endif /* GLAMOR_PRIV_H */ diff --git a/extra/glamor-egl/glamor_utils.h b/extra/glamor-egl/glamor_utils.h new file mode 100644 index 000000000..36beb49ed --- /dev/null +++ b/extra/glamor-egl/glamor_utils.h @@ -0,0 +1,1836 @@ +/* + * Copyright © 2009 Intel Corporation + * + * 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. + * + * Authors: + * Zhigang Gong + * + */ + +#ifndef GLAMOR_PRIV_H +#error This file can only be included by glamor_priv.h +#endif + +#ifndef __GLAMOR_UTILS_H__ +#define __GLAMOR_UTILS_H__ + +#define v_from_x_coord_x(_xscale_, _x_) ( 2 * (_x_) * (_xscale_) - 1.0) +#define v_from_x_coord_y(_yscale_, _y_) (-2 * (_y_) * (_yscale_) + 1.0) +#define v_from_x_coord_y_inverted(_yscale_, _y_) (2 * (_y_) * (_yscale_) - 1.0) +#define t_from_x_coord_x(_xscale_, _x_) ((_x_) * (_xscale_)) +#define t_from_x_coord_y(_yscale_, _y_) (1.0 - (_y_) * (_yscale_)) +#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_)) + +#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ + do { \ + int _w_,_h_; \ + PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_); \ + *(_pxscale_) = 1.0 / _w_; \ + *(_pyscale_) = 1.0 / _h_; \ + } while(0) + +#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \ + do { \ + *(_pxscale_) = 1.0 / (_pixmap_priv_)->base.fbo->width; \ + *(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \ + } while(0) + +#define GLAMOR_PIXMAP_FBO_NOT_EAXCT_SIZE(priv) \ + (priv->base.fbo->width != priv->base.pixmap->drawable.width \ + || priv->base.fbo->height != priv->base.pixmap->drawable.height) \ + +#define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h) \ + do { \ + if (unlikely(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + w = priv->large.box.x2 - priv->large.box.x1; \ + h = priv->large.box.y2 - priv->large.box.y1; \ + } else { \ + w = priv->base.pixmap->drawable.width; \ + h = priv->base.pixmap->drawable.height; \ + } \ + } while(0) + +#define glamor_pixmap_fbo_fix_wh_ratio(wh, priv) \ + do { \ + int actual_w, actual_h; \ + PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, actual_w, actual_h); \ + wh[0] = (float)priv->base.fbo->width / actual_w; \ + wh[1] = (float)priv->base.fbo->height / actual_h; \ + wh[2] = 1.0 / priv->base.fbo->width; \ + wh[3] = 1.0 / priv->base.fbo->height; \ + } while(0) + +#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \ + do { \ + if (unlikely(_priv_ && (_priv_)->type \ + == GLAMOR_TEXTURE_LARGE)) { \ + *(_xoff_) = - (_priv_)->large.box.x1; \ + *(_yoff_) = - (_priv_)->large.box.y1; \ + } else { \ + *(_xoff_) = 0; \ + *(_yoff_) = 0; \ + } \ + } while(0) + +#define xFixedToFloat(_val_) ((float)xFixedToInt(_val_) \ + + ((float)xFixedFrac(_val_) / 65536.0)) + +#define glamor_picture_get_matrixf(_picture_, _matrix_) \ + do { \ + int _i_; \ + if ((_picture_)->transform) \ + { \ + for(_i_ = 0; _i_ < 3; _i_++) \ + { \ + (_matrix_)[_i_ * 3 + 0] = \ + xFixedToFloat((_picture_)->transform->matrix[_i_][0]); \ + (_matrix_)[_i_ * 3 + 1] = \ + xFixedToFloat((_picture_)->transform->matrix[_i_][1]); \ + (_matrix_)[_i_ * 3 + 2] = \ + xFixedToFloat((_picture_)->transform->matrix[_i_][2]); \ + } \ + } \ + } while(0) + +#define fmod(x, w) (x - w * floor((float)x/w)) + +#define fmodulus(x, w, c) do {c = fmod(x, w); \ + c = c >= 0 ? c : c + w;} \ + while(0) +/* @x: is current coord + * @x2: is the right/bottom edge + * @w: is current width or height + * @odd: is output value, 0 means we are in an even region, 1 means we are in a + * odd region. + * @c: is output value, equal to x mod w. */ +#define fodd_repeat_mod(x, x2, w, odd, c) \ + do { \ + float shift; \ + fmodulus((x), w, c); \ + shift = fabs((x) - (c)); \ + shift = floor(fabs(round(shift)) / w); \ + odd = (int)shift & 1; \ + if (odd && (((x2 % w) == 0) && \ + round(fabs(x)) == x2)) \ + odd = 0; \ + } while(0) + +/* @txy: output value, is the corrected coords. + * @xy: input coords to be fixed up. + * @cd: xy mod wh, is a input value. + * @wh: current width or height. + * @bxy1,bxy2: current box edge's x1/x2 or y1/y2 + * + * case 1: + * ---------- + * | * | + * | | + * ---------- + * tx = (c - x1) mod w + * + * case 2: + * --------- + * * | | + * | | + * --------- + * tx = - (c - (x1 mod w)) + * + * case 3: + * + * ---------- + * | | * + * | | + * ---------- + * tx = ((x2 mod x) - c) + (x2 - x1) + **/ +#define __glamor_repeat_reflect_fixup(txy, xy, \ + cd, wh, bxy1, bxy2) \ + do { \ + cd = wh - cd; \ + if ( xy >= bxy1 && xy < bxy2) { \ + cd = cd - bxy1; \ + fmodulus(cd, wh, txy); \ + } else if (xy < bxy1) { \ + float bxy1_mod; \ + fmodulus(bxy1, wh, bxy1_mod); \ + txy = -(cd - bxy1_mod); \ + } \ + else if (xy >= bxy2) { \ + float bxy2_mod; \ + fmodulus(bxy2, wh, bxy2_mod); \ + if (bxy2_mod == 0) \ + bxy2_mod = wh; \ + txy = (bxy2_mod - cd) + bxy2 - bxy1; \ + } else {assert(0); txy = 0;} \ + } while(0) + +#define _glamor_repeat_reflect_fixup(txy, xy, cd, odd, \ + wh, bxy1, bxy2) \ + do { \ + if (odd) { \ + __glamor_repeat_reflect_fixup(txy, xy, \ + cd, wh, bxy1, bxy2); \ + } else \ + txy = xy - bxy1; \ + } while(0) + +#define _glamor_get_reflect_transform_coords(priv, repeat_type, \ + tx1, ty1, \ + _x1_, _y1_) \ + do { \ + int odd_x, odd_y; \ + float c, d; \ + fodd_repeat_mod(_x1_,priv->box.x2, \ + priv->base.pixmap->drawable.width, \ + odd_x, c); \ + fodd_repeat_mod(_y1_, priv->box.y2, \ + priv->base.pixmap->drawable.height, \ + odd_y, d); \ + DEBUGF("c %f d %f oddx %d oddy %d \n", \ + c, d, odd_x, odd_y); \ + DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \ + priv->box.x1, priv->base.fbo->width); \ + DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \ + priv->box.y1, priv->base.fbo->height); \ + _glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \ + priv->base.pixmap->drawable.width, \ + priv->box.x1, priv->box.x2); \ + _glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \ + priv->base.pixmap->drawable.height, \ + priv->box.y1, priv->box.y2); \ + } while(0) + +#define _glamor_get_repeat_coords(priv, repeat_type, tx1, \ + ty1, tx2, ty2, \ + _x1_, _y1_, _x2_, \ + _y2_, c, d, odd_x, odd_y) \ + do { \ + if (repeat_type == RepeatReflect) { \ + DEBUGF("x1 y1 %d %d\n", \ + _x1_, _y1_ ); \ + DEBUGF("width %d box.x1 %d \n", \ + (priv)->base.pixmap->drawable.width, \ + priv->box.x1); \ + if (odd_x) { \ + c = (priv)->base.pixmap->drawable.width \ + - c; \ + tx1 = c - priv->box.x1; \ + tx2 = tx1 - ((_x2_) - (_x1_)); \ + } else { \ + tx1 = c - priv->box.x1; \ + tx2 = tx1 + ((_x2_) - (_x1_)); \ + } \ + if (odd_y){ \ + d = (priv)->base.pixmap->drawable.height\ + - d; \ + ty1 = d - priv->box.y1; \ + ty2 = ty1 - ((_y2_) - (_y1_)); \ + } else { \ + ty1 = d - priv->box.y1; \ + ty2 = ty1 + ((_y2_) - (_y1_)); \ + } \ + } else { /* RepeatNormal*/ \ + tx1 = (c - priv->box.x1); \ + ty1 = (d - priv->box.y1); \ + tx2 = tx1 + ((_x2_) - (_x1_)); \ + ty2 = ty1 + ((_y2_) - (_y1_)); \ + } \ + } while(0) + + +/* _x1_ ... _y2_ may has fractional. */ +#define glamor_get_repeat_transform_coords(priv, repeat_type, tx1, \ + ty1, _x1_, _y1_) \ + do { \ + DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \ + (priv)->base.pixmap->drawable.width, \ + priv->box.x1, priv->box.x2, priv->box.y1, \ + priv->box.y2); \ + DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \ + if (repeat_type != RepeatReflect) { \ + tx1 = _x1_ - priv->box.x1; \ + ty1 = _y1_ - priv->box.y1; \ + } else \ + _glamor_get_reflect_transform_coords(priv, repeat_type, \ + tx1, ty1, \ + _x1_, _y1_); \ + DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \ + } while(0) + +/* _x1_ ... _y2_ must be integer. */ +#define glamor_get_repeat_coords(priv, repeat_type, tx1, \ + ty1, tx2, ty2, _x1_, _y1_, _x2_, \ + _y2_) \ + do { \ + int c, d; \ + int odd_x = 0, odd_y = 0; \ + DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \ + (priv)->base.pixmap->drawable.width, \ + priv->box.x1, priv->box.x2, \ + priv->box.y1, priv->box.y2); \ + modulus((_x1_), (priv)->base.pixmap->drawable.width, c); \ + modulus((_y1_), (priv)->base.pixmap->drawable.height, d); \ + DEBUGF("c %d d %d \n", c, d); \ + if (repeat_type == RepeatReflect) { \ + odd_x = abs((_x1_ - c) \ + / (priv->base.pixmap->drawable.width)) & 1; \ + odd_y = abs((_y1_ - d) \ + / (priv->base.pixmap->drawable.height)) & 1; \ + } \ + _glamor_get_repeat_coords(priv, repeat_type, tx1, ty1, tx2, ty2,\ + _x1_, _y1_, _x2_, _y2_, c, d, \ + odd_x, odd_y); \ + } while(0) + +#define glamor_transform_point(matrix, tx, ty, x, y) \ + do { \ + int _i_; \ + float _result_[4]; \ + for (_i_ = 0; _i_ < 3; _i_++) { \ + _result_[_i_] = (matrix)[_i_ * 3] * (x) + (matrix)[_i_ * 3 + 1] * (y) \ + + (matrix)[_i_ * 3 + 2]; \ + } \ + tx = _result_[0] / _result_[2]; \ + ty = _result_[1] / _result_[2]; \ + } while(0) + +#define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_, \ + texcoord, yInverted) \ + do { \ + (texcoord)[0] = t_from_x_coord_x(xscale, _tx_); \ + if (likely(yInverted)) \ + (texcoord)[1] = t_from_x_coord_y_inverted(yscale, _ty_);\ + else \ + (texcoord)[1] = t_from_x_coord_y(yscale, _ty_); \ + DEBUGF("normalized point tx %f ty %f \n", (texcoord)[0], \ + (texcoord)[1]); \ + } while(0) + +#define glamor_set_transformed_point(priv, matrix, xscale, \ + yscale, texcoord, \ + x, y, \ + yInverted) \ + do { \ + float tx, ty; \ + int fbo_x_off, fbo_y_off; \ + pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ + glamor_transform_point(matrix, tx, ty, x, y); \ + DEBUGF("tx %f ty %f fbooff %d %d \n", \ + tx, ty, fbo_x_off, fbo_y_off); \ + \ + tx += fbo_x_off; \ + ty += fbo_y_off; \ + (texcoord)[0] = t_from_x_coord_x(xscale, tx); \ + if (likely(yInverted)) \ + (texcoord)[1] = t_from_x_coord_y_inverted(yscale, ty); \ + else \ + (texcoord)[1] = t_from_x_coord_y(yscale, ty); \ + DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]); \ + } while(0) + +#define glamor_set_transformed_normalize_tri_tcoords(priv, \ + matrix, \ + xscale, \ + yscale, \ + vtx, \ + yInverted, \ + texcoords) \ + do { \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords, (vtx)[0], (vtx)[1], \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords+2, (vtx)[2], (vtx)[3], \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords+4, (vtx)[4], (vtx)[5], \ + yInverted); \ + } while (0) + +#define glamor_set_transformed_normalize_tcoords_ext( priv, \ + matrix, \ + xscale, \ + yscale, \ + tx1, ty1, tx2, ty2, \ + yInverted, texcoords, \ + stride) \ + do { \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords, tx1, ty1, \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords + 1 * stride, tx2, ty1, \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords + 2 * stride, tx2, ty2, \ + yInverted); \ + glamor_set_transformed_point(priv, matrix, xscale, yscale, \ + texcoords + 3 * stride, tx1, ty2, \ + yInverted); \ + } while (0) + +#define glamor_set_transformed_normalize_tcoords( priv, \ + matrix, \ + xscale, \ + yscale, \ + tx1, ty1, tx2, ty2, \ + yInverted, texcoords) \ + do { \ + glamor_set_transformed_normalize_tcoords_ext( priv, \ + matrix, \ + xscale, \ + yscale, \ + tx1, ty1, tx2, ty2, \ + yInverted, texcoords, \ + 2); \ + } while (0) + + + +#define glamor_set_normalize_tri_tcoords(xscale, \ + yscale, \ + vtx, \ + yInverted, \ + texcoords) \ + do { \ + _glamor_set_normalize_tpoint(xscale, yscale, \ + (vtx)[0], (vtx)[1], \ + texcoords, \ + yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, \ + (vtx)[2], (vtx)[3], \ + texcoords+2, \ + yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, \ + (vtx)[4], (vtx)[5], \ + texcoords+4, \ + yInverted); \ + } while (0) + +#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \ + repeat_type, \ + matrix, \ + xscale, \ + yscale, \ + _x1_, _y1_, \ + _x2_, _y2_, \ + yInverted, \ + texcoords, \ + stride) \ + do { \ + if (likely(priv->type != GLAMOR_TEXTURE_LARGE)) { \ + glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \ + yscale, _x1_, _y1_, \ + _x2_, _y2_, yInverted, \ + texcoords, stride); \ + } else { \ + float tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4; \ + float ttx1, tty1, ttx2, tty2, ttx3, tty3, ttx4, tty4; \ + DEBUGF("original coords %d %d %d %d\n", _x1_, _y1_, _x2_, _y2_); \ + glamor_transform_point(matrix, tx1, ty1, _x1_, _y1_); \ + glamor_transform_point(matrix, tx2, ty2, _x2_, _y1_); \ + glamor_transform_point(matrix, tx3, ty3, _x2_, _y2_); \ + glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \ + DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \ + tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx1, tty1, \ + tx1, ty1); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx2, tty2, \ + tx2, ty2); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx3, tty3, \ + tx3, ty3); \ + glamor_get_repeat_transform_coords((&priv->large), repeat_type, \ + ttx4, tty4, \ + tx4, ty4); \ + DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1, \ + ttx2, tty2, ttx3, tty3, ttx4, tty4); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx1, tty1, \ + texcoords, yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx2, tty2, \ + texcoords + 1 * stride, yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx3, tty3, \ + texcoords + 2 * stride, yInverted); \ + _glamor_set_normalize_tpoint(xscale, yscale, ttx4, tty4, \ + texcoords + 3 * stride, yInverted); \ + } \ + } while (0) + + +#define glamor_set_repeat_transformed_normalize_tcoords( priv, \ + repeat_type, \ + matrix, \ + xscale, \ + yscale, \ + _x1_, _y1_, \ + _x2_, _y2_, \ + yInverted, \ + texcoords) \ + do { \ + glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \ + repeat_type, \ + matrix, \ + xscale, \ + yscale, \ + _x1_, _y1_, \ + _x2_, _y2_, \ + yInverted, \ + texcoords, \ + 2); \ + } while (0) + +#define _glamor_set_normalize_tcoords(xscale, yscale, tx1, \ + ty1, tx2, ty2, \ + yInverted, vertices, stride) \ + do { \ + /* vertices may be write-only, so we use following \ + * temporary variable. */ \ + float _t0_, _t1_, _t2_, _t5_; \ + (vertices)[0] = _t0_ = t_from_x_coord_x(xscale, tx1); \ + (vertices)[1 * stride] = _t2_ = t_from_x_coord_x(xscale, tx2); \ + (vertices)[2 * stride] = _t2_; \ + (vertices)[3 * stride] = _t0_; \ + if (likely(yInverted)) { \ + (vertices)[1] = _t1_ = t_from_x_coord_y_inverted(yscale, ty1); \ + (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y_inverted(yscale, ty2);\ + } \ + else { \ + (vertices)[1] = _t1_ = t_from_x_coord_y(yscale, ty1); \ + (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y(yscale, ty2);\ + } \ + (vertices)[1 * stride + 1] = _t1_; \ + (vertices)[3 * stride + 1] = _t5_; \ + } while(0) + +#define glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, stride) \ + do { \ + if (unlikely(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + float tx1, tx2, ty1, ty2; \ + int fbo_x_off, fbo_y_off; \ + pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ + tx1 = x1 + fbo_x_off; \ + tx2 = x2 + fbo_x_off; \ + ty1 = y1 + fbo_y_off; \ + ty2 = y2 + fbo_y_off; \ + _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \ + tx2, ty2, yInverted, vertices, \ + stride); \ + } else \ + _glamor_set_normalize_tcoords(xscale, yscale, x1, y1, \ + x2, y2, yInverted, vertices, stride);\ + } while(0) + + +#define glamor_set_normalize_tcoords(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + glamor_set_normalize_tcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, 2); \ + } while(0) + +#define glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \ + xscale, yscale, \ + _x1_, _y1_, _x2_, _y2_, \ + yInverted, vertices, stride)\ + do { \ + if (unlikely(priv->type == GLAMOR_TEXTURE_LARGE)) { \ + float tx1, tx2, ty1, ty2; \ + if (repeat_type == RepeatPad) { \ + tx1 = _x1_ - priv->large.box.x1; \ + ty1 = _y1_ - priv->large.box.y1; \ + tx2 = tx1 + ((_x2_) - (_x1_)); \ + ty2 = ty1 + ((_y2_) - (_y1_)); \ + } else { \ + glamor_get_repeat_coords((&priv->large), repeat_type, \ + tx1, ty1, tx2, ty2, \ + _x1_, _y1_, _x2_, _y2_); \ + } \ + _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1, \ + tx2, ty2, yInverted, vertices, \ + stride); \ + } else \ + _glamor_set_normalize_tcoords(xscale, yscale, _x1_, _y1_, \ + _x2_, _y2_, yInverted, vertices, \ + stride); \ + } while(0) + + +#define glamor_set_repeat_normalize_tcoords(priv, repeat_type, \ + xscale, yscale, \ + _x1_, _y1_, _x2_, _y2_, \ + yInverted, vertices) \ + do { \ + glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \ + xscale, yscale, \ + _x1_, _y1_, _x2_, _y2_, \ + yInverted, vertices, 2); \ + } while(0) + +#define glamor_set_normalize_tcoords_tri_stripe(xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = t_from_x_coord_x(xscale, x1); \ + (vertices)[2] = t_from_x_coord_x(xscale, x2); \ + (vertices)[6] = (vertices)[2]; \ + (vertices)[4] = (vertices)[0]; \ + if (likely(yInverted)) { \ + (vertices)[1] = t_from_x_coord_y_inverted(yscale, y1); \ + (vertices)[7] = t_from_x_coord_y_inverted(yscale, y2); \ + } \ + else { \ + (vertices)[1] = t_from_x_coord_y(yscale, y1); \ + (vertices)[7] = t_from_x_coord_y(yscale, y2); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[5] = (vertices)[7]; \ + } while(0) + +#define glamor_set_tcoords(width, height, x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = (x1); \ + (vertices)[2] = (x2); \ + (vertices)[4] = (vertices)[2]; \ + (vertices)[6] = (vertices)[0]; \ + if (likely(yInverted)) { \ + (vertices)[1] = (y1); \ + (vertices)[5] = (y2); \ + } \ + else { \ + (vertices)[1] = height - (y2); \ + (vertices)[5] = height - (y1); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[7] = (vertices)[5]; \ + } while(0) + +#define glamor_set_tcoords_ext(width, height, x1, y1, x2, y2, \ + yInverted, vertices, stride) \ + do { \ + (vertices)[0] = (x1); \ + (vertices)[1*stride] = (x2); \ + (vertices)[2*stride] = (vertices)[1*stride]; \ + (vertices)[3*stride] = (vertices)[0]; \ + if (likely(yInverted)) { \ + (vertices)[1] = (y1); \ + (vertices)[2*stride + 1] = (y2); \ + } \ + else { \ + (vertices)[1] = height - (y2); \ + (vertices)[2*stride + 1] = height - (y1); \ + } \ + (vertices)[1*stride + 1] = (vertices)[1]; \ + (vertices)[3*stride + 1] = (vertices)[2*stride + 1]; \ + } while(0) + +#define glamor_set_normalize_one_vcoord(xscale, yscale, x, y, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = v_from_x_coord_x(xscale, x); \ + if (likely(yInverted)) { \ + (vertices)[1] = v_from_x_coord_y_inverted(yscale, y); \ + } else { \ + (vertices)[1] = v_from_x_coord_y(yscale, y); \ + } \ + } while(0) + +#define glamor_set_normalize_tri_vcoords(xscale, yscale, vtx, \ + yInverted, vertices) \ + do { \ + glamor_set_normalize_one_vcoord(xscale, yscale, \ + (vtx)[0], (vtx)[1], \ + yInverted, vertices); \ + glamor_set_normalize_one_vcoord(xscale, yscale, \ + (vtx)[2], (vtx)[3], \ + yInverted, vertices+2); \ + glamor_set_normalize_one_vcoord(xscale, yscale, \ + (vtx)[4], (vtx)[5], \ + yInverted, vertices+4); \ + } while(0) + +#define glamor_set_tcoords_tri_strip(width, height, x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = (x1); \ + (vertices)[2] = (x2); \ + (vertices)[6] = (vertices)[2]; \ + (vertices)[4] = (vertices)[0]; \ + if (likely(yInverted)) { \ + (vertices)[1] = (y1); \ + (vertices)[7] = (y2); \ + } \ + else { \ + (vertices)[1] = height - (y2); \ + (vertices)[7] = height - (y1); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[5] = (vertices)[7]; \ + } while(0) + +#define glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, stride) \ + do { \ + int fbo_x_off, fbo_y_off; \ + /* vertices may be write-only, so we use following \ + * temporary variable. */ \ + float _t0_, _t1_, _t2_, _t5_; \ + pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \ + (vertices)[0] = _t0_ = v_from_x_coord_x(xscale, x1 + fbo_x_off); \ + (vertices)[1 * stride] = _t2_ = v_from_x_coord_x(xscale, \ + x2 + fbo_x_off); \ + (vertices)[2 * stride] = _t2_; \ + (vertices)[3 * stride] = _t0_; \ + if (likely(yInverted)) { \ + (vertices)[1] = _t1_ = v_from_x_coord_y_inverted(yscale, \ + y1 + fbo_y_off); \ + (vertices)[2 * stride + 1] = _t5_ = \ + v_from_x_coord_y_inverted(yscale, \ + y2 + fbo_y_off); \ + } \ + else { \ + (vertices)[1] = _t1_ = v_from_x_coord_y(yscale, y1 + fbo_y_off); \ + (vertices)[2 * stride + 1] = _t5_ = v_from_x_coord_y(yscale, \ + y2 + fbo_y_off); \ + } \ + (vertices)[1 * stride + 1] = _t1_; \ + (vertices)[3 * stride + 1] = _t5_; \ + } while(0) + + +#define glamor_set_normalize_vcoords(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + glamor_set_normalize_vcoords_ext(priv, xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices, 2); \ + } while(0) + +#define glamor_set_const_ext(params, nparam, vertices, nverts, stride) \ + do { \ + int _i_ = 0, _j_ = 0; \ + for(; _i_ < nverts; _i_++) { \ + for(_j_ = 0; _j_ < nparam; _j_++) { \ + vertices[stride*_i_ + _j_] = params[_j_]; \ + } \ + } \ + } while(0) + +#define glamor_set_normalize_vcoords_tri_strip(xscale, yscale, \ + x1, y1, x2, y2, \ + yInverted, vertices) \ + do { \ + (vertices)[0] = v_from_x_coord_x(xscale, x1); \ + (vertices)[2] = v_from_x_coord_x(xscale, x2); \ + (vertices)[6] = (vertices)[2]; \ + (vertices)[4] = (vertices)[0]; \ + if (likely(yInverted)) { \ + (vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \ + (vertices)[7] = v_from_x_coord_y_inverted(yscale, y2); \ + } \ + else { \ + (vertices)[1] = v_from_x_coord_y(yscale, y1); \ + (vertices)[7] = v_from_x_coord_y(yscale, y2); \ + } \ + (vertices)[3] = (vertices)[1]; \ + (vertices)[5] = (vertices)[7]; \ + } while(0) + +#define glamor_set_normalize_pt(xscale, yscale, x, y, \ + yInverted, pt) \ + do { \ + (pt)[0] = t_from_x_coord_x(xscale, x); \ + if (likely(yInverted)) { \ + (pt)[1] = t_from_x_coord_y_inverted(yscale, y); \ + } else { \ + (pt)[1] = t_from_x_coord_y(yscale, y); \ + } \ + } while(0) + +#define glamor_set_circle_centre(width, height, x, y, \ + yInverted, c) \ + do { \ + (c)[0] = (float)x; \ + if (likely(yInverted)) { \ + (c)[1] = (float)y; \ + } else { \ + (c)[1] = (float)height - (float)y; \ + } \ + } while(0) + +inline static void +glamor_calculate_boxes_bound(BoxPtr bound, BoxPtr boxes, int nbox) +{ + int x_min, y_min; + int x_max, y_max; + int i; + x_min = y_min = MAXSHORT; + x_max = y_max = MINSHORT; + for (i = 0; i < nbox; i++) { + if (x_min > boxes[i].x1) + x_min = boxes[i].x1; + if (y_min > boxes[i].y1) + y_min = boxes[i].y1; + + if (x_max < boxes[i].x2) + x_max = boxes[i].x2; + if (y_max < boxes[i].y2) + y_max = boxes[i].y2; + } + bound->x1 = x_min; + bound->y1 = y_min; + bound->x2 = x_max; + bound->y2 = y_max; +} + +inline static void +glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy) +{ + int i; + for (i = 0; i < nbox; i++) { + boxes[i].x1 += dx; + boxes[i].y1 += dy; + boxes[i].x2 += dx; + boxes[i].y2 += dy; + } +} + +static inline Bool +region_is_empty(pixman_region16_t *region) +{ + return region->data && region->data->numRects == 0; +} + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + +#define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define glamor_check_fbo_size(_glamor_,_w_, _h_) ((_w_) > 0 && (_h_) > 0 \ + && (_w_) <= _glamor_->max_fbo_size \ + && (_h_) <= _glamor_->max_fbo_size) + +/* For 1bpp pixmap, we don't store it as texture. */ +#define glamor_check_pixmap_fbo_depth(_depth_) ( \ + _depth_ == 8 \ + || _depth_ == 15 \ + || _depth_ == 16 \ + || _depth_ == 24 \ + || _depth_ == 30 \ + || _depth_ == 32) + +#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->base.is_picture == 1) +#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->base.gl_fbo == GLAMOR_FBO_NORMAL) +#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED)) + +/** + * Borrow from uxa. + */ +static inline CARD32 +format_for_depth(int depth) +{ + switch (depth) { + case 1: + return PICT_a1; + case 4: + return PICT_a4; + case 8: + return PICT_a8; + case 15: + return PICT_x1r5g5b5; + case 16: + return PICT_r5g6b5; + default: + case 24: + return PICT_x8r8g8b8; +#if XORG_VERSION_CURRENT >= 10699900 + case 30: + return PICT_x2r10g10b10; +#endif + case 32: + return PICT_a8r8g8b8; + } +} + +static inline void +gl_iformat_for_depth(int depth, GLenum * format) +{ + switch (depth) { +#ifndef GLAMOR_GLES2 + case 1: + case 8: + *format = GL_ALPHA; + break; +#endif + default: + *format = GL_RGBA; + break; + } +} + +static inline CARD32 +format_for_pixmap(PixmapPtr pixmap) +{ + glamor_pixmap_private *pixmap_priv; + PictFormatShort pict_format; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) + pict_format = pixmap_priv->base.picture->format; + else + pict_format = format_for_depth(pixmap->drawable.depth); + + return pict_format; +} + +#define REVERT_NONE 0 +#define REVERT_NORMAL 1 +#define REVERT_DOWNLOADING_A1 2 +#define REVERT_UPLOADING_A1 3 +#define REVERT_DOWNLOADING_2_10_10_10 4 +#define REVERT_UPLOADING_2_10_10_10 5 +#define REVERT_DOWNLOADING_1_5_5_5 7 +#define REVERT_UPLOADING_1_5_5_5 8 +#define REVERT_DOWNLOADING_10_10_10_2 9 +#define REVERT_UPLOADING_10_10_10_2 10 + +#define SWAP_NONE_DOWNLOADING 0 +#define SWAP_DOWNLOADING 1 +#define SWAP_UPLOADING 2 +#define SWAP_NONE_UPLOADING 3 + +/* + * Map picture's format to the correct gl texture format and type. + * no_alpha is used to indicate whehter we need to wire alpha to 1. + * + * Although opengl support A1/GL_BITMAP, we still don't use it + * here, it seems that mesa has bugs when uploading a A1 bitmap. + * + * Return 0 if find a matched texture type. Otherwise return -1. + **/ +#ifndef GLAMOR_GLES2 +static inline int +glamor_get_tex_format_type_from_pictformat(PictFormatShort format, + GLenum * tex_format, + GLenum * tex_type, + int *no_alpha, + int *revert, + int *swap_rb, + int is_upload) + +{ + *no_alpha = 0; + *revert = REVERT_NONE; + *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; + switch (format) { + case PICT_a1: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; + break; + case PICT_b8g8r8x8: + *no_alpha = 1; + case PICT_b8g8r8a8: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8; + break; + + case PICT_x8r8g8b8: + *no_alpha = 1; + case PICT_a8r8g8b8: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case PICT_x8b8g8r8: + *no_alpha = 1; + case PICT_a8b8g8r8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case PICT_x2r10g10b10: + *no_alpha = 1; + case PICT_a2r10g10b10: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + case PICT_x2b10g10r10: + *no_alpha = 1; + case PICT_a2b10g10r10: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + + case PICT_r5g6b5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + break; + case PICT_b5g6r5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV; + break; + case PICT_x1b5g5r5: + *no_alpha = 1; + case PICT_a1b5g5r5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + + case PICT_x1r5g5b5: + *no_alpha = 1; + case PICT_a1r5g5b5: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + case PICT_a8: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + break; + case PICT_x4r4g4b4: + *no_alpha = 1; + case PICT_a4r4g4b4: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; + break; + + case PICT_x4b4g4r4: + *no_alpha = 1; + case PICT_a4b4g4r4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; + break; + + default: + LogMessageVerb(X_INFO, 0, + "fail to get matched format for %x \n", + format); + return -1; + } + return 0; +} + +/* Currently, we use RGBA to represent all formats. */ +inline static int cache_format(GLenum format) +{ + switch (format) { + case GL_ALPHA: + return 1; + case GL_RGBA: + return 0; + default: + return -1; + } +} + +#else +#define IS_LITTLE_ENDIAN (IMAGE_BYTE_ORDER == LSBFirst) + +static inline int +glamor_get_tex_format_type_from_pictformat(PictFormatShort format, + GLenum * tex_format, + GLenum * tex_type, + int *no_alpha, + int *revert, + int *swap_rb, + int is_upload) +{ + int need_swap_rb = 0; + + *no_alpha = 0; + *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; + + switch (format) { + case PICT_b8g8r8x8: + *no_alpha = 1; + case PICT_b8g8r8a8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + need_swap_rb = 1; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + break; + + case PICT_x8r8g8b8: + *no_alpha = 1; + case PICT_a8r8g8b8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + need_swap_rb = 1; + break; + + case PICT_x8b8g8r8: + *no_alpha = 1; + case PICT_a8b8g8r8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + break; + + case PICT_x2r10g10b10: + *no_alpha = 1; + case PICT_a2r10g10b10: + *tex_format = GL_RGBA; + /* glReadPixmap doesn't support GL_UNSIGNED_INT_10_10_10_2. + * we have to use GL_UNSIGNED_BYTE and do the conversion in + * shader latter.*/ + *tex_type = GL_UNSIGNED_BYTE; + if (is_upload == 1) { + if (!IS_LITTLE_ENDIAN) + *revert = REVERT_UPLOADING_10_10_10_2; + else + *revert = REVERT_UPLOADING_2_10_10_10; + } + else { + if (!IS_LITTLE_ENDIAN) { + *revert = REVERT_DOWNLOADING_10_10_10_2; + } + else { + *revert = REVERT_DOWNLOADING_2_10_10_10; + } + } + need_swap_rb = 1; + + break; + + case PICT_x2b10g10r10: + *no_alpha = 1; + case PICT_a2b10g10r10: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + if (is_upload == 1) { + if (!IS_LITTLE_ENDIAN) + *revert = REVERT_UPLOADING_10_10_10_2; + else + *revert = REVERT_UPLOADING_2_10_10_10; + } + else { + if (!IS_LITTLE_ENDIAN) { + *revert = REVERT_DOWNLOADING_10_10_10_2; + } + else { + *revert = REVERT_DOWNLOADING_2_10_10_10; + } + } + break; + + case PICT_r5g6b5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; + + break; + + case PICT_b5g6r5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + need_swap_rb = IS_LITTLE_ENDIAN ? 1 : 0;; + break; + + case PICT_x1b5g5r5: + *no_alpha = 1; + case PICT_a1b5g5r5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; + if (IS_LITTLE_ENDIAN) { + *revert = is_upload ? REVERT_UPLOADING_1_5_5_5 : REVERT_DOWNLOADING_1_5_5_5; + } else + *revert = REVERT_NONE; + break; + + case PICT_x1r5g5b5: + *no_alpha = 1; + case PICT_a1r5g5b5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; + if (IS_LITTLE_ENDIAN) { + *revert = is_upload ? REVERT_UPLOADING_1_5_5_5 : REVERT_DOWNLOADING_1_5_5_5; + } else + *revert = REVERT_NONE; + need_swap_rb = 1; + break; + + case PICT_a1: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; + break; + + case PICT_a8: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = REVERT_NONE; + break; + + case PICT_x4r4g4b4: + *no_alpha = 1; + case PICT_a4r4g4b4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + need_swap_rb = 1; + break; + + case PICT_x4b4g4r4: + *no_alpha = 1; + case PICT_a4b4g4r4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + break; + + default: + LogMessageVerb(X_INFO, 0, + "fail to get matched format for %x \n", + format); + return -1; + } + + if (need_swap_rb) + *swap_rb = is_upload ? SWAP_UPLOADING : SWAP_DOWNLOADING; + else + *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; + return 0; +} + +inline static int cache_format(GLenum format) +{ + switch (format) { + case GL_ALPHA: + return 2; + case GL_RGB: + return 1; + case GL_RGBA: + return 0; + default: + return -1; + } +} + +#endif + + +static inline int +glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, + GLenum * format, + GLenum * type, + int *no_alpha, + int *revert, + int *swap_rb, + int is_upload) +{ + glamor_pixmap_private *pixmap_priv; + PictFormatShort pict_format; + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) + pict_format = pixmap_priv->base.picture->format; + else + pict_format = format_for_depth(pixmap->drawable.depth); + + return glamor_get_tex_format_type_from_pictformat(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); +} + + +/* borrowed from uxa */ +static inline Bool +glamor_get_rgba_from_pixel(CARD32 pixel, + float *red, + float *green, + float *blue, float *alpha, CARD32 format) +{ + int rbits, bbits, gbits, abits; + int rshift, bshift, gshift, ashift; + + rbits = PICT_FORMAT_R(format); + gbits = PICT_FORMAT_G(format); + bbits = PICT_FORMAT_B(format); + abits = PICT_FORMAT_A(format); + + if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) { + rshift = gshift = bshift = ashift = 0; + } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { + bshift = 0; + gshift = bbits; + rshift = gshift + gbits; + ashift = rshift + rbits; + } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) { + rshift = 0; + gshift = rbits; + bshift = gshift + gbits; + ashift = bshift + bbits; +#if XORG_VERSION_CURRENT >= 10699900 + } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) { + ashift = 0; + rshift = abits; + if (abits == 0) + rshift = PICT_FORMAT_BPP(format) - (rbits + gbits + + bbits); + gshift = rshift + rbits; + bshift = gshift + gbits; +#endif + } else { + return FALSE; + } +#define COLOR_INT_TO_FLOAT(_fc_, _p_, _s_, _bits_) \ + *_fc_ = (((_p_) >> (_s_)) & (( 1 << (_bits_)) - 1)) \ + / (float)((1<<(_bits_)) - 1) + + if (rbits) + COLOR_INT_TO_FLOAT(red, pixel, rshift, rbits); + else + *red = 0; + + if (gbits) + COLOR_INT_TO_FLOAT(green, pixel, gshift, gbits); + else + *green = 0; + + if (bbits) + COLOR_INT_TO_FLOAT(blue, pixel, bshift, bbits); + else + *blue = 0; + + if (abits) + COLOR_INT_TO_FLOAT(alpha, pixel, ashift, abits); + else + *alpha = 1; + + return TRUE; +} + +inline static Bool glamor_pict_format_is_compatible(PictFormatShort pict_format, int depth) +{ + GLenum iformat; + + gl_iformat_for_depth(depth, &iformat); + switch (iformat) { + case GL_RGBA: + return (pict_format == PICT_a8r8g8b8 || pict_format == PICT_x8r8g8b8); + case GL_ALPHA: + return (pict_format == PICT_a8); + default: + return FALSE; + } +} + +/* return TRUE if we can access this pixmap at DDX driver. */ +inline static Bool glamor_ddx_fallback_check_pixmap(DrawablePtr drawable) +{ + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); + return (!pixmap_priv + || (pixmap_priv->type == GLAMOR_TEXTURE_DRM + || pixmap_priv->type == GLAMOR_MEMORY + || pixmap_priv->type == GLAMOR_DRM_ONLY)); +} + +inline static Bool glamor_ddx_fallback_check_gc(GCPtr gc) +{ + PixmapPtr pixmap; + if (!gc) + return TRUE; + switch (gc->fillStyle) { + case FillStippled: + case FillOpaqueStippled: + pixmap = gc->stipple; + break; + case FillTiled: + pixmap = gc->tile.pixmap; + break; + default: + pixmap = NULL; + } + return (!pixmap || glamor_ddx_fallback_check_pixmap(&pixmap->drawable)); +} +inline static Bool glamor_is_large_pixmap(PixmapPtr pixmap) +{ + glamor_pixmap_private *priv; + + priv = glamor_get_pixmap_private(pixmap); + return (priv->type == GLAMOR_TEXTURE_LARGE); +} + +inline static Bool glamor_is_large_picture(PicturePtr picture) +{ + PixmapPtr pixmap; + + if (picture->pDrawable) { + pixmap = glamor_get_drawable_pixmap(picture->pDrawable); + return glamor_is_large_pixmap(pixmap); + } + return FALSE; +} + +inline static Bool glamor_tex_format_is_readable(GLenum format) +{ + return ((format == GL_RGBA || format == GL_RGB || format == GL_ALPHA)); + +} + +static inline void _glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i,j; + unsigned char * p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) + { + ErrorF("line %3d: ", i); + for(j = 0; j < w; j++) + ErrorF("%2d ", (p[j/8] & (1 << (j%8)))>>(j%8)); + p += stride; + ErrorF("\n"); + } +} + +static inline void _glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i,j; + unsigned char * p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) + { + ErrorF("line %3d: ", i); + for(j = 0; j < w; j++) + ErrorF("%2x ", p[j]); + p += stride; + ErrorF("\n"); + } +} + +static inline void _glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i,j; + unsigned short * p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind / 2; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) + { + ErrorF("line %3d: ", i); + for(j = 0; j < w; j++) + ErrorF("%2x ", p[j]); + p += stride; + ErrorF("\n"); + } +} + +static inline void _glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h) +{ + int i,j; + unsigned int * p = pixmap->devPrivate.ptr; + int stride = pixmap->devKind / 4; + + p = p + y * stride + x; + + for (i = 0; i < h; i++) + { + ErrorF("line %3d: ", i); + for(j = 0; j < w; j++) + ErrorF("%2x ", p[j]); + p += stride; + ErrorF("\n"); + } +} + +static inline void glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h) +{ + w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w; + h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h; + + glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO); + switch (pixmap->drawable.depth) { + case 8: + _glamor_dump_pixmap_byte(pixmap, x, y, w, h); + break; + case 15: + case 16: + _glamor_dump_pixmap_sword(pixmap, x, y, w, h); + break; + + case 24: + case 32: + _glamor_dump_pixmap_word(pixmap, x, y, w, h); + break; + case 1: + _glamor_dump_pixmap_bits(pixmap, x, y, w, h); + break; + default: + ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth); + } + glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO); +} + +static inline void _glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2, + int x, int y, int w, int h, + PictFormatShort short_format, + int all, int diffs) +{ + int i, j; + unsigned char * p1 = pixmap1->devPrivate.ptr; + unsigned char * p2 = pixmap2->devPrivate.ptr; + int line_need_printed = 0; + int test_code = 0xAABBCCDD; + int little_endian = 0; + unsigned char *p_test; + int bpp = pixmap1->drawable.depth == 8 ? 1 : 4; + int stride = pixmap1->devKind; + + assert(pixmap1->devKind == pixmap2->devKind); + + ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h); + + p1 = p1 + y * stride + x; + p2 = p2 + y * stride + x; + + if (all) { + for (i = 0; i < h; i++) { + ErrorF("line %3d: ", i); + + for (j = 0; j < stride; j++) { + if (j % bpp == 0) + ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]); + else + ErrorF("%2x:%2x ", p1[j], p2[j]); + } + + p1 += stride; + p2 += stride; + ErrorF("\n"); + } + } else { + if (short_format == PICT_a8r8g8b8) { + p_test = (unsigned char *) & test_code; + little_endian = (*p_test == 0xDD); + bpp = 4; + + for (i = 0; i < h; i++) { + line_need_printed = 0; + + for (j = 0; j < stride; j++) { + if (p1[j] != p2[j] && (p1[j] - p2[j] > diffs || p2[j] - p1[j] > diffs)) { + if (line_need_printed) { + if (little_endian) { + switch (j % 4) { + case 2: + ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + case 1: + ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + case 0: + ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + case 3: + ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + } + } else { + switch (j % 4) { + case 1: + ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + case 2: + ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + case 3: + ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + case 0: + ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j], p2[j]); + break; + } + } + } else { + line_need_printed = 1; + j = -1; + ErrorF("line %3d: ", i); + continue; + } + } + } + + p1 += stride; + p2 += stride; + ErrorF("\n"); + } + } //more format can be added here. + else { // the default format, just print. + for (i = 0; i < h; i++) { + line_need_printed = 0; + + for (j = 0; j < stride; j++) { + if (p1[j] != p2[j]) { + if (line_need_printed) { + ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]); + } else { + line_need_printed = 1; + j = -1; + ErrorF("line %3d: ", i); + continue; + } + } + } + + p1 += stride; + p2 += stride; + ErrorF("\n"); + } + } + } +} + +static inline void glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2, + int x, int y, int w, int h, int all, int diffs) +{ + assert(pixmap1->drawable.depth == pixmap2->drawable.depth); + + glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO); + glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO); + + _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs); + + glamor_finish_access(&pixmap1->drawable, GLAMOR_ACCESS_RO); + glamor_finish_access(&pixmap2->drawable, GLAMOR_ACCESS_RO); +} + +/* This function is used to compare two pictures. + If the picture has no drawable, we use fb functions to generate it. */ +static inline void glamor_compare_pictures( ScreenPtr screen, + PicturePtr fst_picture, + PicturePtr snd_picture, + int x_source, int y_source, + int width, int height, + int all, int diffs) +{ + PixmapPtr fst_pixmap; + PixmapPtr snd_pixmap; + int fst_generated, snd_generated; + int error; + int fst_type = -1; + int snd_type = -1; // -1 represent has drawable. + + if (fst_picture->format != snd_picture->format) { + ErrorF("Different picture format can not compare!\n"); + return; + } + + if (!fst_picture->pDrawable) { + fst_type = fst_picture->pSourcePict->type; + } + + if (!snd_picture->pDrawable) { + snd_type = snd_picture->pSourcePict->type; + } + + if ((fst_type != -1) && (snd_type != -1) && (fst_type != snd_type)) { + ErrorF("Different picture type will never be same!\n"); + return; + } + + fst_generated = snd_generated = 0; + + if (!fst_picture->pDrawable) { + PicturePtr pixman_pic; + PixmapPtr pixmap = NULL; + PictFormatShort format; + + format = fst_picture->format; + + pixmap = glamor_create_pixmap(screen, + width, height, + PIXMAN_FORMAT_DEPTH(format), + GLAMOR_CREATE_PIXMAP_CPU); + + pixman_pic = CreatePicture(0, + &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH(format), format), + 0, 0, serverClient, &error); + + fbComposite(PictOpSrc, fst_picture, NULL, pixman_pic, + x_source, y_source, + 0, 0, + 0, 0, + width, height); + + glamor_destroy_pixmap(pixmap); + + fst_picture = pixman_pic; + fst_generated = 1; + } + + if (!snd_picture->pDrawable) { + PicturePtr pixman_pic; + PixmapPtr pixmap = NULL; + PictFormatShort format; + + format = snd_picture->format; + + pixmap = glamor_create_pixmap(screen, + width, height, + PIXMAN_FORMAT_DEPTH(format), + GLAMOR_CREATE_PIXMAP_CPU); + + pixman_pic = CreatePicture(0, + &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH(format), format), + 0, 0, serverClient, &error); + + fbComposite(PictOpSrc, snd_picture, NULL, pixman_pic, + x_source, y_source, + 0, 0, + 0, 0, + width, height); + + glamor_destroy_pixmap(pixmap); + + snd_picture = pixman_pic; + snd_generated = 1; + } + + fst_pixmap = glamor_get_drawable_pixmap(fst_picture->pDrawable); + snd_pixmap = glamor_get_drawable_pixmap(snd_picture->pDrawable); + + if (fst_pixmap->drawable.depth != snd_pixmap->drawable.depth) { + if (fst_generated) + glamor_destroy_picture(fst_picture); + if (snd_generated) + glamor_destroy_picture(snd_picture); + + ErrorF("Different pixmap depth can not compare!\n"); + return; + } + + glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO); + glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO); + + if ((fst_type == SourcePictTypeLinear) || + (fst_type == SourcePictTypeRadial) || + (fst_type == SourcePictTypeConical) || + (snd_type == SourcePictTypeLinear) || + (snd_type == SourcePictTypeRadial) || + (snd_type == SourcePictTypeConical)) { + x_source = y_source = 0; + } + + _glamor_compare_pixmaps(fst_pixmap, snd_pixmap, + x_source, y_source, + width, height, + fst_picture->format, all, diffs); + + glamor_finish_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO); + glamor_finish_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO); + + if (fst_generated) + glamor_destroy_picture(fst_picture); + if (snd_generated) + glamor_destroy_picture(snd_picture); + + return; +} + +#ifdef __i386__ +static inline unsigned long __fls(unsigned long x) +{ + asm("bsr %1,%0" + : "=r" (x) + : "rm" (x)); + return x; +} +#else +static inline unsigned long __fls(unsigned long x) +{ + int n; + + if (x == 0) return(0); + n = 0; + if (x <= 0x0000FFFF) {n = n +16; x = x <<16;} + if (x <= 0x00FFFFFF) {n = n + 8; x = x << 8;} + if (x <= 0x0FFFFFFF) {n = n + 4; x = x << 4;} + if (x <= 0x3FFFFFFF) {n = n + 2; x = x << 2;} + if (x <= 0x7FFFFFFF) {n = n + 1;} + return 31 - n; +} +#endif + +static inline void glamor_make_current(ScreenPtr screen) +{ + glamor_egl_make_current(screen); +} + +static inline void glamor_restore_current(ScreenPtr screen) +{ + glamor_egl_restore_context(screen); +} + +#ifdef GLX_USE_SHARED_DISPATCH +static inline glamor_gl_dispatch * +glamor_get_dispatch(glamor_screen_private *glamor_priv) +{ + if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN) + glamor_make_current(glamor_priv->screen); + + return &glamor_priv->_dispatch; +} + +static inline void +glamor_put_dispatch(glamor_screen_private *glamor_priv) +{ + if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN) + glamor_restore_current(glamor_priv->screen); +} +#else +#warning "Indirect GLX may be broken, need to implement context switch." +static inline glamor_gl_dispatch * +glamor_get_dispatch(glamor_screen_private *glamor_priv) +{ + return &glamor_priv->_dispatch; +} + +static inline void +glamor_put_dispatch(glamor_screen_private *glamor_priv) +{ +} + +#endif + +#endif diff --git a/extra/glamor-egl/glapi.h b/extra/glamor-egl/glapi.h new file mode 100644 index 000000000..d510dac1d --- /dev/null +++ b/extra/glamor-egl/glapi.h @@ -0,0 +1,121 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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. + */ + + +/** + * \mainpage Mesa GL API Module + * + * \section GLAPIIntroduction Introduction + * + * The Mesa GL API module is responsible for dispatching all the + * gl*() functions. All GL functions are dispatched by jumping through + * the current dispatch table (basically a struct full of function + * pointers.) + * + * A per-thread current dispatch table and per-thread current context + * pointer are managed by this module too. + * + * This module is intended to be non-Mesa-specific so it can be used + * with the X/DRI libGL also. + */ + +#ifndef _GLAPI_H +#define _GLAPI_H + +#define GL_GLEXT_PROTOTYPES + +#if GLAMOR_GLES2 +#include +#include +#else +#include +#include "GL/glext.h" +#endif + +/* Is this needed? It is incomplete anyway. */ +#ifdef USE_MGL_NAMESPACE +#define _glapi_set_dispatch _mglapi_set_dispatch +#define _glapi_get_dispatch _mglapi_get_dispatch +#define _glapi_set_context _mglapi_set_context +#define _glapi_get_context _mglapi_get_context +#define _glapi_Dispatch _mglapi_Dispatch +#define _glapi_Context _mglapi_Context +#endif + +typedef void (*_glapi_proc)(void); +struct _glapi_table; + + +#if defined (GLX_USE_TLS) + +extern __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))); + +extern __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +extern const struct _glapi_table *_glapi_Dispatch; +extern const void *_glapi_Context; + +# define GET_DISPATCH() _glapi_tls_Dispatch +# define GET_CURRENT_CONTEXT(C) C = (typeof(C)) _glapi_tls_Context +# define SET_CURRENT_CONTEXT(C) _glapi_tls_Context = (void*)C + +#else + +extern struct _glapi_table *_glapi_Dispatch; +extern void *_glapi_Context; + +# ifdef THREADS + +# define GET_DISPATCH() \ + (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) + +# define GET_CURRENT_CONTEXT(C) C = (typeof(C)) \ + (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context()) + + +# define SET_CURRENT_CONTEXT(C) do { if (likely(_glapi_Context)) \ + _glapi_Context = (void*)C; \ + else \ + _glapi_set_context(C); } while(0) + +# else + +# define GET_DISPATCH() _glapi_Dispatch +# define GET_CURRENT_CONTEXT(C) C = (typeof(C)) _glapi_Context +# define SET_CURRENT_CONTEXT(C) _glapi_Context = (void*)C + +# endif + +#endif /* defined (GLX_USE_TLS) */ + + +extern void +_glapi_set_context(void *context); + +extern void * +_glapi_get_context(void); + +#endif diff --git a/extra/gnome-shell/PKGBUILD b/extra/gnome-shell/PKGBUILD index 4c04ddf49..8ecc52e2e 100644 --- a/extra/gnome-shell/PKGBUILD +++ b/extra/gnome-shell/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 178416 2013-02-21 17:18:12Z heftig $ +# $Id: PKGBUILD 179858 2013-03-10 16:33:19Z heftig $ # Maintainer: Ionut Biru # Contributor: Flamelab # Contributor: Andrew Simmons # Contributor: György Balló pkgname=gparted pkgver=0.14.1 -pkgrel=4 +pkgrel=5 pkgdesc="A Partition Magic clone, frontend to GNU Parted" arch=('i686' 'x86_64') url="http://gparted.sourceforge.net" license=('GPL') -depends=('parted' 'gtkmm' 'hicolor-icon-theme' 'polkit-gnome') +depends=('parted' 'gtkmm' 'hicolor-icon-theme' 'polkit') makedepends=('intltool' 'pkg-config' 'gnome-doc-utils') optdepends=('dosfstools: for FAT16 and FAT32 partitions' 'jfsutils: for jfs partitions' @@ -18,6 +18,7 @@ optdepends=('dosfstools: for FAT16 and FAT32 partitions' 'reiserfsprogs: for reiser partitions' 'xfsprogs: for xfs partitions' 'nilfs-utils: for nilfs2 support' + 'polkit-gnome: to run gparted directly from menu' 'gpart: for recovering corrupt partition tables' 'mtools: utilities to access MS-DOS disks') install=gparted.install @@ -46,9 +47,6 @@ package() { # Install launcher script echo '#!/bin/sh' > ${pkgdir}/usr/sbin/gparted - echo 'pkexec "/usr/sbin/gparted.elf" "$@"' >> ${pkgdir}/usr/sbin/gparted + echo 'pkexec --disable-internal-agent "/usr/sbin/gparted.elf" "$@"' >> ${pkgdir}/usr/sbin/gparted chmod 755 ${pkgdir}/usr/sbin/gparted - - # Modify desktop file - sed -i -e "s|^Exec=.*|Exec=pkexec --disable-internal-agent /usr/sbin/gparted.elf|" "${pkgdir}/usr/share/applications/gparted.desktop" } diff --git a/extra/kwebkitpart/PKGBUILD b/extra/kwebkitpart/PKGBUILD index 72cf6349a..1ca34bd46 100644 --- a/extra/kwebkitpart/PKGBUILD +++ b/extra/kwebkitpart/PKGBUILD @@ -1,20 +1,22 @@ -# $Id: PKGBUILD 178216 2013-02-18 09:51:49Z andrea $ +# $Id: PKGBUILD 179888 2013-03-10 21:31:07Z andrea $ # Maintainer: Andrea Scarpino pkgname=kwebkitpart pkgver=1.3.2 -pkgrel=1 +pkgrel=2 pkgdesc="A WebKit browser component for KDE" url="https://projects.kde.org/projects/extragear/base/kwebkitpart/" arch=('i686' 'x86_64') license=('LGPL') -depends=('kdebase-runtime') +depends=('kdelibs') makedepends=('cmake' 'automoc4') install=${pkgname}.install -source=("ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}.tar.xz") -md5sums=('c8bfcf46b4b01594d328804b6f55dcc6') +source=("ftp://ftp.archlinux.org/other/packages/${pkgname}/${pkgname}-${pkgver}.tar.bz2") +md5sums=('2df1c70371b99e5f638fff702f789ba1') build() { + sed -i '/add_subdirectory(kdelauncher)/d' ${pkgname}-${pkgver}/CMakeLists.txt + mkdir build cd build cmake ../${pkgname}-${pkgver} \ diff --git a/extra/libkdcraw/PKGBUILD b/extra/libkdcraw/PKGBUILD index 1593231e8..aa87080be 100644 --- a/extra/libkdcraw/PKGBUILD +++ b/extra/libkdcraw/PKGBUILD @@ -1,14 +1,14 @@ -# $Id: PKGBUILD 179346 2013-03-05 15:25:06Z andrea $ +# $Id: PKGBUILD 179854 2013-03-10 15:00:56Z andrea $ # Maintainer: Andrea Scarpino pkgname=libkdcraw pkgver=4.10.1 -pkgrel=1 +pkgrel=2 pkgdesc="A C++ interface used to decode RAW picture" url="https://projects.kde.org/projects/kde/kdegraphics/libs/libkdcraw" arch=('i686' 'x86_64') license=('GPL' 'LGPL' 'FDL') -depends=('kdelibs' 'lcms') +depends=('kdelibs' 'lcms2') makedepends=('cmake' 'automoc4') replaces=('kdegraphics-libs') conflicts=('kdegraphics-libs') @@ -17,7 +17,6 @@ source=("http://download.kde.org/stable/${pkgver}/src/${pkgname}-${pkgver}.tar.x sha1sums=('75d1f52d02137b275b545a5390e1857a580a1128') build() { - cd "${srcdir}" mkdir build cd build cmake ../${pkgname}-${pkgver} \ @@ -28,6 +27,6 @@ build() { } package() { - cd "${srcdir}"/build + cd build make DESTDIR="${pkgdir}" install } diff --git a/extra/xfdesktop/PKGBUILD b/extra/xfdesktop/PKGBUILD index c72c40d06..39e171b28 100644 --- a/extra/xfdesktop/PKGBUILD +++ b/extra/xfdesktop/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 179526 2013-03-06 02:34:29Z foutrelis $ +# $Id: PKGBUILD 179856 2013-03-10 16:22:07Z foutrelis $ # Maintainer: Evangelos Foutras # Contributor: tobias pkgname=xfdesktop -pkgver=4.10.1 -pkgrel=2 +pkgver=4.10.2 +pkgrel=1 pkgdesc="A desktop manager for Xfce" arch=('i686' 'x86_64') url="http://www.xfce.org/" @@ -16,18 +16,12 @@ conflicts=('xfce4-menueditor') replaces=('xfce4-menueditor') options=('!libtool') install=xfdesktop.install -source=(http://archive.xfce.org/src/xfce/$pkgname/4.10/$pkgname-$pkgver.tar.bz2 - revert-SVG-images-are-no-longer-pixilated-when-scale.patch) -sha256sums=('2883fe381e1b967d179fdf5ece5ac2566a3ffdb94f4cf139c7fb44567f17d4ad' - '94274832eede98a7d99652ff90ecabd932b46b0f002c25297ddd6f0c346aa3d0') +source=(http://archive.xfce.org/src/xfce/$pkgname/4.10/$pkgname-$pkgver.tar.bz2) +sha256sums=('49a6e0be513e307e896f7e5929825babec9bbcd4b2e73552f9d27647a4db797d') build() { cd "$srcdir/$pkgname-$pkgver" - # Fix hang when solid color is selected - # https://bugzilla.xfce.org/show_bug.cgi?id=9892 - patch -Np1 -i "$srcdir/revert-SVG-images-are-no-longer-pixilated-when-scale.patch" - ./configure \ --prefix=/usr \ --sysconfdir=/etc \ diff --git a/extra/xfdesktop/revert-SVG-images-are-no-longer-pixilated-when-scale.patch b/extra/xfdesktop/revert-SVG-images-are-no-longer-pixilated-when-scale.patch deleted file mode 100644 index 020888a2b..000000000 --- a/extra/xfdesktop/revert-SVG-images-are-no-longer-pixilated-when-scale.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 8c868b20f3e19871f3f09e972cd20dbe3640084a Mon Sep 17 00:00:00 2001 -From: Evangelos Foutras -Date: Wed, 6 Mar 2013 04:27:07 +0200 -Subject: [PATCH] Revert "SVG images are no longer pixilated when scaled up" - -This reverts commit ebad377e5cd067cec9f2b402dff4991ddc4cc3b5. ---- - src/xfce-backdrop.c | 38 +++++++++++++++++--------------------- - 1 file changed, 17 insertions(+), 21 deletions(-) - -diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c -index 9a4d7db..b07492f 100644 ---- a/src/xfce-backdrop.c -+++ b/src/xfce-backdrop.c -@@ -933,10 +933,17 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - - g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), NULL); - -- if(backdrop->priv->show_image && backdrop->priv->image_path) -- gdk_pixbuf_get_file_info(backdrop->priv->image_path, &iw, &ih); -- -+ if(backdrop->priv->show_image && backdrop->priv->image_path) { -+ image = gdk_pixbuf_new_from_file(backdrop->priv->image_path, NULL); -+ if(image) { -+ iw = gdk_pixbuf_get_width(image); -+ ih = gdk_pixbuf_get_height(image); -+ } -+ } -+ - if(backdrop->priv->width == 0 || backdrop->priv->height == 0) { -+ if(!image) -+ return NULL; - w = iw; - h = ih; - } else { -@@ -956,9 +963,7 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - final_image = create_solid(&backdrop->priv->color1, w, h, FALSE, 0xff); - } - -- /*check if the file exists, -- *and if it doesn't then make the background the single colour*/ -- if(!g_file_test(backdrop->priv->image_path, G_FILE_TEST_EXISTS)) { -+ if(!image) { - if(backdrop->priv->brightness != 0) - final_image = adjust_brightness(final_image, backdrop->priv->brightness); - -@@ -996,7 +1001,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - - switch(istyle) { - case XFCE_BACKDROP_IMAGE_CENTERED: -- image = gdk_pixbuf_new_from_file(backdrop->priv->image_path, NULL); - dx = MAX((w - iw) / 2, 0); - dy = MAX((h - ih) / 2, 0); - xo = MIN((w - iw) / 2, dx); -@@ -1007,7 +1011,6 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - break; - - case XFCE_BACKDROP_IMAGE_TILED: -- image = gdk_pixbuf_new_from_file(backdrop->priv->image_path, NULL); - tmp = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); - for(i = 0; (i * iw) < w; i++) { - for(j = 0; (j * ih) < h; j++) { -@@ -1030,10 +1033,10 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - break; - - case XFCE_BACKDROP_IMAGE_STRETCHED: -- image = gdk_pixbuf_new_from_file_at_scale( -- backdrop->priv->image_path, w, h, FALSE, NULL); -+ xscale = (gdouble)w / iw; -+ yscale = (gdouble)h / ih; - gdk_pixbuf_composite(image, final_image, 0, 0, w, h, -- 0, 0, 1, 1, interp, 255); -+ 0, 0, xscale, yscale, interp, 255); - break; - - case XFCE_BACKDROP_IMAGE_SCALED: -@@ -1050,12 +1053,9 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - } - dx = xo; - dy = yo; -- -- image = gdk_pixbuf_new_from_file_at_scale( -- backdrop->priv->image_path, iw * xscale, -- ih * yscale, TRUE, NULL); -+ - gdk_pixbuf_composite(image, final_image, dx, dy, -- iw * xscale, ih * yscale, xo, yo, 1, 1, -+ iw * xscale, ih * yscale, xo, yo, xscale, yscale, - interp, 255); - break; - -@@ -1071,12 +1071,8 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) - xo = 0; - yo = (h - (ih * yscale)) * 0.5; - } -- -- image = gdk_pixbuf_new_from_file_at_scale( -- backdrop->priv->image_path, iw * xscale, -- ih * yscale, TRUE, NULL); - gdk_pixbuf_composite(image, final_image, 0, 0, -- w, h, xo, yo, 1, 1, interp, 255); -+ w, h, xo, yo, xscale, yscale, interp, 255); - break; - - default: --- -1.8.1.5 - diff --git a/libre/calibre-libre/PKGBUILD b/libre/calibre-libre/PKGBUILD index 20d2619c3..fff34ac97 100644 --- a/libre/calibre-libre/PKGBUILD +++ b/libre/calibre-libre/PKGBUILD @@ -8,8 +8,8 @@ _pkgname=calibre pkgname=calibre-libre pkgver=0.9.22 -pkgrel=1.1 -pkgdesc="Ebook management application (with unar support and nonfree fonts removed)" +pkgrel=1.2 +pkgdesc="Ebook management application (with unar support included and nonfree fonts removed)" arch=('i686' 'x86_64' 'mips64el') url="http://calibre-ebook.com/" license=('GPL3') diff --git a/libre/cgminer-libre/PKGBUILD b/libre/cgminer-libre/PKGBUILD index 4c61eda76..55e7e1df8 100644 --- a/libre/cgminer-libre/PKGBUILD +++ b/libre/cgminer-libre/PKGBUILD @@ -7,7 +7,7 @@ pkgname=cgminer-libre _pkgflag=libre -pkgver=2.11.1 +pkgver=2.11.2 _build= pkgrel=1 pkgdesc="Multi-threaded multi-pool CPU and GPU miner for bitcoin, forked from cpuminer, without nonfree OpenCL recommendations." @@ -52,6 +52,6 @@ package() { install -Dm644 ${pkgname%-$_pkgflag}.conf "$pkgdir"/etc/${pkgname%-$_pkgflag}.conf } -md5sums=('aa2199a9756cbca5582c03e8c1a98dd1' +md5sums=('f3deb2205ff53318dd65f9dfd26b99aa' 'fe4a243fabe24608f5c05e40f0f118f6' 'bd76fc92fedce18c59ccea2aa79cc664') diff --git a/libre/file-roller-libre/PKGBUILD b/libre/file-roller-libre/PKGBUILD index cb58c0357..d5ee231f1 100644 --- a/libre/file-roller-libre/PKGBUILD +++ b/libre/file-roller-libre/PKGBUILD @@ -5,8 +5,8 @@ _pkgname=file-roller pkgname=file-roller-libre pkgver=3.6.3 -pkgrel=2.1 -pkgdesc="Archive manipulator for GNOME (with unar recommendation and nonfree unace recommendation removed)" +pkgrel=2.2 +pkgdesc="Archive manipulator for GNOME (with unar recommendation included and nonfree unace recommendation removed)" arch=('i686' 'x86_64' 'mips64el') license=('GPL') depends=('desktop-file-utils' 'gtk3' 'hicolor-icon-theme' 'dconf' 'libarchive' 'file' 'json-glib' 'libnotify') diff --git a/libre/icecat-noscript/PKGBUILD b/libre/icecat-noscript/PKGBUILD index ff3ce7c37..2f78dd128 100644 --- a/libre/icecat-noscript/PKGBUILD +++ b/libre/icecat-noscript/PKGBUILD @@ -4,7 +4,7 @@ _pkgname=firefox-noscript pkgname=icecat-noscript -pkgver=2.6.5.7 +pkgver=2.6.5.8 pkgrel=1 pkgdesc="plugin for icecat which disables script" arch=('any') @@ -15,7 +15,7 @@ conflicts=$_pkgname provides=$_pkgname=$pkgver makedepends=('unzip') source=(https://secure.informaction.com/download/releases/noscript-$pkgver.xpi) -md5sums=('82816e7d024c71d698dd108c0aec527d') +md5sums=('f97258a706d87a28fa7bd8bd4ee05627') package() { # _ffver=`pacman -Q icecat | cut -f2 -d\ | cut -f1 -d-` diff --git a/libre/iceweasel-noscript/PKGBUILD b/libre/iceweasel-noscript/PKGBUILD index ddf6a18a0..d02d90c3b 100644 --- a/libre/iceweasel-noscript/PKGBUILD +++ b/libre/iceweasel-noscript/PKGBUILD @@ -4,7 +4,7 @@ _pkgname=firefox-noscript pkgname=iceweasel-noscript -pkgver=2.6.5.7 +pkgver=2.6.5.8 pkgrel=1 pkgdesc="plugin for iceweasel which disables script" arch=('any') @@ -15,7 +15,7 @@ conflicts=$_pkgname provides=$_pkgname=$pkgver makedepends=('unzip') source=(https://secure.informaction.com/download/releases/noscript-$pkgver.xpi) -md5sums=('82816e7d024c71d698dd108c0aec527d') +md5sums=('f97258a706d87a28fa7bd8bd4ee05627') package() { # _ffver=`pacman -Q iceweasel-libre | cut -f2 -d\ | cut -f1 -d-` -- cgit v1.2.3-54-g00ecf