code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>xorg-app</Name>
        <Homepage>http://www.x.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>MIT</License>
        <IsA>app:console</IsA>
        <IsA>app:gui</IsA>
        <Summary>X.Org applications</Summary>
        <Description>xorg-app contains base Xorg applications.</Description>
        <Archive sha1sum="f89d6fff84d838c0b8b4adeca46185b6d4812a27" type="tarbz2">mirrors://xorg/individual/app/appres-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="93fca9876367b0950b57680237a7dfc1a520ffac" type="tarbz2">mirrors://xorg/individual/app/bdftopcf-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="c019342dd3e7071d944b6efae5b3e058d77f46be" type="tarbz2">mirrors://xorg/individual/app/beforelight-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="84fc49daa5411677d05a134ee2f7e76301fa89d8" type="tarbz2">mirrors://xorg/individual/app/bitmap-1.0.8.tar.bz2</Archive>
        <Archive sha1sum="dfaecb0b038d5c8d7244c518cf8c0c48d10455f9" type="tarbz2">mirrors://xorg/individual/app/editres-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="a609fba513947e5267c924f85774c0e44a076a7d" type="tarbz2">mirrors://xorg/individual/app/fonttosfnt-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="0a0d37c65a8cdd3aff22d633b5ed164e864929d4" type="tarbz2">mirrors://xorg/individual/app/fslsfonts-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="aeafc2cd82092168d0bc4b94c5a27d7e070598fd" type="tarbz2">mirrors://xorg/individual/app/fstobdf-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="83d67e47167de52192c679a0f0a41f4ba51a5b94" type="tarbz2">mirrors://xorg/individual/app/iceauth-1.0.7.tar.bz2</Archive>
        <Archive sha1sum="53e7bb52227f2458bf20c7f95f34b19c26cf8885" type="tarbz2">mirrors://xorg/individual/app/ico-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="ff226b0e565c337ac1ae60027487131920b8d86b" type="tarbz2">mirrors://xorg/individual/app/listres-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="3130c14d7267cecce0ba2280643844b48cca49b0" type="tarbz2">mirrors://xorg/individual/app/luit-1.1.1.tar.bz2</Archive>
        <Archive sha1sum="a0daa928b449998a2374c0472fd715792075f8b3" type="tarbz2">mirrors://xorg/individual/app/mkcomposecache-1.2.1.tar.bz2</Archive>
        <Archive sha1sum="3c06dad8a5fbf7362b51fb7d6b1ab805eba40336" type="tarbz2">mirrors://xorg/individual/app/mkfontdir-1.0.7.tar.bz2</Archive>
        <Archive sha1sum="da32fe297732355eea71d4a94ed003be93d1eae7" type="tarbz2">mirrors://xorg/individual/app/mkfontscale-1.1.2.tar.bz2</Archive>
        <Archive sha1sum="1aa05864019a55610aca5471c5206858dde9a34a" type="tarbz2">mirrors://xorg/individual/app/oclock-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="dac876f347ee97c09b050c83de3a7b67546c8fe0" type="tarbz2">mirrors://xorg/individual/app/rendercheck-1.5.tar.bz2</Archive>
        <Archive sha1sum="542fade81a74f8a6beaea8cb517bdf1033fc6b71" type="tarbz2">mirrors://xorg/individual/app/rgb-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="97fad3686b4687104a58b3f2b7b387d316b26b92" type="tarbz2">mirrors://xorg/individual/app/rstart-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="e5785e243cea56c48a6492f6ec329c5cf7dbbca6" type="tarbz2">mirrors://xorg/individual/app/scripts-1.0.1.tar.bz2</Archive>
        <Archive sha1sum="a27a476f7f39ae30a16dfa25ca07c12378cff7f0" type="tarbz2">mirrors://xorg/individual/app/sessreg-1.1.0.tar.bz2</Archive>
        <Archive sha1sum="560a02cf6f7db1f79739a4f2bd4f8050c7eb6f43" type="tarbz2">mirrors://xorg/individual/app/setxkbmap-1.3.1.tar.bz2</Archive>
        <Archive sha1sum="203f4e655333723af7b2c47a85dfba8258f22ebc" type="tarbz2">mirrors://xorg/individual/app/showfont-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="bbb374ad7e184af7bcada70b90df81f82b9b71ad" type="tarbz2">mirrors://xorg/individual/app/smproxy-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="09e8a8f0d1072e11eb0d6e354d75a555b9952755" type="tarbz2">mirrors://xorg/individual/app/twm-1.0.9.tar.bz2</Archive>
        <Archive sha1sum="02d251213b18b1f2588f20663e89052df58bcb8a" type="tarbz2">mirrors://xorg/individual/app/viewres-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="de4960357e077fddd3d3a33f72f579981efc7fa4" type="tarbz2">mirrors://xorg/individual/app/x11perf-1.6.0.tar.bz2</Archive>
        <Archive sha1sum="87946b2af3ff13705d8eb60adae5c0bcdf839967" type="tarbz2">mirrors://xorg/individual/app/xauth-1.0.10.tar.bz2</Archive>
        <Archive sha1sum="861c2ce6a9ff44e93dece8c69508af9d826c032a" type="tarbz2">mirrors://xorg/individual/app/xbacklight-1.2.1.tar.bz2</Archive>
        <Archive sha1sum="17337a951264f0f96f6d03893f9dfd9cf8f12a5a" type="tarbz2">mirrors://xorg/individual/app/xbiff-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="4f9e14b9ff91e3976b702bdad92f639df80cf406" type="tarbz2">mirrors://xorg/individual/app/xcalc-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="971ac3900b4eb5ad54f3c3d9527e96ccdcb9e504" type="tarbz2">mirrors://xorg/individual/app/xclipboard-1.1.3.tar.bz2</Archive>
        <Archive sha1sum="1b54b96e057469f90a00a9f1ca79ed056cbde271" type="tarbz2">mirrors://xorg/individual/app/xclock-1.0.7.tar.bz2</Archive>
        <Archive sha1sum="b1d09b1a9a4324fa86c85340ae47cc34743423a9" type="tarbz2">mirrors://xorg/individual/app/xcmsdb-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="5590d1bdd2669f083e4c2bb25edd89cce8abbd58" type="tarbz2">mirrors://xorg/individual/app/xcompmgr-1.1.7.tar.bz2</Archive>
        <Archive sha1sum="06624727d5cd291fa5be52467e5c42c057c0ec42" type="tarbz2">mirrors://xorg/individual/app/xconsole-1.0.7.tar.bz2</Archive>
        <Archive sha1sum="e6d5cc03ce1829cc7eea39526ca7b8688aac468b" type="tarbz2">mirrors://xorg/individual/app/xcursorgen-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="281bee72116311e2d8393ae53ea832e9d267eded" type="tarbz2">mirrors://xorg/individual/app/xdbedizzy-1.1.0.tar.bz2</Archive>
        <Archive sha1sum="5fa4247f75bc1d10e78a4c215c8bd3b9c4651dfb" type="tarbz2">mirrors://xorg/individual/app/xditview-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="0922fc31f8fc82ac20e326a6c9eb33ed7d57ad87" type="tarbz2">mirrors://xorg/individual/app/xdpyinfo-1.3.2.tar.bz2</Archive>
        <Archive sha1sum="f37b5d0f8ec461955f0419dbb1890d8cf63d179d" type="tarbz2">mirrors://xorg/individual/app/xedit-1.2.2.tar.bz2</Archive>
        <Archive sha1sum="e737bc46c58b9bb10f0af9883dce203bbed708aa" type="tarbz2">mirrors://xorg/individual/app/xev-1.2.2.tar.bz2</Archive>
        <Archive sha1sum="efe6116d31a7f69e4fb6038613e52b0960b9b61c" type="tarbz2">mirrors://xorg/individual/app/xeyes-1.1.1.tar.bz2</Archive>
        <Archive sha1sum="030659e3728f5f7142e1cf727f147aceeabe4b9e" type="tarbz2">mirrors://xorg/individual/app/xf86dga-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="cac5ca0f5fb6044840b15cf6fb9c541bd4fbce4a" type="tarbz2">mirrors://xorg/individual/app/xfd-1.1.2.tar.bz2</Archive>
        <Archive sha1sum="9fb43a73ff805bfe2d4b7d49831dd1cf26d6f3f0" type="tarbz2">mirrors://xorg/individual/app/xfindproxy-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="fbd8fa8a1c87d8da2e71def964e97bca1d4c4adf" type="tarbz2">mirrors://xorg/individual/app/xfontsel-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="5b8c653476a09e65d93eb7e40da99794366699f5" type="tarbz2">mirrors://xorg/individual/app/xfs-1.1.4.tar.bz2</Archive>
        <Archive sha1sum="7513e16ba5c8fef31aeaff4a42bf131859e75ee0" type="tarbz2">mirrors://xorg/individual/app/xfsinfo-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="ee1b47d2525e2132be628304577e43727077fa3b" type="tarbz2">mirrors://xorg/individual/app/xfwp-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="af1484d0d70bc71dc9d3b7b95645881b7165c41b" type="tarbz2">mirrors://xorg/individual/app/xgamma-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="642f9a286bac77ccb20ee42d03920028f6f5894b" type="tarbz2">mirrors://xorg/individual/app/xgc-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="8abfb0554e14a074f0dbfdda4919880e088545cb" type="tarbz2">mirrors://xorg/individual/app/xhost-1.0.7.tar.bz2</Archive>
        <Archive sha1sum="68367ae6cb4753eeb5fd209afe033d7c4a817748" type="tarbz2">mirrors://xorg/individual/app/xinput-1.6.2.tar.bz2</Archive>
        <Archive sha1sum="0295b57a4c4087b7a4d8d0ce6764039c24efb98c" type="tarbz2">mirrors://xorg/individual/app/xkbcomp-1.3.1.tar.bz2</Archive>
        <Archive sha1sum="629fea940692f9d971dfae36cd697b13337caaba" type="tarbz2">mirrors://xorg/individual/app/xkbevd-1.1.4.tar.bz2</Archive>
        <Archive sha1sum="c0c1e71a32f7d8bfc40539e7f315ca7e02d99205" type="tarbz2">mirrors://xorg/individual/app/xkbprint-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="b09aef7cc3853eb12dbda332f55adec3add4447b" type="tarbz2">mirrors://xorg/individual/app/xkbutils-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="3a9c253ed698ae2e6c176a6f4a5a7d43497818f6" type="tarbz2">mirrors://xorg/individual/app/xkill-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="4a34135ff51c3bc4029d6644e60e03f17ccf8c81" type="tarbz2">mirrors://xorg/individual/app/xload-1.1.2.tar.bz2</Archive>
        <Archive sha1sum="8087ca621c48506b26bb2cf3219a957b31537267" type="tarbz2">mirrors://xorg/individual/app/xlogo-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="0946410a2cd02b0dee7809fd75be090fb3961e9c" type="tarbz2">mirrors://xorg/individual/app/xlsatoms-1.1.2.tar.bz2</Archive>
        <Archive sha1sum="a980aa006c0ca180e4c79be2bd6514205dd218a3" type="tarbz2">mirrors://xorg/individual/app/xlsclients-1.1.3.tar.bz2</Archive>
        <Archive sha1sum="4631ad287cecd4c8c3301fc10f6001d00d2e06ef" type="tarbz2">mirrors://xorg/individual/app/xlsfonts-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="77c4b23765a1a30afde46a6e57afd77f20d58185" type="tarbz2">mirrors://xorg/individual/app/xmag-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="b64516dab2b1c407b28ce3822a98b93178e29f02" type="tarbz2">mirrors://xorg/individual/app/xman-1.1.4.tar.bz2</Archive>
        <Archive sha1sum="cc04934fa71167505a027fbe202b574deeac38d7" type="tarbz2">mirrors://xorg/individual/app/xmessage-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="09f7b3f683b0fe93da62e4dc8ed023fcacca078a" type="tarbz2">mirrors://xorg/individual/app/xmh-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="fe735c8bbba68d7eb50f82d4e092fdcadf161314" type="tarbz2">mirrors://xorg/individual/app/xmodmap-1.0.9.tar.bz2</Archive>
        <Archive sha1sum="7db4e5feb82d5d05038722d3af00d28e103bed18" type="tarbz2">mirrors://xorg/individual/app/xmore-1.0.2.tar.bz2</Archive>
        <Archive sha1sum="0645404e9aa2c9f979e4d006c483633bf6cfc2d9" type="tarbz2">mirrors://xorg/individual/app/xpr-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="f62e85e333132ea746fee7d99ca20a9e5b24e77b" type="tarbz2">mirrors://xorg/individual/app/xprop-1.2.2.tar.bz2</Archive>
        <Archive sha1sum="f402b2ed85817c2e111afafd6f5d0657328be2fa" type="tarbz2">mirrors://xorg/individual/app/xrandr-1.5.0.tar.bz2</Archive>
        <Archive sha1sum="b95ae53b767ee7b56baa55fc78eb9c0b9e5ccd29" type="tarbz2">mirrors://xorg/individual/app/xrdb-1.1.0.tar.bz2</Archive>
        <Archive sha1sum="f0372afb62f75ad29343abc96dbf80be12050b72" type="tarbz2">mirrors://xorg/individual/app/xrefresh-1.0.5.tar.bz2</Archive>
        <Archive sha1sum="62a5e7ec91e6900b798a88ca3b30d25bd5ef3047" type="tarbz2">mirrors://xorg/individual/app/xset-1.2.3.tar.bz2</Archive>
        <Archive sha1sum="add4e6a91c9d0e7d1a80b3534c64d6b7bf633ea0" type="tarbz2">mirrors://xorg/individual/app/xsetmode-1.0.0.tar.bz2</Archive>
        <Archive sha1sum="a8b01c6f27625a6f6943f9be17b1e5511f69d710" type="tarbz2">mirrors://xorg/individual/app/xsetpointer-1.0.1.tar.bz2</Archive>
        <Archive sha1sum="63bfcf55e95553df1e28f538bf009883568115d1" type="tarbz2">mirrors://xorg/individual/app/xsetroot-1.1.1.tar.bz2</Archive>
        <Archive sha1sum="3bb51cdea219729cbdaa491afe90f1d33fe64c40" type="tarbz2">mirrors://xorg/individual/app/xsm-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="b7fcc50ae6100d2ba91d6847969fd9d2b6784a90" type="tarbz2">mirrors://xorg/individual/app/xstdcmap-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="5ed9967f61cb7f6698fc6da6a2ca7afc5305468d" type="tarbz2">mirrors://xorg/individual/app/xvidtune-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="08ff744f7735317fd2fe1b0d2feba8c34cc2e5eb" type="tarbz2">mirrors://xorg/individual/app/xvinfo-1.1.3.tar.bz2</Archive>
        <Archive sha1sum="d1573340d67ce4a2dae31477a8e5459e36dda967" type="tarbz2">mirrors://xorg/individual/app/xwd-1.0.6.tar.bz2</Archive>
        <Archive sha1sum="179253e6b8266bc3e3b6496964077c9cdcb2dcba" type="tarbz2">mirrors://xorg/individual/app/xwininfo-1.1.3.tar.bz2</Archive>
        <Archive sha1sum="786cd4b18bf576fae3ffd417545b1394b27c7f06" type="tarbz2">mirrors://xorg/individual/app/xwud-1.0.4.tar.bz2</Archive>
        <BuildDependencies>
            <Dependency>fontconfig-devel</Dependency>
            <Dependency>libdmx-devel</Dependency>
            <Dependency>libfontenc-devel</Dependency>
            <Dependency>libFS-devel</Dependency>
            <Dependency>libICE-devel</Dependency>
            <Dependency>libpng-devel</Dependency>
            <Dependency>libSM-devel</Dependency>
            <Dependency>libXaw-devel</Dependency>
            <Dependency>libXcomposite-devel</Dependency>
            <Dependency>libXcursor-devel</Dependency>
            <Dependency>libXdamage-devel</Dependency>
            <Dependency>libXext-devel</Dependency>
            <Dependency>libXfixes-devel</Dependency>
            <Dependency>libXfont-devel</Dependency>
            <Dependency>libXft-devel</Dependency>
            <Dependency>libXi-devel</Dependency>
            <Dependency>libXinerama-devel</Dependency>
            <Dependency>libxkbfile-devel</Dependency>
            <Dependency>libXmu-devel</Dependency>
            <Dependency>libXrandr-devel</Dependency>
            <Dependency>libXrender-devel</Dependency>
            <Dependency>libXScrnSaver-devel</Dependency>
            <Dependency>libXt-devel</Dependency>
            <Dependency>libXtst-devel</Dependency>
            <Dependency>libXv-devel</Dependency>
            <Dependency>libXxf86dga-devel</Dependency>
            <Dependency>libXxf86vm-devel</Dependency>
            <Dependency>xbitmaps</Dependency>
            <Dependency>xcb-util-devel</Dependency>
            <Dependency>libXxf86misc-devel</Dependency>
            <Dependency>xorg-proto</Dependency>
            <Dependency>util-macros</Dependency>
            <Dependency>xtrans</Dependency>
        </BuildDependencies>
        <Patches>
            <Patch>0001-Makefile.am-Error-Fix.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>xorg-app</Name>
        <RuntimeDependencies>
            <Dependency>zlib</Dependency>
            <Dependency>libX11</Dependency>
            <Dependency>libXau</Dependency>
            <Dependency>libpng</Dependency>
            <Dependency>libxcb</Dependency>
            <Dependency>freetype</Dependency>
            <Dependency>libFS</Dependency>
            <Dependency>libSM</Dependency>
            <Dependency>libXi</Dependency>
            <Dependency>libXt</Dependency>
            <Dependency>libXv</Dependency>
            <Dependency>libdmx</Dependency>
            <Dependency>libXmu</Dependency>
            <Dependency>libXaw</Dependency>
            <Dependency>libICE</Dependency>
            <Dependency>libXft</Dependency>
            <Dependency>libXtst</Dependency>
            <Dependency>libXext</Dependency>
            <Dependency>xcb-util</Dependency>
            <Dependency>libXfont</Dependency>
            <Dependency>libXrandr</Dependency>
            <Dependency>libXfixes</Dependency>
            <Dependency>libXrender</Dependency>
            <Dependency>fontconfig</Dependency>
            <Dependency>libfontenc</Dependency>
            <Dependency>libXxf86vm</Dependency>
            <Dependency>libXcursor</Dependency>
            <Dependency>libXdamage</Dependency>
            <Dependency>libxkbfile</Dependency>
            <Dependency>libXxf86dga</Dependency>
            <Dependency>libXinerama</Dependency>
            <Dependency>libXxf86misc</Dependency>
            <Dependency>libXcomposite</Dependency>
            <Dependency>libXScrnSaver</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="header">/usr/include</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="data">/usr/share/X11</Path>
            <Path fileType="man">/usr/share/man</Path>
        </Files>
        <Provides>
            <COMAR script="pakhandler.py">System.PackageHandler</COMAR>
        </Provides>
    </Package>
    <Package>
        <Name>xorg-app-devel</Name>
        <RuntimeDependencies>
            <Dependency>libxkbfile-devel</Dependency>
            <Dependency relase="current">xorg-app</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="data">/usr/lib/pkgconfig</Path>
        </Files>
    </Package>

    <History>
        <Update release="2">
            <Date>2017-02-16</Date>
            <Version>7.7</Version>
            <Comment>Version bump.</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-05-10</Date>
            <Version>7.6</Version>
            <Comment>First release</Comment>
            <Name>Burak Ertürk</Name>
            <Email>burakerturk@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>xorg-app</Name>
        X.Org uygulamaları
        Applications de X.Org
        X.Org Anwendungen
    </Source>
