Compare commits

...

61 Commits

Author SHA1 Message Date
Kevin E Martin
e9411184f7 Update formatted docs. 2005-02-08 00:44:27 +00:00
Roland Mainz
348f886151 //bugs.freedesktop.org/show_bug.cgi?id=2206) attachment #1622
(https://bugs.freedesktop.org/attachment.cgi?id=1622) as this patch
    does not work for the branch and causes build failure. Approved in the
    2005-01-31 Xorg release-wranglers phone call.
2005-02-02 03:38:05 +00:00
Roland Mainz
69a9ea8979 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h
xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c
//bugs.freedesktop.org/show_bug.cgi?id=825) attachment #956
    (https://bugs.freedesktop.org/attachment.cgi?id=956): Fix build
    problems on Linux/SPARC. Patch by Jeremy Huddleston
    <eradicator@gentoo.org>. Approved in the 2005-01-31 Xorg
    release-wranglers phone call.
2005-02-02 00:59:25 +00:00
Roland Mainz
0917efa006 //bugs.freedesktop.org/show_bug.cgi?id=2252) attachment #1791
(https://bugs.freedesktop.org/attachment.cgi?id=1791): Fix option
    dontVTSwitch under *BSD, when XKB is disabled. Patch by Matthieu Herrb
    <matthieu.herrb@laas.fr>. Approved in the 2005-01-31 Xorg
    release-wranglers phone call.
2005-02-01 03:32:38 +00:00
Roland Mainz
fb9fb8ead9 //freedesktop.org/bugzilla/show_bug.cgi?id=2322) attachment #1709
(https://bugs.freedesktop.org/attachment.cgi?id=1709): Fix corruption
    of PCI config BAR1 of native PCI-Express boards on 64-bit platforms.
    Patch by Michael Yaroslavtsev <mike.work@besm6.org>.
2005-01-25 02:52:42 +00:00
Roland Mainz
e1f4b3fea8 //bugs.freedesktop.org/show_bug.cgi?id=2167) attachment #1641
(https://bugs.freedesktop.org/attachment.cgi?id=1641): Fix broken
    Solaris print queue enumeration.
2005-01-24 04:20:45 +00:00
Roland Mainz
05fbf7adc1 xc/programs/Xserver/Xprint/Util.c
xc/programs/Xserver/Xprint/attributes.c
xc/programs/Xserver/Xprint/attributes.h
//bugs.freedesktop.org/show_bug.cgi?id=2254) attachment #1654
    (https://bugs.freedesktop.org/attachment.cgi?id=1654) and attachment
    #1659 (https://bugs.freedesktop.org/attachment.cgi?id=1659) Fix for
    gcc4.0 build failure (including removing |ExecCommand()| - the function
    has no consumer and can safely be removed). Patch by Egbert Eich
    <eich@freedesktop.org> and Roland Mainz <roland.mainz@nrubsig.org>.
2005-01-24 03:39:28 +00:00
Roland Mainz
3211034b32 //bugs.freedesktop.org/show_bug.cgi?id=2240) attachment #1642
(https://bugs.freedesktop.org/attachment.cgi?id=1642): Fix incorrect
    usage of /usr/bin/tr in startup script (the used "[\n]" is neither
    correct or portable, using "\n" seems to be sufficient (this fixes
    various "random" issues, including including Debian bug #258419 and
    Debian bug #264983). Patch by Drew Parsons <dparsons@debian.org>.
2005-01-24 03:29:12 +00:00
Roland Mainz
02205c87b8 xc/programs/Xserver/hw/xwin/ChangeLog
xc/programs/Xserver/hw/xwin/winkeybd.h
xc/programs/Xserver/hw/xwin/winkeyhook.c
xc/programs/Xserver/hw/xwin/winmultiwindowclass.c
xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c
xc/programs/Xserver/hw/xwin/winmultiwindowwm.c
//bugs.freedesktop.org/show_bug.cgi?id=1831) attachment #1656
    (https://bugs.freedesktop.org/attachment.cgi?id=1656): CGYWIN update,
    including the following fixes:
- Make keyhook feature work in multiwindowmode too
- Hook windows keys
- Fix crash with non-nullterminated strings (reported by Řyvind Harboe)
- From Bug #1945: Stop unnecessary reordering. Patch by Alexander Gottwald
    and Kensuke Matsuzaki.
2005-01-13 03:56:07 +00:00
Roland Mainz
fe7216c087 xc/config/cf/sun.cf
xc/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile
//bugs.freedesktop.org/show_bug.cgi?id=2096) attachment #1565
    (https://bugs.freedesktop.org/attachment.cgi?id=1565): Fix
    Solaris/SPARC build failure caused by missing assembler code for this
    platform. Patch by Alan Coopersmith <alan.coopersmith@sun.com>
2005-01-13 01:18:47 +00:00
Roland Mainz
39f800e592 //bugs.freedesktop.org/show_bug.cgi?id=2114) attachment #1576
(https://bugs.freedesktop.org/attachment.cgi?id=1576): Fix build
    bustage on PPC64 with Linux 2.6.x kernel headers. Patch by Adam Jackson
    <ajax@freedesktop.org>.
2005-01-13 00:30:55 +00:00
Roland Mainz
731fc608cb //bugs.freedesktop.org/show_bug.cgi?id=1490) attachment #1576
(https://bugs.freedesktop.org/attachment.cgi?id=1576): Refix for
    previous patch (updating to EDID 1.3), this syncs the X11R6.8.x stable
    branch with todays Xorg trunk. Patch by Jay Cotton
    <jay.cotton@sun.com>, Alan Coopersmith <alan.coopersmith@sun.com> and
    Egbert Eich <eich@freedesktop.org>.
2005-01-13 00:03:59 +00:00
Roland Mainz
6c3e568f4b Bugzilla #2252 (https://bugs.freedesktop.org/show_bug.cgi?id=2252)
attachment #1653 (https://bugs.freedesktop.org/attachment.cgi?id=1653):
    Make option 'DontVTSwitch' work again with kbd driver under Linux. The
    kbd driver now calls the OS layer to handle special keys. Possibly
    other special keys and other OSes need to be looked at also. Patch by
    Egbert Eich <eich@freedesktop.org>.
2005-01-12 23:14:26 +00:00
Roland Mainz
80aa8646d4 Bugzilla #2211 (https://bugs.freedesktop.org/show_bug.cgi?id=2211)
attachment #1627 (https://bugs.freedesktop.org/attachment.cgi?id=1627):
    xorgconfig default keyboard model outdated (should be pc105, not
    pc101/pc102). Patch by Alan Coopersmith <alan.coopersmith@sun.com>
2005-01-12 20:09:51 +00:00
Roland Mainz
b710b325cf //bugs.freedesktop.org/show_bug.cgi?id=2206) attachment #1622
(https://bugs.freedesktop.org/attachment.cgi?id=1622): Fix missing
    return value in xf86config. Patch by Egbert Eich
    <eich@freedesktop.org>.
2005-01-12 03:29:20 +00:00
Roland Mainz
017232181f //bugs.freedesktop.org/show_bug.cgi?id=2205) attachment #1621
(https://bugs.freedesktop.org/attachment.cgi?id=1621): Fix missing
    return value in Xprint's resource handling. Patch by Egbert Eich
    <eich@freedesktop.org>.
2005-01-12 02:46:37 +00:00
Roland Mainz
7ab636dcf0 //bugs.freedesktop.org/show_bug.cgi?id=2086) attachment #1556
(https://bugs.freedesktop.org/attachment.cgi?id=1556): Fix problems
    with printing the release candidate version number for point releases.
    Patch by Kevin E. Martin <kem@freedesktop.org>
2004-12-17 02:01:21 +00:00
Roland Mainz
73fe0ac04e xc/programs/Xserver/hw/xfree86/ddc/edid.h
xc/programs/Xserver/hw/xfree86/ddc/interpret_edid.c
//bugs.freedesktop.org/show_bug.cgi?id=1490) attachment #1122
    (https://bugs.freedesktop.org/attachment.cgi?id=1122): Updating to EDID
    1.3. Patch by Jay Cotton <jay.cotton@sun.com> and Egbert Eich
    <eich@freedesktop.org>.
2004-12-17 01:28:14 +00:00
Roland Mainz
d4a26aea28 //bugs.freedesktop.org/show_bug.cgi?id=1383) attachment #902
(https://bugs.freedesktop.org/attachment.cgi?id=902): Fix typo in PCI
    code for Intel 460gx in X server, which causes a SEGV. Patch by H.J.Lu
    <hongjiu.lu@intel.com>
2004-12-17 00:53:09 +00:00
Roland Mainz
3e2c284b8f xc/programs/Xserver/fb/fbwindow.c
xc/programs/Xserver/hw/xfree86/xaa/xaaWrapper.c
//bugs.freedesktop.org/show_bug.cgi?id=1220) attachment #980
    (https://bugs.freedesktop.org/attachment.cgi?id=980): Fix (scrolling)
    performance problems caused by PseudoColor emulation layer. Patch by
    Egbert Eich <eich@freedesktop.org>
2004-12-17 00:38:22 +00:00
Alexander Gottwald
4347dddf4d xc/programs/Xserver/Imakefile
xc/programs/Xserver/hw/xwin/ChangeLog
xc/programs/Xserver/hw/xwin/Imakefile
xc/programs/Xserver/hw/xwin/InitOutput.c
xc/programs/Xserver/hw/xwin/XWin.rc
xc/programs/Xserver/hw/xwin/win.h
xc/programs/Xserver/hw/xwin/winclipboardthread.c
xc/programs/Xserver/hw/xwin/winclipboardwndproc.c
xc/programs/Xserver/hw/xwin/winclipboardxevents.c
xc/programs/Xserver/hw/xwin/winconfig.c
xc/programs/Xserver/hw/xwin/wincreatewnd.c
xc/programs/Xserver/hw/xwin/winmessages.h
xc/programs/Xserver/hw/xwin/winmouse.c
xc/programs/Xserver/hw/xwin/winmultiwindowwm.c
xc/programs/Xserver/hw/xwin/winmultiwindowwndproc.c
xc/programs/Xserver/hw/xwin/winprocarg.c
xc/programs/Xserver/hw/xwin/winresource.h
xc/programs/Xserver/hw/xwin/winshadddnl.c
xc/programs/Xserver/hw/xwin/winwin32rootlesswndproc.c
//bugs.freedesktop.org/show_bug.cgi?id=1831) attachment #1547
    (https://bugs.freedesktop.org/attachment.cgi?id=1547) attachment #1548
    (https://bugs.freedesktop.org/attachment.cgi?id=1548): Cygwin/X patches
    since 6.8.1, including:
- Support for placing the mainwindow by coordinates and monitor
- Setting default cursor in multiwindow mode
- Added keyboardlayout "French (Switzerland)"
- Fixed crashes after switching videomodes
- Added support for reading the fontpath from /etc/X11/font-dirs
- Make -multiplemonitors for multiwindow modes
- Added support for mice with more than 3 buttons
- Fixed another clipboard bug with Unicode applications
2004-12-15 19:22:53 +00:00
Egbert Eich
0e3985b588 - committing file missing due to CVS hickups. 2004-12-15 16:03:15 +00:00
Egbert Eich
5b650fe61d Adding support for OS dependent probing of IA64 chipsets. Not all IA64
chipsets can be probed without OS support as probing them is only
    possible using ACPI. One example of this are the HP ZX1/2 chipsets:
    previously the code assumed that these chips were present when no other
    of the known chipsets could be probed. This assumption brought SGI
    Altrix machines with 64 CPUs to a grinding halt.
2004-12-15 15:24:45 +00:00
Roland Mainz
9d0102bcf7 xc/doc/man/general/Imakefile
xc/doc/man/general/Xprint.html
xc/doc/man/general/Xprint.man
xc/doc/man/general/Xprint.sgml
xc/programs/Xserver/Xprint/Imakefile
xc/programs/Xserver/Xprint/Xprint.html
xc/programs/Xserver/Xprint/Xprint.man
xc/programs/Xserver/Xprint/Xprint.sgml
xc/programs/Xserver/Xprint/Xprt.html
xc/programs/Xserver/Xprint/Xprt.man
//bugs.freedesktop.org/show_bug.cgi?id=811) attachment #1374
    (https://bugs.freedesktop.org/attachment.cgi?id=1374), attachment #1379
    (https://bugs.freedesktop.org/attachment.cgi?id=1379), attachment #1431
    (https://bugs.freedesktop.org/attachment.cgi?id=1431): Add the missing
    manual page for the Xprt server (and move the Xprint(7) to it's correct
    location). Authors: Alan Coopersmith, Giuseppe Ghibň, Thomas Gilg, Jay
    Hobson, Julien Lafon, Masaki Katakai, Roland Mainz, Simon Montagu, Drew
    Parsons.
2004-12-15 07:38:29 +00:00
Roland Mainz
ff4d7161af //bugs.freedesktop.org/show_bug.cgi?id=1965) attachment #1425
(https://bugs.freedesktop.org/attachment.cgi?id=1425): Avoid recursive
    calls of xf86scanpci(). This function normally detects that it has been
    called before by checking if the PCI structure is filled out. So far if
    this was not the case (because PCI probing has failed for some reason)
    the function is traversed again. With the chipset specific PCI bus
    probing this can lead to an endless recursive loop as the post-probing
    code calls xf86scanpci() from within this function. Patch by Egbert
    Eich <eich@freedesktop.org>
2004-12-15 05:52:16 +00:00
Roland Mainz
96d65874af //bugs.freedesktop.org/show_bug.cgi?id=1963) attachment #1424
(https://bugs.freedesktop.org/attachment.cgi?id=1424): The OS specific
    PCI code for Linux worked only if bus 0 was populated as it checked for
    the presence of /proc/bus/pci/00. Fixed to check for
    /proc/bus/pci/<bus_to_look_for> instead. Patch by Egbert Eich
    <eich@freedesktop.org>
2004-12-15 05:48:20 +00:00
Roland Mainz
b6b4d6b342 xc/programs/Xserver/hw/xfree86/common/xf86Events.c
//bugs.freedesktop.org/show_bug.cgi?id=1933) attachment #1392
    (https://bugs.freedesktop.org/attachment.cgi?id=1392): Improving DPMS
    handling on VT swich and server termination/abort: previous version
    called the driver directly and too late. Patch by Egbert Eich
    <eich@freedesktop.org>
2004-12-15 05:36:14 +00:00
Roland Mainz
b380853db9 //bugs.freedesktop.org/show_bug.cgi?id=1931) attachment #1390
(https://bugs.freedesktop.org/attachment.cgi?id=1390): Removing unused
    DDC sections that caused misinterpretation of DDC data due to a missing
    break statement in a switch. Patch by Egbert Eich
    <eich@freedesktop.org>
2004-12-15 05:22:16 +00:00
Roland Mainz
8725759a47 //bugs.freedesktop.org/show_bug.cgi?id=1927) attachment #1386
(https://bugs.freedesktop.org/attachment.cgi?id=1386): Fixed typo in
    |ix86PciSelectCfgmech()|: #if <-> #ifdef. Patch by Egbert Eich
    <eich@freedesktop.org>
2004-12-15 05:14:44 +00:00
Roland Mainz
d8d0729c2f //bugs.freedesktop.org/show_bug.cgi?id=1552) attachment #1026
(https://bugs.freedesktop.org/attachment.cgi?id=1026):
Currently, when a screensaver kicks in, it calls xf86GetModeLine() which
    causes the Vidmode extension to write out a debugging log message of
    what the current modeline is. These messages are generally only useful
    to an X11 developer who is debugging the extension itself, or to an
    application developer who is developing an application which uses the
    vidmode extension to get/set the video mode, however they're not very
    useful for end users.
The current default Xvidmode verbosity causes the X server to write overly
    detailed video modeline information to the X server log file whenever
    any application uses the extension to get, set, or delete modelines.
    This causes a problem for laptop users on battery power with their hard
    disks set to power saving mode, because the hard disk will power down,
    then later the screensaver kicks in, which calls xf86GetModeLine(),
    which causes the log message to get written out, which causes the hard
    disk to be powered back up.
Having these messages off by default solves this problem for laptop users,
    and seems to make the most sense considering how useful they are in
    general. By changing the default log level for these messages,
    developers who need to see these for debugging purposes can increase
    their X server verbosity level and still see them, so no functionality
    is lost.
This patch lowers the default verbosity of the X server's Xvidmode
    extension log file messages, in order to stop Xvidmode from writing out
    non-critical log messages to the X server log whenever an application
    uses this extension.
Patch by Mike A. Harris <mharris@redhat.com>
2004-12-15 05:01:25 +00:00
Roland Mainz
6ecdc65269 xc/config/cf/X11.tmpl
xc/config/cf/cygwin.cf
xc/config/cf/darwin.cf
xc/programs/Xserver/dix/Imakefile
//bugs.freedesktop.org/show_bug.cgi?id=1816) attachment #1300
    (https://bugs.freedesktop.org/attachment.cgi?id=1300): Add
    BuildRootless Imake variable and ROOTLESS define. Patch by Torrey T.
    Lyons <torrey@freedesktop.org>
2004-12-15 04:53:05 +00:00
Roland Mainz
0b94f15d79 //bugs.freedesktop.org/show_bug.cgi?id=1826) attachment #1283
(https://bugs.freedesktop.org/attachment.cgi?id=1283): Do not add '-4'
    to generated default file name (e.g. "xorg.conf" instead of
    "xorg.conf-4"). Patch by Matthieu Herrb <matthieu.herrb@laas.fr>
2004-12-15 03:10:20 +00:00
Roland Mainz
87a3b1931c xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c
//bugs.freedesktop.org/show_bug.cgi?id=1824) attachment #1288
    (https://bugs.freedesktop.org/attachment.cgi?id=1288): Fix kbd driver
    for wskbd protocol and pure wscons console driver Patch by Matthieu
    Herrb <matthieu.herrb@laas.fr>
2004-12-13 14:03:44 +00:00
Roland Mainz
02f760a84d //freedesktop.org/bugzilla/show_bug.cgi?id=661) attachment #1002
(https://bugs.freedesktop.org/attachment.cgi?id=1002): Xprt producing
    spurious characters in PS output when using the bitmap cache
    (Originally reported against Solaris Xprt as Sun bug id #4369307, and
    fixed in Solaris by Jay Hobson <jay.hobson@sun.com>). Patch by Jay
    Hobson <jay.hobson@sun.com>.
2004-12-13 06:35:36 +00:00
Roland Mainz
e81dcbbc7c //freedesktop.org/bugzilla/show_bug.cgi?id=1800) attachment #1474
(https://bugs.freedesktop.org/attachment.cgi?id=1474): Fix Postscript
    DDX's 1bit StaticGray visual to report only 1bit of significant bits in
    color specification (instead of 8bits). Patch by Julien Lafon
    <julien.lafon@gmail.com>
2004-12-13 06:29:43 +00:00
Roland Mainz
24c1ba42e2 xc/config/cf/xprint_site.def
xc/programs/Xserver/Xprint/ps/Ps.h
xc/programs/Xserver/Xprint/ps/PsPixmap.c
xc/programs/Xserver/Xprint/ps/PsPolygon.c
//freedesktop.org/bugzilla/show_bug.cgi?id=1664) attachment #1161
    (https://bugs.freedesktop.org/attachment.cgi?id=1161): RFE: Add support
    for the DOUBLE-BUFFER extension to the Xprint server and DDX.
    Additionally a "pixmap-scrubber" optimisation is added to the
    PostScript DDX to remove all content from a vector pixmap when a
    |PolyFillRect()| call covers the whole pixmap surface with a solid fill
    (this avoids that a backbuffer vector pixmap gets constantly filled
    even when the content is not visible anymore after |XdbeSwapBuffers()|
    has cleared the hidden buffer with the background color).
2004-12-13 05:48:41 +00:00
Roland Mainz
e2463040d8 //freedesktop.org/bugzilla/show_bug.cgi?id=1647) attachment #1117
(https://bugs.freedesktop.org/attachment.cgi?id=1117): Fix the problem
    that |XpSubmitJob()| returns a random value (patch by Stefan
    Dirsch/SuSE).
2004-12-13 05:40:17 +00:00
Roland Mainz
eab8baa925 //freedesktop.org/bugzilla/show_bug.cgi?id=1646) attachment #1116
(https://bugs.freedesktop.org/attachment.cgi?id=1116): Fix the problem
    that |PsCreateColormap()| returns a random value (patch by Stefan
    Dirsch/SuSE).
2004-12-13 05:34:20 +00:00
Roland Mainz
adfa61c481 //freedesktop.org/bugzilla/show_bug.cgi?id=1637) attachment #1114
(https://bugs.freedesktop.org/attachment.cgi?id=1114): Fix problems in
    oid code which may cause the usage of an invalid string pointer
    (original patch by Egbert Eich).
2004-12-13 05:30:48 +00:00
Roland Mainz
f3cd3eb502 xc/programs/Xserver/Xprint/pcl/PclInit.c
//freedesktop.org/bugzilla/show_bug.cgi?id=1629) attachment #1107
    (https://bugs.freedesktop.org/attachment.cgi?id=1107): Fix crash on
    AMD64, regression caused by bug
1496 ("Xorg Xprt does not support "*xp-listfonts-mode:
    xp-list-internal-printer-fonts" to toggle the usage of printer-builtin
    fonts").
2004-12-13 05:16:11 +00:00
Roland Mainz
534a492816 xc/programs/Xserver/Xprint/Init.c
xc/programs/Xserver/Xprint/pcl/PclInit.c
//freedesktop.org/bugzilla/show_bug.cgi?id=1496) attachment #998
    (https://bugs.freedesktop.org/attachment.cgi?id=998): Fixed Xprt font
    handling which did not support "*xp-listfonts-modes:
    xp-list-internal-printer-fonts" or "*xp-listfonts-modes:
    xp-list-glyph-fonts" to toggle the usage of printer-builtin and glyph
    fonts in XListFonts*(), XLoad*Font(), etc. Additionally the Xprint DDX
    now explicitly list "xp-listfonts-modes" in
    "document-attributes-supported" (for document-level) or
    "xp-page-attributes-supported" (for page-level) when the DDX implements
    this feature (as described in the CDE DtPrint and Xprint
    specifications).
2004-12-13 05:12:12 +00:00
Roland Mainz
c2f561e3a2 xc/programs/Xserver/Xprint/ps/PsGC.c
//freedesktop.org/bugzilla/show_bug.cgi?id=1416) attachment #994
    (https://bugs.freedesktop.org/attachment.cgi?id=994): Fix Xprt
    PostScript DDX crashes when copying offscreen pixmap content to the
    same pixmap (the crash can be reproduced with % x11perf -copypixpix500
    ... # or the reduced testcase in bug #1416 (attachment #993)).
2004-12-13 05:06:13 +00:00
Roland Mainz
f6f85e9b7c xc/programs/Xserver/Xprint/Init.c
xc/programs/Xserver/Xprint/ps/Ps.h
xc/programs/Xserver/Xprint/ps/PsArea.c
xc/programs/Xserver/Xprint/ps/PsColor.c
xc/programs/Xserver/Xprint/ps/PsInit.c
xc/programs/Xserver/Xprint/ps/psout.c
//freedesktop.org/bugzilla/show_bug.cgi?id=1299) attachment #1001
    (https://bugs.freedesktop.org/attachment.cgi?id=1001): Add more visuals
    to the Postscript DDX (8bit GrayScale/StaticGray,
1bit StaticGray and the basic infratructure for "deep" visuals with more
    than 8bits per RGB gun). Patch by Roland Mainz
    <roland.mainz@nrubsig.org>.
2004-12-13 05:01:15 +00:00
Roland Mainz
b58c32d542 //bugs.freedesktop.org/show_bug.cgi?id=1695) attachment #1230
(https://bugs.freedesktop.org/attachment.cgi?id=1230): Fix crash in
    Xscreensaver code which allowed any authentificated X client to crash
    the Xserver using |XScreenSaverUnsetAttributes()|. Patch by
    ajax@nwnk.net
2004-12-13 03:34:33 +00:00
Roland Mainz
828cdc528d //bugs.freedesktop.org/show_bug.cgi?id=1688) attachment #1530
(https://bugs.freedesktop.org/attachment.cgi?id=1530): Fix the current
    implementation to make it possible to slow down the mouse pointer or
    use arbitrary fractions (without running into rounding error issues).
    The change is using the same method of preserving rounding errors that
    the exponential method is already using. Patch by Jan Brunner
    <Jan_B@gmx.ch>.
2004-12-13 02:15:29 +00:00
Roland Mainz
fe18885917 //bugs.freedesktop.org/show_bug.cgi?id=1934) attachment #1393
(https://bugs.freedesktop.org/attachment.cgi?id=1393): Fixing
    |SetDPMSTimers()| so that DPMS*Time == 0 disables the appropriate
    timer. This takes advantage of the fact that |TimerSet()| with a
    timeout argument 0 behaves like |TimerCanel()|. Patch by Egbert Eich
    <eich@freedesktop.org>.
2004-12-13 01:45:15 +00:00
Roland Mainz
ef7712f058 //bugs.freedesktop.org/show_bug.cgi?id=1939) attachment #1398
(https://bugs.freedesktop.org/attachment.cgi?id=1398): Fixe size of a
    variable that gets assigned the value of SmartScheduleTime (|long|) to
    |long|. This should help to prevent smart scheduler lockup on 64 bit
    systems due to datatype overruns. Patch by Andreas Schwab and Egbert
    Eich <eich@freedesktop.org>.
2004-12-13 01:23:05 +00:00
Roland Mainz
8ab0584b34 //bugs.freedesktop.org/show_bug.cgi?id=1989) attachment #1399
(https://bugs.freedesktop.org/attachment.cgi?id=1399): Fixed sig11 in
    |ScreenSaverUnsetAttributes()| which occured when calling a
    |CloseDisplay()| after |XScreenSaverSetAttributes()| followed by
    |XScreenSaverUnsetAttributes()|. Caused by missing |FreeResource()| in
    |XScreenSaverUnsetAttributes()|. Patch by Egbert Eich
    <eich@freedesktop.org>.
2004-12-13 01:16:24 +00:00
Roland Mainz
bed7694438 //bugs.freedesktop.org/show_bug.cgi?id=1204) attachment #1360
(https://bugs.freedesktop.org/attachment.cgi?id=1360): Fix X11 test
    suite (caused by DAMAGE layer) failure with Xvfb when rendering text
    using |XDrawText*()| (XDrawText() tests 1, 3, 4, 27, 28,
29, 30, 34, 37, 39, 41, 43 and XDrawText16() tests 1, 3, 9, 10, 11, 12,
13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34,
37, 39, 41, 43). Patch by Hong Bo Peng <penghb@cn.ibm.com> and Stefan
    Dirsch <sndirsch@suse.de>.
2004-12-13 00:56:07 +00:00
Roland Mainz
afdc7044f7 //bugs.freedesktop.org/show_bug.cgi?id=557) attachment #1255
(https://bugs.freedesktop.org/attachment.cgi?id=1255): Do not use
    "bool" as a variable name in xf86cfg, to avoid compiler bugs. Patch by
    Donnie Berkholz <spyderous@gentoo.org>.
2004-12-08 07:02:46 +00:00
Roland Mainz
eb73d7f749 //bugs.freedesktop.org/show_bug.cgi?id=1402) attachment #948
(https://bugs.freedesktop.org/attachment.cgi?id=948): Fix BigFont
    extension if SHM is compiled in but not working. Does not access SHM
    and privates if the SHM syscall failed during extension initialization.
    Patch by Alexander Gottwald <ago@freedesktop.org>.
2004-12-08 06:41:00 +00:00
Roland Mainz
8982b3c084 //bugs.freedesktop.org/show_bug.cgi?id=1453) attachment #964
(https://bugs.freedesktop.org/attachment.cgi?id=964): Fix spaces in
    usage output for BIGREQUESTS extension (option "-maxbigreqsize").
2004-12-08 06:34:31 +00:00
Roland Mainz
1d906ac9cd //bugs.freedesktop.org/show_bug.cgi?id=1489) attachment #979
(https://bugs.freedesktop.org/attachment.cgi?id=979): Use |long|
    instead of |int| for BIGREQUESTS commandline option.
2004-12-08 06:29:59 +00:00
Roland Mainz
6482a7071c Bugzilla #1812 (https://bugs.freedesktop.org/show_bug.cgi?id=1812)
attachment #1263 (https://bugs.freedesktop.org/attachment.cgi?id=1263),
    Sun bug id #6175128: Add Solaris to the platforms on which mprotect()
    is run to set execute permissions when necessary. Patch by Alan
    Coopersmith <alan.coopersmith@sun.com>.
2004-12-08 06:25:07 +00:00
Roland Mainz
3f3633749d //bugs.freedesktop.org/show_bug.cgi?id=1835) attachment #1293
(https://bugs.freedesktop.org/attachment.cgi?id=1293): Fixing the
    problem that xf86pciInfo.c was using it's own broken MIN() macro. Patch
    by Kristian Hřgsberg <krh@bitplanet.net>.
2004-12-08 06:07:57 +00:00
Roland Mainz
718c18d81a //bugs.freedesktop.org/show_bug.cgi?id=1404): Fixing random crashes (like
in DAMAGE code etc.) in Xnest due uninitalised GetWindowPixmap.
    Original patch by Alexander Gottwald <ago@freedesktop.org>
2004-12-08 06:02:34 +00:00
Roland Mainz
22bade2e73 //bugs.freedesktop.org/show_bug.cgi?id=1361) attachment #1287
(https://bugs.freedesktop.org/attachment.cgi?id=1287): Avoid DRI
    initalisation when the Xfree86-DRI extension was turned off. Patch by
    Kristian Hřgsberg <krh@bitplanet.net>.
2004-12-08 05:44:42 +00:00
Roland Mainz
971a0f60e7 //bugs.freedesktop.org/show_bug.cgi?id=1361) attachment #938
(https://bugs.freedesktop.org/attachment.cgi?id=938): Allow more
    extensions to be enabled/disabled.
2004-12-08 05:38:02 +00:00
Roland Mainz
c47036e9c0 xc/programs/Xserver/hw/xfree86/loader/dixsym.c
//bugs.freedesktop.org/show_bug.cgi?id=1361) attachment #899
    (https://bugs.freedesktop.org/attachment.cgi?id=899): Fix module loader
    bustage due duplicate symbols caused by the first patch in Bugzilla
    #1361
2004-12-08 05:32:54 +00:00
Roland Mainz
b48a2a340f xc/programs/Xserver/hw/xfree86/loader/dixsym.c
xc/programs/Xserver/include/globals.h
xc/programs/Xserver/mi/miinitext.c
//bugs.freedesktop.org/show_bug.cgi?id=1361) attachment #894
    (https://bugs.freedesktop.org/attachment.cgi?id=894): Allow turning
    on/off most of the Xserver extensions (=all except server-specific
    extensions (e.g. DMX, XpExtension, etc.) via +extension/-extension
2004-12-08 05:28:12 +00:00
Kevin E Martin
0e3171a83a Update the XORG_DATE for the release.
Update cygwin release version.
Update documentation for release.
2004-09-17 15:38:19 +00:00
459 changed files with 3370 additions and 89846 deletions

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
/*
** License Applicability. Except to the extent portions of this file are
@ -45,8 +45,13 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
#ifndef MISSING_GL_EXTS
__glXDisp_PointParameterfARB, /* 2065 */
__glXDisp_PointParameterfvARB, /* 2066 */
#else
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
#endif
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
@ -2104,6 +2109,7 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
__glXDisp_CopyTexSubImage1D, /* 4121 */
__glXDisp_CopyTexSubImage2D, /* 4122 */
__glXDisp_CopyTexSubImage3D, /* 4123 */
#ifndef MISSING_GL_EXTS
__glXDisp_FogCoordfv, /* 4124 */
__glXDisp_FogCoorddv, /* 4125 */
__glXDisp_SecondaryColor3bv, /* 4126 */
@ -2115,6 +2121,19 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
__glXDisp_SecondaryColor3usv, /* 4132 */
__glXDisp_SecondaryColor3uiv, /* 4133 */
__glXDisp_BlendFuncSeparate, /* 4134 */
#else
__glXNoSuchRenderOpcode, /* 4124 */
__glXNoSuchRenderOpcode, /* 4125 */
__glXNoSuchRenderOpcode, /* 4126 */
__glXNoSuchRenderOpcode, /* 4127 */
__glXNoSuchRenderOpcode, /* 4128 */
__glXNoSuchRenderOpcode, /* 4129 */
__glXNoSuchRenderOpcode, /* 4130 */
__glXNoSuchRenderOpcode, /* 4131 */
__glXNoSuchRenderOpcode, /* 4132 */
__glXNoSuchRenderOpcode, /* 4133 */
__glXNoSuchRenderOpcode, /* 4134 */
#endif
__glXNoSuchRenderOpcode, /* 4135 */
__glXNoSuchRenderOpcode, /* 4136 */
__glXNoSuchRenderOpcode, /* 4137 */
@ -2200,9 +2219,20 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode, /* 4219 */
#ifndef MISSING_GL_EXTS
__glXDisp_ActiveStencilFaceEXT, /* 4220 */
# ifndef __DARWIN__
__glXDisp_PointParameteri, /* 4221 */
__glXDisp_PointParameteriv, /* 4222 */
# else
__glXDisp_PointParameteriNV, /* 4221 */
__glXDisp_PointParameterivNV, /* 4222 */
# endif
#else
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
#endif
};
__GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = {
__glXDisp_AreTexturesResidentEXT, /* 11 */
@ -2225,8 +2255,13 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
#ifndef MISSING_GL_EXTS
__glXDispSwap_PointParameterfARB, /* 2065 */
__glXDispSwap_PointParameterfvARB, /* 2066 */
#else
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
#endif
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
@ -4284,6 +4319,7 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
__glXDispSwap_CopyTexSubImage1D, /* 4121 */
__glXDispSwap_CopyTexSubImage2D, /* 4122 */
__glXDispSwap_CopyTexSubImage3D, /* 4123 */
#ifndef MISSING_GL_EXTS
__glXDispSwap_FogCoordfv, /* 4124 */
__glXDispSwap_FogCoorddv, /* 4125 */
__glXDispSwap_SecondaryColor3bv, /* 4126 */
@ -4295,6 +4331,19 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
__glXDispSwap_SecondaryColor3usv, /* 4132 */
__glXDispSwap_SecondaryColor3uiv, /* 4133 */
__glXDisp_BlendFuncSeparate, /* 4134 */
#else
__glXNoSuchRenderOpcode, /* 4124 */
__glXNoSuchRenderOpcode, /* 4125 */
__glXNoSuchRenderOpcode, /* 4126 */
__glXNoSuchRenderOpcode, /* 4127 */
__glXNoSuchRenderOpcode, /* 4128 */
__glXNoSuchRenderOpcode, /* 4129 */
__glXNoSuchRenderOpcode, /* 4130 */
__glXNoSuchRenderOpcode, /* 4131 */
__glXNoSuchRenderOpcode, /* 4132 */
__glXNoSuchRenderOpcode, /* 4133 */
__glXNoSuchRenderOpcode, /* 4134 */
#endif
__glXNoSuchRenderOpcode, /* 4135 */
__glXNoSuchRenderOpcode, /* 4136 */
__glXNoSuchRenderOpcode, /* 4137 */
@ -4380,9 +4429,20 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode, /* 4219 */
#ifndef MISSING_GL_EXTS
__glXDispSwap_ActiveStencilFaceEXT, /* 4220 */
# ifndef __DARWIN__
__glXDispSwap_PointParameteri, /* 4221 */
__glXDispSwap_PointParameteriv, /* 4222 */
# else
__glXDispSwap_PointParameteriNV, /* 4221 */
__glXDispSwap_PointParameterivNV, /* 4222 */
# endif
#else
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
__glXNoSuchRenderOpcode,
#endif
};
__GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = {
__glXDispSwap_AreTexturesResidentEXT, /* 11 */

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.3 2001/03/21 16:29:35 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.5 2004/01/28 18:11:50 alanh Exp $ */
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
#ifndef _GLX_g_disptab_EXT_h_
#define _GLX_g_disptab_EXT_h_
@ -95,10 +95,17 @@ extern void __glXDispSwap_SecondaryColor3dv(GLbyte *);
extern void __glXDisp_BlendFuncSeparate(GLbyte *);
extern void __glXDispSwap_BlendFuncSeparate(GLbyte *);
#ifdef __DARWIN__
extern void __glXDisp_PointParameteriNV(GLbyte *);
extern void __glXDisp_PointParameterivNV(GLbyte *);
extern void __glXDispSwap_PointParameteriNV(GLbyte *);
extern void __glXDispSwap_PointParameterivNV(GLbyte *);
#else
extern void __glXDisp_PointParameteri(GLbyte *);
extern void __glXDisp_PointParameteriv(GLbyte *);
extern void __glXDispSwap_PointParameteri(GLbyte *);
extern void __glXDispSwap_PointParameteriv(GLbyte *);
#endif
extern void __glXDisp_ActiveStencilFaceEXT(GLbyte*);

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.5 2002/01/14 22:47:08 tsi Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.5tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
@ -1264,7 +1264,6 @@ int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
{
GLsizei n;
__GLXcontext *cx;
int error;
@ -1273,7 +1272,6 @@ int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
return error;
}
pc += __GLX_SINGLE_HDR_SIZE;
n = *(GLsizei *)(pc + 0);
glDeleteTextures(
*(GLsizei *)(pc + 0),
@ -1717,7 +1715,6 @@ int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{
GLsizei n;
__GLXcontext *cx;
int error;
@ -1726,7 +1723,6 @@ int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
return error;
}
pc += __GLX_VENDPRIV_HDR_SIZE;
n = *(GLsizei *)(pc + 0);
glDeleteTexturesEXT(
*(GLsizei *)(pc + 0),

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.5 2002/01/14 22:47:08 tsi Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.4tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */
/* $XFree86$ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.7 2001/10/31 22:50:26 tsi Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.6 2001/03/25 05:32:01 tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86$ */
#ifndef _glxbuf_h_
#define _glxbuf_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86$ */
#ifndef _GLX_error_h_
#define _GLX_error_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86$ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86$ */
#ifndef _glxfb_h_
#define _glxfb_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.7 2002/08/28 06:41:26 torrey Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86$ */
#ifndef _glxmem_h_
#define _glxmem_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.4 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */
/* $XFree86$ */
#ifndef _glxpix_h_
#define _glxpix_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.4 2003/09/28 20:15:43 alanh Exp $ */
#ifndef _impsize_h_
#define _impsize_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86$ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86$ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.5 2004/01/28 18:11:53 alanh Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86$ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86$ */
#ifndef _singlesize_h_
#define _singlesize_h_

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.5 2002/10/30 12:52:03 alanh Exp $ */
/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.4 2002/01/14 22:47:08 tsi Exp $ */
#ifndef __GLX_unpack_h__
#define __GLX_unpack_h__

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
/* $XFree86$ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,7 +1,7 @@
#ifndef _glx_ansic_h_
#define _glx_ansic_h_
/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.7 2002/04/04 14:05:36 eich Exp $ */
/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.5 2001/03/21 20:49:08 dawes Exp $ */
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free

View File

@ -1,4 +1,4 @@
/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.4 2000/02/23 04:46:54 martin Exp $ */
/* $XFree86: xc/programs/Xserver/GL/include/GL/xf86glx.h,v 1.3 1999/06/14 07:31:41 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.

View File

@ -1,4 +1,4 @@
/* $XdotOrg$ */
/* $XdotOrg: xc/programs/Xserver/Xext/saver.c,v 1.2.4.1 2004/12/13 01:16:24 gisburn Exp $ */
/*
* $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $
*
@ -210,7 +210,7 @@ static int ScreenPrivateIndex;
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) ((t *) xalloc (sizeof (t)))
@ -1185,6 +1185,7 @@ ScreenSaverUnsetAttributes (ClientPtr client)
pPriv = GetScreenPrivate (pDraw->pScreen);
if (pPriv && pPriv->attr && pPriv->attr->client == client)
{
FreeResource (pPriv->attr->resource, AttrType);
FreeScreenAttr (pPriv->attr);
pPriv->attr = NULL;
CheckScreenPrivate (pDraw->pScreen);

View File

@ -99,12 +99,12 @@ static int FontShmdescIndex;
static unsigned int pagesize;
static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
#include <sys/signal.h>
static Bool badSysCall = FALSE;
static void
SigSysHandler(
int signo)
@ -471,13 +471,16 @@ ProcXF86BigfontQueryFont(
if (nCharInfos > 0) {
#ifdef HAS_SHM
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
if (!badSysCall)
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
else
pDesc = NULL;
if (pDesc) {
pCI = (xCharInfo *) pDesc->attach_addr;
if (stuff_flags & XF86Bigfont_FLAGS_Shm)
shmid = pDesc->shmid;
} else {
if (stuff_flags & XF86Bigfont_FLAGS_Shm)
if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
+ sizeof(CARD32));
if (pDesc) {
@ -522,7 +525,7 @@ ProcXF86BigfontQueryFont(
}
}
#ifdef HAS_SHM
if (pDesc) {
if (pDesc && !badSysCall) {
*(CARD32 *)(pCI + nCharInfos) = signature;
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
shmdealloc(pDesc);

View File

@ -163,6 +163,7 @@ static
PixmapFormatRec PSPixmapFormats[] = {
{ 1, 1, BITMAP_SCANLINE_PAD },
{ 8, 8, BITMAP_SCANLINE_PAD },
{ 12, 16, BITMAP_SCANLINE_PAD },
{ 24, 32, BITMAP_SCANLINE_PAD }
};
@ -1217,9 +1218,9 @@ AugmentFontPath(void)
* calling XpContextOfClient (in Xserver/Xext/xprint.c) to determine
* the context associated with the client, and then queries the context's
* attributes to determine whether the bitmap fonts should be visible.
* It looks at the value of the xp-listfonts-mode document/page attribute to
* It looks at the value of the xp-listfonts-modes document/page attribute to
* see if xp-list-glyph-fonts has been left out of the mode list. Only
* if the xp-listfonts-mode attribute exists, and it does not contain
* if the xp-listfonts-modes attribute exists, and it does not contain
* xp-list-glyph-fonts does this function return FALSE. In any other
* case the funtion returns TRUE, indicating that the bitmap fonts
* should be visible to the client.
@ -1238,10 +1239,10 @@ XpClientIsBitmapClient(
* Check the page attributes, and if it's not defined there, then
* check the document attributes.
*/
mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-mode");
mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-modes");
if(!mode || !strlen(mode))
{
mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-mode");
mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-modes");
if(!mode || !strlen(mode))
return TRUE;
}
@ -1251,14 +1252,21 @@ XpClientIsBitmapClient(
return TRUE;
}
/*
* XpClientIsPrintClient is called by the font code to find out if
* a particular client has set a context which references a printer
* which utilizes a particular font path. This function works by
* calling XpContextOfClient (in Xserver/Xext/xprint.c) to determine
* the context associated with the client, and then looks up the
* font directory for the context. The font directory is then compared
* with the directory specified in the FontPathElement which is passed in.
* which utilizes a particular font path.
* This function works by calling XpContextOfClient
* (in Xserver/Xext/xprint.c) to determine the context associated with
* the client and then looks at the value of the xp-listfonts-modes
* document/page attribute to see if xp-list-internal-printer-fonts has
* been left out of the mode list.
* If the xp-listfonts-modes attribute exists, and it does not contain
* xp-list-internal-printer-fonts this function returns FALSE.
* Otherwise it looks up the font directory for the context. The font
* directory is then compared with the directory specified in the
* FontPathElement which is passed in.
*/
Bool
XpClientIsPrintClient(
@ -1266,11 +1274,28 @@ XpClientIsPrintClient(
FontPathElementPtr fpe)
{
XpContextPtr pContext;
char *mode;
char *modelID, *fontDir;
if(!(pContext = XpContextOfClient(client)))
return FALSE;
/*
* Check the page attributes, and if it's not defined there, then
* check the document attributes.
*/
mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-modes");
if(!mode || !strlen(mode))
{
mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-modes");
}
if(mode && strlen(mode))
{
if(!strstr(mode, "xp-list-internal-printer-fonts"))
return FALSE;
}
if (!fpe)
return TRUE;

View File

@ -2104,16 +2104,16 @@ const char* XpOidNotifyString(XpOidNotify notify)
{
switch(notify)
{
case XPOID_NOTIFY_UNSUPPORTED:
return (const char*)NULL;
break;
case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR;
break;
case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR;
break;
case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR;
case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR;
case XPOID_NOTIFY_UNSUPPORTED:
return (const char *)NULL;
}
ErrorF("XpOidNotifyString: Unsupported notify=%ld\n", (long)notify);
return (const char *)NULL;
}
/*

View File

@ -141,30 +141,6 @@ ReplaceFileString(
return string;
}
/*
* ExecCommand takes two character pointers - the command to execute,
* and the "argv" style NULL-terminated vector of arguments for the command.
* We wait for the command to terminate before continuing to ensure that
* we don't delete the job file before the spooler has made a copy.
*/
void
ExecCommand(
char *pCommand,
char **argVector)
{
pid_t childPid;
int status;
if((childPid = fork()) == 0)
{
execv(pCommand, argVector);
}
else
{
(void) waitpid(childPid, &status, 0);
}
return;
}
/*
* TransferBytes reads numBytes of data from pSrcFile and writes them

View File

@ -816,7 +816,7 @@ AppendEntry(
char *s, c;
if (*type != XrmQString)
return;
return False;
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
if (*bindings == XrmBindLoosely) {
@ -1083,34 +1083,6 @@ XpSpoolerGetServerAttributes(void)
return db;
}
/*
* ExecuteCommand takes two pointers - the command to execute,
* and the "argv" style NULL-terminated vector of arguments for the command.
* We wait for the command to terminate before continuing to ensure that
* we don't delete the job file before the spooler has made a copy.
*/
static void
ExecCommand(pCommand, argVector)
char *pCommand;
char **argVector;
{
pid_t childPid;
int status;
if((childPid = fork()) == 0)
{
/* return BadAlloc? */
if (execv(pCommand, argVector) == -1) {
FatalError("unable to exec '%s'", pCommand);
}
}
else
{
(void) waitpid(childPid, &status, 0);
}
return;
}
/*
* SendFileToCommand takes three character pointers - the file name,
* the command to execute,
@ -1515,6 +1487,8 @@ XpSubmitJob(fileName, pContext)
FreeVector(vector);
xfree(cmdNam);
return Success;
}
/*

View File

@ -109,8 +109,6 @@ char *ReplaceAnyString(char *string,
char *ReplaceFileString(char *string,
char *inFileName,
char *outFileName);
void ExecCommand(char *pCommand,
char **argVector);
int TransferBytes(FILE *pSrcFile,
FILE *pDstFile,
int numBytes);

115
Xprint/doc/Xprt.html Normal file
View File

@ -0,0 +1,115 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Xprt</title><meta name="generator" content="DocBook XSL Stylesheets V1.62.4"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="Xprt"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>Xprt &#8212; Print server for X Version 11</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">Xprt</tt> [<tt class="option">-ac</tt>] [<tt class="option">-audit <i class="replaceable"><tt>level</tt></i></tt>] [<tt class="option">-pn</tt>] [<tt class="option">-fp <i class="replaceable"><tt>fontpath</tt></i></tt>] [<tt class="option">-XpFile <i class="replaceable"><tt>file</tt></i></tt>] [<tt class="option">-XpSpoolerType <i class="replaceable"><tt>spoolername</tt></i></tt>] [<tt class="option">:<i class="replaceable"><tt>display</tt></i></tt>]</p></div></div><div class="refsect1" lang="en"><a name="id2804962"></a><h2>DESCRIPTION</h2><p><span><b class="command">Xprt</b></span> is the Xprint print server
for version 11 of the X Window system for non display devices
such as printers and fax machines.</p><p>Xprint is an advanced printing system which enables X11
applications to use devices like printers, FAX or create
documents in formats like PostScript, PCL or PDF. It may be used by
clients such as <span class="application">mozilla</span>.
</p><p>Xprint is a very flexible, extensible, scaleable, client/server
print system based on ISO 10175 (and some other specs) and the X11
rendering protocol.
Using Xprint an application can search, query and use devices like
printers, FAX machines or create documents in formats like PDF.
In particular, an application can seek a printer, query supported
attributes (like paper size, trays, fonts etc.), configure the printer
device to match it's needs and print on it like on any other X device
reusing parts of the code which is used for the video card Xserver.
</p></div><div xmlns:ns1="" class="refsect1" lang="en"><a name="id2805117"></a><h2>USAGE</h2><p>
Although Xprt may be invoked from the command line, it is
preferable to run it as a daemon via the init script
<tt class="filename">/etc/init.d/xprint</tt> (where this script exists).
</p><p>Client programs such as mozilla will require environment
variable <tt class="envar">${XPSERVERLIST}</tt> to be set, identifying the
&quot;display&quot; on which Xprt is running. This variable may be set
for all users via <tt class="filename">/etc/profile</tt> (or similar), using
<b class="userinput"><tt>/etc/init.d/xprint get_xpserverlist</tt></b>:
</p><div class="informalexample"><pre class="programlisting">export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`</pre></div></div><div class="refsect1" lang="en"><a name="id2805150"></a><h2>OPTIONS</h2><p>Many of Xprt's command line options are shared in common
with the usual X servers (see <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>).
Commonly used options include:</p><div class="variablelist"><dl><dt><span class="term"><tt class="option">:<i class="replaceable"><tt>display</tt></i></tt></span></dt><dd><p> The X server runs on the given display. If multiple X
servers are to run simultaneously on a host, each must
have a unique display number. Note that the standard X
server (for video displays) typically runs on display
:0. If <tt class="filename">/etc/init.d/xprint</tt> is used
to invoke Xprt, it may be configured to automatically assign an available
display number.</p></dd><dt><span class="term"><tt class="option">-ac</tt></span></dt><dd><p>disables host-based access control mechanisms. Enables access
by any host, and permits any host to modify the access control
list. Use with extreme caution. This option exists primarily
for running test suites remotely.</p></dd><dt><span class="term"><tt class="option">-audit <i class="replaceable"><tt>level</tt></i></tt></span></dt><dd><p>sets the audit trail level. The default level is 1, meaning
only connection rejections are reported. Level 2 additionally
reports all successful connections and disconnects. Level 4
enables messages from the SECURITY extension, if present,
including generation and revocation of authorizations and
violations of the security policy. Level 0 turns off the audit
trail. Audit lines are sent as standard error output.</p></dd><dt><span class="term"><tt class="option">-fp <i class="replaceable"><tt>fontpath</tt></i></tt></span></dt><dd><p>sets the search path for fonts. This path is a comma
separated list of directories which Xprt searches for
font databases.</p></dd><dt><span class="term"><tt class="option">-pn</tt></span></dt><dd><p>permits the server to continue running if it fails to
establish all of its well-known sockets (connection
points for clients), but establishes at least
one.</p></dd><dt><span class="term"><tt class="option">-XpFile <i class="replaceable"><tt>file</tt></i></tt></span></dt><dd><p>Sets an altername Xprinters file (see section FILES).</p></dd><dt><span class="term"><tt class="option">-XpSpoolerType <i class="replaceable"><tt>spoolername</tt></i></tt></span></dt><dd xmlns:ns2=""><p>
Defines the spooler system to be used for print job spooling.
Supported values in xprint.mozdev.org release 009 are:
</p><table class="simplelist" border="0" summary="Simple list"><tr><td>aix</td></tr><tr><td>aix4</td></tr><tr><td>bsd</td></tr><tr><td>osf</td></tr><tr><td>solaris</td></tr><tr><td>sysv</td></tr><tr><td>uxp</td></tr><tr><td>cups</td></tr><tr><td>lprng</td></tr><tr><td>other</td></tr><tr><td>none</td></tr></table><p>
(multiple values can be specified, seperated by ':', the first active spooler will be chosen).
The default value is platform-specific and can be obtained via
</p><pre class="programlisting">Xprt -h</pre><p>.
</p></dd></dl></div></div><div xmlns:ns3="" class="refsect1" lang="en"><a name="id2805336"></a><h2>ENVIRONMENT</h2><p>
The following environment variables are recognized by the X print server
(environment variables recognized by Xprint clients are described in
<span class="citerefentry"><span class="refentrytitle">Xprint</span>(7)</span>):
</p><div class="variablelist"><dl><dt><span class="term"><tt class="envar">${XPCONFIGDIR}</tt></span></dt><dd><p> This environment variable points to the root
of the Xprint server configuration directory hierarchy.
If the variable is not defined, the default
path is be assumed. The default path may be
<tt class="filename">/usr/X11R6/lib/X11/xserver/</tt>,
<tt class="filename">/usr/lib/X11/xserver/</tt>,
<tt class="filename">/usr/share/Xprint/xserver/</tt> or
<tt class="filename">/usr/openwin/server/etc/XpConfig</tt>, depending on the
system, and may be configured in <tt class="filename">/etc/init.d/xprint</tt>.</p></dd><dt><span class="term"><tt class="envar">${LANG}</tt></span></dt><dd><p>
This environment variable selects the locale settings used by the Xprint server.
Xprt allows language-specific settings (stored in <tt class="filename">${XPCONFIGDIR}/${LANG}/print/</tt>)
which will override the default settings (stored in <tt class="filename">${XPCONFIGDIR}/C/print/</tt>).
If <tt class="envar">${LANG}</tt> is not set &quot;C&quot; is assumed.
</p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2805421"></a><h2>FILES</h2><div class="variablelist"><dl><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/Xprinters</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/Xprinters</tt></span></dt><dd><p>
`Xprinters' is the top most configuration file. It tells
Xprt which specific printer names (e.g. mylaser) should
be supported, and whether <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> or other commands
should be used to automatically supplement the list of
printers.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/printer</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/printer</tt></span></dt><dd><p>
The `printer' file maps printer names to model
configurations (see `model-config' below). For example,
&quot;mylaser&quot; could be mapped to a &quot;HPDJ1600C&quot;, and all other
arbitrary printers could be mapped to a default, such as
&quot;HPLJ4SI&quot;. When depending on <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> in the Xprinters
file, setting up defaults in `printer' becomes all the
more important.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/document</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/document</tt></span></dt><dd><p>
The `document' file specifies the initial document values
for any print jobs. For example, which paper tray to
use, what default resolution, etc.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/job</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/job</tt></span></dt><dd><p>
The `job' file specifies the initial job values for any
print jobs. For example, &quot;notification-profile&quot; can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/model-config</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</tt></span></dt><dd><p>
The `model-config' file has attributes that describe the
printer model's capabilities and default settings.
Printer model fonts may also be present. The model-config
file also identifies the print ddx driver to be used.
For each printer model supported, a complete hierarchy of
files should exist. In most cases, these files do not
need to be modified.
</p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</tt></span></dt><dd><p>
The print ddx drivers can have highly specific
configuration files to control their behavior. In most
cases, these files do not need to be modified.
</p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2805584"></a><h2>SEE ALSO</h2><p><span class="simplelist"><span class="citerefentry"><span class="refentrytitle">Xprint</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">X11</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">xplsprinters</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xprehashprinterlist</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xphelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxmhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpawhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxthelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpsimplehelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">libXp</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintAppUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XmPrintShell</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XawPrintShell</span>(3x)</span>, Xprint FAQ (<a href="http://xprint.mozdev.org/docs/Xprint_FAQ.html" target="_top">http://xprint.mozdev.org/docs/Xprint_FAQ.html</a>), Xprint main site (<a href="http://xprint.mozdev.org/" target="_top">http://xprint.mozdev.org/</a>)</span></p></div><div class="refsect1" lang="en"><a name="id2805757"></a><h2>AUTHORS</h2><p>
This manual page was written by
Drew Parsons <tt class="email">&lt;<a href="mailto:dparsons@debian.org">dparsons@debian.org</a>&gt;</tt> and
Roland Mainz <tt class="email">&lt;<a href="mailto:roland.mainz@nrubsig.org">roland.mainz@nrubsig.org</a>&gt;</tt>,
with some help from the man page at
<a href="http://www.sins.com.au/unix/manpages/Xprt.html" target="_top">http://www.sins.com.au/unix/manpages/Xprt.html</a> and the XFree86
man page for <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1)</span>.
</p></div></div></body></html>

196
Xprint/doc/Xprt.man.pre Normal file
View File

@ -0,0 +1,196 @@
.\" -*- coding: us-ascii -*-
.TH Xprt __appmansuffix__ "25 November 2004"
.SH NAME
Xprt \- Print server for X Version 11
.SH SYNOPSIS
.ad l
\fBXprt\fR \kx
.if (\nxu > (\n(.lu / 2)) .nr x (\n(.lu / 5)
'in \n(.iu+\nxu
[\fB\-ac\fR] [\fB\-audit \fBlevel\fR\fR] [\fB\-pn\fR] [\fB\-fp \fBfontpath\fR\fR] [\fB\-XpFile \fBfile\fR\fR] [\fB\-XpSpoolerType \fBspoolername\fR\fR] [\fB:\fBdisplay\fR\fR]
'in \n(.iu-\nxu
.ad b
.SH DESCRIPTION
Xprt is the Xprint print server
for version 11 of the X Window system for non display devices
such as printers and fax machines.
.PP
Xprint is an advanced printing system which enables X11
applications to use devices like printers, FAX or create
documents in formats like PostScript, PCL or PDF. It may be used by
clients such as mozilla.
.PP
Xprint is a very flexible, extensible, scaleable, client/server
print system based on ISO 10175 (and some other specs) and the X11
rendering protocol.
Using Xprint an application can search, query and use devices like
printers, FAX machines or create documents in formats like PDF.
In particular, an application can seek a printer, query supported
attributes (like paper size, trays, fonts etc.), configure the printer
device to match it's needs and print on it like on any other X device
reusing parts of the code which is used for the video card Xserver.
.SH USAGE
Although Xprt may be invoked from the command line, it is
preferable to run it as a daemon via the init script
\fB/etc/init.d/xprint\fR (where this script exists).
.PP
Client programs such as mozilla will require environment
variable \fB${XPSERVERLIST}\fR to be set, identifying the
"display" on which Xprt is running. This variable may be set
for all users via \fB/etc/profile\fR (or similar), using
\fB/etc/init.d/xprint get_xpserverlist\fR:
.nf
export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`
.fi
.SH OPTIONS
Many of Xprt's command line options are shared in common
with the usual X servers (see \fBXserver\fR(__appmansuffix__)).
Commonly used options include:
.TP
\fB:\fIdisplay\fB\fR
The X server runs on the given display. If multiple X
servers are to run simultaneously on a host, each must
have a unique display number. Note that the standard X
server (for video displays) typically runs on display
:0. If \fB/etc/init.d/xprint\fR is used
to invoke Xprt, it may be configured to automatically assign an available
display number.
.TP
\fB\-ac\fR
disables host-based access control mechanisms. Enables access
by any host, and permits any host to modify the access control
list. Use with extreme caution. This option exists primarily
for running test suites remotely.
.TP
\fB\-audit \fIlevel\fB\fR
sets the audit trail level. The default level is 1, meaning
only connection rejections are reported. Level 2 additionally
reports all successful connections and disconnects. Level 4
enables messages from the SECURITY extension, if present,
including generation and revocation of authorizations and
violations of the security policy. Level 0 turns off the audit
trail. Audit lines are sent as standard error output.
.TP
\fB\-fp \fIfontpath\fB\fR
sets the search path for fonts. This path is a comma
separated list of directories which Xprt searches for
font databases.
.TP
\fB\-pn\fR
permits the server to continue running if it fails to
establish all of its well-known sockets (connection
points for clients), but establishes at least
one.
.TP
\fB\-XpFile \fIfile\fB\fR
Sets an altername Xprinters file (see section FILES).
.TP
\fB\-XpSpoolerType \fIspoolername\fB\fR
Defines the spooler system to be used for print job spooling.
Supported values in xprint.mozdev.org release 009 are:
aix
aix4
bsd
osf
solaris
sysv
uxp
cups
lprng
other
none
(multiple values can be specified, seperated by ':', the first active spooler will be chosen).
The default value is platform-specific and can be obtained via
.nf
Xprt \-h
.fi
\&.
.SH ENVIRONMENT
The following environment variables are recognized by the X print server
(environment variables recognized by Xprint clients are described in
\fBXprint\fR(__miscmansuffix__)):
.TP
\fB${XPCONFIGDIR}\fR
This environment variable points to the root
of the Xprint server configuration directory hierarchy.
If the variable is not defined, the default
path is be assumed. The default path may be
\fB/usr/X11R6/lib/X11/xserver/\fR,
\fB/usr/lib/X11/xserver/\fR,
\fB/usr/share/Xprint/xserver/\fR or
\fB/usr/openwin/server/etc/XpConfig\fR, depending on the
system, and may be configured in \fB/etc/init.d/xprint\fR.
.TP
\fB${LANG}\fR
This environment variable selects the locale settings used by the Xprint server.
Xprt allows language-specific settings (stored in \fB${XPCONFIGDIR}/${LANG}/print/\fR)
which will override the default settings (stored in \fB${XPCONFIGDIR}/C/print/\fR).
If \fB${LANG}\fR is not set "C" is assumed.
.PP
.SH FILES
.TP
\fB${XPCONFIGDIR}/${LANG}/print/Xprinters\fR, \fB${XPCONFIGDIR}/C/print/Xprinters\fR
`Xprinters' is the top most configuration file. It tells
Xprt which specific printer names (e.g. mylaser) should
be supported, and whether \fBlpstat\fR(1) or other commands
should be used to automatically supplement the list of
printers.
.TP
\fB${XPCONFIGDIR}/${LANG}/print/attributes/printer\fR, \fB${XPCONFIGDIR}/C/print/attributes/printer\fR
The `printer' file maps printer names to model
configurations (see `model-config' below). For example,
"mylaser" could be mapped to a "HPDJ1600C", and all other
arbitrary printers could be mapped to a default, such as
"HPLJ4SI". When depending on \fBlpstat\fR(1) in the Xprinters
file, setting up defaults in `printer' becomes all the
more important.
.TP
\fB${XPCONFIGDIR}/${LANG}/print/attributes/document\fR, \fB${XPCONFIGDIR}/C/print/attributes/document\fR
The `document' file specifies the initial document values
for any print jobs. For example, which paper tray to
use, what default resolution, etc.
.TP
\fB${XPCONFIGDIR}/${LANG}/print/attributes/job\fR, \fB${XPCONFIGDIR}/C/print/attributes/job\fR
The `job' file specifies the initial job values for any
print jobs. For example, "notification-profile" can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.
.TP
\fB${XPCONFIGDIR}/C/print/models/PSdefault/model\-config\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf\fR
The `model-config' file has attributes that describe the
printer model's capabilities and default settings.
Printer model fonts may also be present. The model-config
file also identifies the print ddx driver to be used.
For each printer model supported, a complete hierarchy of
files should exist. In most cases, these files do not
need to be modified.
.TP
\fB${XPCONFIGDIR}/C/print/ddx\-config/raster/pdf\fR, \fB${XPCONFIGDIR}/C/print/ddx\-config/raster/pcl\fR, \fB${XPCONFIGDIR}/C/print/ddx\-config/raster/postscript\fR
The print ddx drivers can have highly specific
configuration files to control their behavior. In most
cases, these files do not need to be modified.
.SH "SEE ALSO"
\fBXprint\fR(__miscmansuffix__), \fBX11\fR(__miscmansuffix__), \fBxplsprinters\fR(__appmansuffix__), \fBxprehashprinterlist\fR(__appmansuffix__), \fBxphelloworld\fR(__appmansuffix__), \fBxpxmhelloworld\fR(__appmansuffix__), \fBxpawhelloworld\fR(__appmansuffix__), \fBxpxthelloworld\fR(__appmansuffix__), \fBxpsimplehelloworld\fR(__appmansuffix__), \fBXserver\fR(__appmansuffix__), \fBlibXp\fR(__libmansuffix__), \fBlibXprintUtils\fR(__libmansuffix__), \fBlibXprintAppUtils\fR(__libmansuffix__), \fBXmPrintShell\fR(__libmansuffix__), \fBXawPrintShell\fR(__libmansuffix__), Xprint FAQ (http://xprint.mozdev.org/docs/Xprint_FAQ.html), Xprint main site (http://xprint.mozdev.org/)
.SH AUTHORS
This manual page was written by
Drew Parsons <dparsons@debian.org> and
Roland Mainz <roland.mainz@nrubsig.org>,
with some help from the man page at
http://www.sins.com.au/unix/manpages/Xprt.html and the XFree86
man page for \fBXserver\fR(1).

371
Xprint/doc/Xprt.sgml Normal file
View File

@ -0,0 +1,371 @@
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" 'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'>
<!-- Process this file with docbook-to-man to generate an nroff manual
page: 'docbook-to-man manpage.sgml > manpage.1'. You may view
the manual page with: 'docbook-to-man manpage.sgml | nroff -man | less'.
A typical entry in a Makefile or Makefile.am is:
manpage.1: manpage.sgml
docbook-to-man $< > $@
HTML generation can be done like this:
% xsltproc ==docbook /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.60.1/html/docbook.xsl Xprint.sgml >Xprint.html
-->
<refentry id="Xprt">
<refmeta>
<refentrytitle>Xprt</refentrytitle>
<manvolnum>__appmansuffix__</manvolnum>
</refmeta>
<refnamediv>
<refname>Xprt</refname>
<refpurpose>Print server for X Version 11</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>Xprt</command>
<arg><option>-ac</option></arg>
<arg><option>-audit <replaceable>level</replaceable></option></arg>
<arg><option>-pn</option></arg>
<arg><option>-fp <replaceable>fontpath</replaceable></option></arg>
<arg><option>-XpFile <replaceable>file</replaceable></option></arg>
<arg><option>-XpSpoolerType <replaceable>spoolername</replaceable></option></arg>
<arg><option>:<replaceable>display</replaceable></option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
<para><command>Xprt</command> is the Xprint print server
for version 11 of the X Window system for non display devices
such as printers and fax machines.</para>
<para>Xprint is an advanced printing system which enables X11
applications to use devices like printers, FAX or create
documents in formats like PostScript, PCL or PDF. It may be used by
clients such as <application>mozilla</application>.
</para>
<para>Xprint is a very flexible, extensible, scaleable, client/server
print system based on ISO 10175 (and some other specs) and the X11
rendering protocol.
Using Xprint an application can search, query and use devices like
printers, FAX machines or create documents in formats like PDF.
In particular, an application can seek a printer, query supported
attributes (like paper size, trays, fonts etc.), configure the printer
device to match it's needs and print on it like on any other X device
reusing parts of the code which is used for the video card Xserver.
</para>
</refsect1>
<refsect1>
<title>USAGE</title>
<para>
Although Xprt may be invoked from the command line, it is
preferable to run it as a daemon via the init script
<filename>/etc/init.d/xprint</filename> (where this script exists).
</para>
<para>Client programs such as mozilla will require environment
variable <envar>${XPSERVERLIST}</envar> to be set, identifying the
"display" on which Xprt is running. This variable may be set
for all users via <filename>/etc/profile</filename> (or similar), using
<userinput>/etc/init.d/xprint get_xpserverlist</userinput>:
<informalexample>
<programlisting>export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`</programlisting>
</informalexample>
</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<para>Many of Xprt's command line options are shared in common
with the usual X servers (see <citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry>).
Commonly used options include:</para>
<variablelist>
<varlistentry>
<term><option>:<replaceable>display</replaceable></option>
</term>
<listitem>
<para> The X server runs on the given display. If multiple X
servers are to run simultaneously on a host, each must
have a unique display number. Note that the standard X
server (for video displays) typically runs on display
:0. If <filename>/etc/init.d/xprint</filename> is used
to invoke Xprt, it may be configured to automatically assign an available
display number.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-ac</option>
</term>
<listitem>
<para>disables host-based access control mechanisms. Enables access
by any host, and permits any host to modify the access control
list. Use with extreme caution. This option exists primarily
for running test suites remotely.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-audit <replaceable>level</replaceable></option>
</term>
<listitem>
<para>sets the audit trail level. The default level is 1, meaning
only connection rejections are reported. Level 2 additionally
reports all successful connections and disconnects. Level 4
enables messages from the SECURITY extension, if present,
including generation and revocation of authorizations and
violations of the security policy. Level 0 turns off the audit
trail. Audit lines are sent as standard error output.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-fp <replaceable>fontpath</replaceable></option>
</term>
<listitem>
<para>sets the search path for fonts. This path is a comma
separated list of directories which Xprt searches for
font databases.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-pn</option>
</term>
<listitem>
<para>permits the server to continue running if it fails to
establish all of its well-known sockets (connection
points for clients), but establishes at least
one.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-XpFile <replaceable>file</replaceable></option>
</term>
<listitem>
<para>Sets an altername Xprinters file (see section FILES).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-XpSpoolerType <replaceable>spoolername</replaceable></option>
</term>
<listitem>
<para>
Defines the spooler system to be used for print job spooling.
Supported values in xprint.mozdev.org release 009 are:
<simplelist type="vert">
<member>aix</member>
<member>aix4</member>
<member>bsd</member>
<member>osf</member>
<member>solaris</member>
<member>sysv</member>
<member>uxp</member>
<member>cups</member>
<member>lprng</member>
<member>other</member>
<member>none</member>
</simplelist>
(multiple values can be specified, seperated by ':', the first active spooler will be chosen).
The default value is platform-specific and can be obtained via
<programlisting>Xprt -h</programlisting>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>ENVIRONMENT</title>
<para>
The following environment variables are recognized by the X print server
(environment variables recognized by Xprint clients are described in
<citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry>):
<variablelist>
<varlistentry>
<term><envar>${XPCONFIGDIR}</envar></term>
<listitem>
<para> This environment variable points to the root
of the Xprint server configuration directory hierarchy.
If the variable is not defined, the default
path is be assumed. The default path may be
<filename>/usr/X11R6/lib/X11/xserver/</filename>,
<filename>/usr/lib/X11/xserver/</filename>,
<filename>/usr/share/Xprint/xserver/</filename> or
<filename>/usr/openwin/server/etc/XpConfig</filename>, depending on the
system, and may be configured in <filename>/etc/init.d/xprint</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>${LANG}</envar></term>
<listitem>
<para>
This environment variable selects the locale settings used by the Xprint server.
Xprt allows language-specific settings (stored in <filename>${XPCONFIGDIR}/${LANG}/print/</filename>)
which will override the default settings (stored in <filename>${XPCONFIGDIR}/C/print/</filename>).
If <envar>${LANG}</envar> is not set "C" is assumed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>${XPCONFIGDIR}/${LANG}/print/Xprinters</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/Xprinters</filename></term>
<listitem>
<para>
`Xprinters' is the top most configuration file. It tells
Xprt which specific printer names (e.g. mylaser) should
be supported, and whether <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> or other commands
should be used to automatically supplement the list of
printers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/printer</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/attributes/printer</filename></term>
<listitem>
<para>
The `printer' file maps printer names to model
configurations (see `model-config' below). For example,
"mylaser" could be mapped to a "HPDJ1600C", and all other
arbitrary printers could be mapped to a default, such as
"HPLJ4SI". When depending on <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> in the Xprinters
file, setting up defaults in `printer' becomes all the
more important.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/document</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/attributes/document</filename></term>
<listitem>
<para>
The `document' file specifies the initial document values
for any print jobs. For example, which paper tray to
use, what default resolution, etc.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/job</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/attributes/job</filename></term>
<listitem>
<para>
The `job' file specifies the initial job values for any
print jobs. For example, "notification-profile" can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/model-config</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</filename></term>
<listitem>
<para>
The `model-config' file has attributes that describe the
printer model's capabilities and default settings.
Printer model fonts may also be present. The model-config
file also identifies the print ddx driver to be used.
For each printer model supported, a complete hierarchy of
files should exist. In most cases, these files do not
need to be modified.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</filename></term>
<term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</filename></term>
<listitem>
<para>
The print ddx drivers can have highly specific
configuration files to control their behavior. In most
cases, these files do not need to be modified.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
<para>
<simplelist type="inline">
<!-- specific references -->
<!-- none -->
<!-- Xprint general references -->
<member><citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>X11</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xplsprinters</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xprehashprinterlist</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xphelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpxmhelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpawhelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpxthelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>xpsimplehelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
<!--
<member><citerefentry><refentrytitle>Xprt</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
-->
<!-- ToDO: Add manual pages for the single Xprint DDX implementations (PostScript/PDF/PCL/PCL-MONO/Raster/etc.) -->
<member><citerefentry><refentrytitle>libXp</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>libXprintUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>libXprintAppUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>XmPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>XawPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member>Xprint FAQ (<ulink url="http://xprint.mozdev.org/docs/Xprint_FAQ.html">http://xprint.mozdev.org/docs/Xprint_FAQ.html</ulink>)</member>
<member>Xprint main site (<ulink url="http://xprint.mozdev.org/">http://xprint.mozdev.org/</ulink>)</member>
</simplelist>
</para>
</refsect1>
<refsect1>
<title>AUTHORS</title>
<para>
This manual page was written by
Drew Parsons <email>dparsons@debian.org</email> and
Roland Mainz <email>roland.mainz@nrubsig.org</email>,
with some help from the man page at
<ulink url="http://www.sins.com.au/unix/manpages/Xprt.html">http://www.sins.com.au/unix/manpages/Xprt.html</ulink> and the XFree86
man page for <citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
</refsect1>
</refentry>

View File

@ -248,7 +248,7 @@ get_fontlist_from_xfs_config()
tok="${val#*=}"
done
done
) | tr "," "[\n]" | fontpath2fontlist
) | tr "," "\n" | fontpath2fontlist
}
get_fontlist_from_all_xfs_configs()
@ -832,7 +832,7 @@ do_get_xpserverlist()
echo ${display}
fi
)
done | tr "[\n]" " "
done | tr "\n" " "
)
# Only produce output if we have some entries...
[ "${xpserverlist}" != "" ] && echo "${xpserverlist}"

View File

@ -329,12 +329,12 @@ AllocatePclPrivates(ScreenPtr pScreen)
*/
static char DOC_ATT_SUPP[]="document-attributes-supported";
static char DOC_ATT_VAL[]="document-format";
static char DOC_ATT_VAL[]="document-format xp-listfonts-modes";
static char JOB_ATT_SUPP[]="job-attributes-supported";
static char JOB_ATT_VAL[]="";
static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
default-input-tray default-medium plex";
default-input-tray default-medium plex xp-listfonts-modes";
static int
PclInitContext(XpContextPtr pCon)
@ -427,7 +427,7 @@ PclInitContext(XpContextPtr pCon)
server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
if( ( attrStr = (char *)xalloc(strlen(server) + strlen(DOC_ATT_SUPP)
+ strlen(DOC_ATT_VAL) +
strlen(PAGE_ATT_VAL) + 6 ) )
strlen(PAGE_ATT_VAL) + 8 ) )
== (char *)NULL )
return BadAlloc;
sprintf( attrStr, "*%s:\t%s %s %s", DOC_ATT_SUPP, server,
@ -440,7 +440,7 @@ PclInitContext(XpContextPtr pCon)
*/
server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
if( ( attrStr = (char *)xalloc(strlen(server) + strlen(JOB_ATT_SUPP)
+ strlen(JOB_ATT_VAL) + 4 ) )
+ strlen(JOB_ATT_VAL) + 8 ) )
== (char *)NULL )
return BadAlloc;
sprintf( attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL );
@ -452,7 +452,7 @@ PclInitContext(XpContextPtr pCon)
*/
server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
if( ( attrStr = (char *)xalloc(strlen(server) + strlen(PAGE_ATT_SUPP)
+ strlen(PAGE_ATT_VAL) + 4 ) )
+ strlen(PAGE_ATT_VAL) + 8 ) )
== (char *)NULL )
return BadAlloc;
sprintf( attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL );

View File

@ -350,7 +350,6 @@ typedef struct
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
char **argv);
static Bool PsDestroyContext(XpContextPtr pCon);
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
/*
@ -374,9 +373,6 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
*/
extern Bool PsCreateGC(GCPtr pGC);
static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
unsigned long *valid, PsOutPtr *psOut,
ColormapPtr *cMap);
extern PsContextPrivPtr PsGetPsContextPriv( DrawablePtr pDrawable );
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
PsOutPtr *psOut, ColormapPtr *cMap);
@ -556,7 +552,7 @@ extern int PsListInstalledColormaps(ScreenPtr pScreen, XID *pCmapList);
extern void PsStoreColors(ColormapPtr pColor, int ndef, xColorItem *pdefs);
extern void PsResolveColor(unsigned short *pRed, unsigned short *pGreen,
unsigned short *pBlue, VisualPtr pVisual);
extern int PsGetPixelColor(ColormapPtr cMap, int pixval);
extern PsOutColor PsGetPixelColor(ColormapPtr cMap, int pixval);
extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
ColormapPtr cMap);
@ -566,6 +562,7 @@ extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height,
int depth);
extern void PsScrubPixmap(PixmapPtr pPixmap);
extern Bool PsDestroyPixmap(PixmapPtr pPixmap);
extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv);
extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable);

View File

@ -131,6 +131,13 @@ PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
pt = (char *)(&i); i = 1; if( pt[0]=='\001' ) swap = 1; else swap = 0;
#ifdef PSOUT_USE_DEEPCOLOR
if( depth==30 )
{
ErrorF("PsPutScaledImage: Not implemented yet for 30bit\m");
}
else
#endif /* PSOUT_USE_DEEPCOLOR */
if( depth==24 )
{
PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3);
@ -174,6 +181,34 @@ PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
else goto error;
PsOut_EndImage(psOut);
}
#ifdef PSOUT_USE_DEEPCOLOR
else if( (depth > 8) && (depth < 16) )
{
int rowsiz = PixmapBytePad(w, depth);
PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ )
{
short *pt = (short *)&pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt++ )
{
PsOutColor clr = PsGetPixelColor(cMap, (int)(*pt)&0xFFFF);
/* XXX: This needs to be fixed for endian swapping and to support
* depths deeper than 8bit per R-,G-,B-gun... */
int val = PSOUTCOLOR_TO_RGB24BIT(clr);
char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
PsOut_OutImageBytes(psOut, 3, &ipt[1]);
}
}
PsOut_EndImage(psOut);
}
#endif /* PSOUT_USE_DEEPCOLOR */
else if( depth==8 )
{
int rowsiz = PixmapBytePad(w, depth);
@ -183,8 +218,9 @@ PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
char *pt = &pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt++ )
{
int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
char *ipt = (char *)&val;
PsOutColor clr = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
int val = PSOUTCOLOR_TO_RGB24BIT(clr);
char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
@ -296,6 +332,14 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_BeginImageCache(psOut, cache_id);
#endif
#ifdef PSOUT_USE_DEEPCOLOR
if( depth==30 )
{
ErrorF("PsPutScaledImageIM: Not implemented yet for 30bit\m");
}
else
#endif /* PSOUT_USE_DEEPCOLOR */
if( depth==24 )
{
PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
@ -339,6 +383,32 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
else goto error;
PsOut_EndImage(psOut);
}
#ifdef PSOUT_USE_DEEPCOLOR
else if( (depth > 8) && (depth < 16) )
{
int rowsiz = PixmapBytePad(w, depth);
PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ )
{
short *pt = (short *)&pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt++ )
{
PsOutColor clr = PsGetPixelColor(cMap, (int)(*pt)&0xFFFF);
int val = PSOUTCOLOR_TO_RGB24BIT(clr);
char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
PsOut_OutImageBytes(psOut, 3, &ipt[1]);
}
}
PsOut_EndImage(psOut);
}
#endif /* PSOUT_USE_DEEPCOLOR */
else if( depth==8 )
{
int rowsiz = PixmapBytePad(w, depth);
@ -348,8 +418,11 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
char *pt = &pImage[rowsiz*r];
for( c=0 ; c<w ; c++,pt++ )
{
int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
char *ipt = (char *)&val;
PsOutColor clr = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
/* XXX: This needs to be fixed for endian swapping and to support
* depths deeper than 8bit per R-,G-,B-gun... */
int val = PSOUTCOLOR_TO_RGB24BIT(clr);
char *ipt = (char *)&val;
if( swap )
{
char tmp[4];

View File

@ -75,6 +75,8 @@ in this Software without prior written authorization from The Open Group.
********************************************************************/
#include "Ps.h"
#include "mi.h"
#include "micmap.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "colormapst.h"
@ -82,49 +84,25 @@ in this Software without prior written authorization from The Open Group.
Bool
PsCreateColormap(ColormapPtr pColor)
{
int i;
unsigned short rgb;
VisualPtr pVisual = pColor->pVisual;
Pixel pix;
if( pVisual->class==TrueColor )
{
for( i=0 ; i<pVisual->ColormapEntries ; i++ )
{
rgb = (i<<8)|i;
pColor->red[i].fShared = FALSE;
pColor->red[i].co.local.red = rgb;
pColor->red[i].co.local.green = 0;
pColor->red[i].co.local.blue = 0;
pColor->green[i].fShared = FALSE;
pColor->green[i].co.local.red = 0;
pColor->green[i].co.local.green = rgb;
pColor->green[i].co.local.blue = 0;
pColor->blue[i].fShared = FALSE;
pColor->blue[i].co.local.red = 0;
pColor->blue[i].co.local.green = 0;
pColor->blue[i].co.local.blue = rgb;
}
}
return TRUE;
return miInitializeColormap(pColor);
}
void
PsDestroyColormap(ColormapPtr pColor)
{
/* NO-OP */
}
void
PsInstallColormap(ColormapPtr pColor)
{
miInstallColormap(pColor);
}
void
PsUninstallColormap(ColormapPtr pColor)
{
miUninstallColormap(pColor);
}
int
@ -132,7 +110,7 @@ PsListInstalledColormaps(
ScreenPtr pScreen,
XID *pCmapList)
{
return 0;
return miListInstalledColormaps(pScreen, pCmapList);
}
void
@ -160,18 +138,71 @@ PsResolveColor(
unsigned short *pBlue,
VisualPtr pVisual)
{
miResolveColor(pRed, pGreen, pBlue, pVisual);
}
int
PsOutColor
PsGetPixelColor(ColormapPtr cMap, int pixval)
{
int r, g, b;
if( cMap->pVisual->class==TrueColor ) return(pixval);
if( pixval<0 || pixval>255 ) return(0);
r = cMap->red[pixval].co.local.red>>8;
g = cMap->red[pixval].co.local.green>>8;
b = cMap->red[pixval].co.local.blue>>8;
return((r<<16)|(g<<8)|b);
VisualPtr v = cMap->pVisual;
switch( v->class )
{
case TrueColor:
{
PsOutColor p = pixval;
PsOutColor r, g, b;
#ifdef PSOUT_USE_DEEPCOLOR
int shift = 16 - v->bitsPerRGBValue;
#else
int shift = 8 - v->bitsPerRGBValue;
#endif /* PSOUT_USE_DEEPCOLOR */
r = ((p & v->redMask) >> v->offsetRed) << shift;
g = ((p & v->greenMask) >> v->offsetGreen) << shift;
b = ((p & v->blueMask) >> v->offsetBlue) << shift;
#ifdef PSOUT_USE_DEEPCOLOR
return((r<<32)|(g<<16)|b);
#else
return((r<<16)|(g<<8)|b);
#endif /* PSOUT_USE_DEEPCOLOR */
}
case PseudoColor:
case GrayScale:
case StaticGray:
{
PsOutColor r, g, b;
if( pixval < 0 || pixval > v->ColormapEntries)
return(0);
r = cMap->red[pixval].co.local.red;
g = cMap->red[pixval].co.local.green;
b = cMap->red[pixval].co.local.blue;
if ((v->class | DynamicClass) == GrayScale)
{
/* rescale to gray (see |miResolveColor()|) */
r = g = b = (30L*r + 59L*g + 11L*b) / 100L;
}
#ifdef PSOUT_USE_DEEPCOLOR
return((r<<32)|(g<<16)|b);
#else
r >>= 8;
g >>= 8;
b >>= 8;
return((r<<16)|(g<<8)|b);
#endif /* PSOUT_USE_DEEPCOLOR */
}
default:
FatalError("PsGetPixelColor: Unsupported visual %x\n",
(int)cMap->pVisual->class);
break;
}
return 0; /* NO-OP*/
}
void

View File

@ -380,6 +380,16 @@ PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc)
{
GCPtr pDst;
if (pSrc == NULL) {
/* https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 ("'x11perf
* -copypixpix500' crashes Xprt's PostScript DDX [PsCreateAndCopyGC"):
* I have no clue whether this is the real fix or just wallpapering
* over the crash (that's why we warn here loudly when this
* happens) ... */
fprintf(stderr, "PsCreateAndCopyGC: pSrc == NULL\n");
return NULL;
}
if ((pDst =
CreateScratchGC(pDrawable->pScreen, pDrawable->depth)) == NULL)
{

View File

@ -119,8 +119,18 @@ InitializePsDriver(ndx, pScreen, argc, argv)
#endif
char **printerNames;
int numPrinters;
int nVisuals;
int nDepths;
int nv, /* total number of visuals */
nv_1bit, /* number of 8bit visuals */
nv_8bit, /* number of 8bit visuals */
nv_12bit, /* number of 12bit visuals */
nv_24bit, /* number of 24bit visuals*/
nv_30bit; /* number of 30bit visuals*/
int nd; /* number of depths */
VisualID *vids_1bit,
*vids_8bit,
*vids_12bit,
*vids_24bit,
*vids_30bit;
VisualPtr visuals;
DepthPtr depths;
VisualID defaultVisual;
@ -179,44 +189,180 @@ InitializePsDriver(ndx, pScreen, argc, argv)
/* Will BitmapToRegion make any difference at all? */
pScreen->BitmapToRegion = mfbPixmapToRegion;
nVisuals = 2;
nDepths = 2;
visuals = (VisualPtr)xalloc(nVisuals*sizeof(VisualRec));
depths = (DepthPtr) xalloc(nDepths*sizeof(DepthRec));
visuals = (VisualPtr) xalloc(8*sizeof(VisualRec));
depths = (DepthPtr) xalloc(8*sizeof(DepthRec));
vids_1bit = (VisualID *)xalloc(8*sizeof(VisualID));
vids_8bit = (VisualID *)xalloc(8*sizeof(VisualID));
vids_12bit = (VisualID *)xalloc(8*sizeof(VisualID));
vids_24bit = (VisualID *)xalloc(8*sizeof(VisualID));
vids_30bit = (VisualID *)xalloc(8*sizeof(VisualID));
visuals[0].vid = FakeClientID(0);
visuals[0].class = TrueColor;
visuals[0].bitsPerRGBValue = 8;
visuals[0].ColormapEntries = 256;
visuals[0].nplanes = 24;
visuals[0].redMask = 0x00FF0000;
visuals[0].greenMask = 0x0000FF00;
visuals[0].blueMask = 0x000000FF;
visuals[0].offsetRed = 16;
visuals[0].offsetGreen = 8;
visuals[0].offsetBlue = 0;
nv = nv_1bit = nv_8bit = nv_12bit = nv_24bit = nv_30bit = nd = 0;
visuals[1].vid = FakeClientID(0);
visuals[1].class = PseudoColor;
visuals[1].bitsPerRGBValue = 8;
visuals[1].ColormapEntries = 256;
visuals[1].nplanes = 8;
visuals[1].redMask = 0x0;
visuals[1].greenMask = 0x0;
visuals[1].blueMask = 0x0;
visuals[1].offsetRed = 0x0;
visuals[1].offsetGreen = 0x0;
visuals[1].offsetBlue = 0x0;
/* TrueColor, 24bit */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = TrueColor;
visuals[nv].bitsPerRGBValue = 8;
visuals[nv].ColormapEntries = 256;
visuals[nv].nplanes = 24;
visuals[nv].redMask = 0X00FF0000;
visuals[nv].greenMask = 0X0000FF00;
visuals[nv].blueMask = 0X000000FF;
visuals[nv].offsetRed = 16;
visuals[nv].offsetGreen = 8;
visuals[nv].offsetBlue = 0;
vids_24bit[nv_24bit] = visuals[nv].vid;
nv++; nv_24bit++;
depths[0].depth = 24;
depths[0].numVids = 1;
depths[0].vids = (VisualID *)xalloc(sizeof(VisualID));
depths[0].vids[0] = visuals[0].vid;
/* PseudoColor, 8bit */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = PseudoColor;
visuals[nv].bitsPerRGBValue = 8;
visuals[nv].ColormapEntries = 256;
visuals[nv].nplanes = 8;
visuals[nv].redMask = 0x0;
visuals[nv].greenMask = 0x0;
visuals[nv].blueMask = 0x0;
visuals[nv].offsetRed = 0x0;
visuals[nv].offsetGreen = 0x0;
visuals[nv].offsetBlue = 0x0;
vids_8bit[nv_8bit] = visuals[nv].vid;
nv++; nv_8bit++;
depths[1].depth = 8;
depths[1].numVids = 1;
depths[1].vids = (VisualID *)xalloc(sizeof(VisualID));
depths[1].vids[0] = visuals[1].vid;
/* GrayScale, 8bit */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = GrayScale;
visuals[nv].bitsPerRGBValue = 8;
visuals[nv].ColormapEntries = 256;
visuals[nv].nplanes = 8;
visuals[nv].redMask = 0x0;
visuals[nv].greenMask = 0x0;
visuals[nv].blueMask = 0x0;
visuals[nv].offsetRed = 0x0;
visuals[nv].offsetGreen = 0x0;
visuals[nv].offsetBlue = 0x0;
vids_8bit[nv_8bit] = visuals[nv].vid;
nv++; nv_8bit++;
/* StaticGray, 8bit */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = StaticGray;
visuals[nv].bitsPerRGBValue = 8;
visuals[nv].ColormapEntries = 256;
visuals[nv].nplanes = 8;
visuals[nv].redMask = 0x0;
visuals[nv].greenMask = 0x0;
visuals[nv].blueMask = 0x0;
visuals[nv].offsetRed = 0x0;
visuals[nv].offsetGreen = 0x0;
visuals[nv].offsetBlue = 0x0;
vids_8bit[nv_8bit] = visuals[nv].vid;
nv++; nv_8bit++;
/* StaticGray, 1bit */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = StaticGray;
visuals[nv].bitsPerRGBValue = 1;
visuals[nv].ColormapEntries = 2;
visuals[nv].nplanes = 1;
visuals[nv].redMask = 0x0;
visuals[nv].greenMask = 0x0;
visuals[nv].blueMask = 0x0;
visuals[nv].offsetRed = 0x0;
visuals[nv].offsetGreen = 0x0;
visuals[nv].offsetBlue = 0x0;
vids_1bit[nv_1bit] = visuals[nv].vid;
nv++; nv_1bit++;
#ifdef PSOUT_USE_DEEPCOLOR
/* TrueColor, 30bit, 10bit per R-,G-,B-gun */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = TrueColor;
visuals[nv].bitsPerRGBValue = 10;
visuals[nv].ColormapEntries = 1024;
visuals[nv].nplanes = 30;
visuals[nv].redMask = 0X3FF00000;
visuals[nv].greenMask = 0X000FFC00;
visuals[nv].blueMask = 0X000003FF;
visuals[nv].offsetRed = 20;
visuals[nv].offsetGreen = 10;
visuals[nv].offsetBlue = 0;
vids_30bit[nv_30bit] = visuals[nv].vid;
nv++; nv_30bit++;
/* PostScript Level 2 and above, colors can have 12 bits per component
* (36 bit for RGB) */
/* GrayScale, 12bit, 12bit per R-,G-,B-gun */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = GrayScale;
visuals[nv].bitsPerRGBValue = 12;
visuals[nv].ColormapEntries = 4096;
visuals[nv].nplanes = 12;
visuals[nv].redMask = 0x0;
visuals[nv].greenMask = 0x0;
visuals[nv].blueMask = 0x0;
visuals[nv].offsetRed = 0x0;
visuals[nv].offsetGreen = 0x0;
visuals[nv].offsetBlue = 0x0;
vids_12bit[nv_12bit] = visuals[nv].vid;
nv++; nv_12bit++;
/* StaticGray, 12bit, 12bit per R-,G-,B-gun */
visuals[nv].vid = FakeClientID(0);
visuals[nv].class = StaticGray;
visuals[nv].bitsPerRGBValue = 12;
visuals[nv].ColormapEntries = 4096;
visuals[nv].nplanes = 12;
visuals[nv].redMask = 0x0;
visuals[nv].greenMask = 0x0;
visuals[nv].blueMask = 0x0;
visuals[nv].offsetRed = 0x0;
visuals[nv].offsetGreen = 0x0;
visuals[nv].offsetBlue = 0x0;
vids_12bit[nv_12bit] = visuals[nv].vid;
nv++; nv_12bit++;
#endif /* PSOUT_USE_DEEPCOLOR */
if( nv_30bit > 0 )
{
depths[nd].depth = 30;
depths[nd].numVids = nv_30bit;
depths[nd].vids = vids_30bit;
nd++;
}
if( nv_24bit > 0 )
{
depths[nd].depth = 24;
depths[nd].numVids = nv_24bit;
depths[nd].vids = vids_24bit;
nd++;
}
if( nv_12bit > 0 )
{
depths[nd].depth = 12;
depths[nd].numVids = nv_12bit;
depths[nd].vids = vids_12bit;
nd++;
}
if( nv_8bit > 0 )
{
depths[nd].depth = 8;
depths[nd].numVids = nv_8bit;
depths[nd].vids = vids_8bit;
nd++;
}
if( nv_1bit > 0 )
{
depths[nd].depth = 1;
depths[nd].numVids = nv_1bit;
depths[nd].vids = vids_1bit;
nd++;
}
/* Defaul visual is 8bit PseudoColor */
defaultVisual = visuals[1].vid;
@ -228,7 +374,7 @@ InitializePsDriver(ndx, pScreen, argc, argv)
GlxWrapInitVisuals(&proc);
/* GlxInitVisuals ignores the last three arguments. */
proc(&visuals, &depths, &nVisuals, &nDepths,
proc(&visuals, &depths, &nv, &nd,
&rootDepth, &defaultVisual, 0, 0, 0);
}
#endif /* GLXEXT */
@ -237,8 +383,8 @@ InitializePsDriver(ndx, pScreen, argc, argv)
pScreen->width, pScreen->height,
(int) (pScreen->width / (pScreen->mmWidth / 25.40)),
(int) (pScreen->height / (pScreen->mmHeight / 25.40)),
0, rootDepth, nDepths,
depths, defaultVisual, nVisuals, visuals);
0, rootDepth, nd,
depths, defaultVisual, nv, visuals);
if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE;
@ -282,12 +428,12 @@ AllocatePsPrivates(ScreenPtr pScreen)
*/
static char DOC_ATT_SUPP[]="document-attributes-supported";
static char DOC_ATT_VAL[]="document-format";
static char DOC_ATT_VAL[]="document-format xp-listfonts-modes";
static char JOB_ATT_SUPP[]="job-attributes-supported";
static char JOB_ATT_VAL[]="";
static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
default-input-tray default-medium plex";
default-input-tray default-medium plex xp-listfonts-modes";
static int
PsInitContext(pCon)
@ -346,7 +492,7 @@ PsInitContext(pCon)
server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
if ((attrStr = (char *) xalloc(strlen(server) +
strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
+ strlen(PAGE_ATT_VAL) + 6)) == NULL)
+ strlen(PAGE_ATT_VAL) + 8)) == NULL)
{
return BadAlloc;
}
@ -360,7 +506,7 @@ PsInitContext(pCon)
*/
server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
if ((attrStr = (char *) xalloc(strlen(server) + strlen(JOB_ATT_SUPP) +
strlen(JOB_ATT_VAL) + 4)) == NULL)
strlen(JOB_ATT_VAL) + 8)) == NULL)
{
return BadAlloc;
}
@ -373,7 +519,7 @@ PsInitContext(pCon)
*/
server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
if ((attrStr = (char *) xalloc(strlen(server) + strlen(PAGE_ATT_SUPP) +
strlen(PAGE_ATT_VAL) + 4)) == NULL)
strlen(PAGE_ATT_VAL) + 8)) == NULL)
{
return BadAlloc;
}

View File

@ -92,7 +92,7 @@ PsCreatePixmap(
{
PixmapPtr pPixmap;
pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec));
pPixmap = (PixmapPtr)xcalloc(1, sizeof(PixmapRec));
if( !pPixmap) return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
pPixmap->drawable.class = 0;
@ -108,20 +108,21 @@ PsCreatePixmap(
pPixmap->devKind = 0;
pPixmap->refcnt = 1;
pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xalloc(sizeof(PsPixmapPrivRec));
pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xcalloc(1, sizeof(PsPixmapPrivRec));
if( !pPixmap->devPrivate.ptr )
{ xfree(pPixmap); return NullPixmap; }
memset(pPixmap->devPrivate.ptr, 0, sizeof(PsPixmapPrivRec));
return pPixmap;
}
Bool
PsDestroyPixmap(PixmapPtr pPixmap)
/* PsScrubPixmap: Remove all content from a pixmap (used by
* |PsPolyFillRect()| when the "solid fill" operation covers
* the whole pixmap) */
void
PsScrubPixmap(PixmapPtr pPixmap)
{
PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr;
DisplayListPtr disp = priv->dispList;
if( --pPixmap->refcnt ) return TRUE;
while( disp )
{
int i;
@ -178,6 +179,20 @@ PsDestroyPixmap(PixmapPtr pPixmap)
}
xfree(oldDisp);
}
priv->dispList = NULL;
}
Bool
PsDestroyPixmap(PixmapPtr pPixmap)
{
PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr;
DisplayListPtr disp = priv->dispList;
if( --pPixmap->refcnt ) return TRUE;
PsScrubPixmap(pPixmap);
xfree(priv);
xfree(pPixmap);
return TRUE;
@ -192,11 +207,11 @@ PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
{
if( disp->nelms>=DPY_BLOCKSIZE && disp->next ) continue;
if( disp->nelms<DPY_BLOCKSIZE ) return(disp);
disp->next = (DisplayListPtr)xalloc(sizeof(DisplayListRec));
disp->next = (DisplayListPtr)xcalloc(1, sizeof(DisplayListRec));
disp->next->next = (DisplayListPtr)0;
disp->next->nelms = 0;
}
disp = (DisplayListPtr)xalloc(sizeof(DisplayListRec));
disp = (DisplayListPtr)xcalloc(1, sizeof(DisplayListRec));
disp->next = (DisplayListPtr)0;
disp->nelms = 0;
priv->dispList = disp;
@ -480,6 +495,7 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
for( i=0 ; i<disp->nelms ; i++,elm++ )
{
if( !elm->gc ) continue; /* workaround for https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 */
if( !elm->gc->fgPixel ) continue;
switch(elm->type)
{
@ -498,7 +514,7 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
if( (*nElms) )
{
elms = (PsElmPtr)xalloc((*nElms)*sizeof(PsElmRec));
elms = (PsElmPtr)xcalloc(1, (*nElms)*sizeof(PsElmRec));
if( elms )
{
disp = priv->dispList;
@ -568,7 +584,7 @@ PsCloneFillElementList(int nElms, PsElmPtr elms)
int i;
PsElmPtr newElms;
newElms = (PsElmPtr)xalloc(nElms*sizeof(PsElmRec));
newElms = (PsElmPtr)xcalloc(1, nElms*sizeof(PsElmRec));
if( !newElms ) return(newElms);
for( i=0 ; i<nElms ; i++ )
{

View File

@ -203,6 +203,31 @@ PsPolyFillRect(
DisplayListPtr disp;
GCPtr gc;
#ifdef DBE
/* Remove previous pixmap content if we render one single rect which
* covers the whole pixmap surface (this optimisation was added for
* the double-buffer extension ("DBE") which uses |PolyFillRect()|
* to clear the buffer - but it makes sense in other cases, too).
*/
if (nRects == 1)
{
extern Bool noDbeExtension;
if ( (pRects[0].x==0) && (pRects[0].y==0) &&
(pRects[0].width==pDrawable->width) && (pRects[0].height==pDrawable->height) &&
(pGC->fillStyle == FillSolid) &&
(noDbeExtension == False))
{
#ifdef DEBUG_gismobile
ErrorF("PsPolyFillRect: scrubbing pixmap...\n");
#endif /* DEBUG_gismobile */
/* Remove all content from the pixmap as it would be covered
* by the whole rect anyway */
PsScrubPixmap(pDrawable);
}
}
#endif /* DBE */
if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
disp = PsGetFreeDisplayBlock(priv);

View File

@ -422,17 +422,19 @@ S_OutTok(PsOutPtr self, char *tok, int cr)
}
static void
S_Color(PsOutPtr self, int clr)
S_Color(PsOutPtr self, PsOutColor clr)
{
int ir, ig, ib;
ir = clr>>16; ig = (clr>>8)&0xFF; ib = clr&0xFF;
ir = PSOUTCOLOR_TO_REDBITS(clr);
ig = PSOUTCOLOR_TO_GREENBITS(clr);
ib = PSOUTCOLOR_TO_BLUEBITS(clr);
if( ir==ig && ig==ib )
{ S_OutNum(self, (float)ir/255.); S_OutTok(self, "g", 1); }
{ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); S_OutTok(self, "g", 1); }
else
{
S_OutNum(self, (float)ir/255.);
S_OutNum(self, (float)ig/255.);
S_OutNum(self, (float)ib/255.);
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig));
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib));
S_OutTok(self, "sc", 1);
}
}
@ -636,7 +638,7 @@ PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex, int res,
/*
* Initialize the structure
*/
psout->CurColor = 0xFFFFFFFF;
psout->CurColor = PSOUTCOLOR_NOCOLOR;
psout->LineWidth = 1;
psout->LineCap = PsCButt;
psout->LineJoin = PsJMiter;
@ -723,7 +725,7 @@ void
PsOut_DirtyAttributes(PsOutPtr self)
{
int i;
self->CurColor = 0xFFFFFFFF;
self->CurColor = PSOUTCOLOR_NOCOLOR;
self->LineWidth = -1;
self->LineCap = (PsCapEnum)-1;
self->LineJoin = (PsJoinEnum)-1;
@ -911,7 +913,7 @@ PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf)
}
void
PsOut_Color(PsOutPtr self, int clr)
PsOut_Color(PsOutPtr self, PsOutColor clr)
{
if( clr==self->CurColor || self->InTile>=PsStip ) return;
self->CurColor = clr;
@ -926,7 +928,7 @@ PsOut_FillRule(PsOutPtr self, PsRuleEnum rule)
void
PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap, PsJoinEnum join,
int nDsh, int *dsh, int dshOff, int bclr)
int nDsh, int *dsh, int dshOff, PsOutColor bclr)
{
int i;
int same = 1;
@ -973,7 +975,10 @@ PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap, PsJoinEnum join,
S_OutTok(self, "ds", 1);
}
if( nDsh ) self->LineBClr = bclr; else bclr = -1;
if( nDsh )
self->LineBClr = bclr;
else
bclr = PSOUTCOLOR_NOCOLOR;
}
void
@ -1094,7 +1099,7 @@ PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts)
if( i==0 ) S_OutTok(self, "m", 0);
else S_OutTok(self, "l", 0);
}
if( self->LineBClr>=0 )
if( self->LineBClr != PSOUTCOLOR_NOCOLOR )
{
S_OutTok(self, "gs", 0);
S_Color(self, self->LineBClr);
@ -1133,7 +1138,7 @@ PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h)
S_OutNum(self, (float)w);
S_OutNum(self, (float)h);
S_OutTok(self, "R", 0);
if( self->LineBClr>=0 )
if( self->LineBClr != PSOUTCOLOR_NOCOLOR )
{
S_OutTok(self, "gs", 0);
S_Color(self, self->LineBClr);
@ -1159,7 +1164,7 @@ PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
S_OutNum(self, ang1+ang2);
if( ang2<0 ) S_OutTok(self, "An", 0);
else S_OutTok(self, "Ac", 0);
if( self->LineBClr>=0 )
if( self->LineBClr != PSOUTCOLOR_NOCOLOR )
{
S_OutTok(self, "gs", 0);
S_Color(self, self->LineBClr);
@ -1169,7 +1174,7 @@ PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
}
void
PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, int bclr)
PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, PsOutColor bclr)
{
int xo = self->XOff;
int yo = self->YOff;
@ -1179,21 +1184,23 @@ PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, int bclr)
S_OutStr(self, text, textl);
S_OutNum(self, (float)x);
S_OutNum(self, (float)y);
if( bclr<0 ) S_OutTok(self, "T", 1);
if( bclr == PSOUTCOLOR_NOCOLOR )
S_OutTok(self, "T", 1);
else
{
int ir = bclr>>16;
int ig = (bclr>>8)&0xFF;
int ib = bclr&0xFF;
S_OutNum(self, (float)ir/255.);
S_OutNum(self, (float)ig/255.);
S_OutNum(self, (float)ib/255.);
int ir = PSOUTCOLOR_TO_REDBITS(bclr);
int ig = PSOUTCOLOR_TO_GREENBITS(bclr);
int ib = PSOUTCOLOR_TO_BLUEBITS(bclr);
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig));
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib));
S_OutTok(self, "Tb", 1);
}
}
void
PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, int bclr)
PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr)
{
int xo = self->XOff;
int yo = self->YOff;
@ -1203,22 +1210,23 @@ PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, int b
S_OutStr16(self, text, textl);
S_OutNum(self, (float)x);
S_OutNum(self, (float)y);
if( bclr<0 ) S_OutTok(self, "T", 1);
if( bclr == PSOUTCOLOR_NOCOLOR )
S_OutTok(self, "T", 1);
else
{
int ir = bclr>>16;
int ig = (bclr>>8)&0xFF;
int ib = bclr&0xFF;
S_OutNum(self, (float)ir/255.);
S_OutNum(self, (float)ig/255.);
S_OutNum(self, (float)ib/255.);
int ir = PSOUTCOLOR_TO_REDBITS(bclr);
int ig = PSOUTCOLOR_TO_GREENBITS(bclr);
int ib = PSOUTCOLOR_TO_BLUEBITS(bclr);
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig));
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib));
S_OutTok(self, "Tb", 1);
}
}
#ifdef BM_CACHE
void /* new */
PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, PsOutColor bclr, PsOutColor fclr)
{
char cacheID[10];
int xo = self->XOff;
@ -1231,22 +1239,26 @@ PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
S_OutNum(self, (float)x);
S_OutNum(self, (float)y);
if( fclr==0xFFFFFF )
if( fclr==PSOUTCOLOR_WHITE )
{
int ir, ig, ib;
ir = bclr>>16; ig = (bclr>>8)&0xFF; ib = bclr&0xFF;
int ir = PSOUTCOLOR_TO_REDBITS(bclr);
int ig = PSOUTCOLOR_TO_GREENBITS(bclr);
int ib = PSOUTCOLOR_TO_BLUEBITS(bclr);
if( ir==ig && ig==ib )
S_OutNum(self, (float)ir/255.);
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
else
S_OutNum(self, (float)0);
self->RevImage = 1;
}
else
{
int ir, ig, ib;
ir = fclr>>16; ig = (fclr>>8)&0xFF; ib = fclr&0xFF;
int ir = PSOUTCOLOR_TO_REDBITS(fclr);
int ig = PSOUTCOLOR_TO_GREENBITS(fclr);
int ib = PSOUTCOLOR_TO_BLUEBITS(fclr);
if( ir==ig && ig==ib )
S_OutNum(self, (float)ir/255.);
S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
else
S_OutNum(self, (float)0);
}
@ -1272,10 +1284,10 @@ PsOut_EndImageCache(PsOutPtr self)
#endif
void
PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
int w, int h, int sw, int sh, int format)
{
int savClr = self->CurColor;
PsOutColor savClr = self->CurColor;
int xo = self->XOff;
int yo = self->YOff;
@ -1291,7 +1303,7 @@ PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
S_OutTok(self, "<", 0);
self->ImageFormat = format;
self->RevImage = 0;
if( self->InTile==PsTile && format==1 && fclr==0xFFFFFF )
if( self->InTile==PsTile && format==1 && fclr==PSOUTCOLOR_WHITE )
self->RevImage = 1;
return;
}
@ -1300,7 +1312,7 @@ PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
if( format==1 )
{
S_OutTok(self, "gs", 0);
if( fclr==0xFFFFFF )
if( fclr==PSOUTCOLOR_WHITE )
{
PsOut_Color(self, fclr);
PsOut_FillRect(self, x, y, sw, sh);
@ -1332,10 +1344,10 @@ PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
}
void
PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
int w, int h, int sw, int sh, int format)
{
int savClr = self->CurColor;
PsOutColor savClr = self->CurColor;
int xo = self->XOff;
int yo = self->YOff;
@ -1351,7 +1363,7 @@ PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
S_OutTok(self, "<", 0);
self->ImageFormat = format;
self->RevImage = 0;
if( self->InTile==PsTile && format==1 && fclr==0xFFFFFF )
if( self->InTile==PsTile && format==1 && fclr==PSOUTCOLOR_WHITE )
self->RevImage = 1;
return;
}
@ -1363,7 +1375,7 @@ PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
#ifdef BM_CACHE
S_OutTok(self, "g", 1);
#else
if( fclr==0xFFFFFF )
if( fclr==PSOUTCOLOR_WHITE )
{
PsOut_Color(self, bclr);
self->RevImage = 1;
@ -1411,7 +1423,7 @@ PsOut_EndImage(PsOutPtr self)
S_OutTok(self, ">", 1);
if( self->ImageFormat==1 && self->InTile==PsTile )
{
if( self->ImgFClr==0xFFFFFF )
if( self->ImgFClr==PSOUTCOLOR_WHITE )
{
PsOut_Color(self, self->ImgFClr);
PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH);
@ -1436,14 +1448,16 @@ PsOut_EndImage(PsOutPtr self)
self->RevImage = 0;
return;
}
/*
* Bug 4639307: Move flush before "> im" to get all of bitmap into ps file.
*/
S_Flush(self);
#ifdef BM_CACHE
if(self->start_image)
S_OutTok(self, "> im", 1); /* new */
#endif
self->ImageFormat = 0;
self->RevImage = 0;
S_Flush(self);
#ifdef BM_CACHE
if(self->start_image)
{
@ -1509,7 +1523,7 @@ PsOut_EndFrame(PsOutPtr self)
int
PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
int bclr, int fclr)
PsOutColor bclr, PsOutColor fclr)
{
int i;
char key[64];
@ -1585,7 +1599,7 @@ PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
case PsOpStip: key[0] = 'o'; break; }
S_OutTok(self, key, 0);
S_OutTok(self, "spt", 1);
self->CurColor = 0xFFFFFFFF;
self->CurColor = PSOUTCOLOR_NOCOLOR;
}
void

View File

@ -153,6 +153,30 @@ typedef enum PsFTDownloadFontType_
PsFontType3
} PsFTDownloadFontType;
#ifdef PSOUT_USE_DEEPCOLOR
typedef long long PsOutColor;
#define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 32)
#define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 16) & 0xFFFF)
#define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFFFF)
#define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 65535.)
#define PSOUTCOLOR_WHITE (0xFFFFFFFFFFFFLL)
#define PSOUTCOLOR_NOCOLOR (-1LL)
#define PSOUTCOLOR_TO_RGB24BIT(clr) (((PSOUTCOLOR_TO_REDBITS(clr) >> 8) << 16) | \
((PSOUTCOLOR_TO_GREENBITS(clr) >> 8) << 8) | \
((PSOUTCOLOR_TO_BLUEBITS(clr) >> 8) << 0))
#else
typedef long PsOutColor;
#define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 16)
#define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 8) & 0xFF)
#define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFF)
#define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 255.)
#define PSOUTCOLOR_WHITE (0xFFFFFF)
#define PSOUTCOLOR_NOCOLOR (-1)
#define PSOUTCOLOR_TO_RGB24BIT(clr) ((PSOUTCOLOR_TO_REDBITS(clr) << 16) | \
(PSOUTCOLOR_TO_GREENBITS(clr) << 8) | \
(PSOUTCOLOR_TO_BLUEBITS(clr) << 0))
#endif /* PSOUT_USE_DEEPCOLOR */
#ifdef USE_PSOUT_PRIVATE
typedef void *voidPtr;
@ -168,14 +192,14 @@ typedef struct PsOutRec_
{
FILE *Fp;
char Buf[16384];
int CurColor;
PsOutColor CurColor;
int LineWidth;
PsCapEnum LineCap;
PsJoinEnum LineJoin;
int NDashes;
int *Dashes;
int DashOffset;
int LineBClr;
PsOutColor LineBClr;
PsRuleEnum FillRule;
char *FontName;
int FontSize;
@ -193,8 +217,8 @@ typedef struct PsOutRec_
PsFillEnum InTile;
int ImgSkip;
int ImgBClr;
int ImgFClr;
PsOutColor ImgBClr;
PsOutColor ImgFClr;
int ImgX;
int ImgY;
int ImgW;
@ -230,11 +254,11 @@ extern void PsOut_Offset(PsOutPtr self, int x, int y);
extern void PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf);
extern void PsOut_Color(PsOutPtr self, int clr);
extern void PsOut_Color(PsOutPtr self, PsOutColor clr);
extern void PsOut_FillRule(PsOutPtr self, PsRuleEnum rule);
extern void PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap,
PsJoinEnum join, int nDsh, int *dsh, int dshOff,
int bclr);
PsOutColor bclr);
extern void PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso);
extern void PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso);
@ -250,12 +274,12 @@ extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
float ang1, float ang2);
extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
int bclr);
extern void PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, int bclr);
PsOutColor bclr);
extern void PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr);
extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
extern void PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
int w, int h, int sw, int sh, int format);
extern void PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
extern void PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
int w, int h, int sw, int sh, int format);
extern void PsOut_EndImage(PsOutPtr self);
extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
@ -265,7 +289,7 @@ extern void PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y,
extern void PsOut_EndFrame(PsOutPtr self);
extern int PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h,
PsFillEnum type, int bclr, int fclr);
PsFillEnum type, PsOutColor bclr, PsOutColor fclr);
extern void PsOut_EndPattern(PsOutPtr self);
extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);

View File

@ -125,7 +125,7 @@ copyright holders.
"| sort -u` " \
"| nawk -F: ' NF == 2 { name=$1 } " \
" NF == 1 { sub(\"^.*description\\( - undefined|=\\)\",\"\"); " \
" printf \"%sxp-printerattr.descriptor=%s\\n\", name, $1 } '"
" printf \"%s\txp-printerattr.descriptor=%s\\n\", name, $1 } '"
#define LIST_QUEUES_OTHER \
"LANG=C lpstat -v | " \

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.4 2004/07/29 18:43:58 stukreit Exp $ */
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.5 2004/07/31 01:48:27 anholt Exp $ */
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
/************************************************************

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xc/programs/Xserver/dix/main.c,v 1.2 2004/04/23 19:04:44 eich Exp $ */
/* $XdotOrg: xc/programs/Xserver/dix/main.c,v 1.3 2004/06/30 20:06:53 kem Exp $ */
/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.43 2003/10/30 21:21:02 herrb Exp $ */
/***********************************************************
@ -689,7 +689,7 @@ AddScreen(
if (i == MAXSCREENS)
return -1;
pScreen = (ScreenPtr) xalloc(sizeof(ScreenRec));
pScreen = (ScreenPtr) xcalloc(1, sizeof(ScreenRec));
if (!pScreen)
return -1;

View File

@ -22,7 +22,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $XdotOrg: xc/programs/Xserver/fb/fb.h,v 1.5 2004/07/30 20:30:51 ajax Exp $ */
/* $XdotOrg: xc/programs/Xserver/fb/fb.h,v 1.6 2004/08/11 21:14:17 kem Exp $ */
#ifndef _FB_H_
#define _FB_H_
@ -647,7 +647,7 @@ typedef struct {
((WindowPtr) (pWin))->devPrivates[fbGetWinPrivateIndex()].ptr)
#endif
#if defined(__DARWIN__)||defined(__CYGWIN__)
#ifdef ROOTLESS
#define __fbPixOriginX(pPix) ((pPix)->drawable.x)
#define __fbPixOriginY(pPix) ((pPix)->drawable.y)
#else

View File

@ -1,4 +1,4 @@
/* $XdotOrg: xc/programs/Xserver/fb/fbwindow.c,v 1.3 2004/08/11 22:40:14 keithp Exp $ */
/* $XdotOrg: xc/programs/Xserver/fb/fbwindow.c,v 1.4 2004/08/13 08:16:14 keithp Exp $ */
/*
* Id: fbwindow.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
@ -122,12 +122,9 @@ fbCopyWindow(WindowPtr pWin,
{
RegionRec rgnDst;
int dx, dy;
#ifdef COMPOSITE
PixmapPtr pPixmap = fbGetWindowPixmap (pWin);
DrawablePtr pDrawable = &pPixmap->drawable;
#else
DrawablePtr pDrawable = &WindowTable[pWin->drawable.pScreen->myNum]->drawable;
#endif
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;

View File

@ -1,34 +0,0 @@
XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.7 2001/05/23 08:56:08 alanh Exp $
KDRIVE=.
#include "Kdrive.tmpl"
#if BuildRender
RENDERSRCS=kpict.c
RENDEROBJS=kpict.o
#endif
#if BuildXvExt
XVSRCS=kxv.c
XVOBJS=kxv.o
#endif
#if XipaqServer
DEFINES = -DXIPAQ
#endif
SRCS = kaa.c kcmap.c kcolor.c kdrive.c kinfo.c kinput.c kmap.c knoop.c ktest.c \
vga.c kasync.c kmode.c kcurscol.c kshadow.c $(RENDERSRCS) $(XVSRCS)
OBJS = kaa.o kcmap.o kcolor.o kdrive.o kinfo.o kinput.o kmap.o knoop.o ktest.o \
vga.o kasync.o kmode.o kcurscol.o kshadow.o $(RENDEROBJS) $(XVOBJS)
INCLUDES = $(KDINCS)
NormalLibraryObjectRule()
NormalLibraryTarget(kdrive,$(OBJS))
SpecialCObjectRule(kdrive,,$(EXT_DEFINES))
InstallManPage(Xkdrive,$(MANDIR))
DependTarget()

View File

@ -1,17 +0,0 @@
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $
#include <Server.tmpl>
#if BuildRender
RENDERINCS=-I$(KDRIVE)/../../render
#endif
#if BuildRandR
RANDRINCS=-I$(KDRIVE)/../../randr
#endif
KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \
-I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \
-I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \
-I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS)

View File

@ -1,27 +0,0 @@
if KDRIVEVESA
VESA_SUBDIRS = vesa mach64 mga nvidia r128 smi chips pm2 via neomagic
endif
if KDRIVEFBDEV
FBDEV_SUBDIRS = fbdev
endif
if XSDLSERVER
XSDL_SUBDIRS=sdl
endif
if XEPHYR
XEPHYR_SUBDIRS = ephyr
endif
SUBDIRS = \
src \
linux \
$(XSDL_SUBDIRS) \
$(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \
$(XEPHYR_SUBDIRS) \
ati \
fake \
ephyr \
i810

View File

@ -1,77 +0,0 @@
.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $
.\"
.TH Xkdrive 1 __vendorversion__
.SH NAME
Xkdrive \- tiny X server
.SH SYNOPSIS
.B Xvesa
.RI [ :display ]
.RI [ option ...]
.B Xfbdev
.RI [ :display ]
.RI [ option ...]
.B Xigs
.RI [ :display ]
.RI [ option ...]
.B Xtrident
.RI [ :display ]
.RI [ option ...]
.B Xsis530
.RI [ :display ]
.RI [ option ...]
.B Xtrio
.RI [ :display ]
.RI [ option ...]
.B Xitsy
.RI [ :display ]
.RI [ option ...]
.SH DESCRIPTION
.B Xkdrive
is a family of X servers designed to be particularly small. This
manual page describes the common functionality of the
.B Xkdrive
servers; for information on a specific X server, please refer to the
relevant manual page.
.SH OPTIONS
In addition to the standard options accepted by all X servers (see
Xserver(1)), all the
.B Xkdrive
servers accept the following options:
.TP 8
.B -card \fIpcmcia\fP
use pcmcia card as additional screen.
.TP 8
.B -dumb
disable hardware acceleration.
.TP 8
.B -origin \fIX\fP,\fIY\fP
Locates the next screen in the Xinerama virtual screen.
.TP 8
.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB
use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values).
.TP 8
.B -softCursor
disable the hardware cursor.
.TP 8
.B -videoTest
start the server, pause momentarily, and exit.
.TP 8
.B -zaphod
disable switching screens by moving the pointer across a screen boundary.
.TP 8
.B -2button
enable emulation of a middle mouse button by chording.
.TP 8
.B -3button
disable emulation of a middle mouse button by chording.
.SH SEE ALSO
X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1).
.SH AUTHORS
The Xkdrive common core was written by Keith Packard,
and is based on the Sample Implementation of X.

View File

@ -1,71 +0,0 @@
if DRI
DRI_INCLUDES = -I$(top_srcdir)/dri \
-I$(top_srcdir)/drm
DRI_LIBS = $(top_builddir)/dri/libdri.a \
$(top_builddir)/drm/libdrm.a
DRI_SOURCES = ati_dri.c \
ati_dri.h \
ati_dripriv.h \
r128_common.h \
r128_sarea.h \
radeon_common.h \
radeon_sarea.h
endif
if KDRIVEFBDEV
FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev
FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
endif
if KDRIVEVESA
VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
endif
INCLUDES = \
@KDRIVE_INCS@ \
$(DRI_INCLUDES) \
$(FBDEV_INCLUDES) \
$(VESA_INCLUDES) \
@XSERVER_CFLAGS@
bin_PROGRAMS = Xati
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libati.a
libati_a_SOURCES = \
ati_cursor.c \
ati_dma.c \
ati_dma.h \
ati_draw.c \
ati_draw.h \
ati_microcode.c \
ati.c \
ati.h \
ati_reg.h \
r128_composite.c \
ati_video.c \
radeon_composite.c \
$(DRI_SOURCES)
Xati_SOURCES = \
ati_stub.c
ATI_LIBS = \
libati.a \
$(FBDEV_LIBS) \
$(VESA_LIBS) \
$(DRI_LIBS) \
@KDRIVE_LIBS@
Xati_LDADD = \
$(ATI_LIBS) \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xati_DEPENDENCIES = $(ATI_LIBS) @KDRIVE_LIBS@

View File

@ -1,765 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ati.h"
#include "ati_reg.h"
#if defined(USE_DRI) && defined(GLXEXT)
#include "ati_sarea.h"
#endif
static Bool ATIIsAGP(ATICardInfo *atic);
#define CAP_SERIESMASK 0xf
#define CAP_R128 0x1 /* If it's a Rage 128 */
#define CAP_R100 0x2 /* If it's an r100 series radeon. */
#define CAP_R200 0x3 /* If it's an r200 series radeon. */
#define CAP_R300 0x4 /* If it's an r300 series radeon. */
#define CAP_FEATURESMASK 0xf0
#define CAP_NOAGP 0x10 /* If it's a PCI-only card. */
struct pci_id_entry ati_pci_ids[] = {
{0x1002, 0x4136, 0x2, "ATI Radeon RS100"},
{0x1002, 0x4137, 0x2, "ATI Radeon RS200"},
{0x1002, 0x4237, 0x2, "ATI Radeon RS250"},
{0x1002, 0x4144, 0x4, "ATI Radeon R300 AD"},
{0x1002, 0x4145, 0x4, "ATI Radeon R300 AE"},
{0x1002, 0x4146, 0x4, "ATI Radeon R300 AF"},
{0x1002, 0x4147, 0x4, "ATI Radeon R300 AG"},
{0x1002, 0x4148, 0x4, "ATI Radeon R350 AH"},
{0x1002, 0x4149, 0x4, "ATI Radeon R350 AI"},
{0x1002, 0x414a, 0x4, "ATI Radeon R350 AJ"},
{0x1002, 0x414b, 0x4, "ATI Radeon R350 AK"},
{0x1002, 0x4150, 0x4, "ATI Radeon RV350 AP"},
{0x1002, 0x4151, 0x4, "ATI Radeon RV350 AQ"},
{0x1002, 0x4152, 0x4, "ATI Radeon RV350 AR"},
{0x1002, 0x4153, 0x4, "ATI Radeon RV350 AS"},
{0x1002, 0x4154, 0x4, "ATI Radeon RV350 AT"},
{0x1002, 0x4156, 0x4, "ATI Radeon RV350 AV"},
{0x1002, 0x4242, 0x3, "ATI Radeon R200 BB"},
{0x1002, 0x4243, 0x3, "ATI Radeon R200 BC"},
{0x1002, 0x4336, 0x2, "ATI Radeon RS100"},
{0x1002, 0x4337, 0x2, "ATI Radeon RS200"},
{0x1002, 0x4437, 0x2, "ATI Radeon RS250"},
{0x1002, 0x4964, 0x2, "ATI Radeon RV250 Id"},
{0x1002, 0x4965, 0x2, "ATI Radeon RV250 Ie"},
{0x1002, 0x4966, 0x2, "ATI Radeon RV250 If"},
{0x1002, 0x4967, 0x2, "ATI Radeon R250 Ig"},
{0x1002, 0x4c45, 0x11, "ATI Rage 128 LE"},
{0x1002, 0x4c46, 0x1, "ATI Rage 128 LF"},
{0x1002, 0x4c57, 0x2, "ATI Radeon Mobiliy M7 RV200 LW (7500)"},
{0x1002, 0x4c58, 0x2, "ATI Radeon Mobiliy M7 RV200 LX (7500)"},
{0x1002, 0x4c59, 0x2, "ATI Radeon Mobility M6 LY"},
{0x1002, 0x4c5a, 0x2, "ATI Radeon Mobility M6 LZ"},
{0x1002, 0x4c64, 0x3, "ATI Radeon RV250 Ld"},
{0x1002, 0x4c65, 0x3, "ATI Radeon RV250 Le"},
{0x1002, 0x4c66, 0x3, "ATI Radeon Mobility M9 RV250 Lf"},
{0x1002, 0x4c67, 0x3, "ATI Radeon RV250 Lg"},
{0x1002, 0x4d46, 0x1, "ATI Rage 128 MF"},
{0x1002, 0x4d46, 0x1, "ATI Rage 128 ML"},
{0x1002, 0x4e44, 0x4, "ATI Radeon R300 ND"},
{0x1002, 0x4e45, 0x4, "ATI Radeon R300 NE"},
{0x1002, 0x4e46, 0x4, "ATI Radeon R300 NF"},
{0x1002, 0x4e47, 0x4, "ATI Radeon R300 NG"},
{0x1002, 0x4e48, 0x4, "ATI Radeon R350 NH"},
{0x1002, 0x4e49, 0x4, "ATI Radeon R350 NI"},
{0x1002, 0x4e4a, 0x4, "ATI Radeon R350 NJ"},
{0x1002, 0x4e4b, 0x4, "ATI Radeon R350 NK"},
{0x1002, 0x4e50, 0x4, "ATI Radeon Mobility RV350 NP"},
{0x1002, 0x4e51, 0x4, "ATI Radeon Mobility RV350 NQ"},
{0x1002, 0x4e52, 0x4, "ATI Radeon Mobility RV350 NR"},
{0x1002, 0x4e53, 0x4, "ATI Radeon Mobility RV350 NS"},
{0x1002, 0x4e54, 0x4, "ATI Radeon Mobility RV350 NT"},
{0x1002, 0x4e56, 0x4, "ATI Radeon Mobility RV350 NV"},
{0x1002, 0x5041, 0x1, "ATI Rage 128 PA"},
{0x1002, 0x5042, 0x1, "ATI Rage 128 PB"},
{0x1002, 0x5043, 0x1, "ATI Rage 128 PC"},
{0x1002, 0x5044, 0x11, "ATI Rage 128 PD"},
{0x1002, 0x5045, 0x1, "ATI Rage 128 PE"},
{0x1002, 0x5046, 0x1, "ATI Rage 128 PF"},
{0x1002, 0x5047, 0x1, "ATI Rage 128 PG"},
{0x1002, 0x5048, 0x1, "ATI Rage 128 PH"},
{0x1002, 0x5049, 0x1, "ATI Rage 128 PI"},
{0x1002, 0x504a, 0x1, "ATI Rage 128 PJ"},
{0x1002, 0x504b, 0x1, "ATI Rage 128 PK"},
{0x1002, 0x504c, 0x1, "ATI Rage 128 PL"},
{0x1002, 0x504d, 0x1, "ATI Rage 128 PM"},
{0x1002, 0x504e, 0x1, "ATI Rage 128 PN"},
{0x1002, 0x504f, 0x1, "ATI Rage 128 PO"},
{0x1002, 0x5050, 0x11, "ATI Rage 128 PP"},
{0x1002, 0x5051, 0x1, "ATI Rage 128 PQ"},
{0x1002, 0x5052, 0x11, "ATI Rage 128 PR"},
{0x1002, 0x5053, 0x1, "ATI Rage 128 PS"},
{0x1002, 0x5054, 0x1, "ATI Rage 128 PT"},
{0x1002, 0x5055, 0x1, "ATI Rage 128 PU"},
{0x1002, 0x5056, 0x1, "ATI Rage 128 PV"},
{0x1002, 0x5057, 0x1, "ATI Rage 128 PW"},
{0x1002, 0x5058, 0x1, "ATI Rage 128 PX"},
{0x1002, 0x5144, 0x2, "ATI Radeon R100 QD"},
{0x1002, 0x5145, 0x2, "ATI Radeon R100 QE"},
{0x1002, 0x5146, 0x2, "ATI Radeon R100 QF"},
{0x1002, 0x5147, 0x2, "ATI Radeon R100 QG"},
{0x1002, 0x5148, 0x3, "ATI Radeon R200 QH"},
{0x1002, 0x514c, 0x3, "ATI Radeon R200 QL"},
{0x1002, 0x514d, 0x3, "ATI Radeon R200 QM"},
{0x1002, 0x5157, 0x2, "ATI Radeon RV200 QW (7500)"},
{0x1002, 0x5158, 0x2, "ATI Radeon RV200 QX (7500)"},
{0x1002, 0x5159, 0x2, "ATI Radeon RV100 QY"},
{0x1002, 0x515a, 0x2, "ATI Radeon RV100 QZ"},
{0x1002, 0x5245, 0x11, "ATI Rage 128 RE"},
{0x1002, 0x5246, 0x1, "ATI Rage 128 RF"},
{0x1002, 0x5247, 0x1, "ATI Rage 128 RG"},
{0x1002, 0x524b, 0x11, "ATI Rage 128 RK"},
{0x1002, 0x524c, 0x1, "ATI Rage 128 RL"},
{0x1002, 0x5345, 0x1, "ATI Rage 128 SE"},
{0x1002, 0x5346, 0x1, "ATI Rage 128 SF"},
{0x1002, 0x5347, 0x1, "ATI Rage 128 SG"},
{0x1002, 0x5348, 0x1, "ATI Rage 128 SH"},
{0x1002, 0x534b, 0x1, "ATI Rage 128 SK"},
{0x1002, 0x534c, 0x1, "ATI Rage 128 SL"},
{0x1002, 0x534d, 0x1, "ATI Rage 128 SM"},
{0x1002, 0x534e, 0x1, "ATI Rage 128 SN"},
{0x1002, 0x5446, 0x1, "ATI Rage 128 TF"},
{0x1002, 0x544c, 0x1, "ATI Rage 128 TL"},
{0x1002, 0x5452, 0x1, "ATI Rage 128 TR"},
{0x1002, 0x5453, 0x1, "ATI Rage 128 TS"},
{0x1002, 0x5454, 0x1, "ATI Rage 128 TT"},
{0x1002, 0x5455, 0x1, "ATI Rage 128 TU"},
{0x1002, 0x5834, 0x3, "ATI Radeon RS300"},
{0x1002, 0x5835, 0x3, "ATI Radeon RS300 Mobility"},
{0x1002, 0x5941, 0x3, "ATI Radeon RV280 (9200)"},
{0x1002, 0x5961, 0x3, "ATI Radeon RV280 (9200 SE)"},
{0x1002, 0x5964, 0x3, "ATI Radeon RV280 (9200 SE)"},
{0x1002, 0x5c60, 0x3, "ATI Radeon RV280"},
{0x1002, 0x5c61, 0x3, "ATI Radeon RV280 Mobility"},
{0x1002, 0x5c62, 0x3, "ATI Radeon RV280"},
{0x1002, 0x5c63, 0x3, "ATI Radeon RV280 Mobility"},
{0x1002, 0x5c64, 0x3, "ATI Radeon RV280"},
{0, 0, 0, NULL}
};
static char *
make_busid(KdCardAttr *attr)
{
char *busid;
busid = xalloc(20);
if (busid == NULL)
return NULL;
snprintf(busid, 20, "pci:%04x:%02x:%02x.%d", attr->domain, attr->bus,
attr->slot, attr->func);
return busid;
}
static Bool
ATICardInit(KdCardInfo *card)
{
ATICardInfo *atic;
int i;
Bool initialized = FALSE;
atic = xcalloc(sizeof(ATICardInfo), 1);
if (atic == NULL)
return FALSE;
#ifdef KDRIVEFBDEV
if (!initialized && fbdevInitialize(card, &atic->backend_priv.fbdev)) {
atic->use_fbdev = TRUE;
initialized = TRUE;
atic->backend_funcs.cardfini = fbdevCardFini;
atic->backend_funcs.scrfini = fbdevScreenFini;
atic->backend_funcs.initScreen = fbdevInitScreen;
atic->backend_funcs.finishInitScreen = fbdevFinishInitScreen;
atic->backend_funcs.createRes = fbdevCreateResources;
atic->backend_funcs.preserve = fbdevPreserve;
atic->backend_funcs.restore = fbdevRestore;
atic->backend_funcs.dpms = fbdevDPMS;
atic->backend_funcs.enable = fbdevEnable;
atic->backend_funcs.disable = fbdevDisable;
atic->backend_funcs.getColors = fbdevGetColors;
atic->backend_funcs.putColors = fbdevPutColors;
#ifdef RANDR
atic->backend_funcs.randrSetConfig = fbdevRandRSetConfig;
#endif
}
#endif
#ifdef KDRIVEVESA
if (!initialized && vesaInitialize(card, &atic->backend_priv.vesa)) {
atic->use_vesa = TRUE;
initialized = TRUE;
atic->backend_funcs.cardfini = vesaCardFini;
atic->backend_funcs.scrfini = vesaScreenFini;
atic->backend_funcs.initScreen = vesaInitScreen;
atic->backend_funcs.finishInitScreen = vesaFinishInitScreen;
atic->backend_funcs.createRes = vesaCreateResources;
atic->backend_funcs.preserve = vesaPreserve;
atic->backend_funcs.restore = vesaRestore;
atic->backend_funcs.dpms = vesaDPMS;
atic->backend_funcs.enable = vesaEnable;
atic->backend_funcs.disable = vesaDisable;
atic->backend_funcs.getColors = vesaGetColors;
atic->backend_funcs.putColors = vesaPutColors;
#ifdef RANDR
atic->backend_funcs.randrSetConfig = vesaRandRSetConfig;
#endif
}
#endif
if (!initialized || !ATIMapReg(card, atic)) {
xfree(atic);
return FALSE;
}
atic->busid = make_busid(&card->attr);
if (atic->busid == NULL) {
xfree(atic);
return FALSE;
}
#ifdef USE_DRI
/* We demand identification by busid, not driver name */
atic->drmFd = drmOpen(NULL, atic->busid);
if (atic->drmFd < 0)
ErrorF("Failed to open DRM, DRI disabled.\n");
#endif /* USE_DRI */
card->driver = atic;
for (i = 0; ati_pci_ids[i].name != NULL; i++) {
if (ati_pci_ids[i].device == card->attr.deviceID) {
atic->pci_id = &ati_pci_ids[i];
break;
}
}
if ((atic->pci_id->caps & CAP_SERIESMASK) != CAP_R128)
atic->is_radeon = TRUE;
if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R100)
atic->is_r100 = TRUE;
if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R200)
atic->is_r200 = TRUE;
if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R300)
atic->is_r300 = TRUE;
atic->is_agp = ATIIsAGP(atic);
ErrorF("Using ATI card: %s (%s) at %s\n", atic->pci_id->name,
atic->is_agp ? "AGP" : "PCI", atic->busid);
return TRUE;
}
static void
ATICardFini(KdCardInfo *card)
{
ATICardInfo *atic = (ATICardInfo *)card->driver;
ATIUnmapReg(card, atic);
atic->backend_funcs.cardfini(card);
}
/*
* Once screen->off_screen_base is set, this function
* allocates the remaining memory appropriately
*/
static void
ATISetOffscreen (KdScreenInfo *screen)
{
ATICardInfo(screen);
#if defined(USE_DRI) && defined(GLXEXT)
ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
int l;
#endif
int screen_size;
char *mmio = atic->reg_base;
/* check (and adjust) pitch */
if (mmio)
{
int byteStride = screen->fb[0].byteStride;
int bitStride;
int pixelStride;
int bpp = screen->fb[0].bitsPerPixel;
/*
* Ensure frame buffer is correctly aligned
*/
if (byteStride & 0x3f)
{
byteStride = (byteStride + 0x3f) & ~0x3f;
bitStride = byteStride * 8;
pixelStride = bitStride / bpp;
screen->fb[0].byteStride = byteStride;
screen->fb[0].pixelStride = pixelStride;
}
}
screen_size = screen->fb[0].byteStride * screen->height;
screen->off_screen_base = screen_size;
#if defined(USE_DRI) && defined(GLXEXT)
/* Reserve a static area for the back buffer the same size as the
* visible screen. XXX: This would be better initialized in ati_dri.c
* when GLX is set up, but the offscreen memory manager's allocations
* don't last through VT switches, while the kernel's understanding of
* offscreen locations does.
*/
atis->frontOffset = 0;
atis->frontPitch = screen->fb[0].byteStride;
if (screen->off_screen_base + screen_size <= screen->memory_size) {
atis->backOffset = screen->off_screen_base;
atis->backPitch = screen->fb[0].byteStride;
screen->off_screen_base += screen_size;
}
/* Reserve the depth span for Rage 128 */
if (!atic->is_radeon && screen->off_screen_base +
screen->fb[0].byteStride <= screen->memory_size) {
atis->spanOffset = screen->off_screen_base;
screen->off_screen_base += screen->fb[0].byteStride;
}
/* Reserve the static depth buffer, which happens to be the same
* bitsPerPixel as the screen.
*/
if (screen->off_screen_base + screen_size <= screen->memory_size) {
atis->depthOffset = screen->off_screen_base;
atis->depthPitch = screen->fb[0].byteStride;
screen->off_screen_base += screen_size;
}
/* Reserve approx. half of remaining offscreen memory for local
* textures. Round down to a whole number of texture regions.
*/
atis->textureSize = (screen->memory_size - screen->off_screen_base) / 2;
l = ATILog2(atis->textureSize / ATI_NR_TEX_REGIONS);
if (l < ATI_LOG_TEX_GRANULARITY)
l = ATI_LOG_TEX_GRANULARITY;
atis->textureSize = (atis->textureSize >> l) << l;
if (atis->textureSize >= 512 * 1024) {
atis->textureOffset = screen->off_screen_base;
screen->off_screen_base += atis->textureSize;
} else {
/* Minimum texture size is for 2 256x256x32bpp textures */
atis->textureSize = 0;
}
#endif /* USE_DRI && GLXEXT */
}
static void
ATISetPitch (KdScreenInfo *screen)
{
ATICardInfo(screen);
#if defined(USE_DRI) && defined(GLXEXT)
ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
int l;
#endif
char *mmio = atic->reg_base;
/* check (and adjust) pitch for radeon */
if (mmio)
{
int byteStride = screen->fb[0].byteStride;
int bitStride;
int pixelStride;
int bpp = screen->fb[0].bitsPerPixel;
CARD32 crtc_pitch;
CARD32 crtc2_pitch;
#if 0
CARD32 crtc_ext_cntl;
CARD32 dac_cntl;
#endif
bitStride = byteStride * 8;
pixelStride = bitStride / bpp;
crtc_pitch = (pixelStride >> 3);
crtc_pitch |= crtc_pitch << 16;
crtc2_pitch = (pixelStride >> 3);
crtc2_pitch |= crtc2_pitch << 16;
#if 0
crtc_ext_cntl = MMIO_IN32 (mmio, ATI_REG_CRTC_EXT_CNTL);
dac_cntl = MMIO_IN32 (mmio, ATI_REG_DAC_CNTL);
/* Turn off the screen */
MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL,
crtc_ext_cntl |
ATI_CRTC_VSYNC_DIS |
ATI_CRTC_HSYNC_DIS |
ATI_CRTC_DISPLAY_DIS);
MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL,
dac_cntl |
ATI_DAC_RANGE_CNTL |
ATI_DAC_BLANKING);
#endif
MMIO_OUT32 (mmio, ATI_REG_CRTC_PITCH, crtc_pitch);
MMIO_OUT32 (mmio, ATI_REG_CRTC2_PITCH, crtc2_pitch);
#if 0
/* Turn the screen back on */
MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL,
crtc_ext_cntl);
MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL,
dac_cntl);
#endif
}
}
static Bool
ATIScreenInit(KdScreenInfo *screen)
{
ATIScreenInfo *atis;
ATICardInfo(screen);
Bool success = FALSE;
atis = xcalloc(sizeof(ATIScreenInfo), 1);
if (atis == NULL)
return FALSE;
atis->atic = atic;
atis->screen = screen;
screen->driver = atis;
if (screen->fb[0].depth == 0)
screen->fb[0].depth = 16;
#ifdef KDRIVEFBDEV
if (atic->use_fbdev) {
success = fbdevScreenInitialize(screen,
&atis->backend_priv.fbdev);
}
#endif
#ifdef KDRIVEVESA
if (atic->use_vesa) {
success = vesaScreenInitialize(screen,
&atis->backend_priv.vesa);
}
#endif
if (!success) {
screen->driver = NULL;
xfree(atis);
return FALSE;
}
ATISetOffscreen (screen);
return TRUE;
}
#ifdef RANDR
static Bool
ATIRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
int rate,
RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
ATICardInfo *atic = screen->card->driver;
Bool ret;
ATIDrawDisable (pScreen);
ret = atic->backend_funcs.randrSetConfig(pScreen, randr, rate, pSize);
ATISetOffscreen (screen);
ATISetPitch (screen);
/*
* Set frame buffer mapping
*/
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
pScreen->width,
pScreen->height,
screen->fb[0].depth,
screen->fb[0].bitsPerPixel,
screen->fb[0].byteStride,
screen->fb[0].frameBuffer);
ATIDrawEnable (pScreen);
return ret;
}
static Bool
ATIRandRInit (ScreenPtr pScreen)
{
rrScrPrivPtr pScrPriv;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrSetConfig = ATIRandRSetConfig;
return TRUE;
}
#endif
static void
ATIScreenFini(KdScreenInfo *screen)
{
ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
ATICardInfo *atic = screen->card->driver;
#ifdef XV
ATIFiniVideo(screen->pScreen);
#endif
atic->backend_funcs.scrfini(screen);
xfree(atis);
screen->driver = 0;
}
Bool
ATIMapReg(KdCardInfo *card, ATICardInfo *atic)
{
atic->reg_base = (CARD8 *)KdMapDevice(ATI_REG_BASE(card),
ATI_REG_SIZE(card));
if (atic->reg_base == NULL)
return FALSE;
KdSetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card),
KD_MAPPED_MODE_REGISTERS);
return TRUE;
}
void
ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic)
{
if (atic->reg_base) {
KdResetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card),
KD_MAPPED_MODE_REGISTERS);
KdUnmapDevice((void *)atic->reg_base, ATI_REG_SIZE(card));
atic->reg_base = 0;
}
}
static Bool
ATIInitScreen(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
#ifdef XV
ATIInitVideo(pScreen);
#endif
return atic->backend_funcs.initScreen(pScreen);
}
static Bool
ATIFinishInitScreen(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
if (!atic->backend_funcs.finishInitScreen(pScreen))
return FALSE;
#ifdef RANDR
if (!ATIRandRInit (pScreen))
return FALSE;
#endif
return TRUE;
}
static Bool
ATICreateResources(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
return atic->backend_funcs.createRes(pScreen);
}
static void
ATIPreserve(KdCardInfo *card)
{
ATICardInfo *atic = card->driver;
char *mmio = atic->reg_base;
atic->backend_funcs.preserve(card);
if (atic->is_radeon && mmio)
{
atic->crtc_pitch = MMIO_IN32(mmio, ATI_REG_CRTC_PITCH);
atic->crtc2_pitch = MMIO_IN32(mmio, ATI_REG_CRTC2_PITCH);
}
}
static void
ATIRestore(KdCardInfo *card)
{
ATICardInfo *atic = card->driver;
char *mmio = atic->reg_base;
if (mmio)
{
MMIO_OUT32(mmio, ATI_REG_CRTC_PITCH, atic->crtc_pitch);
MMIO_OUT32(mmio, ATI_REG_CRTC2_PITCH, atic->crtc2_pitch);
}
ATIUnmapReg(card, atic);
atic->backend_funcs.restore(card);
}
static Bool
ATIDPMS(ScreenPtr pScreen, int mode)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
return atic->backend_funcs.dpms(pScreen, mode);
}
static Bool
ATIEnable(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
if (!atic->backend_funcs.enable(pScreen))
return FALSE;
if ((atic->reg_base == NULL) && !ATIMapReg(pScreenPriv->screen->card,
atic))
return FALSE;
ATISetOffscreen (pScreenPriv->screen);
ATISetPitch (pScreenPriv->screen);
return TRUE;
}
static void
ATIDisable(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
#if defined(USE_DRI) && defined(GLXEXT)
ATIScreenInfo(pScreenPriv);
#endif /* USE_DRI && GLXEXT */
ATICardInfo(pScreenPriv);
ATIUnmapReg(pScreenPriv->card, atic);
atic->backend_funcs.disable(pScreen);
}
static void
ATIGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
atic->backend_funcs.getColors(pScreen, fb, n, pdefs);
}
static void
ATIPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
atic->backend_funcs.putColors(pScreen, fb, n, pdefs);
}
/* Compute log base 2 of val. */
int
ATILog2(int val)
{
int bits;
for (bits = 0; val != 0; val >>= 1, ++bits)
;
return bits - 1;
}
static Bool
ATIIsAGP(ATICardInfo *atic)
{
char *mmio = atic->reg_base;
CARD32 cap_ptr, cap_id;
if (mmio == NULL)
return FALSE;
if (MMIO_IN32(mmio, ATI_REG_PCI_CFG_STATUS) & ATI_CAP_LIST) {
cap_ptr = MMIO_IN32(mmio, ATI_REG_PCI_CFG_CAPABILITIES_PTR) &
ATI_CAP_PTR_MASK;
while (cap_ptr != ATI_CAP_ID_NULL) {
cap_id = MMIO_IN32(mmio, ATI_PCI_CFG_OFFSET + cap_ptr);
if ((cap_id & 0xff) == ATI_CAP_ID_AGP)
return TRUE;
cap_ptr = (cap_id >> 8) & ATI_CAP_PTR_MASK;
}
}
return FALSE;
}
/* This function is required to work around a hardware bug in some (all?)
* revisions of the R300. This workaround should be called after every
* CLOCK_CNTL_INDEX register access. If not, register reads afterward
* may not be correct.
*/
void R300CGWorkaround(ATIScreenInfo *atis) {
ATICardInfo *atic = atis->atic;
char *mmio = atic->reg_base;
CARD32 save;
save = MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save & ~(0x3f |
ATI_PLL_WR_EN));
MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save);
}
KdCardFuncs ATIFuncs = {
ATICardInit, /* cardinit */
ATIScreenInit, /* scrinit */
ATIInitScreen, /* initScreen */
ATIFinishInitScreen, /* finishInitScreen */
ATICreateResources, /* createRes */
ATIPreserve, /* preserve */
ATIEnable, /* enable */
ATIDPMS, /* dpms */
ATIDisable, /* disable */
ATIRestore, /* restore */
ATIScreenFini, /* scrfini */
ATICardFini, /* cardfini */
ATICursorInit, /* initCursor */
ATICursorEnable, /* enableCursor */
ATICursorDisable, /* disableCursor */
ATICursorFini, /* finiCursor */
ATIRecolorCursor, /* recolorCursor */
ATIDrawInit, /* initAccel */
ATIDrawEnable, /* enableAccel */
ATIDrawSync, /* syncAccel */
ATIDrawDisable, /* disableAccel */
ATIDrawFini, /* finiAccel */
ATIGetColors, /* getColors */
ATIPutColors, /* putColors */
};

View File

@ -1,418 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifndef _ATI_H_
#define _ATI_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef KDRIVEFBDEV
#include <fbdev.h>
#endif
#ifdef KDRIVEVESA
#include <vesa.h>
#endif
#include "kxv.h"
#ifdef XF86DRI
#define USE_DRI
#include "libdrm.h"
#include "dri.h"
#ifdef GLXEXT
#include "GL/glxint.h"
#include "GL/glxtokens.h"
#include "ati_dripriv.h"
#endif
#endif
#define ATI_REG_BASE(c) ((c)->attr.address[1])
#define ATI_REG_SIZE(c) (0x4000)
#ifdef __powerpc__
static __inline__ void
MMIO_OUT32(__volatile__ void *base, const unsigned long offset,
const unsigned int val)
{
__asm__ __volatile__(
"stwbrx %1,%2,%3\n\t"
"eieio"
: "=m" (*((volatile unsigned char *)base+offset))
: "r" (val), "b" (base), "r" (offset));
}
static __inline__ CARD32
MMIO_IN32(__volatile__ void *base, const unsigned long offset)
{
register unsigned int val;
__asm__ __volatile__(
"lwbrx %0,%1,%2\n\t"
"eieio"
: "=r" (val)
: "b" (base), "r" (offset),
"m" (*((volatile unsigned char *)base+offset)));
return val;
}
#else
#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v))
#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a)))
#endif
#define MMIO_OUT8(mmio, a, v) (*(VOL8 *)((mmio) + (a)) = (v))
#define MMIO_IN8(mmio, a, v) (*(VOL8 *)((mmio) + (a)))
#define INPLL(mmio, addr) \
(MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, addr), \
MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_DATA))
#define OUTPLL(mmio, addr, val) do { \
MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, (addr) | ATI_PLL_WR_EN); \
MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_DATA, val); \
} while (0)
typedef volatile CARD8 VOL8;
typedef volatile CARD16 VOL16;
typedef volatile CARD32 VOL32;
struct pci_id_entry {
CARD16 vendor;
CARD16 device;
CARD8 caps;
char *name;
};
struct backend_funcs {
void (*cardfini)(KdCardInfo *);
void (*scrfini)(KdScreenInfo *);
Bool (*initScreen)(ScreenPtr);
Bool (*finishInitScreen)(ScreenPtr pScreen);
Bool (*createRes)(ScreenPtr);
void (*preserve)(KdCardInfo *);
void (*restore)(KdCardInfo *);
Bool (*dpms)(ScreenPtr, int);
Bool (*enable)(ScreenPtr);
void (*disable)(ScreenPtr);
void (*getColors)(ScreenPtr, int, int, xColorItem *);
void (*putColors)(ScreenPtr, int, int, xColorItem *);
#ifdef RANDR
Bool (*randrSetConfig) (ScreenPtr, Rotation, int, RRScreenSizePtr);
#endif
};
typedef struct _ATICardInfo {
union {
#ifdef KDRIVEFBDEV
FbdevPriv fbdev;
#endif
#ifdef KDRIVEVESA
VesaCardPrivRec vesa;
#endif
} backend_priv;
struct backend_funcs backend_funcs;
struct pci_id_entry *pci_id;
CARD8 *reg_base;
Bool is_radeon;
Bool is_r100;
Bool is_r200;
Bool is_r300;
Bool is_agp;
char *busid;
CARD32 crtc_pitch;
CARD32 crtc2_pitch;
#ifdef USE_DRI
int drmFd;
#endif /* USE_DRI */
Bool use_fbdev, use_vesa;
} ATICardInfo;
#define getATICardInfo(kd) ((ATICardInfo *) ((kd)->card->driver))
#define ATICardInfo(kd) ATICardInfo *atic = getATICardInfo(kd)
typedef struct _ATICursor {
int width, height;
int xhot, yhot;
Bool has_cursor;
CursorPtr pCursor;
Pixel source, mask;
KdOffscreenArea *area;
} ATICursor;
typedef struct _ATIPortPriv {
int brightness;
int saturation;
RegionRec clip;
Bool videoOn;
Time offTime;
Time freeTime;
CARD32 size;
KdOffscreenArea *off_screen;
DrawablePtr pDraw;
PixmapPtr pPixmap;
CARD32 src_offset;
CARD32 src_pitch;
CARD8 *src_addr;
int id;
int src_x1, src_y1, src_x2, src_y2;
int dst_x1, dst_y1, dst_x2, dst_y2;
int src_w, src_h, dst_w, dst_h;
} ATIPortPrivRec, *ATIPortPrivPtr;
typedef struct _dmaBuf {
int size;
int used;
void *address;
#ifdef USE_DRI
drmBufPtr drmBuf;
#endif
} dmaBuf;
typedef struct _ATIScreenInfo {
union {
#ifdef KDRIVEFBDEV
FbdevScrPriv fbdev;
#endif
#ifdef KDRIVEVESA
VesaScreenPrivRec vesa;
#endif
} backend_priv;
KaaScreenInfoRec kaa;
ATICardInfo *atic;
KdScreenInfo *screen;
int scratch_offset;
int scratch_next;
int scratch_size;
KdOffscreenArea *scratch_area;
ATICursor cursor;
KdVideoAdaptorPtr pAdaptor;
int num_texture_ports;
Bool using_pio; /* If we use decode DMA packets to MMIO. */
Bool using_pseudo; /* If we use MMIO to submit DMA packets. */
Bool using_dma; /* If we use non-DRI DMA to submit packets. */
Bool using_dri; /* If we use the DRM for DMA. */
Bool using_agp; /* If we are using AGP or not for DMA. */
KdOffscreenArea *dma_space; /* For "DMA" from framebuffer. */
void *agp_addr; /* Mapped AGP aperture */
int agp_size;
int agp_key; /* Key of AGP memory for DMA */
CARD32 *ring_addr; /* Beginning of ring buffer. */
int ring_write; /* Index of write ptr in ring. */
int ring_read; /* Index of read ptr in ring. */
int ring_len;
dmaBuf *indirectBuffer;
int indirectStart;
int mmio_avail;
int cce_pri_size;
int cce_pri_avail;
#ifdef USE_DRI
Bool dma_started;
drmSize registerSize;
drmHandle registerHandle;
drmHandle fbHandle;
drmSize gartSize;
drmHandle agpMemHandle; /* Handle from drmAgpAlloc */
unsigned long gartOffset;
unsigned char *AGP; /* Map */
int agpMode;
drmSize pciSize;
drmHandle pciMemHandle;
/* ring buffer data */
unsigned long ringStart; /* Offset into AGP space */
drmHandle ringHandle; /* Handle from drmAddMap */
drmSize ringMapSize; /* Size of map */
int ringSize; /* Size of ring (MB) */
unsigned char *ring; /* Map */
unsigned long ringReadOffset; /* Offset into AGP space */
drmHandle ringReadPtrHandle; /* Handle from drmAddMap */
drmSize ringReadMapSize; /* Size of map */
unsigned char *ringReadPtr; /* Map */
/* vertex/indirect buffer data */
unsigned long bufStart; /* Offset into AGP space */
drmHandle bufHandle; /* Handle from drmAddMap */
drmSize bufMapSize; /* Size of map */
int bufSize; /* Size of buffers (MB) */
unsigned char *buf; /* Map */
int bufNumBufs; /* Number of buffers */
drmBufMapPtr buffers; /* Buffer map */
/* AGP Texture data */
unsigned long gartTexStart; /* Offset into AGP space */
drmHandle gartTexHandle; /* Handle from drmAddMap */
drmSize gartTexMapSize; /* Size of map */
int gartTexSize; /* Size of AGP tex space (MB) */
unsigned char *gartTex; /* Map */
int log2GARTTexGran;
int DMAusecTimeout; /* CCE timeout in usecs */
/* DRI screen private data */
int frontOffset;
int frontPitch;
int backOffset;
int backPitch;
int depthOffset;
int depthPitch;
int spanOffset;
int textureOffset;
int textureSize;
int log2TexGran;
int irqEnabled;
int serverContext;
DRIInfoPtr pDRIInfo;
#ifdef GLXEXT
int numVisualConfigs;
__GLXvisualConfig *pVisualConfigs;
ATIConfigPrivPtr pVisualConfigsPriv;
#endif /* GLXEXT */
#endif /* USE_DRI */
} ATIScreenInfo;
#define getATIScreenInfo(kd) ((ATIScreenInfo *) ((kd)->screen->driver))
#define ATIScreenInfo(kd) ATIScreenInfo *atis = getATIScreenInfo(kd)
typedef union { float f; CARD32 i; } fi_type;
/* Surely there's a better way to go about this */
static inline CARD32
ATIFloatAsInt(float val)
{
fi_type fi;
fi.f = val;
return fi.i;
}
#define GET_FLOAT_BITS(x) ATIFloatAsInt(x)
/* ati.c */
Bool
ATIMapReg(KdCardInfo *card, ATICardInfo *atic);
void
ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic);
void
R300CGWorkaround(ATIScreenInfo *atis);
/* ati_draw.c */
void
ATIDrawSetup(ScreenPtr pScreen);
Bool
ATIDrawInit(ScreenPtr pScreen);
void
ATIDrawEnable(ScreenPtr pScreen);
void
ATIDrawSync(ScreenPtr pScreen);
void
ATIDrawDisable(ScreenPtr pScreen);
void
ATIDrawFini(ScreenPtr pScreen);
/* ati_dri.c */
#ifdef USE_DRI
Bool
ATIDRIScreenInit(ScreenPtr pScreen);
void
ATIDRICloseScreen(ScreenPtr pScreen);
void
ATIDRIDMAStart(ATIScreenInfo *atis);
void
ATIDRIDMAStop(ATIScreenInfo *atis);
void
ATIDRIDMAReset(ATIScreenInfo *atis);
void
ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard);
drmBufPtr
ATIDRIGetBuffer(ATIScreenInfo *atis);
#endif /* USE_DRI */
/* ati_cursor.c */
Bool
ATICursorInit(ScreenPtr pScreen);
void
ATICursorEnable(ScreenPtr pScreen);
void
ATICursorDisable(ScreenPtr pScreen);
void
ATICursorFini(ScreenPtr pScreen);
void
ATIRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef);
int
ATILog2(int val);
/* ati_video.c */
Bool
ATIInitVideo(ScreenPtr pScreen);
void
ATIFiniVideo(ScreenPtr pScreen);
extern KdCardFuncs ATIFuncs;
#endif /* _ATI_H_ */

View File

@ -1,560 +0,0 @@
/*
* Copyright © 2004 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ati.h"
#include "ati_reg.h"
#include "cursorstr.h"
#include "ati_draw.h"
static void
ATIMoveCursor(ScreenPtr pScreen, int x, int y)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
CARD16 xoff, yoff;
CARD8 *mmio = atic->reg_base;
int stride = atic->is_radeon ? 256 : 16;
if (!pCurPriv->has_cursor)
return;
if (!pScreenPriv->enabled)
return;
x -= pCurPriv->xhot;
xoff = 0;
if (x < 0) {
xoff = -x;
x = 0;
}
y -= pCurPriv->yhot;
yoff = 0;
if (y < 0) {
yoff = -y;
y = 0;
}
MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_OFF, ATI_CUR_LOCK |
(xoff << 16) | yoff);
MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_POSN, ATI_CUR_LOCK |
(x << 16) | y);
MMIO_OUT32(mmio, ATI_REG_CUR_OFFSET, (pCurPriv->area->offset + yoff *
stride));
}
static void
ClassicAllocCursorColors(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
CursorPtr pCursor = pCurPriv->pCursor;
KdAllocateCursorPixels(pScreen, 0, pCursor, &pCurPriv->source,
&pCurPriv->mask);
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
case 4:
pCurPriv->source |= pCurPriv->source << 4;
pCurPriv->mask |= pCurPriv->mask << 4;
/* FALLTHROUGH */
case 8:
pCurPriv->source |= pCurPriv->source << 8;
pCurPriv->mask |= pCurPriv->mask << 8;
/* FALLTHROUGH */
case 16:
pCurPriv->source |= pCurPriv->source << 16;
pCurPriv->mask |= pCurPriv->mask << 16;
}
}
static void
ClassicSetCursorColors(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
CARD8 *mmio = atic->reg_base;
MMIO_OUT32(mmio, ATI_REG_CUR_CLR0, pCurPriv->mask);
MMIO_OUT32(mmio, ATI_REG_CUR_CLR1, pCurPriv->source);
}
static void
ClassicRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
CursorPtr pCursor = pCurPriv->pCursor;
if (!pCurPriv->has_cursor || !pCursor)
return;
if (!pScreenPriv->enabled)
return;
if (pdef) {
while (ndef != 0) {
if (pdef->pixel == pCurPriv->source ||
pdef->pixel == pCurPriv->mask)
break;
ndef--;
}
if (ndef == 0)
return;
}
ClassicAllocCursorColors(pScreen);
ClassicSetCursorColors(pScreen);
}
#define InvertBits32(v) do { \
v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
} while (0)
static void
ClassicLoadCursor(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
CursorPtr pCursor = pCurPriv->pCursor;
CursorBitsPtr bits = pCursor->bits;
int h;
CARD32 *ram, *msk, *mskLine, *src, *srcLine;
int i;
int lwsrc;
CARD32 tmp;
CARD8 *mmio = atic->reg_base;
ClassicAllocCursorColors(pScreen);
pCurPriv->pCursor = pCursor;
pCurPriv->xhot = pCursor->bits->xhot;
pCurPriv->yhot = pCursor->bits->yhot;
/* Stick new image into cursor memory */
ram = (CARD32 *)(pScreenPriv->screen->memory_base +
pCurPriv->area->offset);
mskLine = (CARD32 *)bits->mask;
srcLine = (CARD32 *)bits->source;
h = bits->height;
if (h > ATI_CURSOR_HEIGHT)
h = ATI_CURSOR_HEIGHT;
lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp & ~ATI_CRTC_CUR_EN);
for (i = 0; i < ATI_CURSOR_HEIGHT; i++) {
CARD32 m1, m2, s1, s2;
msk = mskLine;
src = srcLine;
mskLine += lwsrc;
srcLine += lwsrc;
if (i < h && 0 < lwsrc) {
m1 = ~*msk++;
s1 = *src++;
InvertBits32(m1);
InvertBits32(s1);
} else {
m1 = 0xffffffff;
s1 = 0x0;
}
if (i < h && 1 < lwsrc) {
m2 = ~*msk++;
s2 = *src++;
InvertBits32(m2);
InvertBits32(s2);
} else {
m2 = 0xffffffff;
s2 = 0x0;
}
*ram++ = m1;
*ram++ = m2;
*ram++ = s1;
*ram++ = s2;
}
/* Not sure why this is necessary, but it prevents some cursor
* corruption. Not even all of it.
*/
for (i = 0; i < ATI_CURSOR_HEIGHT; i++) {
*ram++ = 0xffffffff;
*ram++ = 0xffffffff;
*ram++ = 0x0;
*ram++ = 0x0;
}
/* Enable the cursor */
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp | ATI_CRTC_CUR_EN);
/* Set new color */
ClassicSetCursorColors(pScreen);
}
static void
RadeonLoadCursor(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
CursorPtr pCursor = pCurPriv->pCursor;
CursorBitsPtr bits = pCursor->bits;
int h, w;
int x, y;
CARD32 *ram, *msk, *mskLine, *src, *srcLine;
int lwsrc;
CARD32 tmp;
CARD8 *mmio = atic->reg_base;
pCurPriv->pCursor = pCursor;
pCurPriv->xhot = pCursor->bits->xhot;
pCurPriv->yhot = pCursor->bits->yhot;
w = bits->width;
if (w > ATI_CURSOR_WIDTH)
w = ATI_CURSOR_WIDTH;
h = bits->height;
if (h > ATI_CURSOR_HEIGHT)
h = ATI_CURSOR_HEIGHT;
tmp = MMIO_IN32(mmio, 0x7c);
tmp = 0x00010f80;
MMIO_OUT32 (mmio, 0x7c, tmp);
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN);
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
/* Stick new image into cursor memory */
ram = (CARD32 *)(pScreenPriv->screen->memory_base +
pCurPriv->area->offset);
if (pCursor->bits->argb)
{
srcLine = pCursor->bits->argb;
for (y = 0; y < h; y++)
{
src = srcLine;
srcLine += pCursor->bits->width;
for (x = 0; x < w; x++)
*ram++ = *src++;
for (; x < ATI_CURSOR_WIDTH; x++)
*ram++ = 0;
}
for (; y < ATI_CURSOR_HEIGHT; y++)
for (x = 0; x < ATI_CURSOR_WIDTH; x++)
*ram++ = 0;
}
else
{
CARD32 colors[4];
colors[0] = 0;
colors[1] = 0;
colors[2] = (((pCursor->backRed >> 8) << 16) |
((pCursor->backGreen >> 8) << 8) |
((pCursor->backBlue >> 8) << 0) |
0xff000000);
colors[3] = (((pCursor->foreRed >> 8) << 16) |
((pCursor->foreGreen >> 8) << 8) |
((pCursor->foreBlue >> 8) << 0) |
0xff000000);
mskLine = (CARD32 *)bits->mask;
srcLine = (CARD32 *)bits->source;
/* words per line */
lwsrc = BitmapBytePad(bits->width) / 4;
for (y = 0; y < ATI_CURSOR_HEIGHT; y++)
{
CARD32 m, s;
msk = mskLine;
src = srcLine;
mskLine += lwsrc;
srcLine += lwsrc;
for (x = 0; x < ATI_CURSOR_WIDTH / 32; x++)
{
int k;
if (y < h && x < lwsrc)
{
m = *msk++;
s = *src++;
}
else
{
m = 0x0;
s = 0x0;
}
for (k = 0; k < 32; k++)
{
CARD32 bits = (s & 1) | ((m & 1) << 1);
*ram++ = colors[bits];
s >>= 1;
m >>= 1;
}
}
}
}
/* Enable the cursor */
tmp &= ~(ATI_CRTC_ICON_EN);
tmp |= ATI_CRTC_ARGB_EN;
tmp |= ATI_CRTC_CUR_EN;
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
}
static void
ATIUnloadCursor(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
CARD8 *mmio = atic->reg_base;
CARD32 tmp;
tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN);
MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
}
static Bool
ATIRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
if (!pScreenPriv->enabled)
return TRUE;
/* miRecolorCursor does this */
if (pCursor && pCurPriv->pCursor == pCursor)
{
int x, y;
miPointerPosition(&x, &y);
if (atic->is_radeon)
RadeonLoadCursor (pScreen);
else
ClassicLoadCursor(pScreen);
/* Move to new position */
ATIMoveCursor(pScreen, x, y);
}
return TRUE;
}
static Bool
ATIUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
return TRUE;
}
static void
ATISetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
pCurPriv->pCursor = pCursor;
if (!pScreenPriv->enabled)
return;
if (pCursor)
{
if (atic->is_radeon)
RadeonLoadCursor (pScreen);
else
ClassicLoadCursor(pScreen);
/* Move to new position */
ATIMoveCursor(pScreen, x, y);
}
else
ATIUnloadCursor(pScreen);
}
miPointerSpriteFuncRec ATIPointerSpriteFuncs = {
ATIRealizeCursor,
ATIUnrealizeCursor,
ATISetCursor,
ATIMoveCursor,
};
static void
ATIQueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight,
ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
switch (class)
{
case CursorShape:
if (*pwidth > pCurPriv->width)
*pwidth = pCurPriv->width;
if (*pheight > pCurPriv->height)
*pheight = pCurPriv->height;
if (*pwidth > pScreen->width)
*pwidth = pScreen->width;
if (*pheight > pScreen->height)
*pheight = pScreen->height;
break;
default:
fbQueryBestSize(class, pwidth, pheight, pScreen);
break;
}
}
static void
ATICursorSave(ScreenPtr pScreen, KdOffscreenArea *area)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
pCurPriv->area = NULL;
}
void
ATICursorEnable(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
if (!pCurPriv->has_cursor)
return;
if (pCurPriv->area == NULL) {
if (atic->is_radeon)
pCurPriv->area = KdOffscreenAlloc(pScreen,
ATI_CURSOR_HEIGHT * ATI_CURSOR_WIDTH * 4,
128, TRUE, ATICursorSave, atis);
else
pCurPriv->area = KdOffscreenAlloc(pScreen,
ATI_CURSOR_HEIGHT * ATI_CURSOR_PITCH * 2,
32, TRUE, ATICursorSave, atis);
}
if (pCurPriv->area == NULL)
FatalError("Couldn't allocate offscreen memory for cursor.\n");
if (pCurPriv->pCursor) {
int x, y;
miPointerPosition(&x, &y);
if (atic->is_radeon)
RadeonLoadCursor(pScreen);
else
ClassicLoadCursor(pScreen);
/* Move to new position */
ATIMoveCursor(pScreen, x, y);
}
else
ATIUnloadCursor(pScreen);
}
void
ATICursorDisable(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
if (!pScreenPriv->enabled || !pCurPriv->has_cursor)
return;
if (pCurPriv->pCursor)
ATIUnloadCursor(pScreen);
}
Bool
ATICursorInit(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
pCurPriv->has_cursor = FALSE;
if (atic->reg_base == NULL)
return FALSE;
pCurPriv->width = ATI_CURSOR_WIDTH;
pCurPriv->height= ATI_CURSOR_HEIGHT;
pScreen->QueryBestSize = ATIQueryBestSize;
miPointerInitialize(pScreen, &ATIPointerSpriteFuncs,
&kdPointerScreenFuncs, FALSE);
pCurPriv->has_cursor = TRUE;
pCurPriv->pCursor = NULL;
return TRUE;
}
void
ATIRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
{
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
if (!atic->is_radeon)
ClassicRecolorCursor (pScreen, ndef, pdef);
}
void
ATICursorFini(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICursor *pCurPriv = &atis->cursor;
pCurPriv->has_cursor = FALSE;
pCurPriv->pCursor = NULL;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +0,0 @@
/*
* Copyright © 2004 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifndef _ATI_DMA_H_
#define _ATI_DMA_H_
#define DMA_PACKET0(reg, count) \
(ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2))
#define DMA_PACKET1(reg1, reg2) \
(ATI_CCE_PACKET1 | \
(((reg2) >> 2) << ATI_CCE_PACKET1_REG_2_SHIFT) | ((reg1) >> 2))
#define DMA_PACKET3(type, count) \
((type) | (((count) - 1) << 16))
#if 0 /* CCE non-debug */
#define RING_LOCALS CARD32 *__head; int __count
#define BEGIN_DMA(n) \
do { \
if ((atis->indirectBuffer->used + 4*(n)) > \
atis->indirectBuffer->size) { \
ATIFlushIndirect(atis, 1); \
} \
__head = (CARD32 *)((char *)atis->indirectBuffer->address + \
atis->indirectBuffer->used); \
__count = 0; \
} while (0)
#define END_DMA() do { \
atis->indirectBuffer->used += __count * 4; \
} while (0)
#else
#define RING_LOCALS CARD32 *__head; int __count; int __total
#define BEGIN_DMA(n) \
do { \
if ((atis->indirectBuffer->used + 4*(n)) > \
atis->indirectBuffer->size) { \
ATIFlushIndirect(atis, 1); \
} \
__head = (CARD32 *)((char *)atis->indirectBuffer->address + \
atis->indirectBuffer->used); \
__count = 0; \
__total = n; \
} while (0)
#define END_DMA() do { \
if (__count != __total) \
FatalError("count != total (%d vs %d) at %s:%d\n", \
__count, __total, __FILE__, __LINE__); \
atis->indirectBuffer->used += __count * 4; \
} while (0)
#endif
#define OUT_RING(x) do { \
__head[__count++] = (x); \
} while (0)
#define OUT_RING_F(x) OUT_RING(GET_FLOAT_BITS(x))
#define OUT_REG(reg, val) \
do { \
OUT_RING(DMA_PACKET0(reg, 1)); \
OUT_RING(val); \
} while (0)
dmaBuf *
ATIGetDMABuffer(ATIScreenInfo *atis);
void
ATIFlushIndirect(ATIScreenInfo *atis, Bool discard);
void
ATIDMASetup(ScreenPtr pScreen);
void
ATIDMATeardown(ScreenPtr pScreen);
#endif /* _ATI_DMA_H_ */

View File

@ -1,849 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ati.h"
#include "ati_reg.h"
#include "ati_dma.h"
#include "ati_draw.h"
#include "kaa.h"
CARD8 ATISolidRop[16] = {
/* GXclear */ 0x00, /* 0 */
/* GXand */ 0xa0, /* src AND dst */
/* GXandReverse */ 0x50, /* src AND NOT dst */
/* GXcopy */ 0xf0, /* src */
/* GXandInverted*/ 0x0a, /* NOT src AND dst */
/* GXnoop */ 0xaa, /* dst */
/* GXxor */ 0x5a, /* src XOR dst */
/* GXor */ 0xfa, /* src OR dst */
/* GXnor */ 0x05, /* NOT src AND NOT dst */
/* GXequiv */ 0xa5, /* NOT src XOR dst */
/* GXinvert */ 0x55, /* NOT dst */
/* GXorReverse */ 0xf5, /* src OR NOT dst */
/* GXcopyInverted*/ 0x0f, /* NOT src */
/* GXorInverted */ 0xaf, /* NOT src OR dst */
/* GXnand */ 0x5f, /* NOT src OR NOT dst */
/* GXset */ 0xff, /* 1 */
};
CARD8 ATIBltRop[16] = {
/* GXclear */ 0x00, /* 0 */
/* GXand */ 0x88, /* src AND dst */
/* GXandReverse */ 0x44, /* src AND NOT dst */
/* GXcopy */ 0xcc, /* src */
/* GXandInverted*/ 0x22, /* NOT src AND dst */
/* GXnoop */ 0xaa, /* dst */
/* GXxor */ 0x66, /* src XOR dst */
/* GXor */ 0xee, /* src OR dst */
/* GXnor */ 0x11, /* NOT src AND NOT dst */
/* GXequiv */ 0x99, /* NOT src XOR dst */
/* GXinvert */ 0x55, /* NOT dst */
/* GXorReverse */ 0xdd, /* src OR NOT dst */
/* GXcopyInverted*/ 0x33, /* NOT src */
/* GXorInverted */ 0xbb, /* NOT src OR dst */
/* GXnand */ 0x77, /* NOT src OR NOT dst */
/* GXset */ 0xff, /* 1 */
};
int copydx, copydy;
ATIScreenInfo *accel_atis;
/* If is_24bpp is set, then we are using the accelerator in 8-bit mode due
* to it being broken for 24bpp, so coordinates have to be multiplied by 3.
*/
Bool is_24bpp;
CARD32 settings, color, src_pitch_offset, dst_pitch_offset;
int sample_count;
float sample_offsets_x[255];
float sample_offsets_y[255];
#define DRAW_USING_PACKET3 0
void
ATIDrawSetup(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
RING_LOCALS;
/* XXX: this shouldn't be necessary, but fixes some R128 composite
* issues.
*/
/*if (!atic->is_radeon) {
char *mmio = atic->reg_base;
ATIWaitIdle(atis);
MMIO_OUT32(mmio, R128_REG_PC_GUI_MODE,
R128_PC_BYPASS_EN);
}*/
BEGIN_DMA(2);
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
END_DMA();
if (!atic->is_radeon) {
/* Setup for R128 Composite */
BEGIN_DMA(12);
OUT_REG(R128_REG_SCALE_3D_CNTL,
R128_SCALE_3D_TEXMAP_SHADE |
R128_SCALE_PIX_REPLICATE |
R128_TEX_CACHE_SPLIT |
R128_TEX_MAP_ALPHA_IN_TEXTURE |
R128_TEX_CACHE_LINE_SIZE_4QW);
OUT_REG(R128_REG_SETUP_CNTL,
R128_COLOR_SOLID_COLOR |
R128_PRIM_TYPE_TRI |
R128_TEXTURE_ST_MULT_W |
R128_STARTING_VERTEX_1 |
R128_ENDING_VERTEX_3 |
R128_SUB_PIX_4BITS);
OUT_REG(R128_REG_PM4_VC_FPU_SETUP,
R128_FRONT_DIR_CCW |
R128_BACKFACE_CULL |
R128_FRONTFACE_SOLID |
R128_FPU_COLOR_SOLID |
R128_FPU_SUB_PIX_4BITS |
R128_FPU_MODE_3D |
R128_TRAP_BITS_DISABLE |
R128_XFACTOR_2 |
R128_YFACTOR_2 |
R128_FLAT_SHADE_VERTEX_OGL |
R128_FPU_ROUND_TRUNCATE |
R128_WM_SEL_8DW);
OUT_REG(R128_REG_PLANE_3D_MASK_C, 0xffffffff);
OUT_REG(R128_REG_CONSTANT_COLOR_C, 0xff000000);
OUT_REG(R128_REG_WINDOW_XY_OFFSET, 0x00000000);
END_DMA();
} else {
/* Setup for R100/R200 Composite */
BEGIN_DMA(8);
OUT_REG(RADEON_REG_RE_TOP_LEFT, 0);
OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff);
OUT_REG(RADEON_REG_RB3D_PLANEMASK, 0xffffffff);
OUT_REG(RADEON_REG_SE_CNTL,
RADEON_FFACE_CULL_CCW |
RADEON_FFACE_SOLID |
RADEON_VTX_PIX_CENTER_OGL);
END_DMA();
if (atic->is_r100) {
BEGIN_DMA(4);
OUT_REG(RADEON_REG_SE_CNTL_STATUS, RADEON_TCL_BYPASS);
OUT_REG(RADEON_REG_SE_COORD_FMT,
RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
RADEON_VTX_ST0_NONPARAMETRIC |
RADEON_VTX_ST1_NONPARAMETRIC |
RADEON_TEX1_W_ROUTING_USE_W0);
END_DMA();
} else {
BEGIN_DMA(12);
OUT_REG(R200_REG_RE_CNTL, 0);
OUT_REG(R200_REG_SE_VTE_CNTL, R200_VTX_XY_FMT);
OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY);
OUT_REG(R200_REG_SE_VTX_FMT_1,
(2 << R200_VTX_TEX0_COMP_CNT_SHIFT) |
(2 << R200_VTX_TEX1_COMP_CNT_SHIFT));
OUT_REG(R200_REG_SE_VAP_CNTL, 0);
OUT_REG(R200_REG_RE_AUX_SCISSOR_CNTL, 0);
END_DMA();
}
}
}
void
RadeonSwitchTo2D(ATIScreenInfo *atis)
{
RING_LOCALS;
BEGIN_DMA(4);
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
RADEON_RB2D_DC_FLUSH);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
END_DMA();
}
void
RadeonSwitchTo3D(ATIScreenInfo *atis)
{
RING_LOCALS;
BEGIN_DMA(4);
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
RADEON_RB2D_DC_FLUSH);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
END_DMA();
}
/* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we
* require src and dest datatypes to be equal.
*/
static Bool
ATIGetDatatypeBpp(int bpp, CARD32 *type)
{
switch (bpp) {
case 8:
*type = R128_DATATYPE_CI8;
return TRUE;
case 16:
*type = R128_DATATYPE_RGB565;
return TRUE;
case 24:
*type = R128_DATATYPE_CI8;
return TRUE;
case 32:
*type = R128_DATATYPE_ARGB8888;
return TRUE;
default:
ATI_FALLBACK(("Unsupported bpp: %d\n", bpp));
return FALSE;
}
}
Bool
ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset,
int offset, int pitch)
{
ATICardInfo *atic = atis->atic;
/* On the R128, depending on the bpp the screen can be set up so that it
* doesn't meet the offscreenPitch requirement but can still be
* accelerated, so we check the specific pitch requirement of alignment
* to 8 pixels.
*/
if (atic->is_radeon) {
if (pitch % atis->kaa.offscreenPitch != 0)
ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
*pitch_offset = ((pitch >> 6) << 22) | (offset >> 10);
} else {
if (pitch % bpp != 0)
ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
*pitch_offset = ((pitch / bpp) << 21) | (offset >> 5);
}
if (offset % atis->kaa.offscreenByteAlign != 0)
ATI_FALLBACK(("Bad offset 0x%08x\n", offset));
return TRUE;
}
Bool
ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset)
{
KdScreenPriv(pPix->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 pitch, offset;
int bpp;
bpp = pPix->drawable.bitsPerPixel;
if (bpp == 24)
bpp = 8;
offset = ((CARD8 *)pPix->devPrivate.ptr -
pScreenPriv->screen->memory_base);
pitch = pPix->devKind;
return ATIGetOffsetPitch(atis, bpp, pitch_offset, offset, pitch);
}
static Bool
ATIPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
{
KdScreenPriv(pPix->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
CARD32 datatype;
RING_LOCALS;
is_24bpp = (pPix->drawable.bitsPerPixel == 24);
accel_atis = atis;
if (is_24bpp) {
/* Solid fills in fake-24bpp mode only work if the pixel color
* and planemask are all the same byte.
*/
if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) &
0xffff)))
ATI_FALLBACK(("Can't do solid color 0x%08x in 24bpp\n",
fg));
if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
0xffff)))
ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n",
pm));
}
if (!ATIGetDatatypeBpp(pPix->drawable.bitsPerPixel, &datatype))
return FALSE;
if (!ATIGetPixmapOffsetPitch(pPix, &dst_pitch_offset))
return FALSE;
if (atic->is_radeon)
RadeonSwitchTo2D(atis);
settings =
ATI_GMC_DST_PITCH_OFFSET_CNTL |
ATI_GMC_BRUSH_SOLID_COLOR |
(datatype << 8) |
ATI_GMC_SRC_DATATYPE_COLOR |
(ATISolidRop[alu] << 16) |
ATI_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS;
color = fg;
#if DRAW_USING_PACKET3
BEGIN_DMA(6);
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT |
ATI_DST_Y_TOP_TO_BOTTOM);
END_DMA();
#else
BEGIN_DMA(12);
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings);
OUT_REG(ATI_REG_DP_BRUSH_FRGD_CLR, fg);
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT |
ATI_DST_Y_TOP_TO_BOTTOM);
END_DMA();
#endif
return TRUE;
}
static void
ATISolid(int x1, int y1, int x2, int y2)
{
ATIScreenInfo *atis = accel_atis;
RING_LOCALS;
if (is_24bpp) {
x1 *= 3;
x2 *= 3;
}
#if DRAW_USING_PACKET3
BEGIN_DMA(6);
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_PAINT_MULTI, 5));
OUT_RING(settings);
OUT_RING(dst_pitch_offset);
OUT_RING(color);
OUT_RING((x1 << 16) | y1);
OUT_RING(((x2 - x1) << 16) | (y2 - y1));
END_DMA();
#else
BEGIN_DMA(3);
OUT_RING(DMA_PACKET0(ATI_REG_DST_Y_X, 2));
OUT_RING((y1 << 16) | x1);
OUT_RING(((y2 - y1) << 16) | (x2 - x1));
END_DMA();
#endif
}
static void
ATIDoneSolid(void)
{
}
static Bool
ATIPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
CARD32 datatype;
RING_LOCALS;
copydx = dx;
copydy = dy;
is_24bpp = pDst->drawable.bitsPerPixel == 24;
accel_atis = atis;
if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
0xffff))))
ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n", pm));
if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype))
return FALSE;
if (!ATIGetPixmapOffsetPitch(pSrc, &src_pitch_offset))
return FALSE;
if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
return FALSE;
if (atic->is_radeon)
RadeonSwitchTo2D(atis);
settings =
ATI_GMC_SRC_PITCH_OFFSET_CNTL |
ATI_GMC_DST_PITCH_OFFSET_CNTL |
ATI_GMC_BRUSH_NONE |
(datatype << 8) |
ATI_GMC_SRC_DATATYPE_COLOR |
(ATIBltRop[alu] << 16) |
ATI_DP_SRC_SOURCE_MEMORY |
ATI_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS;
#if DRAW_USING_PACKET3
BEGIN_DMA(6);
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
OUT_REG(ATI_REG_DP_CNTL,
(dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) |
(dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0));
END_DMA();
#else
BEGIN_DMA(12);
OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
OUT_REG(ATI_REG_SRC_PITCH_OFFSET, src_pitch_offset);
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings);
OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
OUT_REG(ATI_REG_DP_CNTL,
(dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) |
(dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0));
END_DMA();
#endif
return TRUE;
}
static void
ATICopy(int srcX, int srcY, int dstX, int dstY, int w, int h)
{
ATIScreenInfo *atis = accel_atis;
RING_LOCALS;
if (is_24bpp) {
srcX *= 3;
dstX *= 3;
w *= 3;
}
#if !DRAW_USING_PACKET3
if (copydx < 0) {
srcX += w - 1;
dstX += w - 1;
}
if (copydy < 0) {
srcY += h - 1;
dstY += h - 1;
}
#endif
#if DRAW_USING_PACKET3
BEGIN_DMA(7);
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_BITBLT_MULTI, 6));
OUT_RING(settings);
OUT_RING(src_pitch_offset);
OUT_RING(dst_pitch_offset);
OUT_RING((srcX << 16) | srcY);
OUT_RING((dstX << 16) | dstY);
OUT_RING((w << 16) | h);
END_DMA();
#else
BEGIN_DMA(4);
OUT_RING(DMA_PACKET0(ATI_REG_SRC_Y_X, 3));
OUT_RING((srcY << 16) | srcX);
OUT_RING((dstY << 16) | dstX);
OUT_RING((h << 16) | w);
END_DMA();
#endif
}
static void
ATIDoneCopy(void)
{
}
static Bool
ATIUploadToScreen(PixmapPtr pDst, char *src, int src_pitch)
{
ScreenPtr pScreen = pDst->drawable.pScreen;
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
int width, height, bpp, i, dwords;
int dst_pitch, dst_offset;
CARD32 dst_pitch_offset, datatype;
Bool success;
RING_LOCALS;
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
pScreenPriv->screen->memory_base);
dst_pitch = pDst->devKind;
width = pDst->drawable.width;
height = pDst->drawable.height;
bpp = pDst->drawable.bitsPerPixel;
success = ATIGetDatatypeBpp(bpp, &datatype);
if (bpp == 24) {
is_24bpp = TRUE;
bpp = 8;
} else
is_24bpp = FALSE;
if (!ATIGetOffsetPitch(atis, bpp, &dst_pitch_offset, dst_offset,
dst_pitch))
return FALSE;
if (src_pitch != (width * bpp / 8))
return FALSE;
/* No PACKET3 packets when in PIO mode. */
if (atis->using_pio)
return FALSE;
/* XXX: Hostdata uploads aren't working yet. */
return FALSE;
dwords = (width * height * (bpp / 8) + 3) / 4;
/* Flush pixel cache so nothing being written to the destination
* previously gets mixed up with the hostdata blit.
*/
if (atic->is_radeon) {
BEGIN_DMA(4);
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
RADEON_RB2D_DC_FLUSH);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_2D_IDLECLEAN |
RADEON_WAIT_3D_IDLECLEAN |
RADEON_WAIT_HOST_IDLECLEAN);
END_DMA();
} else {
BEGIN_DMA(2);
OUT_REG(R128_REG_PC_GUI_CTLSTAT,
R128_PC_FLUSH_GUI | R128_PC_RI_GUI);
END_DMA();
}
BEGIN_DMA(8);
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_HOSTDATA_BLT, 7 + dwords));
OUT_RING(ATI_GMC_DST_PITCH_OFFSET_CNTL |
ATI_GMC_BRUSH_NONE |
(datatype << 8) |
ATI_GMC_SRC_DATATYPE_COLOR |
(ATISolidRop[GXcopy] << 16) |
ATI_DP_SRC_SOURCE_HOST_DATA |
ATI_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS |
ATI_GMC_WR_MSK_DIS);
OUT_RING(dst_pitch_offset);
OUT_RING(0xffffffff);
OUT_RING(0xffffffff);
OUT_RING((0 << 16) | 0);
OUT_RING((height << 16) | width);
OUT_RING(dwords);
END_DMA();
for (i = 0; i < dwords; i++) {
BEGIN_DMA(1);
OUT_RING(((CARD32 *)src)[i]);
END_DMA();
}
if (atic->is_radeon) {
BEGIN_DMA(4);
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
RADEON_RB2D_DC_FLUSH);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_2D_IDLECLEAN |
RADEON_WAIT_HOST_IDLECLEAN);
END_DMA();
} else {
BEGIN_DMA(2);
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
END_DMA();
}
KdMarkSync(pScreen);
ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp);
return TRUE;
}
static Bool
ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
{
KdScreenPriv(pSrc->drawable.pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
int dst_pitch, src_pitch, w, i, size, bytes;
unsigned char *dst, *src;
RING_LOCALS;
/* Align width to log 2, useful for R128 composite. This should be a
* KAA flag we check for (and supported in kaa.c in general) since many
* older bits of hardware are going to want POT pitches.
*/
w = pSrc->drawable.width;
if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT)
w = 1 << (ATILog2(w - 1) + 1);
dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 +
atis->kaa.offscreenPitch - 1) & ~(atis->kaa.offscreenPitch - 1);
size = dst_pitch * pSrc->drawable.height;
if (size > atis->scratch_area->size)
ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n",
pSrc->drawable.width, pSrc->drawable.height));
atis->scratch_next = (atis->scratch_next +
atis->kaa.offscreenByteAlign - 1) &
~(atis->kaa.offscreenByteAlign - 1);
if (atis->scratch_next + size > atis->scratch_area->offset +
atis->scratch_area->size) {
/* Only sync when we've used all of the scratch area. */
KdCheckSync(pSrc->drawable.pScreen);
atis->scratch_next = atis->scratch_area->offset;
}
memcpy(pDst, pSrc, sizeof(*pDst));
pDst->devKind = dst_pitch;
pDst->devPrivate.ptr = pScreenPriv->screen->memory_base +
atis->scratch_next;
atis->scratch_next += size;
src = pSrc->devPrivate.ptr;
src_pitch = pSrc->devKind;
dst = pDst->devPrivate.ptr;
bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
i = pSrc->drawable.height;
while (i--) {
memcpy(dst, src, bytes);
dst += dst_pitch;
src += src_pitch;
}
/* Flush the pixel cache */
if (atic->is_radeon) {
BEGIN_DMA(2);
OUT_REG(RADEON_REG_RB2D_DSTCACHE_CTLSTAT,
RADEON_RB2D_DC_FLUSH_ALL);
END_DMA();
} else {
BEGIN_DMA(2);
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_ALL);
END_DMA();
}
return TRUE;
}
static void
ATIBlockHandler(pointer blockData, OSTimePtr timeout, pointer readmask)
{
ScreenPtr pScreen = (ScreenPtr) blockData;
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
/* When the server is going to sleep, make sure that all DMA data has
* been flushed.
*/
if (atis->indirectBuffer)
ATIFlushIndirect(atis, 1);
}
static void
ATIWakeupHandler(pointer blockData, int result, pointer readmask)
{
}
Bool
ATIDrawInit(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth,
pScreenPriv->screen->fb[0].bitsPerPixel);
RegisterBlockAndWakeupHandlers(ATIBlockHandler, ATIWakeupHandler,
pScreen);
#ifdef USE_DRI
atis->using_dri = ATIDRIScreenInit(pScreen);
#endif /* USE_DRI */
memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec));
atis->kaa.PrepareSolid = ATIPrepareSolid;
atis->kaa.Solid = ATISolid;
atis->kaa.DoneSolid = ATIDoneSolid;
atis->kaa.PrepareCopy = ATIPrepareCopy;
atis->kaa.Copy = ATICopy;
atis->kaa.DoneCopy = ATIDoneCopy;
/* Other acceleration will be hooked in in DrawEnable depending on
* what type of DMA gets initialized.
*/
atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
if (atic->is_radeon) {
atis->kaa.offscreenByteAlign = 1024;
atis->kaa.offscreenPitch = 64;
} else {
/* Rage 128 compositing wants power-of-two pitches. */
atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT;
atis->kaa.offscreenByteAlign = 32;
/* Pitch alignment is in sets of 8 pixels, and we need to cover
* 32bpp, so 32 bytes.
*/
atis->kaa.offscreenPitch = 32;
}
kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0);
sample_count = (1 << 8) - 1;
if (!kaaDrawInit(pScreen, &atis->kaa))
return FALSE;
return TRUE;
}
static void
ATIScratchSave(ScreenPtr pScreen, KdOffscreenArea *area)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
atis->scratch_area = NULL;
}
void
ATIDrawEnable(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
ATIDMASetup(pScreen);
ATIDrawSetup(pScreen);
atis->kaa.PrepareBlend = NULL;
atis->kaa.Blend = NULL;
atis->kaa.DoneBlend = NULL;
atis->kaa.CheckComposite = NULL;
atis->kaa.PrepareComposite = NULL;
atis->kaa.Composite = NULL;
atis->kaa.DoneComposite = NULL;
/* We can't dispatch 3d commands in PIO mode. */
if (!atis->using_pio) {
if (!atic->is_radeon) {
atis->kaa.CheckComposite = R128CheckComposite;
atis->kaa.PrepareComposite = R128PrepareComposite;
atis->kaa.Composite = R128Composite;
atis->kaa.DoneComposite = R128DoneComposite;
} else if (atic->is_r100) {
atis->kaa.CheckComposite = R100CheckComposite;
atis->kaa.PrepareComposite = R100PrepareComposite;
atis->kaa.Composite = RadeonComposite;
atis->kaa.DoneComposite = RadeonDoneComposite;
} else if (0 && atic->is_r200) { /* XXX */
atis->kaa.CheckComposite = R200CheckComposite;
atis->kaa.PrepareComposite = R200PrepareComposite;
atis->kaa.Composite = RadeonComposite;
atis->kaa.DoneComposite = RadeonDoneComposite;
}
}
#ifdef USE_DRI
if (atis->using_dri) {
if (!atic->is_radeon) {
/*atis->kaa.PrepareTrapezoids = R128PrepareTrapezoids;
atis->kaa.Trapezoids = R128Trapezoids;
atis->kaa.DoneTrapezoids = R128DoneTrapezoids;*/
} else if (atic->is_r100) {
atis->kaa.PrepareTrapezoids = RadeonPrepareTrapezoids;
atis->kaa.Trapezoids = RadeonTrapezoids;
atis->kaa.DoneTrapezoids = RadeonDoneTrapezoids;
}
}
#endif /* USE_DRI */
atis->kaa.UploadToScreen = ATIUploadToScreen;
/* Reserve a scratch area. It'll be used for storing glyph data during
* Composite operations, because glyphs aren't in real pixmaps and thus
* can't be migrated.
*/
atis->scratch_area = KdOffscreenAlloc(pScreen, 131072,
atis->kaa.offscreenByteAlign, TRUE, ATIScratchSave, atis);
if (atis->scratch_area != NULL) {
atis->scratch_next = atis->scratch_area->offset;
atis->kaa.UploadToScratch = ATIUploadToScratch;
} else
atis->kaa.UploadToScratch = NULL;
KdMarkSync(pScreen);
}
void
ATIDrawDisable(ScreenPtr pScreen)
{
ATIDMATeardown(pScreen);
}
void
ATIDrawFini(ScreenPtr pScreen)
{
#ifdef USE_DRI
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
if (atis->using_dri) {
ATIDRICloseScreen(pScreen);
atis->using_dri = FALSE;
}
#endif /* USE_DRI */
RemoveBlockAndWakeupHandlers(ATIBlockHandler, ATIWakeupHandler,
pScreen);
kaaDrawFini(pScreen);
}
void
ATIDrawSync(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATIWaitIdle(atis);
}

View File

@ -1,77 +0,0 @@
/*
* Copyright © 2004 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifndef _ATI_DRAW_H_
#define _ATI_DRAW_H_
Bool ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset,
int offset, int pitch);
Bool ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset);
Bool R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture);
Bool R128PrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
PixmapPtr pMask, PixmapPtr pDst);
void R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
int w, int h);
void R128DoneComposite(void);
Bool R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst);
void R128Trapezoids(KaaTrapezoid *traps, int ntraps);
void R128DoneTrapezoids(void);
Bool R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture);
Bool R100PrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
PixmapPtr pMask, PixmapPtr pDst);
Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture);
Bool R200PrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
PixmapPtr pMask, PixmapPtr pDst);
void RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX,
int dstY, int w, int h);
void RadeonDoneComposite(void);
Bool RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst);
void RadeonTrapezoids(KaaTrapezoid *traps, int ntraps);
void RadeonDoneTrapezoids(void);
void RadeonSwitchTo2D(ATIScreenInfo *atis);
void RadeonSwitchTo3D(ATIScreenInfo *atis);
void ATIWaitIdle(ATIScreenInfo *atis);
#if 0
#define ATI_FALLBACK(x) \
do { \
ErrorF("%s: ", __FUNCTION__); \
ErrorF x; \
return FALSE; \
} while (0)
#else
#define ATI_FALLBACK(x) return FALSE
#endif
#endif /* _ATI_DRAW_H_ */

View File

@ -1,240 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifdef USE_DMA
#define TAG(x) x##DMA
#define LOCALS RING_LOCALS; \
(void)atic
#define BEGIN(x) BEGIN_RING(x * 2)
#define OUT_REG(reg, val) OUT_RING_REG(reg, val)
#define END() ADVANCE_RING()
#else
#define TAG(x) x##MMIO
#define LOCALS char *mmio = atic->reg_base; \
(void)atis
#define BEGIN(x) ATIWaitAvailMMIO(x)
#define OUT_REG(reg, val) MMIO_OUT32((mmio), (reg), (val))
#define END()
#endif
static Bool
TAG(ATISetup)(PixmapPtr pDst, PixmapPtr pSrc)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
int dst_offset, dst_pitch;
int bpp = pDst->drawable.bitsPerPixel;
LOCALS;
accel_atis = atis;
dst_pitch = pDst->devKind;
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
pScreenPriv->screen->memory_base);
if ((dst_pitch & (atis->kaa.offscreenPitch - 1)) != 0)
ATI_FALLBACK(("Bad dst pitch 0x%x\n", dst_pitch));
if ((dst_offset & (atis->kaa.offscreenByteAlign - 1)) != 0)
ATI_FALLBACK(("Bad dst offset 0x%x\n", dst_offset));
if (pSrc != NULL) {
src_pitch = pSrc->devKind;
src_offset = ((CARD8 *)pSrc->devPrivate.ptr -
pScreenPriv->screen->memory_base);
if ((src_pitch & (atis->kaa.offscreenPitch - 1)) != 0)
ATI_FALLBACK(("Bad src pitch 0x%x\n", src_pitch));
if ((src_offset & (atis->kaa.offscreenByteAlign - 1)) != 0)
ATI_FALLBACK(("Bad src offset 0x%x\n", src_offset));
}
#ifdef USE_DMA
if (atic->is_radeon && !atic->is_r200)
RadeonSwitchTo2D();
#endif
BEGIN((pSrc != NULL) ? 3 : 2);
if (atic->is_radeon) {
OUT_REG(RADEON_REG_DST_PITCH_OFFSET,
((dst_pitch >> 6) << 22) | (dst_offset >> 10));
if (pSrc != NULL) {
OUT_REG(RADEON_REG_SRC_PITCH_OFFSET,
((src_pitch >> 6) << 22) | (src_offset >> 10));
}
} else {
if (is_24bpp) {
dst_pitch *= 3;
src_pitch *= 3;
}
/* R128 pitch is in units of 8 pixels, offset in 32 bytes */
OUT_REG(RADEON_REG_DST_PITCH_OFFSET,
((dst_pitch/bpp) << 21) | (dst_offset >> 5));
if (pSrc != NULL) {
OUT_REG(RADEON_REG_SRC_PITCH_OFFSET,
((src_pitch/bpp) << 21) | (src_offset >> 5));
}
}
OUT_REG(RADEON_REG_DEFAULT_SC_BOTTOM_RIGHT,
(RADEON_DEFAULT_SC_RIGHT_MAX | RADEON_DEFAULT_SC_BOTTOM_MAX));
END();
return TRUE;
}
static Bool
TAG(ATIPrepareSolid)(PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
{
KdScreenPriv(pPixmap->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
CARD32 datatype;
LOCALS;
if (is_24bpp) {
/* Solid fills in fake-24bpp mode only work if the pixel color
* and planemask are all the same byte.
*/
if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) &
0xffff)))
ATI_FALLBACK(("Can't do solid color %d in 24bpp\n"));
if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
0xffff)))
ATI_FALLBACK(("Can't do planemask %d in 24bpp\n"));
}
if (!ATIGetDatatypeBpp(pPixmap->drawable.bitsPerPixel, &datatype))
return FALSE;
if (!TAG(ATISetup)(pPixmap, NULL))
return FALSE;
BEGIN(4);
OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL,
(datatype << 8) |
RADEON_GMC_CLR_CMP_CNTL_DIS |
RADEON_GMC_AUX_CLIP_DIS |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_SRC_DATATYPE_COLOR |
(ATISolidRop[alu] << 16));
OUT_REG(RADEON_REG_DP_BRUSH_FRGD_CLR, fg);
OUT_REG(RADEON_REG_DP_WRITE_MASK, pm);
OUT_REG(RADEON_REG_DP_CNTL, RADEON_DST_X_LEFT_TO_RIGHT |
RADEON_DST_Y_TOP_TO_BOTTOM);
END();
return TRUE;
}
static void
TAG(ATISolid)(int x1, int y1, int x2, int y2)
{
ATIScreenInfo *atis = accel_atis;
ATICardInfo *atic = atis->atic;
LOCALS;
if (is_24bpp) {
x1 *= 3;
x2 *= 3;
}
BEGIN(2);
OUT_REG(RADEON_REG_DST_Y_X, (y1 << 16) | x1);
OUT_REG(RADEON_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1));
END();
}
static Bool
TAG(ATIPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
CARD32 datatype;
LOCALS;
copydx = dx;
copydy = dy;
if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
0xffff))))
ATI_FALLBACK(("Can't do planemask %d in 24bpp\n"));
if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype))
return FALSE;
if (!TAG(ATISetup)(pDst, pSrc))
return FALSE;
BEGIN(3);
OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL,
(datatype << 8) |
RADEON_GMC_CLR_CMP_CNTL_DIS |
RADEON_GMC_AUX_CLIP_DIS |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_SRC_DATATYPE_COLOR |
(ATIBltRop[alu] << 16) |
RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_DP_SRC_SOURCE_MEMORY);
OUT_REG(RADEON_REG_DP_WRITE_MASK, pm);
OUT_REG(RADEON_REG_DP_CNTL,
(dx >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) |
(dy >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0));
END();
return TRUE;
}
static void
TAG(ATICopy)(int srcX, int srcY, int dstX, int dstY, int w, int h)
{
ATIScreenInfo *atis = accel_atis;
ATICardInfo *atic = atis->atic;
LOCALS;
if (is_24bpp) {
srcX *= 3;
dstX *= 3;
w *= 3;
}
if (copydx < 0) {
srcX += w - 1;
dstX += w - 1;
}
if (copydy < 0) {
srcY += h - 1;
dstY += h - 1;
}
BEGIN(3);
OUT_REG(RADEON_REG_SRC_Y_X, (srcY << 16) | srcX);
OUT_REG(RADEON_REG_DST_Y_X, (dstY << 16) | dstX);
OUT_REG(RADEON_REG_DST_HEIGHT_WIDTH, (h << 16) | w);
END();
}
#undef TAG
#undef LOCALS
#undef BEGIN
#undef OUT_REG
#undef END

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifndef _ATI_DRI_H_
#define _ATI_DRI_H_
typedef struct {
/* DRI screen private data */
int deviceID; /* PCI device ID */
int width; /* Width in pixels of display */
int height; /* Height in scanlines of display */
int depth; /* Depth of display (8, 15, 16, 24) */
int bpp; /* Bit depth of display (8, 16, 24, 32) */
int IsPCI; /* Current card is a PCI card */
int AGPMode;
int frontOffset; /* Start of front buffer */
int frontPitch;
int backOffset; /* Start of shared back buffer */
int backPitch;
int depthOffset; /* Start of shared depth buffer */
int depthPitch;
int spanOffset; /* Start of scratch spanline */
int textureOffset; /* Start of texture data in frame buffer */
int textureSize;
int log2TexGran;
/* MMIO register data */
drmHandle registerHandle;
drmSize registerSize;
/* CCE AGP Texture data */
drmHandle gartTexHandle;
drmSize gartTexMapSize;
int log2AGPTexGran;
int gartTexOffset;
unsigned int sarea_priv_offset;
} R128DRIRec, *R128DRIPtr;
typedef struct {
/* DRI screen private data */
int deviceID; /* PCI device ID */
int width; /* Width in pixels of display */
int height; /* Height in scanlines of display */
int depth; /* Depth of display (8, 15, 16, 24) */
int bpp; /* Bit depth of display (8, 16, 24, 32) */
int IsPCI; /* Current card is a PCI card */
int AGPMode;
int frontOffset; /* Start of front buffer */
int frontPitch;
int backOffset; /* Start of shared back buffer */
int backPitch;
int depthOffset; /* Start of shared depth buffer */
int depthPitch;
int textureOffset; /* Start of texture data in frame buffer */
int textureSize;
int log2TexGran;
/* MMIO register data */
drmHandle registerHandle;
drmSize registerSize;
/* CP in-memory status information */
drmHandle statusHandle;
drmSize statusSize;
/* CP GART Texture data */
drmHandle gartTexHandle;
drmSize gartTexMapSize;
int log2GARTTexGran;
int gartTexOffset;
unsigned int sarea_priv_offset;
} RADEONDRIRec, *RADEONDRIPtr;
#endif /* _ATI_DRI_H_ */

View File

@ -1,58 +0,0 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dripriv.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation on the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Authors:
* Rickard E. Faith <faith@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
*/
#ifndef _ATI_DRIPRIV_H_
#define _ATI_DRIPRIV_H_
#ifdef GLXEXT
#include "GL/glxint.h"
extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
void **configprivs);
#endif
typedef struct {
/* Nothing here yet */
int dummy;
} ATIConfigPrivRec, *ATIConfigPrivPtr;
typedef struct {
/* Nothing here yet */
int dummy;
} ATIDRIContextRec, *ATIDRIContextPtr;
#endif

View File

@ -1,857 +0,0 @@
/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*-
* radeon_cp.c -- CP support for Radeon -*- linux-c -*-
*
* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Fremont, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
*/
/* CCE microcode (from ATI) */
#include "ati.h"
CARD32 r128_cce_microcode[] = {
0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0,
1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0,
599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1,
11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11,
262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28,
1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9,
30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656,
1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1,
15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071,
12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2,
46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1,
459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1,
18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1,
15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2,
268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1,
15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82,
1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729,
3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008,
1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0,
15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1,
180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1,
114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0,
33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370,
1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1,
14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793,
1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1,
198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1,
114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1,
1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1,
1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894,
16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14,
174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1,
33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1,
33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1,
409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
CARD32 radeon_cp_microcode[][2] = {
{ 0x21007000, 0000000000 },
{ 0x20007000, 0000000000 },
{ 0x000000b4, 0x00000004 },
{ 0x000000b8, 0x00000004 },
{ 0x6f5b4d4c, 0000000000 },
{ 0x4c4c427f, 0000000000 },
{ 0x5b568a92, 0000000000 },
{ 0x4ca09c6d, 0000000000 },
{ 0xad4c4c4c, 0000000000 },
{ 0x4ce1af3d, 0000000000 },
{ 0xd8afafaf, 0000000000 },
{ 0xd64c4cdc, 0000000000 },
{ 0x4cd10d10, 0000000000 },
{ 0x000f0000, 0x00000016 },
{ 0x362f242d, 0000000000 },
{ 0x00000012, 0x00000004 },
{ 0x000f0000, 0x00000016 },
{ 0x362f282d, 0000000000 },
{ 0x000380e7, 0x00000002 },
{ 0x04002c97, 0x00000002 },
{ 0x000f0001, 0x00000016 },
{ 0x333a3730, 0000000000 },
{ 0x000077ef, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x00000021, 0x0000001a },
{ 0x00004000, 0x0000001e },
{ 0x00061000, 0x00000002 },
{ 0x00000021, 0x0000001a },
{ 0x00004000, 0x0000001e },
{ 0x00061000, 0x00000002 },
{ 0x00000021, 0x0000001a },
{ 0x00004000, 0x0000001e },
{ 0x00000017, 0x00000004 },
{ 0x0003802b, 0x00000002 },
{ 0x040067e0, 0x00000002 },
{ 0x00000017, 0x00000004 },
{ 0x000077e0, 0x00000002 },
{ 0x00065000, 0x00000002 },
{ 0x000037e1, 0x00000002 },
{ 0x040067e1, 0x00000006 },
{ 0x000077e0, 0x00000002 },
{ 0x000077e1, 0x00000002 },
{ 0x000077e1, 0x00000006 },
{ 0xffffffff, 0000000000 },
{ 0x10000000, 0000000000 },
{ 0x0003802b, 0x00000002 },
{ 0x040067e0, 0x00000006 },
{ 0x00007675, 0x00000002 },
{ 0x00007676, 0x00000002 },
{ 0x00007677, 0x00000002 },
{ 0x00007678, 0x00000006 },
{ 0x0003802c, 0x00000002 },
{ 0x04002676, 0x00000002 },
{ 0x00007677, 0x00000002 },
{ 0x00007678, 0x00000006 },
{ 0x0000002f, 0x00000018 },
{ 0x0000002f, 0x00000018 },
{ 0000000000, 0x00000006 },
{ 0x00000030, 0x00000018 },
{ 0x00000030, 0x00000018 },
{ 0000000000, 0x00000006 },
{ 0x01605000, 0x00000002 },
{ 0x00065000, 0x00000002 },
{ 0x00098000, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x64c0603e, 0x00000004 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00080000, 0x00000016 },
{ 0000000000, 0000000000 },
{ 0x0400251d, 0x00000002 },
{ 0x00007580, 0x00000002 },
{ 0x00067581, 0x00000002 },
{ 0x04002580, 0x00000002 },
{ 0x00067581, 0x00000002 },
{ 0x00000049, 0x00000004 },
{ 0x00005000, 0000000000 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x0000750e, 0x00000002 },
{ 0x00019000, 0x00000002 },
{ 0x00011055, 0x00000014 },
{ 0x00000055, 0x00000012 },
{ 0x0400250f, 0x00000002 },
{ 0x0000504f, 0x00000004 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00007565, 0x00000002 },
{ 0x00007566, 0x00000002 },
{ 0x00000058, 0x00000004 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x01e655b4, 0x00000002 },
{ 0x4401b0e4, 0x00000002 },
{ 0x01c110e4, 0x00000002 },
{ 0x26667066, 0x00000018 },
{ 0x040c2565, 0x00000002 },
{ 0x00000066, 0x00000018 },
{ 0x04002564, 0x00000002 },
{ 0x00007566, 0x00000002 },
{ 0x0000005d, 0x00000004 },
{ 0x00401069, 0x00000008 },
{ 0x00101000, 0x00000002 },
{ 0x000d80ff, 0x00000002 },
{ 0x0080006c, 0x00000008 },
{ 0x000f9000, 0x00000002 },
{ 0x000e00ff, 0x00000002 },
{ 0000000000, 0x00000006 },
{ 0x0000008f, 0x00000018 },
{ 0x0000005b, 0x00000004 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00007576, 0x00000002 },
{ 0x00065000, 0x00000002 },
{ 0x00009000, 0x00000002 },
{ 0x00041000, 0x00000002 },
{ 0x0c00350e, 0x00000002 },
{ 0x00049000, 0x00000002 },
{ 0x00051000, 0x00000002 },
{ 0x01e785f8, 0x00000002 },
{ 0x00200000, 0x00000002 },
{ 0x0060007e, 0x0000000c },
{ 0x00007563, 0x00000002 },
{ 0x006075f0, 0x00000021 },
{ 0x20007073, 0x00000004 },
{ 0x00005073, 0x00000004 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00007576, 0x00000002 },
{ 0x00007577, 0x00000002 },
{ 0x0000750e, 0x00000002 },
{ 0x0000750f, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00600083, 0x0000000c },
{ 0x006075f0, 0x00000021 },
{ 0x000075f8, 0x00000002 },
{ 0x00000083, 0x00000004 },
{ 0x000a750e, 0x00000002 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x0020750f, 0x00000002 },
{ 0x00600086, 0x00000004 },
{ 0x00007570, 0x00000002 },
{ 0x00007571, 0x00000002 },
{ 0x00007572, 0x00000006 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00005000, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00007568, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x00000095, 0x0000000c },
{ 0x00058000, 0x00000002 },
{ 0x0c607562, 0x00000002 },
{ 0x00000097, 0x00000004 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x00600096, 0x00000004 },
{ 0x400070e5, 0000000000 },
{ 0x000380e6, 0x00000002 },
{ 0x040025c5, 0x00000002 },
{ 0x000380e5, 0x00000002 },
{ 0x000000a8, 0x0000001c },
{ 0x000650aa, 0x00000018 },
{ 0x040025bb, 0x00000002 },
{ 0x000610ab, 0x00000018 },
{ 0x040075bc, 0000000000 },
{ 0x000075bb, 0x00000002 },
{ 0x000075bc, 0000000000 },
{ 0x00090000, 0x00000006 },
{ 0x00090000, 0x00000002 },
{ 0x000d8002, 0x00000006 },
{ 0x00007832, 0x00000002 },
{ 0x00005000, 0x00000002 },
{ 0x000380e7, 0x00000002 },
{ 0x04002c97, 0x00000002 },
{ 0x00007820, 0x00000002 },
{ 0x00007821, 0x00000002 },
{ 0x00007800, 0000000000 },
{ 0x01200000, 0x00000002 },
{ 0x20077000, 0x00000002 },
{ 0x01200000, 0x00000002 },
{ 0x20007000, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x0120751b, 0x00000002 },
{ 0x8040750a, 0x00000002 },
{ 0x8040750b, 0x00000002 },
{ 0x00110000, 0x00000002 },
{ 0x000380e5, 0x00000002 },
{ 0x000000c6, 0x0000001c },
{ 0x000610ab, 0x00000018 },
{ 0x844075bd, 0x00000002 },
{ 0x000610aa, 0x00000018 },
{ 0x840075bb, 0x00000002 },
{ 0x000610ab, 0x00000018 },
{ 0x844075bc, 0x00000002 },
{ 0x000000c9, 0x00000004 },
{ 0x804075bd, 0x00000002 },
{ 0x800075bb, 0x00000002 },
{ 0x804075bc, 0x00000002 },
{ 0x00108000, 0x00000002 },
{ 0x01400000, 0x00000002 },
{ 0x006000cd, 0x0000000c },
{ 0x20c07000, 0x00000020 },
{ 0x000000cf, 0x00000012 },
{ 0x00800000, 0x00000006 },
{ 0x0080751d, 0x00000006 },
{ 0000000000, 0000000000 },
{ 0x0000775c, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00661000, 0x00000002 },
{ 0x0460275d, 0x00000020 },
{ 0x00004000, 0000000000 },
{ 0x01e00830, 0x00000002 },
{ 0x21007000, 0000000000 },
{ 0x6464614d, 0000000000 },
{ 0x69687420, 0000000000 },
{ 0x00000073, 0000000000 },
{ 0000000000, 0000000000 },
{ 0x00005000, 0x00000002 },
{ 0x000380d0, 0x00000002 },
{ 0x040025e0, 0x00000002 },
{ 0x000075e1, 0000000000 },
{ 0x00000001, 0000000000 },
{ 0x000380e0, 0x00000002 },
{ 0x04002394, 0x00000002 },
{ 0x00005000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0x00000008, 0000000000 },
{ 0x00000004, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
};
CARD32 r200_cp_microcode[][2] = {
{ 0x21007000, 0000000000 },
{ 0x20007000, 0000000000 },
{ 0x000000ab, 0x00000004 },
{ 0x000000af, 0x00000004 },
{ 0x66544a49, 0000000000 },
{ 0x49494174, 0000000000 },
{ 0x54517d83, 0000000000 },
{ 0x498d8b64, 0000000000 },
{ 0x49494949, 0000000000 },
{ 0x49da493c, 0000000000 },
{ 0x49989898, 0000000000 },
{ 0xd34949d5, 0000000000 },
{ 0x9dc90e11, 0000000000 },
{ 0xce9b9b9b, 0000000000 },
{ 0x000f0000, 0x00000016 },
{ 0x352e232c, 0000000000 },
{ 0x00000013, 0x00000004 },
{ 0x000f0000, 0x00000016 },
{ 0x352e272c, 0000000000 },
{ 0x000f0001, 0x00000016 },
{ 0x3239362f, 0000000000 },
{ 0x000077ef, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x00000020, 0x0000001a },
{ 0x00004000, 0x0000001e },
{ 0x00061000, 0x00000002 },
{ 0x00000020, 0x0000001a },
{ 0x00004000, 0x0000001e },
{ 0x00061000, 0x00000002 },
{ 0x00000020, 0x0000001a },
{ 0x00004000, 0x0000001e },
{ 0x00000016, 0x00000004 },
{ 0x0003802a, 0x00000002 },
{ 0x040067e0, 0x00000002 },
{ 0x00000016, 0x00000004 },
{ 0x000077e0, 0x00000002 },
{ 0x00065000, 0x00000002 },
{ 0x000037e1, 0x00000002 },
{ 0x040067e1, 0x00000006 },
{ 0x000077e0, 0x00000002 },
{ 0x000077e1, 0x00000002 },
{ 0x000077e1, 0x00000006 },
{ 0xffffffff, 0000000000 },
{ 0x10000000, 0000000000 },
{ 0x0003802a, 0x00000002 },
{ 0x040067e0, 0x00000006 },
{ 0x00007675, 0x00000002 },
{ 0x00007676, 0x00000002 },
{ 0x00007677, 0x00000002 },
{ 0x00007678, 0x00000006 },
{ 0x0003802b, 0x00000002 },
{ 0x04002676, 0x00000002 },
{ 0x00007677, 0x00000002 },
{ 0x00007678, 0x00000006 },
{ 0x0000002e, 0x00000018 },
{ 0x0000002e, 0x00000018 },
{ 0000000000, 0x00000006 },
{ 0x0000002f, 0x00000018 },
{ 0x0000002f, 0x00000018 },
{ 0000000000, 0x00000006 },
{ 0x01605000, 0x00000002 },
{ 0x00065000, 0x00000002 },
{ 0x00098000, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x64c0603d, 0x00000004 },
{ 0x00080000, 0x00000016 },
{ 0000000000, 0000000000 },
{ 0x0400251d, 0x00000002 },
{ 0x00007580, 0x00000002 },
{ 0x00067581, 0x00000002 },
{ 0x04002580, 0x00000002 },
{ 0x00067581, 0x00000002 },
{ 0x00000046, 0x00000004 },
{ 0x00005000, 0000000000 },
{ 0x00061000, 0x00000002 },
{ 0x0000750e, 0x00000002 },
{ 0x00019000, 0x00000002 },
{ 0x00011055, 0x00000014 },
{ 0x00000055, 0x00000012 },
{ 0x0400250f, 0x00000002 },
{ 0x0000504a, 0x00000004 },
{ 0x00007565, 0x00000002 },
{ 0x00007566, 0x00000002 },
{ 0x00000051, 0x00000004 },
{ 0x01e655b4, 0x00000002 },
{ 0x4401b0dc, 0x00000002 },
{ 0x01c110dc, 0x00000002 },
{ 0x2666705d, 0x00000018 },
{ 0x040c2565, 0x00000002 },
{ 0x0000005d, 0x00000018 },
{ 0x04002564, 0x00000002 },
{ 0x00007566, 0x00000002 },
{ 0x00000054, 0x00000004 },
{ 0x00401060, 0x00000008 },
{ 0x00101000, 0x00000002 },
{ 0x000d80ff, 0x00000002 },
{ 0x00800063, 0x00000008 },
{ 0x000f9000, 0x00000002 },
{ 0x000e00ff, 0x00000002 },
{ 0000000000, 0x00000006 },
{ 0x00000080, 0x00000018 },
{ 0x00000054, 0x00000004 },
{ 0x00007576, 0x00000002 },
{ 0x00065000, 0x00000002 },
{ 0x00009000, 0x00000002 },
{ 0x00041000, 0x00000002 },
{ 0x0c00350e, 0x00000002 },
{ 0x00049000, 0x00000002 },
{ 0x00051000, 0x00000002 },
{ 0x01e785f8, 0x00000002 },
{ 0x00200000, 0x00000002 },
{ 0x00600073, 0x0000000c },
{ 0x00007563, 0x00000002 },
{ 0x006075f0, 0x00000021 },
{ 0x20007068, 0x00000004 },
{ 0x00005068, 0x00000004 },
{ 0x00007576, 0x00000002 },
{ 0x00007577, 0x00000002 },
{ 0x0000750e, 0x00000002 },
{ 0x0000750f, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00600076, 0x0000000c },
{ 0x006075f0, 0x00000021 },
{ 0x000075f8, 0x00000002 },
{ 0x00000076, 0x00000004 },
{ 0x000a750e, 0x00000002 },
{ 0x0020750f, 0x00000002 },
{ 0x00600079, 0x00000004 },
{ 0x00007570, 0x00000002 },
{ 0x00007571, 0x00000002 },
{ 0x00007572, 0x00000006 },
{ 0x00005000, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00007568, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x00000084, 0x0000000c },
{ 0x00058000, 0x00000002 },
{ 0x0c607562, 0x00000002 },
{ 0x00000086, 0x00000004 },
{ 0x00600085, 0x00000004 },
{ 0x400070dd, 0000000000 },
{ 0x000380dd, 0x00000002 },
{ 0x00000093, 0x0000001c },
{ 0x00065095, 0x00000018 },
{ 0x040025bb, 0x00000002 },
{ 0x00061096, 0x00000018 },
{ 0x040075bc, 0000000000 },
{ 0x000075bb, 0x00000002 },
{ 0x000075bc, 0000000000 },
{ 0x00090000, 0x00000006 },
{ 0x00090000, 0x00000002 },
{ 0x000d8002, 0x00000006 },
{ 0x00005000, 0x00000002 },
{ 0x00007821, 0x00000002 },
{ 0x00007800, 0000000000 },
{ 0x00007821, 0x00000002 },
{ 0x00007800, 0000000000 },
{ 0x01665000, 0x00000002 },
{ 0x000a0000, 0x00000002 },
{ 0x000671cc, 0x00000002 },
{ 0x0286f1cd, 0x00000002 },
{ 0x000000a3, 0x00000010 },
{ 0x21007000, 0000000000 },
{ 0x000000aa, 0x0000001c },
{ 0x00065000, 0x00000002 },
{ 0x000a0000, 0x00000002 },
{ 0x00061000, 0x00000002 },
{ 0x000b0000, 0x00000002 },
{ 0x38067000, 0x00000002 },
{ 0x000a00a6, 0x00000004 },
{ 0x20007000, 0000000000 },
{ 0x01200000, 0x00000002 },
{ 0x20077000, 0x00000002 },
{ 0x01200000, 0x00000002 },
{ 0x20007000, 0000000000 },
{ 0x00061000, 0x00000002 },
{ 0x0120751b, 0x00000002 },
{ 0x8040750a, 0x00000002 },
{ 0x8040750b, 0x00000002 },
{ 0x00110000, 0x00000002 },
{ 0x000380dd, 0x00000002 },
{ 0x000000bd, 0x0000001c },
{ 0x00061096, 0x00000018 },
{ 0x844075bd, 0x00000002 },
{ 0x00061095, 0x00000018 },
{ 0x840075bb, 0x00000002 },
{ 0x00061096, 0x00000018 },
{ 0x844075bc, 0x00000002 },
{ 0x000000c0, 0x00000004 },
{ 0x804075bd, 0x00000002 },
{ 0x800075bb, 0x00000002 },
{ 0x804075bc, 0x00000002 },
{ 0x00108000, 0x00000002 },
{ 0x01400000, 0x00000002 },
{ 0x006000c4, 0x0000000c },
{ 0x20c07000, 0x00000020 },
{ 0x000000c6, 0x00000012 },
{ 0x00800000, 0x00000006 },
{ 0x0080751d, 0x00000006 },
{ 0x000025bb, 0x00000002 },
{ 0x000040c0, 0x00000004 },
{ 0x0000775c, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00661000, 0x00000002 },
{ 0x0460275d, 0x00000020 },
{ 0x00004000, 0000000000 },
{ 0x00007999, 0x00000002 },
{ 0x00a05000, 0x00000002 },
{ 0x00661000, 0x00000002 },
{ 0x0460299b, 0x00000020 },
{ 0x00004000, 0000000000 },
{ 0x01e00830, 0x00000002 },
{ 0x21007000, 0000000000 },
{ 0x00005000, 0x00000002 },
{ 0x00038042, 0x00000002 },
{ 0x040025e0, 0x00000002 },
{ 0x000075e1, 0000000000 },
{ 0x00000001, 0000000000 },
{ 0x000380d9, 0x00000002 },
{ 0x04007394, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
};
/* Microcode from http://volodya-project.sourceforge.net/ */
CARD32 r300_cp_microcode[][2] = {
{ 0x4200e000, 0000000000 },
{ 0x4000e000, 0000000000 },
{ 0x000000af, 0x00000008 },
{ 0x000000b3, 0x00000008 },
{ 0x6c5a504f, 0000000000 },
{ 0x4f4f497a, 0000000000 },
{ 0x5a578288, 0000000000 },
{ 0x4f91906a, 0000000000 },
{ 0x4f4f4f4f, 0000000000 },
{ 0x4fe24f44, 0000000000 },
{ 0x4f9c9c9c, 0000000000 },
{ 0xdc4f4fde, 0000000000 },
{ 0xa1cd4f4f, 0000000000 },
{ 0xd29d9d9d, 0000000000 },
{ 0x4f0f9fd7, 0000000000 },
{ 0x000ca000, 0x00000004 },
{ 0x000d0012, 0x00000038 },
{ 0x0000e8b4, 0x00000004 },
{ 0x000d0014, 0x00000038 },
{ 0x0000e8b6, 0x00000004 },
{ 0x000d0016, 0x00000038 },
{ 0x0000e854, 0x00000004 },
{ 0x000d0018, 0x00000038 },
{ 0x0000e855, 0x00000004 },
{ 0x000d001a, 0x00000038 },
{ 0x0000e856, 0x00000004 },
{ 0x000d001c, 0x00000038 },
{ 0x0000e857, 0x00000004 },
{ 0x000d001e, 0x00000038 },
{ 0x0000e824, 0x00000004 },
{ 0x000d0020, 0x00000038 },
{ 0x0000e825, 0x00000004 },
{ 0x000d0022, 0x00000038 },
{ 0x0000e830, 0x00000004 },
{ 0x000d0024, 0x00000038 },
{ 0x0000f0c0, 0x00000004 },
{ 0x000d0026, 0x00000038 },
{ 0x0000f0c1, 0x00000004 },
{ 0x000d0028, 0x00000038 },
{ 0x0000f041, 0x00000004 },
{ 0x000d002a, 0x00000038 },
{ 0x0000f184, 0x00000004 },
{ 0x000d002c, 0x00000038 },
{ 0x0000f185, 0x00000004 },
{ 0x000d002e, 0x00000038 },
{ 0x0000f186, 0x00000004 },
{ 0x000d0030, 0x00000038 },
{ 0x0000f187, 0x00000004 },
{ 0x000d0032, 0x00000038 },
{ 0x0000f180, 0x00000004 },
{ 0x000d0034, 0x00000038 },
{ 0x0000f393, 0x00000004 },
{ 0x000d0036, 0x00000038 },
{ 0x0000f38a, 0x00000004 },
{ 0x000d0038, 0x00000038 },
{ 0x0000f38e, 0x00000004 },
{ 0x0000e821, 0x00000004 },
{ 0x0140a000, 0x00000004 },
{ 0x00000043, 0x00000018 },
{ 0x00cce800, 0x00000004 },
{ 0x001b0001, 0x00000004 },
{ 0x08004800, 0x00000004 },
{ 0x001b0001, 0x00000004 },
{ 0x08004800, 0x00000004 },
{ 0x001b0001, 0x00000004 },
{ 0x08004800, 0x00000004 },
{ 0x0000003a, 0x00000008 },
{ 0x0000a000, 0000000000 },
{ 0x02c0a000, 0x00000004 },
{ 0x000ca000, 0x00000004 },
{ 0x00130000, 0x00000004 },
{ 0x000c2000, 0x00000004 },
{ 0xc980c045, 0x00000008 },
{ 0x2000451d, 0x00000004 },
{ 0x0000e580, 0x00000004 },
{ 0x000ce581, 0x00000004 },
{ 0x08004580, 0x00000004 },
{ 0x000ce581, 0x00000004 },
{ 0x0000004c, 0x00000008 },
{ 0x0000a000, 0000000000 },
{ 0x000c2000, 0x00000004 },
{ 0x0000e50e, 0x00000004 },
{ 0x00032000, 0x00000004 },
{ 0x00022056, 0x00000028 },
{ 0x00000056, 0x00000024 },
{ 0x0800450f, 0x00000004 },
{ 0x0000a050, 0x00000008 },
{ 0x0000e565, 0x00000004 },
{ 0x0000e566, 0x00000004 },
{ 0x00000057, 0x00000008 },
{ 0x03cca5b4, 0x00000004 },
{ 0x05432000, 0x00000004 },
{ 0x00022000, 0x00000004 },
{ 0x4ccce063, 0x00000030 },
{ 0x08274565, 0x00000004 },
{ 0x00000063, 0x00000030 },
{ 0x08004564, 0x00000004 },
{ 0x0000e566, 0x00000004 },
{ 0x0000005a, 0x00000008 },
{ 0x00802066, 0x00000010 },
{ 0x00202000, 0x00000004 },
{ 0x001b00ff, 0x00000004 },
{ 0x01000069, 0x00000010 },
{ 0x001f2000, 0x00000004 },
{ 0x001c00ff, 0x00000004 },
{ 0000000000, 0x0000000c },
{ 0x00000085, 0x00000030 },
{ 0x0000005a, 0x00000008 },
{ 0x0000e576, 0x00000004 },
{ 0x000ca000, 0x00000004 },
{ 0x00012000, 0x00000004 },
{ 0x00082000, 0x00000004 },
{ 0x1800650e, 0x00000004 },
{ 0x00092000, 0x00000004 },
{ 0x000a2000, 0x00000004 },
{ 0x000f0000, 0x00000004 },
{ 0x00400000, 0x00000004 },
{ 0x00000079, 0x00000018 },
{ 0x0000e563, 0x00000004 },
{ 0x00c0e5f9, 0x000000c2 },
{ 0x0000006e, 0x00000008 },
{ 0x0000a06e, 0x00000008 },
{ 0x0000e576, 0x00000004 },
{ 0x0000e577, 0x00000004 },
{ 0x0000e50e, 0x00000004 },
{ 0x0000e50f, 0x00000004 },
{ 0x0140a000, 0x00000004 },
{ 0x0000007c, 0x00000018 },
{ 0x00c0e5f9, 0x000000c2 },
{ 0x0000007c, 0x00000008 },
{ 0x0014e50e, 0x00000004 },
{ 0x0040e50f, 0x00000004 },
{ 0x00c0007f, 0x00000008 },
{ 0x0000e570, 0x00000004 },
{ 0x0000e571, 0x00000004 },
{ 0x0000e572, 0x0000000c },
{ 0x0000a000, 0x00000004 },
{ 0x0140a000, 0x00000004 },
{ 0x0000e568, 0x00000004 },
{ 0x000c2000, 0x00000004 },
{ 0x00000089, 0x00000018 },
{ 0x000b0000, 0x00000004 },
{ 0x18c0e562, 0x00000004 },
{ 0x0000008b, 0x00000008 },
{ 0x00c0008a, 0x00000008 },
{ 0x000700e4, 0x00000004 },
{ 0x00000097, 0x00000038 },
{ 0x000ca099, 0x00000030 },
{ 0x080045bb, 0x00000004 },
{ 0x000c209a, 0x00000030 },
{ 0x0800e5bc, 0000000000 },
{ 0x0000e5bb, 0x00000004 },
{ 0x0000e5bc, 0000000000 },
{ 0x00120000, 0x0000000c },
{ 0x00120000, 0x00000004 },
{ 0x001b0002, 0x0000000c },
{ 0x0000a000, 0x00000004 },
{ 0x0000e821, 0x00000004 },
{ 0x0000e800, 0000000000 },
{ 0x0000e821, 0x00000004 },
{ 0x0000e82e, 0000000000 },
{ 0x02cca000, 0x00000004 },
{ 0x00140000, 0x00000004 },
{ 0x000ce1cc, 0x00000004 },
{ 0x050de1cd, 0x00000004 },
{ 0x000000a7, 0x00000020 },
{ 0x4200e000, 0000000000 },
{ 0x000000ae, 0x00000038 },
{ 0x000ca000, 0x00000004 },
{ 0x00140000, 0x00000004 },
{ 0x000c2000, 0x00000004 },
{ 0x00160000, 0x00000004 },
{ 0x700ce000, 0x00000004 },
{ 0x001400aa, 0x00000008 },
{ 0x4000e000, 0000000000 },
{ 0x02400000, 0x00000004 },
{ 0x400ee000, 0x00000004 },
{ 0x02400000, 0x00000004 },
{ 0x4000e000, 0000000000 },
{ 0x000c2000, 0x00000004 },
{ 0x0240e51b, 0x00000004 },
{ 0x0080e50a, 0x00000005 },
{ 0x0080e50b, 0x00000005 },
{ 0x00220000, 0x00000004 },
{ 0x000700e4, 0x00000004 },
{ 0x000000c1, 0x00000038 },
{ 0x000c209a, 0x00000030 },
{ 0x0880e5bd, 0x00000005 },
{ 0x000c2099, 0x00000030 },
{ 0x0800e5bb, 0x00000005 },
{ 0x000c209a, 0x00000030 },
{ 0x0880e5bc, 0x00000005 },
{ 0x000000c4, 0x00000008 },
{ 0x0080e5bd, 0x00000005 },
{ 0x0000e5bb, 0x00000005 },
{ 0x0080e5bc, 0x00000005 },
{ 0x00210000, 0x00000004 },
{ 0x02800000, 0x00000004 },
{ 0x00c000c8, 0x00000018 },
{ 0x4180e000, 0x00000040 },
{ 0x000000ca, 0x00000024 },
{ 0x01000000, 0x0000000c },
{ 0x0100e51d, 0x0000000c },
{ 0x000045bb, 0x00000004 },
{ 0x000080c4, 0x00000008 },
{ 0x0000f3ce, 0x00000004 },
{ 0x0140a000, 0x00000004 },
{ 0x00cc2000, 0x00000004 },
{ 0x08c053cf, 0x00000040 },
{ 0x00008000, 0000000000 },
{ 0x0000f3d2, 0x00000004 },
{ 0x0140a000, 0x00000004 },
{ 0x00cc2000, 0x00000004 },
{ 0x08c053d3, 0x00000040 },
{ 0x00008000, 0000000000 },
{ 0x0000f39d, 0x00000004 },
{ 0x0140a000, 0x00000004 },
{ 0x00cc2000, 0x00000004 },
{ 0x08c0539e, 0x00000040 },
{ 0x00008000, 0000000000 },
{ 0x03c00830, 0x00000004 },
{ 0x4200e000, 0000000000 },
{ 0x0000a000, 0x00000004 },
{ 0x200045e0, 0x00000004 },
{ 0x0000e5e1, 0000000000 },
{ 0x00000001, 0000000000 },
{ 0x000700e1, 0x00000004 },
{ 0x0800e394, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
{ 0000000000, 0000000000 },
};

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifndef _ATI_SAREA_H_
#define _ATI_SAREA_H_
/* There are 2 heaps (local/AGP). Each region within a heap is a
* minimum of 64k, and there are at most 64 of them per heap.
*/
#define ATI_CARD_HEAP 0
#define ATI_GART_HEAP 1
#define ATI_NR_TEX_HEAPS 2
#define ATI_NR_TEX_REGIONS 64
#define ATI_LOG_TEX_GRANULARITY 16
#include "r128_sarea.h"
#include "radeon_sarea.h"
#endif /* _ATI_SAREA_H_ */

View File

@ -1,79 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ati.h"
#include "klinux.h"
extern struct pci_id_entry ati_pci_ids[];
void
InitCard(char *name)
{
struct pci_id_entry *id;
KdCardAttr attr;
for (id = ati_pci_ids; id->name != NULL; id++) {
int j = 0;
while (LinuxFindPci(id->vendor, id->device, j++, &attr))
KdCardInfoAdd(&ATIFuncs, &attr, 0);
}
}
void
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
KdInitOutput(pScreenInfo, argc, argv);
}
void
InitInput(int argc, char **argv)
{
KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
}
void
ddxUseMsg (void)
{
KdUseMsg();
#ifdef KDRIVEVESA
vesaUseMsg();
#endif
}
int
ddxProcessArgument(int argc, char **argv, int i)
{
int ret;
#ifdef KDRIVEVESA
if (!(ret = vesaProcessArgument (argc, argv, i)))
#endif
ret = KdProcessArgument(argc, argv, i);
return ret;
}

View File

@ -1,950 +0,0 @@
/*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Based on mach64video.c by Keith Packard.
*/
/* $RCSId$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ati.h"
#include "ati_dma.h"
#include "ati_draw.h"
#include "ati_reg.h"
#include "kaa.h"
#include <X11/extensions/Xv.h>
#include "fourcc.h"
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
static Atom xvBrightness, xvSaturation;
extern CARD8 ATIBltRop[16];
#define IMAGE_MAX_WIDTH 2048
#define IMAGE_MAX_HEIGHT 2048
static void
ATIStopVideo(KdScreenInfo *screen, pointer data, Bool exit)
{
ScreenPtr pScreen = screen->pScreen;
ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
if (pPortPriv->off_screen) {
KdOffscreenFree (pScreen, pPortPriv->off_screen);
pPortPriv->off_screen = 0;
}
}
static int
ATISetPortAttribute(KdScreenInfo *screen, Atom attribute, int value,
pointer data)
{
return BadMatch;
}
static int
ATIGetPortAttribute(KdScreenInfo *screen, Atom attribute, int *value,
pointer data)
{
return BadMatch;
}
static void
ATIQueryBestSize(KdScreenInfo *screen, Bool motion, short vid_w, short vid_h,
short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h,
pointer data)
{
*p_w = drw_w;
*p_h = drw_h;
}
/* ATIClipVideo -
Takes the dst box in standard X BoxRec form (top and left
edges inclusive, bottom and right exclusive). The new dst
box is returned. The source boundaries are given (x1, y1
inclusive, x2, y2 exclusive) and returned are the new source
boundaries in 16.16 fixed point.
*/
static void
ATIClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2,
BoxPtr extents, INT32 width, INT32 height)
{
INT32 vscale, hscale, delta;
int diff;
hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
*x1 <<= 16; *x2 <<= 16;
*y1 <<= 16; *y2 <<= 16;
diff = extents->x1 - dst->x1;
if (diff > 0) {
dst->x1 = extents->x1;
*x1 += diff * hscale;
}
diff = dst->x2 - extents->x2;
if (diff > 0) {
dst->x2 = extents->x2;
*x2 -= diff * hscale;
}
diff = extents->y1 - dst->y1;
if (diff > 0) {
dst->y1 = extents->y1;
*y1 += diff * vscale;
}
diff = dst->y2 - extents->y2;
if (diff > 0) {
dst->y2 = extents->y2;
*y2 -= diff * vscale;
}
if (*x1 < 0) {
diff = (- *x1 + hscale - 1)/ hscale;
dst->x1 += diff;
*x1 += diff * hscale;
}
delta = *x2 - (width << 16);
if (delta > 0) {
diff = (delta + hscale - 1)/ hscale;
dst->x2 -= diff;
*x2 -= diff * hscale;
}
if (*y1 < 0) {
diff = (- *y1 + vscale - 1)/ vscale;
dst->y1 += diff;
*y1 += diff * vscale;
}
delta = *y2 - (height << 16);
if (delta > 0) {
diff = (delta + vscale - 1)/ vscale;
dst->y2 -= diff;
*y2 -= diff * vscale;
}
}
static void
R128DisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv)
{
ScreenPtr pScreen = screen->pScreen;
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 dstDatatype, srcDatatype;
CARD32 dst_offset, dst_pitch;
int dstxoff, dstyoff;
PixmapPtr pPixmap = pPortPriv->pPixmap;
int bpp = pPixmap->drawable.bitsPerPixel;
RING_LOCALS;
BoxPtr pBox = REGION_RECTS(&pPortPriv->clip);
int nBox = REGION_NUM_RECTS(&pPortPriv->clip);
if (pPortPriv->id == FOURCC_UYVY)
srcDatatype = R128_DATATYPE_YVYU_422;
else
srcDatatype = R128_DATATYPE_VYUY_422;
switch (bpp)
{
case 16:
if (pPixmap->drawable.depth == 15)
dstDatatype = R128_DATATYPE_ARGB1555;
else
dstDatatype = R128_DATATYPE_RGB565;
break;
case 32:
dstDatatype = R128_DATATYPE_ARGB8888;
break;
default:
return;
}
dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr -
pScreenPriv->screen->memory_base);
dst_pitch = pPixmap->devKind;
#ifdef COMPOSITE
dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
#else
dstxoff = 0;
dstyoff = 0;
#endif
BEGIN_DMA(18);
OUT_REG(ATI_REG_DST_PITCH_OFFSET,
((dst_pitch / bpp) << 21) | (dst_offset >> 5));
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
ATI_GMC_DST_PITCH_OFFSET_CNTL |
ATI_GMC_BRUSH_NONE |
(dstDatatype << 8) |
ATI_GMC_SRC_DATATYPE_COLOR |
(ATIBltRop[GXcopy] << 16) |
R128_GMC_3D_FCN_EN |
ATI_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS);
OUT_REG(ATI_REG_DP_CNTL,
ATI_DST_X_LEFT_TO_RIGHT | ATI_DST_Y_TOP_TO_BOTTOM );
OUT_REG(R128_REG_SCALE_3D_CNTL,
R128_SCALE_3D_SCALE |
R128_SBLEND_ONE |
R128_DBLEND_ZERO);
OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_CACHE_FLUSH);
OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype);
OUT_RING(DMA_PACKET0(R128_REG_SCALE_PITCH, 5));
OUT_RING(pPortPriv->src_pitch / 16);
OUT_RING((pPortPriv->src_w << 16) / pPortPriv->dst_w);
OUT_RING((pPortPriv->src_h << 16) / pPortPriv->dst_h);
OUT_RING(0x0);
OUT_RING(0x0);
END_DMA();
while (nBox--) {
int srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth;
dstX = pBox->x1 + dstxoff;
dstY = pBox->y1 + dstyoff;
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
srcX = (pBox->x1 - pPortPriv->dst_x1) *
pPortPriv->src_w / pPortPriv->dst_w;
srcY = (pBox->y1 - pPortPriv->dst_y1) *
pPortPriv->src_h / pPortPriv->dst_h;
srcw = pPortPriv->src_w - srcX;
srch = pPortPriv->src_h - srcY;
BEGIN_DMA(6);
/* R128_REG_SCALE_SRC_HEIGHT_WIDTH,
* R128_REG_SCALE_OFFSET_0
*/
OUT_RING(DMA_PACKET0(R128_REG_SCALE_SRC_HEIGHT_WIDTH, 2));
OUT_RING((srch << 16) | srcw);
OUT_RING(pPortPriv->src_offset + srcY * pPortPriv->src_pitch +
srcX * 2);
/* R128_REG_SCALE_DST_X_Y
* R128_REG_SCALE_DST_HEIGHT_WIDTH
*/
OUT_RING(DMA_PACKET0(R128_REG_SCALE_DST_X_Y, 2));
OUT_RING((dstX << 16) | dstY);
OUT_RING((dsth << 16) | dstw);
END_DMA();
pBox++;
}
#ifdef DAMAGEEXT
/* XXX: Shouldn't this be in kxv.c instead? */
DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
#endif
KdMarkSync(pScreen);
}
union intfloat {
float f;
CARD32 i;
};
struct blend_vertex {
union intfloat x, y;
union intfloat s0, t0;
};
#define VTX_DWORD_COUNT 4
#define VTX_OUT(vtx) \
do { \
OUT_RING(vtx.x.i); \
OUT_RING(vtx.y.i); \
OUT_RING(vtx.s0.i); \
OUT_RING(vtx.t0.i); \
} while (0)
static void
RadeonDisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv)
{
ScreenPtr pScreen = screen->pScreen;
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
struct blend_vertex vtx[4];
PixmapPtr pPixmap = pPortPriv->pPixmap;
CARD32 txformat;
CARD32 dst_offset, dst_pitch, dst_format;
int dstxoff, dstyoff, pixel_shift;
RING_LOCALS;
BoxPtr pBox = REGION_RECTS(&pPortPriv->clip);
int nBox = REGION_NUM_RECTS(&pPortPriv->clip);
switch (pPixmap->drawable.bitsPerPixel)
{
case 16:
if (pPixmap->drawable.depth == 15)
dst_format = RADEON_COLOR_FORMAT_ARGB1555;
else
dst_format = RADEON_COLOR_FORMAT_RGB565;
pixel_shift = 1;
break;
case 32:
dst_format = RADEON_COLOR_FORMAT_ARGB8888;
pixel_shift = 2;
break;
default:
return;
}
dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr -
pScreenPriv->screen->memory_base);
dst_pitch = pPixmap->devKind;
#ifdef COMPOSITE
dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
#else
dstxoff = 0;
dstyoff = 0;
#endif
if (pPortPriv->id == FOURCC_UYVY)
txformat = RADEON_TXFORMAT_YVYU422;
else
txformat = RADEON_TXFORMAT_VYUY422;
txformat |= RADEON_TXFORMAT_NON_POWER2;
/* RADEON_REG_PP_TXFILTER_0,
* RADEON_REG_PP_TXFORMAT_0,
* RADEON_REG_PP_TXOFFSET_0
*/
BEGIN_DMA(4);
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 3));
OUT_RING(RADEON_YUV_TO_RGB);
OUT_RING(txformat);
OUT_RING(pPortPriv->src_offset);
END_DMA();
/* RADEON_REG_PP_TEX_SIZE_0,
* RADEON_REG_PP_TEX_PITCH_0
*/
BEGIN_DMA(3);
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2));
OUT_RING((pPixmap->drawable.width - 1) |
((pPixmap->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_RING(pPortPriv->src_pitch - 32);
END_DMA();
BEGIN_DMA(14);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
/* RADEON_REG_PP_CNTL,
* RADEON_REG_RB3D_CNTL,
* RADEON_REG_RB3D_COLOROFFSET
*/
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
OUT_RING(RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE);
OUT_RING(dst_format | RADEON_ALPHA_BLEND_ENABLE);
OUT_RING(dst_offset);
OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
OUT_REG(RADEON_REG_PP_TXCBLEND_0,
RADEON_COLOR_ARG_A_ZERO |
RADEON_COLOR_ARG_B_ZERO |
RADEON_COLOR_ARG_C_T0_COLOR |
RADEON_BLEND_CTL_ADD |
RADEON_CLAMP_TX);
OUT_REG(RADEON_REG_PP_TXABLEND_0,
RADEON_ALPHA_ARG_A_ZERO |
RADEON_ALPHA_ARG_B_ZERO |
RADEON_ALPHA_ARG_C_T0_ALPHA |
RADEON_BLEND_CTL_ADD |
RADEON_CLAMP_TX);
OUT_REG(RADEON_REG_RB3D_BLENDCNTL,
RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO);
END_DMA();
while (nBox--) {
float srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth;
dstX = pBox->x1 + dstxoff;
dstY = pBox->y1 + dstyoff;
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
srcX = (pBox->x1 - pPortPriv->dst_x1) *
pPortPriv->src_w / pPortPriv->dst_w;
srcY = (pBox->y1 - pPortPriv->dst_y1) *
pPortPriv->src_h / pPortPriv->dst_h;
srcw = pPortPriv->src_w * (dstw / pPortPriv->dst_w);
srch = pPortPriv->src_h * (dsth / pPortPriv->dst_h);
vtx[0].x.f = dstX;
vtx[0].y.f = dstY;
vtx[0].s0.f = srcX;
vtx[0].t0.f = srcY;
vtx[1].x.f = dstX;
vtx[1].y.f = dstY + dsth;
vtx[1].s0.f = srcX;
vtx[1].t0.f = srcY + srch;
vtx[2].x.f = dstX + dstw;
vtx[2].y.f = dstY + dsth;
vtx[2].s0.f = srcX + srcw;
vtx[2].t0.f = srcY + srch;
vtx[3].x.f = dstX + dstw;
vtx[3].y.f = dstY;
vtx[3].s0.f = srcX + srcw;
vtx[3].t0.f = srcY;
if (atic->is_r100) {
BEGIN_DMA(4 * VTX_DWORD_COUNT + 3);
OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
4 * VTX_DWORD_COUNT + 2));
OUT_RING(RADEON_CP_VC_FRMT_XY |
RADEON_CP_VC_FRMT_ST0);
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
RADEON_CP_VC_CNTL_MAOS_ENABLE |
RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
} else {
BEGIN_DMA(4 * VTX_DWORD_COUNT + 2);
OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
4 * VTX_DWORD_COUNT + 1));
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
}
VTX_OUT(vtx[0]);
VTX_OUT(vtx[1]);
VTX_OUT(vtx[2]);
VTX_OUT(vtx[3]);
END_DMA();
pBox++;
}
#ifdef DAMAGEEXT
/* XXX: Shouldn't this be in kxv.c instead? */
DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
#endif
KdMarkSync(pScreen);
}
static void
ATIVideoSave(ScreenPtr pScreen, KdOffscreenArea *area)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATIPortPrivPtr pPortPriv = atis->pAdaptor->pPortPrivates[0].ptr;
if (pPortPriv->off_screen == area)
pPortPriv->off_screen = 0;
}
static int
ATIPutImage(KdScreenInfo *screen, DrawablePtr pDraw,
short src_x, short src_y,
short drw_x, short drw_y,
short src_w, short src_h,
short drw_w, short drw_h,
int id,
unsigned char *buf,
short width,
short height,
Bool sync,
RegionPtr clipBoxes,
pointer data)
{
ScreenPtr pScreen = screen->pScreen;
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIScreenInfo(pScreenPriv);
ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
char *mmio = atic->reg_base;
INT32 x1, x2, y1, y2;
int randr = RR_Rotate_0 /* XXX */;
int srcPitch, srcPitch2, dstPitch;
int top, left, npixels, nlines, size;
BoxRec dstBox;
int dst_width = width, dst_height = height;
int rot_x1, rot_y1, rot_x2, rot_y2;
int dst_x1, dst_y1, dst_x2, dst_y2;
int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
/* Clip */
x1 = src_x;
x2 = src_x + src_w;
y1 = src_y;
y2 = src_y + src_h;
dstBox.x1 = drw_x;
dstBox.x2 = drw_x + drw_w;
dstBox.y1 = drw_y;
dstBox.y2 = drw_y + drw_h;
ATIClipVideo(&dstBox, &x1, &x2, &y1, &y2,
REGION_EXTENTS(pScreen, clipBoxes), width, height);
src_w = (x2 - x1) >> 16;
src_h = (y2 - y1) >> 16;
drw_w = dstBox.x2 - dstBox.x1;
drw_h = dstBox.y2 - dstBox.y1;
if ((x1 >= x2) || (y1 >= y2))
return Success;
if (mmio == NULL)
return BadAlloc;
if (randr & (RR_Rotate_0|RR_Rotate_180)) {
dst_width = width;
dst_height = height;
rot_src_w = src_w;
rot_src_h = src_h;
rot_drw_w = drw_w;
rot_drw_h = drw_h;
} else {
dst_width = height;
dst_height = width;
rot_src_w = src_h;
rot_src_h = src_w;
rot_drw_w = drw_h;
rot_drw_h = drw_w;
}
switch (randr & RR_Rotate_All) {
case RR_Rotate_0:
default:
dst_x1 = dstBox.x1;
dst_y1 = dstBox.y1;
dst_x2 = dstBox.x2;
dst_y2 = dstBox.y2;
rot_x1 = x1;
rot_y1 = y1;
rot_x2 = x2;
rot_y2 = y2;
break;
case RR_Rotate_90:
dst_x1 = dstBox.y1;
dst_y1 = screen->height - dstBox.x2;
dst_x2 = dstBox.y2;
dst_y2 = screen->height - dstBox.x1;
rot_x1 = y1;
rot_y1 = (src_w << 16) - x2;
rot_x2 = y2;
rot_y2 = (src_w << 16) - x1;
break;
case RR_Rotate_180:
dst_x1 = screen->width - dstBox.x2;
dst_y1 = screen->height - dstBox.y2;
dst_x2 = screen->width - dstBox.x1;
dst_y2 = screen->height - dstBox.y1;
rot_x1 = (src_w << 16) - x2;
rot_y1 = (src_h << 16) - y2;
rot_x2 = (src_w << 16) - x1;
rot_y2 = (src_h << 16) - y1;
break;
case RR_Rotate_270:
dst_x1 = screen->width - dstBox.y2;
dst_y1 = dstBox.x1;
dst_x2 = screen->width - dstBox.y1;
dst_y2 = dstBox.x2;
rot_x1 = (src_h << 16) - y2;
rot_y1 = x1;
rot_x2 = (src_h << 16) - y1;
rot_y2 = x2;
break;
}
switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
dstPitch = ((dst_width << 1) + 15) & ~15;
srcPitch = (width + 3) & ~3;
srcPitch2 = ((width >> 1) + 3) & ~3;
size = dstPitch * dst_height;
break;
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
dstPitch = ((dst_width << 1) + 15) & ~15;
srcPitch = (width << 1);
srcPitch2 = 0;
size = dstPitch * dst_height;
break;
}
if (pPortPriv->off_screen != NULL && size != pPortPriv->size) {
KdOffscreenFree(screen->pScreen, pPortPriv->off_screen);
pPortPriv->off_screen = 0;
}
if (pPortPriv->off_screen == NULL) {
pPortPriv->off_screen = KdOffscreenAlloc(screen->pScreen,
size * 2, 64, TRUE, ATIVideoSave, pPortPriv);
if (pPortPriv->off_screen == NULL)
return BadAlloc;
}
if (pDraw->type == DRAWABLE_WINDOW)
pPortPriv->pPixmap =
(*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
else
pPortPriv->pPixmap = (PixmapPtr)pDraw;
/* Migrate the pixmap to offscreen if necessary. */
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap))
kaaMoveInPixmap(pPortPriv->pPixmap);
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) {
return BadAlloc;
}
pPortPriv->src_offset = pPortPriv->off_screen->offset;
pPortPriv->src_addr = (CARD8 *)(pScreenPriv->screen->memory_base +
pPortPriv->src_offset);
pPortPriv->src_pitch = dstPitch;
pPortPriv->size = size;
pPortPriv->pDraw = pDraw;
/* copy data */
top = rot_y1 >> 16;
left = (rot_x1 >> 16) & ~1;
npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
/* Since we're probably overwriting the area that might still be used
* for the last PutImage request, wait for idle.
*/
ATIWaitIdle(atis);
switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
top &= ~1;
nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
KdXVCopyPlanarData(screen, buf, pPortPriv->src_addr, randr,
srcPitch, srcPitch2, dstPitch, rot_src_w, rot_src_h,
height, top, left, nlines, npixels, id);
break;
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
nlines = ((rot_y2 + 0xffff) >> 16) - top;
KdXVCopyPackedData(screen, buf, pPortPriv->src_addr, randr,
srcPitch, dstPitch, rot_src_w, rot_src_h, top, left,
nlines, npixels);
break;
}
/* update cliplist */
if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes)) {
REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes);
}
pPortPriv->id = id;
pPortPriv->src_x1 = rot_x1;
pPortPriv->src_y1 = rot_y1;
pPortPriv->src_x2 = rot_x2;
pPortPriv->src_y2 = rot_y2;
pPortPriv->src_w = rot_src_w;
pPortPriv->src_h = rot_src_h;
pPortPriv->dst_x1 = dst_x1;
pPortPriv->dst_y1 = dst_y1;
pPortPriv->dst_x2 = dst_x2;
pPortPriv->dst_y2 = dst_y2;
pPortPriv->dst_w = rot_drw_w;
pPortPriv->dst_h = rot_drw_h;
if (atic->is_radeon)
RadeonDisplayVideo(screen, pPortPriv);
else
R128DisplayVideo(screen, pPortPriv);
return Success;
}
static int
ATIReputImage(KdScreenInfo *screen, DrawablePtr pDraw, short drw_x, short drw_y,
RegionPtr clipBoxes, pointer data)
{
ScreenPtr pScreen = screen->pScreen;
KdScreenPriv(pScreen);
ATICardInfo(pScreenPriv);
ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
BoxPtr pOldExtents = REGION_EXTENTS(screen->pScreen, &pPortPriv->clip);
BoxPtr pNewExtents = REGION_EXTENTS(screen->pScreen, clipBoxes);
if (pOldExtents->x1 != pNewExtents->x1 ||
pOldExtents->x2 != pNewExtents->x2 ||
pOldExtents->y1 != pNewExtents->y1 ||
pOldExtents->y2 != pNewExtents->y2)
return BadMatch;
if (pDraw->type == DRAWABLE_WINDOW)
pPortPriv->pPixmap =
(*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
else
pPortPriv->pPixmap = (PixmapPtr)pDraw;
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap))
kaaMoveInPixmap(pPortPriv->pPixmap);
if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) {
ErrorF("err\n");
return BadAlloc;
}
/* update cliplist */
if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes))
REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes);
/* XXX: What do the drw_x and drw_y here mean for us? */
if (atic->is_radeon)
RadeonDisplayVideo(screen, pPortPriv);
else
R128DisplayVideo(screen, pPortPriv);
return Success;
}
static int
ATIQueryImageAttributes(KdScreenInfo *screen, int id, unsigned short *w,
unsigned short *h, int *pitches, int *offsets)
{
int size, tmp;
if (*w > IMAGE_MAX_WIDTH)
*w = IMAGE_MAX_WIDTH;
if (*h > IMAGE_MAX_HEIGHT)
*h = IMAGE_MAX_HEIGHT;
*w = (*w + 1) & ~1;
if (offsets)
offsets[0] = 0;
switch (id)
{
case FOURCC_YV12:
case FOURCC_I420:
*h = (*h + 1) & ~1;
size = (*w + 3) & ~3;
if (pitches)
pitches[0] = size;
size *= *h;
if (offsets)
offsets[1] = size;
tmp = ((*w >> 1) + 3) & ~3;
if (pitches)
pitches[1] = pitches[2] = tmp;
tmp *= (*h >> 1);
size += tmp;
if (offsets)
offsets[2] = size;
size += tmp;
break;
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
size = *w << 1;
if (pitches)
pitches[0] = size;
size *= *h;
break;
}
return size;
}
/* client libraries expect an encoding */
static KdVideoEncodingRec DummyEncoding[1] =
{
{
0,
"XV_IMAGE",
IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
{1, 1}
}
};
#define NUM_FORMATS 3
static KdVideoFormatRec Formats[NUM_FORMATS] =
{
{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
};
#define NUM_ATTRIBUTES 0
static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
{
};
#define NUM_IMAGES 4
static KdImageRec Images[NUM_IMAGES] =
{
XVIMAGE_YUY2,
XVIMAGE_YV12,
XVIMAGE_I420,
XVIMAGE_UYVY
};
static KdVideoAdaptorPtr
ATISetupImageVideo(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
KdVideoAdaptorPtr adapt;
ATIPortPrivPtr pPortPriv;
int i;
atis->num_texture_ports = 16;
adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + atis->num_texture_ports *
(sizeof(ATIPortPrivRec) + sizeof(DevUnion)));
if (adapt == NULL)
return NULL;
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
adapt->flags = VIDEO_CLIP_TO_VIEWPORT;
adapt->name = "ATI Texture Video";
adapt->nEncodings = 1;
adapt->pEncodings = DummyEncoding;
adapt->nFormats = NUM_FORMATS;
adapt->pFormats = Formats;
adapt->nPorts = atis->num_texture_ports;
adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
pPortPriv =
(ATIPortPrivPtr)(&adapt->pPortPrivates[atis->num_texture_ports]);
for (i = 0; i < atis->num_texture_ports; i++)
adapt->pPortPrivates[i].ptr = &pPortPriv[i];
adapt->nAttributes = NUM_ATTRIBUTES;
adapt->pAttributes = Attributes;
adapt->pImages = Images;
adapt->nImages = NUM_IMAGES;
adapt->PutVideo = NULL;
adapt->PutStill = NULL;
adapt->GetVideo = NULL;
adapt->GetStill = NULL;
adapt->StopVideo = ATIStopVideo;
adapt->SetPortAttribute = ATISetPortAttribute;
adapt->GetPortAttribute = ATIGetPortAttribute;
adapt->QueryBestSize = ATIQueryBestSize;
adapt->PutImage = ATIPutImage;
adapt->ReputImage = ATIReputImage;
adapt->QueryImageAttributes = ATIQueryImageAttributes;
/* gotta uninit this someplace */
REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
atis->pAdaptor = adapt;
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
xvSaturation = MAKE_ATOM("XV_SATURATION");
return adapt;
}
Bool ATIInitVideo(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
KdScreenInfo *screen = pScreenPriv->screen;
KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
KdVideoAdaptorPtr newAdaptor = NULL;
int num_adaptors;
atis->pAdaptor = NULL;
if (atic->reg_base == NULL)
return FALSE;
if (atic->is_r200 || atic->is_r300)
return FALSE;
num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
newAdaptor = ATISetupImageVideo(pScreen);
if (newAdaptor) {
if (!num_adaptors) {
num_adaptors = 1;
adaptors = &newAdaptor;
} else {
newAdaptors = xalloc((num_adaptors + 1) *
sizeof(KdVideoAdaptorPtr *));
if (newAdaptors) {
memcpy(newAdaptors, adaptors, num_adaptors *
sizeof(KdVideoAdaptorPtr));
newAdaptors[num_adaptors] = newAdaptor;
adaptors = newAdaptors;
num_adaptors++;
}
}
}
if (num_adaptors)
KdXVScreenInit(pScreen, adaptors, num_adaptors);
if (newAdaptors)
xfree(newAdaptors);
return TRUE;
}
void
ATIFiniVideo(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ATIScreenInfo(pScreenPriv);
KdVideoAdaptorPtr adapt = atis->pAdaptor;
ATIPortPrivPtr pPortPriv;
int i;
if (!adapt)
return;
for (i = 0; i < atis->num_texture_ports; i++) {
pPortPriv = (ATIPortPrivPtr)(&adapt->pPortPrivates[i].ptr);
REGION_UNINIT(pScreen, &pPortPriv->clip);
}
xfree(adapt);
atis->pAdaptor = NULL;
}

View File

@ -1,137 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt, Anders Carlsson
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifdef USE_DMA
#define TAG(x) x##DMA
#define LOCALS RING_LOCALS; \
(void)atic
#define BEGIN(x) BEGIN_RING(x * 2)
#define OUT_REG(reg, val) OUT_RING_REG(reg, val)
#define END() ADVANCE_RING()
#else
#define TAG(x) x##MMIO
#define LOCALS char *mmio = atic->reg_base
#define BEGIN(x) ATIWaitAvailMMIO(x)
#define OUT_REG(reg, val) MMIO_OUT32(mmio, (reg), (val))
#define END()
#endif
static Bool
TAG(R128PrepareBlend)(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
ATICardInfo(pScreenPriv);
CARD32 dstDatatype, srcDatatype;
LOCALS;
accel_atis = atis;
if (!TAG(ATISetup)(pDst, pSrc))
return FALSE;
src_bpp = pSrc->drawable.bitsPerPixel;
is_repeat = pSrcPicture->repeat;
if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0]))
ATI_FALLBACK(("Unsupported op 0x%x\n", op));
if (pSrcPicture->repeat && (pSrc->drawable.width != 1 ||
pSrc->drawable.height != 1))
ATI_FALLBACK(("repeat unsupported\n"));
if (pSrcPicture->transform != NULL)
ATI_FALLBACK(("transform unsupported\n"));
if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype))
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
pDstPicture->format));
if (!R128GetDatatypePict(pSrcPicture->format, &srcDatatype))
ATI_FALLBACK(("Unsupported src format 0x%x\n",
pSrcPicture->format));
BEGIN(11);
OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL,
(dstDatatype << 8) |
RADEON_GMC_SRC_DATATYPE_COLOR |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_CLR_CMP_CNTL_DIS |
RADEON_GMC_AUX_CLIP_DIS |
(ATIBltRop[3] << 16) |
RADEON_GMC_3D_FCN_EN);
OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_ALPHA_EN | R128_TEX_CACHE_FLUSH);
OUT_REG(R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C, 0);
OUT_REG(R128_REG_SCALE_3D_CNTL,
R128_SCALE_3D_SCALE |
R128BlendOp[op] |
R128_TEX_MAP_ALPHA_IN_TEXTURE);
OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype);
OUT_REG(R128_REG_SCALE_PITCH, src_pitch / src_bpp);
/* 4.16 fixed point scaling factor? */
if (is_repeat) {
OUT_REG(R128_REG_SCALE_X_INC, 0);
OUT_REG(R128_REG_SCALE_Y_INC, 0);
} else {
OUT_REG(R128_REG_SCALE_X_INC, 65536);
OUT_REG(R128_REG_SCALE_Y_INC, 65536);
}
OUT_REG(R128_REG_SCALE_HACC, 0x00000000);
OUT_REG(R128_REG_SCALE_VACC, 0x00000000);
OUT_REG(RADEON_REG_DP_CNTL,
RADEON_DST_X_LEFT_TO_RIGHT | RADEON_DST_Y_TOP_TO_BOTTOM );
END();
return TRUE;
}
static void
TAG(R128Blend)(int srcX, int srcY, int dstX, int dstY, int width, int height)
{
ATIScreenInfo *atis = accel_atis;
ATICardInfo *atic = atis->atic;
LOCALS;
if (is_repeat) {
srcX = 0;
srcY = 0;
}
BEGIN(4);
OUT_REG(R128_REG_SCALE_OFFSET_0, src_offset + srcY * src_pitch + srcX *
(src_bpp >> 3));
OUT_REG(R128_REG_SCALE_SRC_HEIGHT_WIDTH, (height << 16) | width);
OUT_REG(R128_REG_SCALE_DST_X_Y, (dstX << 16) | dstY);
OUT_REG(R128_REG_SCALE_DST_HEIGHT_WIDTH, (height << 16) | width);
END();
}
static void
TAG(R128DoneBlend)(void)
{
}
#undef TAG
#undef LOCALS
#undef BEGIN
#undef OUT_REG
#undef END

View File

@ -1,171 +0,0 @@
/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite
* Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com
*
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author:
* Gareth Hughes <gareth@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
* Converted to common header format:
* Jens Owen <jens@tungstengraphics.com>
*
* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_common.h,v 1.2 2002/12/16 16:19:10 dawes Exp $
*
*/
#ifndef _R128_COMMON_H_
#define _R128_COMMON_H_
#include "X11/Xmd.h"
/*
* WARNING: If you change any of these defines, make sure to change
* the kernel include file as well (r128_drm.h)
*/
/* Driver specific DRM command indices
* NOTE: these are not OS specific, but they are driver specific
*/
#define DRM_R128_INIT 0x00
#define DRM_R128_CCE_START 0x01
#define DRM_R128_CCE_STOP 0x02
#define DRM_R128_CCE_RESET 0x03
#define DRM_R128_CCE_IDLE 0x04
#define DRM_R128_UNDEFINED1 0x05
#define DRM_R128_RESET 0x06
#define DRM_R128_SWAP 0x07
#define DRM_R128_CLEAR 0x08
#define DRM_R128_VERTEX 0x09
#define DRM_R128_INDICES 0x0a
#define DRM_R128_BLIT 0x0b
#define DRM_R128_DEPTH 0x0c
#define DRM_R128_STIPPLE 0x0d
#define DRM_R128_UNDEFINED2 0x0e
#define DRM_R128_INDIRECT 0x0f
#define DRM_R128_FULLSCREEN 0x10
#define DRM_R128_CLEAR2 0x11
#define DRM_R128_GETPARAM 0x12
#define DRM_R128_FLIP 0x13
#define DRM_R128_FRONT_BUFFER 0x1
#define DRM_R128_BACK_BUFFER 0x2
#define DRM_R128_DEPTH_BUFFER 0x4
typedef struct {
enum {
DRM_R128_INIT_CCE = 0x01,
DRM_R128_CLEANUP_CCE = 0x02
} func;
unsigned long sarea_priv_offset;
int is_pci;
int cce_mode;
int cce_secure; /* FIXME: Deprecated, we should remove this */
int ring_size;
int usec_timeout;
unsigned int fb_bpp;
unsigned int front_offset, front_pitch;
unsigned int back_offset, back_pitch;
unsigned int depth_bpp;
unsigned int depth_offset, depth_pitch;
unsigned int span_offset;
unsigned long fb_offset;
unsigned long mmio_offset;
unsigned long ring_offset;
unsigned long ring_rptr_offset;
unsigned long buffers_offset;
unsigned long agp_textures_offset;
} drmR128Init;
typedef struct {
int flush;
int idle;
} drmR128CCEStop;
typedef struct {
int idx;
int start;
int end;
int discard;
} drmR128Indirect;
typedef struct {
int idx;
int pitch;
int offset;
int format;
unsigned short x, y;
unsigned short width, height;
} drmR128Blit;
typedef struct {
enum {
DRM_R128_WRITE_SPAN = 0x01,
DRM_R128_WRITE_PIXELS = 0x02,
DRM_R128_READ_SPAN = 0x03,
DRM_R128_READ_PIXELS = 0x04
} func;
int n;
int *x;
int *y;
unsigned int *buffer;
unsigned char *mask;
} drmR128Depth;
typedef struct {
int prim;
int idx; /* Index of vertex buffer */
int count; /* Number of vertices in buffer */
int discard; /* Client finished with buffer? */
} drmR128Vertex;
typedef struct {
unsigned int *mask;
} drmR128Stipple;
typedef struct {
unsigned int flags;
unsigned int clear_color;
unsigned int clear_depth;
unsigned int color_mask;
unsigned int depth_mask;
} drmR128Clear;
typedef struct {
enum {
DRM_R128_INIT_FULLSCREEN = 0x01,
DRM_R128_CLEANUP_FULLSCREEN = 0x02
} func;
} drmR128Fullscreen;
typedef struct drm_r128_getparam {
int param;
int *value;
} drmR128GetParam;
#define R128_PARAM_IRQ_NR 1
#endif

View File

@ -1,574 +0,0 @@
/*
* Copyright © 2003 Eric Anholt, Anders Carlsson
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#include "ati.h"
#include "ati_reg.h"
#include "ati_dma.h"
#include "ati_draw.h"
extern ATIScreenInfo *accel_atis;
extern int sample_count;
extern float sample_offsets_x[255];
extern float sample_offsets_y[255];
extern CARD8 ATIBltRop[16];
static int widths[2] = {1,1};
static int heights[2] = {1,1};
static Bool is_transform[2];
static PictTransform *transform[2];
struct blendinfo {
Bool dst_alpha;
Bool src_alpha;
CARD32 blendctl;
};
static struct blendinfo R128BlendOp[] = {
/* Clear */
{0, 0, R128_SBLEND_ZERO | R128_DBLEND_ZERO},
/* Src */
{0, 0, R128_SBLEND_ONE | R128_DBLEND_ZERO},
/* Dst */
{0, 0, R128_SBLEND_ZERO | R128_DBLEND_ONE},
/* Over */
{0, 1, R128_SBLEND_ONE | R128_DBLEND_INV_SRC_ALPHA},
/* OverReverse */
{1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ONE},
/* In */
{1, 0, R128_SBLEND_DST_ALPHA | R128_DBLEND_ZERO},
/* InReverse */
{0, 1, R128_SBLEND_ZERO | R128_DBLEND_SRC_ALPHA},
/* Out */
{1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ZERO},
/* OutReverse */
{0, 1, R128_SBLEND_ZERO | R128_DBLEND_INV_SRC_ALPHA},
/* Atop */
{1, 1, R128_SBLEND_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA},
/* AtopReverse */
{1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_SRC_ALPHA},
/* Xor */
{1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA},
/* Add */
{0, 0, R128_SBLEND_ONE | R128_DBLEND_ONE},
};
static Bool
R128GetDatatypePict(CARD32 format, CARD32 *type)
{
switch (format) {
case PICT_a1r5g5b5:
case PICT_x1r5g5b5:
*type = R128_DATATYPE_ARGB1555;
return TRUE;
case PICT_r5g6b5:
*type = R128_DATATYPE_RGB565;
return TRUE;
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
*type = R128_DATATYPE_ARGB8888;
return TRUE;
default:
return FALSE;
}
}
static Bool
R128CheckCompositeTexture(PicturePtr pPict)
{
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
if (w > (1 << 10) || h > (1 << 10))
ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
switch (pPict->format) {
case PICT_a8:
case PICT_a1r5g5b5:
case PICT_a4r4g4b4:
case PICT_r5g6b5:
case PICT_a8r8g8b8:
break;
default:
ATI_FALLBACK(("Unsupported picture format 0x%x\n",
pPict->format));
}
return TRUE;
}
Bool
R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
CARD32 dstDatatype;
if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0]))
ATI_FALLBACK(("Unsupported op 0x%x\n", op));
if (pDstPicture->format == PICT_a8) {
if (R128BlendOp[op].src_alpha || R128BlendOp[op].dst_alpha ||
pMaskPicture != NULL)
ATI_FALLBACK(("alpha blending unsupported with "
"A8 dst?\n"));
} else if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype)) {
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
pDstPicture->format));
}
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
R128BlendOp[op].src_alpha)
ATI_FALLBACK(("Component alpha not supported with source alpha "
"blending.\n"));
if (!R128CheckCompositeTexture(pSrcPicture))
return FALSE;
if (pMaskPicture != NULL && !R128CheckCompositeTexture(pMaskPicture))
return FALSE;
return TRUE;
}
static Bool
R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, CARD32 *txsize,
CARD32 *tex_cntl_c)
{
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int bytepp, shift, l2w, l2h, l2p;
int pitch;
pitch = pPix->devKind;
if ((pitch & (pitch - 1)) != 0)
ATI_FALLBACK(("NPOT pitch 0x%x unsupported\n", pitch));
switch (pPict->format) {
case PICT_a8:
/* DATATYPE_RGB8 appears to expand the value into the alpha
* channel like we want. We then blank out the R,G,B channels
* as necessary using the combiners.
*/
*tex_cntl_c = R128_DATATYPE_RGB8 << R128_TEX_DATATYPE_SHIFT;
break;
case PICT_a1r5g5b5:
*tex_cntl_c = R128_DATATYPE_ARGB1555 << R128_TEX_DATATYPE_SHIFT;
break;
case PICT_a4r4g4b4:
*tex_cntl_c = R128_DATATYPE_ARGB4444 << R128_TEX_DATATYPE_SHIFT;
break;
case PICT_r5g6b5:
*tex_cntl_c = R128_DATATYPE_RGB565 << R128_TEX_DATATYPE_SHIFT;
break;
case PICT_a8r8g8b8:
*tex_cntl_c = R128_DATATYPE_ARGB8888 << R128_TEX_DATATYPE_SHIFT;
break;
default:
return FALSE;
}
bytepp = PICT_FORMAT_BPP(pPict->format) / 8;
*tex_cntl_c |= R128_MIP_MAP_DISABLE;
if (pPict->filter == PictFilterBilinear)
*tex_cntl_c |= R128_MIN_BLEND_LINEAR | R128_MAG_BLEND_LINEAR;
if (unit == 0)
shift = 0;
else {
shift = 16;
*tex_cntl_c |= R128_SEC_SELECT_SEC_ST;
}
/* ATILog2 returns -1 for value of 0 */
l2w = ATILog2(w - 1) + 1;
l2h = ATILog2(h - 1) + 1;
l2p = ATILog2(pPix->devKind / bytepp);
if (pPict->repeat && w == 1 && h == 1)
l2p = 0;
else if (pPict->repeat && l2p != l2w)
ATI_FALLBACK(("Repeat not supported for pitch != width\n"));
l2w = l2p;
widths[unit] = 1 << l2w;
heights[unit] = 1 << l2h;
*txsize |= l2p << (R128_TEX_PITCH_SHIFT + shift);
*txsize |= ((l2w > l2h) ? l2w : l2h) << (R128_TEX_SIZE_SHIFT + shift);
*txsize |= l2h << (R128_TEX_HEIGHT_SHIFT + shift);
if (pPict->transform != 0) {
is_transform[unit] = TRUE;
transform[unit] = pPict->transform;
} else {
is_transform[unit] = FALSE;
}
return TRUE;
}
Bool
R128PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 txsize = 0, prim_tex_cntl_c, sec_tex_cntl_c = 0, dstDatatype;
CARD32 dst_pitch_offset, color_factor, in_color_factor, alpha_comb;
CARD32 blend_cntl;
int i;
RING_LOCALS;
accel_atis = atis;
if (pDstPicture->format == PICT_a8)
dstDatatype = R128_DATATYPE_Y8;
else
R128GetDatatypePict(pDstPicture->format, &dstDatatype);
if (!R128TextureSetup(pSrcPicture, pSrc, 0, &txsize, &prim_tex_cntl_c))
return FALSE;
if (pMask != NULL && !R128TextureSetup(pMaskPicture, pMask, 1, &txsize,
&sec_tex_cntl_c))
return FALSE;
else if (pMask == NULL)
is_transform[1] = FALSE;
if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
return FALSE;
blend_cntl = R128BlendOp[op].blendctl;
if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
R128BlendOp[op].dst_alpha) {
if ((blend_cntl & R128_SBLEND_MASK) ==
R128_SBLEND_DST_ALPHA)
blend_cntl = (blend_cntl & ~R128_SBLEND_MASK) |
R128_SBLEND_ONE;
else if ((blend_cntl & R128_SBLEND_MASK) ==
R128_SBLEND_INV_DST_ALPHA)
blend_cntl = (blend_cntl & ~R128_SBLEND_MASK) |
R128_SBLEND_ZERO;
}
BEGIN_DMA(12);
OUT_REG(R128_REG_SCALE_3D_CNTL,
R128_SCALE_3D_TEXMAP_SHADE |
R128_SCALE_PIX_REPLICATE |
R128_TEX_CACHE_SPLIT |
R128_TEX_MAP_ALPHA_IN_TEXTURE |
R128_TEX_CACHE_LINE_SIZE_4QW);
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
ATI_GMC_DST_PITCH_OFFSET_CNTL |
ATI_GMC_BRUSH_SOLID_COLOR |
(dstDatatype << 8) |
ATI_GMC_SRC_DATATYPE_COLOR |
(ATIBltRop[GXcopy] << 16) |
ATI_DP_SRC_SOURCE_MEMORY |
R128_GMC_3D_FCN_EN |
ATI_GMC_CLR_CMP_CNTL_DIS |
R128_GMC_AUX_CLIP_DIS |
ATI_GMC_WR_MSK_DIS);
OUT_REG(R128_REG_MISC_3D_STATE_CNTL,
R128_MISC_SCALE_3D_TEXMAP_SHADE |
R128_MISC_SCALE_PIX_REPLICATE |
R128_ALPHA_COMB_ADD_CLAMP |
blend_cntl);
OUT_REG(R128_REG_TEX_CNTL_C,
R128_TEXMAP_ENABLE |
((pMask != NULL) ? R128_SEC_TEXMAP_ENABLE : 0) |
R128_ALPHA_ENABLE |
R128_TEX_CACHE_FLUSH);
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
END_DMA();
/* IN operator: Without a mask, only the first texture unit is enabled.
* With a mask, we put the source in the first unit and have it pass
* through as input to the 2nd. The 2nd unit takes the incoming source
* pixel and modulates it with either the alpha or each of the channels
* in the mask, depending on componentAlpha.
*/
BEGIN_DMA(15);
/* R128_REG_PRIM_TEX_CNTL_C,
* R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C,
* R128_REG_TEX_SIZE_PITCH_C,
* R128_REG_PRIM_TEX_0_OFFSET_C - R128_REG_PRIM_TEX_10_OFFSET_C
*/
OUT_RING(DMA_PACKET0(R128_REG_PRIM_TEX_CNTL_C, 14));
OUT_RING(prim_tex_cntl_c);
/* If this is the only stage and the dest is a8, route the alpha result
* to the color (red channel, in particular), too. Otherwise, be sure
* to zero out color channels of an a8 source.
*/
if (pMaskPicture == NULL && pDstPicture->format == PICT_a8)
color_factor = R128_COLOR_FACTOR_ALPHA;
else if (pSrcPicture->format == PICT_a8)
color_factor = R128_COLOR_FACTOR_CONST_COLOR;
else
color_factor = R128_COLOR_FACTOR_TEX;
if (PICT_FORMAT_A(pSrcPicture->format) == 0)
alpha_comb = R128_COMB_ALPHA_COPY_INP;
else
alpha_comb = R128_COMB_ALPHA_DIS;
OUT_RING(R128_COMB_COPY |
color_factor |
R128_INPUT_FACTOR_INT_COLOR |
alpha_comb |
R128_ALPHA_FACTOR_TEX_ALPHA |
R128_INP_FACTOR_A_CONST_ALPHA);
OUT_RING(txsize);
/* We could save some output by only writing the offset register that
* will actually be used. On the other hand, this is easy.
*/
for (i = 0; i <= 10; i++)
OUT_RING(((CARD8 *)pSrc->devPrivate.ptr -
pScreenPriv->screen->memory_base));
END_DMA();
if (pMask != NULL) {
BEGIN_DMA(14);
/* R128_REG_SEC_TEX_CNTL_C,
* R128_REG_SEC_TEXTURE_COMBINE_CNTL_C,
* R128_REG_SEC_TEX_0_OFFSET_C - R128_REG_SEC_TEX_10_OFFSET_C
*/
OUT_RING(DMA_PACKET0(R128_REG_SEC_TEX_CNTL_C, 13));
OUT_RING(sec_tex_cntl_c);
if (pDstPicture->format == PICT_a8) {
color_factor = R128_COLOR_FACTOR_ALPHA;
in_color_factor = R128_INPUT_FACTOR_PREV_ALPHA;
} else if (pMaskPicture->componentAlpha) {
color_factor = R128_COLOR_FACTOR_TEX;
in_color_factor = R128_INPUT_FACTOR_PREV_COLOR;
} else {
color_factor = R128_COLOR_FACTOR_ALPHA;
in_color_factor = R128_INPUT_FACTOR_PREV_COLOR;
}
OUT_RING(R128_COMB_MODULATE |
color_factor |
in_color_factor |
R128_COMB_ALPHA_MODULATE |
R128_ALPHA_FACTOR_TEX_ALPHA |
R128_INP_FACTOR_A_PREV_ALPHA);
for (i = 0; i <= 10; i++)
OUT_RING(((CARD8 *)pMask->devPrivate.ptr -
pScreenPriv->screen->memory_base));
END_DMA();
}
return TRUE;
}
#define VTX_RING_COUNT 8
#define VTX_OUT(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \
do { \
OUT_RING_F((_dstX)); \
OUT_RING_F(((float)(_dstY)) + .125); \
OUT_RING_F(0.0); \
OUT_RING_F(1.0); \
OUT_RING_F((((float)(_srcX)) + 0.5) / (widths[0])); \
OUT_RING_F((((float)(_srcY)) + 0.5) / (heights[0])); \
OUT_RING_F((((float)(_maskX)) + 0.5) / (widths[1])); \
OUT_RING_F((((float)(_maskY)) + 0.5) / (heights[1])); \
} while (0)
void
R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
int w, int h)
{
ATIScreenInfo *atis = accel_atis;
int srcXend, srcYend, maskXend, maskYend;
PictVector v;
RING_LOCALS;
/*ErrorF("R128Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/
srcXend = srcX + w;
srcYend = srcY + h;
maskXend = maskX + w;
maskYend = maskY + h;
if (is_transform[0]) {
v.vector[0] = IntToxFixed(srcX);
v.vector[1] = IntToxFixed(srcY);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[0], &v);
srcX = xFixedToInt(v.vector[0]);
srcY = xFixedToInt(v.vector[1]);
v.vector[0] = IntToxFixed(srcXend);
v.vector[1] = IntToxFixed(srcYend);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[0], &v);
srcXend = xFixedToInt(v.vector[0]);
srcYend = xFixedToInt(v.vector[1]);
}
if (is_transform[1]) {
v.vector[0] = IntToxFixed(maskX);
v.vector[1] = IntToxFixed(maskY);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[1], &v);
maskX = xFixedToInt(v.vector[0]);
maskY = xFixedToInt(v.vector[1]);
v.vector[0] = IntToxFixed(maskXend);
v.vector[1] = IntToxFixed(maskYend);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[1], &v);
maskXend = xFixedToInt(v.vector[0]);
maskYend = xFixedToInt(v.vector[1]);
}
BEGIN_DMA(3 + 4 * VTX_RING_COUNT);
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM,
2 + 4 * VTX_RING_COUNT));
OUT_RING(R128_CCE_VC_FRMT_RHW |
R128_CCE_VC_FRMT_S_T |
R128_CCE_VC_FRMT_S2_T2);
OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN |
R128_CCE_VC_CNTL_PRIM_WALK_RING |
(4 << R128_CCE_VC_CNTL_NUM_SHIFT));
VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY);
VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend);
VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend);
VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY);
END_DMA();
}
void
R128DoneComposite(void)
{
}
Bool
R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 dst_pitch_offset;
RING_LOCALS;
accel_atis = atis;
if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
return FALSE;
BEGIN_DMA(18);
OUT_REG(R128_REG_SCALE_3D_CNTL,
R128_SCALE_3D_TEXMAP_SHADE |
R128_SCALE_PIX_REPLICATE |
R128_TEX_CACHE_SPLIT |
R128_TEX_CACHE_LINE_SIZE_4QW);
OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
ATI_GMC_DST_PITCH_OFFSET_CNTL |
ATI_GMC_BRUSH_SOLID_COLOR |
(R128_DATATYPE_RGB8 << 8) |
ATI_GMC_SRC_DATATYPE_COLOR |
(ATIBltRop[GXcopy] << 16) |
ATI_DP_SRC_SOURCE_MEMORY |
R128_GMC_3D_FCN_EN |
ATI_GMC_CLR_CMP_CNTL_DIS |
ATI_GMC_WR_MSK_DIS);
OUT_REG(R128_REG_MISC_3D_STATE_CNTL,
R128_MISC_SCALE_3D_TEXMAP_SHADE |
R128_MISC_SCALE_PIX_REPLICATE |
R128_ALPHA_COMB_ADD_CLAMP |
R128BlendOp[PictOpAdd].blendctl);
OUT_REG(R128_REG_TEX_CNTL_C,
R128_ALPHA_ENABLE);
OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
/* R128_REG_AUX_SC_CNTL,
* R128_REG_AUX1_SC_LEFT
* R128_REG_AUX1_SC_RIGHT
* R128_REG_AUX1_SC_TOP
* R128_REG_AUX1_SC_BOTTOM
*/
OUT_RING(DMA_PACKET0(R128_REG_AUX_SC_CNTL, 5));
OUT_RING(R128_AUX1_SC_ENB);
OUT_RING(0);
OUT_RING(pDst->drawable.width);
OUT_RING(0);
OUT_RING(pDst->drawable.height);
END_DMA();
return TRUE;
}
#define TRAP_VERT_RING_COUNT 4
#define TRAP_VERT(_x, _y) \
do { \
OUT_RING_F((_x) + sample_x); \
OUT_RING_F((_y) + 0.125 + sample_y); \
OUT_RING_F(0.0); \
OUT_RING(0x01010101); \
} while (0)
void
R128Trapezoids(KaaTrapezoid *traps, int ntraps)
{
ATIScreenInfo *atis = accel_atis;
RING_LOCALS;
while (ntraps > 0) {
int i, sample, count, vertcount;
count = 0xffff / 4 / sample_count;
if (count > ntraps)
count = ntraps;
vertcount = count * sample_count * 4;
BEGIN_DMA(3 + vertcount * TRAP_VERT_RING_COUNT);
OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM,
2 + vertcount * TRAP_VERT_RING_COUNT));
OUT_RING(R128_CCE_VC_FRMT_DIFFUSE_ARGB);
OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN |
R128_CCE_VC_CNTL_PRIM_WALK_RING |
(vertcount << R128_CCE_VC_CNTL_NUM_SHIFT));
for (i = 0; i < count; i++) {
for (sample = 0; sample < sample_count; sample++) {
float sample_x = sample_offsets_x[sample];
float sample_y = sample_offsets_y[sample];
TRAP_VERT(traps[i].tl, traps[i].ty);
TRAP_VERT(traps[i].bl, traps[i].by);
TRAP_VERT(traps[i].br, traps[i].by);
TRAP_VERT(traps[i].tr, traps[i].ty);
}
}
END_DMA();
ntraps -= count;
traps += count;
}
}
void
R128DoneTrapezoids(void)
{
}

View File

@ -1,186 +0,0 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.7 2002/02/16 21:26:35 herrb Exp $ */
/*
* Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
* Precision Insight, Inc., Cedar Park, Texas, and
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation on the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
* SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Gareth Hughes <gareth@valinux.com>
*
*/
#ifndef _R128_SAREA_H_
#define _R128_SAREA_H_
/* WARNING: If you change any of these defines, make sure to change the
* defines in the kernel file (r128_drm.h)
*/
#ifndef __R128_SAREA_DEFINES__
#define __R128_SAREA_DEFINES__
/* What needs to be changed for the current vertex buffer?
*/
#define R128_UPLOAD_CONTEXT 0x001
#define R128_UPLOAD_SETUP 0x002
#define R128_UPLOAD_TEX0 0x004
#define R128_UPLOAD_TEX1 0x008
#define R128_UPLOAD_TEX0IMAGES 0x010
#define R128_UPLOAD_TEX1IMAGES 0x020
#define R128_UPLOAD_CORE 0x040
#define R128_UPLOAD_MASKS 0x080
#define R128_UPLOAD_WINDOW 0x100
#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */
#define R128_REQUIRE_QUIESCENCE 0x400
#define R128_UPLOAD_ALL 0x7ff
#define R128_FRONT 0x1
#define R128_BACK 0x2
#define R128_DEPTH 0x4
/* Primitive types
*/
#define R128_POINTS 0x1
#define R128_LINES 0x2
#define R128_LINE_STRIP 0x3
#define R128_TRIANGLES 0x4
#define R128_TRIANGLE_FAN 0x5
#define R128_TRIANGLE_STRIP 0x6
/* Vertex/indirect buffer size
*/
#define R128_BUFFER_SIZE 16384
/* Byte offsets for indirect buffer data
*/
#define R128_INDEX_PRIM_OFFSET 20
#define R128_HOSTDATA_BLIT_OFFSET 32
/* Keep these small for testing
*/
#define R128_NR_SAREA_CLIPRECTS 12
#define R128_NR_CONTEXT_REGS 12
#define R128_MAX_TEXTURE_LEVELS 11
#define R128_MAX_TEXTURE_UNITS 2
#endif /* __R128_SAREA_DEFINES__ */
typedef struct {
/* Context state - can be written in one large chunk */
unsigned int dst_pitch_offset_c;
unsigned int dp_gui_master_cntl_c;
unsigned int sc_top_left_c;
unsigned int sc_bottom_right_c;
unsigned int z_offset_c;
unsigned int z_pitch_c;
unsigned int z_sten_cntl_c;
unsigned int tex_cntl_c;
unsigned int misc_3d_state_cntl_reg;
unsigned int texture_clr_cmp_clr_c;
unsigned int texture_clr_cmp_msk_c;
unsigned int fog_color_c;
/* Texture state */
unsigned int tex_size_pitch_c;
unsigned int constant_color_c;
/* Setup state */
unsigned int pm4_vc_fpu_setup;
unsigned int setup_cntl;
/* Mask state */
unsigned int dp_write_mask;
unsigned int sten_ref_mask_c;
unsigned int plane_3d_mask_c;
/* Window state */
unsigned int window_xy_offset;
/* Core state */
unsigned int scale_3d_cntl;
} r128_context_regs_t;
/* Setup registers for each texture unit
*/
typedef struct {
unsigned int tex_cntl;
unsigned int tex_combine_cntl;
unsigned int tex_size_pitch;
unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS];
unsigned int tex_border_color;
} r128_texture_regs_t;
typedef struct {
/* The channel for communication of state information to the kernel
* on firing a vertex buffer.
*/
r128_context_regs_t ContextState;
r128_texture_regs_t TexState[R128_MAX_TEXTURE_UNITS];
unsigned int dirty;
unsigned int vertsize;
unsigned int vc_format;
#ifdef XF86DRI
/* The current cliprects, or a subset thereof.
*/
XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS];
unsigned int nbox;
#endif
/* Counters for throttling of rendering clients.
*/
unsigned int last_frame;
unsigned int last_dispatch;
/* Maintain an LRU of contiguous regions of texture space. If you
* think you own a region of texture memory, and it has an age
* different to the one you set, then you are mistaken and it has
* been stolen by another client. If global texAge hasn't changed,
* there is no need to walk the list.
*
* These regions can be used as a proxy for the fine-grained texture
* information of other clients - by maintaining them in the same
* lru which is used to age their own textures, clients have an
* approximate lru for the whole of global texture space, and can
* make informed decisions as to which areas to kick out. There is
* no need to choose whether to kick out your own texture or someone
* else's - simply eject them all in LRU order.
*/
/* Last elt is sentinal */
drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1];
/* last time texture was uploaded */
unsigned int texAge[ATI_NR_TEX_HEAPS];
int ctxOwner; /* last context to upload state */
int pfAllowPageFlip; /* set by the 2d driver, read by the client */
int pfCurrentPage; /* set by kernel, read by others */
} R128SAREAPriv, *R128SAREAPrivPtr;
#endif

View File

@ -1,461 +0,0 @@
/* radeon_common.h -- common header definitions for Radeon 2D/3D/DRM suite
*
* Copyright 2000 VA Linux Systems, Inc., Fremont, California.
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author:
* Gareth Hughes <gareth@valinux.com>
* Kevin E. Martin <martin@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
*
* Converted to common header format:
* Jens Owen <jens@tungstengraphics.com>
*
* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_common.h,v 1.2 2003/04/07 01:22:09 martin Exp $
*
*/
#ifndef _RADEON_COMMON_H_
#define _RADEON_COMMON_H_
#include <inttypes.h>
/* WARNING: If you change any of these defines, make sure to change
* the kernel include file as well (radeon_drm.h)
*/
/* Driver specific DRM command indices
* NOTE: these are not OS specific, but they are driver specific
*/
#define DRM_RADEON_CP_INIT 0x00
#define DRM_RADEON_CP_START 0x01
#define DRM_RADEON_CP_STOP 0x02
#define DRM_RADEON_CP_RESET 0x03
#define DRM_RADEON_CP_IDLE 0x04
#define DRM_RADEON_RESET 0x05
#define DRM_RADEON_FULLSCREEN 0x06
#define DRM_RADEON_SWAP 0x07
#define DRM_RADEON_CLEAR 0x08
#define DRM_RADEON_VERTEX 0x09
#define DRM_RADEON_INDICES 0x0a
#define DRM_RADEON_STIPPLE 0x0c
#define DRM_RADEON_INDIRECT 0x0d
#define DRM_RADEON_TEXTURE 0x0e
#define DRM_RADEON_VERTEX2 0x0f
#define DRM_RADEON_CMDBUF 0x10
#define DRM_RADEON_GETPARAM 0x11
#define DRM_RADEON_FLIP 0x12
#define DRM_RADEON_ALLOC 0x13
#define DRM_RADEON_FREE 0x14
#define DRM_RADEON_INIT_HEAP 0x15
#define DRM_RADEON_IRQ_EMIT 0x16
#define DRM_RADEON_IRQ_WAIT 0x17
#define DRM_RADEON_CP_RESUME 0x18
#define DRM_RADEON_SETPARAM 0x19
#define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39
#define RADEON_FRONT 0x1
#define RADEON_BACK 0x2
#define RADEON_DEPTH 0x4
#define RADEON_STENCIL 0x8
#define RADEON_CLEAR_X1 0
#define RADEON_CLEAR_Y1 1
#define RADEON_CLEAR_X2 2
#define RADEON_CLEAR_Y2 3
#define RADEON_CLEAR_DEPTH 4
typedef struct {
enum {
DRM_RADEON_INIT_CP = 0x01,
DRM_RADEON_CLEANUP_CP = 0x02,
DRM_RADEON_INIT_R200_CP = 0x03
} func;
unsigned long sarea_priv_offset;
int is_pci;
int cp_mode;
int gart_size;
int ring_size;
int usec_timeout;
unsigned int fb_bpp;
unsigned int front_offset, front_pitch;
unsigned int back_offset, back_pitch;
unsigned int depth_bpp;
unsigned int depth_offset, depth_pitch;
unsigned long fb_offset;
unsigned long mmio_offset;
unsigned long ring_offset;
unsigned long ring_rptr_offset;
unsigned long buffers_offset;
unsigned long gart_textures_offset;
} drmRadeonInit;
typedef struct {
int flush;
int idle;
} drmRadeonCPStop;
typedef struct {
int idx;
int start;
int end;
int discard;
} drmRadeonIndirect;
typedef union drmRadeonClearR {
float f[5];
unsigned int ui[5];
} drmRadeonClearRect;
typedef struct drmRadeonClearT {
unsigned int flags;
unsigned int clear_color;
unsigned int clear_depth;
unsigned int color_mask;
unsigned int depth_mask; /* misnamed field: should be stencil */
drmRadeonClearRect *depth_boxes;
} drmRadeonClearType;
typedef struct drmRadeonFullscreenT {
enum {
RADEON_INIT_FULLSCREEN = 0x01,
RADEON_CLEANUP_FULLSCREEN = 0x02
} func;
} drmRadeonFullscreenType;
typedef struct {
unsigned int *mask;
} drmRadeonStipple;
typedef struct {
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
const void *data;
} drmRadeonTexImage;
typedef struct {
unsigned int offset;
int pitch;
int format;
int width; /* Texture image coordinates */
int height;
drmRadeonTexImage *image;
} drmRadeonTexture;
#define RADEON_MAX_TEXTURE_UNITS 3
/* Layout matches drm_radeon_state_t in linux drm_radeon.h.
*/
typedef struct {
struct {
unsigned int pp_misc; /* 0x1c14 */
unsigned int pp_fog_color;
unsigned int re_solid_color;
unsigned int rb3d_blendcntl;
unsigned int rb3d_depthoffset;
unsigned int rb3d_depthpitch;
unsigned int rb3d_zstencilcntl;
unsigned int pp_cntl; /* 0x1c38 */
unsigned int rb3d_cntl;
unsigned int rb3d_coloroffset;
unsigned int re_width_height;
unsigned int rb3d_colorpitch;
} context;
struct {
unsigned int se_cntl;
} setup1;
struct {
unsigned int se_coord_fmt; /* 0x1c50 */
} vertex;
struct {
unsigned int re_line_pattern; /* 0x1cd0 */
unsigned int re_line_state;
unsigned int se_line_width; /* 0x1db8 */
} line;
struct {
unsigned int pp_lum_matrix; /* 0x1d00 */
unsigned int pp_rot_matrix_0; /* 0x1d58 */
unsigned int pp_rot_matrix_1;
} bumpmap;
struct {
unsigned int rb3d_stencilrefmask; /* 0x1d7c */
unsigned int rb3d_ropcntl;
unsigned int rb3d_planemask;
} mask;
struct {
unsigned int se_vport_xscale; /* 0x1d98 */
unsigned int se_vport_xoffset;
unsigned int se_vport_yscale;
unsigned int se_vport_yoffset;
unsigned int se_vport_zscale;
unsigned int se_vport_zoffset;
} viewport;
struct {
unsigned int se_cntl_status; /* 0x2140 */
} setup2;
struct {
unsigned int re_top_left; /*ignored*/ /* 0x26c0 */
unsigned int re_misc;
} misc;
struct {
unsigned int pp_txfilter;
unsigned int pp_txformat;
unsigned int pp_txoffset;
unsigned int pp_txcblend;
unsigned int pp_txablend;
unsigned int pp_tfactor;
unsigned int pp_border_color;
} texture[RADEON_MAX_TEXTURE_UNITS];
struct {
unsigned int se_zbias_factor;
unsigned int se_zbias_constant;
} zbias;
unsigned int dirty;
} drmRadeonState;
/* 1.1 vertex ioctl. Used in compatibility modes.
*/
typedef struct {
int prim;
int idx; /* Index of vertex buffer */
int count; /* Number of vertices in buffer */
int discard; /* Client finished with buffer? */
} drmRadeonVertex;
typedef struct {
unsigned int start;
unsigned int finish;
unsigned int prim:8;
unsigned int stateidx:8;
unsigned int numverts:16; /* overloaded as offset/64 for elt prims */
unsigned int vc_format;
} drmRadeonPrim;
typedef struct {
int idx; /* Index of vertex buffer */
int discard; /* Client finished with buffer? */
int nr_states;
drmRadeonState *state;
int nr_prims;
drmRadeonPrim *prim;
} drmRadeonVertex2;
#define RADEON_MAX_STATES 16
#define RADEON_MAX_PRIMS 64
/* Command buffer. Replace with true dma stream?
*/
typedef struct {
int bufsz;
char *buf;
int nbox;
drmClipRect *boxes;
} drmRadeonCmdBuffer;
/* New style per-packet identifiers for use in cmd_buffer ioctl with
* the RADEON_EMIT_PACKET command. Comments relate new packets to old
* state bits and the packet size:
*/
#define RADEON_EMIT_PP_MISC 0 /* context/7 */
#define RADEON_EMIT_PP_CNTL 1 /* context/3 */
#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */
#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */
#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */
#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */
#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */
#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */
#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */
#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */
#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */
#define RADEON_EMIT_RE_MISC 11 /* misc/1 */
#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */
#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */
#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */
#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */
#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */
#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */
#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */
#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */
#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */
#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */
#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */
#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */
#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */
#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */
#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */
#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */
#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */
#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/6 */
#define R200_EMIT_TFACTOR_0 30 /* tf/6 */
#define R200_EMIT_VTX_FMT_0 31 /* vtx/4 */
#define R200_EMIT_VAP_CTL 32 /* vap/1 */
#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */
#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */
#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */
#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */
#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */
#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */
#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */
#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */
#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */
#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */
#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */
#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */
#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */
#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */
#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */
#define R200_EMIT_VTE_CNTL 48 /* vte/1 */
#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */
#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */
#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */
#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */
#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */
#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */
#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */
#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */
#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */
#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */
#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */
#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */
#define R200_EMIT_PP_CUBIC_FACES_0 61
#define R200_EMIT_PP_CUBIC_OFFSETS_0 62
#define R200_EMIT_PP_CUBIC_FACES_1 63
#define R200_EMIT_PP_CUBIC_OFFSETS_1 64
#define R200_EMIT_PP_CUBIC_FACES_2 65
#define R200_EMIT_PP_CUBIC_OFFSETS_2 66
#define R200_EMIT_PP_CUBIC_FACES_3 67
#define R200_EMIT_PP_CUBIC_OFFSETS_3 68
#define R200_EMIT_PP_CUBIC_FACES_4 69
#define R200_EMIT_PP_CUBIC_OFFSETS_4 70
#define R200_EMIT_PP_CUBIC_FACES_5 71
#define R200_EMIT_PP_CUBIC_OFFSETS_5 72
#define RADEON_EMIT_PP_TEX_SIZE_0 73
#define RADEON_EMIT_PP_TEX_SIZE_1 74
#define RADEON_EMIT_PP_TEX_SIZE_2 75
#define RADEON_MAX_STATE_PACKETS 76
/* Commands understood by cmd_buffer ioctl. More can be added but
* obviously these can't be removed or changed:
*/
#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */
#define RADEON_CMD_SCALARS 2 /* emit scalar data */
#define RADEON_CMD_VECTORS 3 /* emit vector data */
#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */
#define RADEON_CMD_PACKET3 5 /* emit hw packet */
#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */
#define RADEON_CMD_SCALARS2 7 /* R200 stopgap */
#define RADEON_CMD_WAIT 8 /* synchronization */
typedef union {
int i;
struct {
unsigned char cmd_type, pad0, pad1, pad2;
} header;
struct {
unsigned char cmd_type, packet_id, pad0, pad1;
} packet;
struct {
unsigned char cmd_type, offset, stride, count;
} scalars;
struct {
unsigned char cmd_type, offset, stride, count;
} vectors;
struct {
unsigned char cmd_type, buf_idx, pad0, pad1;
} dma;
struct {
unsigned char cmd_type, flags, pad0, pad1;
} wait;
} drmRadeonCmdHeader;
#define RADEON_WAIT_2D 0x1
#define RADEON_WAIT_3D 0x2
typedef struct drm_radeon_getparam {
int param;
int *value;
} drmRadeonGetParam;
#define RADEON_PARAM_GART_BUFFER_OFFSET 1
#define RADEON_PARAM_LAST_FRAME 2
#define RADEON_PARAM_LAST_DISPATCH 3
#define RADEON_PARAM_LAST_CLEAR 4
#define RADEON_PARAM_IRQ_NR 5
#define RADEON_PARAM_GART_BASE 6
#define RADEON_MEM_REGION_GART 1
#define RADEON_MEM_REGION_FB 2
typedef struct drm_radeon_mem_alloc {
int region;
int alignment;
int size;
int *region_offset; /* offset from start of fb or GART */
} drmRadeonMemAlloc;
typedef struct drm_radeon_mem_free {
int region;
int region_offset;
} drmRadeonMemFree;
typedef struct drm_radeon_mem_init_heap {
int region;
int size;
int start;
} drmRadeonMemInitHeap;
/* 1.6: Userspace can request & wait on irq's:
*/
typedef struct drm_radeon_irq_emit {
int *irq_seq;
} drmRadeonIrqEmit;
typedef struct drm_radeon_irq_wait {
int irq_seq;
} drmRadeonIrqWait;
/* 1.10: Clients tell the DRM where they think the framebuffer is located in
* the card's address space, via a new generic ioctl to set parameters
*/
typedef struct drm_radeon_set_param {
unsigned int param;
int64_t value;
} drmRadeonSetParam;
#define RADEON_SETPARAM_FB_LOCATION 1
#endif

View File

@ -1,807 +0,0 @@
/*
* $Id$
*
* Copyright © 2003 Eric Anholt
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Eric Anholt not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Eric Anholt makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Header$ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ati.h"
#include "ati_reg.h"
#include "ati_dma.h"
#include "ati_draw.h"
extern ATIScreenInfo *accel_atis;
extern int sample_count;
extern float sample_offsets_x[255];
extern float sample_offsets_y[255];
static Bool is_transform[2];
static PictTransform *transform[2];
struct blendinfo {
Bool dst_alpha;
Bool src_alpha;
CARD32 blend_cntl;
};
static struct blendinfo RadeonBlendOp[] = {
/* Clear */
{0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ZERO},
/* Src */
{0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO},
/* Dst */
{0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ONE},
/* Over */
{0, 1, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_INV_SRC_ALPHA},
/* OverReverse */
{1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ONE},
/* In */
{1, 0, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_ZERO},
/* InReverse */
{0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_SRC_ALPHA},
/* Out */
{1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ZERO},
/* OutReverse */
{0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_INV_SRC_ALPHA},
/* Atop */
{1, 1, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA},
/* AtopReverse */
{1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_SRC_ALPHA},
/* Xor */
{1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA},
/* Add */
{0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ONE},
};
struct formatinfo {
int fmt;
Bool byte_swap;
CARD32 card_fmt;
};
/* Note on texture formats:
* TXFORMAT_Y8 expands to (Y,Y,Y,1). TXFORMAT_I8 expands to (I,I,I,I)
*/
static struct formatinfo R100TexFormats[] = {
{PICT_a8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP},
{PICT_x8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888},
{PICT_a8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP},
{PICT_x8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888},
{PICT_r5g6b5, 0, RADEON_TXFORMAT_RGB565},
{PICT_a1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP},
{PICT_x1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555},
{PICT_a8, 0, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP},
};
static struct formatinfo R200TexFormats[] = {
{PICT_a8r8g8b8, 0, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP},
{PICT_x8r8g8b8, 0, R200_TXFORMAT_ARGB8888},
{PICT_a8r8g8b8, 1, R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP},
{PICT_x8r8g8b8, 1, R200_TXFORMAT_RGBA8888},
{PICT_r5g6b5, 0, R200_TXFORMAT_RGB565},
{PICT_a1r5g5b5, 0, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP},
{PICT_x1r5g5b5, 0, R200_TXFORMAT_ARGB1555},
{PICT_a8, 0, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP},
};
/* Common Radeon setup code */
static Bool
RadeonGetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
{
switch (pDstPicture->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
*dst_format = RADEON_COLOR_FORMAT_ARGB8888;
break;
case PICT_r5g6b5:
*dst_format = RADEON_COLOR_FORMAT_RGB565;
break;
case PICT_a1r5g5b5:
case PICT_x1r5g5b5:
*dst_format = RADEON_COLOR_FORMAT_ARGB1555;
break;
case PICT_a8:
*dst_format = RADEON_COLOR_FORMAT_RGB8;
break;
default:
ATI_FALLBACK(("Unsupported dest format 0x%x\n",
pDstPicture->format));
}
return TRUE;
}
/* R100-specific code */
static Bool
R100CheckCompositeTexture(PicturePtr pPict, int unit)
{
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i;
if ((w > 0x7ff) || (h > 0x7ff))
ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++)
{
if (R100TexFormats[i].fmt == pPict->format)
break;
}
if (i == sizeof(R100TexFormats) / sizeof(R100TexFormats[0]))
ATI_FALLBACK(("Unsupported picture format 0x%x\n",
pPict->format));
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
return TRUE;
}
static Bool
R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
{
ATIScreenInfo *atis = accel_atis;
KdScreenPriv(pPix->drawable.pScreen);
CARD32 txformat, txoffset, txpitch;
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i;
RING_LOCALS;
txpitch = pPix->devKind;
txoffset = ((CARD8 *)pPix->devPrivate.ptr -
pScreenPriv->screen->memory_base);
for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++)
{
if (R100TexFormats[i].fmt == pPict->format)
break;
}
txformat = R100TexFormats[i].card_fmt;
if (R100TexFormats[i].byte_swap)
txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP;
if (pPict->repeat) {
txformat |= ATILog2(w) << RADEON_TXFORMAT_WIDTH_SHIFT;
txformat |= ATILog2(h) << RADEON_TXFORMAT_HEIGHT_SHIFT;
} else
txformat |= RADEON_TXFORMAT_NON_POWER2;
txformat |= unit << 24; /* RADEON_TXFORMAT_ST_ROUTE_STQX */
if ((txoffset & 0x1f) != 0)
ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset));
if ((txpitch & 0x1f) != 0)
ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch));
/* RADEON_REG_PP_TXFILTER_0,
* RADEON_REG_PP_TXFORMAT_0,
* RADEON_REG_PP_TXOFFSET_0
*/
BEGIN_DMA(4);
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0 + 0x18 * unit, 3));
OUT_RING(0);
OUT_RING(txformat);
OUT_RING(txoffset);
END_DMA();
/* RADEON_REG_PP_TEX_SIZE_0,
* RADEON_REG_PP_TEX_PITCH_0
*/
BEGIN_DMA(3);
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0 + 0x8 * unit, 2));
OUT_RING((pPix->drawable.width - 1) |
((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_RING(txpitch - 32);
END_DMA();
if (pPict->transform != 0) {
is_transform[unit] = TRUE;
transform[unit] = pPict->transform;
} else {
is_transform[unit] = FALSE;
}
return TRUE;
}
Bool
R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
CARD32 tmp1;
/* Check for unsupported compositing operations. */
if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op));
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
RadeonBlendOp[op].src_alpha)
ATI_FALLBACK(("Component alpha not supported with source "
"alpha blending.\n"));
if (pDstPicture->pDrawable->width >= (1 << 11) ||
pDstPicture->pDrawable->height >= (1 << 11))
ATI_FALLBACK(("Dest w/h too large (%d,%d).\n",
pDstPicture->pDrawable->width,
pDstPicture->pDrawable->height));
if (!R100CheckCompositeTexture(pSrcPicture, 0))
return FALSE;
if (pMaskPicture != NULL && !R100CheckCompositeTexture(pMaskPicture, 1))
return FALSE;
if (!RadeonGetDestFormat(pDstPicture, &tmp1))
return FALSE;
return TRUE;
}
Bool
R100PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 dst_format, dst_offset, dst_pitch;
CARD32 pp_cntl, blendcntl, cblend, ablend;
int pixel_shift;
RING_LOCALS;
accel_atis = atis;
RadeonGetDestFormat(pDstPicture, &dst_format);
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
pScreenPriv->screen->memory_base);
dst_pitch = pDst->devKind;
if ((dst_offset & 0x0f) != 0)
ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
if (!R100TextureSetup(pSrcPicture, pSrc, 0))
return FALSE;
pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
if (pMask != NULL) {
if (!R100TextureSetup(pMaskPicture, pMask, 1))
return FALSE;
pp_cntl |= RADEON_TEX_1_ENABLE;
} else {
is_transform[1] = FALSE;
}
BEGIN_DMA(14);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
/* RADEON_REG_PP_CNTL,
* RADEON_REG_RB3D_CNTL,
* RADEON_REG_RB3D_COLOROFFSET
*/
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
OUT_RING(pp_cntl);
OUT_RING(dst_format | RADEON_ALPHA_BLEND_ENABLE);
OUT_RING(dst_offset);
OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
/* IN operator: Multiply src by mask components or mask alpha.
* BLEND_CTL_ADD is A * B + C.
* If a picture is a8, we have to explicitly zero its color values.
* If the destination is a8, we have to route the alpha to red, I think.
*/
cblend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
RADEON_COLOR_ARG_C_ZERO;
ablend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
RADEON_ALPHA_ARG_C_ZERO;
if (pDstPicture->format == PICT_a8)
cblend |= RADEON_COLOR_ARG_A_T0_ALPHA;
else if (pSrcPicture->format == PICT_a8)
cblend |= RADEON_COLOR_ARG_A_ZERO;
else
cblend |= RADEON_COLOR_ARG_A_T0_COLOR;
ablend |= RADEON_ALPHA_ARG_A_T0_ALPHA;
if (pMask) {
if (pMaskPicture->componentAlpha &&
pDstPicture->format != PICT_a8)
cblend |= RADEON_COLOR_ARG_B_T1_COLOR;
else
cblend |= RADEON_COLOR_ARG_B_T1_ALPHA;
ablend |= RADEON_ALPHA_ARG_B_T1_ALPHA;
} else {
cblend |= RADEON_COLOR_ARG_B_ZERO | RADEON_COMP_ARG_B;
ablend |= RADEON_ALPHA_ARG_B_ZERO | RADEON_COMP_ARG_B;
}
OUT_REG(RADEON_REG_PP_TXCBLEND_0, cblend);
OUT_REG(RADEON_REG_PP_TXABLEND_0, ablend);
/* Op operator. */
blendcntl = RadeonBlendOp[op].blend_cntl;
if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
RadeonBlendOp[op].dst_alpha) {
if ((blendcntl & RADEON_SBLEND_MASK) ==
RADEON_SBLEND_GL_DST_ALPHA)
blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
RADEON_SBLEND_GL_ONE;
else if ((blendcntl & RADEON_SBLEND_MASK) ==
RADEON_SBLEND_GL_INV_DST_ALPHA)
blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
RADEON_SBLEND_GL_ZERO;
}
OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl);
END_DMA();
return TRUE;
}
static Bool
R200CheckCompositeTexture(PicturePtr pPict, int unit)
{
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i;
if ((w > 0x7ff) || (h > 0x7ff))
ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
{
if (R200TexFormats[i].fmt == pPict->format)
break;
}
if (i == sizeof(R200TexFormats) / sizeof(R200TexFormats[0]))
ATI_FALLBACK(("Unsupported picture format 0x%x\n",
pPict->format));
if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
return TRUE;
}
static Bool
R200TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
{
ATIScreenInfo *atis = accel_atis;
KdScreenPriv(pPix->drawable.pScreen);
CARD32 txformat, txoffset, txpitch;
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i;
RING_LOCALS;
txpitch = pPix->devKind;
txoffset = ((CARD8 *)pPix->devPrivate.ptr -
pScreenPriv->screen->memory_base);
for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
{
if (R200TexFormats[i].fmt == pPict->format)
break;
}
txformat = R200TexFormats[i].card_fmt;
if (R100TexFormats[i].byte_swap)
txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP;
if (pPict->repeat) {
txformat |= ATILog2(w) << R200_TXFORMAT_WIDTH_SHIFT;
txformat |= ATILog2(h) << R200_TXFORMAT_HEIGHT_SHIFT;
} else
txformat |= R200_TXFORMAT_NON_POWER2;
txformat |= unit << R200_TXFORMAT_ST_ROUTE_SHIFT;
if ((txoffset & 0x1f) != 0)
ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset));
if ((txpitch & 0x1f) != 0)
ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch));
/* R200_REG_PP_TXFILTER_0,
* R200_REG_PP_TXFORMAT_0,
* R200_REG_PP_TXFORMAT_X_0,
* R200_REG_PP_TXSIZE_0,
* R200_REG_PP_TXPITCH_0
*/
BEGIN_DMA(6);
OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_0 + 0x20 * unit, 5));
OUT_RING(0);
OUT_RING(txformat);
OUT_RING(0);
OUT_RING((pPix->drawable.width - 1) |
((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); /* XXX */
OUT_RING(txpitch - 32); /* XXX */
END_DMA();
BEGIN_DMA(2);
OUT_REG(R200_PP_TXOFFSET_0 + 0x18 * unit, txoffset);
END_DMA();
if (pPict->transform != 0) {
is_transform[unit] = TRUE;
transform[unit] = pPict->transform;
} else {
is_transform[unit] = FALSE;
}
return TRUE;
}
Bool
R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
CARD32 tmp1;
/* Check for unsupported compositing operations. */
if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op));
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
RadeonBlendOp[op].src_alpha)
ATI_FALLBACK(("Component alpha not supported with source "
"alpha blending.\n"));
if (!R200CheckCompositeTexture(pSrcPicture, 0))
return FALSE;
if (pMaskPicture != NULL && !R200CheckCompositeTexture(pMaskPicture, 1))
return FALSE;
if (!RadeonGetDestFormat(pDstPicture, &tmp1))
return FALSE;
return TRUE;
}
Bool
R200PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 dst_format, dst_offset, dst_pitch;
CARD32 pp_cntl, blendcntl, cblend, ablend;
int pixel_shift;
RING_LOCALS;
RadeonGetDestFormat(pDstPicture, &dst_format);
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
accel_atis = atis;
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
pScreenPriv->screen->memory_base);
dst_pitch = pDst->devKind;
if ((dst_offset & 0x0f) != 0)
ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
if (!R200TextureSetup(pSrcPicture, pSrc, 0))
return FALSE;
pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
if (pMask != NULL) {
if (!R200TextureSetup(pMaskPicture, pMask, 1))
return FALSE;
pp_cntl |= RADEON_TEX_1_ENABLE;
} else {
is_transform[1] = FALSE;
}
BEGIN_DMA(34);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
/* RADEON_REG_PP_CNTL,
* RADEON_REG_RB3D_CNTL,
* RADEON_REG_RB3D_COLOROFFSET
*/
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
OUT_RING(pp_cntl);
OUT_RING(dst_format | RADEON_ALPHA_BLEND_ENABLE);
OUT_RING(dst_offset);
OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
/* IN operator: Multiply src by mask components or mask alpha.
* BLEND_CTL_ADD is A * B + C.
* If a picture is a8, we have to explicitly zero its color values.
* If the destination is a8, we have to route the alpha to red, I think.
*/
cblend = R200_TXC_OP_MADD | R200_TXC_ARG_C_ZERO;
ablend = R200_TXA_OP_MADD | R200_TXA_ARG_C_ZERO;
if (pDstPicture->format == PICT_a8)
cblend |= R200_TXC_ARG_A_R0_ALPHA;
else if (pSrcPicture->format == PICT_a8)
cblend |= R200_TXC_ARG_A_ZERO;
else
cblend |= R200_TXC_ARG_A_R0_COLOR;
ablend |= R200_TXA_ARG_B_R0_ALPHA;
if (pMask) {
if (pMaskPicture->componentAlpha &&
pDstPicture->format != PICT_a8)
cblend |= R200_TXC_ARG_B_R1_COLOR;
else
cblend |= R200_TXC_ARG_B_R1_ALPHA;
ablend |= R200_TXA_ARG_B_R1_ALPHA;
} else {
cblend |= R200_TXC_ARG_B_ZERO | R200_TXC_COMP_ARG_B;
ablend |= R200_TXA_ARG_B_ZERO | R200_TXA_COMP_ARG_B;
}
OUT_REG(R200_REG_PP_TXCBLEND_0, cblend);
OUT_REG(R200_REG_PP_TXABLEND_0, ablend);
OUT_REG(R200_REG_PP_TXCBLEND2_0, 0);
OUT_REG(R200_REG_PP_TXABLEND2_0, 0);
/* Op operator. */
blendcntl = RadeonBlendOp[op].blend_cntl;
if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
RadeonBlendOp[op].dst_alpha) {
blendcntl &= ~RADEON_SBLEND_MASK;
if ((blendcntl & RADEON_SBLEND_MASK) ==
RADEON_SBLEND_GL_DST_ALPHA)
blendcntl |= RADEON_SBLEND_GL_ONE;
else if ((blendcntl & RADEON_SBLEND_MASK) ==
RADEON_SBLEND_GL_INV_DST_ALPHA)
blendcntl |= RADEON_SBLEND_GL_ZERO;
}
OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl);
END_DMA();
return TRUE;
}
union intfloat {
float f;
CARD32 i;
};
struct blend_vertex {
union intfloat x, y;
union intfloat s0, t0;
union intfloat s1, t1;
};
#define VTX_DWORD_COUNT 6
#define VTX_OUT(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \
do { \
OUT_RING_F(_dstX); \
OUT_RING_F(_dstY); \
OUT_RING_F(_srcX); \
OUT_RING_F(_srcY); \
OUT_RING_F(_maskX); \
OUT_RING_F(_maskY); \
} while (0)
void
RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
int w, int h)
{
ATIScreenInfo *atis = accel_atis;
ATICardInfo *atic = atis->atic;
int srcXend, srcYend, maskXend, maskYend;
RING_LOCALS;
PictVector v;
/*ErrorF("RadeonComposite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/
srcXend = srcX + w;
srcYend = srcY + h;
maskXend = maskX + w;
maskYend = maskY + h;
if (is_transform[0]) {
v.vector[0] = IntToxFixed(srcX);
v.vector[1] = IntToxFixed(srcY);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[0], &v);
srcX = xFixedToInt(v.vector[0]);
srcY = xFixedToInt(v.vector[1]);
v.vector[0] = IntToxFixed(srcXend);
v.vector[1] = IntToxFixed(srcYend);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[0], &v);
srcXend = xFixedToInt(v.vector[0]);
srcYend = xFixedToInt(v.vector[1]);
}
if (is_transform[1]) {
v.vector[0] = IntToxFixed(maskX);
v.vector[1] = IntToxFixed(maskY);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[1], &v);
maskX = xFixedToInt(v.vector[0]);
maskY = xFixedToInt(v.vector[1]);
v.vector[0] = IntToxFixed(maskXend);
v.vector[1] = IntToxFixed(maskYend);
v.vector[2] = xFixed1;
PictureTransformPoint(transform[1], &v);
maskXend = xFixedToInt(v.vector[0]);
maskYend = xFixedToInt(v.vector[1]);
}
if (atic->is_r100) {
BEGIN_DMA(4 * VTX_DWORD_COUNT + 3);
OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
4 * VTX_DWORD_COUNT + 2));
OUT_RING(RADEON_CP_VC_FRMT_XY |
RADEON_CP_VC_FRMT_ST0 |
RADEON_CP_VC_FRMT_ST1);
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
RADEON_CP_VC_CNTL_MAOS_ENABLE |
RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
} else {
BEGIN_DMA(4 * VTX_DWORD_COUNT + 2);
OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
4 * VTX_DWORD_COUNT + 1));
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
(4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
}
VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY);
VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend);
VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend);
VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY);
END_DMA();
}
void
RadeonDoneComposite(void)
{
}
Bool
RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst)
{
KdScreenPriv(pDst->drawable.pScreen);
ATIScreenInfo(pScreenPriv);
CARD32 dst_offset, dst_pitch;
int pixel_shift;
RING_LOCALS;
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
accel_atis = atis;
dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
pScreenPriv->screen->memory_base);
dst_pitch = pDst->devKind;
if ((dst_offset & 0x0f) != 0)
ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
BEGIN_DMA(14);
OUT_REG(ATI_REG_WAIT_UNTIL,
RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN);
/* RADEON_REG_PP_CNTL,
* RADEON_REG_RB3D_CNTL,
* RADEON_REG_RB3D_COLOROFFSET,
* RADEON_REG_RE_WIDTH_HEIGHT,
* RADEON_REG_RB3D_COLORPITCH
*/
OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 5));
OUT_RING(RADEON_TEX_BLEND_0_ENABLE);
OUT_RING(RADEON_COLOR_FORMAT_RGB8 | RADEON_ALPHA_BLEND_ENABLE);
OUT_RING(dst_offset);
OUT_RING(((pDst->drawable.height - 1) << 16) |
(pDst->drawable.width - 1));
OUT_RING(dst_pitch >> pixel_shift);
/* RADEON_REG_PP_TXCBLEND_0,
* RADEON_REG_PP_TXABLEND_0,
* RADEON_REG_PP_TFACTOR_0
*/
OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXCBLEND_0, 3));
OUT_RING(RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
RADEON_COLOR_ARG_C_TFACTOR_ALPHA);
OUT_RING(RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
RADEON_ALPHA_ARG_C_TFACTOR_ALPHA);
OUT_RING(0x01000000);
OUT_REG(RADEON_REG_RB3D_BLENDCNTL, RadeonBlendOp[PictOpAdd].blend_cntl);
END_DMA();
return TRUE;
}
#define TRAP_VERT_RING_COUNT 2
#define TRAP_VERT(_x, _y) \
do { \
OUT_RING_F((_x) + sample_x); \
OUT_RING_F((_y) + sample_y); \
} while (0)
void
RadeonTrapezoids(KaaTrapezoid *traps, int ntraps)
{
ATIScreenInfo *atis = accel_atis;
ATICardInfo *atic = atis->atic;
RING_LOCALS;
while (ntraps > 0) {
int i, sample, count, vertcount;
count = 0xffff / 4 / sample_count;
if (count > ntraps)
count = ntraps;
vertcount = count * sample_count * 4;
if (atic->is_r100) {
BEGIN_DMA(3 + vertcount * TRAP_VERT_RING_COUNT);
OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
2 + vertcount * TRAP_VERT_RING_COUNT));
OUT_RING(RADEON_CP_VC_FRMT_XY);
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
RADEON_CP_VC_CNTL_MAOS_ENABLE |
RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
(vertcount << RADEON_CP_VC_CNTL_NUM_SHIFT));
} else {
BEGIN_DMA(2 + vertcount * TRAP_VERT_RING_COUNT);
OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
1 + vertcount * TRAP_VERT_RING_COUNT));
OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
RADEON_CP_VC_CNTL_PRIM_WALK_RING |
(vertcount << RADEON_CP_VC_CNTL_NUM_SHIFT));
}
for (i = 0; i < count; i++) {
for (sample = 0; sample < sample_count; sample++) {
float sample_x = sample_offsets_x[sample];
float sample_y = sample_offsets_y[sample];
TRAP_VERT(traps[i].tl, traps[i].ty);
TRAP_VERT(traps[i].bl, traps[i].by);
TRAP_VERT(traps[i].br, traps[i].by);
TRAP_VERT(traps[i].tr, traps[i].ty);
}
}
END_DMA();
ntraps -= count;
traps += count;
}
}
void
RadeonDoneTrapezoids(void)
{
ATIScreenInfo *atis = accel_atis;
RING_LOCALS;
BEGIN_DMA(2);
OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff);
END_DMA();
}

View File

@ -1,222 +0,0 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.5 2002/10/30 12:52:14 alanh Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
* VA Linux Systems Inc., Fremont, California.
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation on the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Authors:
* Kevin E. Martin <martin@xfree86.org>
* Gareth Hughes <gareth@valinux.com>
*
*/
#ifndef _RADEON_SAREA_H_
#define _RADEON_SAREA_H_
/* WARNING: If you change any of these defines, make sure to change the
* defines in the kernel file (radeon_drm.h)
*/
#ifndef __RADEON_SAREA_DEFINES__
#define __RADEON_SAREA_DEFINES__
/* What needs to be changed for the current vertex buffer? */
#define RADEON_UPLOAD_CONTEXT 0x00000001
#define RADEON_UPLOAD_VERTFMT 0x00000002
#define RADEON_UPLOAD_LINE 0x00000004
#define RADEON_UPLOAD_BUMPMAP 0x00000008
#define RADEON_UPLOAD_MASKS 0x00000010
#define RADEON_UPLOAD_VIEWPORT 0x00000020
#define RADEON_UPLOAD_SETUP 0x00000040
#define RADEON_UPLOAD_TCL 0x00000080
#define RADEON_UPLOAD_MISC 0x00000100
#define RADEON_UPLOAD_TEX0 0x00000200
#define RADEON_UPLOAD_TEX1 0x00000400
#define RADEON_UPLOAD_TEX2 0x00000800
#define RADEON_UPLOAD_TEX0IMAGES 0x00001000
#define RADEON_UPLOAD_TEX1IMAGES 0x00002000
#define RADEON_UPLOAD_TEX2IMAGES 0x00004000
#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
#define RADEON_REQUIRE_QUIESCENCE 0x00010000
#define RADEON_UPLOAD_ZBIAS 0x00020000
#define RADEON_UPLOAD_ALL 0x0002ffff
#define RADEON_UPLOAD_CONTEXT_ALL 0x000201ff
#define RADEON_FRONT 0x1
#define RADEON_BACK 0x2
#define RADEON_DEPTH 0x4
#define RADEON_STENCIL 0x8
/* Primitive types */
#define RADEON_POINTS 0x1
#define RADEON_LINES 0x2
#define RADEON_LINE_STRIP 0x3
#define RADEON_TRIANGLES 0x4
#define RADEON_TRIANGLE_FAN 0x5
#define RADEON_TRIANGLE_STRIP 0x6
#define RADEON_3VTX_POINTS 0x9
#define RADEON_3VTX_LINES 0xa
/* Vertex/indirect buffer size */
#define RADEON_BUFFER_SIZE 65536
/* Byte offsets for indirect buffer data */
#define RADEON_INDEX_PRIM_OFFSET 20
#define RADEON_HOSTDATA_BLIT_OFFSET 32
#define RADEON_SCRATCH_REG_OFFSET 32
/* Keep these small for testing */
#define RADEON_NR_SAREA_CLIPRECTS 12
#define RADEON_MAX_TEXTURE_LEVELS 12
#define RADEON_MAX_TEXTURE_UNITS 3
/* Blits have strict offset rules. All blit offset must be aligned on
* a 1K-byte boundary.
*/
#define RADEON_OFFSET_SHIFT 10
#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT)
#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1)
#endif /* __RADEON_SAREA_DEFINES__ */
typedef struct {
unsigned int red;
unsigned int green;
unsigned int blue;
unsigned int alpha;
} radeon_color_regs_t;
typedef struct {
/* Context state */
unsigned int pp_misc;
unsigned int pp_fog_color;
unsigned int re_solid_color;
unsigned int rb3d_blendcntl;
unsigned int rb3d_depthoffset;
unsigned int rb3d_depthpitch;
unsigned int rb3d_zstencilcntl;
unsigned int pp_cntl;
unsigned int rb3d_cntl;
unsigned int rb3d_coloroffset;
unsigned int re_width_height;
unsigned int rb3d_colorpitch;
unsigned int se_cntl;
/* Vertex format state */
unsigned int se_coord_fmt;
/* Line state */
unsigned int re_line_pattern;
unsigned int re_line_state;
unsigned int se_line_width;
/* Bumpmap state */
unsigned int pp_lum_matrix;
unsigned int pp_rot_matrix_0;
unsigned int pp_rot_matrix_1;
/* Mask state */
unsigned int rb3d_stencilrefmask;
unsigned int rb3d_ropcntl;
unsigned int rb3d_planemask;
/* Viewport state */
unsigned int se_vport_xscale;
unsigned int se_vport_xoffset;
unsigned int se_vport_yscale;
unsigned int se_vport_yoffset;
unsigned int se_vport_zscale;
unsigned int se_vport_zoffset;
/* Setup state */
unsigned int se_cntl_status;
/* Misc state */
unsigned int re_top_left;
unsigned int re_misc;
} radeon_context_regs_t;
/* Setup registers for each texture unit */
typedef struct {
unsigned int pp_txfilter;
unsigned int pp_txformat;
unsigned int pp_txoffset;
unsigned int pp_txcblend;
unsigned int pp_txablend;
unsigned int pp_tfactor;
unsigned int pp_border_color;
} radeon_texture_regs_t;
typedef struct {
/* The channel for communication of state information to the kernel
* on firing a vertex buffer.
*/
radeon_context_regs_t ContextState;
radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS];
unsigned int dirty;
unsigned int vertsize;
unsigned int vc_format;
/* The current cliprects, or a subset thereof */
XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS];
unsigned int nbox;
/* Counters for throttling of rendering clients */
unsigned int last_frame;
unsigned int last_dispatch;
unsigned int last_clear;
/* Maintain an LRU of contiguous regions of texture space. If you
* think you own a region of texture memory, and it has an age
* different to the one you set, then you are mistaken and it has
* been stolen by another client. If global texAge hasn't changed,
* there is no need to walk the list.
*
* These regions can be used as a proxy for the fine-grained texture
* information of other clients - by maintaining them in the same
* lru which is used to age their own textures, clients have an
* approximate lru for the whole of global texture space, and can
* make informed decisions as to which areas to kick out. There is
* no need to choose whether to kick out your own texture or someone
* else's - simply eject them all in LRU order.
*/
/* Last elt is sentinal */
drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1];
/* last time texture was uploaded */
unsigned int texAge[ATI_NR_TEX_HEAPS];
int ctxOwner; /* last context to upload state */
int pfAllowPageFlip; /* set by the 2d driver, read by the client */
int pfCurrentPage; /* set by kernel, read by others */
int crtc2_base; /* for pageflipping with CloneMode */
} RADEONSAREAPriv, *RADEONSAREAPrivPtr;
#endif

View File

@ -1,32 +0,0 @@
INCLUDES = \
@KDRIVE_INCS@ \
-I$(top_srcdir)/hw/kdrive/vesa \
@XSERVER_CFLAGS@
bin_PROGRAMS = Xchips
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libchips.a
libchips_a_SOURCES = \
chipsdraw.c \
chips.c \
chips.h
Xchips_SOURCES = \
chipsstub.c
CHIPS_LIBS = \
libchips.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
@KDRIVE_LIBS@
Xchips_LDADD = \
$(CHIPS_LIBS) \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xchips_DEPENDENCIES = $(CHIPS_LIBS) @KDRIVE_LIBS@

View File

@ -1,341 +0,0 @@
/*
* Copyright © 2001 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.18 2001/06/04 09:45:42 keithp Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "chips.h"
#include <sys/io.h>
#undef CHIPS_DEBUG
Bool
chipsCardInit (KdCardInfo *card)
{
int k;
char *pixels;
ChipsCardInfo *chipsc;
CARD8 r00, r01, r02;
CARD8 r39;
chipsc = (ChipsCardInfo *) xalloc (sizeof (ChipsCardInfo));
if (!chipsc)
return FALSE;
iopl (3);
if (!vesaInitialize (card, &chipsc->vesa))
{
xfree (chipsc);
return FALSE;
}
#ifdef USE_PCI
chipsc->window = (CARD32 *) (chipsc->cop_base + 0x10000);
#else
chipsc->window = 0;
#endif
card->driver = chipsc;
return TRUE;
}
Bool
chipsScreenInit (KdScreenInfo *screen)
{
ChipsCardInfo *chipsc = screen->card->driver;
ChipsScreenInfo *chipss;
int screen_size, memory;
CARD32 mmio_base;
CARD32 mmio_size;
chipss = (ChipsScreenInfo *) xalloc (sizeof (ChipsScreenInfo));
if (!chipss)
return FALSE;
memset (chipss, '\0', sizeof (ChipsScreenInfo));
if (!vesaScreenInitialize (screen, &chipss->vesa))
{
xfree (chipss);
return FALSE;
}
if (chipss->vesa.mapping != VESA_LINEAR)
screen->dumb = TRUE;
if (!screen->dumb)
{
chipss->mmio_base = (CARD8 *) KdMapDevice (CHIPS_MMIO_BASE(chipss),
CHIPS_MMIO_SIZE(chipss));
if (chipss->mmio_base)
{
KdSetMappedMode (CHIPS_MMIO_BASE(chipss),
CHIPS_MMIO_SIZE(chipss),
KD_MAPPED_MODE_REGISTERS);
}
else
screen->dumb = TRUE;
}
else
chipss->mmio_base = 0;
chipss->screen = chipss->vesa.fb;
memory = chipss->vesa.fb_size;
screen_size = screen->fb[0].byteStride * screen->height;
if (chipss->screen && memory >= screen_size + 2048)
{
memory -= 2048;
chipss->cursor_base = chipss->screen + memory - 2048;
}
else
chipss->cursor_base = 0;
memory -= screen_size;
if (memory > screen->fb[0].byteStride)
{
chipss->off_screen = chipss->screen + screen_size;
chipss->off_screen_size = memory;
}
else
{
chipss->off_screen = 0;
chipss->off_screen_size = 0;
}
screen->driver = chipss;
return TRUE;
}
Bool
chipsInitScreen (ScreenPtr pScreen)
{
return vesaInitScreen (pScreen);
}
#ifdef RANDR
static Bool
chipsRandRSetConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize)
{
KdCheckSync (pScreen);
if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
return FALSE;
return TRUE;
}
static void
chipsRandRInit (ScreenPtr pScreen)
{
rrScrPriv(pScreen);
pScrPriv->rrSetConfig = chipsRandRSetConfig;
}
#endif
Bool
chipsFinishInitScreen (ScreenPtr pScreen)
{
Bool ret;
ret = vesaFinishInitScreen (pScreen);
#ifdef RANDR
chipsRandRInit (pScreen);
#endif
return ret;
}
static Bool
chipsCreateResources (ScreenPtr pScreen)
{
return vesaCreateResources (pScreen);
}
CARD8
chipsReadXR (ChipsScreenInfo *chipss, CARD8 index)
{
CARD8 value;
outb (index, 0x3d6);
value = inb (0x3d7);
return value;
}
void
chipsWriteXR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
{
outb (index, 0x3d6);
outb (value, 0x3d7);
}
CARD8
chipsReadFR (ChipsScreenInfo *chipss, CARD8 index)
{
CARD8 value;
outb (index, 0x3d0);
value = inb (0x3d1);
return value;
}
void
chipsWriteFR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
{
outb (index, 0x3d0);
outb (value, 0x3d1);
}
CARD8
chipsReadSeq (ChipsScreenInfo *chipss, CARD8 index)
{
CARD8 value;
outb (index, 0x3c4);
value = inb (0x3c5);
return value;
}
void
chipsWriteSeq (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
{
outb (index, 0x3c4);
outb (value, 0x3c5);
}
void
chipsPreserve (KdCardInfo *card)
{
ChipsCardInfo *chipss = card->driver;
vesaPreserve(card);
}
void
chipsSetMMIO (ChipsCardInfo *chipsc)
{
}
void
chipsResetMMIO (ChipsCardInfo *chipsc)
{
}
Bool
chipsEnable (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
ChipsCardInfo *chipsc = pScreenPriv->card->driver;
if (!vesaEnable (pScreen))
return FALSE;
chipsSetMMIO (chipsc);
return TRUE;
}
Bool
chipsDPMS (ScreenPtr pScreen, int mode)
{
KdScreenPriv(pScreen);
chipsScreenInfo(pScreenPriv);
ErrorF ("seqreg 0x01 0x%x\n", chipsReadSeq (chipss, 0x1));
ErrorF ("dpmsreg XR61 0x%x\n", chipsReadXR (chipss, 0x61));
ErrorF ("dpmsreg XR73 0x%x\n", chipsReadXR (chipss, 0x73));
ErrorF ("flat panel FR05 0x%x\n", chipsReadFR (chipss, 0x5));
ErrorF ("flat panel XR52 0x%x\n", chipsReadXR (chipss, 0x52));
return TRUE;
}
void
chipsDisable (ScreenPtr pScreen)
{
vesaDisable (pScreen);
}
void
chipsRestore (KdCardInfo *card)
{
ChipsCardInfo *chipsc = card->driver;
chipsResetMMIO (chipsc);
vesaRestore (card);
}
void
chipsScreenFini (KdScreenInfo *screen)
{
ChipsScreenInfo *chipss = (ChipsScreenInfo *) screen->driver;
if (chipss->mmio_base)
{
KdUnmapDevice ((void *) chipss->mmio_base, CHIPS_MMIO_SIZE(chipss));
KdResetMappedMode (CHIPS_MMIO_BASE(chipss),
CHIPS_MMIO_SIZE(chipss),
KD_MAPPED_MODE_REGISTERS);
}
vesaScreenFini (screen);
xfree (chipss);
screen->driver = 0;
}
void
chipsCardFini (KdCardInfo *card)
{
ChipsCardInfo *chipsc = card->driver;
vesaCardFini (card);
}
#define chipsCursorInit (void *) 0
#define chipsCursorEnable (void *) 0
#define chipsCursorDisable (void *) 0
#define chipsCursorFini (void *) 0
#define chipsRecolorCursor (void *) 0
KdCardFuncs chipsFuncs = {
chipsCardInit, /* cardinit */
chipsScreenInit, /* scrinit */
chipsInitScreen, /* initScreen */
chipsFinishInitScreen, /* finishInitScreen */
chipsCreateResources, /* createRes */
chipsPreserve, /* preserve */
chipsEnable, /* enable */
vesaDPMS, /* dpms */
chipsDisable, /* disable */
chipsRestore, /* restore */
chipsScreenFini, /* scrfini */
chipsCardFini, /* cardfini */
chipsCursorInit, /* initCursor */
chipsCursorEnable, /* enableCursor */
chipsCursorDisable, /* disableCursor */
chipsCursorFini, /* finiCursor */
chipsRecolorCursor, /* recolorCursor */
chipsDrawInit, /* initAccel */
chipsDrawEnable, /* enableAccel */
chipsDrawSync, /* syncAccel */
chipsDrawDisable, /* disableAccel */
chipsDrawFini, /* finiAccel */
vesaGetColors, /* getColors */
vesaPutColors, /* putColors */
};

View File

@ -1,122 +0,0 @@
/*
* Id: chips.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
*
* Copyright © 1999 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/chips/chips.h,v 1.9 2000/11/29 08:42:25 keithp Exp $ */
#ifndef _CHIPS_H_
#define _CHIPS_H_
#include <vesa.h>
/*
* offset from ioport beginning
*/
#define HIQV
#ifdef HIQV
#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x400000)
#else
#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x200000)
#endif
#define CHIPS_MMIO_SIZE(c) (0x20000)
typedef volatile CARD8 VOL8;
typedef volatile CARD16 VOL16;
typedef volatile CARD32 VOL32;
typedef struct _chipsSave {
int dummy;
} ChipsSave;
typedef struct _chipsCardInfo {
VesaCardPrivRec vesa;
CARD32 *window;
Bool mmio;
ChipsSave save;
} ChipsCardInfo;
#define getChipsCardInfo(kd) ((ChipsCardInfo *) ((kd)->card->driver))
#define chipsCardInfo(kd) ChipsCardInfo *chipsc = getChipsCardInfo(kd)
typedef struct _chipsCursor {
int width, height;
int xhot, yhot;
Bool has_cursor;
CursorPtr pCursor;
Pixel source, mask;
} ChipsCursor;
#define CHIPS_CURSOR_WIDTH 64
#define CHIPS_CURSOR_HEIGHT 64
typedef struct _chipsScreenInfo {
VesaScreenPrivRec vesa;
CARD8 *mmio_base;
CARD8 *cursor_base;
CARD8 *screen;
CARD8 *off_screen;
int off_screen_size;
ChipsCursor cursor;
} ChipsScreenInfo;
#define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver))
#define chipsScreenInfo(kd) ChipsScreenInfo *chipss = getChipsScreenInfo(kd)
Bool
chipsDrawInit (ScreenPtr pScreen);
void
chipsDrawEnable (ScreenPtr pScreen);
void
chipsDrawSync (ScreenPtr pScreen);
void
chipsDrawDisable (ScreenPtr pScreen);
void
chipsDrawFini (ScreenPtr pScreen);
CARD8
chipsReadXR (ChipsScreenInfo *chipsc, CARD8 index);
void
chipsWriteXR (ChipsScreenInfo *chipsc, CARD8 index, CARD8 value);
Bool
chipsCursorInit (ScreenPtr pScreen);
void
chipsCursorEnable (ScreenPtr pScreen);
void
chipsCursorDisable (ScreenPtr pScreen);
void
chipsCursorFini (ScreenPtr pScreen);
void
chipsRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
extern KdCardFuncs chipsFuncs;
#endif /* _CHIPS_H_ */

View File

@ -1,495 +0,0 @@
/*
* Id: tridentdraw.c,v 1.1 1999/11/02 03:54:47 keithp Exp $
*
* Copyright © 1999 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.c,v 1.10 2001/06/03 18:48:19 keithp Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "chips.h"
#include <X11/Xmd.h>
#include "gcstruct.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "regionstr.h"
#include "mistruct.h"
#include "fontstruct.h"
#include "dixfontstr.h"
#include "fb.h"
#include "migc.h"
#include "miline.h"
CARD8 chipsBltRop[16] = {
/* GXclear */ 0x00, /* 0 */
/* GXand */ 0x88, /* src AND dst */
/* GXandReverse */ 0x44, /* src AND NOT dst */
/* GXcopy */ 0xcc, /* src */
/* GXandInverted*/ 0x22, /* NOT src AND dst */
/* GXnoop */ 0xaa, /* dst */
/* GXxor */ 0x66, /* src XOR dst */
/* GXor */ 0xee, /* src OR dst */
/* GXnor */ 0x11, /* NOT src AND NOT dst */
/* GXequiv */ 0x99, /* NOT src XOR dst */
/* GXinvert */ 0x55, /* NOT dst */
/* GXorReverse */ 0xdd, /* src OR NOT dst */
/* GXcopyInverted*/ 0x33, /* NOT src */
/* GXorInverted */ 0xbb, /* NOT src OR dst */
/* GXnand */ 0x77, /* NOT src OR NOT dst */
/* GXset */ 0xff, /* 1 */
};
CARD8 chipsSolidRop[16] = {
/* GXclear */ 0x00, /* 0 */
/* GXand */ 0xa0, /* src AND dst */
/* GXandReverse */ 0x50, /* src AND NOT dst */
/* GXcopy */ 0xf0, /* src */
/* GXandInverted*/ 0x0a, /* NOT src AND dst */
/* GXnoop */ 0xaa, /* dst */
/* GXxor */ 0x5a, /* src XOR dst */
/* GXor */ 0xfa, /* src OR dst */
/* GXnor */ 0x05, /* NOT src AND NOT dst */
/* GXequiv */ 0xa5, /* NOT src XOR dst */
/* GXinvert */ 0x55, /* NOT dst */
/* GXorReverse */ 0xf5, /* src OR NOT dst */
/* GXcopyInverted*/ 0x0f, /* NOT src */
/* GXorInverted */ 0xaf, /* NOT src OR dst */
/* GXnand */ 0x5f, /* NOT src OR NOT dst */
/* GXset */ 0xff, /* 1 */
};
/* Definitions for the Chips and Technology BitBLT engine communication. */
/* These are done using Memory Mapped IO, of the registers */
/* BitBLT modes for register 93D0. */
#ifdef HIQV
#define ctPATCOPY 0xF0
#define ctLEFT2RIGHT 0x000
#define ctRIGHT2LEFT 0x100
#define ctTOP2BOTTOM 0x000
#define ctBOTTOM2TOP 0x200
#define ctSRCSYSTEM 0x400
#define ctDSTSYSTEM 0x800
#define ctSRCMONO 0x1000
#define ctBGTRANSPARENT 0x22000
#define ctCOLORTRANSENABLE 0x4000
#define ctCOLORTRANSDISABLE 0x0
#define ctCOLORTRANSDST 0x8000
#define ctCOLORTRANSROP 0x0
#define ctCOLORTRANSEQUAL 0x10000L
#define ctCOLORTRANSNEQUAL 0x0
#define ctPATMONO 0x40000L
#define ctPATSOLID 0x80000L
#define ctPATSTART0 0x000000L
#define ctPATSTART1 0x100000L
#define ctPATSTART2 0x200000L
#define ctPATSTART3 0x300000L
#define ctPATSTART4 0x400000L
#define ctPATSTART5 0x500000L
#define ctPATSTART6 0x600000L
#define ctPATSTART7 0x700000L
#define ctSRCFG 0x000000L /* Where is this for the 65550?? */
#else
#define ctPATCOPY 0xF0
#define ctTOP2BOTTOM 0x100
#define ctBOTTOM2TOP 0x000
#define ctLEFT2RIGHT 0x200
#define ctRIGHT2LEFT 0x000
#define ctSRCFG 0x400
#define ctSRCMONO 0x800
#define ctPATMONO 0x1000
#define ctBGTRANSPARENT 0x2000
#define ctSRCSYSTEM 0x4000
#define ctPATSOLID 0x80000L
#define ctPATSTART0 0x00000L
#define ctPATSTART1 0x10000L
#define ctPATSTART2 0x20000L
#define ctPATSTART3 0x30000L
#define ctPATSTART4 0x40000L
#define ctPATSTART5 0x50000L
#define ctPATSTART6 0x60000L
#define ctPATSTART7 0x70000L
#endif
#define chipsFillPix(bpp,pixel) {\
if (bpp == 8) \
{ \
pixel = pixel & 0xff; \
} \
else if (bpp == 16) \
{ \
pixel = pixel & 0xffff; \
} \
}
static VOL8 *mmio;
static CARD32 byteStride;
static CARD32 bytesPerPixel;
static CARD32 pixelStride;
static void
chipsSet (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
chipsScreenInfo(pScreenPriv);
mmio = chipss->mmio_base;
byteStride = pScreenPriv->screen->fb[0].byteStride;
bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3;
pixelStride = pScreenPriv->screen->fb[0].pixelStride;
}
#ifdef HIQV
#define CHIPS_BR0 0x00 /* offset */
#define CHIPS_BR1 0x04 /* bg */
#define CHIPS_BR2 0x08 /* fg */
#define CHIPS_BR3 0x0c /* monochrome */
#define CHIPS_BR4 0x10 /* bitblt */
#define CHIPS_BR5 0x14 /* pattern addr */
#define CHIPS_BR6 0x18 /* source addr */
#define CHIPS_BR7 0x1c /* dst addr */
#define CHIPS_BR8 0x20 /* dst w/h */
#else
#define CHIPS_DR0 0x83d0
#define CHIPS_DR1 0x87d0
#define CHIPS_DR2 0x8bd0
#define CHIPS_DR3 0x8fd0
#define CHIPS_DR4 0x93d0
#define CHIPS_DR5 0x97d0
#define CHIPS_DR6 0x9bd0
#define CHIPS_DR7 0x9fd0
#endif
#define DBG(x)
static void
chipsPitch (int src, int dst)
{
CARD32 p;
p = ((dst & 0xffff) << 16) | (src & 0xffff);
DBG(ErrorF ("\tpitch 0x%x\n", p));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR0) = p;
#else
*(VOL32 *) (mmio + CHIPS_DR0) = p;
#endif
}
static void
chipsBg (Pixel bg)
{
DBG(ErrorF ("\tbg 0x%x\n", bg));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR1) = bg & 0xffff;
#else
*(VOL32 *) (mmio + CHIPS_DR2) = bg;
#endif
}
static void
chipsFg (Pixel fg)
{
DBG(ErrorF ("\tfg 0x%x\n", fg));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR2) = fg;
#else
*(VOL32 *) (mmio + CHIPS_DR3) = fg;
#endif
}
static void
chipsOp (CARD32 op)
{
DBG(ErrorF ("\top 0x%x\n", op));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR4) = op;
#else
*(VOL32 *) (mmio + CHIPS_DR4) = op;
#endif
}
static void
chipsRopSolid (int rop)
{
CARD32 op;
op = chipsSolidRop[rop] | ctTOP2BOTTOM | ctLEFT2RIGHT | ctPATSOLID | ctPATMONO;
chipsOp (op);
}
static void
chipsSrc (int addr)
{
DBG(ErrorF ("\tsrc 0x%x\n", addr));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR6) = addr;
#else
*(VOL32 *) (mmio + CHIPS_DR5) = addr;
#endif
}
static void
chipsDst (int addr)
{
DBG(ErrorF ("\tdst 0x%x\n", addr));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR7) = addr;
#else
*(VOL32 *) (mmio + CHIPS_DR6) = addr;
#endif
}
static void
chipsWidthHeightGo (int w, int h)
{
DBG(ErrorF ("\twidth height %d/%d\n", w, h));
#ifdef HIQV
*(VOL32 *) (mmio + CHIPS_BR8) = ((h & 0xffff) << 16) | (w & 0xffff);
#else
*(VOL32 *) (mmio + CHIPS_DR7) = ((h & 0xffff) << 16) | (w & 0xffff);
#endif
}
static void
chipsWaitIdle (void)
{
#ifdef HIQV
int timeout = 0;
CARD8 tmp;
VOL32 *br4 = (VOL32 *) (mmio + CHIPS_BR4);
DBG(ErrorF ("\tBR4 0x%x 0x%x\n", mmio + CHIPS_BR4, *br4));
DBG(ErrorF ("\tXR20 0x%x\n", chipsReadXR (0, 0x20)));
for (;;)
{
if ((*br4 & 0x80000000) == 0)
break;
tmp = chipsReadXR (0, 0x20);
if ((tmp & 1) == 0)
break;
if (++timeout > 1000000)
{
ErrorF ("timeout\n");
tmp = chipsReadXR (0, 0x20);
chipsWriteXR (0, 0x20, tmp | 2);
sleep (1);
chipsWriteXR (0, 0x20, tmp);
sleep (1);
}
}
#else
while (*(VOL32 *) (mmio + CHIPS_DR4) & 0x00100000)
;
#endif
}
static Bool
chipsPrepareSolid (PixmapPtr pPixmap,
int alu,
Pixel pm,
Pixel fg)
{
FbBits depthMask;
DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
depthMask = FbFullMask(pPixmap->drawable.depth);
if ((pm & depthMask) != depthMask)
return FALSE;
else
{
chipsSet (pPixmap->drawable.pScreen);
chipsWaitIdle ();
chipsFillPix(pPixmap->drawable.bitsPerPixel,fg);
chipsFg (fg);
chipsBg (fg);
chipsRopSolid (alu);
chipsPitch (byteStride, byteStride);
return TRUE;
}
}
static void
chipsSolid (int x1, int y1, int x2, int y2)
{
CARD32 dst;
int w, h;
DBG(ErrorF (" Solid %dx%d %dx%d\n", x1, y1, x2, y2));
dst = y1 * byteStride + x1 * bytesPerPixel;
w = (x2 - x1) * bytesPerPixel;
h = (y2 - y1);
chipsWaitIdle ();
chipsDst (dst);
chipsWidthHeightGo (w, h);
}
static void
chipsDoneSolid (void)
{
}
static CARD32 copyOp;
static Bool
chipsPrepareCopy (PixmapPtr pSrcPixmap,
PixmapPtr pDstPixmap,
int dx,
int dy,
int alu,
Pixel pm)
{
FbBits depthMask;
DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
depthMask = FbFullMask(pDstPixmap->drawable.depth);
if ((pm & depthMask) != depthMask)
return FALSE;
else
{
copyOp = chipsBltRop[alu];
if (dy >= 0)
copyOp |= ctTOP2BOTTOM;
else
copyOp |= ctBOTTOM2TOP;
if (dx >= 0)
copyOp |= ctLEFT2RIGHT;
else
copyOp |= ctRIGHT2LEFT;
chipsSet (pDstPixmap->drawable.pScreen);
chipsWaitIdle ();
chipsOp (copyOp);
chipsPitch (byteStride, byteStride);
return TRUE;
}
}
static void
chipsCopy (int srcX,
int srcY,
int dstX,
int dstY,
int w,
int h)
{
int src, dst;
if ((copyOp & (ctTOP2BOTTOM|ctBOTTOM2TOP)) == ctBOTTOM2TOP)
{
src = (srcY + h - 1) * byteStride;
dst = (dstY + h - 1) * byteStride;
}
else
{
src = srcY * byteStride;
dst = dstY * byteStride;
}
if ((copyOp & (ctLEFT2RIGHT|ctRIGHT2LEFT)) == ctRIGHT2LEFT)
{
src = src + (srcX + w) * bytesPerPixel - 1;
dst = dst + (dstX + w) * bytesPerPixel - 1;
}
else
{
src = src + srcX * bytesPerPixel;
dst = dst + dstX * bytesPerPixel;
}
chipsWaitIdle ();
chipsSrc (src);
chipsDst (dst);
chipsWidthHeightGo (w * bytesPerPixel, h);
}
static void
chipsDoneCopy (void)
{
}
KaaScreenInfoRec chipsKaa = {
chipsPrepareSolid,
chipsSolid,
chipsDoneSolid,
chipsPrepareCopy,
chipsCopy,
chipsDoneCopy,
0, 0, 0
};
Bool
chipsDrawInit (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
case 8:
case 16:
break;
default:
return FALSE;
}
if (!kaaDrawInit (pScreen, &chipsKaa))
return FALSE;
return TRUE;
}
void
chipsDrawEnable (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
chipsScreenInfo(pScreenPriv);
CARD8 mode = 0x00;
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
case 8:
mode = 0x00;
break;
case 16:
mode = 0x10;
break;
}
chipsSet (pScreen);
chipsWaitIdle ();
chipsWriteXR (chipss, 0x20, mode);
KdMarkSync (pScreen);
}
void
chipsDrawDisable (ScreenPtr pScreen)
{
}
void
chipsDrawFini (ScreenPtr pScreen)
{
}
void
chipsDrawSync (ScreenPtr pScreen)
{
chipsSet (pScreen);
chipsWaitIdle ();
}

View File

@ -1,69 +0,0 @@
/*
* Id: chipsstub.c,v 1.1 1999/11/02 08:19:15 keithp Exp $
*
* Copyright 1999 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/chips/chipsstub.c,v 1.1 2001/09/05 07:12:42 keithp Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "chips.h"
extern int chips_clk, chips_mclk;
void
InitCard (char *name)
{
KdCardAttr attr;
KdCardInfoAdd (&chipsFuncs, &attr, 0);
}
void
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
{
KdInitOutput (pScreenInfo, argc, argv);
}
void
InitInput (int argc, char **argv)
{
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
}
void
ddxUseMsg (void)
{
KdUseMsg();
vesaUseMsg();
}
int
ddxProcessArgument (int argc, char **argv, int i)
{
int ret;
if (!(ret = vesaProcessArgument (argc, argv, i)))
ret = KdProcessArgument(argc, argv, i);
return ret;
}

View File

@ -1,42 +0,0 @@
INCLUDES = \
@KDRIVE_INCS@ \
@XSERVER_CFLAGS@
noinst_LIBRARIES = libxephyr.a libxephyr-hostx.a
if TSLIB
TSLIB_LIBS = -lts
endif
bin_PROGRAMS = Xephyr
libxephyr_a_SOURCES = \
ephyr.c \
os.c \
hostx.h \
ephyr.h
libxephyr_hostx_a_SOURCES = \
hostx.c \
hostx.h
libxephyr_hostx_a_INCLUDES = @XEPHYR_INCS@
Xephyr_SOURCES = \
ephyrinit.c
Xephyr_LDADD = \
libxephyr.a \
libxephyr-hostx.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_LIBS) \
@XEPHYR_LIBS@
Xephyr_DEPENDENCIES = \
libxephyr.a \
libxephyr-hostx.a \
@KDRIVE_LIBS@

View File

@ -1,71 +0,0 @@
Xephyr README
=============
What Is It ?
============
Xephyr is a a kdrive server that outputs to a window on a pre-existing
'host' X display. Think Xnest but with support for modern extensions
like composite, damage and randr.
Unlike Xnest which is an X proxy, i.e. limited to the
capabilities of the host X server, Xephyr is a real X server which
uses the host X server window as "framebuffer" via fast SHM XImages.
It also has support for 'visually' debugging what the server is
painting.
How To Use
==========
You probably want to run like;
Xephyr :1 -ac -screen 800x600 &
Then set DISPLAY=:1 and run whatever X apps you like.
Use 'xrandr' to change to orientation/size.
There is a '-parent' switch which works just like Xnests ( for use
with things like matchbox-nest - http://matchbox.handhelds.org ).
There is also a '-host-cursor' switch to set 'cursor acceleration' -
The host's cursor is reused. This is only really there to aid
debugging by avoiding server paints for the cursor. Performance
improvement is negiable.
Send a SIGUSR1 to the server ( eg kill -USR1 `pidof Xephyr` ) to
toggle the debugging mode. In this mode red rectangles are painted to
screen areas getting painted before painting the actual content. The
delay between this can be altered by setting a XEPHYR_PAUSE env var to
a value in micro seconds.
Caveats
=======
- Depth is limited to being the same as the host.
- Rotated displays are currently updated via full blits. This
is slower than a normal oprientated display. Debug mode will
therefor not be of much use rotated.
- The '-host-cursor' cursor is static in its appearence.
- The build gets a warning about 'nanosleep'. I think the various '-D'
build flags are causing this. I havn't figured as yet how to work
round it. It doesn't appear to break anything however.
- Keyboard handling is basic but works.
- Mouse button 5 probably wont work.
Matthew Allum <mallum@o-hand.com> 2004

View File

@ -1,675 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* TODO:
*
* POSSIBLES
* - much improve keyboard handling *kind of done*
* - '-fullscreen' switch ?
* - full keyboard grab option somehow ? - use for testing WM key shortcuts
* with out host WM getting them instead.
* - Make cursor 'accel' better.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ephyr.h"
extern int KdTsPhyScreen;
static int mouseState = 0;
Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv)
{
OsSignal(SIGUSR1, hostx_handle_signal);
priv->base = 0;
priv->bytes_per_line = 0;
return TRUE;
}
Bool
ephyrCardInit (KdCardInfo *card)
{
EphyrPriv *priv;
priv = (EphyrPriv *) xalloc (sizeof (EphyrPriv));
if (!priv)
return FALSE;
if (!ephyrInitialize (card, priv))
{
xfree (priv);
return FALSE;
}
card->driver = priv;
return TRUE;
}
Bool
ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
{
int width = 640, height = 480;
if (hostx_want_screen_size(&width, &height)
|| !screen->width || !screen->height)
{
screen->width = width;
screen->height = height;
}
if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
ErrorF("\nXephyr screen depth must match hosts, ignoring.\n");
screen->fb[0].depth = hostx_get_depth();
screen->rate = 72;
if (screen->fb[0].depth <= 8)
{
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
}
else
{
screen->fb[0].visuals = (1 << TrueColor);
if (screen->fb[0].depth <= 15)
{
screen->fb[0].depth = 15;
screen->fb[0].bitsPerPixel = 16;
hostx_get_visual_masks (&screen->fb[0].redMask,
&screen->fb[0].greenMask,
&screen->fb[0].blueMask);
}
else if (screen->fb[0].depth <= 16)
{
screen->fb[0].depth = 16;
screen->fb[0].bitsPerPixel = 16;
hostx_get_visual_masks (&screen->fb[0].redMask,
&screen->fb[0].greenMask,
&screen->fb[0].blueMask);
}
else
{
screen->fb[0].depth = 24;
screen->fb[0].bitsPerPixel = 32;
hostx_get_visual_masks (&screen->fb[0].redMask,
&screen->fb[0].greenMask,
&screen->fb[0].blueMask);
}
}
scrpriv->randr = screen->randr;
return ephyrMapFramebuffer (screen);
}
Bool
ephyrScreenInit (KdScreenInfo *screen)
{
EphyrScrPriv *scrpriv;
scrpriv = xalloc (sizeof (EphyrScrPriv));
if (!scrpriv)
return FALSE;
memset (scrpriv, 0, sizeof (EphyrScrPriv));
screen->driver = scrpriv;
if (!ephyrScreenInitialize (screen, scrpriv))
{
screen->driver = 0;
xfree (scrpriv);
return FALSE;
}
return TRUE;
}
void*
ephyrWindowLinear (ScreenPtr pScreen,
CARD32 row,
CARD32 offset,
int mode,
CARD32 *size,
void *closure)
{
KdScreenPriv(pScreen);
EphyrPriv *priv = pScreenPriv->card->driver;
if (!pScreenPriv->enabled)
{
return 0;
}
*size = priv->bytes_per_line;
return priv->base + row * priv->bytes_per_line + offset;
}
Bool
ephyrMapFramebuffer (KdScreenInfo *screen)
{
EphyrScrPriv *scrpriv = screen->driver;
EphyrPriv *priv = screen->card->driver;
KdMouseMatrix m;
EPHYR_DBG(" screen->width: %d, screen->height: %d",
screen->width, screen->height);
/* Always use shadow so we get damage notifications */
scrpriv->shadow = TRUE;
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
/* point the framebuffer to the data in an XImage */
priv->base = hostx_screen_init (screen->width, screen->height);
screen->memory_base = (CARD8 *) (priv->base);
screen->memory_size = 0;
screen->off_screen_base = 0;
KdShadowFbAlloc (screen, 0,
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
return TRUE;
}
void
ephyrSetScreenSizes (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
{
pScreen->width = screen->width;
pScreen->height = screen->height;
pScreen->mmWidth = screen->width_mm;
pScreen->mmHeight = screen->height_mm;
}
else
{
pScreen->width = screen->height;
pScreen->height = screen->width;
pScreen->mmWidth = screen->height_mm;
pScreen->mmHeight = screen->width_mm;
}
}
Bool
ephyrUnmapFramebuffer (KdScreenInfo *screen)
{
KdShadowFbFree (screen, 0);
/* Note, priv->base will get freed when XImage recreated */
return TRUE;
}
void
ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
int nbox;
BoxPtr pbox;
RegionPtr damage;
if (!(scrpriv->randr & RR_Rotate_0) || (scrpriv->randr & RR_Reflect_All))
{
/* Rotated.
* TODO: Fix this to use damage as well so much faster.
* Sledgehammer approach atm.
*
* Catch reflects here too - though thats wrong ...
*/
EPHYR_DBG("slow paint");
shadowUpdateRotatePacked(pScreen, pBuf);
hostx_paint_rect(0,0,0,0, screen->width, screen->height);
return;
}
else shadowUpdatePacked(pScreen, pBuf);
/* Figure out what rects have changed and update em. */
if (!pBuf || !pBuf->pDamage)
return;
damage = DamageRegion (pBuf->pDamage);
if (!REGION_NOTEMPTY (pScreen, damage))
return;
nbox = REGION_NUM_RECTS (damage);
pbox = REGION_RECTS (damage);
while (nbox--)
{
hostx_paint_rect(pbox->x1, pbox->y1,
pbox->x1, pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
}
Bool
ephyrSetShadow (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
ShadowUpdateProc update;
ShadowWindowProc window;
window = ephyrWindowLinear;
update = ephyrShadowUpdate;
return KdShadowSet (pScreen, scrpriv->randr, update, window);
}
#ifdef RANDR
Bool
ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
RRScreenSizePtr pSize;
Rotation randr;
int n = 0;
EPHYR_DBG("mark");
struct { int width, height; } sizes[] =
{
{ 1600, 1200 },
{ 1400, 1050 },
{ 1280, 960 },
{ 1280, 1024 },
{ 1152, 768 },
{ 1024, 768 },
{ 832, 624 },
{ 800, 600 },
{ 720, 400 },
{ 480, 640 },
{ 640, 480 },
{ 640, 400 },
{ 320, 240 },
{ 240, 320 },
{ 160, 160 },
{ 0, 0 }
};
*rotations = RR_Rotate_All|RR_Reflect_All;
if (!hostx_want_preexisting_window()) /* only if no -parent switch */
{
while (sizes[n].width != 0 && sizes[n].height != 0)
{
RRRegisterSize (pScreen,
sizes[n].width,
sizes[n].height,
(sizes[n].width * screen->width_mm)/screen->width,
(sizes[n].height *screen->height_mm)/screen->height
);
n++;
}
}
pSize = RRRegisterSize (pScreen,
screen->width,
screen->height,
screen->width_mm,
screen->height_mm);
randr = KdSubRotation (scrpriv->randr, screen->randr);
RRSetCurrentConfig (pScreen, randr, 0, pSize);
return TRUE;
}
Bool
ephyrRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
int rate,
RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = screen->driver;
Bool wasEnabled = pScreenPriv->enabled;
EphyrScrPriv oldscr;
int oldwidth;
int oldheight;
int oldmmwidth;
int oldmmheight;
int newwidth, newheight;
if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
{
newwidth = pSize->width;
newheight = pSize->height;
}
else
{
newwidth = pSize->height;
newheight = pSize->width;
}
if (wasEnabled)
KdDisableScreen (pScreen);
oldscr = *scrpriv;
oldwidth = screen->width;
oldheight = screen->height;
oldmmwidth = pScreen->mmWidth;
oldmmheight = pScreen->mmHeight;
/*
* Set new configuration
*/
scrpriv->randr = KdAddRotation (screen->randr, randr);
KdOffscreenSwapOut (screen->pScreen);
ephyrUnmapFramebuffer (screen);
screen->width = newwidth;
screen->height = newheight;
if (!ephyrMapFramebuffer (screen))
goto bail4;
KdShadowUnset (screen->pScreen);
if (!ephyrSetShadow (screen->pScreen))
goto bail4;
ephyrSetScreenSizes (screen->pScreen);
/*
* Set frame buffer mapping
*/
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
pScreen->width,
pScreen->height,
screen->fb[0].depth,
screen->fb[0].bitsPerPixel,
screen->fb[0].byteStride,
screen->fb[0].frameBuffer);
/* set the subpixel order */
KdSetSubpixelOrder (pScreen, scrpriv->randr);
if (wasEnabled)
KdEnableScreen (pScreen);
return TRUE;
bail4:
EPHYR_DBG("bailed");
ephyrUnmapFramebuffer (screen);
*scrpriv = oldscr;
(void) ephyrMapFramebuffer (screen);
pScreen->width = oldwidth;
pScreen->height = oldheight;
pScreen->mmWidth = oldmmwidth;
pScreen->mmHeight = oldmmheight;
if (wasEnabled)
KdEnableScreen (pScreen);
return FALSE;
}
Bool
ephyrRandRInit (ScreenPtr pScreen)
{
rrScrPrivPtr pScrPriv;
if (!RRScreenInit (pScreen))
{
return FALSE;
}
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = ephyrRandRGetInfo;
pScrPriv->rrSetConfig = ephyrRandRSetConfig;
return TRUE;
}
#endif
Bool
ephyrCreateColormap (ColormapPtr pmap)
{
return fbInitializeColormap (pmap);
}
Bool
ephyrInitScreen (ScreenPtr pScreen)
{
pScreen->CreateColormap = ephyrCreateColormap;
return TRUE;
}
Bool
ephyrFinishInitScreen (ScreenPtr pScreen)
{
if (!shadowSetup (pScreen))
return FALSE;
#ifdef RANDR
if (!ephyrRandRInit (pScreen))
return FALSE;
#endif
return TRUE;
}
Bool
ephyrCreateResources (ScreenPtr pScreen)
{
return ephyrSetShadow (pScreen);
}
void
ephyrPreserve (KdCardInfo *card)
{
}
Bool
ephyrEnable (ScreenPtr pScreen)
{
return TRUE;
}
Bool
ephyrDPMS (ScreenPtr pScreen, int mode)
{
return TRUE;
}
void
ephyrDisable (ScreenPtr pScreen)
{
}
void
ephyrRestore (KdCardInfo *card)
{
}
void
ephyrScreenFini (KdScreenInfo *screen)
{
}
void
ephyrPoll(void)
{
EphyrHostXEvent ev;
while (hostx_get_event(&ev))
{
switch (ev.type)
{
case EPHYR_EV_MOUSE_MOTION:
KdEnqueueMouseEvent(kdMouseInfo, mouseState,
ev.data.mouse_motion.x,
ev.data.mouse_motion.y);
break;
case EPHYR_EV_MOUSE_PRESS:
mouseState |= ev.data.mouse_down.button_num;
KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0);
break;
case EPHYR_EV_MOUSE_RELEASE:
mouseState &= ~ev.data.mouse_up.button_num;
KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0);
break;
case EPHYR_EV_KEY_PRESS:
KdEnqueueKeyboardEvent (ev.data.key_down.scancode, FALSE);
break;
case EPHYR_EV_KEY_RELEASE:
KdEnqueueKeyboardEvent (ev.data.key_up.scancode, TRUE);
break;
default:
break;
}
}
}
void
ephyrCardFini (KdCardInfo *card)
{
EphyrPriv *priv = card->driver;
xfree (priv);
}
void
ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
while (n--)
{
pdefs->red = 0;
pdefs->green = 0;
pdefs->blue = 0;
pdefs++;
}
}
void
ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
}
/* Mouse calls */
static Bool
MouseInit (void)
{
return TRUE;
}
static void
MouseFini (void)
{
;
}
KdMouseFuncs EphyrMouseFuncs = {
MouseInit,
MouseFini,
};
/* Keyboard */
static void
EphyrKeyboardLoad (void)
{
EPHYR_DBG("mark");
hostx_load_keymap();
}
static int
EphyrKeyboardInit (void)
{
return 0;
}
static void
EphyrKeyboardFini (void)
{
}
static void
EphyrKeyboardLeds (int leds)
{
}
static void
EphyrKeyboardBell (int volume, int frequency, int duration)
{
}
KdKeyboardFuncs EphyrKeyboardFuncs = {
EphyrKeyboardLoad,
EphyrKeyboardInit,
EphyrKeyboardLeds,
EphyrKeyboardBell,
EphyrKeyboardFini,
0,
};

View File

@ -1,156 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _EPHYR_H_
#define _EPHYR_H_
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include "os.h" /* for OsSignal() */
#include "kdrive.h"
#include "kkeymap.h"
#include "hostx.h"
#ifdef RANDR
#include "randrstr.h"
#endif
typedef struct _ephyrPriv {
CARD8 *base;
int bytes_per_line;
} EphyrPriv;
typedef struct _ephyrScrPriv {
Rotation randr;
Bool shadow;
PixmapPtr pShadow;
} EphyrScrPriv;
extern KdCardFuncs ephyrFuncs;
Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
Bool
ephyrCardInit (KdCardInfo *card);
Bool
ephyrScreenInit (KdScreenInfo *screen);
Bool
ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv);
Bool
ephyrInitScreen (ScreenPtr pScreen);
Bool
ephyrFinishInitScreen (ScreenPtr pScreen);
Bool
ephyrCreateResources (ScreenPtr pScreen);
void
ephyrPreserve (KdCardInfo *card);
Bool
ephyrEnable (ScreenPtr pScreen);
Bool
ephyrDPMS (ScreenPtr pScreen, int mode);
void
ephyrDisable (ScreenPtr pScreen);
void
ephyrRestore (KdCardInfo *card);
void
ephyrScreenFini (KdScreenInfo *screen);
void
ephyrCardFini (KdCardInfo *card);
void
ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
void
ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
Bool
ephyrMapFramebuffer (KdScreenInfo *screen);
void *
ephyrWindowLinear (ScreenPtr pScreen,
CARD32 row,
CARD32 offset,
int mode,
CARD32 *size,
void *closure);
void
ephyrSetScreenSizes (ScreenPtr pScreen);
Bool
ephyrUnmapFramebuffer (KdScreenInfo *screen);
Bool
ephyrSetShadow (ScreenPtr pScreen);
Bool
ephyrCreateColormap (ColormapPtr pmap);
void
ephyrPoll(void);
#ifdef RANDR
Bool
ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
Bool
ephyrRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
int rate,
RRScreenSizePtr pSize);
Bool
ephyrRandRInit (ScreenPtr pScreen);
void
ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
#endif
extern KdMouseFuncs EphyrMouseFuncs;
extern KdKeyboardFuncs EphyrKeyboardFuncs;
extern KdOsFuncs EphyrOsFuncs;
extern Bool ephyrCursorInit(ScreenPtr pScreen);
extern void ephyrCursorEnable(ScreenPtr pScreen);
#endif

View File

@ -1,185 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ephyr.h"
extern Window EphyrPreExistingHostWin;
void
InitCard (char *name)
{
KdCardAttr attr;
EPHYR_DBG("mark");
KdCardInfoAdd (&ephyrFuncs, &attr, 0);
}
void
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
{
KdInitOutput (pScreenInfo, argc, argv);
}
void
InitInput (int argc, char **argv)
{
KdInitInput (&EphyrMouseFuncs, &EphyrKeyboardFuncs);
}
void
ddxUseMsg (void)
{
KdUseMsg();
ErrorF("\nXephyr Option Usage:\n");
ErrorF("-parent XID Use existing window as Xephyr root win\n");
ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
ErrorF("\n");
exit(1);
}
int
ddxProcessArgument (int argc, char **argv, int i)
{
EPHYR_DBG("mark");
if (!strcmp (argv[i], "-parent"))
{
if(i+1 < argc)
{
hostx_use_preexisting_window(strtol(argv[i+1], NULL, 0));
return 2;
}
UseMsg();
exit(1);
}
else if (!strcmp (argv[i], "-host-cursor"))
{
hostx_use_host_cursor();
return 1;
}
return KdProcessArgument (argc, argv, i);
}
void
OsVendorInit (void)
{
EPHYR_DBG("mark");
if (hostx_want_host_cursor())
{
ephyrFuncs.initCursor = &ephyrCursorInit;
ephyrFuncs.enableCursor = &ephyrCursorEnable;
}
KdOsInit (&EphyrOsFuncs);
}
/* 'Fake' cursor stuff, could be improved */
static Bool
ephyrRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
return TRUE;
}
static Bool
ephyrUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
return TRUE;
}
static void
ephyrSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
{
;
}
static void
ephyrMoveCursor(ScreenPtr pScreen, int x, int y)
{
;
}
miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
ephyrRealizeCursor,
ephyrUnrealizeCursor,
ephyrSetCursor,
ephyrMoveCursor,
};
Bool
ephyrCursorInit(ScreenPtr pScreen)
{
miPointerInitialize(pScreen, &EphyrPointerSpriteFuncs,
&kdPointerScreenFuncs, FALSE);
return TRUE;
}
void
ephyrCursorEnable(ScreenPtr pScreen)
{
;
}
KdCardFuncs ephyrFuncs = {
ephyrCardInit, /* cardinit */
ephyrScreenInit, /* scrinit */
ephyrInitScreen, /* initScreen */
ephyrFinishInitScreen, /* finishInitScreen */
ephyrCreateResources, /* createRes */
ephyrPreserve, /* preserve */
ephyrEnable, /* enable */
ephyrDPMS, /* dpms */
ephyrDisable, /* disable */
ephyrRestore, /* restore */
ephyrScreenFini, /* scrfini */
ephyrCardFini, /* cardfini */
0, /* initCursor */
0, /* enableCursor */
0, /* disableCursor */
0, /* finiCursor */
0, /* recolorCursor */
0, /* initAccel */
0, /* enableAccel */
0, /* syncAccel */
0, /* disableAccel */
0, /* finiAccel */
ephyrGetColors, /* getColors */
ephyrPutColors, /* putColors */
};

View File

@ -1,564 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "hostx.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h> /* for memset */
#include <time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/time.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/XShm.h>
/*
* All xlib calls go here, which gets built as its own .a .
* Mixing kdrive and xlib headers causes all sorts of types
* to get clobbered.
*/
struct EphyrHostXVars
{
Display *dpy;
int screen;
Visual *visual;
Window win, winroot;
Window win_pre_existing; /* Set via -parent option like xnest */
GC gc;
int depth;
XImage *ximg;
int win_width, win_height;
Bool use_host_cursor;
Bool have_shm;
long damage_debug_msec;
XShmSegmentInfo shminfo;
};
static EphyrHostXVars HostX = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; /* defaults */
static int HostXWantDamageDebug = 0;
extern KeySym EphyrKeymap[];
extern KeySym kdKeymap[];
extern int kdMinScanCode;
extern int kdMaxScanCode;
extern int kdMinKeyCode;
extern int kdMaxKeyCode;
extern int kdKeymapWidth;
extern int monitorResolution;
/* X Error traps */
static int trapped_error_code = 0;
static int (*old_error_handler) (Display *d, XErrorEvent *e);
static int
error_handler(Display *display,
XErrorEvent *error)
{
trapped_error_code = error->error_code;
return 0;
}
static void
hostx_errors_trap(void)
{
trapped_error_code = 0;
old_error_handler = XSetErrorHandler(error_handler);
}
static int
hostx_errors_untrap(void)
{
XSetErrorHandler(old_error_handler);
return trapped_error_code;
}
int
hostx_want_screen_size(int *width, int *height)
{
if (HostX.win_pre_existing != None)
{
*width = HostX.win_width;
*height = HostX.win_height;
return 1;
}
return 0;
}
int
hostx_want_host_cursor(void)
{
return HostX.use_host_cursor;
}
void
hostx_use_host_cursor(void)
{
HostX.use_host_cursor = True;
}
int
hostx_want_preexisting_window(void)
{
if (HostX.win_pre_existing)
return 1;
else
return 0;
}
void
hostx_use_preexisting_window(unsigned long win_id)
{
HostX.win_pre_existing = win_id;
}
static void
hostx_toggle_damage_debug(void)
{
HostXWantDamageDebug ^= 1;
}
void
hostx_handle_signal(int signum)
{
hostx_toggle_damage_debug();
EPHYR_DBG("Signal caught. Damage Debug:%i\n", HostXWantDamageDebug);
}
int
hostx_init(void)
{
XSetWindowAttributes attr;
Cursor empty_cursor;
Pixmap cursor_pxm;
XColor col;
attr.event_mask =
ButtonPressMask
|ButtonReleaseMask
|PointerMotionMask
|KeyPressMask
|KeyReleaseMask
|ExposureMask;
EPHYR_DBG("mark");
if ((HostX.dpy = XOpenDisplay(getenv("DISPLAY"))) == NULL)
{
fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
exit(1);
}
HostX.screen = DefaultScreen(HostX.dpy);
HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
/* old way of getting dpi
HostX.mm_per_pixel_vertical = (double)DisplayHeightMM(HostX.dpy, HostX.screen)
/ DisplayHeight(HostX.dpy, HostX.screen);
HostX.mm_per_pixel_horizontal = (double)DisplayWidthMM(HostX.dpy, HostX.screen)
/ DisplayWidth(HostX.dpy, HostX.screen);
*/
if (HostX.win_pre_existing != None)
{
Status result;
XWindowAttributes prewin_attr;
/* Get screen size from existing window */
HostX.win = HostX.win_pre_existing;
hostx_errors_trap();
result = XGetWindowAttributes(HostX.dpy, HostX.win, &prewin_attr);
if (hostx_errors_untrap() || !result)
{
fprintf(stderr, "\nXephyr -parent window' does not exist!\n");
exit(1);
}
HostX.win_width = prewin_attr.width;
HostX.win_height = prewin_attr.height;
XSelectInput(HostX.dpy, HostX.win, attr.event_mask);
}
else
{
HostX.win = XCreateWindow(HostX.dpy,
HostX.winroot,
0,0,100,100, /* will resize */
0,
CopyFromParent,
CopyFromParent,
CopyFromParent,
CWEventMask,
&attr);
XStoreName(HostX.dpy, HostX.win, "Xephyr");
}
HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
XParseColor(HostX.dpy, DefaultColormap(HostX.dpy,HostX.screen), "red", &col);
XAllocColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen), &col);
XSetForeground(HostX.dpy, HostX.gc, col.pixel);
if (!hostx_want_host_cursor())
{
/* Ditch the cursor, we provide our 'own' */
cursor_pxm = XCreatePixmap (HostX.dpy, HostX.winroot, 1, 1, 1);
memset (&col, 0, sizeof (col));
empty_cursor = XCreatePixmapCursor (HostX.dpy,
cursor_pxm, cursor_pxm,
&col, &col, 1, 1);
XDefineCursor (HostX.dpy, HostX.win, empty_cursor);
XFreePixmap (HostX.dpy, cursor_pxm);
}
HostX.ximg = NULL;
/* Try to get share memory ximages for a little bit more speed */
if (!XShmQueryExtension(HostX.dpy) || getenv("XEPHYR_NO_SHM"))
{
fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
HostX.have_shm = False;
}
else
{
/* Really really check we have shm - better way ?*/
XShmSegmentInfo shminfo;
HostX.have_shm = True;
shminfo.shmid=shmget(IPC_PRIVATE, 1, IPC_CREAT|0777);
shminfo.shmaddr=shmat(shminfo.shmid,0,0);
shminfo.readOnly=True;
hostx_errors_trap();
XShmAttach(HostX.dpy, &shminfo);
XSync(HostX.dpy, False);
if (hostx_errors_untrap())
{
fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
HostX.have_shm = False;
}
shmdt(shminfo.shmaddr);
shmctl(shminfo.shmid, IPC_RMID, 0);
}
XFlush(HostX.dpy);
/* Setup the pause time between paints when debugging updates */
HostX.damage_debug_msec = 20000; /* 1/50 th of a second */
if (getenv("XEPHYR_PAUSE"))
{
HostX.damage_debug_msec = strtol(getenv("XEPHYR_PAUSE"), NULL, 0);
EPHYR_DBG("pause is %li\n", HostX.damage_debug_msec);
}
return 1;
}
int
hostx_get_depth (void)
{
return HostX.depth;
}
int
hostx_get_bpp(void)
{
return HostX.visual->bits_per_rgb;
}
void
hostx_get_visual_masks (unsigned long *rmsk,
unsigned long *gmsk,
unsigned long *bmsk)
{
*rmsk = HostX.visual->red_mask;
*gmsk = HostX.visual->green_mask;
*bmsk = HostX.visual->blue_mask;
}
void*
hostx_screen_init (int width, int height)
{
int bitmap_pad;
Bool shm_success = False;
XSizeHints *size_hints;
EPHYR_DBG("mark");
if (HostX.ximg != NULL)
{
/* Free up the image data if previously used
* i.ie called by server reset
*/
if (HostX.have_shm)
{
XShmDetach(HostX.dpy, &HostX.shminfo);
XDestroyImage (HostX.ximg);
shmdt(HostX.shminfo.shmaddr);
shmctl(HostX.shminfo.shmid, IPC_RMID, 0);
}
else
{
if (HostX.ximg->data)
{
free(HostX.ximg->data);
HostX.ximg->data = NULL;
}
XDestroyImage(HostX.ximg);
}
}
if (HostX.have_shm)
{
HostX.ximg = XShmCreateImage(HostX.dpy, HostX.visual, HostX.depth,
ZPixmap, NULL, &HostX.shminfo,
width, height );
HostX.shminfo.shmid = shmget(IPC_PRIVATE,
HostX.ximg->bytes_per_line * height,
IPC_CREAT|0777);
HostX.shminfo.shmaddr = HostX.ximg->data = shmat(HostX.shminfo.shmid,
0, 0);
if (HostX.ximg->data == (char *)-1)
{
EPHYR_DBG("Can't attach SHM Segment, falling back to plain XImages");
HostX.have_shm = False;
XDestroyImage(HostX.ximg);
shmctl(HostX.shminfo.shmid, IPC_RMID, 0);
}
else
{
EPHYR_DBG("SHM segment attached");
HostX.shminfo.readOnly = False;
XShmAttach(HostX.dpy, &HostX.shminfo);
shm_success = True;
}
}
if (!shm_success)
{
bitmap_pad = ( HostX.depth > 16 )? 32 : (( HostX.depth > 8 )? 16 : 8 );
HostX.ximg = XCreateImage( HostX.dpy,
HostX.visual,
HostX.depth,
ZPixmap, 0, 0,
width,
height,
bitmap_pad,
0);
HostX.ximg->data = malloc( HostX.ximg->bytes_per_line * height );
}
XResizeWindow(HostX.dpy, HostX.win, width, height);
/* Ask the WM to keep our size static */
size_hints = XAllocSizeHints();
size_hints->max_width = size_hints->min_width = width;
size_hints->max_height = size_hints->min_height = height;
size_hints->flags = PMinSize|PMaxSize;
XSetWMNormalHints(HostX.dpy, HostX.win, size_hints);
XFree(size_hints);
XMapWindow(HostX.dpy, HostX.win);
XSync(HostX.dpy, False);
HostX.win_width = width;
HostX.win_height = height;
return HostX.ximg->data;
}
void
hostx_paint_rect(int sx, int sy,
int dx, int dy,
int width, int height)
{
/*
* Copy the image data updated by the shadow layer
* on to the window
*/
if (HostXWantDamageDebug)
{
hostx_paint_debug_rect(dx, dy, width, height);
}
if (HostX.have_shm)
{
XShmPutImage(HostX.dpy, HostX.win, HostX.gc, HostX.ximg,
sx, sy, dx, dy, width, height, False);
}
else
{
XPutImage(HostX.dpy, HostX.win, HostX.gc, HostX.ximg,
sx, sy, dx, dy, width, height);
}
XSync(HostX.dpy, False);
}
void
hostx_paint_debug_rect(int x, int y,
int width, int height)
{
struct timespec tspec;
tspec.tv_sec = HostX.damage_debug_msec / (1000000);
tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000;
EPHYR_DBG("msec: %li tv_sec %li, tv_msec %li",
HostX.damage_debug_msec, tspec.tv_sec, tspec.tv_nsec);
XFillRectangle(HostX.dpy, HostX.win, HostX.gc, x, y, width,height);
XSync(HostX.dpy, False);
/* nanosleep seems to work better than usleep for me... */
nanosleep(&tspec, NULL);
}
void
hostx_load_keymap(void)
{
KeySym *keymap;
int mapWidth, min_keycode, max_keycode;
XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode);
EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode);
keymap = XGetKeyboardMapping(HostX.dpy,
min_keycode,
max_keycode - min_keycode + 1,
&mapWidth);
memcpy (kdKeymap, keymap,
(max_keycode - min_keycode + 1)*mapWidth*sizeof(KeySym));
EPHYR_DBG("keymap width: %d", mapWidth);
/* all kdrive vars - see kkeymap.c */
kdMinScanCode = min_keycode;
kdMaxScanCode = max_keycode;
kdMinKeyCode = min_keycode;
kdMaxKeyCode = max_keycode;
kdKeymapWidth = mapWidth;
XFree(keymap);
}
int
hostx_get_event(EphyrHostXEvent *ev)
{
XEvent xev;
if (XPending(HostX.dpy))
{
XNextEvent(HostX.dpy, &xev);
switch (xev.type)
{
case Expose:
/* Not so great event compression, but works ok */
while (XCheckTypedWindowEvent(HostX.dpy, xev.xexpose.window,
Expose, &xev));
hostx_paint_rect(0, 0, 0, 0, HostX.win_width, HostX.win_height);
return 0;
case MotionNotify:
ev->type = EPHYR_EV_MOUSE_MOTION;
ev->data.mouse_motion.x = xev.xmotion.x;
ev->data.mouse_motion.y = xev.xmotion.y;
return 1;
case ButtonPress:
ev->type = EPHYR_EV_MOUSE_PRESS;
/*
* This is a bit hacky. will break for button 5 ( defined as 0x10 )
* Check KD_BUTTON defines in kdrive.h
*/
ev->data.mouse_down.button_num = 1<<(xev.xbutton.button-1);
return 1;
case ButtonRelease:
ev->type = EPHYR_EV_MOUSE_RELEASE;
ev->data.mouse_up.button_num = 1<<(xev.xbutton.button-1);
return 1;
case KeyPress:
{
ev->type = EPHYR_EV_KEY_PRESS;
ev->data.key_down.scancode = xev.xkey.keycode;
return 1;
}
case KeyRelease:
ev->type = EPHYR_EV_KEY_RELEASE;
ev->data.key_up.scancode = xev.xkey.keycode;
return 1;
default:
break;
}
}
return 0;
}

View File

@ -1,131 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _XLIBS_STUFF_H_
#define _XLIBS_STUFF_H_
#define EPHYR_WANT_DEBUG 0
#if (EPHYR_WANT_DEBUG)
#define EPHYR_DBG(x, a...) \
fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
#else
#define EPHYR_DBG(x, a...) do {} while (0)
#endif
typedef struct EphyrHostXVars EphyrHostXVars;
typedef struct EphyrHostXEvent EphyrHostXEvent;
typedef enum EphyrHostXEventType
{
EPHYR_EV_MOUSE_MOTION,
EPHYR_EV_MOUSE_PRESS,
EPHYR_EV_MOUSE_RELEASE,
EPHYR_EV_KEY_PRESS,
EPHYR_EV_KEY_RELEASE
}
EphyrHostXEventType;
struct EphyrHostXEvent
{
EphyrHostXEventType type;
union
{
struct mouse_motion {
int x;
int y;
} mouse_motion;
struct mouse_down {
int button_num;
} mouse_down;
struct mouse_up {
int button_num;
} mouse_up;
struct key_up {
int scancode;
} key_up;
struct key_down {
int scancode;
} key_down;
} data;
};
int
hostx_want_screen_size(int *width, int *height);
int
hostx_want_host_cursor(void);
void
hostx_use_host_cursor(void);
int
hostx_want_preexisting_window(void);
void
hostx_use_preexisting_window(unsigned long win_id);
void
hostx_handle_signal(int signum);
int
hostx_init(void);
int
hostx_get_depth (void);
int
hostx_get_bpp(void);
void
hostx_get_visual_masks (unsigned long *rmsk,
unsigned long *gmsk,
unsigned long *bmsk);
void*
hostx_screen_init (int width, int height);
void
hostx_paint_rect(int sx, int sy,
int dx, int dy,
int width, int height);
void
hostx_paint_debug_rect(int x, int y,
int width, int height);
void
hostx_load_keymap(void);
int
hostx_get_event(EphyrHostXEvent *ev);
#endif

View File

@ -1,67 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ephyr.h"
static int
EphyrInit (void)
{
return hostx_init();
}
static void
EphyrEnable (void)
{
EPHYR_DBG("mark");
}
static Bool
EphyrSpecialKey (KeySym sym)
{
return FALSE;
}
static void
EphyrDisable (void)
{
}
static void
EphyrFini (void)
{
}
KdOsFuncs EphyrOsFuncs = {
EphyrInit,
EphyrEnable,
EphyrSpecialKey,
EphyrDisable,
EphyrFini,
ephyrPoll
};

View File

@ -1,32 +0,0 @@
INCLUDES = \
@KDRIVE_INCS@ \
@XSERVER_CFLAGS@
noinst_LIBRARIES = libfake.a
bin_PROGRAMS = Xfake
if TSLIB
TSLIB_FLAG = -lts
endif
libfake_a_SOURCES = \
fake.c \
kbd.c \
os.c \
mouse.c \
fake.h
Xfake_SOURCES = \
fakeinit.c
Xfake_LDADD = \
libfake.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xfake_DEPENDENCIES = \
libfake.a \
@KDRIVE_LIBS@

View File

@ -1,494 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "fake.h"
extern int KdTsPhyScreen;
Bool
fakeInitialize (KdCardInfo *card, FakePriv *priv)
{
priv->base = 0;
priv->bytes_per_line = 0;
return TRUE;
}
Bool
fakeCardInit (KdCardInfo *card)
{
FakePriv *priv;
priv = (FakePriv *) xalloc (sizeof (FakePriv));
if (!priv)
return FALSE;
if (!fakeInitialize (card, priv))
{
xfree (priv);
return FALSE;
}
card->driver = priv;
return TRUE;
}
static Bool
fakeModeSupported (KdScreenInfo *screen,
const KdMonitorTiming *t)
{
return TRUE;
}
Bool
fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv)
{
const KdMonitorTiming *t;
if (!screen->width || !screen->height)
{
screen->width = 1024;
screen->height = 768;
screen->rate = 72;
}
if (!screen->fb[0].depth)
screen->fb[0].depth = 16;
t = KdFindMode (screen, fakeModeSupported);
screen->rate = t->rate;
screen->width = t->horizontal;
screen->height = t->vertical;
if (screen->fb[0].depth <= 8)
{
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
}
else
{
screen->fb[0].visuals = (1 << TrueColor);
#define Mask(o,l) (((1 << l) - 1) << o)
if (screen->fb[0].depth <= 15)
{
screen->fb[0].depth = 15;
screen->fb[0].bitsPerPixel = 16;
screen->fb[0].redMask = Mask (10, 5);
screen->fb[0].greenMask = Mask (5, 5);
screen->fb[0].blueMask = Mask (0, 5);
}
else if (screen->fb[0].depth <= 16)
{
screen->fb[0].depth = 16;
screen->fb[0].bitsPerPixel = 16;
screen->fb[0].redMask = Mask (11, 5);
screen->fb[0].greenMask = Mask (5, 6);
screen->fb[0].blueMask = Mask (0, 5);
}
else
{
screen->fb[0].depth = 24;
screen->fb[0].bitsPerPixel = 32;
screen->fb[0].redMask = Mask (16, 8);
screen->fb[0].greenMask = Mask (8, 8);
screen->fb[0].blueMask = Mask (0, 8);
}
}
scrpriv->randr = screen->randr;
return fakeMapFramebuffer (screen);
}
Bool
fakeScreenInit (KdScreenInfo *screen)
{
FakeScrPriv *scrpriv;
scrpriv = xalloc (sizeof (FakeScrPriv));
if (!scrpriv)
return FALSE;
memset (scrpriv, '\0', sizeof (FakeScrPriv));
screen->driver = scrpriv;
if (!fakeScreenInitialize (screen, scrpriv))
{
screen->driver = 0;
xfree (scrpriv);
return FALSE;
}
return TRUE;
}
void *
fakeWindowLinear (ScreenPtr pScreen,
CARD32 row,
CARD32 offset,
int mode,
CARD32 *size,
void *closure)
{
KdScreenPriv(pScreen);
FakePriv *priv = pScreenPriv->card->driver;
if (!pScreenPriv->enabled)
return 0;
*size = priv->bytes_per_line;
return priv->base + row * priv->bytes_per_line;
}
Bool
fakeMapFramebuffer (KdScreenInfo *screen)
{
FakeScrPriv *scrpriv = screen->driver;
KdMouseMatrix m;
FakePriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
scrpriv->shadow = TRUE;
else
scrpriv->shadow = FALSE;
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
if (priv->base)
free (priv->base);
priv->base = malloc (priv->bytes_per_line * screen->height);
screen->memory_base = (CARD8 *) (priv->base);
screen->memory_size = 0;
screen->off_screen_base = 0;
if (scrpriv->shadow)
{
if (!KdShadowFbAlloc (screen, 0,
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
return FALSE;
}
else
{
screen->fb[0].byteStride = priv->bytes_per_line;
screen->fb[0].pixelStride = (priv->bytes_per_line * 8/
screen->fb[0].bitsPerPixel);
screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
}
return TRUE;
}
void
fakeSetScreenSizes (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
FakeScrPriv *scrpriv = screen->driver;
if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
{
pScreen->width = screen->width;
pScreen->height = screen->height;
pScreen->mmWidth = screen->width_mm;
pScreen->mmHeight = screen->height_mm;
}
else
{
pScreen->width = screen->width;
pScreen->height = screen->height;
pScreen->mmWidth = screen->height_mm;
pScreen->mmHeight = screen->width_mm;
}
}
Bool
fakeUnmapFramebuffer (KdScreenInfo *screen)
{
FakePriv *priv = screen->card->driver;
KdShadowFbFree (screen, 0);
if (priv->base)
{
free (priv->base);
priv->base = 0;
}
return TRUE;
}
Bool
fakeSetShadow (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
FakeScrPriv *scrpriv = screen->driver;
ShadowUpdateProc update;
ShadowWindowProc window;
window = fakeWindowLinear;
update = 0;
if (scrpriv->randr)
update = shadowUpdateRotatePacked;
else
update = shadowUpdatePacked;
return KdShadowSet (pScreen, scrpriv->randr, update, window);
}
#ifdef RANDR
Bool
fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
FakeScrPriv *scrpriv = screen->driver;
RRScreenSizePtr pSize;
Rotation randr;
int n;
*rotations = RR_Rotate_All|RR_Reflect_All;
for (n = 0; n < pScreen->numDepths; n++)
if (pScreen->allowedDepths[n].numVids)
break;
if (n == pScreen->numDepths)
return FALSE;
pSize = RRRegisterSize (pScreen,
screen->width,
screen->height,
screen->width_mm,
screen->height_mm);
randr = KdSubRotation (scrpriv->randr, screen->randr);
RRSetCurrentConfig (pScreen, randr, 0, pSize);
return TRUE;
}
Bool
fakeRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
int rate,
RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
FakeScrPriv *scrpriv = screen->driver;
Bool wasEnabled = pScreenPriv->enabled;
FakeScrPriv oldscr;
int oldwidth;
int oldheight;
int oldmmwidth;
int oldmmheight;
int newwidth, newheight;
if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
{
newwidth = pSize->width;
newheight = pSize->height;
}
else
{
newwidth = pSize->height;
newheight = pSize->width;
}
if (wasEnabled)
KdDisableScreen (pScreen);
oldscr = *scrpriv;
oldwidth = screen->width;
oldheight = screen->height;
oldmmwidth = pScreen->mmWidth;
oldmmheight = pScreen->mmHeight;
/*
* Set new configuration
*/
scrpriv->randr = KdAddRotation (screen->randr, randr);
KdOffscreenSwapOut (screen->pScreen);
fakeUnmapFramebuffer (screen);
if (!fakeMapFramebuffer (screen))
goto bail4;
KdShadowUnset (screen->pScreen);
if (!fakeSetShadow (screen->pScreen))
goto bail4;
fakeSetScreenSizes (screen->pScreen);
/*
* Set frame buffer mapping
*/
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
pScreen->width,
pScreen->height,
screen->fb[0].depth,
screen->fb[0].bitsPerPixel,
screen->fb[0].byteStride,
screen->fb[0].frameBuffer);
/* set the subpixel order */
KdSetSubpixelOrder (pScreen, scrpriv->randr);
if (wasEnabled)
KdEnableScreen (pScreen);
return TRUE;
bail4:
fakeUnmapFramebuffer (screen);
*scrpriv = oldscr;
(void) fakeMapFramebuffer (screen);
pScreen->width = oldwidth;
pScreen->height = oldheight;
pScreen->mmWidth = oldmmwidth;
pScreen->mmHeight = oldmmheight;
if (wasEnabled)
KdEnableScreen (pScreen);
return FALSE;
}
Bool
fakeRandRInit (ScreenPtr pScreen)
{
rrScrPrivPtr pScrPriv;
if (!RRScreenInit (pScreen))
return FALSE;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = fakeRandRGetInfo;
pScrPriv->rrSetConfig = fakeRandRSetConfig;
return TRUE;
}
#endif
Bool
fakeCreateColormap (ColormapPtr pmap)
{
return fbInitializeColormap (pmap);
}
Bool
fakeInitScreen (ScreenPtr pScreen)
{
#ifdef TOUCHSCREEN
KdTsPhyScreen = pScreen->myNum;
#endif
pScreen->CreateColormap = fakeCreateColormap;
return TRUE;
}
Bool
fakeFinishInitScreen (ScreenPtr pScreen)
{
if (!shadowSetup (pScreen))
return FALSE;
#ifdef RANDR
if (!fakeRandRInit (pScreen))
return FALSE;
#endif
return TRUE;
}
Bool
fakeCreateResources (ScreenPtr pScreen)
{
return fakeSetShadow (pScreen);
}
void
fakePreserve (KdCardInfo *card)
{
}
Bool
fakeEnable (ScreenPtr pScreen)
{
return TRUE;
}
Bool
fakeDPMS (ScreenPtr pScreen, int mode)
{
return TRUE;
}
void
fakeDisable (ScreenPtr pScreen)
{
}
void
fakeRestore (KdCardInfo *card)
{
}
void
fakeScreenFini (KdScreenInfo *screen)
{
}
void
fakeCardFini (KdCardInfo *card)
{
FakePriv *priv = card->driver;
if (priv->base)
free (priv->base);
xfree (priv);
}
void
fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
while (n--)
{
pdefs->red = 0;
pdefs->green = 0;
pdefs->blue = 0;
pdefs++;
}
}
void
fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
}

View File

@ -1,139 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _FBDEV_H_
#define _FBDEV_H_
#include <stdio.h>
#include <unistd.h>
#include "kdrive.h"
#ifdef RANDR
#include "randrstr.h"
#endif
typedef struct _fakePriv {
CARD8 *base;
int bytes_per_line;
} FakePriv;
typedef struct _fakeScrPriv {
Rotation randr;
Bool shadow;
PixmapPtr pShadow;
} FakeScrPriv;
extern KdCardFuncs fakeFuncs;
Bool
fakeInitialize (KdCardInfo *card, FakePriv *priv);
Bool
fakeCardInit (KdCardInfo *card);
Bool
fakeScreenInit (KdScreenInfo *screen);
Bool
fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv);
Bool
fakeInitScreen (ScreenPtr pScreen);
Bool
fakeFinishInitScreen (ScreenPtr pScreen);
Bool
fakeCreateResources (ScreenPtr pScreen);
void
fakePreserve (KdCardInfo *card);
Bool
fakeEnable (ScreenPtr pScreen);
Bool
fakeDPMS (ScreenPtr pScreen, int mode);
void
fakeDisable (ScreenPtr pScreen);
void
fakeRestore (KdCardInfo *card);
void
fakeScreenFini (KdScreenInfo *screen);
void
fakeCardFini (KdCardInfo *card);
void
fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
void
fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
Bool
fakeMapFramebuffer (KdScreenInfo *screen);
void *
fakeWindowLinear (ScreenPtr pScreen,
CARD32 row,
CARD32 offset,
int mode,
CARD32 *size,
void *closure);
void
fakeSetScreenSizes (ScreenPtr pScreen);
Bool
fakeUnmapFramebuffer (KdScreenInfo *screen);
Bool
fakeSetShadow (ScreenPtr pScreen);
Bool
fakeCreateColormap (ColormapPtr pmap);
#ifdef RANDR
Bool
fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
Bool
fakeRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
int rate,
RRScreenSizePtr pSize);
Bool
fakeRandRInit (ScreenPtr pScreen);
#endif
extern KdMouseFuncs FakeMouseFuncs;
extern KdKeyboardFuncs FakeKeyboardFuncs;
extern KdOsFuncs FakeOsFuncs;
#endif /* _FBDEV_H_ */

View File

@ -1,96 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "fake.h"
void
InitCard (char *name)
{
KdCardAttr attr;
KdCardInfoAdd (&fakeFuncs, &attr, 0);
}
void
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
{
KdInitOutput (pScreenInfo, argc, argv);
}
void
InitInput (int argc, char **argv)
{
KdInitInput (&FakeMouseFuncs, &FakeKeyboardFuncs);
}
void
ddxUseMsg (void)
{
KdUseMsg();
}
int
ddxProcessArgument (int argc, char **argv, int i)
{
return KdProcessArgument (argc, argv, i);
}
void
OsVendorInit (void)
{
KdOsInit (&FakeOsFuncs);
}
KdCardFuncs fakeFuncs = {
fakeCardInit, /* cardinit */
fakeScreenInit, /* scrinit */
fakeInitScreen, /* initScreen */
fakeFinishInitScreen, /* finishInitScreen */
fakeCreateResources, /* createRes */
fakePreserve, /* preserve */
fakeEnable, /* enable */
fakeDPMS, /* dpms */
fakeDisable, /* disable */
fakeRestore, /* restore */
fakeScreenFini, /* scrfini */
fakeCardFini, /* cardfini */
0, /* initCursor */
0, /* enableCursor */
0, /* disableCursor */
0, /* finiCursor */
0, /* recolorCursor */
0, /* initAccel */
0, /* enableAccel */
0, /* syncAccel */
0, /* disableAccel */
0, /* finiAccel */
fakeGetColors, /* getColors */
fakePutColors, /* putColors */
};

View File

@ -1,195 +0,0 @@
/*
* Id: kbd.c,v 1.1 1999/11/02 18:39:28 keithp Exp $
*
* Copyright © 1999 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/fake/kbd.c,v 1.1 1999/11/19 13:53:53 hohndel Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "fake.h"
#include "kkeymap.h"
#include <X11/keysym.h>
#define FAKE_WIDTH 2
KeySym FakeKeymap[] = {
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
/* 3 10 */ XK_2, XK_at,
/* 4 11 */ XK_3, XK_numbersign,
/* 5 12 */ XK_4, XK_dollar,
/* 6 13 */ XK_5, XK_percent,
/* 7 14 */ XK_6, XK_asciicircum,
/* 8 15 */ XK_7, XK_ampersand,
/* 9 16 */ XK_8, XK_asterisk,
/* 10 17 */ XK_9, XK_parenleft,
/* 11 18 */ XK_0, XK_parenright,
/* 12 19 */ XK_minus, XK_underscore,
/* 13 20 */ XK_equal, XK_plus,
/* 14 21 */ XK_BackSpace, NoSymbol,
/* 15 22 */ XK_Tab, NoSymbol,
/* 16 23 */ XK_Q, NoSymbol,
/* 17 24 */ XK_W, NoSymbol,
/* 18 25 */ XK_E, NoSymbol,
/* 19 26 */ XK_R, NoSymbol,
/* 20 27 */ XK_T, NoSymbol,
/* 21 28 */ XK_Y, NoSymbol,
/* 22 29 */ XK_U, NoSymbol,
/* 23 30 */ XK_I, NoSymbol,
/* 24 31 */ XK_O, NoSymbol,
/* 25 32 */ XK_P, NoSymbol,
/* 26 33 */ XK_bracketleft, XK_braceleft,
/* 27 34 */ XK_bracketright, XK_braceright,
/* 28 35 */ XK_Return, NoSymbol,
/* 29 36 */ XK_Control_L, NoSymbol,
/* 30 37 */ XK_A, NoSymbol,
/* 31 38 */ XK_S, NoSymbol,
/* 32 39 */ XK_D, NoSymbol,
/* 33 40 */ XK_F, NoSymbol,
/* 34 41 */ XK_G, NoSymbol,
/* 35 42 */ XK_H, NoSymbol,
/* 36 43 */ XK_J, NoSymbol,
/* 37 44 */ XK_K, NoSymbol,
/* 38 45 */ XK_L, NoSymbol,
/* 39 46 */ XK_semicolon, XK_colon,
/* 40 47 */ XK_apostrophe, XK_quotedbl,
/* 41 48 */ XK_grave, XK_asciitilde,
/* 42 49 */ XK_Shift_L, NoSymbol,
/* 43 50 */ XK_backslash, XK_bar,
/* 44 51 */ XK_Z, NoSymbol,
/* 45 52 */ XK_X, NoSymbol,
/* 46 53 */ XK_C, NoSymbol,
/* 47 54 */ XK_V, NoSymbol,
/* 48 55 */ XK_B, NoSymbol,
/* 49 56 */ XK_N, NoSymbol,
/* 50 57 */ XK_M, NoSymbol,
/* 51 58 */ XK_comma, XK_less,
/* 52 59 */ XK_period, XK_greater,
/* 53 60 */ XK_slash, XK_question,
/* 54 61 */ XK_Shift_R, NoSymbol,
/* 55 62 */ XK_KP_Multiply, NoSymbol,
/* 56 63 */ XK_Alt_L, XK_Meta_L,
/* 57 64 */ XK_space, NoSymbol,
/* 58 65 */ XK_Caps_Lock, NoSymbol,
/* 59 66 */ XK_F1, NoSymbol,
/* 60 67 */ XK_F2, NoSymbol,
/* 61 68 */ XK_F3, NoSymbol,
/* 62 69 */ XK_F4, NoSymbol,
/* 63 70 */ XK_F5, NoSymbol,
/* 64 71 */ XK_F6, NoSymbol,
/* 65 72 */ XK_F7, NoSymbol,
/* 66 73 */ XK_F8, NoSymbol,
/* 67 74 */ XK_F9, NoSymbol,
/* 68 75 */ XK_F10, NoSymbol,
/* 69 76 */ XK_Break, XK_Pause,
/* 70 77 */ XK_Scroll_Lock, NoSymbol,
/* 71 78 */ XK_KP_Home, XK_KP_7,
/* 72 79 */ XK_KP_Up, XK_KP_8,
/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
/* 74 81 */ XK_KP_Subtract, NoSymbol,
/* 75 82 */ XK_KP_Left, XK_KP_4,
/* 76 83 */ XK_KP_5, NoSymbol,
/* 77 84 */ XK_KP_Right, XK_KP_6,
/* 78 85 */ XK_KP_Add, NoSymbol,
/* 79 86 */ XK_KP_End, XK_KP_1,
/* 80 87 */ XK_KP_Down, XK_KP_2,
/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
/* 82 89 */ XK_KP_Insert, XK_KP_0,
/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
/* 84 91 */ NoSymbol, NoSymbol,
/* 85 92 */ NoSymbol, NoSymbol,
/* 86 93 */ NoSymbol, NoSymbol,
/* 87 94 */ XK_F11, NoSymbol,
/* 88 95 */ XK_F12, NoSymbol,
/* These are remapped from the extended set (using ExtendMap) */
/* 89 96 */ XK_Control_R, NoSymbol,
/* 90 97 */ XK_KP_Enter, NoSymbol,
/* 91 98 */ XK_KP_Divide, NoSymbol,
/* 92 99 */ XK_Sys_Req, XK_Print,
/* 93 100 */ XK_Alt_R, XK_Meta_R,
/* 94 101 */ XK_Num_Lock, NoSymbol,
/* 95 102 */ XK_Home, NoSymbol,
/* 96 103 */ XK_Up, NoSymbol,
/* 97 104 */ XK_Page_Up, NoSymbol,
/* 98 105 */ XK_Left, NoSymbol,
/* 99 106 */ XK_Right, NoSymbol,
/* 100 107 */ XK_End, NoSymbol,
/* 101 108 */ XK_Down, NoSymbol,
/* 102 109 */ XK_Page_Down, NoSymbol,
/* 103 110 */ XK_Insert, NoSymbol,
/* 104 111 */ XK_Delete, NoSymbol,
/* 105 112 */ XK_Super_L, NoSymbol,
/* 106 113 */ XK_Super_R, NoSymbol,
/* 107 114 */ XK_Menu, NoSymbol,
/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
/* 110 117 */ XK_Up, NoSymbol, /* joypad */
/* 111 118 */ XK_Down, NoSymbol,
/* 112 119 */ XK_Left, NoSymbol,
/* 113 120 */ XK_Right, NoSymbol,
/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
static void
FakeKeyboardLoad (void)
{
kdMinScanCode = 1;
kdKeymapWidth = FAKE_WIDTH;
kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap));
}
static int
FakeKeyboardInit (void)
{
return 0;
}
static void
FakeKeyboardFini (void)
{
}
static void
FakeKeyboardLeds (int leds)
{
}
static void
FakeKeyboardBell (int volume, int frequency, int duration)
{
}
KdKeyboardFuncs FakeKeyboardFuncs = {
FakeKeyboardLoad,
FakeKeyboardInit,
FakeKeyboardLeds,
FakeKeyboardBell,
FakeKeyboardFini,
0,
};

View File

@ -1,53 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define NEED_EVENTS
#include <errno.h>
#include <termios.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xpoll.h>
#include "inputstr.h"
#include "scrnintstr.h"
#include "kdrive.h"
static Bool
MouseInit (void)
{
return TRUE;
}
static void
MouseFini (void)
{
}
KdMouseFuncs FakeMouseFuncs = {
MouseInit,
MouseFini,
};

View File

@ -1,65 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "fake.h"
static int
FakeInit (void)
{
return 1;
}
static void
FakeEnable (void)
{
}
static Bool
FakeSpecialKey (KeySym sym)
{
return FALSE;
}
static void
FakeDisable (void)
{
}
static void
FakeFini (void)
{
}
KdOsFuncs FakeOsFuncs = {
FakeInit,
FakeEnable,
FakeSpecialKey,
FakeDisable,
FakeFini,
0
};

View File

@ -1,19 +0,0 @@
XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Imakefile,v 1.4 2001/05/23 08:56:08 alanh Exp $
KDRIVE=..
#include "../Kdrive.tmpl"
#if XipaqServer
DEFINES = -DXIPAQ
#endif
SRCS = fbdev.c fbinit.c
OBJS = fbdev.o fbinit.o
INCLUDES = $(KDINCS) -I.
NormalLibraryObjectRule()
NormalLibraryTarget(fbdev,$(OBJS))
InstallManPage(Xfbdev,$(MANDIR))
DependTarget()

Some files were not shown because too many files have changed in this diff Show More