Tizen 2.1 base tizen_2.1 tizen_2.2 2.1b_release 2.2.1_release 2.2_release accepted/tizen_2.1/20130425.024332 submit/tizen_2.1/20130424.234737 submit/tizen_2.2/20130714.150453
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:54:31 +0000 (01:54 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:54:31 +0000 (01:54 +0900)
35 files changed:
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
README [new file with mode: 0644]
configure.ac [new file with mode: 0644]
include/X11/extensions/Xxf86dga.h [new file with mode: 0644]
include/X11/extensions/xf86dga1.h [new file with mode: 0644]
man/Makefile.am [new file with mode: 0644]
man/XDGA.man [new file with mode: 0644]
man/XDGAChangePixmapMode.man [new file with mode: 0644]
man/XDGACloseFramebuffer.man [new file with mode: 0644]
man/XDGACopyArea.man [new file with mode: 0644]
man/XDGACopyTransparentArea.man [new file with mode: 0644]
man/XDGACreateColormap.man [new file with mode: 0644]
man/XDGAFillRectangle.man [new file with mode: 0644]
man/XDGAGetViewportStatus.man [new file with mode: 0644]
man/XDGAInstallColormap.man [new file with mode: 0644]
man/XDGAKeyEventToXKeyEvent.man [new file with mode: 0644]
man/XDGAOpenFramebuffer.man [new file with mode: 0644]
man/XDGAQueryExtension.man [new file with mode: 0644]
man/XDGAQueryModes.man [new file with mode: 0644]
man/XDGAQueryVersion.man [new file with mode: 0644]
man/XDGASelectInput.man [new file with mode: 0644]
man/XDGASetClientVersion.man [new file with mode: 0644]
man/XDGASetMode.man [new file with mode: 0644]
man/XDGASetViewport.man [new file with mode: 0644]
man/XDGASync.man [new file with mode: 0644]
man/XF86DGA.man [new file with mode: 0644]
man/XFree86-DGA.man [new file with mode: 0644]
packaging/libXxf86dga.spec [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/XF86DGA.c [new file with mode: 0644]
src/XF86DGA2.c [new file with mode: 0644]
xxf86dga.pc.in [new file with mode: 0644]

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..bcebc15
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,26 @@
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995, 1996  The XFree86 Project, Inc
+
+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 fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from the XFree86
+Project.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..fd4d98b
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,609 @@
+commit 3dad5d7c34c5787f0466b9ff50d7c26cd18e37bd
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Mar 7 21:34:06 2012 -0800
+
+    libXxf86dga 1.1.3
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 870a35db2ad6eab47d1026a56e52c3f53a9877eb
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Nov 10 21:50:52 2011 -0800
+
+    Fix gcc -Wwrite-strings warnings
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit e9936bbcfe7ae6430ec91fd5fca696c09f2b904c
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Sep 16 22:57:14 2011 -0700
+
+    Strip trailing whitespace
+    
+    Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
+    git diff -w & git diff -b show no diffs from this change
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit c85b3c711d96331b4aa564ee4c9168d1aa0c10bc
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Tue May 17 20:54:52 2011 -0700
+
+    XDGA.man: Fix capitalization of ViewportStep to match xf86dgaproto headers
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 8d4356002f886417c1edb7b41aa1139d984bb861
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Feb 2 11:43:45 2011 -0500
+
+    config: comment, minor upgrade, quote and layout configure.ac
+    
+    Group statements per section as per Autoconf standard layout
+    Quote statements where appropriate.
+    Autoconf recommends not using dnl instead of # for comments
+    
+    Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters.
+    Add AC_CONFIG_SRCDIR([Makefile.am])
+    
+    This helps automated maintenance and release activities.
+    Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines
+
+commit 1d8387fbb917fb47d27b20b369d3fb7d0947ab6a
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jan 28 19:41:38 2011 -0500
+
+    config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 4aae82f7d0533ba696434b2c8d108e8d8206b8bc
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Jan 27 18:50:15 2011 -0500
+
+    config: remove AC_PROG_CC as it overrides AC_PROG_C_C99
+    
+    XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls
+    AC_PROG_C_C99. This sets gcc with -std=gnu99.
+    If AC_PROG_CC macro is called afterwards, it resets CC to gcc.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 3eb0d49a8d673c79ba9714d027f1ee056cf4b0b9
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Oct 29 18:00:17 2010 -0700
+
+    libXxf86dga 1.1.2
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 967c47b8e431e1b4a25b3436ba4e130cc7eee5b5
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Oct 29 17:58:37 2010 -0700
+
+    Sun's copyrights now belong to Oracle
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit a9cad8418292ee2291004d2c9ada7547120b53fd
+Author: Jesse Adkins <jesserayadkins@gmail.com>
+Date:   Tue Sep 28 13:30:04 2010 -0700
+
+    Purge cvs tags.
+    
+    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit a8a764e1c41a8f261f768e9ac2ef24e23ba6eedd
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Aug 17 14:37:23 2010 -0400
+
+    man: store shadow man pages in git rather than generating them
+    
+    Simplify the build process and the makefile.
+    
+    Local fix in CVS for bug 5628 is not required
+    as the problem has been fixed in
+    util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 7395fb5197549ce048b9e759eb27cd7f4f284c66
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Jul 8 15:28:39 2010 -0700
+
+    Use make rules instead of shell for loops to generate shadow man pages
+    
+    Allows parallel make and simpler build logs/error reporting
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 30a8e2d18fe6dc9fac599e2570360ebb27207811
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Jul 8 15:26:35 2010 -0700
+
+    config: upgrade to util-macros 1.8 for additional man page support
+    
+    Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
+    The value of MAN_SUBST is the same for all X.Org packages.
+    
+    Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS
+    The existing statement can now be removed from the configuration file.
+    
+    Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED)
+    Enables silent rule and use platform appropriate version of sed.
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 86ece63cf0d038eb36e80cc4836eb387c407b773
+Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
+Date:   Thu Jul 1 07:08:11 2010 -0300
+
+    Purge macros NEED_EVENTS and NEED_REPLIES
+    
+    Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+    Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 5c9d042d4450d28c50258895885836253fbf5e61
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 16:50:34 2010 -0400
+
+    config: update AC_PREREQ statement to 2.60
+    
+    Unrelated to the previous patches, the new value simply reflects
+    the reality that the minimum level for autoconf to configure
+    all x.org modules is 2.60 dated June 2006.
+    
+    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit e8483875af8417918ce99fac61982167f96acf17
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:49 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 1ad4c147bbaf1523adba2e9f4b289c0fb4360097
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Feb 16 10:37:21 2010 -0500
+
+    config: move CWARNFLAGS from configure.ac to Makefile.am
+    
+    Compiler warning flags should be explicitly set in the makefile
+    rather than being merged with other packages compiler flags.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 253089a20d1496ef4102d06d603f1755e5e6e746
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Jan 14 10:37:36 2010 -0500
+
+    COPYING: fix copyright notice format
+    
+    Newlines and spaces.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 639c859ee3b74088a50bc0402f99261bd5c0f3e9
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 14 20:56:48 2010 -0800
+
+    Update Sun license notices to current X.Org standard form
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit cc8610353912c7002da001365cb9a27e1e02091a
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Nov 27 20:56:04 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit 6631f7b26574e665dfec6003ecc8d0bf77151ab4
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Oct 28 14:09:10 2009 -0400
+
+    INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+    
+    Add missing INSTALL file. Use standard GNU file on building tarball
+    README may have been updated
+    Remove AUTHORS file as it is empty and no content available yet.
+    Remove NEWS file as it is empty and no content available yet.
+
+commit 7c8e098dece92f8ac824c8e2eb3e737cacee57e7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:26 2009 -0400
+
+    Deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 8255d46aafed7f7527360b7b1dbf2333ad41444a
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Oct 26 22:08:43 2009 -0400
+
+    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+    
+    ChangeLog filename is known to Automake and requires no further
+    coding in the makefile.
+
+commit efd0fb6f31ee88887e16e98dca89473ff2bb56a1
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Oct 22 12:34:19 2009 -0400
+
+    .gitignore: use common defaults with custom section # 24239
+    
+    Using common defaults will reduce errors and maintenance.
+    Only the very small or inexistent custom section need periodic maintenance
+    when the structure of the component changes. Do not edit defaults.
+
+commit 990b19154368d9a1733636367d6a99d863d558ee
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Oct 6 16:14:45 2009 +1000
+
+    libXxf86dga 1.1.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 3cfcfc6246fb213bb0edf529b4f2b40907e5161c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Oct 6 15:38:27 2009 +1000
+
+    Include Xxf86dga.h, not xf86dga.
+    
+    f78f3ed3571ab0bd75753a7ab388120a383d894a removed xf86dga.h and instead
+    provided Xxf86dga.h. Let's use it!
+    
+    Also, remove two superfluous includes, including it once per file is enough.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 0bd51760a0d92181faedbd52e7d7249c8179f95d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Oct 6 15:34:22 2009 +1000
+
+    Actually use XORG_DEFAULT_OPTIONS
+    
+    For some reason, this part didn't make it into
+    8eab9123467b047f2b4ddec7df48a679c9254ca1.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 5bf5c3c78963cec3cd22e445c62cc7cfd2a37df2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Oct 1 22:34:39 2009 +1000
+
+    libXxf86dga 1.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8eab9123467b047f2b4ddec7df48a679c9254ca1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Oct 1 22:33:10 2009 +1000
+
+    Require macros 1.3 for XORG_DEFAULT_OPTIONS
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9be294d7455ce5799b09bc6bb06c18bea80287be
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Sep 21 10:16:25 2009 +1000
+
+    Bump to 1.0.99.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f78f3ed3571ab0bd75753a7ab388120a383d894a
+Author: Carl Worth <cworth@cworth.org>
+Date:   Wed Sep 16 17:08:17 2009 -0700
+
+    Rename xf86dga.h to Xxf86dga.h
+    
+    The xf86dgaproto package (as of 2.0.99.2) now provides an include file
+    named xf86dga.h for compatibility. We now depend on that version.
+
+commit fd90936abab52caf163c83d114a22980adcc3ee0
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Aug 27 10:56:55 2009 +1000
+
+    Bump to 1.0.99.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e28cffbe48279a622b19cab1c83ab0a97e60ccef
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Aug 26 16:41:04 2009 +1000
+
+    Move Xlib headers from xf86dgaproto to here.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 66abdd3e52ef3071c7d89313cc95935a4ee7ba52
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:37 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 11ff34f811737514ded5231b73407d63a1baf68d
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Mon Feb 2 14:22:44 2009 -0200
+
+    Janitor: make distcheck and .gitignore.
+
+commit d5bcd25affa9df2d937f57fac914de4b6f740ae6
+Author: Matthieu Herrb <matthieu.herrb@laas.fr>
+Date:   Sun Mar 9 08:47:58 2008 +0100
+
+    nuke RCS Ids
+
+commit 7acb8e34e19ca4ac3347cd42c31adf877397f23b
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Thu Dec 6 16:38:43 2007 -0500
+
+    Replace static ChangeLog with dist-hook to generate from git log
+
+commit 5968e0f1e992db63b003f2389657cd527a806efd
+Author: Eric Anholt <eric@anholt.net>
+Date:   Wed Sep 5 10:17:57 2007 -0700
+
+    Bump to 1.0.2 and require updated xf86dgaproto for the prototype update.
+
+commit 625a9c61265cdd1de3da425843a1a8de80d67c78
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Mon Sep 3 05:53:50 2007 -0400
+
+    Add *~ to .gitignore to skip patch/emacs droppings
+
+commit b3d86af10895f30ffb2999c28c5864b2be8681f6
+Author: Wang Zhenyu <zhenyu.z.wang@intel.com>
+Date:   Wed Apr 18 09:35:56 2007 +0800
+
+    Fix sign extension bug on x86_64 system.
+    
+    In XF86DGAGetVideoLL(), we pass offset param as 'int' type, but
+    later we cast it to 'unsigned long' in calling MapPhysAddress().
+    This causes page table error on x86_64 system like below:
+    
+    dga: Corrupted page table at address 2b9712b1b000
+    PGD 702a4067 PUD 6f830067 PMD 6f864067 PTE ffffffff80040027
+    Bad pagetable: 000f [1] SMP
+    CPU 0
+    Modules linked in: i915 drm dm_mirror dm_mod video button battery asus_acpi ac parport_pc parport nvram uhci_hcd ehci_hcd snd_hda_intel snd_hda_codec snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss pcspkr snd_pcm i2c_i801 i2c_core e1000 snd_timer snd soundcore snd_page_alloc
+    Pid: 2509, comm: dga Not tainted 2.6.21-rc6 #2
+    RIP: 0033:[<0000003d119754a0>]  [<0000003d119754a0>]
+    RSP: 002b:00007fff98f0d4c8  EFLAGS: 00010202
+    RAX: 0000000000008000 RBX: 0000000000000001 RCX: 00002b9712b1b000
+    RDX: 0000000000200000 RSI: 0000000000000071 RDI: 00002b9712b1b000
+    RBP: 0000000000000000 R08: 7171717171717171 R09: 0000000000000000
+    R10: 0000000000000000 R11: 0000003d119753e0 R12: 0000000000000000
+    R13: 00007fff98f0d730 R14: 0000000000503010 R15: 0000000000000000
+    FS:  00002b9712b19f60(0000) GS:ffffffff8060d000(0000) knlGS:0000000000000000
+    CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
+    CR2: 00002b9712b1b000 CR3: 000000006ffdb000 CR4: 00000000000006e0
+    Process dga (pid: 2509, threadinfo ffff8100718de000, task ffff81006ffd67a0)
+    
+    RIP  [<0000003d119754a0>]
+     RSP <00007fff98f0d4c8>
+    
+    This patch requires latest xf86dgaproto to build.
+
+commit 316e02ab0bd590851c80e3028150f2a6a5a36708
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:59:12 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit b5be6bc7a5b5527f86dfd224e89a7c1561845131
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Apr 27 00:25:08 2006 +0000
+
+    Bump to 1.0.1
+
+commit 9ec9ba4c4539b27d819553fa4be73745b4fdfbf7
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun Feb 12 18:19:23 2006 +0000
+
+    Bug #5628 <https://bugs.freedesktop.org/show_bug.cgi?id=5628> Shadow pages
+        not created correctly when MANDIR & MANSUFFIX don't match.
+
+commit 5ab70ae500ec62fc89c7fa783f60db87d8b934a7
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:35 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit a31ecfdc3fde5b217f06cf3351bb12b37f5f7882
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Dec 6 22:48:45 2005 +0000
+
+    Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
+
+commit a3121e6147f16eb72c9df262c7735191c98626bd
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:45 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit 47a9625fe9e29c4ead2b7209c0d064aeff415eaf
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 04:41:51 2005 +0000
+
+    Add check and cflags for malloc(0) returning NULL.
+
+commit dbd43adfb46efddc1380895e192d96982470cb4d
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Nov 28 22:03:06 2005 +0000
+
+    Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4
+        update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir)
+
+commit 81f335d928ea693c6dff24c2a170010959b1cc1d
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:43 2005 +0000
+
+    Update pkgconfig files to separate library build-time dependencies from
+        application build-time dependencies, and update package deps to work
+        with separate build roots.
+
+commit a346dd66fdfe04d2cb41bd2f7869f1c6b90e5941
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Nov 9 21:19:13 2005 +0000
+
+    Update package version number for X11R7 RC2 release.
+
+commit 70330a9bf76526353725e50233faafa14efcde16
+Author: Kean Johnson <kean@armory.com>
+Date:   Tue Nov 8 06:33:25 2005 +0000
+
+    See ChangeLog entry 2005-11-07 for details.
+
+commit 01d7b50a520e92449afaabaed5d331db9c49084e
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:12 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit b0171fe11db042bccc7eaf2c0a88c3640eba6974
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Oct 18 00:00:09 2005 +0000
+
+    Use @LIB_MAN_SUFFIX@ instead of $(LIB_MAN_SUFFIX) in macro substitutions to
+        work better with BSD make
+
+commit 32bf677cabd0641aa6bdcfbf58ec782133cc97ff
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Oct 17 21:13:22 2005 +0000
+
+    Rename .shadows.DONE to shadows.DONE to avoid some make's thinking it's a
+        suffix rule (reported by Matthieu Herrb)
+
+commit 04020960fd2baa35a0e3546a536fe196f9e0d13d
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Thu Oct 13 04:25:46 2005 +0000
+
+    Add generated man pages to .cvsignores
+
+commit 03c9007c310c8ca72d4c01a64f20c92bc581d688
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Wed Oct 12 01:18:25 2005 +0000
+
+    Use sed to put version number in man page Add shadow man pages for man
+        pages that document multiple functions.
+
+commit 4ce6461553712f7e966e874607225e57cd35e7eb
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:53 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit b56facdddd0b07195082ca94f6745b890151ad7b
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 21:05:22 2005 +0000
+
+    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
+
+commit 2343f1171cb1a36e47622395965d072a0ce78db7
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Fri Jul 1 16:16:15 2005 +0000
+
+    spell freedesktop.org correctly
+
+commit 139215564ee6e63101858b9481f3413361a6d4a7
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Fri Jun 10 22:38:47 2005 +0000
+
+    Apply patch from Jeff Smith (whydoubt@yahoo.com):
+    - Add file linking for Xxf86misc, Xxf86dga, and Xxf86vm.
+    - Check in build system for Xxf86misc, Xxf86dga, and Xxf86vm.
+
+commit 177b9f5cb3c9108d9547731721efb8cd6064b753
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu May 6 17:31:17 2004 +0000
+
+    BugZilla #601: Fixing makedepend choking on floating point exception
+        because CHAR_BIT is defined to __CHAR_BIT__ which is a compiler
+        intrinsic define. BugZilla #605: Fixing build on IA64 which is broken
+        due to the inclusion of the kernel header asm/page.h. Kernel headers
+        however don't work with
+    -ansi. The inclusion of asm/page.h can however savely be removed as it
+        there are plenty of other ways to determine the page size.
+
+commit a18b2a60c586926bf51e40aae0adf65c0b232184
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:55 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit 5ac2ec8cdbfc35957cca371e11c7dad06d410f73
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:27 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit 1abdebb927820b966ea5c4af7437666fef02ba77
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:33 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit 2fdd9aa86fb54d85563b7a9cb5b232b3a47705c0
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:34 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit a102c89670006328f7ef0190385d72a5b1d52e5c
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:48 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 7c35b3f77af60ea304442f55ca5c665c0862da0a
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Thu Dec 4 22:02:57 2003 +0000
+
+    XFree86 4.3.99.901 (RC 1)
+
+commit dad8187051796d5dd318a4c324336344f80debab
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Thu Dec 4 22:02:57 2003 +0000
+
+    Initial revision
+
+commit 55019a1748a69f278dcc728e0db7ee79d426e695
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:16 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 2b92812979340a133c14336d4a87ea95a942b676
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit ca572cb2f331b374c246b4435f5aeb036392e16f
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    Initial revision
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..8b82ade
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,291 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008 Free Software Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *Note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..420a225
--- /dev/null
@@ -0,0 +1,16 @@
+SUBDIRS = src man
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xxf86dga.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..c11f6d6
--- /dev/null
+++ b/README
@@ -0,0 +1,25 @@
+libXxf86dga - Client library for the XFree86-DGA extension.
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/lib/libXxf86dga
+
+        http://cgit.freedesktop.org/xorg/lib/libXxf86dga
+
+For patch submission instructions, see:
+
+       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..54585c9
--- /dev/null
@@ -0,0 +1,30 @@
+
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([libXxf86dga], [1.1.3],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXxf86dga])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS(src/config.h)
+
+# Initialize Automake
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Initialize libtool
+AC_PROG_LIBTOOL
+
+# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.8)
+XORG_DEFAULT_OPTIONS
+XORG_CHECK_MALLOC_ZERO
+
+# Obtain compiler/linker options for depedencies
+PKG_CHECK_MODULES(XXF86DGA, xproto x11 xextproto xext [xf86dgaproto >= 2.0.99.2])
+
+AC_CONFIG_FILES([Makefile
+               src/Makefile
+               man/Makefile
+               xxf86dga.pc])
+AC_OUTPUT
diff --git a/include/X11/extensions/Xxf86dga.h b/include/X11/extensions/Xxf86dga.h
new file mode 100644 (file)
index 0000000..d78a032
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+   Copyright (c) 1999  XFree86 Inc
+*/
+
+#ifndef _XF86DGA_H_
+#define _XF86DGA_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/xf86dgaconst.h>
+#include <X11/extensions/xf86dga1.h>
+
+_XFUNCPROTOBEGIN
+
+typedef struct {
+   int type;
+   unsigned long serial;
+   Display *display;
+   int screen;
+   Time time;
+   unsigned int state;
+   unsigned int button;
+} XDGAButtonEvent;
+
+typedef struct {
+   int type;
+   unsigned long serial;
+   Display *display;
+   int screen;
+   Time time;
+   unsigned int state;
+   unsigned int keycode;
+} XDGAKeyEvent;
+
+typedef struct {
+   int type;
+   unsigned long serial;
+   Display *display;
+   int screen;
+   Time time;
+   unsigned int state;
+   int dx;
+   int dy;
+} XDGAMotionEvent;
+
+typedef union {
+  int type;
+  XDGAButtonEvent xbutton;
+  XDGAKeyEvent   xkey;
+  XDGAMotionEvent xmotion;
+  long           pad[24];
+} XDGAEvent;
+
+Bool XDGAQueryExtension(
+    Display    *dpy,
+    int        *eventBase,
+    int        *erroBase
+);
+
+Bool XDGAQueryVersion(
+    Display    *dpy,
+    int        *majorVersion,
+    int        *minorVersion
+);
+
+XDGAMode* XDGAQueryModes(
+    Display    *dpy,
+    int        screen,
+    int                *num
+);
+
+XDGADevice* XDGASetMode(
+    Display    *dpy,
+    int                screen,
+    int                mode
+);
+
+Bool XDGAOpenFramebuffer(
+    Display    *dpy,
+    int        screen
+);
+
+void XDGACloseFramebuffer(
+    Display    *dpy,
+    int                screen
+);
+
+void XDGASetViewport(
+    Display    *dpy,
+    int                screen,
+    int                x,
+    int                y,
+    int                flags
+);
+
+void XDGAInstallColormap(
+    Display    *dpy,
+    int                screen,
+    Colormap   cmap
+);
+
+Colormap XDGACreateColormap(
+    Display    *dpy,
+    int        screen,
+    XDGADevice  *device,
+    int        alloc
+);
+
+void XDGASelectInput(
+    Display    *dpy,
+    int                screen,
+    long       event_mask
+);
+
+void XDGAFillRectangle(
+    Display    *dpy,
+    int                screen,
+    int                x,
+    int                y,
+    unsigned int       width,
+    unsigned int       height,
+    unsigned long      color
+);
+
+
+void XDGACopyArea(
+    Display    *dpy,
+    int                screen,
+    int                srcx,
+    int                srcy,
+    unsigned int       width,
+    unsigned int       height,
+    int                dstx,
+    int                dsty
+);
+
+
+void XDGACopyTransparentArea(
+    Display    *dpy,
+    int                screen,
+    int                srcx,
+    int                srcy,
+    unsigned int       width,
+    unsigned int       height,
+    int                dstx,
+    int                dsty,
+    unsigned long key
+);
+
+int XDGAGetViewportStatus(
+    Display    *dpy,
+    int                screen
+);
+
+void XDGASync(
+    Display    *dpy,
+    int                screen
+);
+
+Bool XDGASetClientVersion(
+    Display    *dpy
+);
+
+void XDGAChangePixmapMode(
+    Display    *dpy,
+    int                screen,
+    int                *x,
+    int                *y,
+    int                mode
+);
+
+
+void XDGAKeyEventToXKeyEvent(XDGAKeyEvent* dk, XKeyEvent* xk);
+
+
+_XFUNCPROTOEND
+#endif /* _XF86DGA_H_ */
diff --git a/include/X11/extensions/xf86dga1.h b/include/X11/extensions/xf86dga1.h
new file mode 100644 (file)
index 0000000..8110438
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995  XFree86 Inc
+
+*/
+
+/************************************************************************
+
+   THIS IS THE OLD DGA API AND IS OBSOLETE.  PLEASE DO NOT USE IT ANYMORE
+
+************************************************************************/
+
+#ifndef _XF86DGA1_H_
+#define _XF86DGA1_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/xf86dga1const.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XF86DGAQueryVersion(
+    Display*           /* dpy */,
+    int*               /* majorVersion */,
+    int*               /* minorVersion */
+);
+
+Bool XF86DGAQueryExtension(
+    Display*           /* dpy */,
+    int*               /* event_base */,
+    int*               /* error_base */
+);
+
+Status XF86DGAGetVideoLL(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    unsigned int *             /* base addr */,
+    int *                      /* width */,
+    int *                      /* bank_size */,
+    int *                      /* ram_size */
+);
+
+Status XF86DGAGetVideo(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    char **                    /* base addr */,
+    int *                      /* width */,
+    int *                      /* bank_size */,
+    int *                      /* ram_size */
+);
+
+Status XF86DGADirectVideo(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    int                        /* enable */
+);
+
+Status XF86DGADirectVideoLL(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    int                        /* enable */
+);
+
+Status XF86DGAGetViewPortSize(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    int *                      /* width */,
+    int *                      /* height */
+);
+
+Status XF86DGASetViewPort(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    int x                      /* X */,
+    int y                      /* Y */
+);
+
+Status XF86DGAGetVidPage(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    int *                      /* vid page */
+);
+
+Status XF86DGASetVidPage(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    int                                /* vid page */
+);
+
+Status XF86DGAInstallColormap(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    Colormap                   /*Colormap */
+);
+
+int XF86DGAForkApp(
+    int screen
+);
+
+Status XF86DGAQueryDirectVideo(
+    Display *          /* dpy */,
+    int                        /* screen */,
+    int *              /* flags */
+);
+
+Bool XF86DGAViewPortChanged(
+    Display *          /* dpy */,
+    int                        /* screen */,
+    int                        /* n */
+);
+
+
+_XFUNCPROTOEND
+
+#endif /* _XF86DGA1_H_ */
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644 (file)
index 0000000..7b12599
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2005, Oracle and/or its affiliates. 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
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+libmandir = $(LIB_MAN_DIR)
+
+libman_PRE =                           \
+       XDGA.man                        \
+       $(XDGA_shadows:=.man)
+
+XDGA_functions =                       \
+       XDGAQueryExtension              \
+       XDGAQueryVersion                \
+       XDGAQueryModes                  \
+       XDGASetMode                     \
+       XDGAOpenFramebuffer             \
+       XDGACloseFramebuffer            \
+       XDGASetViewport                 \
+       XDGAInstallColormap             \
+       XDGACreateColormap              \
+       XDGASelectInput                 \
+       XDGAFillRectangle               \
+       XDGACopyArea                    \
+       XDGACopyTransparentArea         \
+       XDGAGetViewportStatus           \
+       XDGASync                        \
+       XDGASetClientVersion            \
+       XDGAChangePixmapMode            \
+       XDGAKeyEventToXKeyEvent
+
+XDGA_shadows = XF86DGA XFree86-DGA $(XDGA_functions)
+
+EXTRA_DIST = $(libman_PRE)
+CLEANFILES = $(libman_DATA)
+
+libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@)
+
+SUFFIXES = .$(LIB_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+.man.$(LIB_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/man/XDGA.man b/man/XDGA.man
new file mode 100644 (file)
index 0000000..4510bcd
--- /dev/null
@@ -0,0 +1,672 @@
+.\"
+.TH XDGA 3 __vendorversion__
+.SH NAME
+XDGA \- Client library for the XFree86-DGA extension.
+.SH SYNOPSIS
+.B #include <X11/extensions/xf86dga.h>
+.HP
+Bool
+.BR XDGAQueryExtension (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int *" eventBase ,
+.br
+.RI "int *" errorBase )
+.HP
+Bool
+.BR XDGAQueryVersion (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int *" majorVersion ,
+.br
+.RI "int *" minorVersion )
+.HP
+XDGAMode
+.RB * XDGAQueryModes (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int *" num )
+.HP
+XDGADevice
+.RB * XDGASetMode (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int " mode )
+.HP
+Bool
+.BR XDGAOpenFramebuffer (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen )
+.HP
+void
+.BR XDGACloseFramebuffer (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen )
+.HP
+void
+.BR XDGASetViewport (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int " x ,
+.br
+.RI "int " y ,
+.br
+.RI "int " flags )
+.HP
+void
+.BR XDGAInstallColormap (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "Colormap " cmap )
+.HP
+Colormap
+.BR XDGACreateColormap (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "XDGADevice *" device ,
+.br
+.RI "int " alloc )
+.HP
+void
+.BR XDGASelectInput (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "long " event_mask )
+.HP
+void
+.BR XDGAFillRectangle (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int " x ,
+.br
+.RI "int " y ,
+.br
+.RI "unsigned int " width ,
+.br
+.RI "unsigned int " height ,
+.br
+.RI "unsigned long " color )
+.HP
+void
+.BR XDGACopyArea (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int " srcx ,
+.br
+.RI "int " srcy ,
+.br
+.RI "unsigned int " width ,
+.br
+.RI "unsigned int " height ,
+.br
+.RI "int " dstx ,
+.br
+.RI "int " dsty )
+.HP
+void
+.BR XDGACopyTransparentArea (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int " srcx ,
+.br
+.RI "int " srcy ,
+.br
+.RI "unsigned int " width ,
+.br
+.RI "unsigned int " height ,
+.br
+.RI "int " dstx ,
+.br
+.RI "int " dsty ,
+.br
+.RI "unsigned long " key )
+.HP
+int
+.BR XDGAGetViewportStatus (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen )
+.HP
+void
+.BR XDGASync (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen )
+.HP
+Bool
+.BR XDGASetClientVersion (
+.br
+.RI "Display *" dpy )
+.HP
+void
+.BR XDGAChangePixmapMode (
+.br
+.RI "Display *" dpy ,
+.br
+.RI "int " screen ,
+.br
+.RI "int *" x ,
+.br
+.RI "int *" y ,
+.br
+.RI "int " mode )
+.HP
+void
+.BR XDGAKeyEventToXKeyEvent (
+.br
+.RI "XDGAKeyEvent *" dk ,
+.br
+.RI "XKeyEvent *" xk )
+
+.SH DESCRIPTION
+The
+.B XFree86-DGA
+extension is an X server extension for allowing client programs direct
+access to the video frame buffer.  This is a brief description of the
+programming interface for version 2.0 of the
+.B XFree86-DGA
+extension.
+.PP
+.B XFree86-DGA
+is not intended as a direct rendering API, but rather, as a mechanism
+to "get the X Server out of the way" so that some other direct rendering
+API can have full access to the hardware.  With this in mind, DGA does
+provide clients some direct access to the hardware without requiring a
+separate rendering API, but this access is limited to direct linear
+framebuffer access.
+.PP
+Most of the reasons for the
+.B XFree86-DGA
+extension's existence are now better served in other ways.  Further
+development of this extension is not expected, and it may be deprecated
+in a future release.  The features that continue to be useful will either
+be provided through other existing mechanisms, or through an extension
+that address those needs more specifically.
+.PP
+.B XFree86-DGA
+is initialized by passing a number corresponding to a valid
+.I XDGAMode
+to
+.BR XDGASetMode ().
+Clients can get a list of valid modes from
+.BR XDGAQueryModes ().
+Each
+.I XDGAMode
+corresponds to a different framebuffer layout.
+.PP
+.BR XDGAQueryModes ()
+returns a pointer to an array of
+.IR XDGAMode s
+which are valid for the given screen.
+.I num
+is the number of elements in the array.  The returned array can be freed
+with XFree(3).  The
+.I XDGAMode
+structure is as follows:
+.PP
+.nf
+.ta .5i 2i
+typedef struct {
+   int num;
+   char *name;
+   float verticalRefresh;
+   int flags;
+   int imageWidth;
+   int imageHeight;
+   int pixmapWidth;
+   int pixmapHeight;
+   int bytesPerScanline;
+   int byteOrder;
+   int depth;
+   int bitsPerPixel;
+   unsigned long redMask;
+   unsigned long greenMask;
+   unsigned long blueMask;
+   short visualClass;
+   int viewportWidth;
+   int viewportHeight;
+   int xViewportStep;
+   int yViewportStep;
+   int maxViewportX;
+   int maxViewportY;
+   int viewportFlags;
+   int reserved1;
+   int reserved2;
+.br
+} XDGAMode;
+.fi
+.TP 8
+.I num
+A unique identifying number
+.RI ( num
+> 0) for the mode.  This is the number referenced when initializing the mode.
+.TP 8
+.I name
+The name of the corresponding modeline as given in the __xconfigfile__ file.
+.TP 8
+.I verticalRefresh
+The vertical refresh rate for the modeline (in Hz).
+.TP 8
+.I flags
+Any of the following may be OR'd together:
+.RS 8
+.TP 4
+.B XDGAConcurrentAccess
+Indicates that concurrent client/server access to the framebuffer is
+possible.  If this flag is not set it is very important to call
+.BR XDGASync ()
+before directly accessing the framebuffer if a call to
+.BR XDGAFillRectangle (),
+.BR XDGACopyArea ()
+or
+.BR XDGACopyTransparentArea ()
+or any Xlib rendering function has been made prior to such accesses.
+.TP 4
+.B XDGASolidFillRect
+Indicates that
+.BR XDGAFillRectangle ()
+is supported.
+.TP 4
+.B XDGABlitRect
+Indicates that
+.BR XDGACopyArea ()
+is supported.
+.TP 4
+.B XDGABlitTransRect
+Indicates that
+.BR XDGACopyTransparentArea ()
+is supported.
+.TP 4
+.B XDGAPixmap
+Indicates that a Pixmap will be returned when the mode is initialized.
+This means that rendering with Xlib is possible for this mode.
+.TP 4
+.B XDGAInterlaced
+.TP 4
+.B XDGADoublescan
+Indicates that the mode is an interlaced or doublescan mode.
+.RE
+.TP 8
+.I imageWidth
+.TP 8
+.I imageHeight
+The width and height of the framebuffer area accessible by the client.
+This rectangle is always justified to the upper left-hand corner.
+.TP 8
+.I pixmapWidth
+.TP 8
+.I pixmapHeight
+The width and height of the framebuffer area accessible by Xlib.  This
+rectangle is always justified to the upper left-hand corner.  These
+fields are only valid if the
+.B XDGAPixmap
+flag is set in the
+.I flags
+field.
+.TP 8
+.I bytesPerScanline
+The pitch of the framebuffer in bytes.
+.TP 8
+.I byteOrder
+.B MSBFirst
+or
+.BR LSBFirst .
+.TP 8
+.I depth
+The number of bits in each pixel which contain usable data.
+.TP 8
+.I bitsPerPixel
+The number of bits taken up by each pixel.
+.TP 8
+.I redMask
+.TP 8
+.I greenMask
+.TP 8
+.I blueMask
+The RGB masks.  These do not apply to color-indexed modes.
+.TP 8
+.I visualClass
+.BR TrueColor ,
+.BR PseudoColor ,
+.BR DirectColor ,
+etc.
+.TP 8
+.I viewportWidth
+.TP 8
+.I viewportHeight
+The dimensions of the portion of the framebuffer which will be displayed
+on the screen.
+.TP 8
+.I xViewportStep
+.TP 8
+.I yViewportStep
+The granularity of the x,y viewport positioning possible with the
+.BR XDGASetViewport ()
+function.
+.TP 8
+.I maxViewportX
+.TP 8
+.I maxViewportY
+The maximum x and y positions possible with the
+.BR XDGASetViewport ()
+function.
+.TP 8
+.I viewportFlags
+Any of the following may be OR'd together
+.RS 8
+.TP 4
+.B XDGAFlipRetrace
+Indicates that the hardware can switch viewports during the vertical
+retrace.
+.TP 4
+.B XDGAFlipImmediate
+Indicates that the hardware can switch viewports immediately without
+waiting for the vertical retrace.
+.RE
+.PP
+.BR XDGASetMode ()
+initialises the
+.I XDGAMode
+corresponding to
+.IR num .
+To exit DGA mode and return to normal server operation, call
+.BR XDGASetMode ()
+with
+.I num
+set to zero.
+.BR XDGASetMode ()
+returns a pointer to an
+.I XDGADevice
+if successful.  The XDGADevice can be freed with XFree(3).  The
+.I XDGADevice
+structure is as follows:
+.PP
+.nf
+.ta .5i 2i
+typedef struct {
+   XDGAMode mode;
+   unsigned char *data;
+   Pixmap pixmap;
+.br
+} XDGADevice;
+.fi
+.TP 8
+.I mode
+The
+.I XDGAMode
+structure, identical to the information returned by
+.BR XDGAQueryModes ().
+.TP 8
+.I data
+If direct framebuffer access is desired and possible, this field will
+contain a pointer to the mapped framebuffer memory.  Generally, this
+field will be zero unless a call to
+.BR XDGAOpenFramebuffer ()
+is made prior to initialization of the mode.
+.TP 8
+.I pixmap
+If the mode supports Xlib rendering as indicated by
+.B XDGAPixmap
+in the
+.I flags
+field, this will contain a Pixmap handle suitable for passing as the
+drawable argument to Xlib functions.  This field will be zero if Xlib
+rendering is not supported.
+.PP
+.BR XDGAQueryExtension ()
+checks for the presence of the extension and returns the event and error bases.
+.PP
+.BR XDGAQueryVersion ()
+returns the
+.B XFree86-DGA
+major and minor version numbers.
+.PP
+.BR XDGAOpenFramebuffer ()
+maps the framebuffer memory.  The client needs sufficient privileges to be
+able to do this.
+.BR XDGAOpenFramebuffer ()
+should be called prior to initializing a DGA mode if direct framebuffer
+access is desired for that mode.
+.BR XDGAOpenFramebuffer ()
+does not need to be called if direct framebuffer access is not required.
+If the framebuffer is opened,
+.PP
+.BR XDGACloseFramebuffer ()
+should be called prior to client exit to unmap the memory.
+.PP
+.BR XDGAChangePixmapMode ()
+can be used to change between two pixmap sizes in cases where a Pixmap is
+available for Xlib rendering.  The following values for the
+.I mode
+parameter are available:
+.RS 8
+.TP 4
+.B XDGAPixmapModeLarge
+The pixmap size is defined by the
+.I pixmapWidth
+and
+.I  pixmapHeight
+fields in the
+.I XDGAMode
+structure.  The
+.I x
+and
+.I y
+values are ignored in this case.
+.TP 4
+.B XDGAPixmapModeSmall
+The pixmap size is defined by the
+.I viewportWidth
+and
+.I viewportHeight
+fields in the
+.I XDGAMode
+structure.  In this mode, the
+.I x
+and
+.I y
+values specify where in the framebuffer this pixmap rectangle is located.
+It may be placed anywhere within the Xlib renderable region described
+by the
+.I pixmapWidth
+and
+.I pixmapHeight
+fields in the
+.IR XDGAMode .
+The
+.I x
+and
+.I y
+values returned are the resultant location of the pixmap and may be
+different from the requested x,y location due to platform specific
+alignment constraints.  All Xlib rendering is clipped to this pixmap
+rectangle.
+.RE
+.PP
+.BR XDGASetViewport ()
+sets the upper left-hand corner of the rectangle of framebuffer that is
+to be displayed on the screen.  Not all locations may be supported by
+the hardware and requested locations will be adjusted according to the
+.I xViewportStep
+and
+.I yViewportStep
+fields in the
+.IR XDGAMode .
+.PP
+.I flags
+can be
+.B XDGAFlipRetrace
+or
+.B XDGAFlipImmediate
+to adjust the viewport location at the next vertical retrace or
+immediately.  Values other than the supported values advertised in the
+mode's
+.I viewportFlags
+field will result in hardware-specific default behavior.
+.B XDGAFlipImmediate
+will block until the flip is completed.
+.B XDGAFlipRetrace
+will generally NOT block so it is necessary to monitor the viewport
+status with
+.BR XDGAGetViewportStatus ().
+.B XDGAFlipImmediate
+requests during pending
+.B XDGAFlipRetrace
+requests will be ignored.
+.PP
+.BR XDGAGetViewportStatus ()
+keeps track of the
+.BR XDGASetViewport ()
+requests still pending.  The return value of the function will have
+consecutive bits set (LSB justified), each bit representing a pending
+viewport change.  For example:
+.PP
+.nf
+     while(XDGAGetViewportStatus(dpy, screen));
+.fi
+.PP
+waits for all pending viewport changes to finish.
+.PP
+.nf
+     while(0x2 & XDGAGetViewportStatus(dpy, screen));
+.fi
+.PP
+waits until all but the last viewport changes have completed.
+.PP
+.BR XDGACreateColormap ()
+is similar to the Xlib function XCreateColormap(3) except that it takes
+an
+.I XDGADevice
+as an argument instead of a Window and Visual.  Though XCreateColormap(3)
+may create usable colormaps in some cases,
+.BR XDGACreateColormap ()
+is the preferred method for creating colormaps in DGA since there may
+not be an advertised visual compatible with the DGA device.
+.PP
+.BR XDGAInstallColormap ()
+must be used to install colormaps in DGA mode.  XInstallColormap(3) will
+not work.
+.PP
+.BR XDGASelectInput ()
+enables DGA's own event mechanism.  This function is similar to
+XSelectInput(3), and all Xlib Key, Button and Motion masks are supported.
+The following DGA events are defined:
+.PP
+.nf
+.ta .5i 2i
+typedef struct {
+   int type;             /\(** ButtonPress or ButtonRelease + the DGA event base*/
+   unsigned long serial; /\(** # or last request processed by the server */
+   Display *display;     /\(** Display the event was read from */
+   int screen;           /\(** The screen number the event came from */
+   Time time;            /\(** milliseconds */
+   unsigned int state;   /\(** key or button mask */
+   unsigned int button;  /\(** detail */
+.br
+} XDGAButtonEvent;
+.fi
+.PP
+.nf
+.ta .5i 2i
+typedef struct {
+   int type;             /\(** KeyPress or KeyRelease + the DGA event base*/
+   unsigned long serial; /\(** # or last request processed by the server */
+   Display *display;     /\(** Display the event was read from */
+   int screen;           /\(** The screen number the event came from */
+   Time time;            /\(** milliseconds */
+   unsigned int state;   /\(** key or button mask */
+   unsigned int keycode; /\(** detail */
+.br
+} XDGAKeyEvent;
+.fi
+.PP
+.nf
+.ta .5i 2i
+typedef struct {
+   int type;             /\(** MotionNotify + the DGA event base*/
+   unsigned long serial; /\(** # or last request processed by the server */
+   Display *display;     /\(** Display the event was read from */
+   int screen;           /\(** The screen number the event came from */
+   Time time;            /\(** milliseconds */
+   unsigned int state;   /\(** key or button mask */
+   int dx;               /\(** relative pointer motion */
+   int dy;               /\(** relative pointer motion */
+.br
+} XDGAMotionEvent;
+.fi
+.PP
+.BR XDGAKeyEventToXKeyEvent ()
+is a helper function to translate
+.IR XDGAKeyEvent s
+into
+.IR XKeyEvent s
+suitable for use with XLookupKeysym(3).
+.PP
+.BR XDGAFillRectangle (),
+.BR XDGACopyArea (),
+and
+.BR XDGACopyTransparentArea ()
+are included with some reservation since DGA is not intended as a
+rendering API.  These are merely convenience routines and are optionally
+supported.  The associated flags will be set in the
+.IR XDGAMode 's
+.I flags
+field if these functions are supported.  These functions will be no-ops
+otherwise. they do not provide direct access to the hardware, but are
+simply context-less operations performed by the server.
+.PP
+.BR XDGASync ()
+blocks until all server rendering to the framebuffer completes.  If Xlib
+or the 3 rendering functions above are used,
+.BR XDGASync ()
+must be called before the client directly accesses the framebuffer as
+the server rendering is asynchronous with the client and may have not
+completed.  This is especially important if the
+.B XDGAConcurrentAccess
+flag is not set in the
+.IR XDGAMode 's
+.I flags
+field since concurrent access by the server and client may result in a
+system lockup.
+.SH SEE ALSO
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__)
+.SH AUTHORS
+.B XFree86-DGA
+version 2 was written by Mark Vojkovich.  Version 1 was written by Jon
+Tombs, Harm Hanemaayer, Mark Vojkovich.
+
diff --git a/man/XDGAChangePixmapMode.man b/man/XDGAChangePixmapMode.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGACloseFramebuffer.man b/man/XDGACloseFramebuffer.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGACopyArea.man b/man/XDGACopyArea.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGACopyTransparentArea.man b/man/XDGACopyTransparentArea.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGACreateColormap.man b/man/XDGACreateColormap.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAFillRectangle.man b/man/XDGAFillRectangle.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAGetViewportStatus.man b/man/XDGAGetViewportStatus.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAInstallColormap.man b/man/XDGAInstallColormap.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAKeyEventToXKeyEvent.man b/man/XDGAKeyEventToXKeyEvent.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAOpenFramebuffer.man b/man/XDGAOpenFramebuffer.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAQueryExtension.man b/man/XDGAQueryExtension.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAQueryModes.man b/man/XDGAQueryModes.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGAQueryVersion.man b/man/XDGAQueryVersion.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGASelectInput.man b/man/XDGASelectInput.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGASetClientVersion.man b/man/XDGASetClientVersion.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGASetMode.man b/man/XDGASetMode.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGASetViewport.man b/man/XDGASetViewport.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XDGASync.man b/man/XDGASync.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XF86DGA.man b/man/XF86DGA.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/man/XFree86-DGA.man b/man/XFree86-DGA.man
new file mode 100644 (file)
index 0000000..7cab59e
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XDGA.__libmansuffix__
diff --git a/packaging/libXxf86dga.spec b/packaging/libXxf86dga.spec
new file mode 100644 (file)
index 0000000..0816454
--- /dev/null
@@ -0,0 +1,67 @@
+Summary: X.Org X11 libXxf86dga runtime library
+Name: libXxf86dga
+Version: 1.1.3
+Release: 1
+License: MIT
+Group: System Environment/Libraries
+URL: http://www.x.org
+
+Source0: %{name}-%{version}.tar.gz
+
+BuildRequires: pkgconfig
+BuildRequires:  pkgconfig(xorg-macros)
+BuildRequires:  pkgconfig(xf86dgaproto)
+BuildRequires: libX11-devel
+BuildRequires: libXext-devel
+
+%description
+X.Org X11 libXxf86dga runtime library
+
+%package devel
+Summary: X.Org X11 libXxf86dga development package
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Provides: libxxf86dga-devel
+
+%description devel
+X.Org X11 libXxf86dga development package
+
+%prep
+%setup -q
+
+%build
+%reconfigure --disable-static \
+              LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p %{buildroot}/usr/share/license
+cp -af COPYING %{buildroot}/usr/share/license/%{name}
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
+
+# We intentionally don't ship *.la files
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+
+%remove_docs
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+/usr/share/license/%{name}
+%doc COPYING ChangeLog README
+%{_libdir}/libXxf86dga.so.1
+%{_libdir}/libXxf86dga.so.1.0.0
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/libXxf86dga.so
+%{_libdir}/pkgconfig/xxf86dga.pc
+#%{_mandir}/man3/*.3*
+%{_includedir}/X11/extensions/xf86dga1.h
+%{_includedir}/X11/extensions/Xxf86dga.h
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..fbde550
--- /dev/null
@@ -0,0 +1,15 @@
+lib_LTLIBRARIES = libXxf86dga.la
+
+libXxf86dga_la_SOURCES = XF86DGA.c XF86DGA2.c
+
+AM_CFLAGS = -I $(top_srcdir)/include \
+            $(XXF86DGA_CFLAGS) \
+            $(MALLOC_ZERO_CFLAGS) \
+            $(CWARNFLAGS)
+
+libXxf86dga_la_LIBADD = $(XXF86DGA_LIBS)
+libXxf86dga_la_LDFLAGS = -version-number 1:0:0
+
+libXxf86dgaincludedir = $(includedir)/X11/extensions
+libXxf86dgainclude_HEADERS = $(top_srcdir)/include/X11/extensions/Xxf86dga.h \
+                             $(top_srcdir)/include/X11/extensions/xf86dga1.h
diff --git a/src/XF86DGA.c b/src/XF86DGA.c
new file mode 100644 (file)
index 0000000..4544507
--- /dev/null
@@ -0,0 +1,718 @@
+/* $XFree86: xc/lib/Xxf86dga/XF86DGA.c,v 3.23tsi Exp $ */
+/*
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995,1996  The XFree86 Project, Inc
+
+*/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifdef __UNIXOS2__ /* needed here to override certain constants in X headers */
+#define INCL_DOS
+#define INCL_DOSIOCTL
+#define I_NEED_OS2_H
+#include <os2.h>
+#endif
+
+#if defined(linux)
+#define HAS_MMAP_ANON
+#include <sys/types.h>
+#include <sys/mman.h>
+/* kernel header doesn't work with -ansi */
+/* #include <asm/page.h> */   /* PAGE_SIZE */
+#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
+#define HAS_GETPAGESIZE
+#endif /* linux */
+
+#if defined(CSRG_BASED)
+#define HAS_MMAP_ANON
+#define HAS_GETPAGESIZE
+#include <sys/types.h>
+#include <sys/mman.h>
+#endif /* CSRG_BASED */
+
+#if defined(DGUX)
+#define HAS_GETPAGESIZE
+#define MMAP_DEV_ZERO
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#endif /* DGUX */
+
+#if defined(SVR4) && !defined(DGUX)
+#define MMAP_DEV_ZERO
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#endif /* SVR4 && !DGUX */
+
+#if defined(sun) && !defined(SVR4) /* SunOS */
+#define MMAP_DEV_ZERO   /* doesn't SunOS have MAP_ANON ?? */
+#define HAS_GETPAGESIZE
+#include <sys/types.h>
+#include <sys/mman.h>
+#endif /* sun && !SVR4 */
+
+#ifdef XNO_SYSCONF
+#undef _SC_PAGESIZE
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xxf86dga.h>
+#include <X11/extensions/xf86dgaproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+extern XExtDisplayInfo* xdga_find_display(Display*);
+extern const char *xdga_extension_name;
+
+#define XF86DGACheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xdga_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public XFree86-DGA Extension routines                    *
+ *                                                                           *
+ *****************************************************************************/
+
+Bool XF86DGAQueryExtension (
+    Display *dpy,
+    int *event_basep,
+    int *error_basep
+){
+    return XDGAQueryExtension(dpy, event_basep, error_basep);
+}
+
+Bool XF86DGAQueryVersion(
+    Display* dpy,
+    int* majorVersion,
+    int* minorVersion
+){
+    return XDGAQueryVersion(dpy, majorVersion, minorVersion);
+}
+
+Bool XF86DGAGetVideoLL(
+    Display* dpy,
+    int screen,
+    unsigned int *offset,
+    int *width,
+    int *bank_size,
+    int *ram_size
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGAGetVideoLLReply rep;
+    xXF86DGAGetVideoLLReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGAGetVideoLL, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGAGetVideoLL;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    *offset = rep.offset;
+    *width = rep.width;
+    *bank_size = rep.bank_size;
+    *ram_size = rep.ram_size;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+
+Bool XF86DGADirectVideoLL(
+    Display* dpy,
+    int screen,
+    int enable
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGADirectVideoReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGADirectVideo, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGADirectVideo;
+    req->screen = screen;
+    req->enable = enable;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    XSync(dpy,False);
+    return True;
+}
+
+Bool XF86DGAGetViewPortSize(
+    Display* dpy,
+    int screen,
+    int *width,
+    int *height
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGAGetViewPortSizeReply rep;
+    xXF86DGAGetViewPortSizeReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGAGetViewPortSize, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGAGetViewPortSize;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    *width = rep.width;
+    *height = rep.height;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+
+Bool XF86DGASetViewPort(
+    Display* dpy,
+    int screen,
+    int x,
+    int y
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGASetViewPortReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGASetViewPort, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGASetViewPort;
+    req->screen = screen;
+    req->x = x;
+    req->y = y;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    XSync(dpy,False);
+    return True;
+}
+
+
+Bool XF86DGAGetVidPage(
+    Display* dpy,
+    int screen,
+    int *vpage
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGAGetVidPageReply rep;
+    xXF86DGAGetVidPageReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGAGetVidPage, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGAGetVidPage;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    *vpage = rep.vpage;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+
+Bool XF86DGASetVidPage(
+    Display* dpy,
+    int screen,
+    int vpage
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGASetVidPageReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGASetVidPage, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGASetVidPage;
+    req->screen = screen;
+    req->vpage = vpage;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    XSync(dpy,False);
+    return True;
+}
+
+Bool XF86DGAInstallColormap(
+    Display* dpy,
+    int screen,
+    Colormap cmap
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGAInstallColormapReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGAInstallColormap, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGAInstallColormap;
+    req->screen = screen;
+    req->id = cmap;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    XSync(dpy,False);
+    return True;
+}
+
+Bool XF86DGAQueryDirectVideo(
+    Display *dpy,
+    int screen,
+    int *flags
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGAQueryDirectVideoReply rep;
+    xXF86DGAQueryDirectVideoReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGAQueryDirectVideo, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGAQueryDirectVideo;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *flags = rep.flags;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool XF86DGAViewPortChanged(
+    Display *dpy,
+    int screen,
+    int n
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXF86DGAViewPortChangedReply rep;
+    xXF86DGAViewPortChangedReq *req;
+
+    XF86DGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DGAViewPortChanged, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XF86DGAViewPortChanged;
+    req->screen = screen;
+    req->n = n;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rep.result;
+}
+
+
+
+/* Helper functions */
+
+#include <X11/Xmd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#if defined(ISC)
+# define HAS_SVR3_MMAP
+# include <sys/types.h>
+# include <errno.h>
+
+# include <sys/at_ansi.h>
+# include <sys/kd.h>
+
+# include <sys/sysmacros.h>
+# include <sys/immu.h>
+# include <sys/region.h>
+
+# include <sys/mmap.h>
+#else
+# if defined(Lynx) && defined(NO_MMAP)
+#  include <sys/types.h>
+#  include <errno.h>
+#  include <smem.h>
+# else
+#  if !defined(__UNIXOS2__)
+#   include <sys/mman.h>
+#  endif
+# endif
+#endif
+#include <sys/wait.h>
+#include <signal.h>
+#include <unistd.h>
+
+#if defined(SVR4) && !defined(sun)
+#define DEV_MEM "/dev/pmem"
+#elif defined(SVR4) && defined(sun)
+#define DEV_MEM "/dev/xsvc"
+#elif defined(HAS_APERTURE_DRV)
+#define DEV_MEM "/dev/xf86"
+#else
+#define DEV_MEM "/dev/mem"
+#endif
+
+typedef struct {
+    unsigned long physaddr;    /* actual requested physical address */
+    unsigned long size;                /* actual requested map size */
+    unsigned long delta;       /* delta to account for page alignment */
+    void *       vaddr;        /* mapped address, without the delta */
+    int                  refcount;     /* reference count */
+} MapRec, *MapPtr;
+
+typedef struct {
+    Display *  display;
+    int                screen;
+    MapPtr     map;
+} ScrRec, *ScrPtr;
+
+static int mapFd = -1;
+static int numMaps = 0;
+static int numScrs = 0;
+static MapPtr *mapList = NULL;
+static ScrPtr *scrList = NULL;
+
+static MapPtr
+AddMap(void)
+{
+    MapPtr *old;
+
+    old = mapList;
+    mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1));
+    if (!mapList) {
+       mapList = old;
+       return NULL;
+    }
+    mapList[numMaps] = malloc(sizeof(MapRec));
+    if (!mapList[numMaps])
+       return NULL;
+    return mapList[numMaps++];
+}
+
+static ScrPtr
+AddScr(void)
+{
+    ScrPtr *old;
+
+    old = scrList;
+    scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1));
+    if (!scrList) {
+       scrList = old;
+       return NULL;
+    }
+    scrList[numScrs] = malloc(sizeof(ScrRec));
+    if (!scrList[numScrs])
+       return NULL;
+    return scrList[numScrs++];
+}
+
+static MapPtr
+FindMap(unsigned long address, unsigned long size)
+{
+    int i;
+
+    for (i = 0; i < numMaps; i++) {
+       if (mapList[i]->physaddr == address &&
+           mapList[i]->size == size)
+           return mapList[i];
+    }
+    return NULL;
+}
+
+static ScrPtr
+FindScr(Display *display, int screen)
+{
+    int i;
+
+    for (i = 0; i < numScrs; i++) {
+       if (scrList[i]->display == display &&
+           scrList[i]->screen == screen)
+           return scrList[i];
+    }
+    return NULL;
+}
+
+static void *
+MapPhysAddress(unsigned long address, unsigned long size)
+{
+    unsigned long offset, delta;
+    int pagesize = -1;
+    void *vaddr;
+    MapPtr mp;
+#if defined(ISC) && defined(HAS_SVR3_MMAP)
+    struct kd_memloc mloc;
+#elif defined(__UNIXOS2__)
+    APIRET rc;
+    ULONG action;
+    HFILE hfd;
+#endif
+
+    if ((mp = FindMap(address, size))) {
+       mp->refcount++;
+       return (void *)((unsigned long)mp->vaddr + mp->delta);
+    }
+
+#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
+    pagesize = sysconf(_SC_PAGESIZE);
+#endif
+#ifdef _SC_PAGE_SIZE
+    if (pagesize == -1)
+       pagesize = sysconf(_SC_PAGE_SIZE);
+#endif
+#ifdef HAS_GETPAGESIZE
+    if (pagesize == -1)
+       pagesize = getpagesize();
+#endif
+#ifdef PAGE_SIZE
+    if (pagesize == -1)
+       pagesize = PAGE_SIZE;
+#endif
+    if (pagesize == -1)
+       pagesize = 4096;
+
+   delta = address % pagesize;
+   offset = address - delta;
+
+#if defined(ISC) && defined(HAS_SVR3_MMAP)
+    if (mapFd < 0) {
+       if ((mapFd = open("/dev/mmap", O_RDWR)) < 0)
+           return NULL;
+    }
+    mloc.vaddr = (char *)0;
+    mloc.physaddr = (char *)offset;
+    mloc.length = size + delta;
+    mloc.ioflg=1;
+
+    if ((vaddr = (void *)ioctl(mapFd, MAP, &mloc)) == (void *)-1)
+       return NULL;
+#elif defined (__UNIXOS2__)
+    /*
+     * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
+     * Consecutive calling of this routine will make PMAP$ driver run out
+     * of memory handles. Some umap/close mechanism should be provided
+     */
+
+    rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
+                OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
+    if (rc != 0)
+       return NULL;
+    {
+       struct map_ioctl {
+               union {
+                       ULONG phys;
+                       void* user;
+               } a;
+               ULONG size;
+       } pmap,dmap;
+       ULONG plen,dlen;
+#define XFREE86_PMAP   0x76
+#define PMAP_MAP       0x44
+
+       pmap.a.phys = offset;
+       pmap.size = size + delta;
+       rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
+                        (PULONG)&pmap, sizeof(pmap), &plen,
+                        (PULONG)&dmap, sizeof(dmap), &dlen);
+       if (rc == 0) {
+               vaddr = dmap.a.user;
+       }
+   }
+   if (rc != 0)
+       return NULL;
+#elif defined(Lynx) && defined(NO_MMAP)
+    vaddr = (void *)smem_create("XF86DGA", (char *)offset,
+                               size + delta, SM_READ|SM_WRITE);
+#else
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+    if (mapFd < 0) {
+       if ((mapFd = open(DEV_MEM, O_RDWR)) < 0)
+           return NULL;
+    }
+    vaddr = (void *)mmap(NULL, size + delta, PROT_READ | PROT_WRITE,
+                        MAP_FILE | MAP_SHARED, mapFd, (off_t)offset);
+    if (vaddr == (void *)-1)
+       return NULL;
+#endif
+
+    if (!vaddr) {
+       if (!(mp = AddMap()))
+           return NULL;
+       mp->physaddr = address;
+       mp->size = size;
+       mp->delta = delta;
+       mp->vaddr = vaddr;
+       mp->refcount = 1;
+    }
+    return (void *)((unsigned long)vaddr + delta);
+}
+
+/*
+ * Still need to find a clean way of detecting the death of a DGA app
+ * and returning things to normal - Jon
+ * This is here to help debugging without rebooting... Also C-A-BS
+ * should restore text mode.
+ */
+
+int
+XF86DGAForkApp(int screen)
+{
+    pid_t pid;
+    int status;
+    int i;
+
+     /* fork the app, parent hangs around to clean up */
+    if ((pid = fork()) > 0) {
+       ScrPtr sp;
+
+       waitpid(pid, &status, 0);
+       for (i = 0; i < numScrs; i++) {
+           sp = scrList[i];
+           XF86DGADirectVideoLL(sp->display, sp->screen, 0);
+           XSync(sp->display, False);
+       }
+        if (WIFEXITED(status))
+           _exit(0);
+       else
+           _exit(-1);
+    }
+    return pid;
+}
+
+
+Bool
+XF86DGADirectVideo(
+    Display *dis,
+    int screen,
+    int enable
+){
+    ScrPtr sp;
+    MapPtr mp = NULL;
+
+    if ((sp = FindScr(dis, screen)))
+       mp = sp->map;
+
+    if (enable & XF86DGADirectGraphics) {
+#if !defined(ISC) && !defined(HAS_SVR3_MMAP) \
+       && !(defined(Lynx) && defined(NO_MMAP)) \
+       && !defined(__UNIXOS2__)
+       if (mp && mp->vaddr)
+           mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
+#endif
+    } else {
+#if !defined(ISC) && !defined(HAS_SVR3_MMAP) \
+       && !(defined(Lynx) && defined(NO_MMAP)) \
+       && !defined(__UNIXOS2__)
+       if (mp && mp->vaddr)
+           mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
+#elif defined(Lynx) && defined(NO_MMAP)
+       /* XXX this doesn't allow enable after disable */
+       smem_create(NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH);
+       smem_remove("XF86DGA");
+#endif
+    }
+
+    XF86DGADirectVideoLL(dis, screen, enable);
+    return 1;
+}
+
+
+static void
+XF86cleanup(int sig)
+{
+    ScrPtr sp;
+    int i;
+    static char beenhere = 0;
+
+    if (beenhere)
+       _exit(3);
+    beenhere = 1;
+
+    for (i = 0; i < numScrs; i++) {
+       sp = scrList[i];
+       XF86DGADirectVideo(sp->display, sp->screen, 0);
+       XSync(sp->display, False);
+    }
+    _exit(3);
+}
+
+Bool
+XF86DGAGetVideo(
+    Display *dis,
+    int screen,
+    char **addr,
+    int *width,
+    int *bank,
+    int *ram
+){
+    unsigned int offset;
+    static int beenHere = 0;
+    ScrPtr sp;
+    MapPtr mp;
+
+    if (!(sp = FindScr(dis, screen))) {
+       if (!(sp = AddScr())) {
+           fprintf(stderr, "XF86DGAGetVideo: malloc failure\n");
+           exit(-2);
+       }
+       sp->display = dis;
+       sp->screen = screen;
+       sp->map = NULL;
+    }
+
+    XF86DGAGetVideoLL(dis, screen , &offset, width, bank, ram);
+
+    *addr = MapPhysAddress(offset, *bank);
+    if (*addr == NULL) {
+       fprintf(stderr, "XF86DGAGetVideo: failed to map video memory (%s)\n",
+               strerror(errno));
+       exit(-2);
+    }
+
+    if ((mp = FindMap(offset, *bank)))
+       sp->map = mp;
+
+    if (!beenHere) {
+       beenHere = 1;
+       atexit((void(*)(void))XF86cleanup);
+       /* one shot XF86cleanup attempts */
+       signal(SIGSEGV, XF86cleanup);
+#ifdef SIGBUS
+       signal(SIGBUS, XF86cleanup);
+#endif
+       signal(SIGHUP, XF86cleanup);
+       signal(SIGFPE, XF86cleanup);
+    }
+
+    return 1;
+}
+
diff --git a/src/XF86DGA2.c b/src/XF86DGA2.c
new file mode 100644 (file)
index 0000000..e81b486
--- /dev/null
@@ -0,0 +1,964 @@
+/*
+
+Copyright (c) 1995  Jon Tombs
+Copyright (c) 1995,1996  The XFree86 Project, Inc
+
+*/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifdef __UNIXOS2__ /* needed here to override certain constants in X headers */
+#define INCL_DOS
+#define INCL_DOSIOCTL
+#define I_NEED_OS2_H
+#include <os2.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xxf86dga.h>
+#include <X11/extensions/xf86dgaproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <stdio.h>
+
+
+/* If you change this, change the Bases[] array below as well */
+#define MAX_HEADS 16
+
+const char *xdga_extension_name = XF86DGANAME;
+
+static XExtensionInfo _xdga_info_data;
+static XExtensionInfo *xdga_info = &_xdga_info_data;
+
+
+Bool XDGAMapFramebuffer(int, char *, unsigned char*, CARD32, CARD32, CARD32);
+void XDGAUnmapFramebuffer(int);
+unsigned char* XDGAGetMappedMemory(int);
+
+#define XDGACheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xdga_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int xdga_close_display(Display *dpy, XExtCodes *codes);
+static Bool xdga_wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev);
+static Status xdga_event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev);
+
+static XExtensionHooks xdga_extension_hooks = {
+    NULL,                              /* create_gc */
+    NULL,                              /* copy_gc */
+    NULL,                              /* flush_gc */
+    NULL,                              /* free_gc */
+    NULL,                              /* create_font */
+    NULL,                              /* free_font */
+    xdga_close_display,                        /* close_display */
+    xdga_wire_to_event,                        /* wire_to_event */
+    xdga_event_to_wire,                        /* event_to_wire */
+    NULL,                              /* error */
+    NULL,                              /* error_string */
+};
+
+static XEXT_GENERATE_CLOSE_DISPLAY (xdga_close_display, xdga_info)
+
+
+XExtDisplayInfo* xdga_find_display(Display*);
+XEXT_GENERATE_FIND_DISPLAY (xdga_find_display, xdga_info,
+                                  "XFree86-DGA",
+                                  &xdga_extension_hooks,
+                                  0, NULL)
+
+
+static Status
+xdga_event_to_wire(
+  Display *dpy,
+  XEvent *event,
+  xEvent *wire_ev
+){
+    return True;
+}
+
+static Bool
+xdga_wire_to_event(
+  Display *dpy,
+  XEvent *event,
+  xEvent *wire_ev
+){
+  dgaEvent *wire = (dgaEvent *) wire_ev;
+  XDGAButtonEvent *bevent;
+  XDGAKeyEvent *kevent;
+  XDGAMotionEvent *mevent;
+  XExtDisplayInfo *info = xdga_find_display (dpy);
+
+  XDGACheckExtension (dpy, info, False);
+
+  switch((wire->u.u.type & 0x7f) - info->codes->first_event) {
+  case MotionNotify:
+       mevent = (XDGAMotionEvent*)event;
+       mevent->type = wire->u.u.type & 0x7F;
+       mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
+       mevent->display = dpy;
+       mevent->screen = wire->u.event.screen;
+       mevent->time = wire->u.event.time;
+       mevent->state = wire->u.event.state;
+       mevent->dx = wire->u.event.dx;
+       mevent->dy = wire->u.event.dy;
+       return True;
+  case ButtonPress:
+  case ButtonRelease:
+       bevent = (XDGAButtonEvent*)event;
+       bevent->type = wire->u.u.type & 0x7F;
+       bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
+       bevent->display = dpy;
+       bevent->screen = wire->u.event.screen;
+       bevent->time = wire->u.event.time;
+       bevent->state = wire->u.event.state;
+       bevent->button = wire->u.u.detail;
+       return True;
+  case KeyPress:
+  case KeyRelease:
+       kevent = (XDGAKeyEvent*)event;
+       kevent->type = wire->u.u.type & 0x7F;
+       kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
+       kevent->display = dpy;
+       kevent->screen = wire->u.event.screen;
+       kevent->time = wire->u.event.time;
+       kevent->state = wire->u.event.state;
+       kevent->keycode = wire->u.u.detail;
+       return True;
+  }
+
+  return False;
+}
+
+
+Bool XDGAQueryExtension (
+    Display *dpy,
+    int *event_basep,
+    int *error_basep
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       *event_basep = info->codes->first_event;
+       *error_basep = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+
+Bool XDGAQueryVersion(
+    Display *dpy,
+    int *majorVersion,
+    int *minorVersion
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGAQueryVersionReply rep;
+    xXDGAQueryVersionReq *req;
+
+    XDGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XDGAQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGAQueryVersion;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *majorVersion = rep.majorVersion;
+    *minorVersion = rep.minorVersion;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    if (*majorVersion >= 2)
+    {
+       int i, j;
+
+       for (i = 0, j = info->codes->first_event;
+            i < XF86DGANumberEvents;
+            i++, j++)
+       {
+           XESetWireToEvent (dpy, j, xdga_wire_to_event);
+           XESetEventToWire (dpy, j, xdga_event_to_wire);
+       }
+       XDGASetClientVersion(dpy);
+    }
+    return True;
+}
+
+Bool XDGASetClientVersion(
+    Display    *dpy
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGASetClientVersionReq *req;
+
+    XDGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XDGASetClientVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGASetClientVersion;
+    req->major = XDGA_MAJOR_VERSION;
+    req->minor = XDGA_MINOR_VERSION;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool XDGAOpenFramebuffer(
+    Display    *dpy,
+    int        screen
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGAOpenFramebufferReply rep;
+    xXDGAOpenFramebufferReq *req;
+    char *deviceName = NULL;
+    Bool ret;
+
+    XDGACheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XDGAOpenFramebuffer, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGAOpenFramebuffer;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    if(rep.length) {
+       deviceName = Xmalloc(rep.length << 2);
+       _XRead(dpy, deviceName, rep.length << 2);
+    }
+
+    ret = XDGAMapFramebuffer(screen, deviceName,
+                               (unsigned char*)(long)rep.mem1,
+                               rep.size, rep.offset, rep.extra);
+
+    if(deviceName)
+       Xfree(deviceName);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return ret;
+}
+
+void XDGACloseFramebuffer(
+    Display    *dpy,
+    int                screen
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGACloseFramebufferReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    XDGAUnmapFramebuffer(screen);
+
+    LockDisplay(dpy);
+    GetReq(XDGACloseFramebuffer, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGACloseFramebuffer;
+    req->screen = screen;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+
+
+XDGAMode* XDGAQueryModes(
+    Display *dpy,
+    int screen,
+    int *num
+){
+    XExtDisplayInfo *dinfo = xdga_find_display (dpy);
+    xXDGAQueryModesReply rep;
+    xXDGAQueryModesReq *req;
+    XDGAMode *modes = NULL;
+
+    *num = 0;
+
+    XDGACheckExtension (dpy, dinfo, NULL);
+
+    LockDisplay(dpy);
+    GetReq(XDGAQueryModes, req);
+    req->reqType = dinfo->codes->major_opcode;
+    req->dgaReqType = X_XDGAQueryModes;
+    req->screen = screen;
+
+    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       if(rep.length) {
+          xXDGAModeInfo info;
+          int i, size;
+          char *offset;
+
+          size = rep.length << 2;
+          size -= rep.number * sz_xXDGAModeInfo; /* find text size */
+          modes = (XDGAMode*)Xmalloc((rep.number * sizeof(XDGAMode)) + size);
+          offset = (char*)(&modes[rep.number]); /* start of text */
+
+
+          if(modes) {
+             for(i = 0; i < rep.number; i++) {
+               _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
+
+               modes[i].num = info.num;
+               modes[i].verticalRefresh =
+                       (float)info.vsync_num / (float)info.vsync_den;
+               modes[i].flags = info.flags;
+               modes[i].imageWidth = info.image_width;
+               modes[i].imageHeight = info.image_height;
+               modes[i].pixmapWidth = info.pixmap_width;
+               modes[i].pixmapHeight = info.pixmap_height;
+               modes[i].bytesPerScanline = info.bytes_per_scanline;
+               modes[i].byteOrder = info.byte_order;
+               modes[i].depth = info.depth;
+               modes[i].bitsPerPixel = info.bpp;
+               modes[i].redMask = info.red_mask;
+               modes[i].greenMask = info.green_mask;
+               modes[i].blueMask = info.blue_mask;
+               modes[i].visualClass = info.visual_class;
+               modes[i].viewportWidth = info.viewport_width;
+               modes[i].viewportHeight = info.viewport_height;
+               modes[i].xViewportStep = info.viewport_xstep;
+               modes[i].yViewportStep = info.viewport_ystep;
+               modes[i].maxViewportX = info.viewport_xmax;
+               modes[i].maxViewportY = info.viewport_ymax;
+               modes[i].viewportFlags = info.viewport_flags;
+               modes[i].reserved1 = info.reserved1;
+               modes[i].reserved2 = info.reserved2;
+
+               _XRead(dpy, offset, info.name_size);
+               modes[i].name = offset;
+               offset += info.name_size;
+             }
+             *num = rep.number;
+          } else
+               _XEatData(dpy, rep.length << 2);
+       }
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return modes;
+}
+
+
+XDGADevice *
+XDGASetMode(
+    Display    *dpy,
+    int                screen,
+    int                mode
+){
+    XExtDisplayInfo *dinfo = xdga_find_display (dpy);
+    xXDGASetModeReply rep;
+    xXDGASetModeReq *req;
+    XDGADevice *dev = NULL;
+    Pixmap pid;
+
+    XDGACheckExtension (dpy, dinfo, NULL);
+
+    LockDisplay(dpy);
+    GetReq(XDGASetMode, req);
+    req->reqType = dinfo->codes->major_opcode;
+    req->dgaReqType = X_XDGASetMode;
+    req->screen = screen;
+    req->mode = mode;
+    req->pid = pid = XAllocID(dpy);
+
+    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       if(rep.length) {
+          xXDGAModeInfo info;
+          int size;
+
+          size = rep.length << 2;
+          size -= sz_xXDGAModeInfo; /* get text size */
+
+          dev = (XDGADevice*)Xmalloc(sizeof(XDGADevice) + size);
+
+          if(dev) {
+               _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
+
+               dev->mode.num = info.num;
+               dev->mode.verticalRefresh =
+                               (float)info.vsync_num / (float)info.vsync_den;
+               dev->mode.flags = info.flags;
+               dev->mode.imageWidth = info.image_width;
+               dev->mode.imageHeight = info.image_height;
+               dev->mode.pixmapWidth = info.pixmap_width;
+               dev->mode.pixmapHeight = info.pixmap_height;
+               dev->mode.bytesPerScanline = info.bytes_per_scanline;
+               dev->mode.byteOrder = info.byte_order;
+               dev->mode.depth = info.depth;
+               dev->mode.bitsPerPixel = info.bpp;
+               dev->mode.redMask = info.red_mask;
+               dev->mode.greenMask = info.green_mask;
+               dev->mode.blueMask = info.blue_mask;
+               dev->mode.visualClass = info.visual_class;
+               dev->mode.viewportWidth = info.viewport_width;
+               dev->mode.viewportHeight = info.viewport_height;
+               dev->mode.xViewportStep = info.viewport_xstep;
+               dev->mode.yViewportStep = info.viewport_ystep;
+               dev->mode.maxViewportX = info.viewport_xmax;
+               dev->mode.maxViewportY = info.viewport_ymax;
+               dev->mode.viewportFlags = info.viewport_flags;
+               dev->mode.reserved1 = info.reserved1;
+               dev->mode.reserved2 = info.reserved2;
+
+               dev->mode.name = (char*)(&dev[1]);
+               _XRead(dpy, dev->mode.name, info.name_size);
+
+               dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
+               dev->data = XDGAGetMappedMemory(screen);
+
+               if(dev->data)
+                   dev->data += rep.offset;
+          }
+          /* not sure what to do if the allocation fails */
+       }
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return dev;
+}
+
+
+void XDGASetViewport(
+    Display    *dpy,
+    int                screen,
+    int                x,
+    int                y,
+    int                flags
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGASetViewportReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGASetViewport, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGASetViewport;
+    req->screen = screen;
+    req->x = x;
+    req->y = y;
+    req->flags = flags;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+
+void XDGAInstallColormap(
+    Display    *dpy,
+    int                screen,
+    Colormap   cmap
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGAInstallColormapReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGAInstallColormap, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGAInstallColormap;
+    req->screen = screen;
+    req->cmap = cmap;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void XDGASelectInput(
+    Display    *dpy,
+    int                screen,
+    long       mask
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGASelectInputReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGASelectInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGASelectInput;
+    req->screen = screen;
+    req->mask = mask;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void XDGAFillRectangle(
+    Display    *dpy,
+    int                screen,
+    int                x,
+    int                y,
+    unsigned int       width,
+    unsigned int       height,
+    unsigned long      color
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGAFillRectangleReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGAFillRectangle, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGAFillRectangle;
+    req->screen = screen;
+    req->x = x;
+    req->y = y;
+    req->width = width;
+    req->height = height;
+    req->color = color;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void XDGACopyArea(
+    Display    *dpy,
+    int                screen,
+    int                srcx,
+    int                srcy,
+    unsigned int       width,
+    unsigned int       height,
+    int                dstx,
+    int                dsty
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGACopyAreaReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGACopyArea, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGACopyArea;
+    req->screen = screen;
+    req->srcx = srcx;
+    req->srcy = srcy;
+    req->width = width;
+    req->height = height;
+    req->dstx = dstx;
+    req->dsty = dsty;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void XDGACopyTransparentArea(
+    Display    *dpy,
+    int                screen,
+    int                srcx,
+    int                srcy,
+    unsigned int       width,
+    unsigned int       height,
+    int                dstx,
+    int                dsty,
+    unsigned long key
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGACopyTransparentAreaReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGACopyTransparentArea, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGACopyTransparentArea;
+    req->screen = screen;
+    req->srcx = srcx;
+    req->srcy = srcy;
+    req->width = width;
+    req->height = height;
+    req->dstx = dstx;
+    req->dsty = dsty;
+    req->key = key;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+
+int XDGAGetViewportStatus(
+    Display *dpy,
+    int screen
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGAGetViewportStatusReply rep;
+    xXDGAGetViewportStatusReq *req;
+    int status = 0;
+
+    XDGACheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XDGAGetViewportStatus, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGAGetViewportStatus;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
+       status = rep.status;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return status;
+}
+
+void XDGASync(
+    Display *dpy,
+    int screen
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGASyncReply rep;
+    xXDGASyncReq *req;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGASync, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGASync;
+    req->screen = screen;
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+
+void XDGAChangePixmapMode(
+    Display *dpy,
+    int screen,
+    int *x,
+    int *y,
+    int mode
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGAChangePixmapModeReq *req;
+    xXDGAChangePixmapModeReply rep;
+
+    XextSimpleCheckExtension (dpy, info, xdga_extension_name);
+
+    LockDisplay(dpy);
+    GetReq(XDGAChangePixmapMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGAChangePixmapMode;
+    req->screen = screen;
+    req->x = *x;
+    req->y = *y;
+    req->flags = mode;
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
+    *x = rep.x;
+    *y = rep.y;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+Colormap XDGACreateColormap(
+    Display *dpy,
+    int screen,
+    XDGADevice *dev,
+    int        alloc
+){
+    XExtDisplayInfo *info = xdga_find_display (dpy);
+    xXDGACreateColormapReq *req;
+    Colormap cid;
+
+    XDGACheckExtension (dpy, info, -1);
+
+    LockDisplay(dpy);
+    GetReq(XDGACreateColormap, req);
+    req->reqType = info->codes->major_opcode;
+    req->dgaReqType = X_XDGACreateColormap;
+    req->screen = screen;
+    req->mode = dev->mode.num;
+    req->alloc = alloc;
+    cid = req->id = XAllocID(dpy);
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return cid;
+}
+
+
+void XDGAKeyEventToXKeyEvent(
+    XDGAKeyEvent* dk,
+    XKeyEvent* xk
+){
+    xk->type = dk->type;
+    xk->serial = dk->serial;
+    xk->send_event = False;
+    xk->display = dk->display;
+    xk->window = RootWindow(dk->display, dk->screen);
+    xk->root = xk->window;
+    xk->subwindow = None;
+    xk->time = dk->time;
+    xk->x = xk->y = xk->x_root = xk->y_root = 0;
+    xk->state = dk->state;
+    xk->keycode = dk->keycode;
+    xk->same_screen = True;
+}
+
+#include <X11/Xmd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#if defined(ISC)
+# define HAS_SVR3_MMAP
+# include <sys/types.h>
+# include <errno.h>
+
+# include <sys/at_ansi.h>
+# include <sys/kd.h>
+
+# include <sys/sysmacros.h>
+# include <sys/immu.h>
+# include <sys/region.h>
+
+# include <sys/mmap.h>
+#else
+# if defined(Lynx) && defined(NO_MMAP)
+#  include <sys/types.h>
+#  include <errno.h>
+#  include <smem.h>
+# else
+#  if !defined(__UNIXOS2__)
+#   include <sys/mman.h>
+#  endif
+# endif
+#endif
+#include <sys/wait.h>
+#include <signal.h>
+#include <unistd.h>
+
+#if defined(SVR4) && !defined(sun)
+#define DEV_MEM "/dev/pmem"
+#elif defined(SVR4) && defined(sun)
+#define DEV_MEM "/dev/xsvc"
+#elif defined(HAS_APERTURE_DRV)
+#define DEV_MEM "/dev/xf86"
+#else
+#define DEV_MEM "/dev/mem"
+#endif
+
+
+
+typedef struct _DGAMapRec{
+  unsigned char *physical;
+  unsigned char *virtual;
+  CARD32 size;
+  int fd;
+  int screen;
+  struct _DGAMapRec *next;
+} DGAMapRec, *DGAMapPtr;
+
+static Bool
+DGAMapPhysical(int, const char*, unsigned char*, CARD32, CARD32, CARD32, DGAMapPtr);
+static void DGAUnmapPhysical(DGAMapPtr);
+
+static DGAMapPtr _Maps = NULL;
+
+
+unsigned char*
+XDGAGetMappedMemory(int screen)
+{
+    DGAMapPtr pMap = _Maps;
+    unsigned char *pntr = NULL;
+
+    while(pMap != NULL) {
+       if(pMap->screen == screen) {
+           pntr = pMap->virtual;
+           break;
+       }
+       pMap = pMap->next;
+    }
+
+    return pntr;
+}
+
+Bool
+XDGAMapFramebuffer(
+   int screen,
+   char *name,                 /* optional device name */
+   unsigned char* base,                /* physical memory */
+   CARD32 size,                        /* size */
+   CARD32 offset,              /* optional offset */
+   CARD32 extra                        /* optional extra data */
+){
+   DGAMapPtr pMap = _Maps;
+   Bool result;
+
+   /* is it already mapped ? */
+   while(pMap != NULL) {
+     if(pMap->screen == screen)
+       return True;
+     pMap = pMap->next;
+   }
+
+   if(extra & XDGANeedRoot) {
+    /* we should probably check if we have root permissions and
+       return False here */
+
+   }
+
+   pMap = (DGAMapPtr)Xmalloc(sizeof(DGAMapRec));
+
+   result = DGAMapPhysical(screen, name, base, size, offset, extra, pMap);
+
+   if(result) {
+      pMap->next = _Maps;
+      _Maps = pMap;
+   } else
+      Xfree(pMap);
+
+   return result;
+}
+
+void
+XDGAUnmapFramebuffer(int screen)
+{
+   DGAMapPtr pMap = _Maps;
+   DGAMapPtr pPrev = NULL;
+
+   /* is it already mapped */
+    while(pMap != NULL) {
+       if(pMap->screen == screen)
+           break;
+       pPrev = pMap;
+       pMap = pMap->next;
+    }
+
+    if(!pMap)
+       return;
+
+    DGAUnmapPhysical(pMap);
+
+    if(!pPrev)
+       _Maps = pMap->next;
+    else
+       pPrev->next = pMap->next;
+
+    Xfree(pMap);
+}
+
+
+static Bool
+DGAMapPhysical(
+   int screen,
+   const char *name,           /* optional device name */
+   unsigned char* base,                /* physical memory */
+   CARD32 size,                        /* size */
+   CARD32 offset,              /* optional offset */
+   CARD32 extra,               /* optional extra data */
+   DGAMapPtr pMap
+) {
+#if defined(ISC) && defined(HAS_SVR3_MMAP)
+    struct kd_memloc mloc;
+#elif defined(__UNIXOS2__)
+    APIRET rc;
+    ULONG action;
+    HFILE hfd;
+#endif
+
+    base += offset;
+
+    pMap->screen = screen;
+    pMap->physical = base;
+    pMap->size = size;
+
+#if defined(ISC) && defined(HAS_SVR3_MMAP)
+    if ((pMap->fd = open("/dev/mmap", O_RDWR)) < 0)
+       return False;
+    mloc.vaddr = (char *)0;
+    mloc.physaddr = (char *)base;
+    mloc.length = size;
+    mloc.ioflg=1;
+
+    if ((pMap->virtual = (void *)ioctl(pMap->fd, MAP, &mloc)) == (void *)-1)
+       return False;
+#elif defined (__UNIXOS2__)
+    /*
+     * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
+     * Consecutive calling of this routine will make PMAP$ driver run out
+     * of memory handles. Some umap/close mechanism should be provided
+     */
+
+    rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
+                OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
+    if (rc != 0)
+       return False;
+    {
+       struct map_ioctl {
+               union {
+                       ULONG phys;
+                       void* user;
+               } a;
+               ULONG size;
+       } pmap,dmap;
+       ULONG plen,dlen;
+#define XFREE86_PMAP   0x76
+#define PMAP_MAP       0x44
+
+       pmap.a.phys = base;
+       pmap.size = size;
+       rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
+                        (PULONG)&pmap, sizeof(pmap), &plen,
+                        (PULONG)&dmap, sizeof(dmap), &dlen);
+       if (rc == 0) {
+               pMap->virtual = dmap.a.user;
+       }
+   }
+   if (rc != 0)
+       return False;
+#elif defined (Lynx) && defined(NO_MMAP)
+    pMap->virtual = smem_create("XF86DGA", (char*)base, size, SM_READ|SM_WRITE);
+#else
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+    if (!name)
+           name = DEV_MEM;
+    if ((pMap->fd = open(name, O_RDWR)) < 0)
+       return False;
+    pMap->virtual = mmap(NULL, size, PROT_READ | PROT_WRITE,
+                       MAP_FILE | MAP_SHARED, pMap->fd, (off_t)base);
+    if (pMap->virtual == (void *)-1)
+       return False;
+    mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE);
+#endif
+
+    return True;
+}
+
+
+
+static void
+DGAUnmapPhysical(DGAMapPtr pMap)
+{
+#if defined(ISC) && defined(HAS_SVR3_MMAP)
+    /* XXX Add unmapping code here. */
+#elif defined (__UNIXOS2__)
+    /* XXX Add unmapping code here. */
+#elif defined(Lynx) && defined(NO_MMAP)
+       /* XXX this doesn't allow enable after disable */
+    smem_create(NULL, pMap->virtual, pMap->size, SM_DETACH);
+    smem_remove("XF86DGA");
+#else
+    if (pMap->virtual && pMap->virtual != (void *)-1) {
+       mprotect(pMap->virtual,pMap->size, PROT_READ);
+       munmap(pMap->virtual, pMap->size);
+       pMap->virtual = 0;
+    }
+    if (pMap->fd >= 0) {
+       close(pMap->fd);
+       pMap->fd = -1;
+    }
+#endif
+}
diff --git a/xxf86dga.pc.in b/xxf86dga.pc.in
new file mode 100644 (file)
index 0000000..30d2912
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xxf86dga
+Description: XFree86 Direct Graphics Access Extension Library
+Version: @VERSION@
+Requires: xf86dgaproto
+Requires.private: x11 xext
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXxf86dga