</PISI>

repo_name: ayhanyalcinsoy/main


code:
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

WorkDir = "."
NoStrip = ["/"]

def setup():
    for package in shelltools.ls("*-*"):
        shelltools.cd(package)
        autotools.configure("--with-fontrootdir=/usr/share/fonts")
        shelltools.cd("../")

def build():
    for package in shelltools.ls("*-*"):
        shelltools.cd(package)
        autotools.make()
        shelltools.cd("../")

def install():
    for package in shelltools.ls("*-*"):
        shelltools.cd(package)
        autotools.rawInstall("DESTDIR=%s" % get.installDIR())
        shelltools.cd("../")

    # Trailing slash is important since it is used with dosed.
    encodingsDir = "/usr/share/fonts/encodings/"

    # Create encodings.dir scanning installed files only
    encdir = get.installDIR() + encodingsDir
    shelltools.system("/usr/bin/mkfontdir -n -e %s -e %slarge ." % (encdir, encdir))
    pisitools.dosed("encodings.dir", encdir, "")
    pisitools.insinto(encodingsDir, "encodings.dir")

    fontpaths = {
        "misc"      : "misc:unscaled:pri=10",
        "75dpi"     : "75dpi:unscaled",
        "100dpi"    : "100dpi:unscaled",
        "cyrillic"  : "cyrillic",
    }

    for fontdir, sym in fontpaths.items():
        fontpath = "/usr/share/fonts/%s" % fontdir
        pisitools.dosym(fontpath, "/etc/X11/fontpath.d/%s" % sym)

    # These will be generated by the package handler in xorg-app package
    pisitools.remove("/usr/share/fonts/*/fonts.dir")


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>xorg-font</Name>
        <Homepage>http://www.x.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>MIT</License>
        <IsA>data:font</IsA>
        X.Org font files
        <Description>xorg-font contains base X.Org fonts.</Description>
        <Archive sha1sum="24ace2470403f85a0d393769204029bd8247992a" type="tarbz2">mirrors://xorg/individual/font/encodings-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="6a2ec569336b5646682a14eee3c7790274beffd1" type="tarbz2">mirrors://xorg/individual/font/font-adobe-75dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="53311cbd604f18bd9570727105a4222473d363e3" type="tarbz2">mirrors://xorg/individual/font/font-adobe-100dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="50e837322a09f1a7c40fb78fc6aad1a157284507" type="tarbz2">mirrors://xorg/individual/font/font-adobe-utopia-75dpi-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="9e80cf5bbd5522a5cfad2a9f8f8fce86de0f0226" type="tarbz2">mirrors://xorg/individual/font/font-adobe-utopia-100dpi-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="3113cfafb91c2c53df6a1fae57dca6c50fb8ce20" type="tarbz2">mirrors://xorg/individual/font/font-adobe-utopia-type1-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="96b0aa38f88a54ef32ab85d3eef6f29b0437f70d" type="tarbz2">mirrors://xorg/individual/font/font-alias-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="322ae41e74deea8de11fa077fd0e0191927a667c" type="tarbz2">mirrors://xorg/individual/font/font-arabic-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="7290567d42a0f5adb6a3ad170524bb7ed59871d7" type="tarbz2">mirrors://xorg/individual/font/font-bh-75dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="47d5e50be9e78695017650a088da52bfcf1eeb40" type="tarbz2">mirrors://xorg/individual/font/font-bh-100dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="3c6678e6bbb2bd352baaf610a8f6aac9c5140c85" type="tarbz2">mirrors://xorg/individual/font/font-bh-lucidatypewriter-75dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="bc4f804e49db8c6add04f52ffb1c0cd63e714b2c" type="tarbz2">mirrors://xorg/individual/font/font-bh-lucidatypewriter-100dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="f42ebd527096011040a312e0f9cdf78d64177419" type="tarbz2">mirrors://xorg/individual/font/font-bh-ttf-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="69ff038d38015cd305a4cd4d1a921fe3bd08bbde" type="tarbz2">mirrors://xorg/individual/font/font-bh-type1-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="975e9f7872483394ebd87610f8bbc924d99bea34" type="tarbz2">mirrors://xorg/individual/font/font-bitstream-75dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="138376f8683c09b9068c7c124842a7af9f0fcc2e" type="tarbz2">mirrors://xorg/individual/font/font-bitstream-100dpi-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="7633551be3525c501278e81259b22ad9a893de4d" type="tarbz2">mirrors://xorg/individual/font/font-bitstream-type1-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="e5af8c2e8fb23955808a08bd38728ab3ad284d61" type="tarbz2">mirrors://xorg/individual/font/font-cronyx-cyrillic-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="1649271129bbeff3aeee70a9da87a8e5e59162c1" type="tarbz2">mirrors://xorg/individual/font/font-cursor-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="0c7b24e08e6d42eb006d79ae7ab4bbf446d59f7a" type="tarbz2">mirrors://xorg/individual/font/font-daewoo-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="a748d35b8b0241abd3e1d85f80da318b529a74d0" type="tarbz2">mirrors://xorg/individual/font/font-dec-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="bfc7d0a3aa0f96bf61ea26d6b3f5afbbdd0f35f6" type="tarbz2">mirrors://xorg/individual/font/font-ibm-type1-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="cbd9bf441b25362123c817b1aa7a7be1ee4a9321" type="tarbz2">mirrors://xorg/individual/font/font-isas-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="8c08c5fe01d4605f2886822cb3655548a6535e58" type="tarbz2">mirrors://xorg/individual/font/font-jis-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="db3e912d41bda20f60b520c19e65bd7134ee1224" type="tarbz2">mirrors://xorg/individual/font/font-micro-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="9c0e283ae59e7b05c0798fe0645cc822d22dcb0c" type="tarbz2">mirrors://xorg/individual/font/font-misc-cyrillic-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="3f6af53047cb1206d737e8e8fbbbbb315c5419bb" type="tarbz2">mirrors://xorg/individual/font/font-misc-ethiopic-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="f0693ea8fbc1d43177014155a0ecd2516348b51b" type="tarbz2">mirrors://xorg/individual/font/font-misc-meltho-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="245d3041d9138b7e4a00858228adad2de304043b" type="tarbz2">mirrors://xorg/individual/font/font-mutt-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="c6d28c56880807963175cbbd682fb6f75a35f77d" type="tarbz2">mirrors://xorg/individual/font/font-misc-misc-1.1.2.tar.bz2</Archive>
        <Archive sha1sum="fbe3629e9dcc03d12300d4ebab64fd038ea98952" type="tarbz2">mirrors://xorg/individual/font/font-schumacher-misc-1.1.2.tar.bz2</Archive>
        <Archive sha1sum="de1f0226f74d7e4d3ee9ab0b9c87478ab2a7db30" type="tarbz2">mirrors://xorg/individual/font/font-screen-cyrillic-1.0.4.tar.bz2</Archive>
        <Archive sha1sum="8d0dd87148283c8ac8c5ac37906b12fab5ddb1d8" type="tarbz2">mirrors://xorg/individual/font/font-sony-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="6a72602557bb5dfe46c1ee3b56658aeed1e04f9d" type="tarbz2">mirrors://xorg/individual/font/font-sun-misc-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="29249b49eac7e3f32d7a1a93808fcfd9d399011c" type="tarbz2">mirrors://xorg/individual/font/font-winitzki-cyrillic-1.0.3.tar.bz2</Archive>
        <Archive sha1sum="1381f274a178cbd08627560e17a4a8f6653be3f7" type="tarbz2">mirrors://xorg/individual/font/font-xfree86-type1-1.0.4.tar.bz2</Archive>
        <BuildDependencies>
            <Dependency>font-util</Dependency>
            <Dependency>xorg-app</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>xorg-font</Name>
        <RuntimeDependencies>
            <Dependency>xorg-app</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc/X11/fontpath.d</Path>
            <Path fileType="data">/usr/share/fonts</Path>
            <Path fileType="config">/etc/fonts/conf.avail/42-luxi-mono.conf</Path>
            <Path fileType="config">/etc/fonts/conf.d/42-luxi-mono.conf</Path>
        </Files>
    </Package>

    <Package>
        <Name>xorg-font-extra</Name>
        X.Org additional font files
        <RuntimeDependencies>
            <Dependency>xorg-app</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc/X11/fontpath.d/75dpi:unscaled</Path>
            <Path fileType="config">/etc/X11/fontpath.d/100dpi:unscaled</Path>
            <Path fileType="data">/usr/share/fonts/75dpi</Path>
            <Path fileType="data">/usr/share/fonts/100dpi</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-02-16</Date>
            <Version>7.6</Version>
            <Comment>Rebuild</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-02</Date>
            <Version>7.6</Version>
            <Comment>Rebuild</Comment>
            <Name>Burak Ertürk</Name>
            <Email>burakerturk@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-11-17</Date>
            <Version>7.6</Version>
            <Comment>First release</Comment>
            <Name>Burak Ertürk</Name>
            <Email>burakerturk@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>xorg-font</Name>
        X.Org yazı tipi dosyaları
        Fichiers de fontes d'écrans graphiques (X.Org)
        Grafische Oberfläche (X.Org) Schrift Dateien
    </Source>

    <Package>
        <Name>xorg-font-extra</Name>
        X.Org ek yazı tipi dosyaları
    </Package>
</PISI>


code:
<PISI>
    <Name>x11.server</Name>
</PISI>


code:
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

def setup():
#    shelltools.chmod("hw/vnc/symlink-vnc.sh")
    autotools.autoreconf("-fi")

    autotools.configure("--enable-install-libxf86config \
                         --disable-systemd-logind \
                         --enable-aiglx \
                         --enable-glx-tls \
                         --enable-composite \
                         --enable-xcsecurity \
                         --enable-record \
                         --enable-dri \
                         --enable-dri2 \
                         --enable-glamor \
                         --enable-xwayland \
                         --enable-config-udev \
                         --disable-config-hal \
                         --enable-xfree86-utils \
                         --enable-xorg \
                         --enable-dmx \
                         --enable-xvfb \
                         --enable-xnest \
                         --enable-kdrive \
                         --enable-xfont \
                         --enable-kdrive-evdev \
                         --enable-kdrive-kbd \
                         --enable-kdrive-mouse \
                         --enable-xephyr \
                         --disable-xfake \
                         --disable-xfbdev \
                         --disable-devel-docs \
                         --disable-static \
                         --without-doxygen \
                         --with-pic \
                         --without-dtrace \
                         --with-int10=x86emu \
                         --with-os-name=\"PisiLinux\" \
                         --with-os-vendor=\"Pisi GNU/Linux Community\" \
                         --with-builderstring=\"Package: %s\" \
                         --with-fontrootdir=/usr/share/fonts \
                         --with-default-font-path=catalogue:/etc/X11/fontpath.d,built-ins \
                         --with-xkb-output=/var/lib/xkb \
                         --with-dri-driver-path=/usr/lib/xorg/modules/dri \
                         --without-xmlto \
                         --without-fop \
                         --localstatedir=/var \
                         PCI_TXT_IDS_DIR=/usr/share/X11/pci \
                         " % get.srcTAG())

    pisitools.dosed("libtool", " -shared ", " -Wl,-O1,--as-needed -shared ")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    pisitools.dodir("/etc/X11/fontpath.d")
    pisitools.dodir("/etc/X11/xorg.conf.d")
    pisitools.dodir("/usr/share/X11/pci")
    pisitools.dodir("/usr/share/X11/xorg.conf.d")

    # Remove empty dir
    pisitools.removeDir("/var/log")

    pisitools.dodoc("COPYING", "README")


code:
From cd1962b7f9c14bc67e22c07cb9a9cd3a4a119506 Mon Sep 17 00:00:00 2001
From: Gaetan Nadon <memsize-XzQKRVe1yT0V+D8aMU/kSg@public.gmane.org>
Date: Sat, 28 Nov 2009 21:32:47 -0500
Subject: [PATCH] configure.ac: error while checking for XDMXCONFIG_DEP

Introduced in commit 9998105a387e0294054502331a56e1e020cd93e4
The replacement third parameters to PKG_CHECK_MODULES([DMXMODULES]
was not quoted.

Signed-off-by: Gaetan Nadon <memsize-XzQKRVe1yT0V+D8aMU/kSg@public.gmane.org>
Reviewed-by: Dan Nicholson <dbn.lists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Tested-by: Julien Cristau <jcristau at debian.org>
---
 configure.ac |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8500db4..1038734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1808,11 +1808,15 @@ AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
 AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])

 dnl DMX DDX
-PKG_CHECK_MODULES([DMXMODULES],
-    [xmuu $LIBXEXT x11 xrender xfixes xfont $LIBXI $DMXPROTO xau $XDMCP_MODULES],
-    PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11], [have_dmx=yes],
-                      [have_dmx=no]),
-    [have_dmx=no])
+PKG_CHECK_MODULES(
+	[DMXMODULES],
+	[xmuu $LIBXEXT x11 xrender xfixes xfont $LIBXI $DMXPROTO xau $XDMCP_MODULES],
+	[PKG_CHECK_MODULES(
+		[XDMXCONFIG_DEP],
+		[xaw7 xmu xt xpm x11],
+		[have_dmx=yes],
+		[have_dmx=no])],
+	[have_dmx=no])
 AC_MSG_CHECKING([whether to build Xdmx DDX])
 if test "x$DMX" = xauto; then
 	DMX="$have_dmx"
--
1.6.0.4


code:
From e1a7f4bb5333b0271d29f785eb55f1c3273e626a Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 5 May 2015 14:18:54 +1000
Subject: [PATCH] dix: Add unaccelerated valuators to the ValuatorMask

Allows a mask to carry both accelerated and unaccelerated motion at the same
time.

This is required for xf86-input-libinput where the pointer acceleration
happens in libinput already, but parts of the server, specifically raw events
and DGA rely on device-specific unaccelerated data.

To ease integration add this as a second set to the ValuatorMask rather than
extending all APIs to carry a second, possibly NULL set of valuators.

Note that a valuator mask should only be used in either accel/unaccel or
standard mode at any time. Switching requires either a valuator_mask_zero()
call or unsetting all valuators one-by-one. Trying to mix the two will produce
a warning.

The server has a shortcut for changing a mask with the
valuator_mask_drop_unaccelerated() call. This saves us from having to loop
through all valuators on every event, we can just drop the bits we know we
don't want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
 dix/inpututils.c               | 82 +++++++++++++++++++++++++++++++++++++++---
 hw/xfree86/common/xf86Module.h |  2 +-
 include/input.h                | 15 ++++++++
 include/inpututils.h           |  2 ++
 4 files changed, 95 insertions(+), 6 deletions(-)

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 5c2a32d..1363988 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -505,11 +505,8 @@ valuator_mask_isset(const ValuatorMask *mask, int valuator)
     return mask->last_bit >= valuator && BitIsOn(mask->mask, valuator);
 }

-/**
- * Set the valuator to the given floating-point data.
- */
-void
-valuator_mask_set_double(ValuatorMask *mask, int valuator, double data)
+static inline void
+_valuator_mask_set_double(ValuatorMask *mask, int valuator, double data)
 {
     mask->last_bit = max(valuator, mask->last_bit);
     SetBit(mask->mask, valuator);
@@ -517,6 +514,17 @@ valuator_mask_set_double(ValuatorMask *mask, int valuator, double data)
 }

 /**
+ * Set the valuator to the given floating-point data.
+ */
+void
+valuator_mask_set_double(ValuatorMask *mask, int valuator, double data)
+{
+    BUG_WARN_MSG(mask->has_unaccelerated,
+                 "Do not mix valuator types, zero mask first\n");
+    _valuator_mask_set_double(mask, valuator, data);
+}
+
+/**
  * Set the valuator to the given integer data.
  */
 void
@@ -594,11 +602,15 @@ valuator_mask_unset(ValuatorMask *mask, int valuator)

         ClearBit(mask->mask, valuator);
         mask->valuators[valuator] = 0.0;
+        mask->unaccelerated[valuator] = 0.0;

         for (i = 0; i <= mask->last_bit; i++)
             if (valuator_mask_isset(mask, i))
                 lastbit = max(lastbit, i);
         mask->last_bit = lastbit;
+
+        if (mask->last_bit == -1)
+            mask->has_unaccelerated = FALSE;
     }
 }

@@ -611,6 +623,66 @@ valuator_mask_copy(ValuatorMask *dest, const ValuatorMask *src)
         valuator_mask_zero(dest);
 }

+Bool
+valuator_mask_has_unaccelerated(const ValuatorMask *mask)
+{
+    return mask->has_unaccelerated;
+}
+
+void
+valuator_mask_drop_unaccelerated(ValuatorMask *mask)
+{
+    memset(mask->unaccelerated, 0, sizeof(mask->unaccelerated));
+    mask->has_unaccelerated = FALSE;
+}
+
+/**
+ * Set both accelerated and unaccelerated value for this mask.
+ */
+void
+valuator_mask_set_unaccelerated(ValuatorMask *mask,
+                                int valuator,
+                                double accel,
+                                double unaccel)
+{
+    BUG_WARN_MSG(mask->last_bit != -1 && !mask->has_unaccelerated,
+                 "Do not mix valuator types, zero mask first\n");
+    _valuator_mask_set_double(mask, valuator, accel);
+    mask->has_unaccelerated = TRUE;
+    mask->unaccelerated[valuator] = unaccel;
+}
+
+double
+valuator_mask_get_accelerated(const ValuatorMask *mask,
+                              int valuator)
+{
+    return valuator_mask_get_double(mask, valuator);
+}
+
+double
+valuator_mask_get_unaccelerated(const ValuatorMask *mask,
+                                int valuator)
+{
+    return mask->unaccelerated[valuator];
+}
+
+Bool
+valuator_mask_fetch_unaccelerated(const ValuatorMask *mask,
+                                  int valuator,
+                                  double *accel,
+                                  double *unaccel)
+{
+    if (valuator_mask_isset(mask, valuator)) {
+        if (accel)
+            *accel = valuator_mask_get_accelerated(mask, valuator);
+        if (unaccel)
+            *unaccel = valuator_mask_get_unaccelerated(mask, valuator);
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
 int
 CountBits(const uint8_t * mask, int len)
 {
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index e68fe9c..6133641 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -81,7 +81,7 @@ typedef enum {
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
 #define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(19, 0)
-#define ABI_XINPUT_VERSION	SET_ABI_VERSION(21, 0)
+#define ABI_XINPUT_VERSION	SET_ABI_VERSION(21, 1)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(9, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)

diff --git a/include/input.h b/include/input.h
index bf22dc7..0a4c4f7 100644
--- a/include/input.h
+++ b/include/input.h
@@ -674,6 +674,21 @@ extern _X_EXPORT Bool valuator_mask_fetch(const ValuatorMask *mask,
 extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask,
                                                  int valnum, double *val);

+extern _X_EXPORT Bool valuator_mask_has_unaccelerated(const ValuatorMask *mask);
+extern _X_EXPORT void valuator_mask_set_unaccelerated(ValuatorMask *mask,
+                                                      int valuator,
+                                                      double accel,
+                                                      double unaccel);
+extern _X_EXPORT double valuator_mask_get_accelerated(const ValuatorMask *mask,
+                                                      int valuator);
+extern _X_EXPORT double valuator_mask_get_unaccelerated(const ValuatorMask *mask,
+                                                        int valuator);
+extern _X_EXPORT Bool valuator_mask_fetch_unaccelerated(const ValuatorMask *mask,
+                                                        int valuator,
+                                                        double *accel,
+                                                        double *unaccel);
+extern _X_HIDDEN void valuator_mask_drop_unaccelerated(ValuatorMask *mask);
+
 /* InputOption handling interface */
 extern _X_EXPORT InputOption *input_option_new(InputOption *list,
                                                const char *key,
diff --git a/include/inpututils.h b/include/inpututils.h
index 53c96ba..4e90815 100644
--- a/include/inpututils.h
+++ b/include/inpututils.h
@@ -36,8 +36,10 @@ extern Mask event_filters[MAXDEVICES][MAXEVENTS];

 struct _ValuatorMask {
     int8_t last_bit;            /* highest bit set in mask */
+    int8_t has_unaccelerated;
     uint8_t mask[(MAX_VALUATORS + 7) / 8];
     double valuators[MAX_VALUATORS];    /* valuator data */
+    double unaccelerated[MAX_VALUATORS];    /* valuator data */
 };

 extern void verify_internal_event(const InternalEvent *ev);
--
2.4.1


code:
From 7504fbd2239257f1a00a1a15d02862eea81f167c Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 5 May 2015 14:48:41 +1000
Subject: [PATCH] dix: hook up the unaccelerated valuator masks

If present, access the unaccelerated valuator mask values for DGA and XI2 raw
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
 dix/getevents.c                | 31 ++++++++++++++++++++++---------
 hw/xfree86/common/xf86Xinput.c |  4 ++++
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 6fb12c5..64bf76e 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -213,14 +213,25 @@ init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
 }

 static void
-set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask, double *data)
+set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask,
+                  BOOL use_unaccel, double *data)
 {
     int i;

+    use_unaccel = use_unaccel && valuator_mask_has_unaccelerated(mask);
+
     for (i = 0; i < valuator_mask_size(mask); i++) {
         if (valuator_mask_isset(mask, i)) {
+            double v;
+
             SetBit(event->valuators.mask, i);
-            data[i] = valuator_mask_get_double(mask, i);
+
+            if (use_unaccel)
+                v = valuator_mask_get_unaccelerated(mask, i);
+            else
+                v = valuator_mask_get_double(mask, i);
+
+            data[i] = v;
         }
     }
 }
@@ -1138,11 +1149,11 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
     valuator_mask_copy(&mask, mask_in);

     init_raw(pDev, raw, ms, type, key_code);
-    set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+    set_raw_valuators(raw, &mask, TRUE, raw->valuators.data_raw);

     clipValuators(pDev, &mask);

-    set_raw_valuators(raw, &mask, raw->valuators.data);
+    set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);

     event = &events->device_event;
     init_device_event(event, pDev, ms);
@@ -1423,9 +1434,11 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
         num_events++;

         init_raw(pDev, raw, ms, type, buttons);
-        set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+        set_raw_valuators(raw, &mask, TRUE, raw->valuators.data_raw);
     }

+    valuator_mask_drop_unaccelerated(&mask);
+
     /* valuators are in driver-native format (rel or abs) */

     if (flags & POINTER_ABSOLUTE) {
@@ -1438,7 +1451,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
         transformAbsolute(pDev, &mask);
         clipAbsolute(pDev, &mask);
         if ((flags & POINTER_NORAW) == 0 && raw)
-            set_raw_valuators(raw, &mask, raw->valuators.data);
+            set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);
     }
     else {
         transformRelative(pDev, &mask);
@@ -1446,7 +1459,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
         if (flags & POINTER_ACCELERATE)
             accelPointer(pDev, &mask, ms);
         if ((flags & POINTER_NORAW) == 0 && raw)
-            set_raw_valuators(raw, &mask, raw->valuators.data);
+            set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);

         moveRelative(pDev, flags, &mask);
     }
@@ -1951,7 +1964,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         events++;
         num_events++;
         init_raw(dev, raw, ms, type, client_id);
-        set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+        set_raw_valuators(raw, &mask, TRUE, raw->valuators.data_raw);
     }

     event = &events->device_event;
@@ -2013,7 +2026,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         screeny = dev->spriteInfo->sprite->hotPhys.y;
     }
     if (need_rawevent)
-        set_raw_valuators(raw, &mask, raw->valuators.data);
+        set_raw_valuators(raw, &mask, FALSE, raw->valuators.data);

     /* Indirect device touch coordinates are not used for cursor positioning.
      * They are merely informational, and are provided in device coordinates.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 1fb5b16..5ce4c71 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1137,12 +1137,16 @@ xf86CheckMotionEvent4DGA(DeviceIntPtr device, int is_absolute,
                 dx = valuator_mask_get(mask, 0);
                 if (is_absolute)
                     dx -= device->last.valuators[0];
+                else if (valuator_mask_has_unaccelerated(mask))
+                    dx = valuator_mask_get_unaccelerated(mask, 0);
             }

             if (valuator_mask_isset(mask, 1)) {
                 dy = valuator_mask_get(mask, 1);
                 if (is_absolute)
                     dy -= device->last.valuators[1];
+                else if (valuator_mask_has_unaccelerated(mask))
+                    dy = valuator_mask_get_unaccelerated(mask, 1);
             }

             if (DGAStealMotionEvent(device, idx, dx, dy))
--
2.4.1


code:
--- hw/xfree86/common/xf86pciBus.c.orig	2011-09-24 10:53:45.421697668 +0000
+++ hw/xfree86/common/xf86pciBus.c	2011-09-24 10:55:56.416250708 +0000
@@ -1200,9 +1200,15 @@
             break;
         }
         break;
-    case 0x1039:
-        driverList[0] = "sis";
-        break;
+	case 0x1039:
+	    switch (dev->device_id)
+	    {
+		case 0x6350: case 0x6351:
+		    driverList[0] = "sisimedia"; driverList[1] = "sis"; break;
+		default:
+		    driverList[0] = "sis"; break;
+	    }
+	    break;
     case 0x126f:
         driverList[0] = "siliconmotion";
         break;


code:
From 7198a6d4e74f684cb383b3e0f70dd2bae405e6e7 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon, 16 Jan 2017 22:17:36 +0000
Subject: xfree86: Take the input lock for xf86RecolorCursor

xf86RecolorCursor() may be called directly from XRecolorCursor as well
as from xf86ScreenSetCursor(). In the latter case, the input lock is
already held, but not for the former and so we need to add a wrapper
function that acquires the input lock before performing
xf86RecolorCursor()

References: https://bugs.freedesktop.org/show_bug.cgi?id=99358

diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 4481320..55d5861 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -22,6 +22,9 @@

 #include "servermd.h"

+static void
+xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs);
+
 static CARD32
 xf86ReverseBitOrder(CARD32 v)
 {
@@ -204,7 +207,7 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
         if (!xf86DriverLoadCursorImage (infoPtr, bits))
             return FALSE;

-    xf86RecolorCursor(pScreen, pCurs, 1);
+    xf86RecolorCursor_locked (ScreenPriv, pCurs);

     (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);

@@ -312,12 +315,9 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
     input_unlock();
 }

-void
-xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
+static void
+xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs)
 {
-    xf86CursorScreenPtr ScreenPriv =
-        (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
-                                               xf86CursorScreenKey);
     xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;

     /* recoloring isn't applicable to ARGB cursors and drivers
@@ -357,6 +357,18 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
     }
 }

+void
+xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
+{
+    xf86CursorScreenPtr ScreenPriv =
+        (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
+                                               xf86CursorScreenKey);
+
+    input_lock();
+    xf86RecolorCursor_locked (ScreenPriv, pCurs);
+    input_unlock();
+}
+
 /* These functions assume that MaxWidth is a multiple of 32 */
 static unsigned char *
 RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
--
cgit v0.10.2

From cfddd919cce4178baba07959e5e862d02e166522 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon, 16 Jan 2017 22:36:34 +0000
Subject: xfree86: Take input lock for xf86TransparentCursor

diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 55d5861..26dc7e5 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -261,6 +261,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
                                                xf86CursorScreenKey);
     xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;

+    input_lock();
+
     if (!ScreenPriv->transparentData)
         ScreenPriv->transparentData =
             (*infoPtr->RealizeCursor) (infoPtr, NullCursor);
@@ -273,6 +275,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
                                    ScreenPriv->transparentData);

     (*infoPtr->ShowCursor) (infoPtr->pScrn);
+
+    input_unlock();
 }

 static void
--
cgit v0.10.2

From 3eb964e25243056dd998f52d3b00171b71c89189 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri, 20 Jan 2017 09:49:19 +0000
Subject: xfree86: Take input_lock() for xf86ScreenCheckHWCursor

diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 26dc7e5..7043a9c 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -139,9 +139,14 @@ Bool
 xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr)
 {
     ScreenPtr pSlave;
+    Bool use_hw_cursor = TRUE;

-    if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr))
-        return FALSE;
+    input_lock();
+
+    if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr)) {
+        use_hw_cursor = FALSE;
+	goto unlock;
+    }

     /* ask each driver consuming a pixmap if it can support HW cursor */
     xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) {
@@ -151,14 +156,22 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr
             continue;

         sPriv = dixLookupPrivate(&pSlave->devPrivates, xf86CursorScreenKey);
-        if (!sPriv) /* NULL if Option "SWCursor", possibly other conditions */
-            return FALSE;
+        if (!sPriv) { /* NULL if Option "SWCursor", possibly other conditions */
+            use_hw_cursor = FALSE;
+	    break;
+	}

         /* FALSE if HWCursor not supported by slave */
-        if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr))
-            return FALSE;
+        if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) {
+            use_hw_cursor = FALSE;
+	    break;
+	}
     }
-    return TRUE;
+
+unlock:
+    input_unlock();
+
+    return use_hw_cursor;
 }

 static Bool
--
cgit v0.10.2


code:
Index: xorg-server-1.9.0/hw/xfree86/common/xf86Globals.c
===================================================================
--- xorg-server-1.9.0.orig/hw/xfree86/common/xf86Globals.c
+++ xorg-server-1.9.0/hw/xfree86/common/xf86Globals.c
@@ -140,7 +140,7 @@ xf86InfoRec xf86Info = {
 };
 const char *xf86ConfigFile = NULL;
 const char *xf86ConfigDir = NULL;
-const char *xf86ModulePath = DEFAULT_MODULE_PATH;
+const char *xf86ModulePath = DEFAULT_MODULE_PATH "/updates," DEFAULT_MODULE_PATH "/volatile," DEFAULT_MODULE_PATH;
 MessageType xf86ModPathFrom = X_DEFAULT;
 const char *xf86LogFile = DEFAULT_LOGPREFIX;
 MessageType xf86LogFileFrom = X_DEFAULT;


code:
From 4b281c11423b7bac8f0265e650a3e7ff890081bc Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@gmail.com>
Date: Tue, 30 Jul 2013 13:48:04 +1000
Subject: [PATCH] pixmap: fix reverse optimus support with multiple heads

For doing reverese optimus to multiple outputs on a secondary GPU
the GPU can store the blits into a large screen pixmap, unfortunately
this means we need a destination offset into the dirty code, so
add a new API that just adds this interface.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 dix/pixmap.c        | 18 ++++++++++++++----
 include/pixmap.h    |  6 ++++++
 include/pixmapstr.h |  1 +
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dix/pixmap.c b/dix/pixmap.c
index fe92147..e01d961 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -164,9 +164,9 @@ PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave)
 }

 Bool
-PixmapStartDirtyTracking(PixmapPtr src,
-                         PixmapPtr slave_dst,
-                         int x, int y)
+PixmapStartDirtyTracking2(PixmapPtr src,
+			  PixmapPtr slave_dst,
+			  int x, int y, int dst_x, int dst_y)
 {
     ScreenPtr screen = src->drawable.pScreen;
     PixmapDirtyUpdatePtr dirty_update;
@@ -179,6 +179,8 @@ PixmapStartDirtyTracking(PixmapPtr src,
     dirty_update->slave_dst = slave_dst;
     dirty_update->x = x;
     dirty_update->y = y;
+    dirty_update->dst_x = dst_x;
+    dirty_update->dst_y = dst_y;

     dirty_update->damage = DamageCreate(NULL, NULL,
                                         DamageReportNone,
@@ -195,6 +197,14 @@ PixmapStartDirtyTracking(PixmapPtr src,
 }

 Bool
+PixmapStartDirtyTracking(PixmapPtr src,
+			 PixmapPtr slave_dst,
+			 int x, int y)
+{
+   return PixmapStartDirtyTracking2(src, slave_dst, x, y, 0, 0);
+}
+
+Bool
 PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst)
 {
     ScreenPtr screen = src->drawable.pScreen;
@@ -262,7 +272,7 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region)
         h = dst_box.y2 - dst_box.y1;

         pGC->ops->CopyArea(&dirty->src->drawable, &dst->drawable, pGC,
-                           dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dst_box.x1, dst_box.y1);
+                           dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dirty->dst_x + dst_box.x1, dirty->dst_y + dst_box.y1);
         b++;
     }
     FreeScratchGC(pGC);
diff --git a/include/pixmap.h b/include/pixmap.h
index 921a94d..d7d0a5e 100644
--- a/include/pixmap.h
+++ b/include/pixmap.h
@@ -120,6 +120,12 @@ PixmapStartDirtyTracking(PixmapPtr src,
                          PixmapPtr slave_dst,
                          int x, int y);

+#define HAS_DIRTYTRACKING2 1
+extern _X_EXPORT Bool
+PixmapStartDirtyTracking2(PixmapPtr src,
+			  PixmapPtr slave_dst,
+			  int x, int y, int dst_x, int dst_y);
+
 extern _X_EXPORT Bool
 PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst);

diff --git a/include/pixmapstr.h b/include/pixmapstr.h
index 2a1ef9b..2bdff98 100644
--- a/include/pixmapstr.h
+++ b/include/pixmapstr.h
@@ -90,6 +90,7 @@ typedef struct _PixmapDirtyUpdate {
     int x, y;
     DamagePtr damage;
     struct xorg_list ent;
+    int dst_x, dst_y;
 } PixmapDirtyUpdateRec;

 static inline void
--
1.8.2.1


code:
# Collection of quirks and blacklist/whitelists for specific devices.

# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
# http://bugs.freedesktop.org/show_bug.cgi?id=22442
Section "InputClass"
        Identifier "ThinkPad HDAPS accelerometer blacklist"
        MatchProduct "ThinkPad HDAPS accelerometer data"
        Option "Ignore" "on"
EndSection

# https://bugzilla.redhat.com/show_bug.cgi?id=523914
# Mouse does not move in PV Xen guest
# Explicitly tell evdev to not ignore the absolute axes.
Section "InputClass"
        Identifier "Xen Virtual Pointer axis blacklist"
        MatchProduct "Xen Virtual Pointer"
        Option "IgnoreAbsoluteAxes" "off"
        Option "IgnoreRelativeAxes" "off"
EndSection

# https://bugs.freedesktop.org/show_bug.cgi?id=55867
# Bug 55867 - Doesn't know how to tag XI_TRACKBALL
Section "InputClass"
        Identifier "Tag trackballs as XI_TRACKBALL"
        MatchProduct "trackball"
        MatchDriver "evdev"
        Option "TypeName" "TRACKBALL"
EndSection

# https://bugs.freedesktop.org/show_bug.cgi?id=62831
# Bug 62831 - Mionix Naos 5000 mouse detected incorrectly
Section "InputClass"
        Identifier "Tag Mionix Naos 5000 mouse XI_MOUSE"
        MatchProduct "La-VIEW Technology Naos 5000 Mouse"
        MatchDriver "evdev"
        Option "TypeName" "MOUSE"
EndSection


code:
From c17e544b271ced65483692103d39ed1188d4ca25 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 27 Sep 2016 14:30:10 +0200
Subject: [PATCH xserver v2 5/7] xfree86: Remove redundant ServerIsNotSeat0
 check from xf86CallDriverProbe

If foundScreen is TRUE, then all the code below the removed if
will not execute until we reach the return foundScreen; at the
end, so this entire if block is redundant.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86Bus.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 5b93940..27c6b1b 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -82,8 +82,6 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
     if (!xf86DoConfigure && drv->platformProbe != NULL) {
         foundScreen = xf86platformProbeDev(drv);
     }
-    if (ServerIsNotSeat0() && foundScreen)
-        return foundScreen;
 #endif

 #ifdef XSERVER_LIBPCIACCESS
--
2.9.3

From 74bc0fff3a6ca233e56b3fb2971bca97b5a4f8b5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 30 Sep 2016 11:59:04 +0200
Subject: [PATCH xserver v2 6/7] xfree86: Make adding unclaimed devices as GPU
 devices a separate step

This is primarily a preparation patch for fixing the xserver exiting with
a "no screens found" error even though there are supported video cards,
due to the server not recognizing any card as the primary card.

This also fixes the (mostly theoretical) case of a platformBus capable
driver adding a device as GPUscreen before a driver which only supports
the old PCI probe method gets a chance to claim it as a normal screen.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86Bus.c         |  4 ++++
 hw/xfree86/common/xf86platformBus.c | 15 +++++++++++++++
 hw/xfree86/common/xf86platformBus.h |  6 ++++++
 3 files changed, 25 insertions(+)

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 27c6b1b..a3a9898 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -125,6 +125,10 @@ xf86BusConfig(void)
         xf86CallDriverProbe(xf86DriverList[i], FALSE);
     }

+    for (i = 0; i < xf86NumDrivers; i++) {
+        xf86platformAddGPUDevices(xf86DriverList[i]);
+    }
+
     /* If nothing was detected, return now */
     if (xf86NumScreens == 0) {
         xf86Msg(X_ERROR, "No devices detected.\n");
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 39fb1dd..8dd0d5d 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -475,6 +475,21 @@ xf86platformProbeDev(DriverPtr drvp)
                                         isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);
     }

+    return foundScreen;
+}
+
+int
+xf86platformAddGPUDevices(DriverPtr drvp)
+{
+    Bool foundScreen = FALSE;
+    GDevPtr *devList;
+    int j;
+
+    if (!drvp->platformProbe)
+        return FALSE;
+
+    xf86MatchDevice(drvp->driverName, &devList);
+
     /* if autoaddgpu devices is enabled then go find any unclaimed platform
      * devices and add them as GPU screens */
     if (xf86Info.autoAddGPU) {
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index a7335b9..0f5c0ef 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -41,6 +41,7 @@ struct xf86_platform_device {
 #ifdef XSERVER_PLATFORM_BUS
 int xf86platformProbe(void);
 int xf86platformProbeDev(DriverPtr drvp);
+int xf86platformAddGPUDevices(DriverPtr drvp);

 extern int xf86_num_platform_devices;
 extern struct xf86_platform_device *xf86_platform_devices;
@@ -156,6 +157,11 @@ xf86PlatformMatchDriver(char *matches[], int nmatches);

 extern void xf86platformVTProbe(void);
 extern void xf86platformPrimary(void);
+
+#else
+
+static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
+
 #endif

 #endif
--
2.9.3

From 02bcb6f189c4ad8b2e73ce99cfa3c10f0c244a88 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 30 Sep 2016 12:29:09 +0200
Subject: [PATCH xserver v2 7/7] xfree86: Try harder to find atleast 1 non GPU
 Screen

If we did not find any non GPU Screens, try again ignoring the notion
of any video devices being the primary device. This fixes Xorg exiting
with a "no screens found" error when using virtio-vga in a
virtual-machine and when using a device driven by simpledrm.

This is a somewhat ugly solution, but it is the best I can come up with
without major surgery to the bus and probe code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86.h            |  1 +
 hw/xfree86/common/xf86Bus.c         | 26 +++++++++++++++++++++++---
 hw/xfree86/common/xf86Globals.c     |  1 +
 hw/xfree86/common/xf86pciBus.c      |  4 ++++
 hw/xfree86/common/xf86platformBus.c |  4 ++++
 5 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index e54c811..f724688 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -55,6 +55,7 @@
 extern _X_EXPORT int xf86DoConfigure;
 extern _X_EXPORT int xf86DoShowOptions;
 extern _X_EXPORT Bool xf86DoConfigurePass1;
+extern _X_EXPORT Bool xf86ProbeIgnorePrimary;
 extern _X_EXPORT Bool xorgHWAccess;

 extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index a3a9898..9836803 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -117,14 +117,34 @@ xf86BusConfig(void)
     int i, j;

     /*
-     * Now call each of the Probe functions.  Each successful probe will
-     * result in an extra entry added to the xf86Screens[] list for each
-     * instance of the hardware found.
+     * 3 step probe to (hopefully) ensure that we always find at least 1
+     * (non GPU) screen:
+     *
+     * 1. Call each drivers probe function normally,
+     *    Each successful probe will result in an extra entry added to the
+     *    xf86Screens[] list for each instance of the hardware found.
      */
     for (i = 0; i < xf86NumDrivers; i++) {
         xf86CallDriverProbe(xf86DriverList[i], FALSE);
     }

+    /*
+     * 2. If no Screens were found, call each drivers probe function with
+     *    ignorePrimary = TRUE, to ensure that we do actually get a
+     *    Screen if there is atleast one supported video card.
+     */
+    if (xf86NumScreens == 0) {
+        xf86ProbeIgnorePrimary = TRUE;
+        for (i = 0; i < xf86NumDrivers && xf86NumScreens == 0; i++) {
+            xf86CallDriverProbe(xf86DriverList[i], FALSE);
+        }
+        xf86ProbeIgnorePrimary = FALSE;
+    }
+
+    /*
+     * 3. Call xf86platformAddGPUDevices() to add any additional video cards as
+     *    GPUScreens (GPUScreens are only supported by platformBus drivers).
+     */
     for (i = 0; i < xf86NumDrivers; i++) {
         xf86platformAddGPUDevices(xf86DriverList[i]);
     }
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 07cfabf..e962b75 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -152,6 +152,7 @@ XF86ConfigPtr xf86configptr = NULL;
 Bool xf86Resetting = FALSE;
 Bool xf86Initialising = FALSE;
 Bool xf86DoConfigure = FALSE;
+Bool xf86ProbeIgnorePrimary = FALSE;
 Bool xf86DoShowOptions = FALSE;
 DriverPtr *xf86DriverList = NULL;
 int xf86NumDrivers = 0;
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 8158c2b..9adfee5 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -352,6 +352,10 @@ xf86ComparePciBusString(const char *busID, int bus, int device, int func)
 Bool
 xf86IsPrimaryPci(struct pci_device *pPci)
 {
+    /* Add max. 1 screen for the IgnorePrimary fallback path */
+    if (xf86ProbeIgnorePrimary && xf86NumScreens == 0)
+        return TRUE;
+
     if (primaryBus.type == BUS_PCI)
         return pPci == primaryBus.id.pci;
 #ifdef XSERVER_PLATFORM_BUS
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 8dd0d5d..063e81c 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -114,6 +114,10 @@ xf86_find_platform_device_by_devnum(int major, int minor)
 static Bool
 xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
 {
+    /* Add max. 1 screen for the IgnorePrimary fallback path */
+    if (xf86ProbeIgnorePrimary && xf86NumScreens == 0)
+        return TRUE;
+
     if (primaryBus.type == BUS_PLATFORM)
         return plat == primaryBus.id.plat;
 #ifdef XSERVER_LIBPCIACCESS
--
2.9.3

From c57c1e53ea3d76ebba5b2a23b7260817d3e6b921 Mon Sep 17 00:00:00 2001
From: Hans De Goede <hdegoede@redhat.com>
Date: Mon, 12 Dec 2016 17:03:12 +0100
Subject: [PATCH xserver 1/6] xfree86: Free devlist returned by xf86MatchDevice

xf86MatchDevice returns a dynamically allocated list of GDevPtr-s,
free this when we're done with it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86platformBus.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 063e81c..16d934f 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -479,6 +479,8 @@ xf86platformProbeDev(DriverPtr drvp)
                                         isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);
     }

+    free(devList);
+
     return foundScreen;
 }

@@ -505,6 +507,8 @@ xf86platformAddGPUDevices(DriverPtr drvp)
         }
     }

+    free(devList);
+
     return foundScreen;
 }

--
2.9.3

From 08b84d72878e43401e99059c3c926dfa42a360c3 Mon Sep 17 00:00:00 2001
From: Hans De Goede <hdegoede@redhat.com>
Date: Mon, 12 Dec 2016 17:03:13 +0100
Subject: [PATCH xserver 2/6] xfree86: Make OutputClassMatches take a
 xf86_platform_device

Make OutputClassMatches directly take a xf86_platform_device as argument,
rather then an index into xf86_platform_devices. This makes things
easier for callers which already have a xf86_platform_device pointer.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86platformBus.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 16d934f..25a9040 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -214,9 +214,10 @@ MatchToken(const char *value, struct xorg_list *patterns,
 }

 static Bool
-OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
+OutputClassMatches(const XF86ConfOutputClassPtr oclass,
+                   struct xf86_platform_device *dev)
 {
-    char *driver = xf86_platform_odev_attributes(index)->driver;
+    char *driver = dev->attribs->driver;

     if (!MatchToken(driver, &oclass->match_driver, strcmp))
         return FALSE;
@@ -234,7 +235,7 @@ xf86OutputClassDriverList(int index, char *matches[], int nmatches)
         return 0;

     for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
-        if (OutputClassMatches(cl, index)) {
+        if (OutputClassMatches(cl, &xf86_platform_devices[index])) {
             char *path = xf86_platform_odev_attributes(index)->path;

             xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
--
2.9.3

From 9cd3cc75269d9196898487b5712ee47b8291e077 Mon Sep 17 00:00:00 2001
From: Hans De Goede <hdegoede@redhat.com>
Date: Mon, 12 Dec 2016 17:03:14 +0100
Subject: [PATCH xserver 3/6] xfree86: Add options support for OutputClass
 Options

Add support for setting options in OutputClass Sections and having these
applied to any matching output devices.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86Option.c      |  5 ++++-
 hw/xfree86/common/xf86platformBus.c | 42 +++++++++++++++++++++++++++++++++++++
 hw/xfree86/common/xf86platformBus.h |  2 ++
 hw/xfree86/man/xorg.conf.man        | 10 +++++++++
 hw/xfree86/parser/OutputClass.c     |  6 ++++++
 hw/xfree86/parser/xf86Parser.h      |  1 +
 6 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 0e8bc1f..929724d 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -44,6 +44,7 @@
 #include "xf86Xinput.h"
 #include "xf86Optrec.h"
 #include "xf86Parser.h"
+#include "xf86platformBus.h" /* For OutputClass functions */
 #include "optionstr.h"

 static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
@@ -64,7 +65,7 @@ static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
  *
  * The order of precedence for options is:
  *
- *   extraOpts, display, confScreen, monitor, device
+ *   extraOpts, display, confScreen, monitor, device, outputClassOptions
  */

 void
@@ -79,6 +80,8 @@ xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
     pScrn->options = NULL;

     for (i = pScrn->numEntities - 1; i >= 0; i--) {
+        xf86MergeOutputClassOptions(pScrn->entityList[i], &pScrn->options);
+
         device = xf86GetDevFromEntity(pScrn->entityList[i],
                                       pScrn->entityInstanceList[i]);
         if (device && device->options) {
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 25a9040..a698c6c 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -310,6 +310,48 @@ xf86platformProbe(void)
     return 0;
 }

+void
+xf86MergeOutputClassOptions(int entityIndex, void **options)
+{
+    const EntityPtr entity = xf86Entities[entityIndex];
+    struct xf86_platform_device *dev = NULL;
+    XF86ConfOutputClassPtr cl;
+    XF86OptionPtr classopts;
+    int i = 0;
+
+    switch (entity->bus.type) {
+    case BUS_PLATFORM:
+        dev = entity->bus.id.plat;
+        break;
+    case BUS_PCI:
+        for (i = 0; i < xf86_num_platform_devices; i++) {
+            if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
+                                  entity->bus.id.pci)) {
+                dev = &xf86_platform_devices[i];
+                break;
+            }
+        }
+        break;
+    default:
+        xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n",
+                entity->bus.type);
+    }
+
+    if (!dev)
+        return;
+
+    for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+        if (!OutputClassMatches(cl, dev) || !cl->option_lst)
+            continue;
+
+        xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n",
+                cl->identifier, dev->attribs->path);
+
+        classopts = xf86optionListDup(cl->option_lst);
+        *options = xf86optionListMerge(*options, classopts);
+    }
+}
+
 static int
 xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
                   int chipset, GDevPtr dev, Bool active)
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index 0f5c0ef..70d9ec8 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -42,6 +42,7 @@ struct xf86_platform_device {
 int xf86platformProbe(void);
 int xf86platformProbeDev(DriverPtr drvp);
 int xf86platformAddGPUDevices(DriverPtr drvp);
+void xf86MergeOutputClassOptions(int entityIndex, void **options);

 extern int xf86_num_platform_devices;
 extern struct xf86_platform_device *xf86_platform_devices;
@@ -161,6 +162,7 @@ extern void xf86platformPrimary(void);
 #else

 static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
+static inline void xf86MergeOutputClassOptions(int index, void **options) {}

 #endif

diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 7d0c524..8928a53 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1280,6 +1280,16 @@ For example:
 Check the case-sensitive string
 .RI \*q matchdriver \*q
 against the kernel driver of the device.
+.PP
+When an output device has been matched to the
+.B OutputClass
+section, any
+.B Option
+entries are applied to the device. See the
+.B Device
+section below for a description of the remaining
+.B Option
+entries.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c
index 8064e0c..f813ee6 100644
--- a/hw/xfree86/parser/OutputClass.c
+++ b/hw/xfree86/parser/OutputClass.c
@@ -36,6 +36,7 @@ static const xf86ConfigSymTabRec OutputClassTab[] = {
     {ENDSECTION, "endsection"},
     {IDENTIFIER, "identifier"},
     {DRIVER, "driver"},
+    {OPTION, "option"},
     {MATCH_DRIVER, "matchdriver"},
     {-1, ""},
 };
@@ -60,6 +61,8 @@ xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
             free(group);
         }

+        xf86optionListFree(ptr->option_lst);
+
         prev = ptr;
         ptr = ptr->list.next;
         free(prev);
@@ -112,6 +115,9 @@ xf86parseOutputClassSection(void)
             else
                 ptr->driver = xf86_lex_val.str;
             break;
+        case OPTION:
+            ptr->option_lst = xf86parseOption(ptr->option_lst);
+            break;
         case MATCH_DRIVER:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDriver");
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index 9c4b403..897edab 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -338,6 +338,7 @@ typedef struct {
     char *identifier;
     char *driver;
     struct xorg_list match_driver;
+    XF86OptionPtr option_lst;
     char *comment;
 } XF86ConfOutputClassRec, *XF86ConfOutputClassPtr;

--
2.9.3

From ab1a65b7755d081b41188104b21f4d21eaa3187b Mon Sep 17 00:00:00 2001
From: Hans De Goede <hdegoede@redhat.com>
Date: Mon, 12 Dec 2016 17:03:15 +0100
Subject: [PATCH xserver 4/6] xfree86: xf86platformProbe: split finding
 pci-info and setting primary GPU

This is a preparation patch for allowing an OutputClass section to
override the default primary GPU device selection.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86platformBus.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index a698c6c..39b3248 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -145,16 +145,9 @@ platform_find_pci_info(struct xf86_platform_device *pd, char *busid)

     iter = pci_slot_match_iterator_create(&devmatch);
     info = pci_device_next(iter);
-    if (info) {
+    if (info)
         pd->pdev = info;
-        pci_device_probe(info);
-        if (pci_device_is_boot_vga(info)) {
-            primaryBus.type = BUS_PLATFORM;
-            primaryBus.id.plat = pd;
-        }
-    }
     pci_iterator_destroy(iter);
-
 }

 static Bool
@@ -307,6 +300,20 @@ xf86platformProbe(void)
             platform_find_pci_info(&xf86_platform_devices[i], busid);
         }
     }
+
+    for (i = 0; i < xf86_num_platform_devices; i++) {
+        struct xf86_platform_device *dev = &xf86_platform_devices[i];
+
+        if (!dev->pdev)
+            continue;
+
+        pci_device_probe(dev->pdev);
+        if (pci_device_is_boot_vga(dev->pdev)) {
+            primaryBus.type = BUS_PLATFORM;
+            primaryBus.id.plat = dev;
+        }
+    }
+
     return 0;
 }

--
2.9.3

From d75ffcdbf8c1e3c8e0d46debcd533a9f2560f0a8 Mon Sep 17 00:00:00 2001
From: Hans De Goede <hdegoede@redhat.com>
Date: Mon, 12 Dec 2016 17:03:16 +0100
Subject: [PATCH xserver 5/6] xfree86: Allow overriding primary GPU detection
 from an OutputClass section

Allow using:

Option "PrimaryGPU" "yes"

In an OutputClass section to override the default primary GPU device
selection which selects the GPU used as output by the firmware.

If multiple output devices match an OutputClass section with
the PrimaryGPU option set, the first one enumerated becomes the
primary GPU.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86platformBus.c | 19 +++++++++++++++++++
 hw/xfree86/man/xorg.conf.man        | 12 +++++++++++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 39b3248..fc17d15 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -286,6 +286,7 @@ xf86platformProbe(void)
 {
     int i;
     Bool pci = TRUE;
+    XF86ConfOutputClassPtr cl;

     config_odev_probe(xf86PlatformDeviceProbe);

@@ -301,6 +302,24 @@ xf86platformProbe(void)
         }
     }

+    /* First see if there is an OutputClass match marking a device as primary */
+    for (i = 0; i < xf86_num_platform_devices; i++) {
+        struct xf86_platform_device *dev = &xf86_platform_devices[i];
+        for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+            if (!OutputClassMatches(cl, dev))
+                continue;
+
+            if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) {
+                xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as PrimaryGPU\n",
+                        cl->identifier, dev->attribs->path);
+                primaryBus.type = BUS_PLATFORM;
+                primaryBus.id.plat = dev;
+                return 0;
+            }
+        }
+    }
+
+    /* Then check for pci_device_is_boot_vga() */
     for (i = 0; i < xf86_num_platform_devices; i++) {
         struct xf86_platform_device *dev = &xf86_platform_devices[i];

diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 8928a53..79b71a8 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1285,11 +1285,21 @@ When an output device has been matched to the
 .B OutputClass
 section, any
 .B Option
-entries are applied to the device. See the
+entries are applied to the device. One
+.B OutputClass
+specific
+.B Option
+is recognized. See the
 .B Device
 section below for a description of the remaining
 .B Option
 entries.
+.TP 7
+.BI "Option \*qPrimaryGPU\*q \*q" boolean \*q
+This option specifies that the matched device should be treated as the
+primary GPU, replacing the selection of the GPU used as output by the
+firmware. If multiple output devices match an OutputClass section with
+the PrimaryGPU option set, the first one enumerated becomes the primary GPU.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
--
2.9.3

From b5dffbbac193aa640ffcfa0a431c21b862854e53 Mon Sep 17 00:00:00 2001
From: Hans De Goede <hdegoede@redhat.com>
Date: Mon, 12 Dec 2016 17:03:17 +0100
Subject: [PATCH xserver 6/6] xfree86: Add ModulePath support for OutputClass
 config Sections

Allow OutputClass config snippets to modify the module-path.

Note that any specified ModulePaths will be pre-pended to the normal
ModulePath. The idea behind this is that any output hardware specific
modules should have preference over the normal modules.

One use-case for this is the nvidia binary driver, this allows a
config snippet like this:

Section "OutputClass"
    MatchDriver "nvidia"
    Modulepath "/usr/lib64/nvidia/modules"
EndSection

To get the nvidia glx specific glx module loaded, but only when the
nvidia kernel driver is loaded.

Together with the glvnd work done recently, this allows the nouveau
+ mesa and nvidia-binary userspace stacks to co-exist on the same
system without any ldconfig / xorg.conf tweaking and the xserver will
automatically do the right thing depending on which kernel driver
(nouveau or nvidia) is loaded.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/xfree86/common/xf86platformBus.c | 23 +++++++++++++++++++++++
 hw/xfree86/loader/loadmod.c         |  1 +
 hw/xfree86/man/xorg.conf.man        | 16 ++++++++++++++++
 hw/xfree86/parser/OutputClass.c     | 15 +++++++++++++++
 hw/xfree86/parser/xf86Parser.h      |  1 +
 5 files changed, 56 insertions(+)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index fc17d15..0b5795f 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -40,6 +40,7 @@
 #include "hotplug.h"
 #include "systemd-logind.h"

+#include "loaderProcs.h"
 #include "xf86.h"
 #include "xf86_OSproc.h"
 #include "xf86Priv.h"
@@ -287,6 +288,7 @@ xf86platformProbe(void)
     int i;
     Bool pci = TRUE;
     XF86ConfOutputClassPtr cl;
+    char *old_path, *path = NULL;

     config_odev_probe(xf86PlatformDeviceProbe);

@@ -300,8 +302,29 @@ xf86platformProbe(void)
         if (pci && (strncmp(busid, "pci:", 4) == 0)) {
             platform_find_pci_info(&xf86_platform_devices[i], busid);
         }
+
+        /*
+         * Deal with OutputClass ModulePath directives, these must be
+         * processed before we do any module loading.
+         */
+        for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+            if (!OutputClassMatches(cl, &xf86_platform_devices[i]))
+                continue;
+
+            if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) {
+                old_path = path;
+                XNFasprintf(&path, "%s,%s", cl->modulepath,
+                            path ? path : xf86ModulePath);
+                free(old_path);
+                xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
+                        cl->identifier, path);
+                LoaderSetPath(path);
+            }
+        }
     }

+    free(path);
+
     /* First see if there is an OutputClass match marking a device as primary */
     for (i = 0; i < xf86_num_platform_devices; i++) {
         struct xf86_platform_device *dev = &xf86_platform_devices[i];
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 8bf6836..940f5fc 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -184,6 +184,7 @@ LoaderSetPath(const char *path)
     if (!path)
         return;

+    FreeStringList(defaultPathList);
     defaultPathList = InitPathList(path);
 }

diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 79b71a8..00ebf56 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1300,6 +1300,22 @@ This option specifies that the matched device should be treated as the
 primary GPU, replacing the selection of the GPU used as output by the
 firmware. If multiple output devices match an OutputClass section with
 the PrimaryGPU option set, the first one enumerated becomes the primary GPU.
+.PP
+A
+.B OutputClass
+Section may contain
+.B ModulePath
+entries. When an output device matches an
+.B OutputClass
+section, any
+.B ModulePath
+entries in that
+.B OutputClass
+are pre-pended to the search path for loadable Xorg server modules. See
+.B ModulePath
+in the
+.B Files
+section for more info.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c
index f813ee6..01b348f 100644
--- a/hw/xfree86/parser/OutputClass.c
+++ b/hw/xfree86/parser/OutputClass.c
@@ -36,6 +36,7 @@ static const xf86ConfigSymTabRec OutputClassTab[] = {
     {ENDSECTION, "endsection"},
     {IDENTIFIER, "identifier"},
     {DRIVER, "driver"},
+    {MODULEPATH, "modulepath"},
     {OPTION, "option"},
     {MATCH_DRIVER, "matchdriver"},
     {-1, ""},
@@ -53,6 +54,7 @@ xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
         TestFree(ptr->identifier);
         TestFree(ptr->comment);
         TestFree(ptr->driver);
+        TestFree(ptr->modulepath);

         xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
             xorg_list_del(&group->entry);
@@ -115,6 +117,19 @@ xf86parseOutputClassSection(void)
             else
                 ptr->driver = xf86_lex_val.str;
             break;
+        case MODULEPATH:
+            if (xf86getSubToken(&(ptr->comment)) != STRING)
+                Error(QUOTE_MSG, "ModulePath");
+            if (ptr->modulepath) {
+                char *path;
+                XNFasprintf(&path, "%s,%s", ptr->modulepath, xf86_lex_val.str);
+                free(xf86_lex_val.str);
+                free(ptr->modulepath);
+                ptr->modulepath = path;
+            } else {
+                ptr->modulepath = xf86_lex_val.str;
+            }
+            break;
         case OPTION:
             ptr->option_lst = xf86parseOption(ptr->option_lst);
             break;
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index 897edab..e014048 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -337,6 +337,7 @@ typedef struct {
     GenericListRec list;
     char *identifier;
     char *driver;
+    char *modulepath;
     struct xorg_list match_driver;
     XF86OptionPtr option_lst;
     char *comment;
--
2.9.3


code:
Link against static libnettle

There's no libnettle udeb.

Index: xorg-server/configure.ac
===================================================================
--- xorg-server.orig/configure.ac	2013-08-02 20:15:25.471466837 +0200
+++ xorg-server/configure.ac	2013-08-02 20:17:12.875999417 +0200
@@ -1433,7 +1433,7 @@
 if test "x$with_sha1" = xlibnettle; then
 	AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
 	          [Use libnettle SHA1 functions])
-	SHA1_LIBS=-lnettle
+	SHA1_LIBS=-l:libnettle.a
 fi
 AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
 if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then


code:
From 272537ae14a04911fcf2fec51492fa0f91c4a676 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Wed, 29 Aug 2012 20:16:40 +0200
Subject: [PATCH] Revert "Unload submodules."

This reverts commit 0d4bb5442ceb8e8e4a8de6cfc4203cae469eee72.

This doesn't seem to work quite well.  See Debian bug#686152.
---
 hw/xfree86/common/xf86Helper.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1596,7 +1596,13 @@ xf86LoadOneModule(char *name, pointer op
 void
 xf86UnloadSubModule(pointer mod)
 {
+    /*
+     * This is disabled for now.  The loader isn't smart enough yet to undo
+     * relocations.
+     */
+#if 0
     UnloadSubModule(mod);
+#endif
 }

 Bool


code:
From 10aaa5d2ffa62df99f03c857dc78e6ff2b33c183 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Sun, 30 Sep 2012 12:02:11 +0200
Subject: [PATCH] Revert "fb: reorder Bresenham error correction to avoid
 overshoot."

This reverts commit 3e62f48edf47a59d923ac58b6d4262b02456a556.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54168
Debian: http://buss.debian.org/688908

Signed-off-by: Julien Cristau <jcristau@debian.org>
---
 fb/fbseg.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fb/fbseg.c b/fb/fbseg.c
index 1848387..0e4e0a9 100644
--- a/fb/fbseg.c
+++ b/fb/fbseg.c
@@ -65,12 +65,6 @@ fbBresSolid(DrawablePtr pDrawable,
     if (axis == X_AXIS) {
         bits = 0;
         while (len--) {
-            if (e >= 0) {
-                WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
-                bits = 0;
-                dst += dstStride;
-                e += e3;
-            }
             bits |= mask;
             mask = fbBresShiftMask(mask, signdx, dstBpp);
             if (!mask) {
@@ -80,12 +74,21 @@ fbBresSolid(DrawablePtr pDrawable,
                 mask = mask0;
             }
             e += e1;
+            if (e >= 0) {
+                WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
+                bits = 0;
+                dst += dstStride;
+                e += e3;
+            }
         }
         if (bits)
             WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
     }
     else {
         while (len--) {
+            WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+            dst += dstStride;
+            e += e1;
             if (e >= 0) {
                 e += e3;
                 mask = fbBresShiftMask(mask, signdx, dstBpp);
@@ -94,9 +97,6 @@ fbBresSolid(DrawablePtr pDrawable,
                     mask = mask0;
                 }
             }
-            WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
-            dst += dstStride;
-            e += e1;
         }
     }

--
1.7.10.4


code:
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 43c746b..750b425 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -75,6 +75,13 @@
 	"\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
 	"EndSection\n\n"

+#define BUILTIN_SCREEN_SECTION_PROPRIETARY \
+	"Section \"Screen\"\n" \
+	"\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \
+	"\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
+	"\tDefaultDepth\t24\n" \
+	"EndSection\n\n"
+
 #define BUILTIN_LAYOUT_SECTION_PRE \
 	"Section \"ServerLayout\"\n" \
 	"\tIdentifier\t\"Builtin Default Layout\"\n"
@@ -153,7 +160,11 @@ xf86AutoConfig(void)
     for (p = deviceList; *p; p++) {
         snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
         AppendToConfig(buf);
-        snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
+        if (strcmp(*p, "fglrx") == 0 || strcmp(*p, "nvidia") == 0)
+            snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION_PROPRIETARY, *p,
+                     0, *p, 0);
+        else
+            snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
         AppendToConfig(buf);
     }

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index e52f1da..bd62a7e 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1107,7 +1107,8 @@ videoPtrToDriverList(struct pci_device *dev,
         driverList[0] = "ast";
         break;
     case 0x1002:
-        driverList[0] = "ati";
+        driverList[0] = "fglrx";
+        driverList[1] = "ati";
         break;
     case 0x102c:
         driverList[0] = "chips";
@@ -1143,6 +1144,7 @@ videoPtrToDriverList(struct pci_device *dev,
     {
         int idx = 0;

+        driverList[idx++] = "nvidia";
 #ifdef __linux__
         driverList[idx++] = "nouveau";
 #endif


code:
Description: Fix build failure with GCC 4.8
   This patches fixes the following build failure:

   ../../dix/window.c:887:5: error: implicit declaration of function 'DeleteWindowFromAnySelections' [-Werror=implicit-function-declaration]

   by including "selection.h", where the function is prototyped.

Author: Gerardo Malazdrewicz <gerardo@malazdrewicz.com.ar>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=701372
--- xorg-server-1.12.4/dix/window.c	2012-05-17 14:09:02.000000000 -0300
+++ xorg-server-1.12.4.good/dix/window.c	2013-04-18 11:53:06.787521781 -0300
@@ -131,6 +131,8 @@
 #include "xace.h"
 #include "exevents.h"

+#include "selection.h"
+
 #include <X11/Xatom.h>          /* must come after server includes */

 /******


code:
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index e52f1da..462faa9 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -135,8 +135,8 @@ xf86PciProbe(void)
                 }
                 else {
                     xf86Msg(X_NOTICE,
-                            "More than one possible primary device found\n");
-                    primaryBus.type ^= (BusType) (-1);
+                            "More than one possible primary device found.  Using first one seen.\n");
+                    break;
                 }
             }
         }


code:
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -161,6 +161,7 @@
 int xf86NumInputDrivers = 0;
 int xf86NumScreens = 0;
 int xf86NumGPUScreens = 0;
+Bool xf86AttemptedFallback = FALSE;

 const char *xf86VisualNames[] = {
     "StaticGray",
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -481,20 +481,34 @@
             free(optionlist);
         }

+ Fallback:
         /* Load all driver modules specified in the config file */
         /* If there aren't any specified in the config file, autoconfig them */
         /* FIXME: Does not handle multiple active screen sections, but I'm not
          * sure if we really want to handle that case*/
         configured_device = xf86ConfigLayout.screens->screen->device;
-        if ((!configured_device) || (!configured_device->driver)) {
+        if (xf86AttemptedFallback) {
+            configured_device->driver = NULL;
+            if (!autoConfigDevice(configured_device)) {
+                xf86Msg(X_ERROR, "Auto configuration on fallback failed\n");
+                return;
+            }
+        }
+        else if ((!configured_device) || (!configured_device->driver)) {
             if (!autoConfigDevice(configured_device)) {
                 xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
                 return;
             }
         }
         if ((modulelist = xf86DriverlistFromConfig())) {
-            xf86LoadModules(modulelist, NULL);
-            free(modulelist);
+            if (!xf86LoadModules(modulelist, NULL) && !xf86AttemptedFallback) {
+                free(modulelist);
+                xf86AttemptedFallback = TRUE;
+                goto Fallback;
+            }
+            else {
+                free(modulelist);
+            }
         }

         /* Load all input driver modules specified in the config file. */
@@ -554,8 +568,15 @@
         else
             xf86Info.dontVTSwitch = TRUE;

-        if (xf86BusConfig() == FALSE)
-            return;
+        if (xf86BusConfig() == FALSE) {
+            if (!xf86AttemptedFallback) {
+                xf86AttemptedFallback = TRUE;
+                goto Fallback;
+            }
+            else {
+                return;
+            }
+        }

         xf86PostProbe();

--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -89,6 +89,7 @@
 extern _X_EXPORT Bool xf86Resetting;
 extern _X_EXPORT Bool xf86Initialising;
 extern _X_EXPORT int xf86NumScreens;
+extern _X_EXPORT Bool xf86AttemptedFallback;
 extern _X_EXPORT const char *xf86VisualNames[];
 extern _X_EXPORT int xf86Verbose;       /* verbosity level */
 extern _X_EXPORT int xf86LogVerbose;    /* log file verbosity level */


code:
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 24b9a70..266c7e0 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -466,6 +466,10 @@ miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
     GCPtr pGC;

     pBuffer = miGetDCDevice(pDev, pScreen);
+
+    if (!pBuffer)
+        return FALSE;
+
     pSave = pBuffer->pSave;

     pWin = pScreen->root;


code:
From 37d51acb3b6a38af1717bfaa7925043c35bfb447 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Fri, 17 Aug 2012 09:49:24 +1000
Subject: [PATCH] autobind GPUs to the screen, (v3)

this is racy and really not what we want for hotplug going forward,
but until DE support is in GNOME its probably for the best.

v2: fix if config or slave config is NULL
v3: fix multi useful slaves
DO NOT UPSTREAM.
---
 hw/xfree86/common/xf86Init.c        | 12 ++++++++++++
 hw/xfree86/common/xf86platformBus.c |  3 +++
 hw/xfree86/modes/xf86Crtc.c         | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index d231ced..89629c1 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -361,6 +361,16 @@ xf86CreateRootWindow(WindowPtr pWin)
     return ret;
 }

+extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master);
+static void
+xf86AutoConfigOutputDevices(void)
+{
+    int i;
+
+    for (i = 0; i < xf86NumGPUScreens; i++)
+        xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);
+}
+
 static void
 InstallSignalHandlers(void)
 {
@@ -926,6 +936,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
     for (i = 0; i < xf86NumGPUScreens; i++)
         AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);

+    xf86AutoConfigOutputDevices();
+
     xf86VGAarbiterWrapFunctions();
     if (sigio_blocked)
         OsReleaseSIGIO();
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 0525e39..82fef32 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -387,6 +387,8 @@ xf86platformProbeDev(DriverPtr drvp)
     return foundScreen;
 }

+extern void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master);
+
 int
 xf86platformAddDevice(int index)
 {
@@ -446,6 +448,7 @@ xf86platformAddDevice(int index)

    /* attach unbound to 0 protocol screen */
    AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
+   xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);

    return 0;
 }
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 3011f13..34c1848 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -3323,3 +3323,35 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn)
             crtc->x = crtc->y = 0;
         }
 }
+
+
+void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master)
+{
+    RRProviderPtr master_provider;
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(master);
+    xf86CrtcConfigPtr slave_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    Bool unbound = FALSE;
+
+    if (!config || !slave_config)
+        return;
+
+    master_provider = config->randr_provider;
+
+    if ((master->capabilities & RR_Capability_SinkOffload) &&
+        pScrn->capabilities & RR_Capability_SourceOffload) {
+            /* source offload */
+
+        DetachUnboundGPU(pScrn->pScreen);
+        unbound = TRUE;
+        AttachOffloadGPU(master->pScreen, pScrn->pScreen);
+        slave_config->randr_provider->offload_sink = master_provider;
+    }
+    if ((master->capabilities & RR_Capability_SourceOutput) &&
+               pScrn->capabilities & RR_Capability_SinkOutput) {
+        /* sink offload */
+        if (!unbound)
+            DetachUnboundGPU(pScrn->pScreen);
+        AttachOutputGPU(master->pScreen, pScrn->pScreen);
+        slave_config->randr_provider->output_source = master_provider;
+    }
+}
--
1.8.1


code:
diff --git a/dix/window.c b/dix/window.c
index 49ef4a0..5b87238 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -110,6 +110,7 @@ Equipment Corporation.
 #include "input.h"
 #include "inputstr.h"
 #include "resource.h"
+#include "selection.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "dixstruct.h"