summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-07-09 20:04:15 +0100
committerKeith Packard <keithp@keithp.com>2012-07-10 00:41:57 -0700
commite191e296e6e7861978ea4a0ae9aa7b780e52732b (patch)
tree5cd1bcc6b102f1e0c87d04650e8e49d4fd48497f
parent66362441867f68dac97de33744bd0ca478fb65d3 (diff)
Remove XAA
Commit 0c6987df in June 2008 disabled XAA offscreen pixmaps per default, as they were broken, leaving XAA only able to accelerate operations directly on the screen pixmap and nowhere else, eliminating acceleration for basically every modern toolkit, and any composited environment. So, it hasn't worked for over four years. No-one's even come close to fixing it. RIP. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
-rw-r--r--configure.ac4
-rw-r--r--hw/xfree86/Makefile.am6
-rw-r--r--hw/xfree86/common/Makefile.am6
-rw-r--r--hw/xfree86/common/xaarop.h (renamed from hw/xfree86/xaa/xaarop.h)0
-rw-r--r--hw/xfree86/doc/README.modes9
-rw-r--r--hw/xfree86/doc/ddxDesign.xml50
-rw-r--r--hw/xfree86/doc/exa-driver.txt9
-rw-r--r--hw/xfree86/ramdac/.gitignore2
-rw-r--r--hw/xfree86/ramdac/Makefile.am11
-rw-r--r--hw/xfree86/ramdac/xf86CursorPriv.h2
-rw-r--r--hw/xfree86/ramdac/xf86HWCurs.c9
-rwxr-xr-xhw/xfree86/sdksyms.sh8
-rw-r--r--hw/xfree86/xaa/.gitignore4
-rw-r--r--hw/xfree86/xaa/Makefile.am79
-rw-r--r--hw/xfree86/xaa/XAA.HOWTO1427
-rw-r--r--hw/xfree86/xaa/xaa.h1038
-rw-r--r--hw/xfree86/xaa/xaaBitBlt.c229
-rw-r--r--hw/xfree86/xaa/xaaBitOrder.c16
-rw-r--r--hw/xfree86/xaa/xaaBitmap.c477
-rw-r--r--hw/xfree86/xaa/xaaCpyArea.c409
-rw-r--r--hw/xfree86/xaa/xaaCpyPlane.c204
-rw-r--r--hw/xfree86/xaa/xaaCpyWin.c78
-rw-r--r--hw/xfree86/xaa/xaaDashLine.c353
-rw-r--r--hw/xfree86/xaa/xaaFallback.c281
-rw-r--r--hw/xfree86/xaa/xaaFillArc.c202
-rw-r--r--hw/xfree86/xaa/xaaFillPoly.c991
-rw-r--r--hw/xfree86/xaa/xaaFillRect.c1101
-rw-r--r--hw/xfree86/xaa/xaaGC.c564
-rw-r--r--hw/xfree86/xaa/xaaGCmisc.c412
-rw-r--r--hw/xfree86/xaa/xaaImage.c534
-rw-r--r--hw/xfree86/xaa/xaaInit.c635
-rw-r--r--hw/xfree86/xaa/xaaInitAccel.c1571
-rw-r--r--hw/xfree86/xaa/xaaLine.c422
-rw-r--r--hw/xfree86/xaa/xaaLineMisc.c149
-rw-r--r--hw/xfree86/xaa/xaaNonTEGlyph.c192
-rw-r--r--hw/xfree86/xaa/xaaNonTEText.c591
-rw-r--r--hw/xfree86/xaa/xaaOffscreen.c163
-rw-r--r--hw/xfree86/xaa/xaaOverlay.c122
-rw-r--r--hw/xfree86/xaa/xaaOverlayDF.c906
-rw-r--r--hw/xfree86/xaa/xaaPCache.c2527
-rw-r--r--hw/xfree86/xaa/xaaPict.c654
-rw-r--r--hw/xfree86/xaa/xaaROP.c182
-rw-r--r--hw/xfree86/xaa/xaaRect.c121
-rw-r--r--hw/xfree86/xaa/xaaSpans.c876
-rw-r--r--hw/xfree86/xaa/xaaStateChange.c1665
-rw-r--r--hw/xfree86/xaa/xaaStipple.c915
-rw-r--r--hw/xfree86/xaa/xaaTEGlyph.c1083
-rw-r--r--hw/xfree86/xaa/xaaTEText.c295
-rw-r--r--hw/xfree86/xaa/xaaTables.c152
-rw-r--r--hw/xfree86/xaa/xaaWideLine.c924
-rw-r--r--hw/xfree86/xaa/xaacexp.h126
-rw-r--r--hw/xfree86/xaa/xaalocal.h1437
-rw-r--r--hw/xfree86/xaa/xaawrap.h75
53 files changed, 28 insertions, 24270 deletions
diff --git a/configure.ac b/configure.ac
index 209b237b9..1d915f1fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -620,7 +620,6 @@ AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BU
620AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto]) 620AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
621AC_ARG_ENABLE(config-wscons, AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto]) 621AC_ARG_ENABLE(config-wscons, AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto])
622AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes]) 622AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
623AC_ARG_ENABLE(xaa, AS_HELP_STRING([--enable-xaa], [Build XAA (default: enabled)]), [XAA=$enableval], [XAA=yes])
624AC_ARG_ENABLE(vgahw, AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes]) 623AC_ARG_ENABLE(vgahw, AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
625AC_ARG_ENABLE(vbe, AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes]) 624AC_ARG_ENABLE(vbe, AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
626AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes]) 625AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
@@ -712,7 +711,6 @@ case $host_os in
712 PCI=no 711 PCI=no
713 VGAHW=no 712 VGAHW=no
714 VBE=no 713 VBE=no
715 XAA=no
716 XF86UTILS=no 714 XF86UTILS=no
717 XF86VIDMODE=no 715 XF86VIDMODE=no
718 XSELINUX=no 716 XSELINUX=no
@@ -1209,7 +1207,6 @@ XI_LIB='$(top_builddir)/Xi/libXi.la'
1209XI_INC='-I$(top_srcdir)/Xi' 1207XI_INC='-I$(top_srcdir)/Xi'
1210 1208
1211AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes) 1209AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
1212AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
1213AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes) 1210AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
1214AM_CONDITIONAL(VBE, test "x$VBE" = xyes) 1211AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
1215AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes) 1212AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
@@ -2267,7 +2264,6 @@ hw/xfree86/shadowfb/Makefile
2267hw/xfree86/vbe/Makefile 2264hw/xfree86/vbe/Makefile
2268hw/xfree86/vgahw/Makefile 2265hw/xfree86/vgahw/Makefile
2269hw/xfree86/x86emu/Makefile 2266hw/xfree86/x86emu/Makefile
2270hw/xfree86/xaa/Makefile
2271hw/xfree86/utils/Makefile 2267hw/xfree86/utils/Makefile
2272hw/xfree86/utils/man/Makefile 2268hw/xfree86/utils/man/Makefile
2273hw/xfree86/utils/cvt/Makefile 2269hw/xfree86/utils/cvt/Makefile
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index cd699eee9..c3899b577 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -13,8 +13,6 @@ if XF86UTILS
13XF86UTILS_SUBDIR = utils 13XF86UTILS_SUBDIR = utils
14endif 14endif
15 15
16XAA_SUBDIR = xaa
17
18if VGAHW 16if VGAHW
19VGAHW_SUBDIR = vgahw 17VGAHW_SUBDIR = vgahw
20endif 18endif
@@ -29,11 +27,11 @@ endif
29 27
30SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ 28SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
31 ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ 29 ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \
32 $(DRI2_SUBDIR) . $(VBE_SUBDIR) $(XAA_SUBDIR) i2c dixmods \ 30 $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \
33 fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man 31 fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man
34 32
35DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ 33DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
36 parser ramdac shadowfb vbe vgahw xaa \ 34 parser ramdac shadowfb vbe vgahw \
37 loader dixmods dri dri2 exa modes \ 35 loader dixmods dri dri2 exa modes \
38 utils doc man 36 utils doc man
39 37
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index 325875d52..f8fcde956 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -62,7 +62,8 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
62 xf86PciInfo.h xf86Priv.h xf86Privstr.h \ 62 xf86PciInfo.h xf86Priv.h xf86Privstr.h \
63 xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ 63 xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
64 $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \ 64 $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \
65 xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h xf86platformBus.h 65 xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h xf86platformBus.h \
66 xaarop.h
66 67
67DISTCLEANFILES = xf86Build.h 68DISTCLEANFILES = xf86Build.h
68CLEANFILES = $(BUILT_SOURCES) 69CLEANFILES = $(BUILT_SOURCES)
@@ -94,7 +95,8 @@ EXTRA_DIST = \
94 modeline2c.awk \ 95 modeline2c.awk \
95 xf86VGAarbiter.h \ 96 xf86VGAarbiter.h \
96 xf86VGAarbiterPriv.h \ 97 xf86VGAarbiterPriv.h \
97 $(DISTKBDSOURCES) 98 $(DISTKBDSOURCES) \
99 xaarop.h
98 100
99if LNXACPI 101if LNXACPI
100XORG_CFLAGS += -DHAVE_ACPI 102XORG_CFLAGS += -DHAVE_ACPI
diff --git a/hw/xfree86/xaa/xaarop.h b/hw/xfree86/common/xaarop.h
index f2acde075..f2acde075 100644
--- a/hw/xfree86/xaa/xaarop.h
+++ b/hw/xfree86/common/xaarop.h
diff --git a/hw/xfree86/doc/README.modes b/hw/xfree86/doc/README.modes
index 894e21313..ea228e592 100644
--- a/hw/xfree86/doc/README.modes
+++ b/hw/xfree86/doc/README.modes
@@ -133,11 +133,10 @@ this function computes an initial configuration for the server. It tries to
133enable as much hardware as possible using some fairly simple heuristics. 133enable as much hardware as possible using some fairly simple heuristics.
134 134
135The 'canGrow' parameter indicates that the frame buffer does not have a fixed 135The 'canGrow' parameter indicates that the frame buffer does not have a fixed
136size (fixed size frame buffers are required by XAA). When the frame buffer 136size. When the frame buffer has a fixed size, the configuration selects a
137has a fixed size, the configuration selects a 'reasonablely large' frame 137'reasonablely large' frame buffer so that common reconfiguration options are
138buffer so that common reconfiguration options are possible. For resizable 138possible. For resizable frame buffers, the frame buffer is set to the smallest
139frame buffers, the frame buffer is set to the smallest size that encloses 139size that encloses the desired configuration.
140the desired configuration.
141 140
1423.2 ScreenInit functions 1413.2 ScreenInit functions
143 142
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index ce81a9d5d..4c2ca47da 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -330,8 +330,8 @@ that. This is a significant difference compared with the old design.
330 330
331 <para> 331 <para>
332The entry points for drawing operations are already taken care of by 332The entry points for drawing operations are already taken care of by
333the framebuffer code (including, XAA). Extensions and enhancements to 333the framebuffer code. Extensions and enhancements to framebuffer code
334framebuffer code are outside the scope of this document. 334are outside the scope of this document.
335 </para> 335 </para>
336 336
337 <para> 337 <para>
@@ -2003,10 +2003,9 @@ also include the video card's saved state.
2003 </para> 2003 </para>
2004 2004
2005 <para> 2005 <para>
2006Per-screen data for other modules that the driver uses (for example, 2006Per-screen data for other modules that the driver uses that is reset for each
2007the XAA module) that is reset for each server generation is hooked into 2007server generation is hooked into the <structname>ScrnInfoRec</structname>
2008the <structname>ScrnInfoRec</structname> through it's <structfield>privates</structfield> 2008through its <structfield>privates</structfield> field.
2009field.
2010 </para> 2009 </para>
2011 2010
2012 <para> 2011 <para>
@@ -3615,14 +3614,6 @@ The following include files are typically required by video drivers:
3615 </para> 3614 </para>
3616 3615
3617 <para> 3616 <para>
3618 If a driver uses XAA, it needs these:
3619 <literallayout><filename>
3620 "xaa.h"
3621 "xaalocal.h"
3622 </filename></literallayout>
3623 </para>
3624
3625 <para>
3626 If a driver uses the fb manager, it needs this: 3617 If a driver uses the fb manager, it needs this:
3627 <literallayout><filename> 3618 <literallayout><filename>
3628 "xf86fbman.h" 3619 "xf86fbman.h"
@@ -3840,31 +3831,6 @@ manager is allowed to manage. This is typically a box with a width of
3840can be fit within the total video memory, however, the driver can reserve 3831can be fit within the total video memory, however, the driver can reserve
3841areas at the extremities by passing a smaller area to the manager. 3832areas at the extremities by passing a smaller area to the manager.
3842 </para> 3833 </para>
3843
3844 <para>
3845<function>xf86InitFBManager()</function> must be called before XAA is
3846initialized since XAA uses the manager for it's pixmap cache.
3847 </para>
3848
3849 <para>
3850An alternative function is provided to allow the driver to initialize
3851the framebuffer manager with a Region rather than a box.
3852
3853 <programlisting>
3854 Bool xf86InitFBManagerRegion(ScreenPtr pScreen,
3855 RegionPtr FullRegion);
3856 </programlisting>
3857
3858<function>xf86InitFBManagerRegion()</function>, unlike
3859<function>xf86InitFBManager()</function>, does not remove the area used for
3860the visible screen so that area should not be included in the region
3861passed to the function. <function>xf86InitFBManagerRegion()</function> is
3862useful when non-contiguous areas are available to be managed, and is
3863required when multiple framebuffers are stored in video memory (as in
3864the case where an overlay of a different depth is stored as a second
3865framebuffer in offscreen memory).
3866 </para>
3867
3868 </sect1> 3834 </sect1>
3869 3835
3870 <sect1 id="cmap"> 3836 <sect1 id="cmap">
@@ -8900,12 +8866,6 @@ ZZZPreInit(ScrnInfoPtr pScrn, int flags)
8900 ZZZFreeRec(pScrn); 8866 ZZZFreeRec(pScrn);
8901 return FALSE; 8867 return FALSE;
8902 8868
8903 /* Load XAA if needed */
8904 if (!pZzz-&gt;noAccel || pZzz-&gt;hwCursor)
8905 if (!xf86LoadSubModule(pScrn, "xaa")) {
8906 ZZZFreeRec(pScrn);
8907 return FALSE;
8908 }
8909 8869
8910 /* Done */ 8870 /* Done */
8911 return TRUE; 8871 return TRUE;
diff --git a/hw/xfree86/doc/exa-driver.txt b/hw/xfree86/doc/exa-driver.txt
index 048307ee7..da39d3f91 100644
--- a/hw/xfree86/doc/exa-driver.txt
+++ b/hw/xfree86/doc/exa-driver.txt
@@ -8,15 +8,10 @@ from system memory, and Porter-Duff compositing and transform operations.
8 8
9Configuration 9Configuration
10------------- 10-------------
11A new config file option, AccelMethod, should be added to your driver, to allow
12the user to select between the EXA and XAA acceleration APIs.
13
14Some drivers implement a per-instance useEXA flag to track whether EXA is 11Some drivers implement a per-instance useEXA flag to track whether EXA is
15active or not. It can be helpful to also conditionalize XAA support with an 12active or not.
16ifdef so that it can easily be turned off/removed in the future.
17 13
18Setting the flag and checking for AccelMethod can be done in the driver's 14Setting the flag can be done in the driver's Options parsing routine.
19Options parsing routine.
20 15
21Loading EXA 16Loading EXA
22------------ 17------------
diff --git a/hw/xfree86/ramdac/.gitignore b/hw/xfree86/ramdac/.gitignore
deleted file mode 100644
index c55c8c1ab..000000000
--- a/hw/xfree86/ramdac/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1# Add & Override for this directory and it's subdirectories
2xf86BitOrder.c
diff --git a/hw/xfree86/ramdac/Makefile.am b/hw/xfree86/ramdac/Makefile.am
index 3c3780516..346af4ccc 100644
--- a/hw/xfree86/ramdac/Makefile.am
+++ b/hw/xfree86/ramdac/Makefile.am
@@ -1,19 +1,12 @@
1noinst_LTLIBRARIES = libramdac.la 1noinst_LTLIBRARIES = libramdac.la
2 2
3libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \ 3libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
4 xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \ 4 xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c
5 xf86BitOrder.c
6 5
7sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h 6sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
8 7
9DISTCLEANFILES = xf86BitOrder.c
10EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \ 8EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
11 CURSOR.NOTES 9 CURSOR.NOTES
12 10
13AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \ 11AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
14 $(DIX_CFLAGS) $(XORG_CFLAGS)
15INCLUDES = $(XORG_INCS) 12INCLUDES = $(XORG_INCS)
16
17xf86BitOrder.c:
18 $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
19 $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
diff --git a/hw/xfree86/ramdac/xf86CursorPriv.h b/hw/xfree86/ramdac/xf86CursorPriv.h
index d04f93207..04be14135 100644
--- a/hw/xfree86/ramdac/xf86CursorPriv.h
+++ b/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -43,8 +43,6 @@ void xf86MoveCursor(ScreenPtr pScreen, int x, int y);
43void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed); 43void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed);
44Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); 44Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
45 45
46CARD32 xf86ReverseBitOrder(CARD32 data);
47
48extern _X_EXPORT DevPrivateKeyRec xf86CursorScreenKeyRec; 46extern _X_EXPORT DevPrivateKeyRec xf86CursorScreenKeyRec;
49 47
50#define xf86CursorScreenKey (&xf86CursorScreenKeyRec) 48#define xf86CursorScreenKey (&xf86CursorScreenKeyRec)
diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index cb62d9b20..197abff8f 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -21,6 +21,15 @@
21 21
22#include "servermd.h" 22#include "servermd.h"
23 23
24static CARD32
25xf86ReverseBitOrder(CARD32 v)
26{
27 return (((0x01010101 & v) << 7) | ((0x02020202 & v) << 5) |
28 ((0x04040404 & v) << 3) | ((0x08080808 & v) << 1) |
29 ((0x10101010 & v) >> 1) | ((0x20202020 & v) >> 3) |
30 ((0x40404040 & v) >> 5) | ((0x80808080 & v) >> 7));
31}
32
24#if BITMAP_SCANLINE_PAD == 64 33#if BITMAP_SCANLINE_PAD == 64
25 34
26#if 1 35#if 1
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 420640ffe..c0398da18 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -174,14 +174,6 @@ cat > sdksyms.c << EOF
174#endif 174#endif
175 175
176 176
177/* hw/xfree86/xaa/Makefile.am -- module */
178/*
179#include "xaa.h"
180#include "xaalocal.h"
181#include "xaarop.h"
182 */
183
184
185/* hw/xfree86/dixmods/extmod/Makefile.am -- module */ 177/* hw/xfree86/dixmods/extmod/Makefile.am -- module */
186#ifdef XFreeXDGA 178#ifdef XFreeXDGA
187#include "dgaproc.h" 179#include "dgaproc.h"
diff --git a/hw/xfree86/xaa/.gitignore b/hw/xfree86/xaa/.gitignore
deleted file mode 100644
index 1211d01e1..000000000
--- a/hw/xfree86/xaa/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
1# Add & Override for this directory and it's subdirectories
2[lms]-xaa*.c
3[lm]f3-xaa*.c
4[lm][f3]-xaa*.c
diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am
deleted file mode 100644
index 5614d723a..000000000
--- a/hw/xfree86/xaa/Makefile.am
+++ /dev/null
@@ -1,79 +0,0 @@
1LSB_FIRST = l-xaaBitmap.c l-xaaStipple.c l-xaaTEGlyph.c
2LSB_3_FIRST = l3-xaaBitmap.c l3-xaaStipple.c
3MSB_FIRST = m-xaaBitmap.c m-xaaStipple.c m-xaaTEGlyph.c
4MSB_3_FIRST = m3-xaaBitmap.c m3-xaaStipple.c
5LSB_FIXED = lf-xaaBitmap.c lf-xaaStipple.c lf-xaaTEGlyph.c
6LSB_3_FIXED = lf3-xaaBitmap.c lf3-xaaStipple.c
7MSB_FIXED = mf-xaaBitmap.c mf-xaaStipple.c mf-xaaTEGlyph.c
8MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c
9POLYSEG = s-xaaLine.c s-xaaDashLine.c
10
11if XAA
12
13libxaa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
14libxaa_la_LIBADD = $(PIXMAN_LIBS)
15if COMPOSITE
16libxaa_la_LIBADD += $(top_builddir)/miext/cw/libcw.la
17endif
18
19module_LTLIBRARIES = libxaa.la
20libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
21 xaaBitBlt.c xaaCpyArea.c xaaGCmisc.c xaaCpyWin.c \
22 xaaCpyPlane.c xaaFillRect.c xaaTEText.c xaaNonTEText.c \
23 xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c \
24 xaaRect.c xaaLineMisc.c xaaBitOrder.c \
25 xaaFillPoly.c xaaWideLine.c xaaTables.c xaaFillArc.c \
26 xaaLine.c xaaDashLine.c xaaOverlay.c xaaOffscreen.c \
27 xaaOverlayDF.c xaaStateChange.c xaaPict.c $(POLYSEG) \
28 $(LSB_FIRST) $(MSB_FIRST) $(LSB_FIXED) $(MSB_FIXED) \
29 $(LSB_3_FIRST) $(MSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIXED)
30${POLYSEG}:
31 $(AM_V_GEN)echo "#define POLYSEGMENT" > $@
32 $(AM_V_GEN)echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
33${LSB_FIRST}:
34 $(AM_V_GEN)echo "#define LSBFIRST" > $@
35 $(AM_V_GEN)echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
36${LSB_3_FIRST}:
37 $(AM_V_GEN)echo "#define LSBFIRST" > $@
38 $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
39 $(AM_V_GEN)echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
40${LSB_FIXED}:
41 $(AM_V_GEN)echo "#define LSBFIRST" > $@
42 $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
43 $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
44${LSB_3_FIXED}:
45 $(AM_V_GEN)echo "#define LSBFIRST" > $@
46 $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
47 $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
48 $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
49${MSB_FIRST}:
50 $(AM_V_GEN)echo "#define MSBFIRST" > $@
51 $(AM_V_GEN)echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
52${MSB_3_FIRST}:
53 $(AM_V_GEN)echo "#define MSBFIRST" > $@
54 $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
55 $(AM_V_GEN)echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
56${MSB_FIXED}:
57 $(AM_V_GEN)echo "#define MSBFIRST" > $@
58 $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
59 $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
60${MSB_3_FIXED}:
61 $(AM_V_GEN)echo "#define MSBFIRST" > $@
62 $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
63 $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
64 $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
65
66endif # XAA
67
68DISTCLEANFILES = $(POLYSEG) \
69 $(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \
70 $(LSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIRST) $(MSB_3_FIXED)
71
72sdk_HEADERS = xaa.h xaalocal.h xaarop.h
73EXTRA_DIST = xaacexp.h xaawrap.h xaaLine.c xaaDashLine.c \
74 xaaStipple.c xaaTEGlyph.c xaaNonTEGlyph.c xaaBitmap.c \
75 XAA.HOWTO
76
77INCLUDES = $(XORG_INCS) -I$(srcdir)/../../../miext/cw
78
79AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/hw/xfree86/xaa/XAA.HOWTO b/hw/xfree86/xaa/XAA.HOWTO
deleted file mode 100644
index cbd71c138..000000000
--- a/hw/xfree86/xaa/XAA.HOWTO
+++ /dev/null
@@ -1,1427 +0,0 @@
1
2
3 XAA.HOWTO
4
5 This file describes how to add basic XAA support to a chipset driver.
6
70) What is XAA
81) XAA Initialization and Shutdown
92) The Primitives
10 2.0 Generic Flags
11 2.1 Screen to Screen Copies
12 2.2 Solid Fills
13 2.3 Solid Lines
14 2.4 Dashed Lines
15 2.5 Color Expand Fills
16 2.5.1 Screen to Screen Color Expansion
17 2.5.2 CPU to Screen Color Expansion
18 2.5.2.1 The Direct Method
19 2.5.2.2 The Indirect Method
20 2.6 8x8 Mono Pattern Fills
21 2.7 8x8 Color Pattern Fills
22 2.8 Image Writes
23 2.8.1 The Direct Method
24 2.8.2 The Indirect Method
25 2.9 Clipping
263) The Pixmap Cache
274) Offscreen Pixmaps
28
29/********************************************************************/
30
310) WHAT IS XAA
32
33 XAA (the XFree86 Acceleration Architecture) is a device dependent
34layer that encapsulates the unaccelerated framebuffer rendering layer,
35intercepting rendering commands sent to it from higher levels of the
36server. For rendering tasks where hardware acceleration is not
37possible, XAA allows the requests to proceed to the software rendering
38code. Otherwise, XAA breaks the sometimes complicated X primitives
39into simpler primitives more suitable for hardware acceleration and
40will use accelerated functions exported by the chipset driver to
41render these.
42
43 XAA provides a simple, easy to use driver interface that allows
44the driver to communicate its acceleration capabilities and restrictions
45back to XAA. XAA will use the information provided by the driver
46to determine whether or not acceleration will be possible for a
47particular X primitive.
48
49
50
511) XAA INITIALIZATION AND SHUTDOWN
52
53 All relevant prototypes and defines are in xaa.h.
54
55 To Initialize the XAA layer, the driver should allocate an XAAInfoRec
56via XAACreateInfoRec(), fill it out as described in this document
57and pass it to XAAInit(). XAAInit() must be called _after_ the
58framebuffer initialization (usually cfb?ScreenInit or similar) since
59it is "wrapping" that layer. XAAInit() should be called _before_ the
60cursor initialization (usually miDCInitialize) since the cursor
61layer needs to "wrap" all the rendering code including XAA.
62
63 When shutting down, the driver should free the XAAInfoRec
64structure in its CloseScreen function via XAADestroyInfoRec().
65The prototypes for the functions mentioned above are as follows:
66
67 XAAInfoRecPtr XAACreateInfoRec(void);
68 Bool XAAInit(ScreenPtr, XAAInfoRecPtr);
69 void XAADestroyInfoRec(XAAInfoRec);
70
71 The driver informs XAA of it's acceleration capablities by
72filling out an XAAInfoRec structure and passing it to XAAInit().
73The XAAInfoRec structure contains many fields, most of which are
74function pointers and flags. Each primitive will typically have
75two functions and a set of flags associated with it, but it may
76have more. These two functions are the "SetupFor" and "Subsequent"
77functions. The "SetupFor" function tells the driver that the
78hardware should be initialized for a particular type of graphics
79operation. After the "SetupFor" function, one or more calls to the
80"Subsequent" function will be made to indicate that an instance
81of the particular primitive should be rendered by the hardware.
82The details of each instance (width, height, etc...) are given
83with each "Subsequent" function. The set of flags associated
84with each primitive lets the driver tell XAA what its hardware
85limitations are (eg. It doesn't support a planemask, it can only
86do one of the raster-ops, etc...).
87
88 Of the XAAInfoRec fields, one is required. This is the
89Sync function. XAA initialization will fail if this function
90is not provided.
91
92void Sync(ScrnInfoPtr pScrn) /* Required */
93
94 Sync will be called when XAA needs to be certain that all
95 graphics coprocessor operations are finished, such as when
96 the framebuffer must be written to or read from directly
97 and it must be certain that the accelerator will not be
98 overwriting the area of interest.
99
100 One needs to make certain that the Sync function not only
101 waits for the accelerator fifo to empty, but that it waits for
102 the rendering of that last operation to complete.
103
104 It is guaranteed that no direct framebuffer access will
105 occur after a "SetupFor" or "Subsequent" function without
106 the Sync function being called first.
107
108
109
1102) THE PRIMITIVES
111
1122.0 Generic Flags
113
114 Each primitive type has a set of flags associated with it which
115allow the driver to tell XAA what the hardware limitations are.
116The common ones are as follows:
117
118/* Foreground, Background, rop and planemask restrictions */
119
120 GXCOPY_ONLY
121
122 This indicates that the accelerator only supports GXcopy
123 for the particular primitive.
124
125 ROP_NEEDS_SOURCE
126
127 This indicates that the accelerator doesn't supports a
128 particular primitive with rops that don't involve the source.
129 These rops are GXclear, GXnoop, GXinvert and GXset. If neither
130 this flag nor GXCOPY_ONLY is defined, it is assumed that the
131 accelerator supports all 16 raster operations (rops) for that
132 primitive.
133
134 NO_PLANEMASK
135
136 This indicates that the accelerator does not support a hardware
137 write planemask for the particular primitive.
138
139 RGB_EQUAL
140
141 This indicates that the particular primitive requires the red,
142 green and blue bytes of the foreground color (and background color,
143 if applicable) to be equal. This is useful for 24bpp when a graphics
144 coprocessor is used in 8bpp mode, which is not uncommon in older
145 hardware since some have no support for or only limited support for
146 acceleration at 24bpp. This way, many operations will be accelerated
147 for the common case of "grayscale" colors. This flag should only
148 be used in 24bpp.
149
150 In addition to the common ones listed above which are possible for
151nearly all primitives, each primitive may have its own flags specific
152to that primitive. If such flags exist they are documented in the
153descriptions of those primitives below.
154
155
156
157
1582.1 Screen to Screen Copies
159
160 The SetupFor and Subsequent ScreenToScreenCopy functions provide
161 an interface for copying rectangular areas from video memory to
162 video memory. To accelerate this primitive the driver should
163 provide both the SetupFor and Subsequent functions and indicate
164 the hardware restrictions via the ScreenToScreenCopyFlags. The
165 NO_PLANEMASK, GXCOPY_ONLY and ROP_NEEDS_SOURCE flags as described
166 in Section 2.0 are valid as well as the following:
167
168 NO_TRANSPARENCY
169
170 This indicates that the accelerator does not support skipping
171 of color keyed pixels when copying from the source to the destination.
172
173 TRANSPARENCY_GXCOPY_ONLY
174
175 This indicates that the accelerator supports skipping of color keyed
176 pixels only when the rop is GXcopy.
177
178 ONLY_LEFT_TO_RIGHT_BITBLT
179
180 This indicates that the hardware only accepts blitting when the
181 x direction is positive.
182
183 ONLY_TWO_BITBLT_DIRECTIONS
184
185 This indicates that the hardware can only cope with blitting when
186 the direction of x is the same as the direction in y.
187
188
189void SetupForScreenToScreenCopy( ScrnInfoPtr pScrn,
190 int xdir, int ydir,
191 int rop,
192 unsigned int planemask,
193 int trans_color )
194
195 When this is called, SubsequentScreenToScreenCopy will be called
196 one or more times directly after. If ydir is 1, then the accelerator
197 should copy starting from the top (minimum y) of the source and
198 proceed downward. If ydir is -1, then the accelerator should copy
199 starting from the bottom of the source (maximum y) and proceed
200 upward. If xdir is 1, then the accelerator should copy each
201 y scanline starting from the leftmost pixel of the source. If
202 xdir is -1, it should start from the rightmost pixel.
203 If trans_color is not -1 then trans_color indicates that the
204 accelerator should not copy pixels with the color trans_color
205 from the source to the destination, but should skip them.
206 Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
207
208
209void SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
210 int x1, int y1,
211 int x2, int y2,
212 int width, int height)
213
214 Copy a rectangle "width" x "height" from the source (x1,y1) to the
215 destination (x2,y2) using the parameters passed by the last
216 SetupForScreenToScreenCopy call. (x1,y1) and (x2,y2) always denote
217 the upper left hand corners of the source and destination regardless
218 of which xdir and ydir values are given by SetupForScreenToScreenCopy.
219
220
221
2222.2 Solid Fills
223
224 The SetupFor and Subsequent SolidFill(Rect/Trap) functions provide
225 an interface for filling rectangular areas of the screen with a
226 foreground color. To accelerate this primitive the driver should
227 provide both the SetupForSolidFill and SubsequentSolidFillRect
228 functions and indicate the hardware restrictions via the SolidFillFlags.
229 The driver may optionally provide a SubsequentSolidFillTrap if
230 it is capable of rendering the primitive correctly.
231 The GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
232 as described in Section 2.0 are valid.
233
234
235void SetupForSolidFill(ScrnInfoPtr pScrn,
236 int color, int rop, unsigned int planemask)
237
238 SetupForSolidFill indicates that any combination of the following
239 may follow it.
240
241 SubsequentSolidFillRect
242 SubsequentSolidFillTrap
243
244
245
246void SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
247
248 Fill a rectangle of dimensions "w" by "h" with origin at (x,y)
249 using the color, rop and planemask given by the last
250 SetupForSolidFill call.
251
252void SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
253 int left, int dxL, int dyL, int eL,
254 int right, int dxR, int dyR, int eR)
255
256 These parameters describe a trapezoid via a version of
257 Bresenham's parameters. "y" is the top line. "h" is the
258 number of spans to be filled in the positive Y direction.
259 "left" and "right" indicate the starting X values of the
260 left and right edges. dy/dx describes the edge slope.
261 These are not the deltas between the beginning and ending
262 points on an edge. They merely describe the slope. "e" is
263 the initial error term. It's the relationships between dx,
264 dy and e that define the edge.
265 If your engine does not do bresenham trapezoids or does
266 not allow the programmer to specify the error term then
267 you are not expected to be able to accelerate them.
268
269
2702.3 Solid Lines
271
272 XAA provides an interface for drawing thin lines. In order to
273 draw X lines correctly a high degree of accuracy is required.
274 This usually limits line acceleration to hardware which has a
275 Bresenham line engine, though depending on the algorithm used,
276 other line engines may come close if they accept 16 bit line
277 deltas. XAA has both a Bresenham line interface and a two-point
278 line interface for drawing lines of arbitrary orientation.
279 Additionally there is a SubsequentSolidHorVertLine which will
280 be used for all horizontal and vertical lines. Horizontal and
281 vertical lines are handled separately since hardware that doesn't
282 have a line engine (or has one that is unusable due to precision
283 problems) can usually draw these lines by some other method such
284 as drawing them as thin rectangles. Even for hardware that can
285 draw arbitrary lines via the Bresenham or two-point interfaces,
286 the SubsequentSolidHorVertLine is used for horizontal and vertical
287 lines since most hardware is able to render the horizontal lines
288 and sometimes the vertical lines faster by other methods (Hint:
289 try rendering horizontal lines as flattened rectangles). If you have
290 not provided a SubsequentSolidHorVertLine but you have provided
291 Bresenham or two-point lines, a SubsequentSolidHorVertLine function
292 will be supplied for you.
293
294 The flags field associated with Solid Lines is SolidLineFlags and
295 the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
296 described in Section 2.0 are valid restrictions.
297
298 Some line engines have line biases hardcoded to comply with
299 Microsoft line biasing rules. A tell-tale sign of this is the
300 hardware lines not matching the software lines in the zeroth and
301 fourth octants. The driver can set the flag:
302
303 MICROSOFT_ZERO_LINE_BIAS
304
305 in the AccelInfoRec.Flags field to adjust the software lines to
306 match the hardware lines. This is in the generic flags field
307 rather than the SolidLineFlags since this flag applies to all
308 software zero-width lines on the screen and not just the solid ones.
309
310
311void SetupForSolidLine(ScrnInfoPtr pScrn,
312 int color, int rop, unsigned int planemask)
313
314 SetupForSolidLine indicates that any combination of the following
315 may follow it.
316
317 SubsequentSolidBresenhamLine
318 SubsequentSolidTwoPointLine
319 SubsequentSolidHorVertLine
320
321
322void SubsequentSolidHorVertLine( ScrnInfoPtr pScrn,
323 int x, int y, int len, int dir )
324
325 All vertical and horizontal solid thin lines are rendered with
326 this function. The line starts at coordinate (x,y) and extends
327 "len" pixels inclusive. In the direction indicated by "dir."
328 The direction is either DEGREES_O or DEGREES_270. That is, it
329 always extends to the right or down.
330
331
332
333void SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
334 int x1, int y1, int x2, int y2, int flags)
335
336 Draw a line from (x1,y1) to (x2,y2). If the flags field contains
337 the flag OMIT_LAST, the last pixel should not be drawn. Otherwise,
338 the pixel at (x2,y2) should be drawn.
339
340 If you use the TwoPoint line interface there is a good possibility
341 that your line engine has hard-coded line biases that do not match
342 the default X zero-width lines. If so, you may need to set the
343 MICROSOFT_ZERO_LINE_BIAS flag described above. Note that since
344 any vertex in the 16-bit signed coordinate system is valid, your
345 line engine is expected to handle 16-bit values if you have hardware
346 line clipping enabled. If your engine cannot handle 16-bit values,
347 you should not use hardware line clipping.
348
349
350void SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
351 int x, int y, int major, int minor, int err, int len, int octant)
352
353 "X" and "y" are the starting point of the line. "Major" and "minor"
354 are the major and minor step constants. "Err" is the initial error
355 term. "Len" is the number of pixels to be drawn (inclusive). "Octant"
356 can be any combination of the following flags OR'd together:
357
358 Y_MAJOR Y is the major axis (X otherwise)
359 X_DECREASING The line is drawn from right to left
360 Y_DECREASING The line is drawn from bottom to top
361
362 The major, minor and err terms are the "raw" Bresenham parameters
363 consistent with a line engine that does:
364
365 e = err;
366 while(len--) {
367 DRAW_POINT(x,y);
368 e += minor;
369 if(e >= 0) {
370 e -= major;
371 TAKE_ONE_STEP_ALONG_MINOR_AXIS;
372 }
373 TAKE_ONE_STEP_ALONG_MAJOR_AXIS;
374 }
375
376 IBM 8514 style Bresenham line interfaces require their parameters
377 modified in the following way:
378
379 Axial = minor;
380 Diagonal = minor - major;
381 Error = minor + err;
382
383SolidBresenhamLineErrorTermBits
384
385 This field allows the driver to tell XAA how many bits large its
386 Bresenham parameter registers are. Many engines have registers that
387 only accept 12 or 13 bit Bresenham parameters, and the parameters
388 for clipped lines may overflow these if they are not scaled down.
389 If this field is not set, XAA will assume the engine can accomodate
390 16 bit parameters, otherwise, it will scale the parameters to the
391 size specified.
392
393
3942.4 Dashed Lines
395
396 The same degree of accuracy required by the solid lines is required
397 for drawing dashed lines as well. The dash pattern itself is a
398 buffer of binary data where ones are expanded into the foreground
399 color and zeros either correspond to the background color or
400 indicate transparency depending on whether or not DoubleDash or
401 OnOffDashes are being drawn.
402
403 The flags field associated with dashed Lines is DashedLineFlags and
404 the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
405 described in Section 2.0 are valid restrictions. Additionally, the
406 following flags are valid:
407
408 NO_TRANSPARENCY
409
410 This indicates that the driver cannot support dashed lines
411 with transparent backgrounds (OnOffDashes).
412
413 TRANSPARENCY_ONLY
414
415 This indicates that the driver cannot support dashes with
416 both a foreground and background color (DoubleDashes).
417
418 LINE_PATTERN_POWER_OF_2_ONLY
419
420 This indicates that only patterns with a power of 2 length
421 can be accelerated.
422
423 LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
424 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
425 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
426 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
427
428 These describe how the line pattern should be packed.
429 The pattern buffer is DWORD padded. LSBFIRST indicates
430 that the pattern runs from the LSB end to the MSB end.
431 MSBFIRST indicates that the pattern runs from the MSB end
432 to the LSB end. When the pattern does not completely fill
433 the DWORD padded buffer, the pattern will be justified
434 towards the MSB or LSB end based on the flags above.
435
436
437 The following field indicates the maximum length dash pattern that
438 should be accelerated.
439
440 int DashPatternMaxLength
441
442
443void SetupForDashedLine(ScrnInfoPtr pScrn,
444 int fg, int bg, int rop, unsigned int planemask,
445 int length, unsigned char *pattern)
446
447
448 SetupForDashedLine indicates that any combination of the following
449 may follow it.
450
451 SubsequentDashedBresenhamLine
452 SubsequentDashedTwoPointLine
453
454 If "bg" is -1, then the background (pixels corresponding to clear
455 bits in the pattern) should remain unmodified. "Bg" indicates the
456 background color otherwise. "Length" indicates the length of
457 the pattern in bits and "pattern" points to the DWORD padded buffer
458 holding the pattern which has been packed according to the flags
459 set above.
460
461
462void SubsequentDashedTwoPointLine( ScrnInfoPtr pScrn,
463 int x1, int y1, int x2, int y2, int flags, int phase)
464
465void SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn,
466 int x1, int y1, int major, int minor, int err, int len, int octant,
467 int phase)
468
469 These are the same as the SubsequentSolidTwoPointLine and
470 SubsequentBresenhamLine functions except for the addition
471 of the "phase" field which indicates the offset into the dash
472 pattern that the pixel at (x1,y1) corresponds to.
473
474 As with the SubsequentBresenhamLine, there is an
475
476 int DashedBresenhamLineErrorTermBits
477
478 field which indicates the size of the error term registers
479 used with dashed lines. This is usually the same value as
480 the field for the solid lines (because it's usually the same
481 register).
482
483
484
4852.5 Color Expansion Fills
486
487 When filling a color expansion rectangle, the accelerator
488 paints each pixel depending on whether or not a bit in a
489 corresponding bitmap is set or clear. Opaque expansions are
490 when a set bit corresponds to the foreground color and a clear
491 bit corresponds to the background color. A transparent expansion
492 is when a set bit corresponds to the foreground color and a
493 clear bit indicates that the pixel should remain unmodified.
494
495 The graphics accelerator usually has access to the source
496 bitmap in one of two ways: 1) the bitmap data is sent serially
497 to the accelerator by the CPU through some memory mapped aperture
498 or 2) the accelerator reads the source bitmap out of offscreen
499 video memory. Some types of primitives are better suited towards
500 one method or the other. Type 2 is useful for reusable patterns
501 such as stipples which can be cached in offscreen memory. The
502 aperature method can be used for stippling but the CPU must pass
503 the data across the bus each time a stippled fill is to be performed.
504 For expanding 1bpp client pixmaps or text strings to the screen,
505 the aperature method is usually superior because the intermediate
506 copy in offscreen memory needed by the second method would only be
507 used once. Unfortunately, many accelerators can only do one of these
508 methods and not both.
509
510 XAA provides both ScreenToScreen and CPUToScreen color expansion
511 interfaces for doing color expansion fills. The ScreenToScreen
512 functions can only be used with hardware that supports reading
513 of source bitmaps from offscreen video memory, and these are only
514 used for cacheable patterns such as stipples. There are two
515 variants of the CPUToScreen routines - a direct method intended
516 for hardware that has a transfer aperature, and an indirect method
517 intended for hardware without transfer aperatures or hardware
518 with unusual transfer requirements. Hardware that can only expand
519 bitmaps from video memory should supply ScreenToScreen routines
520 but also ScanlineCPUToScreen (indirect) routines to optimize transfers
521 of non-cacheable data. Hardware that can only accept source bitmaps
522 through an aperature should supply CPUToScreen (or ScanlineCPUToScreen)
523 routines. Hardware that can do both should provide both ScreenToScreen
524 and CPUToScreen routines.
525
526 For both ScreenToScreen and CPUToScreen interfaces, the GXCOPY_ONLY,
527 ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags described in
528 Section 2.0 are valid as well as the following:
529
530 /* bit order requirements (one of these must be set) */
531
532 BIT_ORDER_IN_BYTE_LSBFIRST
533
534 This indicates that least significant bit in each byte of the source
535 data corresponds to the leftmost of that block of 8 pixels. This
536 is the prefered format.
537
538 BIT_ORDER_IN_BYTE_MSBFIRST
539
540 This indicates that most significant bit in each byte of the source
541 data corresponds to the leftmost of that block of 8 pixels.
542
543 /* transparency restrictions */
544
545 NO_TRANSPARENCY
546
547 This indicates that the accelerator cannot do a transparent expansion.
548
549 TRANSPARENCY_ONLY
550
551 This indicates that the accelerator cannot do an opaque expansion.
552 In cases where where the background needs to be filled, XAA will
553 render the primitive in two passes when using the CPUToScreen
554 interface, but will not do so with the ScreenToScreen interface
555 since that would require caching of two patterns. Some
556 ScreenToScreen hardware may be able to render two passes at the
557 driver level and remove the TRANSPARENCY_ONLY restriction if
558 it can render pixels corresponding to the zero bits.
559
560
561
5622.5.1 Screen To Screen Color Expansion
563
564 The ScreenToScreenColorExpandFill routines provide an interface
565 for doing expansion blits from source patterns stored in offscreen
566 video memory.
567
568 void SetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn,
569 int fg, int bg,
570 int rop, unsigned int planemask)
571
572
573 Ones in the source bitmap will correspond to the fg color.
574 Zeros in the source bitmap will correspond to the bg color
575 unless bg = -1. In that case the pixels corresponding to the
576 zeros in the bitmap shall be left unmodified by the accelerator.
577
578 For hardware that doesn't allow an easy implementation of skipleft, the
579 driver can replace CacheMonoStipple function with one that stores multiple
580 rotated copies of the stipple and select between them. In this case the
581 driver should set CacheColorExpandDensity to tell XAA how many copies of
582 the pattern are stored in the width of a cache slot. For instance if the
583 hardware can specify the starting address in bytes, then 8 rotated copies
584 of the stipple are needed and CacheColorExpandDensity should be set to 8.
585
586 void SubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
587 int x, int y, int w, int h,
588 int srcx, int srcy, int offset )
589
590
591 Fill a rectangle "w" x "h" at location (x,y). The source pitch
592 between scanlines is the framebuffer pitch (pScrn->displayWidth
593 pixels) and srcx and srcy indicate the start of the source pattern
594 in units of framebuffer pixels. "Offset" indicates the bit offset
595 into the pattern that corresponds to the pixel being painted at
596 "x" on the screen. Some hardware accepts source coordinates in
597 units of bits which makes implementation of the offset trivial.
598 In that case, the bit address of the source bit corresponding to
599 the pixel painted at (x,y) would be:
600
601 (srcy * pScrn->displayWidth + srcx) * pScrn->bitsPerPixel + offset
602
603 It should be noted that the offset assumes LSBFIRST hardware.
604 For MSBFIRST hardware, the driver may need to implement the
605 offset by bliting only from byte boundaries and hardware clipping.
606
607
608
6092.5.2 CPU To Screen Color Expansion
610
611
612 The CPUToScreenColorExpandFill routines provide an interface for
613 doing expansion blits from source patterns stored in system memory.
614 There are two varieties of this primitive, a CPUToScreenColorExpandFill
615 and a ScanlineCPUToScreenColorExpandFill. With the
616 CPUToScreenColorExpandFill method, the source data is sent serially
617 through a memory mapped aperature. With the Scanline version, the
618 data is rendered scanline at a time into intermediate buffers with
619 a call to SubsequentColorExpandScanline following each scanline.
620
621 These two methods have separate flags fields, the
622 CPUToScreenColorExpandFillFlags and ScanlineCPUToScreenColorExpandFillFlags
623 respectively. Flags specific to one method or the other are described
624 in sections 2.5.2.1 and 2.5.2.2 but for both cases the bit order and
625 transparency restrictions listed at the beginning of section 2.5 are
626 valid as well as the following:
627
628 /* clipping (optional) */
629
630 LEFT_EDGE_CLIPPING
631
632 This indicates that the accelerator supports omission of up to
633 31 pixels on the left edge of the rectangle to be filled. This
634 is beneficial since it allows transfer of the source bitmap to
635 always occur from DWORD boundaries.
636
637 LEFT_EDGE_CLIPPING_NEGATIVE_X
638
639 This flag indicates that the accelerator can render color expansion
640 rectangles even if the value of x origin is negative (off of
641 the screen on the left edge).
642
643 /* misc */
644
645 TRIPLE_BITS_24BPP
646
647 When enabled (must be in 24bpp mode), color expansion functions
648 are expected to require three times the amount of bits to be
649 transferred so that 24bpp grayscale colors can be used with color
650 expansion in 8bpp coprocessor mode. Each bit is expanded to 3
651 bits when writing the monochrome data.
652
653
654 2.5.1 The Direct Method
655
656
657 Using the direct method of color expansion XAA will send all
658 bitmap data to the accelerator serially through an memory mapped
659 transfer window defined by the following two fields:
660
661 unsigned char *ColorExpandBase
662
663 This indicates the memory address of the beginning of the aperture.
664
665 int ColorExpandRange
666
667 This indicates the size in bytes of the aperture.
668
669 The driver should specify how the transfered data should be padded.
670 There are options for both the padding of each Y scanline and for the
671 total transfer to the aperature.
672 One of the following two flags must be set:
673
674 CPU_TRANSFER_PAD_DWORD
675
676 This indicates that the total transfer (sum of all scanlines) sent
677 to the aperature must be DWORD padded. This is the default behavior.
678
679 CPU_TRANSFER_PAD_QWORD
680
681 This indicates that the total transfer (sum of all scanlines) sent
682 to the aperature must be QWORD padded. With this set, XAA will send
683 an extra DWORD to the aperature when needed to ensure that only
684 an even number of DWORDs are sent.
685
686 And then there are the flags for padding of each scanline:
687
688 SCANLINE_PAD_DWORD
689
690 This indicates that each Y scanline should be DWORD padded.
691 This is the only option available and is the default.
692
693 Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
694 that the aperture is a single register rather than a range of
695 registers, and XAA should write all of the data to the first DWORD.
696 If the ColorExpandRange is not large enough to accomodate scanlines
697 the width of the screen, this option will be forced. That is, the
698 ColorExpandRange must be:
699
700 ((virtualX + 31)/32) * 4 bytes or more.
701
702 ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
703
704 If the TRIPLE_BITS_24BPP flag is set, the required area should be
705 multiplied by three.
706
707
708void SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
709 int fg, int bg,
710 int rop,
711 unsigned int planemask)
712
713
714
715 Ones in the source bitmap will correspond to the fg color.
716 Zeros in the source bitmap will correspond to the bg color
717 unless bg = -1. In that case the pixels corresponding to the
718 zeros in the bitmap shall be left unmodified by the accelerator.
719
720
721void SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
722 int x, int y, int w, int h,
723 int skipleft )
724
725 When this function is called, the accelerator should be setup
726 to fill a rectangle of dimension "w" by "h" with origin at (x,y)
727 in the fill style prescribed by the last call to
728 SetupForCPUToScreenColorExpandFill. XAA will pass the data to
729 the aperture immediately after this function is called. If the
730 skipleft is non-zero (and LEFT_EDGE_CLIPPING has been enabled), then
731 the accelerator _should_not_ render skipleft pixels on the leftmost
732 edge of the rectangle. Some engines have an alignment feature
733 like this built in, some others can do this using a clipping
734 window.
735
736 It can be arranged for XAA to call Sync() after it is through
737 calling the Subsequent function by setting SYNC_AFTER_COLOR_EXPAND
738 in the CPUToScreenColorExpandFillFlags. This can provide the driver
739 with an oportunity to reset a clipping window if needed.
740
741
7422.5.2 The Indirect Method
743
744 Using the indirect method, XAA will render the bitmap data scanline
745 at a time to one or more buffers. These buffers may be memory
746 mapped apertures or just intermediate storage.
747
748 int NumScanlineColorExpandBuffers
749
750 This indicates the number of buffers available.
751
752 unsigned char **ScanlineColorExpandBuffers
753
754 This is an array of pointers to the memory locations of each buffer.
755 Each buffer is expected to be large enough to accommodate scanlines
756 the width of the screen. That is:
757
758 ((virtualX + 31)/32) * 4 bytes or more.
759
760 ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
761
762 Scanlines are always DWORD padded.
763 If the TRIPLE_BITS_24BPP flag is set, the required area should be
764 multiplied by three.
765
766
767void SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
768 int fg, int bg,
769 int rop,
770 unsigned int planemask)
771
772 Ones in the source bitmap will correspond to the fg color.
773 Zeros in the source bitmap will correspond to the bg color
774 unless bg = -1. In that case the pixels corresponding to the
775 zeros in the bitmap shall be left unmodified by the accelerator.
776
777
778void SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
779 int x, int y, int w, int h,
780 int skipleft )
781
782void SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
783
784
785 When SubsequentScanlineCPUToScreenColorExpandFill is called, XAA
786 will begin transfering the source data scanline at a time, calling
787 SubsequentColorExpandScanline after each scanline. If more than
788 one buffer is available, XAA will cycle through the buffers.
789 Subsequent scanlines will use the next buffer and go back to the
790 buffer 0 again when the last buffer is reached. The index into
791 the ScanlineColorExpandBuffers array is presented as "bufno"
792 with each SubsequentColorExpandScanline call.
793
794 The skipleft field is the same as for the direct method.
795
796 The indirect method can be use to send the source data directly
797 to a memory mapped aperture represented by a single color expand
798 buffer, scanline at a time, but more commonly it is used to place
799 the data into offscreen video memory so that the accelerator can
800 blit it to the visible screen from there. In the case where the
801 accelerator permits rendering into offscreen video memory while
802 the accelerator is active, several buffers can be used so that
803 XAA can be placing source data into the next buffer while the
804 accelerator is blitting the current buffer. For cases where
805 the accelerator requires some special manipulation of the source
806 data first, the buffers can be in system memory. The CPU can
807 manipulate these buffers and then send the data to the accelerator.
808
809
810
8112.6 8x8 Mono Pattern Fills
812
813 XAA provides support for two types of 8x8 hardware patterns -
814 "Mono" patterns and "Color" patterns. Mono pattern data is
815 64 bits of color expansion data with ones indicating the
816 foreground color and zeros indicating the background color.
817 The source bitmaps for the 8x8 mono patterns can be presented
818 to the graphics accelerator in one of two ways. They can be
819 passed as two DWORDS to the 8x8 mono pattern functions or
820 they can be cached in offscreen memory and their locations
821 passed to the 8x8 mono pattern functions. In addition to the
822 GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
823 defined in Section 2.0, the following are defined for the
824 Mono8x8PatternFillFlags:
825
826 HARDWARE_PATTERN_PROGRAMMED_BITS
827
828 This indicates that the 8x8 patterns should be packed into two
829 DWORDS and passed to the 8x8 mono pattern functions. The default
830 behavior is to cache the patterns in offscreen video memory and
831 pass the locations of these patterns to the functions instead.
832 The pixmap cache must be enabled for the default behavior (8x8
833 pattern caching) to work. See Section 3 for how to enable the
834 pixmap cache. The pixmap cache is not necessary for
835 HARDWARE_PATTERN_PROGRAMMED_BITS.
836
837 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
838
839 If the hardware supports programmable pattern offsets then
840 this option should be set. See the table below for further
841 infomation.
842
843 HARDWARE_PATTERN_SCREEN_ORIGIN
844
845 Some hardware wants the pattern offset specified with respect to the
846 upper left-hand corner of the primitive being drawn. Other hardware
847 needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that
848 all pattern offsets should be referenced to the upper left-hand
849 corner of the screen. HARDWARE_PATTERN_SCREEN_ORIGIN is preferable
850 since this is more natural for the X-Window system and offsets will
851 have to be recalculated for each Subsequent function otherwise.
852
853 BIT_ORDER_IN_BYTE_MSBFIRST
854 BIT_ORDER_IN_BYTE_LSBFIRST
855
856 As with other color expansion routines this indicates whether the
857 most or the least significant bit in each byte from the pattern is
858 the leftmost on the screen.
859
860 TRANSPARENCY_ONLY
861 NO_TRANSPARENCY
862
863 This means the same thing as for the color expansion rect routines
864 except that for TRANSPARENCY_ONLY XAA will not render the primitive
865 in two passes since this is more easily handled by the driver.
866 It is recommended that TRANSPARENCY_ONLY hardware handle rendering
867 of opaque patterns in two passes (the background can be filled as
868 a rectangle in GXcopy) in the Subsequent function so that the
869 TRANSPARENCY_ONLY restriction can be removed.
870
871
872
873 Additional information about cached patterns...
874 For the case where HARDWARE_PATTERN_PROGRAMMED_BITS is not set and
875 the pattern must be cached in offscreen memory, the first pattern
876 starts at the cache slot boundary which is set by the
877 CachePixelGranularity field used to configure the pixmap cache.
878 One should ensure that the CachePixelGranularity reflects any
879 alignment restrictions that the accelerator may put on 8x8 pattern
880 storage locations. When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set
881 there is only one pattern stored. When this flag is not set,
882 all 64 pre-rotated copies of the pattern are cached in offscreen memory.
883 The MonoPatternPitch field can be used to specify the X position pixel
884 granularity that each of these patterns must align on. If the
885 MonoPatternPitch is not supplied, the patterns will be densely packed
886 within the cache slot. The behavior of the default XAA 8x8 pattern
887 caching mechanism to store all 8x8 patterns linearly in video memory.
888 If the accelerator needs the patterns stored in a more unusual fashion,
889 the driver will need to provide its own 8x8 mono pattern caching
890 routines for XAA to use.
891
892 The following table describes the meanings of the "patx" and "paty"
893 fields in both the SetupFor and Subsequent functions.
894
895 With HARDWARE_PATTERN_SCREEN_ORIGIN
896 -----------------------------------
897
898 HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
899
900 SetupFor: patx and paty are the first and second DWORDS of the
901 8x8 mono pattern.
902
903 Subsequent: patx and paty are the x,y offset into that pattern.
904 All Subsequent calls will have the same offset in
905 the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
906 the offset specified by the first Subsequent call
907 after a SetupFor call will need to be observed.
908
909 HARDWARE_PATTERN_PROGRAMMED_BITS only
910
911 SetupFor: patx and paty hold the first and second DWORDS of
912 the 8x8 mono pattern pre-rotated to match the desired
913 offset.
914
915 Subsequent: These just hold the same patterns and can be ignored.
916
917 HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
918
919 SetupFor: patx and paty hold the x,y coordinates of the offscreen
920 memory location where the 8x8 pattern is stored. The
921 bits are stored linearly in memory at that location.
922
923 Subsequent: patx and paty hold the offset into the pattern.
924 All Subsequent calls will have the same offset in
925 the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
926 the offset specified by the first Subsequent call
927 after a SetupFor call will need to be observed.
928
929 Neither programmed bits or origin
930
931 SetupFor: patx and paty hold the x,y coordinates of the offscreen
932 memory location where the pre-rotated 8x8 pattern is
933 stored.
934
935 Subsequent: patx and paty are the same as in the SetupFor function
936 and can be ignored.
937
938
939 Without HARDWARE_PATTERN_SCREEN_ORIGIN
940 --------------------------------------
941
942 HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
943
944 SetupFor: patx and paty are the first and second DWORDS of the
945 8x8 mono pattern.
946
947 Subsequent: patx and paty are the x,y offset into that pattern.
948
949 HARDWARE_PATTERN_PROGRAMMED_BITS only
950
951 SetupFor: patx and paty holds the first and second DWORDS of
952 the unrotated 8x8 mono pattern. This can be ignored.
953
954 Subsequent: patx and paty hold the rotated 8x8 pattern to be
955 rendered.
956
957 HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
958
959 SetupFor: patx and paty hold the x,y coordinates of the offscreen
960 memory location where the 8x8 pattern is stored. The
961 bits are stored linearly in memory at that location.
962
963 Subsequent: patx and paty hold the offset into the pattern.
964
965 Neither programmed bits or origin
966
967 SetupFor: patx and paty hold the x,y coordinates of the offscreen
968 memory location where the unrotated 8x8 pattern is
969 stored. This can be ignored.
970
971 Subsequent: patx and paty hold the x,y coordinates of the
972 rotated 8x8 pattern to be rendered.
973
974
975
976void SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
977 int fg, int bg, int rop, unsigned int planemask)
978
979 SetupForMono8x8PatternFill indicates that any combination of the
980 following may follow it.
981
982 SubsequentMono8x8PatternFillRect
983 SubsequentMono8x8PatternFillTrap
984
985 The fg, bg, rop and planemask fields have the same meaning as the
986 ones used for the other color expansion routines. Patx's and paty's
987 meaning can be determined from the table above.
988
989
990void SubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn,
991 int patx, int paty, int x, int y, int w, int h)
992
993 Fill a rectangle of dimensions "w" by "h" with origin at (x,y)
994 using the parameters give by the last SetupForMono8x8PatternFill
995 call. The meanings of patx and paty can be determined by the
996 table above.
997
998void SubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn,
999 int patx, int paty, int y, int h,
1000 int left, int dxL, int dyL, int eL,
1001 int right, int dxR, int dyR, int eR )
1002
1003 The meanings of patx and paty can be determined by the table above.
1004 The rest of the fields have the same meanings as those in the
1005 SubsequentSolidFillTrap function.
1006
1007
1008
10092.7 8x8 Color Pattern Fills
1010
1011 8x8 color pattern data is 64 pixels of full color data that
1012 is stored linearly in offscreen video memory. 8x8 color patterns
1013 are useful as a substitute for 8x8 mono patterns when tiling,
1014 doing opaque stipples, or in the case where transperency is
1015 supported, regular stipples. 8x8 color pattern fills also have
1016 the additional benefit of being able to tile full color 8x8
1017 patterns instead of just 2 color ones like the mono patterns.
1018 However, full color 8x8 patterns aren't used very often in the
1019 X Window system so you might consider passing this primitive
1020 by if you already can do mono patterns, especially if they
1021 require alot of cache area. Color8x8PatternFillFlags is
1022 the flags field for this primitive and the GXCOPY_ONLY,
1023 ROP_NEEDS_SOURCE and NO_PLANEMASK flags as described in
1024 Section 2.0 are valid as well as the following:
1025
1026
1027 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
1028
1029 If the hardware supports programmable pattern offsets then
1030 this option should be set.
1031
1032 HARDWARE_PATTERN_SCREEN_ORIGIN
1033
1034 Some hardware wants the pattern offset specified with respect to the
1035 upper left-hand corner of the primitive being drawn. Other hardware
1036 needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that
1037 all pattern offsets should be referenced to the upper left-hand
1038 corner of the screen. HARDWARE_PATTERN_SCREEN_ORIGIN is preferable
1039 since this is more natural for the X-Window system and offsets will
1040 have to be recalculated for each Subsequent function otherwise.
1041
1042 NO_TRANSPARENCY
1043 TRANSPARENCY_GXCOPY_ONLY
1044
1045 These mean the same as for the ScreenToScreenCopy functions.
1046
1047
1048 The following table describes the meanings of patx and paty passed
1049 to the SetupFor and Subsequent fields:
1050
1051 HARDWARE_PATTERN_PROGRAMMED_ORIGIN && HARDWARE_PATTERN_SCREEN_ORIGIN
1052
1053 SetupFor: patx and paty hold the x,y location of the unrotated
1054 pattern.
1055
1056 Subsequent: patx and paty hold the pattern offset. For the case
1057 of HARDWARE_PATTERN_SCREEN_ORIGIN all Subsequent calls
1058 have the same offset so only the first call will need
1059 to be observed.
1060
1061
1062 HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
1063
1064 SetupFor: patx and paty hold the x,y location of the unrotated
1065 pattern.
1066
1067 Subsequent: patx and paty hold the pattern offset.
1068
1069 HARDWARE_PATTERN_SCREEN_ORIGIN
1070
1071 SetupFor: patx and paty hold the x,y location of the rotated pattern.
1072
1073 Subsequent: patx and paty hold the same location as the SetupFor
1074 function so these can be ignored.
1075
1076 neither flag
1077
1078 SetupFor: patx and paty hold the x,y location of the unrotated
1079 pattern. This can be ignored.
1080
1081 Subsequent: patx and paty hold the x,y location of the rotated
1082 pattern.
1083
1084 Additional information about cached patterns...
1085 All 8x8 color patterns are cached in offscreen video memory so
1086 the pixmap cache must be enabled to use them. The first pattern
1087 starts at the cache slot boundary which is set by the
1088 CachePixelGranularity field used to configure the pixmap cache.
1089 One should ensure that the CachePixelGranularity reflects any
1090 alignment restrictions that the accelerator may put on 8x8 pattern
1091 storage locations. When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set
1092 there is only one pattern stored. When this flag is not set,
1093 all 64 rotations off the pattern are accessible but it is assumed
1094 that the accelerator is capable of accessing data stored on 8
1095 pixel boundaries. If the accelerator has stricter alignment
1096 requirements than this the dirver will need to provide its own
1097 8x8 color pattern caching routines.
1098
1099
1100void SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
1101 int rop, unsigned int planemask, int trans_color)
1102
1103 SetupForColor8x8PatternFill indicates that any combination of the
1104 following may follow it.
1105
1106 SubsequentColor8x8PatternFillRect
1107 SubsequentColor8x8PatternFillTrap (not implemented yet)
1108
1109 For the meanings of patx and paty, see the table above. Trans_color
1110 means the same as for the ScreenToScreenCopy functions.
1111
1112
1113
1114void SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
1115 int patx, int paty, int x, int y, int w, int h)
1116
1117 Fill a rectangle of dimensions "w" by "h" with origin at (x,y)
1118 using the parameters give by the last SetupForColor8x8PatternFill
1119 call. The meanings of patx and paty can be determined by the
1120 table above.
1121
1122void SubsequentColor8x8PatternFillTrap( ScrnInfoPtr pScrn,
1123 int patx, int paty, int y, int h,
1124 int left, int dxL, int dyL, int eL,
1125 int right, int dxR, int dyR, int eR )
1126
1127 For the meanings of patx and paty, see the table above.
1128 The rest of the fields have the same meanings as those in the
1129 SubsequentSolidFillTrap function.
1130
1131
1132
11332.8 Image Writes
1134
1135 XAA provides a mechanism for transfering full color pixel data from
1136 system memory to video memory through the accelerator. This is
1137 useful for dealing with alignment issues and performing raster ops
1138 on the data when writing it to the framebuffer. As with color
1139 expansion rectangles, there is a direct and indirect method. The
1140 direct method sends all data through a memory mapped aperature.
1141 The indirect method sends the data to an intermediated buffer scanline
1142 at a time.
1143
1144 The direct and indirect methods have separate flags fields, the
1145 ImageWriteFlags and ScanlineImageWriteFlags respectively.
1146 Flags specific to one method or the other are described in sections
1147 2.8.1 and 2.8.2 but for both cases the GXCOPY_ONLY, ROP_NEEDS_SOURCE
1148 and NO_PLANEMASK flags described in Section 2.0 are valid as well as
1149 the following:
1150
1151 NO_GXCOPY
1152
1153 In order to have accelerated image transfers faster than the
1154 software versions for GXcopy, the engine needs to support clipping,
1155 be using the direct method and have a large enough image transfer
1156 range so that CPU_TRANSFER_BASE_FIXED doesn't need to be set.
1157 If these are not supported, then it is unlikely that transfering
1158 the data through the accelerator will be of any advantage for the
1159 simple case of GXcopy. In fact, it may be much slower. For such
1160 cases it's probably best to set the NO_GXCOPY flag so that
1161 Image writes will only be used for the more complicated rops.
1162
1163 /* transparency restrictions */
1164
1165 NO_TRANSPARENCY
1166
1167 This indicates that the accelerator does not support skipping
1168 of color keyed pixels when copying from the source to the destination.
1169
1170 TRANSPARENCY_GXCOPY_ONLY
1171
1172 This indicates that the accelerator supports skipping of color keyed
1173 pixels only when the rop is GXcopy.
1174
1175 /* clipping (optional) */
1176
1177 LEFT_EDGE_CLIPPING
1178
1179 This indicates that the accelerator supports omission of up to
1180 3 pixels on the left edge of the rectangle to be filled. This
1181 is beneficial since it allows transfer from the source pixmap to
1182 always occur from DWORD boundaries.
1183
1184 LEFT_EDGE_CLIPPING_NEGATIVE_X
1185
1186 This flag indicates that the accelerator can fill areas with
1187 image write data even if the value of x origin is negative (off of
1188 the screen on the left edge).
1189
1190
11912.8.1 The Direct Method
1192
1193 Using the direct method of ImageWrite XAA will send all
1194 bitmap data to the accelerator serially through an memory mapped
1195 transfer window defined by the following two fields:
1196
1197 unsigned char *ImageWriteBase
1198
1199 This indicates the memory address of the beginning of the aperture.
1200
1201 int ImageWriteRange
1202
1203 This indicates the size in bytes of the aperture.
1204
1205 The driver should specify how the transfered data should be padded.
1206 There are options for both the padding of each Y scanline and for the
1207 total transfer to the aperature.
1208 One of the following two flags must be set:
1209
1210 CPU_TRANSFER_PAD_DWORD
1211
1212 This indicates that the total transfer (sum of all scanlines) sent
1213 to the aperature must be DWORD padded. This is the default behavior.
1214
1215 CPU_TRANSFER_PAD_QWORD
1216
1217 This indicates that the total transfer (sum of all scanlines) sent
1218 to the aperature must be QWORD padded. With this set, XAA will send
1219 an extra DWORD to the aperature when needed to ensure that only
1220 an even number of DWORDs are sent.
1221
1222 And then there are the flags for padding of each scanline:
1223
1224 SCANLINE_PAD_DWORD
1225
1226 This indicates that each Y scanline should be DWORD padded.
1227 This is the only option available and is the default.
1228
1229 Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
1230 that the aperture is a single register rather than a range of
1231 registers, and XAA should write all of the data to the first DWORD.
1232 XAA will automatically select CPU_TRANSFER_BASE_FIXED if the
1233 ImageWriteRange is not large enough to accomodate an entire scanline.
1234
1235
1236void SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
1237 int trans_color, int bpp, int depth)
1238
1239 If trans_color is not -1 then trans_color indicates the transparency
1240 color key and pixels with color trans_color passed through the
1241 aperature should not be transfered to the screen but should be
1242 skipped. Bpp and depth indicate the bits per pixel and depth of
1243 the source pixmap. Trans_color is always -1 if the NO_TRANSPARENCY
1244 flag is set.
1245
1246
1247void SubsequentImageWriteRect(ScrnInfoPtr pScrn,
1248 int x, int y, int w, int h, int skipleft)
1249
1250
1251 Data passed through the aperature should be copied to a rectangle
1252 of width "w" and height "h" with origin (x,y). If LEFT_EDGE_CLIPPING
1253 has been enabled, skipleft will correspond to the number of pixels
1254 on the left edge that should not be drawn. Skipleft is zero
1255 otherwise.
1256
1257 It can be arranged for XAA to call Sync() after it is through
1258 calling the Subsequent functions by setting SYNC_AFTER_IMAGE_WRITE
1259 in the ImageWriteFlags. This can provide the driver with an
1260 oportunity to reset a clipping window if needed.
1261
12622.8.2 The Indirect Method
1263
1264 Using the indirect method, XAA will render the pixel data scanline
1265 at a time to one or more buffers. These buffers may be memory
1266 mapped apertures or just intermediate storage.
1267
1268 int NumScanlineImageWriteBuffers
1269
1270 This indicates the number of buffers available.
1271
1272 unsigned char **ScanlineImageWriteBuffers
1273
1274 This is an array of pointers to the memory locations of each buffer.
1275 Each buffer is expected to be large enough to accommodate scanlines
1276 the width of the screen. That is:
1277
1278 pScrn->VirtualX * pScreen->bitsPerPixel/8 bytes or more.
1279
1280 If LEFT_EDGE_CLIPPING_NEGATIVE_X is set, add an additional 4
1281 bytes to that requirement in 8 and 16bpp, 12 bytes in 24bpp.
1282
1283 Scanlines are always DWORD padded.
1284
1285void SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
1286 unsigned int planemask, int trans_color,
1287 int bpp, int depth)
1288
1289 If trans_color is not -1 then trans_color indicates the transparency
1290 color key and pixels with color trans_color in the buffer should not
1291 be transfered to the screen but should be skipped. Bpp and depth
1292 indicate the bits per pixel and depth of the source bitmap.
1293 Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
1294
1295
1296void SubsequentImageWriteRect(ScrnInfoPtr pScrn,
1297 int x, int y, int w, int h, int skipleft)
1298
1299
1300void SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
1301
1302
1303 When SubsequentImageWriteRect is called, XAA will begin
1304 transfering the source data scanline at a time, calling
1305 SubsequentImageWriteScanline after each scanline. If more than
1306 one buffer is available, XAA will cycle through the buffers.
1307 Subsequent scanlines will use the next buffer and go back to the
1308 buffer 0 again when the last buffer is reached. The index into
1309 the ScanlineImageWriteBuffers array is presented as "bufno"
1310 with each SubsequentImageWriteScanline call.
1311
1312 The skipleft field is the same as for the direct method.
1313
1314 The indirect method can be use to send the source data directly
1315 to a memory mapped aperture represented by a single image write
1316 buffer, scanline at a time, but more commonly it is used to place
1317 the data into offscreen video memory so that the accelerator can
1318 blit it to the visible screen from there. In the case where the
1319 accelerator permits rendering into offscreen video memory while
1320 the accelerator is active, several buffers can be used so that
1321 XAA can be placing source data into the next buffer while the
1322 accelerator is blitting the current buffer. For cases where
1323 the accelerator requires some special manipulation of the source
1324 data first, the buffers can be in system memory. The CPU can
1325 manipulate these buffers and then send the data to the accelerator.
1326
1327
13282.9 Clipping
1329
1330 XAA supports hardware clipping rectangles. To use clipping
1331 in this way it is expected that the graphics accelerator can
1332 clip primitives with verticies anywhere in the 16 bit signed
1333 coordinate system.
1334
1335void SetClippingRectangle ( ScrnInfoPtr pScrn,
1336 int left, int top, int right, int bottom)
1337
1338void DisableClipping (ScrnInfoPtr pScrn)
1339
1340 When SetClippingRectangle is called, all hardware rendering
1341 following it should be clipped to the rectangle specified
1342 until DisableClipping is called.
1343
1344 The ClippingFlags field indicates which operations this sort
1345 of Set/Disable pairing can be used with. Any of the following
1346 flags may be OR'd together.
1347
1348 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
1349 HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
1350 HARDWARE_CLIP_MONO_8x8_FILL
1351 HARDWARE_CLIP_COLOR_8x8_FILL
1352 HARDWARE_CLIP_SOLID_FILL
1353 HARDWARE_CLIP_DASHED_LINE
1354 HARDWARE_CLIP_SOLID_LINE
1355
1356
1357
13583) XAA PIXMAP CACHE
1359
1360 /* NOTE: XAA has no knowledge of framebuffer particulars so until
1361 the framebuffer is able to render into offscreen memory, usage
1362 of the pixmap cache requires that the driver provide ImageWrite
1363 routines or a WritePixmap or WritePixmapToCache replacement so
1364 that patterns can even be placed in the cache.
1365
1366 ADDENDUM: XAA can now load the pixmap cache without requiring
1367 that the driver supply an ImageWrite function, but this can
1368 only be done on linear framebuffers. If you have a linear
1369 framebuffer, set LINEAR_FRAMEBUFFER in the XAAInfoRec.Flags
1370 field and XAA will then be able to upload pixmaps into the
1371 cache without the driver providing functions to do so.
1372 */
1373
1374
1375 The XAA pixmap cache provides a mechanism for caching of patterns
1376 in offscreen video memory so that tiled fills and in some cases
1377 stippling can be done by blitting the source patterns from offscreen
1378 video memory. The pixmap cache also provides the mechanism for caching
1379 of 8x8 color and mono hardware patterns. Any unused offscreen video
1380 memory gets used for the pixmap cache and that information is
1381 provided by the XFree86 Offscreen Memory Manager. XAA registers a
1382 callback with the manager so that it can be informed of any changes
1383 in the offscreen memory configuration. The driver writer does not
1384 need to deal with any of this since it is all automatic. The driver
1385 merely needs to initialize the Offscreen Memory Manager as described
1386 in the DESIGN document and set the PIXMAP_CACHE flag in the
1387 XAAInfoRec.Flags field. The Offscreen Memory Manager initialization
1388 must occur before XAA is initialized or else pixmap cache
1389 initialization will fail.
1390
1391 PixmapCacheFlags is an XAAInfoRec field which allows the driver to
1392 control pixmap cache behavior to some extent. Currently only one
1393 flag is defined:
1394
1395 DO_NOT_BLIT_STIPPLES
1396
1397 This indicates that the stippling should not be done by blitting
1398 from the pixmap cache. This does not apply to 8x8 pattern fills.
1399
1400
1401 CachePixelGranularity is an optional field. If the hardware requires
1402 that a 8x8 patterns have some particular pixel alignment it should
1403 be reflected in this field. Ignoring this field or setting it to
1404 zero or one means there are no alignment issues.
1405
1406
14074) OFFSCREEN PIXMAPS
1408
1409 XAA has the ability to store pixmap drawables in offscreen video
1410 memory and render into them with full hardware acceleration. Placement
1411 of pixmaps in the cache is done automatically on a first-come basis and
1412 only if there is room. To enable this feature, set the OFFSCREEN_PIXMAPS
1413 flag in the XAAInfoRec.Flags field. This is only available when a
1414 ScreenToScreenCopy function is provided, when the Offscreen memory
1415 manager has been initialized and when the LINEAR_FRAMEBUFFER flag is
1416 also set.
1417
1418 int maxOffPixWidth
1419 int maxOffPixHeight
1420
1421 These two fields allow the driver to limit the maximum dimensions
1422 of an offscreen pixmap. If one of these is not set, it is assumed
1423 that there is no limit on that dimension. Note that if an offscreen
1424 pixmap with a particular dimension is allowed, then your driver will be
1425 expected to render primitives as large as that pixmap.
1426
1427$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.12 2000/04/12 14:44:42 tsi Exp $
diff --git a/hw/xfree86/xaa/xaa.h b/hw/xfree86/xaa/xaa.h
deleted file mode 100644
index b530037c9..000000000
--- a/hw/xfree86/xaa/xaa.h
+++ /dev/null
@@ -1,1038 +0,0 @@
1
2#ifndef _XAA_H
3#define _XAA_H
4
5#define XAA_VERSION_MAJOR 1
6#define XAA_VERSION_MINOR 2
7#define XAA_VERSION_RELEASE 1
8
9/*
10
11 ******** OPERATION SPECIFIC FLAGS *********
12
13 **** solid/dashed line flags ****
14
15--------- --------
1623 LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
1722 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
1821 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
1920 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
2019 LINE_PATTERN_POWER_OF_2_ONLY
2118 LINE_LIMIT_COORDS
2217 .
2316 .
24--------- -------
25
26 **** screen to screen copy flags ****
27
28--------- --------
2923 ONLY_LEFT_TO_RIGHT_BITBLT
3022 ONLY_TWO_BITBLT_DIRECTIONS
3121 .
3220 .
3319 .
3418 .
3517 .
3616 .
37--------- -------
38
39 **** clipping flags ****
40
41--------- --------
4223 .
4322 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
4421 HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
4520 HARDWARE_CLIP_MONO_8x8_FILL
4619 HARDWARE_CLIP_COLOR_8x8_FILL
4718 HARDWARE_CLIP_SOLID_FILL
4817 HARDWARE_CLIP_DASHED_LINE
4916 HARDWARE_CLIP_SOLID_LINE
50--------- -------
51
52 **** hardware pattern flags ****
53
54--------- --------
5523 .
5622 .
5721 HARDWARE_PATTERN_SCREEN_ORIGIN
5820 .
5919 .
6018 .
6117 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
6216 HARDWARE_PATTERN_PROGRAMMED_BITS
63--------- -------
64
65 **** write pixmap flags ****
66
67--------- --------
6823 .
6922 .
7021 .
7120 .
7219 .
7318 .
7417 .
7516 CONVERT_32BPP_TO_24BPP
76--------- -------
77
78 ******** GENERIC FLAGS *********
79
80--------- -------
8115 SYNC_AFTER_COLOR_EXPAND
8214 CPU_TRANSFER_PAD_QWORD
8313 .
8412 LEFT_EDGE_CLIPPING_NEGATIVE_X
8511 LEFT_EDGE_CLIPPING
8610 CPU_TRANSFER_BASE_FIXED
87 9 BIT_ORDER_IN_BYTE_MSBFIRST
88 8 TRANSPARENCY_GXCOPY_ONLY
89--------- -------
90 7 NO_TRANSPARENCY
91 6 TRANSPARENCY_ONLY
92 5 ROP_NEEDS_SOURCE
93 4 TRIPLE_BITS_24BPP
94 3 RGB_EQUAL
95 2 NO_PLANEMASK
96 1 NO_GXCOPY
97 0 GXCOPY_ONLY
98--------- -------
99
100
101*/
102
103#include "gcstruct.h"
104#include "pixmapstr.h"
105#include "xf86str.h"
106#include "regionstr.h"
107#include "xf86fbman.h"
108
109#include "picturestr.h"
110
111/* Flags */
112#define PIXMAP_CACHE 0x00000001
113#define MICROSOFT_ZERO_LINE_BIAS 0x00000002
114#define OFFSCREEN_PIXMAPS 0x00000004
115#define LINEAR_FRAMEBUFFER 0x00000008
116
117/* GC fg, bg, and planemask restrictions */
118#define GXCOPY_ONLY 0x00000001
119#define NO_GXCOPY 0x00000002
120#define NO_PLANEMASK 0x00000004
121#define RGB_EQUAL 0x00000008
122#define TRIPLE_BITS_24BPP 0x00000010
123#define ROP_NEEDS_SOURCE 0x00000020
124
125/* transparency restrictions */
126#define TRANSPARENCY_ONLY 0x00000040
127#define NO_TRANSPARENCY 0x00000080
128#define TRANSPARENCY_GXCOPY_ONLY 0x00000100
129
130/* bit order restrictions */
131#define BIT_ORDER_IN_BYTE_MSBFIRST 0x00000200
132#define BIT_ORDER_IN_BYTE_LSBFIRST 0x00000000
133
134/* transfer base restriction */
135#define CPU_TRANSFER_BASE_FIXED 0x00000400
136
137/* skipleft restrictions */
138#define LEFT_EDGE_CLIPPING 0x00000800
139#define LEFT_EDGE_CLIPPING_NEGATIVE_X 0x00001000
140
141/* data padding */
142#define CPU_TRANSFER_PAD_DWORD 0x00000000
143#define CPU_TRANSFER_PAD_QWORD 0x00004000
144#define SCANLINE_PAD_DWORD 0x00000000
145
146#define SYNC_AFTER_COLOR_EXPAND 0x00008000
147#define SYNC_AFTER_IMAGE_WRITE SYNC_AFTER_COLOR_EXPAND
148
149/* hardware pattern */
150#define HARDWARE_PATTERN_PROGRAMMED_BITS 0x00010000
151#define HARDWARE_PATTERN_PROGRAMMED_ORIGIN 0x00020000
152#define HARDWARE_PATTERN_SCREEN_ORIGIN 0x00200000
153
154/* copyarea flags */
155#define ONLY_TWO_BITBLT_DIRECTIONS 0x00400000
156#define ONLY_LEFT_TO_RIGHT_BITBLT 0x00800000
157
158/* line flags */
159#define LINE_PATTERN_LSBFIRST_MSBJUSTIFIED 0x00800000
160#define LINE_PATTERN_LSBFIRST_LSBJUSTIFIED 0x00400000
161#define LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 0x00200000
162#define LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 0x00100000
163#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000
164#define LINE_LIMIT_COORDS 0x00040000
165
166/* clipping flags */
167#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND 0x00400000
168#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY 0x00200000
169#define HARDWARE_CLIP_MONO_8x8_FILL 0x00100000
170#define HARDWARE_CLIP_COLOR_8x8_FILL 0x00080000
171#define HARDWARE_CLIP_SOLID_FILL 0x00040000
172#define HARDWARE_CLIP_DASHED_LINE 0x00020000
173#define HARDWARE_CLIP_SOLID_LINE 0x00010000
174
175#define HARDWARE_CLIP_LINE 0x00000000
176
177/* image write flags */
178#define CONVERT_32BPP_TO_24BPP 0x00010000
179
180/* pixmap cache flags */
181#define CACHE_MONO_8x8 0x00000001
182#define CACHE_COLOR_8x8 0x00000002
183#define DO_NOT_BLIT_STIPPLES 0x00000004
184#define DO_NOT_TILE_MONO_DATA 0x00000008
185#define DO_NOT_TILE_COLOR_DATA 0x00000010
186
187#define DEGREES_0 0
188#define DEGREES_90 1
189#define DEGREES_180 2
190#define DEGREES_270 3
191
192#define OMIT_LAST 1
193
194/* render flags */
195
196#define XAA_RENDER_POWER_OF_2_TILE_ONLY 0x00000008
197#define XAA_RENDER_NO_SRC_ALPHA 0x00000004
198#define XAA_RENDER_IMPRECISE_ONLY 0x00000002
199#define XAA_RENDER_NO_TILE 0x00000001
200
201#define XAA_RENDER_REPEAT 0x00000001
202
203typedef void (*ValidateGCProcPtr) (GCPtr pGC,
204 unsigned long changes, DrawablePtr pDraw);
205
206typedef struct {
207 unsigned char *bits;
208 int width;
209 int height;
210 int yoff;
211 int srcwidth;
212 int start;
213 int end;
214} NonTEGlyphInfo, *NonTEGlyphPtr;
215
216typedef struct {
217 int x;
218 int y;
219 int w;
220 int h;
221 int orig_w;
222 int orig_h;
223 unsigned long serialNumber;
224 int pat0;
225 int pat1;
226 int fg;
227 int bg;
228 int trans_color;
229 DDXPointPtr offsets;
230 DevUnion devPrivate;
231} XAACacheInfoRec, *XAACacheInfoPtr;
232
233typedef struct _PixmapLink {
234 PixmapPtr pPix;
235 struct _PixmapLink *next;
236 FBAreaPtr area;
237} PixmapLink, *PixmapLinkPtr;
238
239typedef struct _XAAInfoRec {
240 ScrnInfoPtr pScrn;
241 int Flags;
242
243 void (*Sync) (ScrnInfoPtr pScrn);
244
245 /* Restore Accel State is a driver callback that is used
246 * when another screen on the same device has been active.
247 * This allows multihead on a single device to work.
248 * If The entityProp has IS_SHARED_ACCEL defined then this
249 * function is required.
250 */
251
252 void (*RestoreAccelState) (ScrnInfoPtr pScrn);
253
254 /***************** Low Level *****************/
255
256/* Blits */
257 void (*SetupForScreenToScreenCopy) (ScrnInfoPtr pScrn,
258 int xdir, int ydir,
259 int rop,
260 unsigned int planemask,
261 int trans_color);
262 int ScreenToScreenCopyFlags;
263
264 void (*SubsequentScreenToScreenCopy) (ScrnInfoPtr pScrn,
265 int xsrc, int ysrc,
266 int xdst, int ydst, int w, int h);
267
268/* Solid fills */
269 void (*SetupForSolidFill) (ScrnInfoPtr pScrn,
270 int color, int rop, unsigned int planemask);
271 int SolidFillFlags;
272
273 void (*SubsequentSolidFillRect) (ScrnInfoPtr pScrn,
274 int x, int y, int w, int h);
275
276 void (*SubsequentSolidFillTrap) (ScrnInfoPtr pScrn,
277 int y, int h,
278 int left, int dxL, int dyL, int eL,
279 int right, int dxR, int dyR, int eR);
280
281/* Solid lines */
282
283 void (*SetupForSolidLine) (ScrnInfoPtr pScrn,
284 int color, int rop, unsigned int planemask);
285 int SolidLineFlags;
286
287 void (*SubsequentSolidTwoPointLine) (ScrnInfoPtr pScrn,
288 int xa, int ya, int xb, int yb,
289 int flags);
290
291 void (*SubsequentSolidBresenhamLine) (ScrnInfoPtr pScrn,
292 int x, int y, int absmaj, int absmin,
293 int err, int len, int octant);
294 int SolidBresenhamLineErrorTermBits;
295
296 void (*SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn,
297 int x, int y, int len, int dir);
298
299/* Dashed lines */
300
301 void (*SetupForDashedLine) (ScrnInfoPtr pScrn,
302 int fg, int bg,
303 int rop,
304 unsigned int planemask,
305 int length, unsigned char *pattern);
306 int DashedLineFlags;
307 int DashPatternMaxLength;
308
309 void (*SubsequentDashedTwoPointLine) (ScrnInfoPtr pScrn,
310 int xa, int ya, int xb, int yb,
311 int flags, int phase);
312
313 void (*SubsequentDashedBresenhamLine) (ScrnInfoPtr pScrn,
314 int x, int y, int absmaj, int absmin,
315 int err, int len, int flags,
316 int phase);
317 int DashedBresenhamLineErrorTermBits;
318
319/* Clipper */
320
321 void (*SetClippingRectangle) (ScrnInfoPtr pScrn,
322 int left, int top, int right, int bottom);
323 int ClippingFlags;
324
325 void (*DisableClipping) (ScrnInfoPtr pScrn);
326
327/* 8x8 mono pattern fills */
328 void (*SetupForMono8x8PatternFill) (ScrnInfoPtr pScrn,
329 int patx, int paty,
330 int fg, int bg,
331 int rop, unsigned int planemask);
332 int Mono8x8PatternFillFlags;
333
334 void (*SubsequentMono8x8PatternFillRect) (ScrnInfoPtr pScrn,
335 int patx, int paty,
336 int x, int y, int w, int h);
337
338 void (*SubsequentMono8x8PatternFillTrap) (ScrnInfoPtr pScrn,
339 int patx, int paty,
340 int y, int h,
341 int left, int dxL, int dyL,
342 int eL, int right, int dxR,
343 int dyR, int eR);
344
345/* 8x8 color pattern fills */
346
347 void (*SetupForColor8x8PatternFill) (ScrnInfoPtr pScrn,
348 int patx, int paty,
349 int rop,
350 unsigned int planemask,
351 int transparency_color);
352 int Color8x8PatternFillFlags;
353
354 void (*SubsequentColor8x8PatternFillRect) (ScrnInfoPtr pScrn,
355 int patx, int paty,
356 int x, int y, int w, int h);
357
358 void (*SubsequentColor8x8PatternFillTrap) (ScrnInfoPtr pScrn,
359 int patx, int paty,
360 int y, int h,
361 int left, int dxL, int dyL,
362 int eL, int right, int dxR,
363 int dyR, int eR);
364
365/* Color expansion */
366
367 void (*SetupForCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
368 int fg, int bg,
369 int rop,
370 unsigned int planemask);
371 int CPUToScreenColorExpandFillFlags;
372
373 void (*SubsequentCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
374 int x, int y, int w, int h,
375 int skipleft);
376
377 unsigned char *ColorExpandBase;
378 int ColorExpandRange;
379
380/* Scanline color expansion */
381
382 void (*SetupForScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
383 int fg, int bg,
384 int rop,
385 unsigned int planemask);
386 int ScanlineCPUToScreenColorExpandFillFlags;
387
388 void (*SubsequentScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
389 int x, int y, int w,
390 int h, int skipleft);
391
392 void (*SubsequentColorExpandScanline) (ScrnInfoPtr pScrn, int bufno);
393
394 int NumScanlineColorExpandBuffers;
395 unsigned char **ScanlineColorExpandBuffers;
396
397/* Screen to screen color expansion */
398
399 void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
400 int fg, int bg,
401 int rop,
402 unsigned int planemask);
403 int ScreenToScreenColorExpandFillFlags;
404
405 void (*SubsequentScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
406 int x, int y, int w, int h,
407 int srcx, int srcy,
408 int skipleft);
409
410/* Image transfers */
411
412 void (*SetupForImageWrite) (ScrnInfoPtr pScrn,
413 int rop,
414 unsigned int planemask,
415 int transparency_color, int bpp, int depth);
416 int ImageWriteFlags;
417
418 void (*SubsequentImageWriteRect) (ScrnInfoPtr pScrn,
419 int x, int y, int w, int h, int skipleft);
420 unsigned char *ImageWriteBase;
421 int ImageWriteRange;
422
423/* Scanline Image transfers */
424
425 void (*SetupForScanlineImageWrite) (ScrnInfoPtr pScrn,
426 int rop,
427 unsigned int planemask,
428 int transparency_color,
429 int bpp, int depth);
430 int ScanlineImageWriteFlags;
431
432 void (*SubsequentScanlineImageWriteRect) (ScrnInfoPtr pScrn,
433 int x, int y, int w, int h,
434 int skipleft);
435
436 void (*SubsequentImageWriteScanline) (ScrnInfoPtr pScrn, int bufno);
437
438 int NumScanlineImageWriteBuffers;
439 unsigned char **ScanlineImageWriteBuffers;
440
441 /* Image Reads - OBSOLETE AND NOT USED */
442
443 void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
444 int ImageReadFlags;
445
446 unsigned char *ImageReadBase;
447 int ImageReadRange;
448
449 void (*SubsequentImageReadRect) (ScrnInfoPtr pScrn,
450 int x, int y, int w, int h);
451
452 /***************** Mid Level *****************/
453 void (*ScreenToScreenBitBlt) (ScrnInfoPtr pScrn,
454 int nbox,
455 DDXPointPtr pptSrc,
456 BoxPtr pbox,
457 int xdir, int ydir,
458 int alu, unsigned int planmask);
459 int ScreenToScreenBitBltFlags;
460
461 void (*WriteBitmap) (ScrnInfoPtr pScrn,
462 int x, int y, int w, int h,
463 unsigned char *src,
464 int srcwidth,
465 int skipleft,
466 int fg, int bg, int rop, unsigned int planemask);
467 int WriteBitmapFlags;
468
469 void (*FillSolidRects) (ScrnInfoPtr pScrn,
470 int fg, int rop,
471 unsigned int planemask, int nBox, BoxPtr pBox);
472 int FillSolidRectsFlags;
473
474 void (*FillMono8x8PatternRects) (ScrnInfoPtr pScrn,
475 int fg, int bg, int rop,
476 unsigned int planemask,
477 int nBox,
478 BoxPtr pBox,
479 int pat0, int pat1, int xorg, int yorg);
480 int FillMono8x8PatternRectsFlags;
481
482 void (*FillColor8x8PatternRects) (ScrnInfoPtr pScrn,
483 int rop,
484 unsigned int planemask,
485 int nBox,
486 BoxPtr pBox,
487 int xorg, int yorg,
488 XAACacheInfoPtr pCache);
489 int FillColor8x8PatternRectsFlags;
490
491 void (*FillCacheBltRects) (ScrnInfoPtr pScrn,
492 int rop,
493 unsigned int planemask,
494 int nBox,
495 BoxPtr pBox,
496 int xorg, int yorg, XAACacheInfoPtr pCache);
497 int FillCacheBltRectsFlags;
498
499 void (*FillColorExpandRects) (ScrnInfoPtr pScrn,
500 int fg, int bg, int rop,
501 unsigned int planemask,
502 int nBox,
503 BoxPtr pBox,
504 int xorg, int yorg, PixmapPtr pPix);
505 int FillColorExpandRectsFlags;
506
507 void (*FillCacheExpandRects) (ScrnInfoPtr pScrn,
508 int fg, int bg, int rop,
509 unsigned int planemask,
510 int nBox,
511 BoxPtr pBox,
512 int xorg, int yorg, PixmapPtr pPix);
513 int FillCacheExpandRectsFlags;
514
515 void (*FillImageWriteRects) (ScrnInfoPtr pScrn,
516 int rop,
517 unsigned int planemask,
518 int nBox,
519 BoxPtr pBox,
520 int xorg, int yorg, PixmapPtr pPix);
521 int FillImageWriteRectsFlags;
522
523 void (*FillSolidSpans) (ScrnInfoPtr pScrn,
524 int fg, int rop,
525 unsigned int planemask,
526 int n,
527 DDXPointPtr points, int *widths, int fSorted);
528 int FillSolidSpansFlags;
529
530 void (*FillMono8x8PatternSpans) (ScrnInfoPtr pScrn,
531 int fg, int bg, int rop,
532 unsigned int planemask,
533 int n,
534 DDXPointPtr points,
535 int *widths,
536 int fSorted,
537 int pat0, int pat1, int xorg, int yorg);
538 int FillMono8x8PatternSpansFlags;
539
540 void (*FillColor8x8PatternSpans) (ScrnInfoPtr pScrn,
541 int rop,
542 unsigned int planemask,
543 int n,
544 DDXPointPtr points,
545 int *widths,
546 int fSorted,
547 XAACacheInfoPtr pCache,
548 int xorg, int yorg);
549 int FillColor8x8PatternSpansFlags;
550
551 void (*FillCacheBltSpans) (ScrnInfoPtr pScrn,
552 int rop,
553 unsigned int planemask,
554 int n,
555 DDXPointPtr points,
556 int *widths,
557 int fSorted,
558 XAACacheInfoPtr pCache, int xorg, int yorg);
559 int FillCacheBltSpansFlags;
560
561 void (*FillColorExpandSpans) (ScrnInfoPtr pScrn,
562 int fg, int bg, int rop,
563 unsigned int planemask,
564 int n,
565 DDXPointPtr points,
566 int *widths,
567 int fSorted,
568 int xorg, int yorg, PixmapPtr pPix);
569 int FillColorExpandSpansFlags;
570
571 void (*FillCacheExpandSpans) (ScrnInfoPtr pScrn,
572 int fg, int bg, int rop,
573 unsigned int planemask,
574 int n,
575 DDXPointPtr ppt,
576 int *pwidth,
577 int fSorted,
578 int xorg, int yorg, PixmapPtr pPix);
579 int FillCacheExpandSpansFlags;
580
581 void (*TEGlyphRenderer) (ScrnInfoPtr pScrn,
582 int x, int y, int w, int h, int skipleft,
583 int startline, unsigned int **glyphs,
584 int glyphWidth, int fg, int bg, int rop,
585 unsigned planemask);
586 int TEGlyphRendererFlags;
587
588 void (*NonTEGlyphRenderer) (ScrnInfoPtr pScrn,
589 int x, int y, int n,
590 NonTEGlyphPtr glyphs,
591 BoxPtr pbox,
592 int fg, int rop, unsigned int planemask);
593 int NonTEGlyphRendererFlags;
594
595 void (*WritePixmap) (ScrnInfoPtr pScrn,
596 int x, int y, int w, int h,
597 unsigned char *src,
598 int srcwidth,
599 int rop,
600 unsigned int planemask,
601 int transparency_color, int bpp, int depth);
602 int WritePixmapFlags;
603
604 void (*ReadPixmap) (ScrnInfoPtr pScrn,
605 int x, int y, int w, int h,
606 unsigned char *dst, int dstwidth, int bpp, int depth);
607 int ReadPixmapFlags;
608
609 /***************** GC Level *****************/
610 RegionPtr (*CopyArea) (DrawablePtr pSrcDrawable,
611 DrawablePtr pDstDrawable,
612 GC * pGC,
613 int srcx, int srcy,
614 int width, int height, int dstx, int dsty);
615 int CopyAreaFlags;
616
617 RegionPtr (*CopyPlane) (DrawablePtr pSrc,
618 DrawablePtr pDst,
619 GCPtr pGC,
620 int srcx, int srcy,
621 int width, int height,
622 int dstx, int dsty, unsigned long bitPlane);
623 int CopyPlaneFlags;
624
625 void (*PushPixelsSolid) (GCPtr pGC,
626 PixmapPtr pBitMap,
627 DrawablePtr pDrawable,
628 int dx, int dy, int xOrg, int yOrg);
629 int PushPixelsFlags;
630
631 /** PolyFillRect **/
632
633 void (*PolyFillRectSolid) (DrawablePtr pDraw,
634 GCPtr pGC, int nrectFill, xRectangle *prectInit);
635 int PolyFillRectSolidFlags;
636
637 void (*PolyFillRectStippled) (DrawablePtr pDraw,
638 GCPtr pGC,
639 int nrectFill, xRectangle *prectInit);
640 int PolyFillRectStippledFlags;
641
642 void (*PolyFillRectOpaqueStippled) (DrawablePtr pDraw,
643 GCPtr pGC,
644 int nrectFill, xRectangle *prectInit);
645 int PolyFillRectOpaqueStippledFlags;
646
647 void (*PolyFillRectTiled) (DrawablePtr pDraw,
648 GCPtr pGC, int nrectFill, xRectangle *prectInit);
649 int PolyFillRectTiledFlags;
650
651 /** FillSpans **/
652
653 void (*FillSpansSolid) (DrawablePtr pDraw,
654 GCPtr pGC,
655 int nInit,
656 DDXPointPtr ppt, int *pwidth, int fSorted);
657 int FillSpansSolidFlags;
658
659 void (*FillSpansStippled) (DrawablePtr pDraw,
660 GCPtr pGC,
661 int nInit,
662 DDXPointPtr ppt, int *pwidth, int fSorted);
663 int FillSpansStippledFlags;
664
665 void (*FillSpansOpaqueStippled) (DrawablePtr pDraw,
666 GCPtr pGC,
667 int nInit,
668 DDXPointPtr ppt, int *pwidth, int fSorted);
669 int FillSpansOpaqueStippledFlags;
670
671 void (*FillSpansTiled) (DrawablePtr pDraw,
672 GCPtr pGC,
673 int nInit,
674 DDXPointPtr ppt, int *pwidth, int fSorted);
675 int FillSpansTiledFlags;
676
677 int (*PolyText8TE) (DrawablePtr pDraw,
678 GCPtr pGC, int x, int y, int count, char *chars);
679 int PolyText8TEFlags;
680
681 int (*PolyText16TE) (DrawablePtr pDraw,
682 GCPtr pGC,
683 int x, int y, int count, unsigned short *chars);
684 int PolyText16TEFlags;
685
686 void (*ImageText8TE) (DrawablePtr pDraw,
687 GCPtr pGC, int x, int y, int count, char *chars);
688 int ImageText8TEFlags;
689
690 void (*ImageText16TE) (DrawablePtr pDraw,
691 GCPtr pGC,
692 int x, int y, int count, unsigned short *chars);
693 int ImageText16TEFlags;
694
695 void (*ImageGlyphBltTE) (DrawablePtr pDrawable,
696 GCPtr pGC,
697 int xInit, int yInit,
698 unsigned int nglyph,
699 CharInfoPtr * ppci, pointer pglyphBase);
700 int ImageGlyphBltTEFlags;
701
702 void (*PolyGlyphBltTE) (DrawablePtr pDrawable,
703 GCPtr pGC,
704 int xInit, int yInit,
705 unsigned int nglyph,
706 CharInfoPtr * ppci, pointer pglyphBase);
707 int PolyGlyphBltTEFlags;
708
709 int (*PolyText8NonTE) (DrawablePtr pDraw,
710 GCPtr pGC, int x, int y, int count, char *chars);
711 int PolyText8NonTEFlags;
712
713 int (*PolyText16NonTE) (DrawablePtr pDraw,
714 GCPtr pGC,
715 int x, int y, int count, unsigned short *chars);
716 int PolyText16NonTEFlags;
717
718 void (*ImageText8NonTE) (DrawablePtr pDraw,
719 GCPtr pGC, int x, int y, int count, char *chars);
720 int ImageText8NonTEFlags;
721
722 void (*ImageText16NonTE) (DrawablePtr pDraw,
723 GCPtr pGC,
724 int x, int y, int count, unsigned short *chars);
725 int ImageText16NonTEFlags;
726
727 void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable,
728 GCPtr pGC,
729 int xInit, int yInit,
730 unsigned int nglyph,
731 CharInfoPtr * ppci, pointer pglyphBase);
732 int ImageGlyphBltNonTEFlags;
733
734 void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable,
735 GCPtr pGC,
736 int xInit, int yInit,
737 unsigned int nglyph,
738 CharInfoPtr * ppci, pointer pglyphBase);
739 int PolyGlyphBltNonTEFlags;
740
741 void (*PolyRectangleThinSolid) (DrawablePtr pDrawable,
742 GCPtr pGC,
743 int nRectsInit, xRectangle *pRectsInit);
744 int PolyRectangleThinSolidFlags;
745
746 void (*PolylinesWideSolid) (DrawablePtr pDrawable,
747 GCPtr pGC, int mode, int npt, DDXPointPtr pPts);
748 int PolylinesWideSolidFlags;
749
750 void (*PolylinesThinSolid) (DrawablePtr pDrawable,
751 GCPtr pGC, int mode, int npt, DDXPointPtr pPts);
752 int PolylinesThinSolidFlags;
753
754 void (*PolySegmentThinSolid) (DrawablePtr pDrawable,
755 GCPtr pGC, int nseg, xSegment * pSeg);
756 int PolySegmentThinSolidFlags;
757
758 void (*PolylinesThinDashed) (DrawablePtr pDrawable,
759 GCPtr pGC,
760 int mode, int npt, DDXPointPtr pPts);
761 int PolylinesThinDashedFlags;
762
763 void (*PolySegmentThinDashed) (DrawablePtr pDrawable,
764 GCPtr pGC, int nseg, xSegment * pSeg);
765 int PolySegmentThinDashedFlags;
766
767 void (*FillPolygonSolid) (DrawablePtr pDrawable,
768 GCPtr pGC,
769 int shape,
770 int mode, int count, DDXPointPtr ptsIn);
771 int FillPolygonSolidFlags;
772
773 void (*FillPolygonStippled) (DrawablePtr pDrawable,
774 GCPtr pGC,
775 int shape,
776 int mode, int count, DDXPointPtr ptsIn);
777 int FillPolygonStippledFlags;
778
779 void (*FillPolygonOpaqueStippled) (DrawablePtr pDrawable,
780 GCPtr pGC,
781 int shape,
782 int mode, int count, DDXPointPtr ptsIn);
783 int FillPolygonOpaqueStippledFlags;
784
785 void (*FillPolygonTiled) (DrawablePtr pDrawable,
786 GCPtr pGC,
787 int shape,
788 int mode, int count, DDXPointPtr ptsIn);
789 int FillPolygonTiledFlags;
790
791 void (*PolyFillArcSolid) (DrawablePtr pDraw,
792 GCPtr pGC, int narcs, xArc * parcs);
793 int PolyFillArcSolidFlags;
794
795 void (*PutImage) (DrawablePtr pDraw,
796 GCPtr pGC,
797 int depth,
798 int x,
799 int y,
800 int w, int h, int leftPad, int format, char *pImage);
801 int PutImageFlags;
802
803 /* Validation masks */
804
805 unsigned long FillSpansMask;
806 ValidateGCProcPtr ValidateFillSpans;
807 unsigned long SetSpansMask;
808 ValidateGCProcPtr ValidateSetSpans;
809 unsigned long PutImageMask;
810 ValidateGCProcPtr ValidatePutImage;
811 unsigned long CopyAreaMask;
812 ValidateGCProcPtr ValidateCopyArea;
813 unsigned long CopyPlaneMask;
814 ValidateGCProcPtr ValidateCopyPlane;
815 unsigned long PolyPointMask;
816 ValidateGCProcPtr ValidatePolyPoint;
817 unsigned long PolylinesMask;
818 ValidateGCProcPtr ValidatePolylines;
819 unsigned long PolySegmentMask;
820 ValidateGCProcPtr ValidatePolySegment;
821 unsigned long PolyRectangleMask;
822 ValidateGCProcPtr ValidatePolyRectangle;
823 unsigned long PolyArcMask;
824 ValidateGCProcPtr ValidatePolyArc;
825 unsigned long FillPolygonMask;
826 ValidateGCProcPtr ValidateFillPolygon;
827 unsigned long PolyFillRectMask;
828 ValidateGCProcPtr ValidatePolyFillRect;
829 unsigned long PolyFillArcMask;
830 ValidateGCProcPtr ValidatePolyFillArc;
831 unsigned long PolyText8Mask;
832 ValidateGCProcPtr ValidatePolyText8;
833 unsigned long PolyText16Mask;
834 ValidateGCProcPtr ValidatePolyText16;
835 unsigned long ImageText8Mask;
836 ValidateGCProcPtr ValidateImageText8;
837 unsigned long ImageText16Mask;
838 ValidateGCProcPtr ValidateImageText16;
839 unsigned long PolyGlyphBltMask;
840 ValidateGCProcPtr ValidatePolyGlyphBlt;
841 unsigned long ImageGlyphBltMask;
842 ValidateGCProcPtr ValidateImageGlyphBlt;
843 unsigned long PushPixelsMask;
844 ValidateGCProcPtr ValidatePushPixels;
845
846 void (*ComputeDash) (GCPtr pGC);
847
848 /* Pixmap Cache */
849
850 int PixmapCacheFlags;
851 Bool UsingPixmapCache;
852 Bool CanDoMono8x8;
853 Bool CanDoColor8x8;
854
855 void (*InitPixmapCache) (ScreenPtr pScreen, RegionPtr areas, pointer data);
856 void (*ClosePixmapCache) (ScreenPtr pScreen);
857
858 int (*StippledFillChooser) (GCPtr pGC);
859 int (*OpaqueStippledFillChooser) (GCPtr pGC);
860 int (*TiledFillChooser) (GCPtr pGC);
861
862 int CachePixelGranularity;
863 int MaxCacheableTileWidth;
864 int MaxCacheableTileHeight;
865 int MaxCacheableStippleWidth;
866 int MaxCacheableStippleHeight;
867
868 XAACacheInfoPtr(*CacheTile) (ScrnInfoPtr Scrn, PixmapPtr pPix);
869 XAACacheInfoPtr(*CacheStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix,
870 int fg, int bg);
871 XAACacheInfoPtr(*CacheMonoStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix);
872 XAACacheInfoPtr(*CacheMono8x8Pattern) (ScrnInfoPtr Scrn, int pat0,
873 int pat1);
874 XAACacheInfoPtr(*CacheColor8x8Pattern) (ScrnInfoPtr Scrn, PixmapPtr pPix,
875 int fg, int bg);
876
877 int MonoPatternPitch;
878 int CacheWidthMono8x8Pattern;
879 int CacheHeightMono8x8Pattern;
880
881 int ColorPatternPitch;
882 int CacheWidthColor8x8Pattern;
883 int CacheHeightColor8x8Pattern;
884
885 int CacheColorExpandDensity;
886
887 void (*WriteBitmapToCache) (ScrnInfoPtr pScrn,
888 int x, int y, int w, int h,
889 unsigned char *src,
890 int srcwidth, int fg, int bg);
891 void (*WritePixmapToCache) (ScrnInfoPtr pScrn,
892 int x, int y, int w, int h,
893 unsigned char *src,
894 int srcwidth, int bpp, int depth);
895 void (*WriteMono8x8PatternToCache) (ScrnInfoPtr pScrn,
896 XAACacheInfoPtr pCache);
897 void (*WriteColor8x8PatternToCache) (ScrnInfoPtr pScrn,
898 PixmapPtr pPix,
899 XAACacheInfoPtr pCache);
900
901 char *PixmapCachePrivate;
902
903 /* Miscellaneous */
904
905 GC ScratchGC;
906 int PreAllocSize;
907 unsigned char *PreAllocMem;
908
909 CharInfoPtr CharInfo[255];
910 NonTEGlyphInfo GlyphInfo[255];
911
912 unsigned int FullPlanemask; /* deprecated */
913
914 PixmapLinkPtr OffscreenPixmaps;
915 int maxOffPixWidth;
916 int maxOffPixHeight;
917
918 XAACacheInfoRec ScratchCacheInfoRec;
919
920 BoxPtr ClipBox;
921
922 Bool NeedToSync;
923
924 char *dgaSaves;
925
926 /* These can be supplied to override the defaults */
927
928 GetImageProcPtr GetImage;
929 GetSpansProcPtr GetSpans;
930 CopyWindowProcPtr CopyWindow;
931
932 unsigned int offscreenDepths;
933 Bool offscreenDepthsInitialized;
934
935 CARD32 FullPlanemasks[32];
936
937 Bool (*Composite) (CARD8 op,
938 PicturePtr pSrc,
939 PicturePtr pMask,
940 PicturePtr pDst,
941 INT16 xSrc,
942 INT16 ySrc,
943 INT16 xMask,
944 INT16 yMask,
945 INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
946
947 Bool (*Glyphs) (CARD8 op,
948 PicturePtr pSrc,
949 PicturePtr pDst,
950 PictFormatPtr maskFormat,
951 INT16 xSrc,
952 INT16 ySrc,
953 int nlist, GlyphListPtr list, GlyphPtr * glyphs);
954
955 /* The old SetupForCPUToScreenAlphaTexture function is no longer used because
956 * it doesn't pass in enough information to write a conforming
957 * implementation. See SetupForCPUToScreenAlphaTexture2.
958 */
959 Bool (*SetupForCPUToScreenAlphaTexture) (ScrnInfoPtr pScrn,
960 int op,
961 CARD16 red,
962 CARD16 green,
963 CARD16 blue,
964 CARD16 alpha,
965 int alphaType,
966 CARD8 *alphaPtr,
967 int alphaPitch,
968 int width, int height, int flags);
969 void (*SubsequentCPUToScreenAlphaTexture) (ScrnInfoPtr pScrn,
970 int dstx,
971 int dsty,
972 int srcx,
973 int srcy, int width, int height);
974 int CPUToScreenAlphaTextureFlags;
975 CARD32 *CPUToScreenAlphaTextureFormats;
976
977 /* The old SetupForCPUToScreenTexture function is no longer used because
978 * it doesn't pass in enough information to write a conforming
979 * implementation. See SetupForCPUToScreenTexture2.
980 */
981 Bool (*SetupForCPUToScreenTexture) (ScrnInfoPtr pScrn,
982 int op,
983 int texType,
984 CARD8 *texPtr,
985 int texPitch,
986 int width, int height, int flags);
987 void (*SubsequentCPUToScreenTexture) (ScrnInfoPtr pScrn,
988 int dstx,
989 int dsty,
990 int srcx,
991 int srcy, int width, int height);
992 int CPUToScreenTextureFlags;
993 CARD32 *CPUToScreenTextureFormats;
994
995 /* these were added for 4.3.0 */
996 BoxRec SolidLineLimits;
997 BoxRec DashedLineLimits;
998
999 /* These were added for X.Org 6.8.0 */
1000 Bool (*SetupForCPUToScreenAlphaTexture2) (ScrnInfoPtr pScrn,
1001 int op,
1002 CARD16 red,
1003 CARD16 green,
1004 CARD16 blue,
1005 CARD16 alpha,
1006 CARD32 maskFormat,
1007 CARD32 dstFormat,
1008 CARD8 *alphaPtr,
1009 int alphaPitch,
1010 int width, int height, int flags);
1011 CARD32 *CPUToScreenAlphaTextureDstFormats;
1012
1013 Bool (*SetupForCPUToScreenTexture2) (ScrnInfoPtr pScrn,
1014 int op,
1015 CARD32 srcFormat,
1016 CARD32 dstFormat,
1017 CARD8 *texPtr,
1018 int texPitch,
1019 int width, int height, int flags);
1020 CARD32 *CPUToScreenTextureDstFormats;
1021} XAAInfoRec, *XAAInfoRecPtr;
1022
1023#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE
1024
1025extern _X_EXPORT Bool
1026 XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
1027
1028extern _X_EXPORT XAAInfoRecPtr XAACreateInfoRec(void);
1029
1030extern _X_EXPORT void
1031 XAADestroyInfoRec(XAAInfoRecPtr infoRec);
1032
1033typedef void (*DepthChangeFuncPtr) (ScrnInfoPtr pScrn, int depth);
1034
1035extern _X_EXPORT Bool
1036 XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback);
1037
1038#endif /* _XAA_H */
diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c
deleted file mode 100644
index c1595c497..000000000
--- a/hw/xfree86/xaa/xaaBitBlt.c
+++ /dev/null
@@ -1,229 +0,0 @@
1
2/*
3 This is a lighter version of cfbBitBlt. We calculate the boxes
4 when accelerating pixmap->screen and screen->screen copies.
5 We also pass the GC to the doBitBlt function so that it has access
6 to the fg and bg so CopyPlane can use this.
7*/
8
9#ifdef HAVE_XORG_CONFIG_H
10#include <xorg-config.h>
11#endif
12
13#include "misc.h"
14#include "xf86.h"
15#include "xf86_OSproc.h"
16
17#include <X11/X.h>
18#include "mi.h"
19#include "pixmapstr.h"
20#include "gcstruct.h"
21#include "windowstr.h"
22#include "xaalocal.h"
23
24RegionPtr
25XAABitBlt(DrawablePtr pSrcDrawable,
26 DrawablePtr pDstDrawable,
27 GC * pGC,
28 int srcx, int srcy,
29 int width, int height,
30 int dstx, int dsty,
31 void (*doBitBlt) (DrawablePtr, DrawablePtr, GCPtr, RegionPtr,
32 DDXPointPtr), unsigned long bitPlane)
33{
34
35 RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
36 RegionPtr prgnExposed;
37 Bool freeSrcClip = FALSE;
38 RegionRec rgnDst;
39 DDXPointPtr pptSrc, ppt;
40 DDXPointRec origDest;
41 BoxPtr pbox;
42 BoxRec fastBox;
43 int i, dx, dy, numRects;
44 xRectangle origSource;
45 int fastClip = 0; /* for fast clipping with pixmap source */
46 int fastExpose = 0; /* for fast exposures with pixmap source */
47
48 origSource.x = srcx;
49 origSource.y = srcy;
50 origSource.width = width;
51 origSource.height = height;
52 origDest.x = dstx;
53 origDest.y = dsty;
54
55 if (pSrcDrawable->pScreen->SourceValidate) {
56 (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy,
57 width, height,
58 pGC->subWindowMode);
59 }
60
61 srcx += pSrcDrawable->x;
62 srcy += pSrcDrawable->y;
63
64 /* clip the source */
65 if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
66 if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
67 prgnSrcClip = pGC->pCompositeClip;
68 else
69 fastClip = 1;
70 }
71 else { /* Window */
72 if (pGC->subWindowMode == IncludeInferiors) {
73 if (!((WindowPtr) pSrcDrawable)->parent) {
74 /*
75 * special case bitblt from root window in
76 * IncludeInferiors mode; just like from a pixmap
77 */
78 fastClip = 1;
79 }
80 else if ((pSrcDrawable == pDstDrawable) &&
81 (pGC->clientClipType == CT_NONE)) {
82 prgnSrcClip = pGC->pCompositeClip;
83 }
84 else {
85 prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable);
86 freeSrcClip = TRUE;
87 }
88 }
89 else {
90 prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList;
91 }
92 }
93
94 fastBox.x1 = srcx;
95 fastBox.y1 = srcy;
96 fastBox.x2 = srcx + width;
97 fastBox.y2 = srcy + height;
98
99 /* Don't create a source region if we are doing a fast clip */
100 if (fastClip) {
101 fastExpose = 1;
102 /*
103 * clip the source; if regions extend beyond the source size,
104 * make sure exposure events get sent
105 */
106 if (fastBox.x1 < pSrcDrawable->x) {
107 fastBox.x1 = pSrcDrawable->x;
108 fastExpose = 0;
109 }
110 if (fastBox.y1 < pSrcDrawable->y) {
111 fastBox.y1 = pSrcDrawable->y;
112 fastExpose = 0;
113 }
114 if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
115 fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
116 fastExpose = 0;
117 }
118 if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
119 fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
120 fastExpose = 0;
121 }
122 }
123 else {
124 RegionInit(&rgnDst, &fastBox, 1);
125 RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
126 }
127
128 dstx += pDstDrawable->x;
129 dsty += pDstDrawable->y;
130
131 if (pDstDrawable->type == DRAWABLE_WINDOW) {
132 if (!((WindowPtr) pDstDrawable)->realized) {
133 if (!fastClip)
134 RegionUninit(&rgnDst);
135 if (freeSrcClip)
136 RegionDestroy(prgnSrcClip);
137 return NULL;
138 }
139 }
140
141 dx = srcx - dstx;
142 dy = srcy - dsty;
143
144 /* Translate and clip the dst to the destination composite clip */
145 if (fastClip) {
146 RegionPtr cclip;
147
148 /* Translate the region directly */
149 fastBox.x1 -= dx;
150 fastBox.x2 -= dx;
151 fastBox.y1 -= dy;
152 fastBox.y2 -= dy;
153
154 /* If the destination composite clip is one rectangle we can
155 do the clip directly. Otherwise we have to create a full
156 blown region and call intersect */
157
158 cclip = pGC->pCompositeClip;
159 if (RegionNumRects(cclip) == 1) {
160 BoxPtr pBox = RegionRects(cclip);
161
162 if (fastBox.x1 < pBox->x1)
163 fastBox.x1 = pBox->x1;
164 if (fastBox.x2 > pBox->x2)
165 fastBox.x2 = pBox->x2;
166 if (fastBox.y1 < pBox->y1)
167 fastBox.y1 = pBox->y1;
168 if (fastBox.y2 > pBox->y2)
169 fastBox.y2 = pBox->y2;
170
171 /* Check to see if the region is empty */
172 if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
173 RegionNull(&rgnDst);
174 }
175 else {
176 RegionInit(&rgnDst, &fastBox, 1);
177 }
178 }
179 else {
180 /* We must turn off fastClip now, since we must create
181 a full blown region. It is intersected with the
182 composite clip below. */
183 fastClip = 0;
184 RegionInit(&rgnDst, &fastBox, 1);
185 }
186 }
187 else {
188 RegionTranslate(&rgnDst, -dx, -dy);
189 }
190
191 if (!fastClip) {
192 RegionIntersect(&rgnDst, &rgnDst, pGC->pCompositeClip);
193 }
194
195 /* Do bit blitting */
196 numRects = RegionNumRects(&rgnDst);
197 if (numRects && width && height) {
198 if (!(pptSrc = (DDXPointPtr) malloc(numRects * sizeof(DDXPointRec)))) {
199 RegionUninit(&rgnDst);
200 if (freeSrcClip)
201 RegionDestroy(prgnSrcClip);
202 return NULL;
203 }
204 pbox = RegionRects(&rgnDst);
205 ppt = pptSrc;
206 for (i = numRects; --i >= 0; pbox++, ppt++) {
207 ppt->x = pbox->x1 + dx;
208 ppt->y = pbox->y1 + dy;
209 }
210
211 (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
212 free(pptSrc);
213 }
214
215 prgnExposed = NULL;
216 if (pGC->fExpose) {
217 /* Pixmap sources generate a NoExposed (we return NULL to do this) */
218 if (!fastExpose)
219 prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
220 origSource.x, origSource.y,
221 (int) origSource.width,
222 (int) origSource.height,
223 origDest.x, origDest.y, bitPlane);
224 }
225 RegionUninit(&rgnDst);
226 if (freeSrcClip)
227 RegionDestroy(prgnSrcClip);
228 return prgnExposed;
229}
diff --git a/hw/xfree86/xaa/xaaBitOrder.c b/hw/xfree86/xaa/xaaBitOrder.c
deleted file mode 100644
index 3d9b980e1..000000000
--- a/hw/xfree86/xaa/xaaBitOrder.c
+++ /dev/null
@@ -1,16 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include <X11/Xmd.h>
7#include "xaalocal.h"
8
9CARD32
10XAAReverseBitOrder(CARD32 v)
11{
12 return (((0x01010101 & v) << 7) | ((0x02020202 & v) << 5) |
13 ((0x04040404 & v) << 3) | ((0x08080808 & v) << 1) |
14 ((0x10101010 & v) >> 1) | ((0x20202020 & v) >> 3) |
15 ((0x40404040 & v) >> 5) | ((0x80808080 & v) >> 7));
16}
diff --git a/hw/xfree86/xaa/xaaBitmap.c b/hw/xfree86/xaa/xaaBitmap.c
deleted file mode 100644
index 45d5a09be..000000000
--- a/hw/xfree86/xaa/xaaBitmap.c
+++ /dev/null
@@ -1,477 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "xaa.h"
7#include "xaalocal.h"
8#include "xaacexp.h"
9#include "xf86.h"
10
11/********** byte swapping ***************/
12
13#ifdef FIXEDBASE
14#define DEST(i) *dest
15#define RETURN(i) return(dest)
16#else
17#define DEST(i) dest[i]
18#define RETURN(i) return(dest + i)
19#endif
20
21#ifdef MSBFIRST
22#define SOURCE(i) SWAP_BITS_IN_BYTES(src[i])
23#else
24#define SOURCE(i) src[i]
25#endif
26
27typedef CARD32 *(*BitmapScanlineProcPtr) (CARD32 *, CARD32 *, int, int);
28
29#ifdef TRIPLE_BITS
30static CARD32 *
31BitmapScanline(CARD32 *src, CARD32 *base, int count, int skipleft)
32{
33 CARD32 bits;
34
35 while (count >= 3) {
36 bits = *src;
37 WRITE_BITS3(bits);
38 src++;
39 count -= 3;
40 }
41 if (count == 2) {
42 bits = *src;
43 WRITE_BITS2(bits);
44 }
45 else if (count == 1) {
46 bits = *src;
47 WRITE_BITS1(bits);
48 }
49
50 return base;
51}
52
53static CARD32 *
54BitmapScanline_Inverted(CARD32 *src, CARD32 *base, int count, int skipleft)
55{
56 CARD32 bits;
57
58 while (count >= 3) {
59 bits = ~(*src);
60 WRITE_BITS3(bits);
61 src++;
62 count -= 3;
63 }
64 if (count == 2) {
65 bits = ~(*src);
66 WRITE_BITS2(bits);
67 }
68 else if (count == 1) {
69 bits = ~(*src);
70 WRITE_BITS1(bits);
71 }
72
73 return base;
74}
75
76static CARD32 *
77BitmapScanline_Shifted(CARD32 *src, CARD32 *base, int count, int skipleft)
78{
79 CARD32 bits;
80
81 while (count >= 3) {
82 bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
83 WRITE_BITS3(bits);
84 src++;
85 count -= 3;
86 }
87 if (count == 2) {
88 bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
89 WRITE_BITS2(bits);
90 }
91 else if (count == 1) {
92 bits = SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft));
93 WRITE_BITS1(bits);
94 }
95
96 return base;
97}
98
99static CARD32 *
100BitmapScanline_Shifted_Inverted(CARD32 *src, CARD32 *base,
101 int count, int skipleft)
102{
103 CARD32 bits;
104
105 while (count >= 3) {
106 bits =
107 ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
108 WRITE_BITS3(bits);
109 src++;
110 count -= 3;
111 }
112 if (count == 2) {
113 bits =
114 ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
115 WRITE_BITS2(bits);
116 }
117 else if (count == 1) {
118 bits =
119 ~(SHIFT_R(*src, skipleft) | SHIFT_L(*(src + 1), (32 - skipleft)));
120 WRITE_BITS1(bits);
121 }
122
123 return base;
124}
125
126#define BitmapScanline_Shifted_Careful BitmapScanline_Shifted
127#define BitmapScanline_Shifted_Inverted_Careful BitmapScanline_Shifted_Inverted
128
129#else
130static CARD32 *
131BitmapScanline(CARD32 *src, CARD32 *dest, int count, int skipleft)
132{
133 while (count >= 4) {
134 DEST(0) = SOURCE(0);
135 DEST(1) = SOURCE(1);
136 DEST(2) = SOURCE(2);
137 DEST(3) = SOURCE(3);
138 count -= 4;
139 src += 4;
140#ifndef FIXEDBASE
141 dest += 4;
142#endif
143 }
144
145 if (!count)
146 return dest;
147 DEST(0) = SOURCE(0);
148 if (count == 1)
149 RETURN(1);
150 DEST(1) = SOURCE(1);
151 if (count == 2)
152 RETURN(2);
153 DEST(2) = SOURCE(2);
154 RETURN(3);
155}
156
157static CARD32 *
158BitmapScanline_Inverted(CARD32 *src, CARD32 *dest, int count, int skipleft)
159{
160 while (count >= 4) {
161 DEST(0) = ~SOURCE(0);
162 DEST(1) = ~SOURCE(1);
163 DEST(2) = ~SOURCE(2);
164 DEST(3) = ~SOURCE(3);
165 count -= 4;
166 src += 4;
167#ifndef FIXEDBASE
168 dest += 4;
169#endif
170 }
171
172 if (!count)
173 return dest;
174 DEST(0) = ~SOURCE(0);
175 if (count == 1)
176 RETURN(1);
177 DEST(1) = ~SOURCE(1);
178 if (count == 2)
179 RETURN(2);
180 DEST(2) = ~SOURCE(2);
181 RETURN(3);
182}
183
184static CARD32 *
185BitmapScanline_Shifted(CARD32 *bits, CARD32 *base, int count, int skipleft)
186{
187 while (count--) {
188 register CARD32 tmp = SHIFT_R(*bits, skipleft) |
189 SHIFT_L(*(bits + 1), (32 - skipleft));
190 WRITE_BITS(tmp);
191 bits++;
192 }
193 return base;
194}
195
196static CARD32 *
197BitmapScanline_Shifted_Inverted(CARD32 *bits, CARD32 *base,
198 int count, int skipleft)
199{
200 while (count--) {
201 register CARD32 tmp = ~(SHIFT_R(*bits, skipleft) |
202 SHIFT_L(*(bits + 1), (32 - skipleft)));
203 WRITE_BITS(tmp);
204 bits++;
205 }
206 return base;
207}
208
209static CARD32 *
210BitmapScanline_Shifted_Careful(CARD32 *bits, CARD32 *base,
211 int count, int skipleft)
212{
213 register CARD32 tmp;
214
215 while (--count) {
216 tmp = SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft));
217 WRITE_BITS(tmp);
218 bits++;
219 }
220 tmp = SHIFT_R(*bits, skipleft);
221 WRITE_BITS(tmp);
222
223 return base;
224}
225
226static CARD32 *
227BitmapScanline_Shifted_Inverted_Careful(CARD32 *bits, CARD32 *base,
228 int count, int skipleft)
229{
230 register CARD32 tmp;
231
232 while (--count) {
233 tmp =
234 ~(SHIFT_R(*bits, skipleft) | SHIFT_L(*(bits + 1), (32 - skipleft)));
235 WRITE_BITS(tmp);
236 bits++;
237 }
238 tmp = ~(SHIFT_R(*bits, skipleft));
239 WRITE_BITS(tmp);
240 return base;
241}
242
243#endif
244
245/*
246 When the accelerator is TRANSPARENCY_ONLY, WriteBitmap can do
247 the fill in two passes, inverting the source on the second pass.
248 For GXcopy we can fill the backing rectangle as a solid rect and
249 avoid the invert.
250*/
251
252void
253#ifdef TRIPLE_BITS
254 EXPNAME(XAAWriteBitmapColorExpand3) (
255#else
256 EXPNAME(XAAWriteBitmapColorExpand) (
257#endif
258 ScrnInfoPtr pScrn,
259 int x, int y, int w, int H,
260 unsigned char *src,
261 int srcwidth,
262 int skipleft,
263 int fg, int bg,
264 int rop, unsigned int planemask) {
265 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
266 CARD32 *base;
267 unsigned char *srcp = src;
268 int SecondPassColor = -1;
269 int shift = 0, dwords;
270 BitmapScanlineProcPtr firstFunc;
271 BitmapScanlineProcPtr secondFunc;
272 int flag;
273 int h = H;
274
275#ifdef TRIPLE_BITS
276 if ((bg != -1) &&
277 ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) ||
278 ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
279 (!CHECK_RGB_EQUAL(bg))))) {
280#else
281 if ((bg != -1) &&
282 (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
283#endif
284 if ((rop == GXcopy) && infoRec->SetupForSolidFill) {
285 (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
286 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
287 }
288 else
289 SecondPassColor = bg;
290 bg = -1;
291 }
292
293#ifdef TRIPLE_BITS
294 if (skipleft) {
295#else
296 if (skipleft &&
297 (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) ||
298 (!(infoRec->
299 CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
300 (skipleft > x)))) {
301#endif
302 if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
303 /* don't read past the end */
304 firstFunc = BitmapScanline_Shifted_Careful;
305 secondFunc = BitmapScanline_Shifted_Inverted_Careful;
306 }
307 else {
308 firstFunc = BitmapScanline_Shifted;
309 secondFunc = BitmapScanline_Shifted_Inverted;
310 }
311 shift = skipleft;
312 skipleft = 0;
313 }
314 else {
315 firstFunc = BitmapScanline;
316 secondFunc = BitmapScanline_Inverted;
317 w += skipleft;
318 x -= skipleft;
319 }
320
321#ifdef TRIPLE_BITS
322 dwords = (3 * w + 31) >> 5;
323#else
324 dwords = (w + 31) >> 5;
325#endif
326
327 SECOND_PASS:
328
329 flag = (infoRec->CPUToScreenColorExpandFillFlags
330 & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
331 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
332 planemask);
333 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
334 skipleft);
335
336 base = (CARD32 *) infoRec->ColorExpandBase;
337
338#ifndef FIXEDBASE
339 if ((dwords * h) <= infoRec->ColorExpandRange)
340 while (h--) {
341 base = (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
342 srcp += srcwidth;
343 }
344 else
345#endif
346 while (h--) {
347 (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
348 srcp += srcwidth;
349 }
350
351 if (flag) {
352 base = (CARD32 *) infoRec->ColorExpandBase;
353 base[0] = 0x00000000;
354 }
355
356 if (SecondPassColor != -1) {
357 h = H; /* Reset height */
358 fg = SecondPassColor;
359 SecondPassColor = -1;
360 firstFunc = secondFunc;
361 srcp = src;
362 goto SECOND_PASS;
363 }
364
365 if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
366 (*infoRec->Sync) (pScrn);
367 else
368 SET_SYNC_FLAG(infoRec);
369}
370
371#ifndef FIXEDBASE
372
373void
374#ifdef TRIPLE_BITS
375 EXPNAME(XAAWriteBitmapScanlineColorExpand3) (
376#else
377 EXPNAME(XAAWriteBitmapScanlineColorExpand) (
378#endif
379 ScrnInfoPtr pScrn,
380 int x, int y, int w, int h,
381 unsigned char *src,
382 int srcwidth,
383 int skipleft,
384 int fg, int bg,
385 int rop,
386 unsigned int planemask) {
387 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
388 CARD32 *base;
389 unsigned char *srcp = src;
390 int SecondPassColor = -1;
391 int shift = 0, dwords, bufferNo;
392 BitmapScanlineProcPtr firstFunc;
393 BitmapScanlineProcPtr secondFunc;
394
395#ifdef TRIPLE_BITS
396 if ((bg != -1) &&
397 ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
398 || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
399 (!CHECK_RGB_EQUAL(bg))))) {
400#else
401 if ((bg != -1) &&
402 (infoRec->
403 ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
404#endif
405 if ((rop == GXcopy) && infoRec->SetupForSolidFill) {
406 (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
407 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
408 }
409 else
410 SecondPassColor = bg;
411 bg = -1;
412 }
413
414#ifdef TRIPLE_BITS
415 if (skipleft) {
416#else
417 if (skipleft &&
418 (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
419 LEFT_EDGE_CLIPPING) ||
420 (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
421 LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) {
422#endif
423 if ((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
424 /* don't read past the end */
425 firstFunc = BitmapScanline_Shifted_Careful;
426 secondFunc = BitmapScanline_Shifted_Inverted_Careful;
427 }
428 else {
429 firstFunc = BitmapScanline_Shifted;
430 secondFunc = BitmapScanline_Shifted_Inverted;
431 }
432 shift = skipleft;
433 skipleft = 0;
434 }
435 else {
436 firstFunc = BitmapScanline;
437 secondFunc = BitmapScanline_Inverted;
438 w += skipleft;
439 x -= skipleft;
440 }
441
442#ifdef TRIPLE_BITS
443 dwords = (3 * w + 31) >> 5;
444#else
445 dwords = (w + 31) >> 5;
446#endif
447
448 SECOND_PASS:
449
450 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
451 planemask);
452 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
453 skipleft);
454
455 bufferNo = 0;
456
457 while (h--) {
458 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
459 (*firstFunc) ((CARD32 *) srcp, base, dwords, shift);
460 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
461 srcp += srcwidth;
462 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
463 bufferNo = 0;
464 }
465
466 if (SecondPassColor != -1) {
467 fg = SecondPassColor;
468 SecondPassColor = -1;
469 firstFunc = secondFunc;
470 srcp = src;
471 goto SECOND_PASS;
472 }
473
474 SET_SYNC_FLAG(infoRec);
475}
476
477#endif
diff --git a/hw/xfree86/xaa/xaaCpyArea.c b/hw/xfree86/xaa/xaaCpyArea.c
deleted file mode 100644
index 0b11b810e..000000000
--- a/hw/xfree86/xaa/xaaCpyArea.c
+++ /dev/null
@@ -1,409 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "xf86str.h"
13#include "xaa.h"
14#include "xaalocal.h"
15#include "migc.h"
16#include "gcstruct.h"
17#include "pixmapstr.h"
18
19/*
20 Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
21 */
22
23RegionPtr
24XAACopyArea(DrawablePtr pSrcDrawable,
25 DrawablePtr pDstDrawable,
26 GC * pGC,
27 int srcx, int srcy, int width, int height, int dstx, int dsty)
28{
29 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
30
31 if (pDstDrawable->type == DRAWABLE_WINDOW) {
32 if ((pSrcDrawable->type == DRAWABLE_WINDOW) ||
33 IS_OFFSCREEN_PIXMAP(pSrcDrawable)) {
34 if (infoRec->ScreenToScreenBitBlt &&
35 CHECK_ROP(pGC, infoRec->ScreenToScreenBitBltFlags) &&
36 CHECK_ROPSRC(pGC, infoRec->ScreenToScreenBitBltFlags) &&
37 CHECK_PLANEMASK(pGC, infoRec->ScreenToScreenBitBltFlags))
38 return (XAABitBlt(pSrcDrawable, pDstDrawable,
39 pGC, srcx, srcy, width, height, dstx, dsty,
40 XAADoBitBlt, 0L));
41 }
42 else {
43 if (infoRec->WritePixmap &&
44 ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) ||
45 ((pDstDrawable->bitsPerPixel == 24) &&
46 (pSrcDrawable->bitsPerPixel == 32) &&
47 (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
48 CHECK_ROP(pGC, infoRec->WritePixmapFlags) &&
49 CHECK_ROPSRC(pGC, infoRec->WritePixmapFlags) &&
50 CHECK_PLANEMASK(pGC, infoRec->WritePixmapFlags) &&
51 CHECK_NO_GXCOPY(pGC, infoRec->WritePixmapFlags))
52 return (XAABitBlt(pSrcDrawable, pDstDrawable,
53 pGC, srcx, srcy, width, height, dstx, dsty,
54 XAADoImageWrite, 0L));
55 }
56 }
57 else if (IS_OFFSCREEN_PIXMAP(pDstDrawable)) {
58 if ((pSrcDrawable->type == DRAWABLE_WINDOW) ||
59 IS_OFFSCREEN_PIXMAP(pSrcDrawable)) {
60 if (infoRec->ScreenToScreenBitBlt &&
61 CHECK_ROP(pGC, infoRec->ScreenToScreenBitBltFlags) &&
62 CHECK_ROPSRC(pGC, infoRec->ScreenToScreenBitBltFlags) &&
63 CHECK_PLANEMASK(pGC, infoRec->ScreenToScreenBitBltFlags))
64 return (XAABitBlt(pSrcDrawable, pDstDrawable,
65 pGC, srcx, srcy, width, height, dstx, dsty,
66 XAADoBitBlt, 0L));
67 }
68 }
69
70 return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
71 srcx, srcy, width, height, dstx, dsty));
72}
73
74void
75XAADoBitBlt(DrawablePtr pSrc,
76 DrawablePtr pDst, GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc)
77{
78 int nbox, careful;
79 BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
80 DDXPointPtr pptTmp, pptNew1, pptNew2;
81 int xdir, ydir;
82 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
83
84 /* XXX we have to err on the side of safety when both are windows,
85 * because we don't know if IncludeInferiors is being used.
86 */
87 careful = ((pSrc == pDst) ||
88 ((pSrc->type == DRAWABLE_WINDOW) &&
89 (pDst->type == DRAWABLE_WINDOW)));
90
91 pbox = RegionRects(prgnDst);
92 nbox = RegionNumRects(prgnDst);
93
94 pboxNew1 = NULL;
95 pptNew1 = NULL;
96 pboxNew2 = NULL;
97 pptNew2 = NULL;
98 if (careful && (pptSrc->y < pbox->y1)) {
99 /* walk source botttom to top */
100 ydir = -1;
101
102 if (nbox > 1) {
103 /* keep ordering in each band, reverse order of bands */
104 pboxNew1 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
105 if (!pboxNew1)
106 return;
107 pptNew1 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox);
108 if (!pptNew1) {
109 free(pboxNew1);
110 return;
111 }
112 pboxBase = pboxNext = pbox + nbox - 1;
113 while (pboxBase >= pbox) {
114 while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1))
115 pboxNext--;
116 pboxTmp = pboxNext + 1;
117 pptTmp = pptSrc + (pboxTmp - pbox);
118 while (pboxTmp <= pboxBase) {
119 *pboxNew1++ = *pboxTmp++;
120 *pptNew1++ = *pptTmp++;
121 }
122 pboxBase = pboxNext;
123 }
124 pboxNew1 -= nbox;
125 pbox = pboxNew1;
126 pptNew1 -= nbox;
127 pptSrc = pptNew1;
128 }
129 }
130 else {
131 /* walk source top to bottom */
132 ydir = 1;
133 }
134
135 if (careful && (pptSrc->x < pbox->x1)) {
136 /* walk source right to left */
137 xdir = -1;
138
139 if (nbox > 1) {
140 /* reverse order of rects in each band */
141 pboxNew2 = (BoxPtr) malloc(sizeof(BoxRec) * nbox);
142 pptNew2 = (DDXPointPtr) malloc(sizeof(DDXPointRec) * nbox);
143 if (!pboxNew2 || !pptNew2) {
144 free(pptNew2);
145 free(pboxNew2);
146 if (pboxNew1) {
147 free(pptNew1);
148 free(pboxNew1);
149 }
150 return;
151 }
152 pboxBase = pboxNext = pbox;
153 while (pboxBase < pbox + nbox) {
154 while ((pboxNext < pbox + nbox) &&
155 (pboxNext->y1 == pboxBase->y1))
156 pboxNext++;
157 pboxTmp = pboxNext;
158 pptTmp = pptSrc + (pboxTmp - pbox);
159 while (pboxTmp != pboxBase) {
160 *pboxNew2++ = *--pboxTmp;
161 *pptNew2++ = *--pptTmp;
162 }
163 pboxBase = pboxNext;
164 }
165 pboxNew2 -= nbox;
166 pbox = pboxNew2;
167 pptNew2 -= nbox;
168 pptSrc = pptNew2;
169 }
170 }
171 else {
172 /* walk source left to right */
173 xdir = 1;
174 }
175
176 (*infoRec->ScreenToScreenBitBlt) (infoRec->pScrn, nbox, pptSrc, pbox,
177 xdir, ydir, pGC->alu, pGC->planemask);
178
179 if (pboxNew2) {
180 free(pptNew2);
181 free(pboxNew2);
182 }
183 if (pboxNew1) {
184 free(pptNew1);
185 free(pboxNew1);
186 }
187
188}
189
190void
191XAADoImageWrite(DrawablePtr pSrc,
192 DrawablePtr pDst,
193 GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc)
194{
195 int srcwidth;
196 unsigned char *psrcBase; /* start of image */
197 unsigned char *srcPntr; /* index into the image */
198 BoxPtr pbox = RegionRects(prgnDst);
199 int nbox = RegionNumRects(prgnDst);
200 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
201 int Bpp = pSrc->bitsPerPixel >> 3;
202
203 psrcBase = (unsigned char *) ((PixmapPtr) pSrc)->devPrivate.ptr;
204 srcwidth = (int) ((PixmapPtr) pSrc)->devKind;
205
206 for (; nbox; pbox++, pptSrc++, nbox--) {
207 srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp);
208
209 (*infoRec->WritePixmap) (infoRec->pScrn, pbox->x1, pbox->y1,
210 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
211 srcPntr, srcwidth, pGC->alu, pGC->planemask,
212 -1, pSrc->bitsPerPixel, pSrc->depth);
213 }
214}
215
216void
217XAADoImageRead(DrawablePtr pSrc,
218 DrawablePtr pDst,
219 GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc)
220{
221 int dstwidth;
222 unsigned char *pdstBase; /* start of image */
223 unsigned char *dstPntr; /* index into the image */
224 BoxPtr pbox = RegionRects(prgnDst);
225 int nbox = RegionNumRects(prgnDst);
226 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
227 int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
228 src and dst have same bpp */
229
230 pdstBase = (unsigned char *) ((PixmapPtr) pDst)->devPrivate.ptr;
231 dstwidth = (int) ((PixmapPtr) pDst)->devKind;
232
233 for (; nbox; pbox++, pptSrc++, nbox--) {
234 dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
235
236 (*infoRec->ReadPixmap) (infoRec->pScrn, pptSrc->x, pptSrc->y,
237 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
238 dstPntr, dstwidth, pSrc->bitsPerPixel,
239 pSrc->depth);
240 }
241}
242
243void
244XAAScreenToScreenBitBlt(ScrnInfoPtr pScrn,
245 int nbox,
246 DDXPointPtr pptSrc,
247 BoxPtr pbox,
248 int xdir, int ydir, int alu, unsigned int planemask)
249{
250 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
251 int dirsetup;
252
253 if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS)
254 || (xdir == ydir)) &&
255 (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT)
256 || (xdir == 1))) {
257 (*infoRec->SetupForScreenToScreenCopy) (pScrn,
258 xdir, ydir, alu, planemask, -1);
259 for (; nbox; pbox++, pptSrc++, nbox--)
260 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x,
261 pptSrc->y, pbox->x1,
262 pbox->y1,
263 pbox->x2 - pbox->x1,
264 pbox->y2 - pbox->y1);
265 SET_SYNC_FLAG(infoRec);
266 return;
267 }
268
269 if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) {
270 /*
271 * This is the case of a chip that only supports xdir = 1,
272 * with ydir = 1 or ydir = -1, but we have xdir = -1.
273 */
274 (*infoRec->SetupForScreenToScreenCopy) (pScrn,
275 1, ydir, alu, planemask, -1);
276 for (; nbox; pbox++, pptSrc++, nbox--)
277 if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
278 /* No problem. Do a xdir = 1 blit instead. */
279 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
280 pptSrc->x, pptSrc->y,
281 pbox->x1, pbox->y1,
282 pbox->x2 - pbox->x1,
283 pbox->y2 - pbox->y1);
284 else {
285 /*
286 * This is the difficult case. Needs striping into
287 * non-overlapping horizontal chunks.
288 */
289 int stripeWidth, w, fullStripes, extra, i;
290
291 stripeWidth = 16;
292 w = pbox->x2 - pbox->x1;
293 if (pbox->x1 - pptSrc->x < stripeWidth)
294 stripeWidth = pbox->x1 - pptSrc->x;
295 fullStripes = w / stripeWidth;
296 extra = w % stripeWidth;
297
298 /* First, take care of the little bit on the far right */
299 if (extra)
300 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
301 pptSrc->x +
302 fullStripes *
303 stripeWidth,
304 pptSrc->y,
305 pbox->x1 +
306 fullStripes *
307 stripeWidth,
308 pbox->y1, extra,
309 pbox->y2 -
310 pbox->y1);
311
312 /* Now, take care of the rest of the blit */
313 for (i = fullStripes - 1; i >= 0; i--)
314 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
315 pptSrc->x +
316 i * stripeWidth,
317 pptSrc->y,
318 pbox->x1 +
319 i * stripeWidth,
320 pbox->y1,
321 stripeWidth,
322 pbox->y2 -
323 pbox->y1);
324 }
325 SET_SYNC_FLAG(infoRec);
326 return;
327 }
328
329 /*
330 * Now the case of a chip that only supports xdir = ydir = 1 or
331 * xdir = ydir = -1, but we have xdir != ydir.
332 */
333 dirsetup = 0; /* No direction set up yet. */
334 for (; nbox; pbox++, pptSrc++, nbox--) {
335 if (xdir == 1 && pptSrc->y != pbox->y1) {
336 /* Do a xdir = ydir = -1 blit instead. */
337 if (dirsetup != -1) {
338 (*infoRec->SetupForScreenToScreenCopy) (pScrn,
339 -1, -1, alu, planemask,
340 -1);
341 dirsetup = -1;
342 }
343 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x,
344 pptSrc->y, pbox->x1,
345 pbox->y1,
346 pbox->x2 - pbox->x1,
347 pbox->y2 - pbox->y1);
348 }
349 else if (xdir == -1 && pptSrc->y != pbox->y1) {
350 /* Do a xdir = ydir = 1 blit instead. */
351 if (dirsetup != 1) {
352 (*infoRec->SetupForScreenToScreenCopy) (pScrn,
353 1, 1, alu, planemask,
354 -1);
355 dirsetup = 1;
356 }
357 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pptSrc->x,
358 pptSrc->y, pbox->x1,
359 pbox->y1,
360 pbox->x2 - pbox->x1,
361 pbox->y2 - pbox->y1);
362 }
363 else if (xdir == 1) {
364 /*
365 * xdir = 1, ydir = -1.
366 * Perform line-by-line xdir = ydir = 1 blits, going up.
367 */
368 int i;
369
370 if (dirsetup != 1) {
371 (*infoRec->SetupForScreenToScreenCopy) (pScrn,
372 1, 1, alu, planemask,
373 -1);
374 dirsetup = 1;
375 }
376 for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
377 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
378 pptSrc->x,
379 pptSrc->y + i,
380 pbox->x1,
381 pbox->y1 + i,
382 pbox->x2 - pbox->x1,
383 1);
384 }
385 else {
386 /*
387 * xdir = -1, ydir = 1.
388 * Perform line-by-line xdir = ydir = -1 blits, going down.
389 */
390 int i;
391
392 if (dirsetup != -1) {
393 (*infoRec->SetupForScreenToScreenCopy) (pScrn,
394 -1, -1, alu, planemask,
395 -1);
396 dirsetup = -1;
397 }
398 for (i = 0; i < pbox->y2 - pbox->y1; i++)
399 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
400 pptSrc->x,
401 pptSrc->y + i,
402 pbox->x1,
403 pbox->y1 + i,
404 pbox->x2 - pbox->x1,
405 1);
406 }
407 } /* next box */
408 SET_SYNC_FLAG(infoRec);
409}
diff --git a/hw/xfree86/xaa/xaaCpyPlane.c b/hw/xfree86/xaa/xaaCpyPlane.c
deleted file mode 100644
index b9197e41f..000000000
--- a/hw/xfree86/xaa/xaaCpyPlane.c
+++ /dev/null
@@ -1,204 +0,0 @@
1
2/*
3 A CopyPlane function that handles bitmap->screen copies and
4 sends anything else to the Fallback.
5
6 Also, a PushPixels for solid fill styles.
7
8 Written by Mark Vojkovich (markv@valinux.com)
9
10*/
11
12#ifdef HAVE_XORG_CONFIG_H
13#include <xorg-config.h>
14#endif
15
16#include <string.h>
17
18#include "misc.h"
19#include "xf86.h"
20#include "xf86_OSproc.h"
21#include "servermd.h"
22
23#include <X11/X.h>
24#include "scrnintstr.h"
25#include "mi.h"
26#include "pixmapstr.h"
27#include "xf86str.h"
28#include "xaa.h"
29#include "xaalocal.h"
30#include "xaawrap.h"
31
32static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
33 GCPtr pGC, RegionPtr rgnDst,
34 DDXPointPtr pptSrc);
35static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
36 GCPtr pGC, RegionPtr rgnDst,
37 DDXPointPtr pptSrc);
38
39static unsigned long TmpBitPlane;
40
41RegionPtr
42XAACopyPlaneColorExpansion(DrawablePtr pSrc,
43 DrawablePtr pDst,
44 GCPtr pGC,
45 int srcx, int srcy,
46 int width, int height,
47 int dstx, int dsty, unsigned long bitPlane)
48{
49 if ((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) {
50 if (pSrc->bitsPerPixel == 1) {
51 return (XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
52 width, height, dstx, dsty,
53 XAACopyPlane1toNColorExpand, bitPlane));
54 }
55 else if (bitPlane < (1 << pDst->depth)) {
56 TmpBitPlane = bitPlane;
57 return (XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
58 width, height, dstx, dsty,
59 XAACopyPlaneNtoNColorExpand, bitPlane));
60 }
61 }
62
63 return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy,
64 width, height, dstx, dsty, bitPlane));
65}
66
67static void
68XAACopyPlane1toNColorExpand(DrawablePtr pSrc,
69 DrawablePtr pDst,
70 GCPtr pGC, RegionPtr rgnDst, DDXPointPtr pptSrc)
71{
72 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
73 BoxPtr pbox = RegionRects(rgnDst);
74 int numrects = RegionNumRects(rgnDst);
75 unsigned char *src = ((PixmapPtr) pSrc)->devPrivate.ptr;
76 int srcwidth = ((PixmapPtr) pSrc)->devKind;
77
78 while (numrects--) {
79 (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1,
80 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
81 src + (srcwidth * pptSrc->y) +
82 ((pptSrc->x >> 5) << 2), srcwidth,
83 pptSrc->x & 31, pGC->fgPixel, pGC->bgPixel,
84 pGC->alu, pGC->planemask);
85 pbox++;
86 pptSrc++;
87 }
88}
89
90static void
91XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc,
92 DrawablePtr pDst,
93 GCPtr pGC, RegionPtr rgnDst, DDXPointPtr pptSrc)
94{
95 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
96 BoxPtr pbox = RegionRects(rgnDst);
97 int numrects = RegionNumRects(rgnDst);
98 unsigned char *src = ((PixmapPtr) pSrc)->devPrivate.ptr;
99 unsigned char *data, *srcPtr, *dataPtr;
100 int srcwidth = ((PixmapPtr) pSrc)->devKind;
101 int pitch, width, height, h, i, index, offset;
102 int Bpp = pSrc->bitsPerPixel >> 3;
103 unsigned long mask = TmpBitPlane;
104
105 if (TmpBitPlane < (1 << 8)) {
106 offset = 0;
107 }
108 else if (TmpBitPlane < (1 << 16)) {
109 offset = 1;
110 mask >>= 8;
111 }
112 else if (TmpBitPlane < (1 << 24)) {
113 offset = 2;
114 mask >>= 16;
115 }
116 else {
117 offset = 3;
118 mask >>= 24;
119 }
120
121 if (IS_OFFSCREEN_PIXMAP(pSrc))
122 SYNC_CHECK(pSrc);
123
124 while (numrects--) {
125 width = pbox->x2 - pbox->x1;
126 h = height = pbox->y2 - pbox->y1;
127 pitch = BitmapBytePad(width);
128
129 if (!(data = calloc(height, pitch)))
130 goto ALLOC_FAILED;
131
132 dataPtr = data;
133 srcPtr = ((pptSrc->y) * srcwidth) + src + ((pptSrc->x) * Bpp) + offset;
134
135 while (h--) {
136 for (i = index = 0; i < width; i++, index += Bpp) {
137 if (mask & srcPtr[index])
138 dataPtr[i >> 3] |= (1 << (i & 7));
139 }
140 dataPtr += pitch;
141 srcPtr += srcwidth;
142 }
143
144 (*infoRec->WriteBitmap) (infoRec->pScrn,
145 pbox->x1, pbox->y1, width, height, data, pitch,
146 0, pGC->fgPixel, pGC->bgPixel, pGC->alu,
147 pGC->planemask);
148
149 free(data);
150
151 ALLOC_FAILED:
152
153 pbox++;
154 pptSrc++;
155 }
156}
157
158void
159XAAPushPixelsSolidColorExpansion(GCPtr pGC,
160 PixmapPtr pBitMap,
161 DrawablePtr pDraw,
162 int dx, int dy, int xOrg, int yOrg)
163{
164 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
165 int MaxBoxes = RegionNumRects(pGC->pCompositeClip);
166 BoxPtr pbox, pClipBoxes;
167 int nboxes, srcx, srcy;
168 xRectangle TheRect;
169 unsigned char *src = pBitMap->devPrivate.ptr;
170 int srcwidth = pBitMap->devKind;
171
172 if (!RegionNumRects(pGC->pCompositeClip))
173 return;
174
175 TheRect.x = xOrg;
176 TheRect.y = yOrg;
177 TheRect.width = dx;
178 TheRect.height = dy;
179
180 if (MaxBoxes > (infoRec->PreAllocSize / sizeof(BoxRec))) {
181 pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
182 if (!pClipBoxes)
183 return;
184 }
185 else
186 pClipBoxes = (BoxPtr) infoRec->PreAllocMem;
187
188 nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
189 pbox = pClipBoxes;
190
191 while (nboxes--) {
192 srcx = pbox->x1 - xOrg;
193 srcy = pbox->y1 - yOrg;
194 (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1,
195 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
196 src + (srcwidth * srcy) + ((srcx >> 5) << 2),
197 srcwidth, srcx & 31,
198 pGC->fgPixel, -1, pGC->alu, pGC->planemask);
199 pbox++;
200 }
201
202 if (pClipBoxes != (BoxPtr) infoRec->PreAllocMem)
203 free(pClipBoxes);
204}
diff --git a/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c
deleted file mode 100644
index e851f4a37..000000000
--- a/hw/xfree86/xaa/xaaCpyWin.c
+++ /dev/null
@@ -1,78 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "windowstr.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16#include "gcstruct.h"
17#include "pixmapstr.h"
18#include "xaawrap.h"
19
20/*
21 Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
22*/
23
24void
25XAACopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
26{
27 DDXPointPtr pptSrc, ppt;
28 RegionRec rgnDst;
29 BoxPtr pbox;
30 int dx, dy, nbox;
31 WindowPtr pwinRoot;
32 ScreenPtr pScreen = pWin->drawable.pScreen;
33 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
34
35 if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
36 XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
37 if (infoRec->pScrn->vtSema && infoRec->NeedToSync) {
38 (*infoRec->Sync) (infoRec->pScrn);
39 infoRec->NeedToSync = FALSE;
40 }
41 (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
42 XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAACopyWindow);
43 return;
44 }
45
46 pwinRoot = pScreen->root;
47
48 RegionNull(&rgnDst);
49
50 dx = ptOldOrg.x - pWin->drawable.x;
51 dy = ptOldOrg.y - pWin->drawable.y;
52 RegionTranslate(prgnSrc, -dx, -dy);
53 RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
54
55 pbox = RegionRects(&rgnDst);
56 nbox = RegionNumRects(&rgnDst);
57 if (!nbox || !(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
58 RegionUninit(&rgnDst);
59 return;
60 }
61 ppt = pptSrc;
62
63 while (nbox--) {
64 ppt->x = pbox->x1 + dx;
65 ppt->y = pbox->y1 + dy;
66 ppt++;
67 pbox++;
68 }
69
70 infoRec->ScratchGC.planemask = ~0L;
71 infoRec->ScratchGC.alu = GXcopy;
72
73 XAADoBitBlt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot,
74 &(infoRec->ScratchGC), &rgnDst, pptSrc);
75
76 free(pptSrc);
77 RegionUninit(&rgnDst);
78}
diff --git a/hw/xfree86/xaa/xaaDashLine.c b/hw/xfree86/xaa/xaaDashLine.c
deleted file mode 100644
index c7e52cd0b..000000000
--- a/hw/xfree86/xaa/xaaDashLine.c
+++ /dev/null
@@ -1,353 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include <stdlib.h>
7
8#include <X11/X.h>
9#include "misc.h"
10#include "xf86.h"
11#include "xf86_OSproc.h"
12
13#include "scrnintstr.h"
14#include "pixmapstr.h"
15#include "miline.h"
16#include "xf86str.h"
17#include "xaa.h"
18#include "xaalocal.h"
19
20void
21#ifdef POLYSEGMENT
22 XAAPolySegmentDashed(DrawablePtr pDrawable,
23 GCPtr pGC, int nseg, xSegment * pSeg
24#else
25XAAPolyLinesDashed(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */
26 int npt, /* number of points */
27 DDXPointPtr pptInit
28#endif
29 )
30{
31 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
32 XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
33 XAAGetGCKey());
34 BoxPtr pboxInit = RegionRects(pGC->pCompositeClip);
35 int nboxInit = RegionNumRects(pGC->pCompositeClip);
36 unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
37 int xorg = pDrawable->x;
38 int yorg = pDrawable->y;
39 int nbox;
40 BoxPtr pbox;
41
42#ifndef POLYSEGMENT
43 DDXPointPtr ppt;
44#endif
45 unsigned int oc1, oc2;
46 int dmin, dmaj, e, octant;
47 int x1, x2, y1, y2, tmp, len, offset;
48 int PatternLength, PatternOffset;
49
50 if (!nboxInit)
51 return;
52
53 if (infoRec->DashedLineFlags & LINE_LIMIT_COORDS) {
54 int minValX = infoRec->DashedLineLimits.x1;
55 int maxValX = infoRec->DashedLineLimits.x2;
56 int minValY = infoRec->DashedLineLimits.y1;
57 int maxValY = infoRec->DashedLineLimits.y2;
58
59#ifdef POLYSEGMENT
60 int n = nseg;
61 xSegment *s = pSeg;
62
63 while (n--)
64#else
65 int n = npt;
66 int xorgtmp = xorg;
67 int yorgtmp = yorg;
68
69 ppt = pptInit;
70 x2 = ppt->x + xorgtmp;
71 y2 = ppt->y + yorgtmp;
72 while (--n)
73#endif
74 {
75#ifdef POLYSEGMENT
76 x1 = s->x1 + xorg;
77 y1 = s->y1 + yorg;
78 x2 = s->x2 + xorg;
79 y2 = s->y2 + yorg;
80 s++;
81#else
82 x1 = x2;
83 y1 = y2;
84 ++ppt;
85 if (mode == CoordModePrevious) {
86 xorgtmp = x1;
87 yorgtmp = y1;
88 }
89 x2 = ppt->x + xorgtmp;
90 y2 = ppt->y + yorgtmp;
91#endif
92 if (x1 > maxValX || x1 < minValX ||
93 x2 > maxValX || x2 < minValX ||
94 y1 > maxValY || y1 < minValY || y2 > maxValY || y2 < minValY) {
95#ifdef POLYSEGMENT
96 XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
97#else
98 XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
99#endif
100 return;
101 }
102 }
103 }
104
105 PatternLength = pGCPriv->DashLength;
106 PatternOffset = pGC->dashOffset % PatternLength;
107
108 (*infoRec->SetupForDashedLine) (infoRec->pScrn, pGC->fgPixel,
109 (pGC->lineStyle ==
110 LineDoubleDash) ? pGC->bgPixel : -1,
111 pGC->alu, pGC->planemask, PatternLength,
112 pGCPriv->DashPattern);
113
114#ifdef POLYSEGMENT
115 while (nseg--)
116#else
117 ppt = pptInit;
118 x2 = ppt->x + xorg;
119 y2 = ppt->y + yorg;
120 while (--npt)
121#endif
122 {
123 nbox = nboxInit;
124 pbox = pboxInit;
125
126#ifdef POLYSEGMENT
127 x1 = pSeg->x1 + xorg;
128 y1 = pSeg->y1 + yorg;
129 x2 = pSeg->x2 + xorg;
130 y2 = pSeg->y2 + yorg;
131 pSeg++;
132#else
133 x1 = x2;
134 y1 = y2;
135 ++ppt;
136 if (mode == CoordModePrevious) {
137 xorg = x1;
138 yorg = y1;
139 }
140 x2 = ppt->x + xorg;
141 y2 = ppt->y + yorg;
142#endif
143
144 if (infoRec->SubsequentDashedBresenhamLine) {
145 if ((dmaj = x2 - x1) < 0) {
146 dmaj = -dmaj;
147 octant = XDECREASING;
148 }
149 else
150 octant = 0;
151
152 if ((dmin = y2 - y1) < 0) {
153 dmin = -dmin;
154 octant |= YDECREASING;
155 }
156
157 if (dmin >= dmaj) {
158 tmp = dmin;
159 dmin = dmaj;
160 dmaj = tmp;
161 octant |= YMAJOR;
162 }
163
164 e = -dmaj - ((bias >> octant) & 1);
165 len = dmaj;
166 dmin <<= 1;
167 dmaj <<= 1;
168 }
169 else { /* Muffle compiler */
170 dmin = dmaj = e = octant = len = 0;
171 }
172
173 while (nbox--) {
174 oc1 = oc2 = 0;
175 OUTCODES(oc1, x1, y1, pbox);
176 OUTCODES(oc2, x2, y2, pbox);
177 if (!(oc1 | oc2)) { /* uncliped */
178 if (infoRec->SubsequentDashedTwoPointLine) {
179 (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn,
180 x1, y1, x2, y2,
181#ifdef POLYSEGMENT
182 (pGC->capStyle !=
183 CapNotLast) ? 0 :
184#endif
185 OMIT_LAST,
186 PatternOffset);
187 }
188 else {
189 (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
190 x1, y1, dmaj,
191 dmin, e,
192#ifdef POLYSEGMENT
193 (pGC->capStyle !=
194 CapNotLast)
195 ? (len + 1) :
196#endif
197 len, octant,
198 PatternOffset);
199 }
200 break;
201 }
202 else if (oc1 & oc2) { /* completely clipped */
203 pbox++;
204 }
205 else if (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE) {
206 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
207 pbox->x1, pbox->y1,
208 pbox->x2 - 1, pbox->y2 - 1);
209
210 if (infoRec->SubsequentDashedBresenhamLine) {
211 (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
212 x1, y1, dmaj,
213 dmin, e,
214#ifdef POLYSEGMENT
215 (pGC->capStyle !=
216 CapNotLast)
217 ? (len + 1) :
218#endif
219 len, octant,
220 PatternOffset);
221 }
222 else {
223 (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn,
224 x1, y1, x2, y2,
225#ifdef POLYSEGMENT
226 (pGC->capStyle !=
227 CapNotLast) ? 0 :
228#endif
229 OMIT_LAST,
230 PatternOffset);
231 }
232 (*infoRec->DisableClipping) (infoRec->pScrn);
233 pbox++;
234 }
235 else {
236 int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
237 int clip1 = 0, clip2 = 0;
238 int err, adx, ady;
239
240 if (octant & YMAJOR) {
241 ady = dmaj >> 1;
242 adx = dmin >> 1;
243 }
244 else {
245 ady = dmin >> 1;
246 adx = dmaj >> 1;
247 }
248
249 if (miZeroClipLine(pbox->x1, pbox->y1,
250 pbox->x2 - 1, pbox->y2 - 1,
251 &new_x1, &new_y1, &new_x2, &new_y2,
252 adx, ady, &clip1, &clip2,
253 octant, bias, oc1, oc2) == -1) {
254 pbox++;
255 continue;
256 }
257
258 if (octant & YMAJOR)
259 len = abs(new_y2 - new_y1);
260 else
261 len = abs(new_x2 - new_x1);
262#ifdef POLYSEGMENT
263 if (clip2 != 0 || pGC->capStyle != CapNotLast)
264 len++;
265#else
266 len += (clip2 != 0);
267#endif
268 if (len) {
269 int abserr, clipdx, clipdy;
270
271 /* unwind bresenham error term to first point */
272 if (clip1) {
273 clipdx = abs(new_x1 - x1);
274 clipdy = abs(new_y1 - y1);
275
276 if (octant & YMAJOR)
277 err = e + clipdy * dmin - clipdx * dmaj;
278 else
279 err = e + clipdx * dmin - clipdy * dmaj;
280 }
281 else
282 err = e;
283
284#define range infoRec->DashedBresenhamLineErrorTermBits
285 abserr = abs(err);
286 while ((abserr & range) || (dmaj & range) || (dmin & range)) {
287 dmin >>= 1;
288 dmaj >>= 1;
289 abserr >>= 1;
290 err /= 2;
291 }
292
293 if (octant & YMAJOR)
294 offset = abs(new_y1 - y1);
295 else
296 offset = abs(new_x1 - x1);
297
298 offset += PatternOffset;
299 offset %= PatternLength;
300
301 (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
302 new_x1, new_y1,
303 dmaj, dmin, err,
304 len, octant,
305 offset);
306 }
307 pbox++;
308 }
309 } /* while (nbox--) */
310#ifndef POLYSEGMENT
311 len = abs(y2 - y1);
312 tmp = abs(x2 - x1);
313 PatternOffset += (len > tmp) ? len : tmp;
314 PatternOffset %= PatternLength;
315#endif
316 } /* while (nline--) */
317
318#ifndef POLYSEGMENT
319 /* paint the last point if the end style isn't CapNotLast.
320 (Assume that a projecting, butt, or round cap that is one
321 pixel wide is the same as the single pixel of the endpoint.)
322 */
323
324 if ((pGC->capStyle != CapNotLast) &&
325 ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
326 (ppt->y + yorg != pptInit->y + pDrawable->y) ||
327 (ppt == pptInit + 1))) {
328 nbox = nboxInit;
329 pbox = pboxInit;
330 while (nbox--) {
331 if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
332 (x2 < pbox->x2) && (y2 < pbox->y2)) {
333 if (infoRec->SubsequentDashedTwoPointLine) {
334 (*infoRec->SubsequentDashedTwoPointLine) (infoRec->pScrn,
335 x2, y2, x2, y2, 0,
336 PatternOffset);
337 }
338 else {
339 (*infoRec->SubsequentDashedBresenhamLine) (infoRec->pScrn,
340 x2, y2, 2, 0, -1,
341 1, 0,
342 PatternOffset);
343 }
344 break;
345 }
346 else
347 pbox++;
348 }
349 }
350#endif
351
352 SET_SYNC_FLAG(infoRec);
353}
diff --git a/hw/xfree86/xaa/xaaFallback.c b/hw/xfree86/xaa/xaaFallback.c
deleted file mode 100644
index f7604ef90..000000000
--- a/hw/xfree86/xaa/xaaFallback.c
+++ /dev/null
@@ -1,281 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "xf86str.h"
13#include "xaa.h"
14#include "xaalocal.h"
15#include "gcstruct.h"
16#include "pixmapstr.h"
17#include "xaawrap.h"
18
19static void
20XAAFillSpansFallback(DrawablePtr pDraw,
21 GC * pGC,
22 int nInit,
23 DDXPointPtr pptInit, int *pwidthInit, int fSorted)
24{
25 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
26 SYNC_CHECK(pGC);
27 (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
28 XAA_GC_OP_EPILOGUE(pGC);
29}
30
31static void
32XAASetSpansFallback(DrawablePtr pDraw,
33 GCPtr pGC,
34 char *pcharsrc,
35 register DDXPointPtr ppt,
36 int *pwidth, int nspans, int fSorted)
37{
38 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
39 SYNC_CHECK(pGC);
40 (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
41 XAA_GC_OP_EPILOGUE(pGC);
42}
43
44static void
45XAAPutImageFallback(DrawablePtr pDraw,
46 GCPtr pGC,
47 int depth,
48 int x, int y, int w, int h,
49 int leftPad, int format, char *pImage)
50{
51 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
52 SYNC_CHECK(pGC);
53 (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
54 leftPad, format, pImage);
55 XAA_GC_OP_EPILOGUE(pGC);
56}
57
58static RegionPtr
59XAACopyAreaFallback(DrawablePtr pSrc,
60 DrawablePtr pDst,
61 GC * pGC,
62 int srcx, int srcy,
63 int width, int height, int dstx, int dsty)
64{
65 RegionPtr ret;
66
67 XAA_GC_OP_PROLOGUE(pGC);
68 if ((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
69 IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
70 SYNC_CHECK(pGC);
71 }
72 ret = (*pGC->ops->CopyArea) (pSrc, pDst,
73 pGC, srcx, srcy, width, height, dstx, dsty);
74 XAA_GC_OP_EPILOGUE(pGC);
75 return ret;
76}
77
78static RegionPtr
79XAACopyPlaneFallback(DrawablePtr pSrc,
80 DrawablePtr pDst,
81 GCPtr pGC,
82 int srcx, int srcy,
83 int width, int height,
84 int dstx, int dsty, unsigned long bitPlane)
85{
86 RegionPtr ret;
87
88 XAA_GC_OP_PROLOGUE(pGC);
89 if ((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
90 IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
91 SYNC_CHECK(pGC);
92 }
93 ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
94 pGC, srcx, srcy, width, height, dstx, dsty,
95 bitPlane);
96 XAA_GC_OP_EPILOGUE(pGC);
97 return ret;
98}
99
100static void
101XAAPolyPointFallback(DrawablePtr pDraw,
102 GCPtr pGC, int mode, int npt, xPoint * pptInit)
103{
104 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
105 SYNC_CHECK(pGC);
106 (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit);
107 XAA_GC_OP_EPILOGUE(pGC);
108}
109
110static void
111XAAPolylinesFallback(DrawablePtr pDraw,
112 GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
113{
114 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
115 SYNC_CHECK(pGC);
116 (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit);
117 XAA_GC_OP_EPILOGUE(pGC);
118}
119
120static void
121XAAPolySegmentFallback(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg)
122{
123 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
124 SYNC_CHECK(pGC);
125 (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg);
126 XAA_GC_OP_EPILOGUE(pGC);
127}
128
129static void
130XAAPolyRectangleFallback(DrawablePtr pDraw,
131 GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
132{
133 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
134 SYNC_CHECK(pGC);
135 (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
136 XAA_GC_OP_EPILOGUE(pGC);
137}
138
139static void
140XAAPolyArcFallback(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
141{
142 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
143 SYNC_CHECK(pGC);
144 (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs);
145 XAA_GC_OP_EPILOGUE(pGC);
146}
147
148static void
149XAAFillPolygonFallback(DrawablePtr pDraw,
150 GCPtr pGC,
151 int shape, int mode, int count, DDXPointPtr ptsIn)
152{
153 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
154 SYNC_CHECK(pGC);
155 (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
156 XAA_GC_OP_EPILOGUE(pGC);
157}
158
159static void
160XAAPolyFillRectFallback(DrawablePtr pDraw,
161 GCPtr pGC, int nrectFill, xRectangle *prectInit)
162{
163 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
164 SYNC_CHECK(pGC);
165 (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
166 XAA_GC_OP_EPILOGUE(pGC);
167}
168
169static void
170XAAPolyFillArcFallback(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
171{
172 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
173 SYNC_CHECK(pGC);
174 (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs);
175 XAA_GC_OP_EPILOGUE(pGC);
176}
177
178static int
179XAAPolyText8Fallback(DrawablePtr pDraw,
180 GCPtr pGC, int x, int y, int count, char *chars)
181{
182 int ret;
183
184 XAA_GC_OP_PROLOGUE(pGC);
185 SYNC_CHECK(pGC);
186 ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
187 XAA_GC_OP_EPILOGUE(pGC);
188 return ret;
189}
190
191static int
192XAAPolyText16Fallback(DrawablePtr pDraw,
193 GCPtr pGC, int x, int y, int count, unsigned short *chars)
194{
195 int ret;
196
197 XAA_GC_OP_PROLOGUE(pGC);
198 SYNC_CHECK(pGC);
199 ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
200 XAA_GC_OP_EPILOGUE(pGC);
201 return ret;
202}
203
204static void
205XAAImageText8Fallback(DrawablePtr pDraw,
206 GCPtr pGC, int x, int y, int count, char *chars)
207{
208 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
209 SYNC_CHECK(pGC);
210 (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
211 XAA_GC_OP_EPILOGUE(pGC);
212}
213
214static void
215XAAImageText16Fallback(DrawablePtr pDraw,
216 GCPtr pGC,
217 int x, int y, int count, unsigned short *chars)
218{
219 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
220 SYNC_CHECK(pGC);
221 (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
222 XAA_GC_OP_EPILOGUE(pGC);
223}
224
225static void
226XAAImageGlyphBltFallback(DrawablePtr pDraw,
227 GCPtr pGC,
228 int xInit, int yInit,
229 unsigned int nglyph,
230 CharInfoPtr * ppci, pointer pglyphBase)
231{
232 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
233 SYNC_CHECK(pGC);
234 (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci,
235 pglyphBase);
236 XAA_GC_OP_EPILOGUE(pGC);
237}
238
239static void
240XAAPolyGlyphBltFallback(DrawablePtr pDraw,
241 GCPtr pGC,
242 int xInit, int yInit,
243 unsigned int nglyph,
244 CharInfoPtr * ppci, pointer pglyphBase)
245{
246 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
247 SYNC_CHECK(pGC);
248 (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph, ppci,
249 pglyphBase);
250 XAA_GC_OP_EPILOGUE(pGC);
251}
252
253static void
254XAAPushPixelsFallback(GCPtr pGC,
255 PixmapPtr pBitMap,
256 DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
257{
258 XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
259 SYNC_CHECK(pGC);
260 (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
261 XAA_GC_OP_EPILOGUE(pGC);
262}
263
264GCOps XAAFallbackOps = {
265 XAAFillSpansFallback, XAASetSpansFallback,
266 XAAPutImageFallback, XAACopyAreaFallback,
267 XAACopyPlaneFallback, XAAPolyPointFallback,
268 XAAPolylinesFallback, XAAPolySegmentFallback,
269 XAAPolyRectangleFallback, XAAPolyArcFallback,
270 XAAFillPolygonFallback, XAAPolyFillRectFallback,
271 XAAPolyFillArcFallback, XAAPolyText8Fallback,
272 XAAPolyText16Fallback, XAAImageText8Fallback,
273 XAAImageText16Fallback, XAAImageGlyphBltFallback,
274 XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
275};
276
277GCOps *
278XAAGetFallbackOps(void)
279{
280 return &XAAFallbackOps;
281}
diff --git a/hw/xfree86/xaa/xaaFillArc.c b/hw/xfree86/xaa/xaaFillArc.c
deleted file mode 100644
index fb7e7201f..000000000
--- a/hw/xfree86/xaa/xaaFillArc.c
+++ /dev/null
@@ -1,202 +0,0 @@
1/*
2 * Copyright 1996 The XFree86 Project
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 *
22 * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
23 */
24
25/*
26 * Filled solid arcs, based on cfbfillarc.c.
27 *
28 * Fill arc using calls to low-level span fill. Because the math for
29 * each span can be done concurrently with the drawing of the span
30 * with a graphics coprocessor operation, this is faster than just
31 * using miPolyFillArc, which first calculates all the spans and then
32 * calls FillSpans.
33 *
34 * Clipped arcs are dispatched to FillSpans.
35 */
36#ifdef HAVE_XORG_CONFIG_H
37#include <xorg-config.h>
38#endif
39
40#include <limits.h>
41
42#include "misc.h"
43#include "xf86.h"
44#include "xf86_OSproc.h"
45
46#include <X11/X.h>
47#include "scrnintstr.h"
48#include "pixmapstr.h"
49#include "xf86str.h"
50#include "xaa.h"
51#include "xaalocal.h"
52#include "mifillarc.h"
53#include "mi.h"
54
55/*
56 * This is based on the integer-math versions from mi. Perhaps on a
57 * Pentium, the floating-point (double)-math version is faster.
58 */
59
60static void
61XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
62{
63 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
64 register int x, y, e;
65 int yk, xk, ym, xm, dx, dy, xorg, yorg;
66 int slw;
67 miFillArcRec info;
68
69 (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
70 pGC->planemask);
71
72 miFillArcSetup(arc, &info);
73 MIFILLARCSETUP();
74 if (pGC->miTranslate) {
75 xorg += pDraw->x;
76 yorg += pDraw->y;
77 }
78 while (y > 0) {
79 MIFILLARCSTEP(slw);
80 if (slw > 0) {
81 (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn, xorg - x,
82 yorg - y, slw, 1);
83 if (miFillArcLower(slw))
84 (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
85 xorg - x, yorg + y + dy,
86 slw, 1);
87 }
88 }
89
90 SET_SYNC_FLAG(infoRec);
91}
92
93#define ADDSPAN(l,r) \
94 if (r >= l) \
95 (*infoRec->SubsequentSolidFillRect)( \
96 infoRec->pScrn, l, ya, r - l + 1, 1);
97
98#define ADDSLICESPANS(flip) \
99 if (!flip) \
100 { \
101 ADDSPAN(xl, xr); \
102 } \
103 else \
104 { \
105 xc = xorg - x; \
106 ADDSPAN(xc, xr); \
107 xc += slw - 1; \
108 ADDSPAN(xl, xc); \
109 }
110
111static void
112XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
113{
114 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
115 int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
116 register int x, y, e;
117 miFillArcRec info;
118 miArcSliceRec slice;
119 int ya, xl, xr, xc;
120
121 (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
122 pGC->planemask);
123
124 miFillArcSetup(arc, &info);
125 miFillArcSliceSetup(arc, &slice, pGC);
126 MIFILLARCSETUP();
127 slw = arc->height;
128 if (slice.flip_top || slice.flip_bot)
129 slw += (arc->height >> 1) + 1;
130 if (pGC->miTranslate) {
131 xorg += pDraw->x;
132 yorg += pDraw->y;
133 slice.edge1.x += pDraw->x;
134 slice.edge2.x += pDraw->x;
135 }
136 while (y > 0) {
137 MIFILLARCSTEP(slw);
138 MIARCSLICESTEP(slice.edge1);
139 MIARCSLICESTEP(slice.edge2);
140 if (miFillSliceUpper(slice)) {
141 ya = yorg - y;
142 MIARCSLICEUPPER(xl, xr, slice, slw);
143
144 ADDSLICESPANS(slice.flip_top);
145 }
146 if (miFillSliceLower(slice)) {
147 ya = yorg + y + dy;
148 MIARCSLICELOWER(xl, xr, slice, slw);
149 ADDSLICESPANS(slice.flip_bot);
150 }
151 }
152
153 SET_SYNC_FLAG(infoRec);
154}
155
156void
157XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
158{
159 register xArc *arc;
160 register int i;
161 int x2, y2;
162 BoxRec box;
163 RegionPtr cclip;
164
165 cclip = pGC->pCompositeClip;
166
167 if (!RegionNumRects(cclip))
168 return;
169
170 for (arc = parcs, i = narcs; --i >= 0; arc++) {
171 if (miFillArcEmpty(arc))
172 continue;
173 if (miCanFillArc(arc)) {
174 box.x1 = arc->x + pDraw->x;
175 box.y1 = arc->y + pDraw->y;
176 /*
177 * Because box.x2 and box.y2 get truncated to 16 bits, and the
178 * RECT_IN_REGION test treats the resulting number as a signed
179 * integer, the RECT_IN_REGION test alone can go the wrong way.
180 * This can result in a server crash because the rendering
181 * routines in this file deal directly with cpu addresses
182 * of pixels to be stored, and do not clip or otherwise check
183 * that all such addresses are within their respective pixmaps.
184 * So we only allow the RECT_IN_REGION test to be used for
185 * values that can be expressed correctly in a signed short.
186 */
187 x2 = box.x1 + (int) arc->width + 1;
188 box.x2 = x2;
189 y2 = box.y1 + (int) arc->height + 1;
190 box.y2 = y2;
191 if ((x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
192 (RegionContainsRect(cclip, &box) == rgnIN)) {
193 if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE))
194 XAAFillEllipseSolid(pDraw, pGC, arc);
195 else
196 XAAFillArcSliceSolid(pDraw, pGC, arc);
197 continue;
198 }
199 }
200 miPolyFillArc(pDraw, pGC, 1, arc);
201 }
202}
diff --git a/hw/xfree86/xaa/xaaFillPoly.c b/hw/xfree86/xaa/xaaFillPoly.c
deleted file mode 100644
index 0cdedf57e..000000000
--- a/hw/xfree86/xaa/xaaFillPoly.c
+++ /dev/null
@@ -1,991 +0,0 @@
1
2/*
3 * Copyright 1996 The XFree86 Project
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 */
24
25/*
26 * Written by Mark Vojkovich. Loosly based on an original version
27 * written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) which
28 * only did solid rectangles and didn't have trapezoid support.
29 *
30 */
31
32#ifdef HAVE_XORG_CONFIG_H
33#include <xorg-config.h>
34#endif
35
36#include "misc.h"
37#include "xf86.h"
38#include "xf86_OSproc.h"
39
40#include <X11/X.h>
41#include "scrnintstr.h"
42#include "pixmapstr.h"
43#include "xf86str.h"
44#include "mi.h"
45#include "micoord.h"
46
47#include "xaa.h"
48#include "xaalocal.h"
49
50#define POLY_USE_MI 0
51#define POLY_FULLY_CLIPPED 1
52#define POLY_IS_EASY 2
53
54#define Setup(c,x,vertex,dx,dy,e,sign,step,DX) {\
55 x = intToX(vertex); \
56 if ((dy = intToY(c) - y)) { \
57 DX = dx = intToX(c) - x; \
58 step = 0; \
59 if (dx >= 0) \
60 { \
61 e = 0; \
62 sign = 1; \
63 if (dx >= dy) {\
64 step = dx / dy; \
65 dx %= dy; \
66 } \
67 } \
68 else \
69 { \
70 e = 1 - dy; \
71 sign = -1; \
72 dx = -dx; \
73 if (dx >= dy) { \
74 step = - (dx / dy); \
75 dx %= dy; \
76 } \
77 } \
78 } \
79 x += origin; \
80 vertex = c; \
81}
82
83#define Step(x,dx,dy,e,sign,step) {\
84 x += step; \
85 if ((e += dx) > 0) \
86 { \
87 x += sign; \
88 e -= dy; \
89 } \
90}
91
92#define FixError(x, dx, dy, e, sign, step, h) { \
93 e += (h) * dx; \
94 x += (h) * step; \
95 if(e > 0) { \
96 x += e * sign/dy; \
97 e %= dy; \
98 if(e) { \
99 x += sign; \
100 e -= dy; \
101 } \
102 } \
103}
104
105/*
106 XAAIsEasyPoly -
107
108 Checks CoordModeOrigin one rect polygons to see if we need
109 to use Mi.
110 Returns: POLY_USE_MI, POLY_FULLY_CLIPPED or POLY_IS_EASY
111 as well as the pointer to the "top" point and the y
112 extents.
113*/
114
115int
116XAAIsEasyPolygon(DDXPointPtr ptsIn, int count, BoxPtr extents, int origin, DDXPointPtr * topPoint, /* return */
117 int *topY, int *bottomY, /* return */
118 int shape)
119{
120 int c = 0, vertex1, vertex2;
121
122 *topY = 32767;
123 *bottomY = 0;
124
125 origin -= (origin & 0x8000) << 1;
126 vertex1 = extents->x1 - origin;
127 vertex2 = extents->x2 - origin /* - 0x00010001 */ ;
128 /* I think this was an error in cfb ^ */
129
130 if (shape == Convex) {
131 while (count--) {
132 c = *((int *) ptsIn);
133 if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
134 return POLY_USE_MI;
135
136 c = intToY(c);
137 if (c < *topY) {
138 *topY = c;
139 *topPoint = ptsIn;
140 }
141 ptsIn++;
142 if (c > *bottomY)
143 *bottomY = c;
144 }
145 }
146 else {
147 int yFlip = 0;
148 int dx2, dx1, x1, x2;
149
150 x2 = x1 = -1;
151 dx2 = dx1 = 1;
152
153 while (count--) {
154 c = *((int *) ptsIn);
155 if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
156 return POLY_USE_MI;
157 c = intToY(c);
158 if (c < *topY) {
159 *topY = c;
160 *topPoint = ptsIn;
161 }
162 ptsIn++;
163 if (c > *bottomY)
164 *bottomY = c;
165 if (c == x1)
166 continue;
167 if (dx1 > 0) {
168 if (x2 < 0)
169 x2 = c;
170 else
171 dx2 = dx1 = (c - x1) >> 31;
172 }
173 else if ((c - x1) >> 31 != dx1) {
174 dx1 = ~dx1;
175 yFlip++;
176 }
177 x1 = c;
178 }
179 x1 = (x2 - c) >> 31;
180 if (x1 != dx1)
181 yFlip++;
182 if (x1 != dx2)
183 yFlip++;
184 if (yFlip != 2) {
185 if (*topY == *bottomY)
186 return POLY_FULLY_CLIPPED;
187 else
188 return POLY_USE_MI;
189 }
190 }
191 if (*topY == *bottomY)
192 return POLY_FULLY_CLIPPED;
193
194 return POLY_IS_EASY;
195}
196
197void
198XAAFillPolygonSolid(DrawablePtr pDraw,
199 GCPtr pGC,
200 int shape, int mode, int count, DDXPointPtr ptsIn)
201{
202 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
203 int origin, vertex1, vertex2;
204 int *vertex1p, *vertex2p, *endp;
205 int x1 = 0, x2 = 0;
206 int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
207 int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
208 int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
209 int c, y, maxy, h, yoffset;
210 DDXPointPtr topPoint;
211
212 if (!RegionNumRects(pGC->pCompositeClip))
213 return;
214
215 if (mode == CoordModePrevious) {
216 register DDXPointPtr ppt = ptsIn + 1;
217
218 for (origin = 1; origin < count; origin++, ppt++) {
219 ppt->x += (ppt - 1)->x;
220 ppt->y += (ppt - 1)->y;
221 }
222 mode = CoordModeOrigin;
223 }
224
225 if (RegionNumRects(pGC->pCompositeClip) != 1) {
226 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
227 return;
228 }
229
230 origin = coordToInt(pDraw->x, pDraw->y);
231
232 switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
233 origin, &topPoint, &y, &maxy, shape)) {
234 case POLY_USE_MI:
235 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
236 case POLY_FULLY_CLIPPED:
237 return;
238 }
239
240 endp = (int *) ptsIn + count;
241 vertex2p = vertex1p = (int *) topPoint;
242 origin = pDraw->x;
243 yoffset = pDraw->y;
244 vertex2 = vertex1 = *vertex2p++;
245 if (vertex2p == endp)
246 vertex2p = (int *) ptsIn;
247
248 (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
249 pGC->planemask);
250
251 while (1) {
252 if (y == intToY(vertex1)) {
253 do {
254 if (vertex1p == (int *) ptsIn)
255 vertex1p = endp;
256 c = *--vertex1p;
257 Setup(c, x1, vertex1, dx1, dy1, e1, sign1, step1, DX1)
258 } while (y >= intToY(vertex1));
259 h = dy1;
260 }
261 else {
262 Step(x1, dx1, dy1, e1, sign1, step1)
263 h = intToY(vertex1) - y;
264 }
265 if (y == intToY(vertex2)) {
266 do {
267 c = *vertex2p++;
268 if (vertex2p == endp)
269 vertex2p = (int *) ptsIn;
270 Setup(c, x2, vertex2, dx2, dy2, e2, sign2, step2, DX2)
271 } while (y >= intToY(vertex2));
272 if (dy2 < h)
273 h = dy2;
274 }
275 else {
276 Step(x2, dx2, dy2, e2, sign2, step2)
277 if ((c = (intToY(vertex2) - y)) < h)
278 h = c;
279 }
280
281 /* fill spans for this segment */
282 if (DX1 | DX2) {
283 if (infoRec->SubsequentSolidFillTrap && (h > 6)) {
284 if (x1 == x2) {
285 while (x1 == x2) {
286 y++;
287 if (!--h)
288 break;
289 Step(x1, dx1, dy1, e1, sign1, step1)
290 Step(x2, dx2, dy2, e2, sign2, step2)
291 }
292 if (y == maxy)
293 break;
294 if (!h)
295 continue;
296 }
297
298 if (x1 < x2)
299 (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn,
300 y + yoffset, h,
301 x1, DX1, dy1, e1,
302 x2 - 1, DX2, dy2, e2);
303 else
304 (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn,
305 y + yoffset, h,
306 x2, DX2, dy2, e2,
307 x1 - 1, DX1, dy1, e1);
308 y += h;
309 if (--h) {
310 FixError(x1, dx1, dy1, e1, sign1, step1, h);
311 FixError(x2, dx2, dy2, e2, sign2, step2, h);
312 h = 0;
313 }
314 }
315 else {
316 while (1) {
317 if (x2 > x1)
318 (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
319 x1, y + yoffset,
320 x2 - x1, 1);
321 else if (x1 > x2)
322 (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
323 x2, y + yoffset,
324 x1 - x2, 1);
325 y++;
326 if (!--h)
327 break;
328 Step(x1, dx1, dy1, e1, sign1, step1)
329 Step(x2, dx2, dy2, e2, sign2, step2)
330 }
331 }
332 }
333 else {
334 if (x2 > x1)
335 (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
336 x1, y + yoffset, x2 - x1,
337 h);
338 else if (x1 > x2)
339 (*infoRec->SubsequentSolidFillRect) (infoRec->pScrn,
340 x2, y + yoffset, x1 - x2,
341 h);
342
343 y += h;
344 h = 0;
345 }
346 if (y == maxy)
347 break;
348 }
349 SET_SYNC_FLAG(infoRec);
350}
351
352void
353XAAFillPolygonHelper(ScrnInfoPtr pScrn,
354 DDXPointPtr ptsIn,
355 int count,
356 DDXPointPtr topPoint,
357 int y,
358 int maxy,
359 int origin,
360 RectFuncPtr RectFunc,
361 TrapFuncPtr TrapFunc,
362 int xorg, int yorg, XAACacheInfoPtr pCache)
363{
364 int *vertex1p, *vertex2p, *endp;
365 int vertex1, vertex2;
366 int x1 = 0, x2 = 0;
367 int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
368 int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
369 int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
370 int c, h, yoffset;
371
372 endp = (int *) ptsIn + count;
373 vertex2p = vertex1p = (int *) topPoint;
374 yoffset = intToY(origin);
375 origin = intToX(origin);
376 vertex2 = vertex1 = *vertex2p++;
377 if (vertex2p == endp)
378 vertex2p = (int *) ptsIn;
379
380 while (1) {
381 if (y == intToY(vertex1)) {
382 do {
383 if (vertex1p == (int *) ptsIn)
384 vertex1p = endp;
385 c = *--vertex1p;
386 Setup(c, x1, vertex1, dx1, dy1, e1, sign1, step1, DX1)
387 } while (y >= intToY(vertex1));
388 h = dy1;
389 }
390 else {
391 Step(x1, dx1, dy1, e1, sign1, step1)
392 h = intToY(vertex1) - y;
393 }
394 if (y == intToY(vertex2)) {
395 do {
396 c = *vertex2p++;
397 if (vertex2p == endp)
398 vertex2p = (int *) ptsIn;
399 Setup(c, x2, vertex2, dx2, dy2, e2, sign2, step2, DX2)
400 } while (y >= intToY(vertex2));
401 if (dy2 < h)
402 h = dy2;
403 }
404 else {
405 Step(x2, dx2, dy2, e2, sign2, step2)
406 if ((c = (intToY(vertex2) - y)) < h)
407 h = c;
408 }
409
410 /* fill spans for this segment */
411 if (DX1 | DX2) {
412 if (TrapFunc && (h > 6)) {
413 if (x1 == x2) {
414 while (x1 == x2) {
415 y++;
416 if (!--h)
417 break;
418 Step(x1, dx1, dy1, e1, sign1, step1)
419 Step(x2, dx2, dy2, e2, sign2, step2)
420 }
421 if (y == maxy)
422 break;
423 if (!h)
424 continue;
425 }
426
427 if (x1 < x2)
428 (*TrapFunc) (pScrn, y + yoffset, h,
429 x1, DX1, dy1, e1,
430 x2 - 1, DX2, dy2, e2, xorg, yorg, pCache);
431 else
432 (*TrapFunc) (pScrn, y + yoffset, h,
433 x2, DX2, dy2, e2,
434 x1 - 1, DX1, dy1, e1, xorg, yorg, pCache);
435 y += h;
436 if (--h) {
437 FixError(x1, dx1, dy1, e1, sign1, step1, h);
438 FixError(x2, dx2, dy2, e2, sign2, step2, h);
439 h = 0;
440 }
441 }
442 else {
443 while (1) {
444 if (x2 > x1)
445 (*RectFunc) (pScrn,
446 x1, y + yoffset, x2 - x1, 1, xorg, yorg,
447 pCache);
448 else if (x1 > x2)
449 (*RectFunc) (pScrn,
450 x2, y + yoffset, x1 - x2, 1, xorg, yorg,
451 pCache);
452 y++;
453 if (!--h)
454 break;
455 Step(x1, dx1, dy1, e1, sign1, step1)
456 Step(x2, dx2, dy2, e2, sign2, step2)
457 }
458 }
459 }
460 else {
461 if (x2 > x1)
462 (*RectFunc) (pScrn,
463 x1, y + yoffset, x2 - x1, h, xorg, yorg, pCache);
464 else if (x1 > x2)
465 (*RectFunc) (pScrn,
466 x2, y + yoffset, x1 - x2, h, xorg, yorg, pCache);
467
468 y += h;
469 h = 0;
470 }
471 if (y == maxy)
472 break;
473 }
474}
475
476 /*****************\
477 | Solid Helpers |
478 \*****************/
479
480static void
481SolidTrapHelper(ScrnInfoPtr pScrn,
482 int y, int h,
483 int x1, int dx1, int dy1, int e1,
484 int x2, int dx2, int dy2, int e2,
485 int xorg, int yorg, XAACacheInfoPtr pCache)
486{
487 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
488
489 (*infoRec->SubsequentSolidFillTrap) (pScrn,
490 y, h, x1, dx1, dy1, e1, x2, dx2, dy2,
491 e2);
492}
493
494static void
495SolidRectHelper(ScrnInfoPtr pScrn,
496 int x, int y, int w, int h,
497 int xorg, int yorg, XAACacheInfoPtr pCache)
498{
499 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
500
501 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
502}
503
504 /*********************\
505 | Mono 8x8 Patterns |
506 \*********************/
507
508static void
509Mono8x8PatternTrapHelper_ScreenOrigin(ScrnInfoPtr pScrn,
510 int y, int h,
511 int x1, int dx1, int dy1, int e1,
512 int x2, int dx2, int dy2, int e2,
513 int xorg, int yorg,
514 XAACacheInfoPtr pCache)
515{
516 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
517
518 (*infoRec->SubsequentMono8x8PatternFillTrap) (pScrn, xorg, yorg,
519 y, h, x1, dx1, dy1, e1, x2,
520 dx2, dy2, e2);
521}
522
523static void
524Mono8x8PatternRectHelper_ScreenOrigin(ScrnInfoPtr pScrn,
525 int x, int y, int w, int h,
526 int xorg, int yorg,
527 XAACacheInfoPtr pCache)
528{
529 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
530
531 (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
532 x, y, w, h);
533}
534
535static void
536Mono8x8PatternRectHelper(ScrnInfoPtr pScrn,
537 int x, int y, int w, int h,
538 int xorg, int yorg, XAACacheInfoPtr pCache)
539{
540 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
541
542 xorg = (x - xorg) & 0x07;
543 yorg = (y - yorg) & 0x07;
544
545 if (!(infoRec->Mono8x8PatternFillFlags &
546 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
547 if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
548 int patx = pCache->pat0;
549 int paty = pCache->pat1;
550
551 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
552 (infoRec->Mono8x8PatternFillFlags &
553 BIT_ORDER_IN_BYTE_MSBFIRST));
554 xorg = patx;
555 yorg = paty;
556 }
557 else {
558 int slot = (yorg << 3) + xorg;
559
560 xorg = pCache->x + pCache->offsets[slot].x;
561 yorg = pCache->y + pCache->offsets[slot].y;
562 }
563 }
564
565 (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
566 x, y, w, h);
567}
568
569 /****************\
570 | Cache Expand |
571 \****************/
572
573static void
574CacheExpandRectHelper(ScrnInfoPtr pScrn,
575 int X, int Y, int Width, int Height,
576 int xorg, int yorg, XAACacheInfoPtr pCache)
577{
578 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
579 int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
580 int cacheWidth;
581
582 cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
583 infoRec->CacheColorExpandDensity;
584
585 phaseY = (Y - yorg) % pCache->orig_h;
586 if (phaseY < 0)
587 phaseY += pCache->orig_h;
588 phaseX = (X - xorg) % pCache->orig_w;
589 if (phaseX < 0)
590 phaseX += pCache->orig_w;
591
592 while (1) {
593 w = Width;
594 skipleft = phaseX;
595 x = X;
596 blit_h = pCache->h - phaseY;
597 if (blit_h > Height)
598 blit_h = Height;
599
600 while (1) {
601 blit_w = cacheWidth - skipleft;
602 if (blit_w > w)
603 blit_w = w;
604 (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x, Y,
605 blit_w, blit_h,
606 pCache->x,
607 pCache->y +
608 phaseY,
609 skipleft);
610 w -= blit_w;
611 if (!w)
612 break;
613 x += blit_w;
614 skipleft = (skipleft + blit_w) % pCache->orig_w;
615 }
616 Height -= blit_h;
617 if (!Height)
618 break;
619 Y += blit_h;
620 phaseY = (phaseY + blit_h) % pCache->orig_h;
621 }
622}
623
624 /**************\
625 | Cache Blit |
626 \**************/
627
628static void
629CacheBltRectHelper(ScrnInfoPtr pScrn,
630 int X, int Y, int Width, int Height,
631 int xorg, int yorg, XAACacheInfoPtr pCache)
632{
633 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
634 int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
635
636 phaseY = (Y - yorg) % pCache->orig_h;
637 if (phaseY < 0)
638 phaseY += pCache->orig_h;
639 phaseX = (X - xorg) % pCache->orig_w;
640 if (phaseX < 0)
641 phaseX += pCache->orig_w;
642
643 while (1) {
644 w = Width;
645 skipleft = phaseX;
646 x = X;
647 blit_h = pCache->h - phaseY;
648 if (blit_h > Height)
649 blit_h = Height;
650
651 while (1) {
652 blit_w = pCache->w - skipleft;
653 if (blit_w > w)
654 blit_w = w;
655 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
656 pCache->x + skipleft,
657 pCache->y + phaseY, x, Y,
658 blit_w, blit_h);
659 w -= blit_w;
660 if (!w)
661 break;
662 x += blit_w;
663 skipleft = (skipleft + blit_w) % pCache->orig_w;
664 }
665 Height -= blit_h;
666 if (!Height)
667 break;
668 Y += blit_h;
669 phaseY = (phaseY + blit_h) % pCache->orig_h;
670 }
671}
672
673 /**********************\
674 | Stippled Polygons |
675 \**********************/
676
677void
678XAAFillPolygonStippled(DrawablePtr pDraw,
679 GCPtr pGC,
680 int shape, int mode, int count, DDXPointPtr ptsIn)
681{
682 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
683 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
684 int origin, type, patx, paty, fg, bg;
685 int y, maxy, xorg, yorg;
686 DDXPointPtr topPoint;
687 XAACacheInfoPtr pCache = NULL;
688 RectFuncPtr RectFunc = NULL;
689 TrapFuncPtr TrapFunc = NULL;
690
691 if (!RegionNumRects(pGC->pCompositeClip))
692 return;
693
694 if (mode == CoordModePrevious) {
695 register DDXPointPtr ppt = ptsIn + 1;
696
697 for (origin = 1; origin < count; origin++, ppt++) {
698 ppt->x += (ppt - 1)->x;
699 ppt->y += (ppt - 1)->y;
700 }
701 mode = CoordModeOrigin;
702 }
703
704 if (RegionNumRects(pGC->pCompositeClip) != 1) {
705 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
706 return;
707 }
708
709 if (pGC->fillStyle == FillStippled) {
710 type = (*infoRec->StippledFillChooser) (pGC);
711 fg = pGC->fgPixel;
712 bg = -1;
713 }
714 else {
715 type = (*infoRec->OpaqueStippledFillChooser) (pGC);
716 fg = pGC->fgPixel;
717 bg = pGC->bgPixel;
718 }
719
720 if (!type) {
721 (*XAAFallbackOps.FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
722 return;
723 }
724
725 if ((type == DO_COLOR_EXPAND) || (type == DO_COLOR_8x8)) {
726 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
727 return;
728 }
729
730 origin = pDraw->x;
731
732 switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
733 origin, &topPoint, &y, &maxy, shape)) {
734 case POLY_USE_MI:
735 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
736 case POLY_FULLY_CLIPPED:
737 return;
738 }
739
740 xorg = (pDraw->x + pGC->patOrg.x);
741 yorg = (pDraw->y + pGC->patOrg.y);
742
743 if ((fg == bg) && (bg != -1) && infoRec->SetupForSolidFill) {
744
745 (*infoRec->SetupForSolidFill) (infoRec->pScrn, fg,
746 pGC->alu, pGC->planemask);
747
748 RectFunc = SolidRectHelper;
749 TrapFunc = infoRec->SubsequentSolidFillTrap ? SolidTrapHelper : NULL;
750 }
751 else
752 switch (type) {
753 case DO_MONO_8x8:
754 patx = pPriv->pattern0;
755 paty = pPriv->pattern1;
756 if (infoRec->Mono8x8PatternFillFlags &
757 HARDWARE_PATTERN_SCREEN_ORIGIN) {
758 xorg = (-xorg) & 0x07;
759 yorg = (-yorg) & 0x07;
760 if (infoRec->Mono8x8PatternFillFlags &
761 HARDWARE_PATTERN_PROGRAMMED_BITS) {
762 if (!(infoRec->Mono8x8PatternFillFlags &
763 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
764 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
765 (infoRec->Mono8x8PatternFillFlags &
766 BIT_ORDER_IN_BYTE_MSBFIRST));
767 xorg = patx;
768 yorg = paty;
769 }
770 }
771 else {
772 XAACacheInfoPtr pCache =
773 (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
774 paty);
775 patx = pCache->x;
776 paty = pCache->y;
777 if (!(infoRec->Mono8x8PatternFillFlags &
778 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
779 int slot = (yorg << 3) + xorg;
780
781 patx += pCache->offsets[slot].x;
782 paty += pCache->offsets[slot].y;
783 xorg = patx;
784 yorg = paty;
785 }
786 }
787 RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
788 if (infoRec->SubsequentMono8x8PatternFillTrap)
789 TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
790 }
791 else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
792 if (!(infoRec->Mono8x8PatternFillFlags &
793 HARDWARE_PATTERN_PROGRAMMED_BITS)) {
794 pCache =
795 (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
796 paty);
797 patx = pCache->x;
798 paty = pCache->y;
799 }
800 else {
801 pCache = &(infoRec->ScratchCacheInfoRec);
802 pCache->pat0 = patx;
803 pCache->pat1 = paty;
804 }
805 RectFunc = Mono8x8PatternRectHelper;
806 }
807
808 (*infoRec->SetupForMono8x8PatternFill) (infoRec->pScrn,
809 patx, paty, fg, bg,
810 pGC->alu, pGC->planemask);
811 break;
812 case DO_CACHE_EXPAND:
813 pCache =
814 (*infoRec->CacheMonoStipple) (infoRec->pScrn, pGC->stipple);
815
816 (*infoRec->SetupForScreenToScreenColorExpandFill) (infoRec->pScrn,
817 fg, bg, pGC->alu,
818 pGC->planemask);
819
820 RectFunc = CacheExpandRectHelper;
821 break;
822 case DO_CACHE_BLT:
823 pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
824 fg, bg);
825 (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1,
826 pGC->alu, pGC->planemask,
827 pCache->trans_color);
828
829 RectFunc = CacheBltRectHelper;
830 break;
831 default:
832 return;
833 }
834
835 XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
836 y, maxy, origin, RectFunc, TrapFunc, xorg, yorg,
837 pCache);
838
839 SET_SYNC_FLAG(infoRec);
840}
841
842 /*******************\
843 | Tiled Polygons |
844 \*******************/
845
846void
847XAAFillPolygonTiled(DrawablePtr pDraw,
848 GCPtr pGC,
849 int shape, int mode, int count, DDXPointPtr ptsIn)
850{
851 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
852 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
853 int origin, type, patx, paty;
854 int y, maxy, xorg, yorg;
855 DDXPointPtr topPoint;
856 XAACacheInfoPtr pCache = NULL;
857 RectFuncPtr RectFunc = NULL;
858 TrapFuncPtr TrapFunc = NULL;
859
860 if (!RegionNumRects(pGC->pCompositeClip))
861 return;
862
863 if (mode == CoordModePrevious) {
864 register DDXPointPtr ppt = ptsIn + 1;
865
866 for (origin = 1; origin < count; origin++, ppt++) {
867 ppt->x += (ppt - 1)->x;
868 ppt->y += (ppt - 1)->y;
869 }
870 mode = CoordModeOrigin;
871 }
872
873 if (RegionNumRects(pGC->pCompositeClip) != 1) {
874 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
875 return;
876 }
877
878 type = (*infoRec->TiledFillChooser) (pGC);
879
880 if (!type || (type == DO_IMAGE_WRITE)) {
881 (*XAAFallbackOps.FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
882 return;
883 }
884
885 if (type == DO_COLOR_8x8) {
886 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
887 return;
888 }
889
890 origin = pDraw->x;
891
892 switch (XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
893 origin, &topPoint, &y, &maxy, shape)) {
894 case POLY_USE_MI:
895 miFillPolygon(pDraw, pGC, shape, mode, count, ptsIn);
896 case POLY_FULLY_CLIPPED:
897 return;
898 }
899
900 xorg = (pDraw->x + pGC->patOrg.x);
901 yorg = (pDraw->y + pGC->patOrg.y);
902
903 switch (type) {
904 case DO_MONO_8x8:
905 patx = pPriv->pattern0;
906 paty = pPriv->pattern1;
907 if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) {
908 xorg = (-xorg) & 0x07;
909 yorg = (-yorg) & 0x07;
910 if (infoRec->Mono8x8PatternFillFlags &
911 HARDWARE_PATTERN_PROGRAMMED_BITS) {
912 if (!(infoRec->Mono8x8PatternFillFlags &
913 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
914 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
915 (infoRec->Mono8x8PatternFillFlags &
916 BIT_ORDER_IN_BYTE_MSBFIRST));
917 xorg = patx;
918 yorg = paty;
919 }
920 }
921 else {
922 XAACacheInfoPtr pCache =
923 (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
924 paty);
925 patx = pCache->x;
926 paty = pCache->y;
927 if (!(infoRec->Mono8x8PatternFillFlags &
928 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
929 int slot = (yorg << 3) + xorg;
930
931 patx += pCache->offsets[slot].x;
932 paty += pCache->offsets[slot].y;
933 xorg = patx;
934 yorg = paty;
935 }
936 }
937 RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
938 if (infoRec->SubsequentMono8x8PatternFillTrap)
939 TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
940 }
941 else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
942 if (!(infoRec->Mono8x8PatternFillFlags &
943 HARDWARE_PATTERN_PROGRAMMED_BITS)) {
944 pCache =
945 (*infoRec->CacheMono8x8Pattern) (infoRec->pScrn, patx,
946 paty);
947 patx = pCache->x;
948 paty = pCache->y;
949 }
950 else {
951 pCache = &(infoRec->ScratchCacheInfoRec);
952 pCache->pat0 = patx;
953 pCache->pat1 = paty;
954 }
955 RectFunc = Mono8x8PatternRectHelper;
956 }
957
958 (*infoRec->SetupForMono8x8PatternFill) (infoRec->pScrn,
959 patx, paty, pPriv->fg,
960 pPriv->bg, pGC->alu,
961 pGC->planemask);
962 break;
963 case DO_CACHE_BLT:
964 pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
965 (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1,
966 pGC->alu, pGC->planemask, -1);
967
968 RectFunc = CacheBltRectHelper;
969 break;
970 case DO_PIXMAP_COPY:
971 pCache = &(infoRec->ScratchCacheInfoRec);
972 pCache->x = pPriv->offscreenArea->box.x1;
973 pCache->y = pPriv->offscreenArea->box.y1;
974 pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
975 pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
976
977 (*infoRec->SetupForScreenToScreenCopy) (infoRec->pScrn, 1, 1,
978 pGC->alu, pGC->planemask, -1);
979
980 RectFunc = CacheBltRectHelper;
981 break;
982 default:
983 return;
984 }
985
986 XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
987 y, maxy, origin, RectFunc, TrapFunc, xorg, yorg,
988 pCache);
989
990 SET_SYNC_FLAG(infoRec);
991}
diff --git a/hw/xfree86/xaa/xaaFillRect.c b/hw/xfree86/xaa/xaaFillRect.c
deleted file mode 100644
index ec0fb9df7..000000000
--- a/hw/xfree86/xaa/xaaFillRect.c
+++ /dev/null
@@ -1,1101 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "pixmapstr.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16
17static void XAARenderSolidRects(GCPtr, int, BoxPtr, int, int);
18static void XAARenderColor8x8Rects(GCPtr, int, BoxPtr, int, int);
19static void XAARenderMono8x8Rects(GCPtr, int, BoxPtr, int, int);
20static void XAARenderColorExpandRects(GCPtr, int, BoxPtr, int, int);
21static void XAARenderCacheExpandRects(GCPtr, int, BoxPtr, int, int);
22static void XAARenderCacheBltRects(GCPtr, int, BoxPtr, int, int);
23static void XAARenderImageWriteRects(GCPtr, int, BoxPtr, int, int);
24static void XAARenderPixmapCopyRects(GCPtr, int, BoxPtr, int, int);
25
26void
27XAAPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill, /* number of rectangles to fill */
28 xRectangle *prectInit /* Pointer to first rectangle to fill */
29 )
30{
31 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
32 int xorg = pDraw->x;
33 int yorg = pDraw->y;
34 int type = 0;
35 ClipAndRenderRectsFunc function;
36
37 if ((nrectFill <= 0) || !pGC->planemask)
38 return;
39
40 if (!RegionNumRects(pGC->pCompositeClip))
41 return;
42
43 switch (pGC->fillStyle) {
44 case FillSolid:
45 type = DO_SOLID;
46 break;
47 case FillStippled:
48 type = (*infoRec->StippledFillChooser) (pGC);
49 break;
50 case FillOpaqueStippled:
51 if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSolidRects &&
52 CHECK_PLANEMASK(pGC, infoRec->FillSolidRectsFlags) &&
53 CHECK_ROP(pGC, infoRec->FillSolidRectsFlags) &&
54 CHECK_ROPSRC(pGC, infoRec->FillSolidRectsFlags) &&
55 CHECK_FG(pGC, infoRec->FillSolidRectsFlags))
56 type = DO_SOLID;
57 else
58 type = (*infoRec->OpaqueStippledFillChooser) (pGC);
59 break;
60 case FillTiled:
61 type = (*infoRec->TiledFillChooser) (pGC);
62 break;
63 }
64
65 switch (type) {
66 case DO_SOLID:
67 function = XAARenderSolidRects;
68 break;
69 case DO_COLOR_8x8:
70 function = XAARenderColor8x8Rects;
71 break;
72 case DO_MONO_8x8:
73 function = XAARenderMono8x8Rects;
74 break;
75 case DO_CACHE_BLT:
76 function = XAARenderCacheBltRects;
77 break;
78 case DO_COLOR_EXPAND:
79 function = XAARenderColorExpandRects;
80 break;
81 case DO_CACHE_EXPAND:
82 function = XAARenderCacheExpandRects;
83 break;
84 case DO_IMAGE_WRITE:
85 function = XAARenderImageWriteRects;
86 break;
87 case DO_PIXMAP_COPY:
88 function = XAARenderPixmapCopyRects;
89 break;
90 default:
91 (*XAAFallbackOps.PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
92 return;
93 }
94
95 if (xorg | yorg) {
96 int n = nrectFill;
97 xRectangle *prect = prectInit;
98
99 while (n--) {
100 prect->x += xorg;
101 prect->y += yorg;
102 prect++;
103 }
104 }
105
106 XAAClipAndRenderRects(pGC, function, nrectFill, prectInit, xorg, yorg);
107}
108
109 /*********************\
110 | Solid Rects |
111 \*********************/
112
113static void
114XAARenderSolidRects(GCPtr pGC,
115 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
116{
117 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
118
119 (*infoRec->FillSolidRects) (infoRec->pScrn,
120 pGC->fgPixel, pGC->alu, pGC->planemask, nboxes,
121 pClipBoxes);
122}
123
124 /************************\
125 | Mono 8x8 Rects |
126 \************************/
127
128static void
129XAARenderMono8x8Rects(GCPtr pGC,
130 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
131{
132 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
133 XAAPixmapPtr pPriv;
134 int fg, bg;
135
136 switch (pGC->fillStyle) {
137 case FillStippled:
138 pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
139 fg = pGC->fgPixel;
140 bg = -1;
141 break;
142 case FillOpaqueStippled:
143 pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
144 fg = pGC->fgPixel;
145 bg = pGC->bgPixel;
146 break;
147 case FillTiled:
148 pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
149 fg = pPriv->fg;
150 bg = pPriv->bg;
151 break;
152 default: /* Muffle compiler */
153 pPriv = NULL; /* Kaboom */
154 fg = -1;
155 bg = -1;
156 break;
157 }
158
159 (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn,
160 fg, bg, pGC->alu, pGC->planemask,
161 nboxes, pClipBoxes, pPriv->pattern0,
162 pPriv->pattern1,
163 (xorg + pGC->patOrg.x),
164 (yorg + pGC->patOrg.y));
165}
166
167 /*************************\
168 | Color 8x8 Rects |
169 \*************************/
170
171static void
172XAARenderColor8x8Rects(GCPtr pGC,
173 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
174{
175 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
176 XAACacheInfoPtr pCache;
177 PixmapPtr pPix;
178 int fg, bg;
179
180 switch (pGC->fillStyle) {
181 case FillStippled:
182 pPix = pGC->stipple;
183 fg = pGC->fgPixel;
184 bg = -1;
185 break;
186 case FillOpaqueStippled:
187 pPix = pGC->stipple;
188 fg = pGC->fgPixel;
189 bg = pGC->bgPixel;
190 break;
191 case FillTiled:
192 pPix = pGC->tile.pixmap;
193 fg = -1;
194 bg = -1;
195 break;
196 default: /* Muffle compiler */
197 pPix = NULL;
198 fg = -1;
199 bg = -1;
200 break;
201 }
202
203 pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg);
204 (*infoRec->FillColor8x8PatternRects) (infoRec->pScrn,
205 pGC->alu, pGC->planemask, nboxes,
206 pClipBoxes, (xorg + pGC->patOrg.x),
207 (yorg + pGC->patOrg.y), pCache);
208}
209
210 /****************************\
211 | Color Expand Rects |
212 \****************************/
213
214static void
215XAARenderColorExpandRects(GCPtr pGC,
216 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
217{
218 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
219 int fg, bg;
220
221 switch (pGC->fillStyle) {
222 case FillStippled:
223 fg = pGC->fgPixel;
224 bg = -1;
225 break;
226 case FillOpaqueStippled:
227 fg = pGC->fgPixel;
228 bg = pGC->bgPixel;
229 break;
230 default: /* Muffle compiler */
231 fg = -1;
232 bg = -1;
233 break;
234 }
235
236 (*infoRec->FillColorExpandRects) (infoRec->pScrn, fg, bg,
237 pGC->alu, pGC->planemask, nboxes,
238 pClipBoxes, (xorg + pGC->patOrg.x),
239 (yorg + pGC->patOrg.y), pGC->stipple);
240}
241
242 /*************************\
243 | Cache Blt Rects |
244 \*************************/
245
246static void
247XAARenderCacheBltRects(GCPtr pGC,
248 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
249{
250 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
251 XAACacheInfoPtr pCache;
252
253 switch (pGC->fillStyle) {
254 case FillStippled:
255 pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
256 pGC->fgPixel, -1);
257 break;
258 case FillOpaqueStippled:
259 pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
260 pGC->fgPixel, pGC->bgPixel);
261 break;
262 case FillTiled:
263 pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
264 break;
265 default: /* Muffle compiler */
266 pCache = NULL;
267 break;
268 }
269
270 (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
271 pGC->planemask, nboxes, pClipBoxes,
272 (xorg + pGC->patOrg.x),
273 (yorg + pGC->patOrg.y), pCache);
274}
275
276 /****************************\
277 | Cache Expand Rects |
278 \****************************/
279
280static void
281XAARenderCacheExpandRects(GCPtr pGC,
282 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
283{
284 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
285 int fg, bg;
286
287 switch (pGC->fillStyle) {
288 case FillStippled:
289 fg = pGC->fgPixel;
290 bg = -1;
291 break;
292 case FillOpaqueStippled:
293 fg = pGC->fgPixel;
294 bg = pGC->bgPixel;
295 break;
296 default: /* Muffle compiler */
297 fg = -1;
298 bg = -1;
299 break;
300 }
301
302 (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg,
303 pGC->alu, pGC->planemask, nboxes,
304 pClipBoxes, (xorg + pGC->patOrg.x),
305 (yorg + pGC->patOrg.y), pGC->stipple);
306}
307
308 /***************************\
309 | Image Write Rects |
310 \***************************/
311
312static void
313XAARenderImageWriteRects(GCPtr pGC,
314 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
315{
316 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
317
318 (*infoRec->FillImageWriteRects) (infoRec->pScrn, pGC->alu,
319 pGC->planemask, nboxes, pClipBoxes,
320 (xorg + pGC->patOrg.x),
321 (yorg + pGC->patOrg.y), pGC->tile.pixmap);
322}
323
324 /***************************\
325 | Pixmap Copy Rects |
326 \***************************/
327
328static void
329XAARenderPixmapCopyRects(GCPtr pGC,
330 int nboxes, BoxPtr pClipBoxes, int xorg, int yorg)
331{
332 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
333 XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
334 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
335
336 pCache->x = pPriv->offscreenArea->box.x1;
337 pCache->y = pPriv->offscreenArea->box.y1;
338 pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
339 pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
340 pCache->trans_color = -1;
341
342 (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
343 pGC->planemask, nboxes, pClipBoxes,
344 (xorg + pGC->patOrg.x),
345 (yorg + pGC->patOrg.y), pCache);
346}
347
348 /************\
349 | Solid |
350 \************/
351
352void
353XAAFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int nBox, /* number of rectangles to fill */
354 BoxPtr pBox /* Pointer to first rectangle to fill */
355 )
356{
357 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
358
359 (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask);
360 while (nBox--) {
361 (*infoRec->SubsequentSolidFillRect) (pScrn, pBox->x1, pBox->y1,
362 pBox->x2 - pBox->x1,
363 pBox->y2 - pBox->y1);
364 pBox++;
365 }
366 SET_SYNC_FLAG(infoRec);
367}
368
369 /*********************\
370 | 8x8 Mono Patterns |
371 \*********************/
372
373void
374XAAFillMono8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
375 int fg, int bg, int rop,
376 unsigned int planemask,
377 int nBox,
378 BoxPtr pBox,
379 int pattern0, int pattern1,
380 int xorigin, int yorigin)
381{
382 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
383 int patx = pattern0, paty = pattern1;
384 int xorg = (-xorigin) & 0x07;
385 int yorg = (-yorigin) & 0x07;
386
387 if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
388 if (!(infoRec->Mono8x8PatternFillFlags &
389 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
390 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
391 (infoRec->Mono8x8PatternFillFlags &
392 BIT_ORDER_IN_BYTE_MSBFIRST));
393 xorg = patx;
394 yorg = paty;
395 }
396 }
397 else {
398 XAACacheInfoPtr pCache =
399 (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
400 patx = pCache->x;
401 paty = pCache->y;
402 if (!(infoRec->Mono8x8PatternFillFlags &
403 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
404 int slot = (yorg << 3) + xorg;
405
406 patx += pCache->offsets[slot].x;
407 paty += pCache->offsets[slot].y;
408 xorg = patx;
409 yorg = paty;
410 }
411 }
412
413 (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
414 fg, bg, rop, planemask);
415
416 while (nBox--) {
417 (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
418 xorg, yorg, pBox->x1,
419 pBox->y1,
420 pBox->x2 - pBox->x1,
421 pBox->y2 - pBox->y1);
422 pBox++;
423 }
424 SET_SYNC_FLAG(infoRec);
425}
426
427void
428XAAFillMono8x8PatternRects(ScrnInfoPtr pScrn,
429 int fg, int bg, int rop,
430 unsigned int planemask,
431 int nBox,
432 BoxPtr pBox,
433 int pattern0, int pattern1, int xorigin, int yorigin)
434{
435 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
436 int patx = pattern0, paty = pattern1;
437 int xorg, yorg;
438 XAACacheInfoPtr pCache = NULL;
439
440 if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) {
441 pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
442 patx = pCache->x;
443 paty = pCache->y;
444 }
445
446 (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
447 fg, bg, rop, planemask);
448
449 while (nBox--) {
450 xorg = (pBox->x1 - xorigin) & 0x07;
451 yorg = (pBox->y1 - yorigin) & 0x07;
452
453 if (!(infoRec->Mono8x8PatternFillFlags &
454 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
455 if (infoRec->Mono8x8PatternFillFlags &
456 HARDWARE_PATTERN_PROGRAMMED_BITS) {
457 patx = pattern0;
458 paty = pattern1;
459 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
460 (infoRec->Mono8x8PatternFillFlags &
461 BIT_ORDER_IN_BYTE_MSBFIRST));
462 xorg = patx;
463 yorg = paty;
464 }
465 else {
466 int slot = (yorg << 3) + xorg;
467
468 xorg = patx + pCache->offsets[slot].x;
469 yorg = paty + pCache->offsets[slot].y;
470 }
471 }
472
473 (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
474 xorg, yorg, pBox->x1,
475 pBox->y1,
476 pBox->x2 - pBox->x1,
477 pBox->y2 - pBox->y1);
478 pBox++;
479 }
480
481 SET_SYNC_FLAG(infoRec);
482}
483
484 /**********************\
485 | 8x8 Color Patterns |
486 \**********************/
487
488void
489XAAFillColor8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
490 int rop,
491 unsigned int planemask,
492 int nBox,
493 BoxPtr pBox,
494 int xorigin, int yorigin,
495 XAACacheInfoPtr pCache)
496{
497 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
498 int patx = pCache->x, paty = pCache->y;
499 int xorg = (-xorigin) & 0x07;
500 int yorg = (-yorigin) & 0x07;
501
502 if (!(infoRec->Color8x8PatternFillFlags &
503 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
504 int slot = (yorg << 3) + xorg;
505
506 paty += pCache->offsets[slot].y;
507 patx += pCache->offsets[slot].x;
508 xorg = patx;
509 yorg = paty;
510 }
511
512 (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty,
513 rop, planemask,
514 pCache->trans_color);
515
516 while (nBox--) {
517 (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
518 xorg, yorg, pBox->x1,
519 pBox->y1,
520 pBox->x2 - pBox->x1,
521 pBox->y2 - pBox->y1);
522 pBox++;
523 }
524 SET_SYNC_FLAG(infoRec);
525}
526
527void
528XAAFillColor8x8PatternRects(ScrnInfoPtr pScrn,
529 int rop,
530 unsigned int planemask,
531 int nBox,
532 BoxPtr pBox,
533 int xorigin, int yorigin, XAACacheInfoPtr pCache)
534{
535 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
536 int xorg, yorg;
537
538 (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y,
539 rop, planemask,
540 pCache->trans_color);
541
542 while (nBox--) {
543 xorg = (pBox->x1 - xorigin) & 0x07;
544 yorg = (pBox->y1 - yorigin) & 0x07;
545
546 if (!(infoRec->Color8x8PatternFillFlags &
547 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
548 int slot = (yorg << 3) + xorg;
549
550 yorg = pCache->y + pCache->offsets[slot].y;
551 xorg = pCache->x + pCache->offsets[slot].x;
552 }
553
554 (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
555 xorg, yorg, pBox->x1,
556 pBox->y1,
557 pBox->x2 - pBox->x1,
558 pBox->y2 - pBox->y1);
559 pBox++;
560 }
561
562 SET_SYNC_FLAG(infoRec);
563}
564
565 /***************\
566 | Cache Blits |
567 \***************/
568
569void
570XAAFillCacheBltRects(ScrnInfoPtr pScrn,
571 int rop,
572 unsigned int planemask,
573 int nBox,
574 BoxPtr pBox, int xorg, int yorg, XAACacheInfoPtr pCache)
575{
576 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
577 int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
578
579 (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask,
580 pCache->trans_color);
581
582 while (nBox--) {
583 y = pBox->y1;
584 phaseY = (y - yorg) % pCache->orig_h;
585 if (phaseY < 0)
586 phaseY += pCache->orig_h;
587 phaseX = (pBox->x1 - xorg) % pCache->orig_w;
588 if (phaseX < 0)
589 phaseX += pCache->orig_w;
590 height = pBox->y2 - y;
591 width = pBox->x2 - pBox->x1;
592
593#if 0
594 if (rop == GXcopy) {
595 while (1) {
596 w = width;
597 skipleft = phaseX;
598 x = pBox->x1;
599 blit_h = pCache->h - phaseY;
600 if (blit_h > height)
601 blit_h = height;
602
603 while (1) {
604 blit_w = pCache->w - skipleft;
605 if (blit_w > w)
606 blit_w = w;
607 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
608 pCache->x +
609 skipleft,
610 pCache->y +
611 phaseY, x, y,
612 blit_w, blit_h);
613 w -= blit_w;
614 if (!w)
615 break;
616 x += blit_w;
617 skipleft = (skipleft + blit_w) % pCache->orig_w;
618 if (blit_w >= pCache->orig_w)
619 break;
620 }
621
622 /* Expand horizontally */
623 if (w) {
624 skipleft -= phaseX;
625 if (skipleft < 0)
626 skipleft += pCache->orig_w;
627 blit_w = x - pBox->x1 - skipleft;
628 while (w) {
629 if (blit_w > w)
630 blit_w = w;
631 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
632 pBox->x1 +
633 skipleft, y,
634 x, y, blit_w,
635 blit_h);
636 w -= blit_w;
637 x += blit_w;
638 blit_w <<= 1;
639 }
640 }
641
642 height -= blit_h;
643 if (!height)
644 break;
645 y += blit_h;
646 phaseY = (phaseY + blit_h) % pCache->orig_h;
647 if (blit_h >= pCache->orig_h)
648 break;
649 }
650
651 /* Expand vertically */
652 if (height) {
653 blit_w = pBox->x2 - pBox->x1;
654 phaseY -= (pBox->y1 - yorg) % pCache->orig_h;
655 if (phaseY < 0)
656 phaseY += pCache->orig_h;
657 blit_h = y - pBox->y1 - phaseY;
658 while (height) {
659 if (blit_h > height)
660 blit_h = height;
661 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pBox->x1,
662 pBox->y1 + phaseY,
663 pBox->x1, y,
664 blit_w, blit_h);
665 height -= blit_h;
666 y += blit_h;
667 blit_h <<= 1;
668 }
669 }
670 }
671 else
672#endif
673 {
674 while (1) {
675 w = width;
676 skipleft = phaseX;
677 x = pBox->x1;
678 blit_h = pCache->h - phaseY;
679 if (blit_h > height)
680 blit_h = height;
681
682 while (1) {
683 blit_w = pCache->w - skipleft;
684 if (blit_w > w)
685 blit_w = w;
686 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
687 pCache->x +
688 skipleft,
689 pCache->y +
690 phaseY, x, y,
691 blit_w, blit_h);
692 w -= blit_w;
693 if (!w)
694 break;
695 x += blit_w;
696 skipleft = (skipleft + blit_w) % pCache->orig_w;
697 }
698 height -= blit_h;
699 if (!height)
700 break;
701 y += blit_h;
702 phaseY = (phaseY + blit_h) % pCache->orig_h;
703 }
704 }
705 pBox++;
706 }
707
708 SET_SYNC_FLAG(infoRec);
709}
710
711 /*******************\
712 | Cache Expansion |
713 \*******************/
714
715void
716XAAFillCacheExpandRects(ScrnInfoPtr pScrn,
717 int fg, int bg, int rop,
718 unsigned int planemask,
719 int nBox,
720 BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix)
721{
722 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
723 int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
724 int cacheWidth;
725 XAACacheInfoPtr pCache;
726
727 pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix);
728
729 cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
730 infoRec->CacheColorExpandDensity;
731
732 (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop,
733 planemask);
734
735 while (nBox--) {
736 y = pBox->y1;
737 phaseY = (y - yorg) % pCache->orig_h;
738 if (phaseY < 0)
739 phaseY += pCache->orig_h;
740 phaseX = (pBox->x1 - xorg) % pCache->orig_w;
741 if (phaseX < 0)
742 phaseX += pCache->orig_w;
743 height = pBox->y2 - y;
744 width = pBox->x2 - pBox->x1;
745
746 while (1) {
747 w = width;
748 skipleft = phaseX;
749 x = pBox->x1;
750 blit_h = pCache->h - phaseY;
751 if (blit_h > height)
752 blit_h = height;
753
754 while (1) {
755 blit_w = cacheWidth - skipleft;
756 if (blit_w > w)
757 blit_w = w;
758 (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x,
759 y, blit_w,
760 blit_h,
761 pCache->x,
762 pCache->y +
763 phaseY,
764 skipleft);
765 w -= blit_w;
766 if (!w)
767 break;
768 x += blit_w;
769 skipleft = (skipleft + blit_w) % pCache->orig_w;
770 }
771 height -= blit_h;
772 if (!height)
773 break;
774 y += blit_h;
775 phaseY = (phaseY + blit_h) % pCache->orig_h;
776 }
777 pBox++;
778 }
779
780 SET_SYNC_FLAG(infoRec);
781}
782
783 /******************\
784 | Image Writes |
785 \******************/
786
787/* This requires all LEFT_EDGE clipping. You get too many problems
788 with reading past the edge of the pattern otherwise */
789
790static void
791WriteColumn(ScrnInfoPtr pScrn,
792 unsigned char *pSrc,
793 int x, int y, int w, int h,
794 int xoff, int yoff, int pHeight, int srcwidth, int Bpp)
795{
796 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
797 unsigned char *src;
798 Bool PlusOne = FALSE;
799 int skipleft, dwords;
800
801 pSrc += (Bpp * xoff);
802
803 if ((skipleft = (long) pSrc & 0x03L)) {
804 if (Bpp == 3)
805 skipleft = 4 - skipleft;
806 else
807 skipleft /= Bpp;
808
809 x -= skipleft;
810 w += skipleft;
811
812 if (Bpp == 3)
813 pSrc -= 3 * skipleft;
814 else /* is this Alpha friendly ? */
815 pSrc = (unsigned char *) ((long) pSrc & ~0x03L);
816 }
817
818 src = pSrc + (yoff * srcwidth);
819
820 dwords = bytes_to_int32(w * Bpp);
821
822 if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
823 ((dwords * h) & 0x01)) {
824 PlusOne = TRUE;
825 }
826
827 (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, skipleft);
828
829 if (dwords > infoRec->ImageWriteRange) {
830 while (h--) {
831 XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase,
832 (CARD32 *) src, dwords);
833 src += srcwidth;
834 yoff++;
835 if (yoff >= pHeight) {
836 yoff = 0;
837 src = pSrc;
838 }
839 }
840 }
841 else {
842 if (srcwidth == (dwords << 2)) {
843 int maxLines = infoRec->ImageWriteRange / dwords;
844 int step;
845
846 while (h) {
847 step = pHeight - yoff;
848 if (step > maxLines)
849 step = maxLines;
850 if (step > h)
851 step = h;
852
853 XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
854 (CARD32 *) src, dwords * step);
855
856 src += (srcwidth * step);
857 yoff += step;
858 if (yoff >= pHeight) {
859 yoff = 0;
860 src = pSrc;
861 }
862 h -= step;
863 }
864 }
865 else {
866 while (h--) {
867 XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
868 (CARD32 *) src, dwords);
869 src += srcwidth;
870 yoff++;
871 if (yoff >= pHeight) {
872 yoff = 0;
873 src = pSrc;
874 }
875 }
876 }
877 }
878
879 if (PlusOne) {
880 CARD32 *base = (CARD32 *) infoRec->ImageWriteBase;
881
882 *base = 0x00000000;
883 }
884}
885
886void
887XAAFillImageWriteRects(ScrnInfoPtr pScrn,
888 int rop,
889 unsigned int planemask,
890 int nBox,
891 BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix)
892{
893 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
894 int x, phaseY, phaseX, height, width, blit_w;
895 int pHeight = pPix->drawable.height;
896 int pWidth = pPix->drawable.width;
897 int Bpp = pPix->drawable.bitsPerPixel >> 3;
898 int srcwidth = pPix->devKind;
899
900 (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, -1,
901 pPix->drawable.bitsPerPixel,
902 pPix->drawable.depth);
903
904 while (nBox--) {
905 x = pBox->x1;
906 phaseY = (pBox->y1 - yorg) % pHeight;
907 if (phaseY < 0)
908 phaseY += pHeight;
909 phaseX = (x - xorg) % pWidth;
910 if (phaseX < 0)
911 phaseX += pWidth;
912 height = pBox->y2 - pBox->y1;
913 width = pBox->x2 - x;
914
915 while (1) {
916 blit_w = pWidth - phaseX;
917 if (blit_w > width)
918 blit_w = width;
919
920 WriteColumn(pScrn, pPix->devPrivate.ptr, x, pBox->y1,
921 blit_w, height, phaseX, phaseY, pHeight, srcwidth, Bpp);
922
923 width -= blit_w;
924 if (!width)
925 break;
926 x += blit_w;
927 phaseX = (phaseX + blit_w) % pWidth;
928 }
929 pBox++;
930 }
931
932 if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
933 (*infoRec->Sync) (pScrn);
934 else
935 SET_SYNC_FLAG(infoRec);
936}
937
938 /*************\
939 | Utilities |
940 \*************/
941
942void
943XAAClipAndRenderRects(GCPtr pGC,
944 ClipAndRenderRectsFunc BoxFunc,
945 int nrectFill, xRectangle *prect, int xorg, int yorg)
946{
947 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
948 int Right, Bottom, MaxBoxes;
949 BoxPtr pextent, pboxClipped, pboxClippedBase;
950
951 MaxBoxes = infoRec->PreAllocSize / sizeof(BoxRec);
952 pboxClippedBase = (BoxPtr) infoRec->PreAllocMem;
953 pboxClipped = pboxClippedBase;
954
955 if (RegionNumRects(pGC->pCompositeClip) == 1) {
956 pextent = RegionRects(pGC->pCompositeClip);
957 while (nrectFill--) {
958 pboxClipped->x1 = max(pextent->x1, prect->x);
959 pboxClipped->y1 = max(pextent->y1, prect->y);
960
961 Right = (int) prect->x + (int) prect->width;
962 pboxClipped->x2 = min(pextent->x2, Right);
963
964 Bottom = (int) prect->y + (int) prect->height;
965 pboxClipped->y2 = min(pextent->y2, Bottom);
966
967 prect++;
968 if ((pboxClipped->x1 < pboxClipped->x2) &&
969 (pboxClipped->y1 < pboxClipped->y2)) {
970 pboxClipped++;
971 if (pboxClipped >= (pboxClippedBase + MaxBoxes)) {
972 (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
973 pboxClipped = pboxClippedBase;
974 }
975 }
976 }
977 }
978 else {
979 pextent = RegionExtents(pGC->pCompositeClip);
980 while (nrectFill--) {
981 int n;
982 BoxRec box, *pbox;
983
984 box.x1 = max(pextent->x1, prect->x);
985 box.y1 = max(pextent->y1, prect->y);
986
987 Right = (int) prect->x + (int) prect->width;
988 box.x2 = min(pextent->x2, Right);
989
990 Bottom = (int) prect->y + (int) prect->height;
991 box.y2 = min(pextent->y2, Bottom);
992
993 prect++;
994
995 if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
996 continue;
997
998 n = RegionNumRects(pGC->pCompositeClip);
999 pbox = RegionRects(pGC->pCompositeClip);
1000
1001 /* clip the rectangle to each box in the clip region
1002 this is logically equivalent to calling Intersect()
1003 */
1004 while (n--) {
1005 pboxClipped->x1 = max(box.x1, pbox->x1);
1006 pboxClipped->y1 = max(box.y1, pbox->y1);
1007 pboxClipped->x2 = min(box.x2, pbox->x2);
1008 pboxClipped->y2 = min(box.y2, pbox->y2);
1009 pbox++;
1010
1011 /* see if clipping left anything */
1012 if (pboxClipped->x1 < pboxClipped->x2 &&
1013 pboxClipped->y1 < pboxClipped->y2) {
1014 pboxClipped++;
1015 if (pboxClipped >= (pboxClippedBase + MaxBoxes)) {
1016 (*BoxFunc) (pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
1017 pboxClipped = pboxClippedBase;
1018 }
1019 }
1020 }
1021 }
1022 }
1023
1024 if (pboxClipped != pboxClippedBase)
1025 (*BoxFunc) (pGC, pboxClipped - pboxClippedBase, pboxClippedBase,
1026 xorg, yorg);
1027}
1028
1029int
1030XAAGetRectClipBoxes(GCPtr pGC,
1031 BoxPtr pboxClippedBase,
1032 int nrectFill, xRectangle *prectInit)
1033{
1034 int Right, Bottom;
1035 BoxPtr pextent, pboxClipped = pboxClippedBase;
1036 xRectangle *prect = prectInit;
1037 RegionPtr prgnClip = pGC->pCompositeClip;
1038
1039 if (RegionNumRects(prgnClip) == 1) {
1040 pextent = RegionRects(prgnClip);
1041 while (nrectFill--) {
1042 pboxClipped->x1 = max(pextent->x1, prect->x);
1043 pboxClipped->y1 = max(pextent->y1, prect->y);
1044
1045 Right = (int) prect->x + (int) prect->width;
1046 pboxClipped->x2 = min(pextent->x2, Right);
1047
1048 Bottom = (int) prect->y + (int) prect->height;
1049 pboxClipped->y2 = min(pextent->y2, Bottom);
1050
1051 prect++;
1052 if ((pboxClipped->x1 < pboxClipped->x2) &&
1053 (pboxClipped->y1 < pboxClipped->y2)) {
1054 pboxClipped++;
1055 }
1056 }
1057 }
1058 else {
1059 pextent = RegionExtents(prgnClip);
1060 while (nrectFill--) {
1061 int n;
1062 BoxRec box, *pbox;
1063
1064 box.x1 = max(pextent->x1, prect->x);
1065 box.y1 = max(pextent->y1, prect->y);
1066
1067 Right = (int) prect->x + (int) prect->width;
1068 box.x2 = min(pextent->x2, Right);
1069
1070 Bottom = (int) prect->y + (int) prect->height;
1071 box.y2 = min(pextent->y2, Bottom);
1072
1073 prect++;
1074
1075 if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
1076 continue;
1077
1078 n = RegionNumRects(prgnClip);
1079 pbox = RegionRects(prgnClip);
1080
1081 /* clip the rectangle to each box in the clip region
1082 this is logically equivalent to calling Intersect()
1083 */
1084 while (n--) {
1085 pboxClipped->x1 = max(box.x1, pbox->x1);
1086 pboxClipped->y1 = max(box.y1, pbox->y1);
1087 pboxClipped->x2 = min(box.x2, pbox->x2);
1088 pboxClipped->y2 = min(box.y2, pbox->y2);
1089 pbox++;
1090
1091 /* see if clipping left anything */
1092 if (pboxClipped->x1 < pboxClipped->x2 &&
1093 pboxClipped->y1 < pboxClipped->y2) {
1094 pboxClipped++;
1095 }
1096 }
1097 }
1098 }
1099
1100 return pboxClipped - pboxClippedBase;
1101}
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
deleted file mode 100644
index d55f1e445..000000000
--- a/hw/xfree86/xaa/xaaGC.c
+++ /dev/null
@@ -1,564 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include <string.h>
7
8#include "misc.h"
9#include "xf86.h"
10#include "xf86_OSproc.h"
11
12#include <X11/X.h>
13#include "scrnintstr.h"
14#include "xf86str.h"
15#include "xaa.h"
16#include "xaalocal.h"
17#include "migc.h"
18#include "gcstruct.h"
19#include "pixmapstr.h"
20#include "xaawrap.h"
21
22static void XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
23static void XAAChangeGC(GCPtr pGC, unsigned long mask);
24static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
25static void XAADestroyGC(GCPtr pGC);
26static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
27static void XAADestroyClip(GCPtr pGC);
28static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc);
29
30GCFuncs XAAGCFuncs = {
31 XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
32 XAAChangeClip, XAADestroyClip, XAACopyClip
33};
34
35extern GCOps XAAPixmapOps;
36
37Bool
38XAACreateGC(GCPtr pGC)
39{
40 ScreenPtr pScreen = pGC->pScreen;
41 XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
42 XAAGetGCKey());
43 Bool ret;
44
45 XAA_SCREEN_PROLOGUE(pScreen, CreateGC);
46
47 if ((ret = (*pScreen->CreateGC) (pGC))) {
48 pGCPriv->wrapOps = NULL;
49 pGCPriv->wrapFuncs = pGC->funcs;
50 pGCPriv->XAAOps = &XAAFallbackOps;
51 pGC->funcs = &XAAGCFuncs;
52 }
53
54 XAA_SCREEN_EPILOGUE(pScreen, CreateGC, XAACreateGC);
55
56 return ret;
57}
58
59static void
60XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
61{
62 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
63
64 XAA_GC_FUNC_PROLOGUE(pGC);
65
66 (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
67
68 if ((changes & GCPlaneMask) &&
69 ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) ==
70 infoRec->FullPlanemasks[pGC->depth - 1])) {
71 pGC->planemask = ~0;
72 }
73
74 if (pGC->depth != 32) {
75 /* 0xffffffff is reserved for transparency */
76 if (pGC->bgPixel == 0xffffffff)
77 pGC->bgPixel = 0x7fffffff;
78 if (pGC->fgPixel == 0xffffffff)
79 pGC->fgPixel = 0x7fffffff;
80 }
81
82 if ((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)) {
83 pGCPriv->flags = OPS_ARE_PIXMAP;
84 pGCPriv->changes |= changes;
85
86 /* make sure we're not using videomemory pixmaps to render
87 onto system memory drawables */
88
89 if ((pGC->fillStyle == FillTiled) &&
90 IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
91 !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {
92
93 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
94 FBAreaPtr area = pPriv->offscreenArea;
95
96 XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
97 xf86FreeOffscreenArea(area);
98 }
99 }
100 else if (!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
101 pGCPriv->flags = 0;
102 pGCPriv->changes |= changes;
103 }
104 else {
105 if (!(pGCPriv->flags & OPS_ARE_ACCEL)) {
106 changes |= pGCPriv->changes;
107 pGCPriv->changes = 0;
108 }
109 pGCPriv->flags = OPS_ARE_ACCEL;
110
111#if 1
112 /* Ugh. If we can't use the blitter on offscreen pixmaps used
113 as tiles, then we need to move them out as cfb can't handle
114 tiles with non-zero origins */
115
116 if ((pGC->fillStyle == FillTiled) &&
117 IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
118 (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser) (pGC))) {
119
120 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
121 FBAreaPtr area = pPriv->offscreenArea;
122
123 XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
124 xf86FreeOffscreenArea(area);
125 }
126#endif
127 }
128
129 XAA_GC_FUNC_EPILOGUE(pGC);
130
131 if (!(pGCPriv->flags & OPS_ARE_ACCEL))
132 return;
133
134 if ((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap) {
135 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
136
137 if (pixPriv->flags & DIRTY) {
138 pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
139 pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
140 }
141 }
142 if ((changes & GCStipple) && pGC->stipple) {
143 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
144
145 if (pixPriv->flags & DIRTY) {
146 pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
147 pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
148 }
149 }
150
151 /* If our Ops are still the default ones we need to allocate new ones */
152 if (pGC->ops == &XAAFallbackOps) {
153 if (!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) {
154 pGCPriv->XAAOps = &XAAFallbackOps;
155 return;
156 }
157 /* make a modifiable copy of the default ops */
158 memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
159 pGC->ops = pGCPriv->XAAOps;
160 changes = ~0;
161 }
162
163 if (!changes)
164 return;
165
166 if ((changes & GCDashList) && infoRec->ComputeDash)
167 infoRec->ComputeDash(pGC);
168
169 if (changes & infoRec->FillSpansMask)
170 (*infoRec->ValidateFillSpans) (pGC, changes, pDraw);
171
172 if (changes & infoRec->SetSpansMask)
173 (*infoRec->ValidateSetSpans) (pGC, changes, pDraw);
174
175 if (changes & infoRec->PutImageMask)
176 (*infoRec->ValidatePutImage) (pGC, changes, pDraw);
177
178 if (changes & infoRec->CopyAreaMask)
179 (*infoRec->ValidateCopyArea) (pGC, changes, pDraw);
180
181 if (changes & infoRec->CopyPlaneMask)
182 (*infoRec->ValidateCopyPlane) (pGC, changes, pDraw);
183
184 if (changes & infoRec->PolyPointMask)
185 (*infoRec->ValidatePolyPoint) (pGC, changes, pDraw);
186
187 if (changes & infoRec->PolylinesMask)
188 (*infoRec->ValidatePolylines) (pGC, changes, pDraw);
189
190 if (changes & infoRec->PolySegmentMask)
191 (*infoRec->ValidatePolySegment) (pGC, changes, pDraw);
192
193 if (changes & infoRec->PolyRectangleMask)
194 (*infoRec->ValidatePolyRectangle) (pGC, changes, pDraw);
195
196 if (changes & infoRec->PolyArcMask)
197 (*infoRec->ValidatePolyArc) (pGC, changes, pDraw);
198
199 if (changes & infoRec->FillPolygonMask)
200 (*infoRec->ValidateFillPolygon) (pGC, changes, pDraw);
201
202 if (changes & infoRec->PolyFillRectMask)
203 (*infoRec->ValidatePolyFillRect) (pGC, changes, pDraw);
204
205 if (changes & infoRec->PolyFillArcMask)
206 (*infoRec->ValidatePolyFillArc) (pGC, changes, pDraw);
207
208 if (changes & infoRec->PolyGlyphBltMask)
209 (*infoRec->ValidatePolyGlyphBlt) (pGC, changes, pDraw);
210
211 if (changes & infoRec->ImageGlyphBltMask)
212 (*infoRec->ValidateImageGlyphBlt) (pGC, changes, pDraw);
213
214 if (changes & infoRec->PolyText8Mask)
215 (*infoRec->ValidatePolyText8) (pGC, changes, pDraw);
216
217 if (changes & infoRec->PolyText16Mask)
218 (*infoRec->ValidatePolyText16) (pGC, changes, pDraw);
219
220 if (changes & infoRec->ImageText8Mask)
221 (*infoRec->ValidateImageText8) (pGC, changes, pDraw);
222
223 if (changes & infoRec->ImageText16Mask)
224 (*infoRec->ValidateImageText16) (pGC, changes, pDraw);
225
226 if (changes & infoRec->PushPixelsMask)
227 (*infoRec->ValidatePushPixels) (pGC, changes, pDraw);
228}
229
230static void
231XAADestroyGC(GCPtr pGC)
232{
233 XAA_GC_FUNC_PROLOGUE(pGC);
234
235 if (pGCPriv->XAAOps != &XAAFallbackOps)
236 free(pGCPriv->XAAOps);
237
238 free(pGCPriv->DashPattern);
239 pGCPriv->flags = 0;
240
241 (*pGC->funcs->DestroyGC) (pGC);
242 XAA_GC_FUNC_EPILOGUE(pGC);
243}
244
245static void
246XAAChangeGC(GCPtr pGC, unsigned long mask)
247{
248 XAA_GC_FUNC_PROLOGUE(pGC);
249 (*pGC->funcs->ChangeGC) (pGC, mask);
250 XAA_GC_FUNC_EPILOGUE(pGC);
251
252 /* we have to assume that shared memory pixmaps are dirty
253 because we can't wrap all operations on them */
254
255 if ((mask & GCTile) && !pGC->tileIsPixel &&
256 PIXMAP_IS_SHARED(pGC->tile.pixmap)) {
257 XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
258
259 pPixPriv->flags |= DIRTY;
260 }
261
262 if ((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)) {
263 XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
264
265 pPixPriv->flags |= DIRTY;
266 }
267}
268
269static void
270XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
271{
272 XAA_GC_FUNC_PROLOGUE(pGCDst);
273 (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
274 XAA_GC_FUNC_EPILOGUE(pGCDst);
275}
276
277static void
278XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
279{
280 XAA_GC_FUNC_PROLOGUE(pGC);
281 (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
282 XAA_GC_FUNC_EPILOGUE(pGC);
283}
284
285static void
286XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc)
287{
288 XAA_GC_FUNC_PROLOGUE(pgcDst);
289 (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
290 XAA_GC_FUNC_EPILOGUE(pgcDst);
291}
292
293static void
294XAADestroyClip(GCPtr pGC)
295{
296 XAA_GC_FUNC_PROLOGUE(pGC);
297 (*pGC->funcs->DestroyClip) (pGC);
298 XAA_GC_FUNC_EPILOGUE(pGC);
299}
300
301/**** Pixmap Wrappers ****/
302
303static void
304XAAFillSpansPixmap(DrawablePtr pDraw,
305 GC * pGC,
306 int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
307{
308 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
309 (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
310 XAA_PIXMAP_OP_EPILOGUE(pGC);
311}
312
313static void
314XAASetSpansPixmap(DrawablePtr pDraw,
315 GCPtr pGC,
316 char *pcharsrc,
317 register DDXPointPtr ppt,
318 int *pwidth, int nspans, int fSorted)
319{
320 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
321 (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
322 XAA_PIXMAP_OP_EPILOGUE(pGC);
323}
324
325static void
326XAAPutImagePixmap(DrawablePtr pDraw,
327 GCPtr pGC,
328 int depth,
329 int x, int y, int w, int h,
330 int leftPad, int format, char *pImage)
331{
332 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
333 (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
334 leftPad, format, pImage);
335 XAA_PIXMAP_OP_EPILOGUE(pGC);
336}
337
338static RegionPtr
339XAACopyAreaPixmap(DrawablePtr pSrc,
340 DrawablePtr pDst,
341 GC * pGC,
342 int srcx, int srcy, int width, int height, int dstx, int dsty)
343{
344 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
345 RegionPtr ret;
346
347 if (infoRec->pScrn->vtSema &&
348 ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) {
349 if (infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
350 (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
351 ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
352 == infoRec->FullPlanemasks[pSrc->depth - 1])) {
353 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst));
354
355 pixPriv->flags |= DIRTY;
356
357 return (XAABitBlt(pSrc, pDst, pGC,
358 srcx, srcy, width, height, dstx, dsty,
359 XAADoImageRead, 0L));
360 }
361 else if (infoRec->NeedToSync) {
362 (*infoRec->Sync) (infoRec->pScrn);
363 infoRec->NeedToSync = FALSE;
364 }
365 }
366
367 {
368 XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
369 ret = (*pGC->ops->CopyArea) (pSrc, pDst,
370 pGC, srcx, srcy, width, height, dstx,
371 dsty);
372 XAA_PIXMAP_OP_EPILOGUE(pGC);
373 }
374 return ret;
375}
376
377static RegionPtr
378XAACopyPlanePixmap(DrawablePtr pSrc,
379 DrawablePtr pDst,
380 GCPtr pGC,
381 int srcx, int srcy,
382 int width, int height,
383 int dstx, int dsty, unsigned long bitPlane)
384{
385 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
386 RegionPtr ret;
387
388 XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
389
390 if (infoRec->pScrn->vtSema &&
391 ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) {
392 if (infoRec->NeedToSync) {
393 (*infoRec->Sync) (infoRec->pScrn);
394 infoRec->NeedToSync = FALSE;
395 }
396 }
397
398 ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
399 pGC, srcx, srcy, width, height, dstx, dsty,
400 bitPlane);
401 XAA_PIXMAP_OP_EPILOGUE(pGC);
402 return ret;
403}
404
405static void
406XAAPolyPointPixmap(DrawablePtr pDraw,
407 GCPtr pGC, int mode, int npt, xPoint * pptInit)
408{
409 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
410 (*pGC->ops->PolyPoint) (pDraw, pGC, mode, npt, pptInit);
411 XAA_PIXMAP_OP_EPILOGUE(pGC);
412}
413
414static void
415XAAPolylinesPixmap(DrawablePtr pDraw,
416 GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)
417{
418 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
419 (*pGC->ops->Polylines) (pDraw, pGC, mode, npt, pptInit);
420 XAA_PIXMAP_OP_EPILOGUE(pGC);
421}
422
423static void
424XAAPolySegmentPixmap(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment * pSeg)
425{
426 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
427 (*pGC->ops->PolySegment) (pDraw, pGC, nseg, pSeg);
428 XAA_PIXMAP_OP_EPILOGUE(pGC);
429}
430
431static void
432XAAPolyRectanglePixmap(DrawablePtr pDraw,
433 GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
434{
435 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
436 (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
437 XAA_PIXMAP_OP_EPILOGUE(pGC);
438}
439
440static void
441XAAPolyArcPixmap(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
442{
443 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
444 (*pGC->ops->PolyArc) (pDraw, pGC, narcs, parcs);
445 XAA_PIXMAP_OP_EPILOGUE(pGC);
446}
447
448static void
449XAAFillPolygonPixmap(DrawablePtr pDraw,
450 GCPtr pGC,
451 int shape, int mode, int count, DDXPointPtr ptsIn)
452{
453 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
454 (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, ptsIn);
455 XAA_PIXMAP_OP_EPILOGUE(pGC);
456}
457
458static void
459XAAPolyFillRectPixmap(DrawablePtr pDraw,
460 GCPtr pGC, int nrectFill, xRectangle *prectInit)
461{
462 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
463 (*pGC->ops->PolyFillRect) (pDraw, pGC, nrectFill, prectInit);
464 XAA_PIXMAP_OP_EPILOGUE(pGC);
465}
466
467static void
468XAAPolyFillArcPixmap(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
469{
470 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
471 (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, parcs);
472 XAA_PIXMAP_OP_EPILOGUE(pGC);
473}
474
475static int
476XAAPolyText8Pixmap(DrawablePtr pDraw,
477 GCPtr pGC, int x, int y, int count, char *chars)
478{
479 int ret;
480
481 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
482 ret = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
483 XAA_PIXMAP_OP_EPILOGUE(pGC);
484 return ret;
485}
486
487static int
488XAAPolyText16Pixmap(DrawablePtr pDraw,
489 GCPtr pGC, int x, int y, int count, unsigned short *chars)
490{
491 int ret;
492
493 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
494 ret = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
495 XAA_PIXMAP_OP_EPILOGUE(pGC);
496 return ret;
497}
498
499static void
500XAAImageText8Pixmap(DrawablePtr pDraw,
501 GCPtr pGC, int x, int y, int count, char *chars)
502{
503 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
504 (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
505 XAA_PIXMAP_OP_EPILOGUE(pGC);
506}
507
508static void
509XAAImageText16Pixmap(DrawablePtr pDraw,
510 GCPtr pGC, int x, int y, int count, unsigned short *chars)
511{
512 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
513 (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
514 XAA_PIXMAP_OP_EPILOGUE(pGC);
515}
516
517static void
518XAAImageGlyphBltPixmap(DrawablePtr pDraw,
519 GCPtr pGC,
520 int xInit, int yInit,
521 unsigned int nglyph,
522 CharInfoPtr * ppci, pointer pglyphBase)
523{
524 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
525 (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph,
526 ppci, pglyphBase);
527 XAA_PIXMAP_OP_EPILOGUE(pGC);
528}
529
530static void
531XAAPolyGlyphBltPixmap(DrawablePtr pDraw,
532 GCPtr pGC,
533 int xInit, int yInit,
534 unsigned int nglyph,
535 CharInfoPtr * ppci, pointer pglyphBase)
536{
537 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
538 (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, xInit, yInit, nglyph,
539 ppci, pglyphBase);
540 XAA_PIXMAP_OP_EPILOGUE(pGC);
541}
542
543static void
544XAAPushPixelsPixmap(GCPtr pGC,
545 PixmapPtr pBitMap,
546 DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
547{
548 XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
549 (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
550 XAA_PIXMAP_OP_EPILOGUE(pGC);
551}
552
553GCOps XAAPixmapOps = {
554 XAAFillSpansPixmap, XAASetSpansPixmap,
555 XAAPutImagePixmap, XAACopyAreaPixmap,
556 XAACopyPlanePixmap, XAAPolyPointPixmap,
557 XAAPolylinesPixmap, XAAPolySegmentPixmap,
558 XAAPolyRectanglePixmap, XAAPolyArcPixmap,
559 XAAFillPolygonPixmap, XAAPolyFillRectPixmap,
560 XAAPolyFillArcPixmap, XAAPolyText8Pixmap,
561 XAAPolyText16Pixmap, XAAImageText8Pixmap,
562 XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
563 XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap,
564};
diff --git a/hw/xfree86/xaa/xaaGCmisc.c b/hw/xfree86/xaa/xaaGCmisc.c
deleted file mode 100644
index ca69aae74..000000000
--- a/hw/xfree86/xaa/xaaGCmisc.c
+++ /dev/null
@@ -1,412 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include <X11/fonts/fontstruct.h>
13#include "dixfontstr.h"
14#include "xf86str.h"
15#include "xaa.h"
16#include "xaalocal.h"
17#include "migc.h"
18#include "mi.h"
19#include "gcstruct.h"
20#include "pixmapstr.h"
21
22void
23XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
24{
25 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
26
27 if (infoRec->CopyArea &&
28 CHECK_PLANEMASK(pGC, infoRec->CopyAreaFlags) &&
29 CHECK_ROP(pGC, infoRec->CopyAreaFlags) &&
30 CHECK_ROPSRC(pGC, infoRec->CopyAreaFlags)
31 )
32 pGC->ops->CopyArea = infoRec->CopyArea;
33 else
34 pGC->ops->CopyArea = XAAFallbackOps.CopyArea;
35}
36
37void
38XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
39{
40 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
41
42 if (infoRec->PutImage &&
43 CHECK_PLANEMASK(pGC, infoRec->PutImageFlags) &&
44 CHECK_ROP(pGC, infoRec->PutImageFlags) &&
45 CHECK_ROPSRC(pGC, infoRec->PutImageFlags) &&
46 CHECK_COLORS(pGC, infoRec->PutImageFlags)
47 )
48 pGC->ops->PutImage = infoRec->PutImage;
49 else
50 pGC->ops->PutImage = XAAFallbackOps.PutImage;
51}
52
53void
54XAAValidateCopyPlane(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
55{
56 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
57
58 if (infoRec->CopyPlane &&
59 CHECK_PLANEMASK(pGC, infoRec->CopyPlaneFlags) &&
60 CHECK_ROP(pGC, infoRec->CopyPlaneFlags) &&
61 CHECK_ROPSRC(pGC, infoRec->CopyPlaneFlags) &&
62 CHECK_COLORS(pGC, infoRec->CopyPlaneFlags)
63 )
64 pGC->ops->CopyPlane = infoRec->CopyPlane;
65 else
66 pGC->ops->CopyPlane = XAAFallbackOps.CopyPlane;
67}
68
69void
70XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
71{
72 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
73
74 if (infoRec->PushPixelsSolid &&
75 (pGC->fillStyle == FillSolid) &&
76 CHECK_PLANEMASK(pGC, infoRec->PushPixelsFlags) &&
77 CHECK_ROP(pGC, infoRec->PushPixelsFlags) &&
78 CHECK_ROPSRC(pGC, infoRec->PushPixelsFlags) &&
79 CHECK_FG(pGC, infoRec->PushPixelsFlags) &&
80 (!(infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY) ||
81 (pGC->alu == GXcopy))
82 )
83 pGC->ops->PushPixels = infoRec->PushPixelsSolid;
84 else
85 pGC->ops->PushPixels = XAAFallbackOps.PushPixels;
86
87}
88
89/* We make the assumption that the FillSpans, PolyFillRect, FillPolygon
90 and PolyFillArc functions are linked in a way that they all have
91 the same rop/color/planemask restrictions. If the driver provides
92 a GC level replacement for these, it will need to supply a new
93 Validate functions if it breaks this assumption */
94
95void
96XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
97{
98 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
99
100 if (pGC->fillStyle != FillTiled)
101 changes &= ~GCTile;
102 if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillSolid))
103 changes &= ~GCStipple;
104 if (!changes)
105 return;
106
107 pGC->ops->FillSpans = XAAFallbackOps.FillSpans;
108 pGC->ops->PolyFillRect = XAAFallbackOps.PolyFillRect;
109 pGC->ops->FillPolygon = XAAFallbackOps.FillPolygon;
110 pGC->ops->PolyFillArc = XAAFallbackOps.PolyFillArc;
111
112 switch (pGC->fillStyle) {
113 case FillSolid:
114 if (infoRec->FillSpansSolid &&
115 CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) &&
116 CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) &&
117 CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) &&
118 CHECK_FG(pGC, infoRec->FillSpansSolidFlags)
119 ) {
120 pGC->ops->FillSpans = infoRec->FillSpansSolid;
121 pGC->ops->PolyFillRect = infoRec->PolyFillRectSolid;
122 pGC->ops->FillPolygon = infoRec->FillPolygonSolid;
123 pGC->ops->PolyFillArc = infoRec->PolyFillArcSolid;
124 }
125 break;
126 /* The [Stippled/OpaqueStippled/Tiled]FillChooser
127 functions do the validating */
128 case FillStippled:
129 if (infoRec->FillSpansStippled) {
130 pGC->ops->FillSpans = infoRec->FillSpansStippled;
131 pGC->ops->PolyFillRect = infoRec->PolyFillRectStippled;
132 if (infoRec->FillPolygonStippled)
133 pGC->ops->FillPolygon = infoRec->FillPolygonStippled;
134 else
135 pGC->ops->FillPolygon = miFillPolygon;
136 pGC->ops->PolyFillArc = miPolyFillArc;
137 }
138 break;
139 case FillOpaqueStippled:
140 if (infoRec->FillSpansOpaqueStippled) {
141 pGC->ops->FillSpans = infoRec->FillSpansOpaqueStippled;
142 pGC->ops->PolyFillRect = infoRec->PolyFillRectOpaqueStippled;
143 if (infoRec->FillPolygonOpaqueStippled)
144 pGC->ops->FillPolygon = infoRec->FillPolygonOpaqueStippled;
145 else
146 pGC->ops->FillPolygon = miFillPolygon;
147 pGC->ops->PolyFillArc = miPolyFillArc;
148 }
149 break;
150 case FillTiled:
151 if (infoRec->FillSpansTiled) {
152 pGC->ops->FillSpans = infoRec->FillSpansTiled;
153 pGC->ops->PolyFillRect = infoRec->PolyFillRectTiled;
154 if (infoRec->FillPolygonTiled)
155 pGC->ops->FillPolygon = infoRec->FillPolygonTiled;
156 else
157 pGC->ops->FillPolygon = miFillPolygon;
158 pGC->ops->PolyFillArc = miPolyFillArc;
159 }
160 break;
161 default:
162 return;
163 }
164}
165
166/* We make the assumption that these Text8/16 and GlyphBlt functions
167 are linked in a way that they all have the same rop/color/planemask
168 restrictions. If the driver provides a GC level replacement for
169 these, it will need to supply a new Validate functions if it breaks
170 this assumption */
171
172void
173XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
174{
175 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
176 Bool BigFont = FALSE;
177
178 pGC->ops->PolyText8 = XAAFallbackOps.PolyText8;
179 pGC->ops->PolyText16 = XAAFallbackOps.PolyText16;
180 pGC->ops->PolyGlyphBlt = XAAFallbackOps.PolyGlyphBlt;
181
182 if (!pGC->font)
183 return;
184 if (pGC->fillStyle != FillSolid)
185 return;
186
187 if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
188 FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
189 BigFont = TRUE;
190
191 /* no funny business */
192 if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
193 ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
194 return;
195
196 /* Check for TE Fonts */
197 if (!TERMINALFONT(pGC->font) || BigFont) {
198 if (infoRec->PolyGlyphBltNonTE &&
199 CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
200 CHECK_ROP(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
201 CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
202 CHECK_FG(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
203 (!(infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
204 (pGC->alu == GXcopy))
205 ) {
206 pGC->ops->PolyText8 = infoRec->PolyText8NonTE;
207 pGC->ops->PolyText16 = infoRec->PolyText16NonTE;
208 pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltNonTE;
209 }
210 }
211 else {
212 if (infoRec->PolyGlyphBltTE &&
213 CHECK_PLANEMASK(pGC, infoRec->PolyGlyphBltTEFlags) &&
214 CHECK_ROP(pGC, infoRec->PolyGlyphBltTEFlags) &&
215 CHECK_ROPSRC(pGC, infoRec->PolyGlyphBltNonTEFlags) &&
216 CHECK_FG(pGC, infoRec->PolyGlyphBltTEFlags) &&
217 (!(infoRec->PolyGlyphBltTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
218 (pGC->alu == GXcopy))
219 ) {
220 pGC->ops->PolyText8 = infoRec->PolyText8TE;
221 pGC->ops->PolyText16 = infoRec->PolyText16TE;
222 pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltTE;
223 }
224 }
225}
226
227void
228XAAValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
229{
230 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
231 Bool BigFont = FALSE;
232
233 pGC->ops->ImageText8 = XAAFallbackOps.ImageText8;
234 pGC->ops->ImageText16 = XAAFallbackOps.ImageText16;
235 pGC->ops->ImageGlyphBlt = XAAFallbackOps.ImageGlyphBlt;
236
237 if (!pGC->font)
238 return;
239
240 if ((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
241 FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
242 BigFont = TRUE;
243
244 /* no funny business */
245 if ((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
246 ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
247 return;
248
249 /* Check for TE Fonts */
250 if (!TERMINALFONT(pGC->font) || BigFont || (pGC->depth == 32)) {
251 if (infoRec->ImageGlyphBltNonTE &&
252 CHECK_PLANEMASK(pGC, infoRec->ImageGlyphBltNonTEFlags) &&
253 CHECK_FG(pGC, infoRec->ImageGlyphBltNonTEFlags) &&
254 infoRec->SetupForSolidFill &&
255 CHECK_PLANEMASK(pGC, infoRec->SolidFillFlags) &&
256 CHECK_BG(pGC, infoRec->SolidFillFlags)) {
257 pGC->ops->ImageText8 = infoRec->ImageText8NonTE;
258 pGC->ops->ImageText16 = infoRec->ImageText16NonTE;
259 pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltNonTE;
260 }
261 }
262 else if (infoRec->ImageGlyphBltTE &&
263 CHECK_PLANEMASK(pGC, infoRec->ImageGlyphBltTEFlags)) {
264 if (!(infoRec->ImageGlyphBltTEFlags & TRANSPARENCY_ONLY) &&
265 CHECK_COLORS(pGC, infoRec->ImageGlyphBltTEFlags)) {
266 pGC->ops->ImageText8 = infoRec->ImageText8TE;
267 pGC->ops->ImageText16 = infoRec->ImageText16TE;
268 pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
269 }
270 else {
271 if (CHECK_FG(pGC, infoRec->ImageGlyphBltTEFlags) &&
272 infoRec->SetupForSolidFill &&
273 CHECK_PLANEMASK(pGC, infoRec->SolidFillFlags) &&
274 CHECK_BG(pGC, infoRec->SolidFillFlags)) {
275 pGC->ops->ImageText8 = infoRec->ImageText8TE;
276 pGC->ops->ImageText16 = infoRec->ImageText16TE;
277 pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
278 }
279 }
280 }
281}
282
283void
284XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
285{
286 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
287 XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
288 XAAGetGCKey());
289
290 if (pGC->lineStyle == LineSolid)
291 changes &= ~GCDashList;
292 if (!changes)
293 return;
294
295 pGC->ops->PolySegment = XAAFallbackOps.PolySegment;
296 pGC->ops->Polylines = XAAFallbackOps.Polylines;
297 pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle;
298 pGC->ops->PolyArc = XAAFallbackOps.PolyArc;
299
300 if ((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) &&
301 (pGC->lineWidth > 0)) {
302
303 pGC->ops->PolyArc = miPolyArc;
304 pGC->ops->PolySegment = miPolySegment;
305 pGC->ops->PolyRectangle = miPolyRectangle;
306 if (pGC->lineStyle == LineSolid)
307 pGC->ops->Polylines = miWideLine;
308 else
309 pGC->ops->Polylines = miWideDash;
310 }
311
312 if ((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) {
313
314 if (pGC->lineStyle == LineSolid) {
315
316 if (infoRec->PolyRectangleThinSolid &&
317 CHECK_PLANEMASK(pGC, infoRec->PolyRectangleThinSolidFlags) &&
318 CHECK_ROP(pGC, infoRec->PolyRectangleThinSolidFlags) &&
319 CHECK_ROPSRC(pGC, infoRec->PolyRectangleThinSolidFlags) &&
320 CHECK_FG(pGC, infoRec->PolyRectangleThinSolidFlags)) {
321
322 pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid;
323 }
324
325 if (infoRec->PolySegmentThinSolid &&
326 CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinSolidFlags) &&
327 CHECK_ROP(pGC, infoRec->PolySegmentThinSolidFlags) &&
328 CHECK_ROPSRC(pGC, infoRec->PolySegmentThinSolidFlags) &&
329 CHECK_FG(pGC, infoRec->PolySegmentThinSolidFlags)) {
330
331 pGC->ops->PolySegment = infoRec->PolySegmentThinSolid;
332 }
333
334 if (infoRec->PolylinesThinSolid &&
335 CHECK_PLANEMASK(pGC, infoRec->PolylinesThinSolidFlags) &&
336 CHECK_ROP(pGC, infoRec->PolylinesThinSolidFlags) &&
337 CHECK_ROPSRC(pGC, infoRec->PolylinesThinSolidFlags) &&
338 CHECK_FG(pGC, infoRec->PolylinesThinSolidFlags)) {
339
340 pGC->ops->Polylines = infoRec->PolylinesThinSolid;
341 }
342 }
343 else if ((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern) {
344
345 if (infoRec->PolySegmentThinDashed &&
346 !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) &&
347 ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags &
348 TRANSPARENCY_GXCOPY_ONLY)) &&
349 CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) &&
350 CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) &&
351 CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) &&
352 CHECK_FG(pGC, infoRec->PolySegmentThinDashedFlags)) {
353
354 pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
355 }
356
357 if (infoRec->PolylinesThinDashed &&
358 !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) &&
359 ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags &
360 TRANSPARENCY_GXCOPY_ONLY)) &&
361 CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) &&
362 CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) &&
363 CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) &&
364 CHECK_FG(pGC, infoRec->PolylinesThinDashedFlags)) {
365
366 pGC->ops->Polylines = infoRec->PolylinesThinDashed;
367 }
368
369 if (pGC->ops->Polylines != XAAFallbackOps.Polylines)
370 pGC->ops->PolyRectangle = miPolyRectangle;
371
372 }
373 else if (pGCPriv->DashPattern && (pGC->depth != 32)) {
374 /* LineDoubleDash */
375 if (infoRec->PolySegmentThinDashed &&
376 !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) &&
377 CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) &&
378 CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) &&
379 CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) &&
380 CHECK_COLORS(pGC, infoRec->PolySegmentThinDashedFlags)) {
381
382 pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
383 }
384
385 if (infoRec->PolylinesThinDashed &&
386 !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) &&
387 CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) &&
388 CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) &&
389 CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) &&
390 CHECK_COLORS(pGC, infoRec->PolylinesThinDashedFlags)) {
391
392 pGC->ops->Polylines = infoRec->PolylinesThinDashed;
393 }
394
395 if (pGC->ops->Polylines != XAAFallbackOps.Polylines)
396 pGC->ops->PolyRectangle = miPolyRectangle;
397
398 }
399 }
400
401 if (infoRec->PolylinesWideSolid &&
402 (pGC->lineWidth > 0) &&
403 (pGC->fillStyle == FillSolid) &&
404 (pGC->lineStyle == LineSolid) &&
405 CHECK_PLANEMASK(pGC, infoRec->PolylinesWideSolidFlags) &&
406 CHECK_ROP(pGC, infoRec->PolylinesWideSolidFlags) &&
407 CHECK_ROPSRC(pGC, infoRec->PolylinesWideSolidFlags) &&
408 CHECK_FG(pGC, infoRec->PolylinesWideSolidFlags)) {
409
410 pGC->ops->Polylines = infoRec->PolylinesWideSolid;
411 }
412}
diff --git a/hw/xfree86/xaa/xaaImage.c b/hw/xfree86/xaa/xaaImage.c
deleted file mode 100644
index 4457c9efa..000000000
--- a/hw/xfree86/xaa/xaaImage.c
+++ /dev/null
@@ -1,534 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9#include "servermd.h"
10
11#include <X11/X.h>
12#include "scrnintstr.h"
13#include "mi.h"
14#include "pixmapstr.h"
15#include "xf86str.h"
16#include "xaa.h"
17#include "xaalocal.h"
18
19void
20XAAMoveDWORDS_FixedBase(register CARD32 *dest,
21 register CARD32 *src, register int dwords)
22{
23 while (dwords & ~0x03) {
24 *dest = *src;
25 *dest = *(src + 1);
26 *dest = *(src + 2);
27 *dest = *(src + 3);
28 dwords -= 4;
29 src += 4;
30 }
31
32 if (!dwords)
33 return;
34 *dest = *src;
35 if (dwords == 1)
36 return;
37 *dest = *(src + 1);
38 if (dwords == 2)
39 return;
40 *dest = *(src + 2);
41}
42
43void
44XAAMoveDWORDS(register CARD32 *dest, register CARD32 *src, register int dwords)
45{
46 while (dwords & ~0x03) {
47 *dest = *src;
48 *(dest + 1) = *(src + 1);
49 *(dest + 2) = *(src + 2);
50 *(dest + 3) = *(src + 3);
51 src += 4;
52 dest += 4;
53 dwords -= 4;
54 }
55 if (!dwords)
56 return;
57 *dest = *src;
58 if (dwords == 1)
59 return;
60 *(dest + 1) = *(src + 1);
61 if (dwords == 2)
62 return;
63 *(dest + 2) = *(src + 2);
64}
65
66void
67XAAMoveDWORDS_FixedSrc(register CARD32 *dest,
68 register CARD32 *src, register int dwords)
69{
70 while (dwords & ~0x03) {
71 *dest = *src;
72 *(dest + 1) = *src;
73 *(dest + 2) = *src;
74 *(dest + 3) = *src;
75 dest += 4;
76 dwords -= 4;
77 }
78 if (!dwords)
79 return;
80 *dest = *src;
81 if (dwords == 1)
82 return;
83 *(dest + 1) = *src;
84 if (dwords == 2)
85 return;
86 *(dest + 2) = *src;
87}
88
89static void
90XAAWritePixmap32To24(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *srcInit, int srcwidth, /* bytes */
91 int rop, unsigned int planemask, int trans)
92{
93 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
94 int count, dwords = bytes_to_int32(w * 3);
95 CARD32 *src, *dst;
96 Bool PlusOne = FALSE;
97
98 if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
99 ((dwords * h) & 0x01)) {
100 PlusOne = TRUE;
101 }
102
103 (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, trans, 24, 24);
104 (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, 0);
105
106 if (dwords > infoRec->ImageWriteRange) {
107 dst = (CARD32 *) infoRec->ImageWriteBase;
108 while (h--) {
109 src = (CARD32 *) srcInit;
110 count = w;
111
112 while (count >= 4) {
113 *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
114 *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
115 *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
116 src += 4;
117 count -= 4;
118 }
119 switch (count) {
120 case 0:
121 break;
122 case 1:
123 *dst = src[0];
124 break;
125 case 2:
126 *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
127 *dst = src[1] >> 8;
128 break;
129 default:
130 *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
131 *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
132 *dst = src[2] >> 16;
133 break;
134 }
135 srcInit += srcwidth;
136 }
137 }
138 else {
139 while (h--) {
140 dst = (CARD32 *) infoRec->ImageWriteBase;
141 src = (CARD32 *) srcInit;
142 count = w;
143
144 while (count >= 4) {
145 dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
146 dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
147 dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
148 dst += 3;
149 src += 4;
150 count -= 4;
151 }
152 switch (count) {
153 case 0:
154 break;
155 case 1:
156 dst[0] = src[0];
157 break;
158 case 2:
159 dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
160 dst[1] = src[1] >> 8;
161 break;
162 default:
163 dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
164 dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
165 dst[2] = src[2] >> 16;
166 break;
167 }
168 srcInit += srcwidth;
169 }
170 }
171
172 if (PlusOne) {
173 CARD32 *base = (CARD32 *) infoRec->ImageWriteBase;
174
175 *base = 0x00000000;
176 }
177
178 if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
179 (*infoRec->Sync) (pScrn);
180 else
181 SET_SYNC_FLAG(infoRec);
182
183}
184
185void
186XAAWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */
187 int rop, unsigned int planemask, int trans, int bpp, int depth)
188{
189 XAAInfoRecPtr infoRec;
190 int dwords, skipleft, Bpp;
191 Bool beCareful, PlusOne;
192
193 if ((bpp == 32) && (pScrn->bitsPerPixel == 24)) {
194 XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth,
195 rop, planemask, trans);
196 return;
197 }
198
199 infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
200 beCareful = PlusOne = FALSE;
201 Bpp = bpp >> 3;
202
203 if ((skipleft = (long) src & 0x03L)) {
204 if (!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
205 skipleft = 0;
206 beCareful = TRUE;
207 goto BAD_ALIGNMENT;
208 }
209
210 if (Bpp == 3)
211 skipleft = 4 - skipleft;
212 else
213 skipleft /= Bpp;
214
215 if ((x < skipleft) && !(infoRec->ImageWriteFlags &
216 LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
217 skipleft = 0;
218 beCareful = TRUE;
219 goto BAD_ALIGNMENT;
220 }
221
222 x -= skipleft;
223 w += skipleft;
224
225 if (Bpp == 3)
226 src -= 3 * skipleft;
227 else /* is this Alpha friendly ? */
228 src = (unsigned char *) ((long) src & ~0x03L);
229 }
230
231 BAD_ALIGNMENT:
232
233 dwords = bytes_to_int32(w * Bpp);
234
235 if ((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
236 ((dwords * h) & 0x01)) {
237 PlusOne = TRUE;
238 }
239
240 (*infoRec->SetupForImageWrite) (pScrn, rop, planemask, trans, bpp, depth);
241 (*infoRec->SubsequentImageWriteRect) (pScrn, x, y, w, h, skipleft);
242
243 if (beCareful) {
244 /* in cases with bad alignment we have to be careful not
245 to read beyond the end of the source */
246 if (((x * Bpp) + (dwords << 2)) > srcwidth)
247 h--;
248 else
249 beCareful = FALSE;
250 }
251
252 if (dwords > infoRec->ImageWriteRange) {
253 while (h--) {
254 XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase,
255 (CARD32 *) src, dwords);
256 src += srcwidth;
257 }
258 if (beCareful) {
259 int shift = ((long) src & 0x03L) << 3;
260
261 if (--dwords)
262 XAAMoveDWORDS_FixedBase((CARD32 *) infoRec->ImageWriteBase,
263 (CARD32 *) src, dwords);
264 src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L);
265 *((CARD32 *) infoRec->ImageWriteBase) = *((CARD32 *) src) >> shift;
266 }
267 }
268 else {
269 if (srcwidth == (dwords << 2)) {
270 int decrement = infoRec->ImageWriteRange / dwords;
271
272 while (h > decrement) {
273 XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
274 (CARD32 *) src, dwords * decrement);
275 src += (srcwidth * decrement);
276 h -= decrement;
277 }
278 if (h) {
279 XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
280 (CARD32 *) src, dwords * h);
281 if (beCareful)
282 src += (srcwidth * h);
283 }
284 }
285 else {
286 while (h--) {
287 XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
288 (CARD32 *) src, dwords);
289 src += srcwidth;
290 }
291 }
292
293 if (beCareful) {
294 int shift = ((long) src & 0x03L) << 3;
295
296 if (--dwords)
297 XAAMoveDWORDS((CARD32 *) infoRec->ImageWriteBase,
298 (CARD32 *) src, dwords);
299 src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L);
300
301 ((CARD32 *) infoRec->ImageWriteBase)[dwords] =
302 *((CARD32 *) src) >> shift;
303 }
304 }
305
306 if (PlusOne) {
307 CARD32 *base = (CARD32 *) infoRec->ImageWriteBase;
308
309 *base = 0x00000000;
310 }
311
312 if (infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
313 (*infoRec->Sync) (pScrn);
314 else
315 SET_SYNC_FLAG(infoRec);
316}
317
318void
319XAAWritePixmapScanline(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */
320 int rop,
321 unsigned int planemask, int trans, int bpp, int depth)
322{
323 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
324 int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3;
325 Bool beCareful = FALSE;
326 CARD32 *base;
327
328 if ((skipleft = (long) src & 0x03L)) {
329 if (!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) {
330 skipleft = 0;
331 beCareful = TRUE;
332 goto BAD_ALIGNMENT;
333 }
334
335 if (Bpp == 3)
336 skipleft = 4 - skipleft;
337 else
338 skipleft /= Bpp;
339
340 if ((x < skipleft) && !(infoRec->ScanlineImageWriteFlags &
341 LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
342 skipleft = 0;
343 beCareful = TRUE;
344 goto BAD_ALIGNMENT;
345 }
346
347 x -= skipleft;
348 w += skipleft;
349
350 if (Bpp == 3)
351 src -= 3 * skipleft;
352 else
353 src = (unsigned char *) ((long) src & ~0x03L);
354 }
355
356 BAD_ALIGNMENT:
357
358 dwords = bytes_to_int32(w * Bpp);
359
360 (*infoRec->SetupForScanlineImageWrite) (pScrn, rop, planemask, trans, bpp,
361 depth);
362 (*infoRec->SubsequentScanlineImageWriteRect) (pScrn, x, y, w, h, skipleft);
363
364 if (beCareful) {
365 /* in cases with bad alignment we have to be careful not
366 to read beyond the end of the source */
367 if (((x * Bpp) + (dwords << 2)) > srcwidth)
368 h--;
369 else
370 beCareful = FALSE;
371 }
372
373 while (h--) {
374 base = (CARD32 *) infoRec->ScanlineImageWriteBuffers[bufferNo];
375 XAAMoveDWORDS(base, (CARD32 *) src, dwords);
376 (*infoRec->SubsequentImageWriteScanline) (pScrn, bufferNo++);
377 src += srcwidth;
378 if (bufferNo >= infoRec->NumScanlineImageWriteBuffers)
379 bufferNo = 0;
380 }
381
382 if (beCareful) {
383 int shift = ((long) src & 0x03L) << 3;
384
385 base = (CARD32 *) infoRec->ScanlineImageWriteBuffers[bufferNo];
386 if (--dwords)
387 XAAMoveDWORDS(base, (CARD32 *) src, dwords);
388 src = (unsigned char *) ((long) (src + (dwords << 2)) & ~0x03L);
389
390 base[dwords] = *((CARD32 *) src) >> shift;
391 (*infoRec->SubsequentImageWriteScanline) (pScrn, bufferNo);
392 }
393
394 SET_SYNC_FLAG(infoRec);
395}
396
397void
398XAAPutImage(DrawablePtr pDraw,
399 GCPtr pGC,
400 int depth,
401 int x, int y, int w, int h, int leftPad, int format, char *pImage)
402{
403 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
404 int bpp = BitsPerPixel(depth);
405 Bool depthBug = FALSE;
406
407 if (!w || !h)
408 return;
409
410 if (!RegionNumRects(pGC->pCompositeClip))
411 return;
412
413 depthBug = XAA_DEPTH_BUG(pGC);
414
415 if (((format == ZPixmap) && infoRec->WritePixmap &&
416 ((pDraw->bitsPerPixel == bpp) ||
417 ((pDraw->bitsPerPixel == 24) && (bpp == 32) &&
418 (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
419 CHECK_ROP(pGC, infoRec->WritePixmapFlags) &&
420 CHECK_ROPSRC(pGC, infoRec->WritePixmapFlags) &&
421 CHECK_PLANEMASK(pGC, infoRec->WritePixmapFlags) &&
422 CHECK_NO_GXCOPY(pGC, infoRec->WritePixmapFlags)) ||
423 ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap &&
424 CHECK_ROP(pGC, infoRec->WriteBitmapFlags) &&
425 CHECK_ROPSRC(pGC, infoRec->WriteBitmapFlags) &&
426 CHECK_PLANEMASK(pGC, infoRec->WriteBitmapFlags) &&
427 CHECK_COLORS(pGC, infoRec->WriteBitmapFlags) &&
428 !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) ||
429 ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap &&
430 CHECK_ROP(pGC, infoRec->WriteBitmapFlags) &&
431 CHECK_ROPSRC(pGC, infoRec->WriteBitmapFlags) &&
432 !(infoRec->WriteBitmapFlags & NO_PLANEMASK) &&
433 !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))) {
434
435 int MaxBoxes = RegionNumRects(pGC->pCompositeClip);
436 BoxPtr pbox, pClipBoxes;
437 int nboxes, srcx, srcy, srcwidth;
438 xRectangle TheRect;
439
440 TheRect.x = pDraw->x + x;
441 TheRect.y = pDraw->y + y;
442 TheRect.width = w;
443 TheRect.height = h;
444
445 if (MaxBoxes > (infoRec->PreAllocSize / sizeof(BoxRec))) {
446 pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
447 if (!pClipBoxes)
448 return;
449 }
450 else
451 pClipBoxes = (BoxPtr) infoRec->PreAllocMem;
452
453 nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
454 pbox = pClipBoxes;
455
456 if (format == XYBitmap) {
457 srcwidth = BitmapBytePad(leftPad + w);
458 while (nboxes--) {
459 srcx = pbox->x1 - TheRect.x + leftPad;
460 srcy = pbox->y1 - TheRect.y;
461 (*infoRec->WriteBitmap) (infoRec->pScrn, pbox->x1, pbox->y1,
462 pbox->x2 - pbox->x1,
463 pbox->y2 - pbox->y1,
464 (unsigned char *) pImage +
465 (srcwidth * srcy) + ((srcx >> 5) << 2),
466 srcwidth, srcx & 31, pGC->fgPixel,
467 pGC->bgPixel, pGC->alu,
468 pGC->planemask);
469 pbox++;
470 }
471 }
472 else if (format == ZPixmap) {
473 int Bpp = bpp >> 3;
474
475 srcwidth = PixmapBytePad(leftPad + w, depth);
476 while (nboxes--) {
477 srcx = pbox->x1 - TheRect.x + leftPad;
478 srcy = pbox->y1 - TheRect.y;
479 (*infoRec->WritePixmap) (infoRec->pScrn, pbox->x1, pbox->y1,
480 pbox->x2 - pbox->x1,
481 pbox->y2 - pbox->y1,
482 (unsigned char *) pImage +
483 (srcwidth * srcy) + (srcx * Bpp),
484 srcwidth, pGC->alu, pGC->planemask, -1,
485 Bpp << 3, depth);
486 pbox++;
487 }
488 }
489 else { /* XYPixmap */
490 int depth = pGC->depth;
491 int numBox, increment;
492 unsigned long i, mask;
493 BoxPtr pntBox;
494
495 srcwidth = BitmapBytePad(w + leftPad);
496 increment = h * srcwidth;
497 i = 1 << (depth - 1);
498 mask = ~0;
499
500 if ((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) &&
501 (pGC->depth == 8)) {
502 i = 0x80000000;
503 mask = 0xff000000;
504 }
505
506 for (; i & mask; i >>= 1, pImage += increment) {
507 if (i & pGC->planemask) {
508 pntBox = pbox;
509 numBox = nboxes;
510 while (numBox--) {
511 srcx = pntBox->x1 - TheRect.x + leftPad;
512 srcy = pntBox->y1 - TheRect.y;
513 (*infoRec->WriteBitmap) (infoRec->pScrn,
514 pntBox->x1, pntBox->y1,
515 pntBox->x2 - pntBox->x1,
516 pntBox->y2 - pntBox->y1,
517 (unsigned char *) pImage +
518 (srcwidth * srcy) +
519 ((srcx >> 5) << 2), srcwidth,
520 srcx & 31, ~0, 0, pGC->alu, i);
521 pntBox++;
522 }
523 }
524 }
525
526 }
527
528 if (pClipBoxes != (BoxPtr) infoRec->PreAllocMem)
529 free(pClipBoxes);
530 }
531 else
532 XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad,
533 format, pImage);
534}
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
deleted file mode 100644
index f146f3adf..000000000
--- a/hw/xfree86/xaa/xaaInit.c
+++ /dev/null
@@ -1,635 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "pixmapstr.h"
13#include "windowstr.h"
14#include "xf86str.h"
15#include "mi.h"
16#include "miline.h"
17#include "xaa.h"
18#include "xaalocal.h"
19#include "xaawrap.h"
20#include "xf86fbman.h"
21#include "servermd.h"
22#ifdef COMPOSITE
23#include "cw.h"
24#endif
25
26#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */
27
28#define MIN_OFFPIX_SIZE (320*200)
29
30static Bool XAACloseScreen(ScreenPtr pScreen);
31static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
32 unsigned int format, unsigned long planemask,
33 char *pdstLine);
34static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
35 int *pwidth, int nspans, char *pdstStart);
36static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
37 unsigned usage_hint);
38static Bool XAADestroyPixmap(PixmapPtr pPixmap);
39static Bool XAAEnterVT(ScrnInfoPtr pScrn);
40static void XAALeaveVT(ScrnInfoPtr pScrn);
41static int XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet);
42static void XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
43static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
44
45static DevPrivateKeyRec XAAScreenKeyRec;
46
47#define XAAScreenKey (&XAAScreenKeyRec)
48static DevPrivateKeyRec XAAGCKeyRec;
49
50#define XAAGCKey (&XAAGCKeyRec)
51static DevPrivateKeyRec XAAPixmapKeyRec;
52
53#define XAAPixmapKey (&XAAPixmapKeyRec)
54
55DevPrivateKey
56XAAGetScreenKey(void)
57{
58 return XAAScreenKey;
59}
60
61DevPrivateKey
62XAAGetGCKey(void)
63{
64 return XAAGCKey;
65}
66
67DevPrivateKey
68XAAGetPixmapKey(void)
69{
70 return XAAPixmapKey;
71}
72
73/* temp kludge */
74static Bool SwitchedOut = FALSE;
75
76XAAInfoRecPtr
77XAACreateInfoRec(void)
78{
79 XAAInfoRecPtr infoRec;
80
81 infoRec = calloc(1, sizeof(XAAInfoRec));
82 if (infoRec)
83 infoRec->CachePixelGranularity = -1;
84
85 return infoRec;
86}
87
88void
89XAADestroyInfoRec(XAAInfoRecPtr infoRec)
90{
91 if (!infoRec)
92 return;
93
94 if (infoRec->ClosePixmapCache)
95 (*infoRec->ClosePixmapCache) (xf86ScrnToScreen(infoRec->pScrn));
96
97 free(infoRec->PreAllocMem);
98
99 free(infoRec->PixmapCachePrivate);
100
101 free(infoRec);
102}
103
104Bool
105XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
106{
107 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
108 XAAScreenPtr pScreenPriv;
109 int i;
110 PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
111
112 /* Return successfully if no acceleration wanted */
113 if (!infoRec)
114 return TRUE;
115
116 if (!dixRegisterPrivateKey(&XAAGCKeyRec, PRIVATE_GC, sizeof(XAAGCRec)))
117 return FALSE;
118
119 if (!dixRegisterPrivateKey
120 (&XAAPixmapKeyRec, PRIVATE_PIXMAP, sizeof(XAAPixmapRec)))
121 return FALSE;
122
123 if (!dixRegisterPrivateKey(&XAAScreenKeyRec, PRIVATE_SCREEN, 0))
124 return FALSE;
125
126 if (!(pScreenPriv = malloc(sizeof(XAAScreenRec))))
127 return FALSE;
128
129 dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
130
131 if (!xf86FBManagerRunning(pScreen))
132 infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
133 if (!(infoRec->Flags & LINEAR_FRAMEBUFFER))
134 infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
135
136 if (!infoRec->FullPlanemask) { /* for backwards compatibility */
137 infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
138 infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
139 }
140
141 for (i = 0; i < 32; i++) {
142 if (!infoRec->FullPlanemasks[i]) /* keep any set by caller */
143 infoRec->FullPlanemasks[i] = (1 << (i + 1)) - 1;
144 }
145
146 if (!XAAInitAccel(pScreen, infoRec))
147 return FALSE;
148 pScreenPriv->AccelInfoRec = infoRec;
149 infoRec->ScratchGC.pScreen = pScreen;
150
151 if (!infoRec->GetImage)
152 infoRec->GetImage = XAAGetImage;
153 if (!infoRec->GetSpans)
154 infoRec->GetSpans = XAAGetSpans;
155 if (!infoRec->CopyWindow)
156 infoRec->CopyWindow = XAACopyWindow;
157
158 pScreenPriv->CreateGC = pScreen->CreateGC;
159 pScreen->CreateGC = XAACreateGC;
160 pScreenPriv->CloseScreen = pScreen->CloseScreen;
161 pScreen->CloseScreen = XAACloseScreen;
162 pScreenPriv->GetImage = pScreen->GetImage;
163 pScreen->GetImage = infoRec->GetImage;
164 pScreenPriv->GetSpans = pScreen->GetSpans;
165 pScreen->GetSpans = infoRec->GetSpans;
166 pScreenPriv->CopyWindow = pScreen->CopyWindow;
167 pScreen->CopyWindow = infoRec->CopyWindow;
168 pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
169 pScreen->CreatePixmap = XAACreatePixmap;
170 pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
171 pScreen->DestroyPixmap = XAADestroyPixmap;
172 pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
173 pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes;
174
175 pScreenPriv->EnterVT = pScrn->EnterVT;
176 pScrn->EnterVT = XAAEnterVT;
177 pScreenPriv->LeaveVT = pScrn->LeaveVT;
178 pScrn->LeaveVT = XAALeaveVT;
179 pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
180 pScrn->SetDGAMode = XAASetDGAMode;
181 pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
182 pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
183
184 pScreenPriv->WindowExposures = pScreen->WindowExposures;
185 if (ps) {
186 pScreenPriv->Composite = ps->Composite;
187 ps->Composite = XAAComposite;
188 pScreenPriv->Glyphs = ps->Glyphs;
189 ps->Glyphs = XAAGlyphs;
190 }
191 if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
192 XAASetupOverlay8_32Planar(pScreen);
193
194 infoRec->PreAllocMem = malloc(MAX_PREALLOC_MEM);
195 if (infoRec->PreAllocMem)
196 infoRec->PreAllocSize = MAX_PREALLOC_MEM;
197
198 if (infoRec->Flags & PIXMAP_CACHE)
199 xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache,
200 (pointer) infoRec);
201
202 if (infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
203 miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
204
205#ifdef COMPOSITE
206 /* Initialize the composite wrapper. This needs to happen after the
207 * wrapping above (so it comes before us), but before all other extensions,
208 * so it doesn't confuse them. (particularly damage).
209 */
210 miInitializeCompositeWrapper(pScreen);
211#endif
212
213 return TRUE;
214}
215
216static Bool
217XAACloseScreen(ScreenPtr pScreen)
218{
219 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
220 XAAScreenPtr pScreenPriv =
221 (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
222
223 pScrn->EnterVT = pScreenPriv->EnterVT;
224 pScrn->LeaveVT = pScreenPriv->LeaveVT;
225 pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess;
226
227 pScreen->CreateGC = pScreenPriv->CreateGC;
228 pScreen->CloseScreen = pScreenPriv->CloseScreen;
229 pScreen->GetImage = pScreenPriv->GetImage;
230 pScreen->GetSpans = pScreenPriv->GetSpans;
231 pScreen->CopyWindow = pScreenPriv->CopyWindow;
232 pScreen->WindowExposures = pScreenPriv->WindowExposures;
233 pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
234 pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
235 pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
236
237 /* We leave it up to the client to free the XAAInfoRec */
238
239 free((pointer) pScreenPriv);
240
241 return (*pScreen->CloseScreen) (pScreen);
242}
243
244static void
245XAAGetImage(DrawablePtr pDraw,
246 int sx, int sy, int w, int h,
247 unsigned int format, unsigned long planemask, char *pdstLine)
248{
249 ScreenPtr pScreen = pDraw->pScreen;
250 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
251 ScrnInfoPtr pScrn = infoRec->pScrn;
252
253 if (pScrn->vtSema &&
254 ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
255 if (infoRec->ReadPixmap && (format == ZPixmap) &&
256 ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
257 infoRec->FullPlanemasks[pDraw->depth - 1]) &&
258 (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth))) {
259 (*infoRec->ReadPixmap) (pScrn,
260 sx + pDraw->x, sy + pDraw->y, w, h,
261 (unsigned char *) pdstLine,
262 PixmapBytePad(w, pDraw->depth),
263 pDraw->bitsPerPixel, pDraw->depth);
264 return;
265 }
266 SYNC_CHECK(pDraw);
267 }
268
269 XAA_SCREEN_PROLOGUE(pScreen, GetImage);
270 (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
271 XAA_SCREEN_EPILOGUE(pScreen, GetImage, XAAGetImage);
272}
273
274static void
275XAAGetSpans(DrawablePtr pDraw,
276 int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
277{
278 ScreenPtr pScreen = pDraw->pScreen;
279
280 XAA_SCREEN_PROLOGUE(pScreen, GetSpans);
281 if (xf86ScreenToScrn(pScreen)->vtSema &&
282 ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
283 SYNC_CHECK(pDraw);
284 }
285 (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart);
286 XAA_SCREEN_EPILOGUE(pScreen, GetSpans, XAAGetSpans);
287}
288
289static int
290XAAPixmapBPP(ScreenPtr pScreen, int depth)
291{
292 PixmapPtr pPix;
293 int bpp;
294 DestroyPixmapProcPtr destroyPixmap;
295
296 XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap);
297 pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth,
298 CREATE_PIXMAP_USAGE_SCRATCH);
299 XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap);
300 if (!pPix)
301 return 0;
302 bpp = pPix->drawable.bitsPerPixel;
303 destroyPixmap = pScreen->DestroyPixmap;
304 XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap);
305 (*pScreen->DestroyPixmap) (pPix);
306 XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, destroyPixmap);
307 return bpp;
308}
309
310static void
311XAAInitializeOffscreenDepths(ScreenPtr pScreen)
312{
313 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
314 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
315 int d, dep;
316
317 infoRec->offscreenDepthsInitialized = TRUE;
318 infoRec->offscreenDepths = 0;
319 if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
320 for (d = 0; d < pScreen->numDepths; d++) {
321 dep = pScreen->allowedDepths[d].depth;
322 if (XAAPixmapBPP(pScreen, dep) == pScrn->bitsPerPixel)
323 infoRec->offscreenDepths |= (1 << (dep - 1));
324 }
325 }
326}
327
328static PixmapPtr
329XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
330{
331 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
332 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
333 XAAPixmapPtr pPriv;
334 PixmapPtr pPix = NULL;
335 int size = w * h;
336
337 if (w > 32767 || h > 32767)
338 return NullPixmap;
339
340 if (!infoRec->offscreenDepthsInitialized)
341 XAAInitializeOffscreenDepths(pScreen);
342
343 if (pScrn->vtSema &&
344 (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
345 (infoRec->offscreenDepths & (1 << (depth - 1))) &&
346 (size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
347 (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
348 (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight))) {
349 PixmapLinkPtr pLink;
350 PixmapPtr pScreenPix;
351 FBAreaPtr area;
352 int gran = 0;
353
354 switch (pScrn->bitsPerPixel) {
355 case 24:
356 case 8:
357 gran = 4;
358 break;
359 case 16:
360 gran = 2;
361 break;
362 case 32:
363 gran = 1;
364 break;
365 default:
366 break;
367 }
368
369 if (BITMAP_SCANLINE_PAD == 64)
370 gran *= 2;
371
372 if (!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0,
373 XAARemoveAreaCallback, NULL))) {
374 goto BAILOUT;
375 }
376
377 if (!(pLink = malloc(sizeof(PixmapLink)))) {
378 xf86FreeOffscreenArea(area);
379 goto BAILOUT;
380 }
381
382 XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap);
383 pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
384 XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap);
385
386 if (!pPix) {
387 free(pLink);
388 xf86FreeOffscreenArea(area);
389 goto BAILOUT;
390 }
391
392 pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
393
394 pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
395 pPix->drawable.x = area->box.x1;
396 pPix->drawable.y = area->box.y1;
397 pPix->drawable.width = w;
398 pPix->drawable.height = h;
399 pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel;
400 pPix->devKind = pScreenPix->devKind;
401 pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
402 area->devPrivate.ptr = pPix;
403
404 pPriv->flags = OFFSCREEN;
405 pPriv->offscreenArea = area;
406 pPriv->freeData = FALSE;
407
408 pLink->next = infoRec->OffscreenPixmaps;
409 pLink->pPix = pPix;
410 infoRec->OffscreenPixmaps = pLink;
411 return pPix;
412 }
413 BAILOUT:
414 XAA_SCREEN_PROLOGUE(pScreen, CreatePixmap);
415 pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
416 XAA_SCREEN_EPILOGUE(pScreen, CreatePixmap, XAACreatePixmap);
417
418 if (pPix) {
419 pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
420 pPriv->flags = 0;
421 pPriv->offscreenArea = NULL;
422 pPriv->freeData = FALSE;
423 if (!w || !h) /* either scratch or shared memory */
424 pPriv->flags |= SHARED_PIXMAP;
425 }
426
427 return pPix;
428}
429
430static Bool
431XAADestroyPixmap(PixmapPtr pPix)
432{
433 ScreenPtr pScreen = pPix->drawable.pScreen;
434 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
435 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
436 Bool ret;
437
438 if (pPix->refcnt == 1) {
439 if (pPriv->flags & OFFSCREEN) {
440 if (pPriv->flags & DGA_PIXMAP)
441 free(pPriv->offscreenArea);
442 else {
443 FBAreaPtr area = pPriv->offscreenArea;
444 PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
445 PixmapLinkPtr prev = NULL;
446
447 while (pLink->pPix != pPix) {
448 prev = pLink;
449 pLink = pLink->next;
450 }
451
452 if (prev)
453 prev->next = pLink->next;
454 else
455 infoRec->OffscreenPixmaps = pLink->next;
456
457 if (!area)
458 area = pLink->area;
459
460 xf86FreeOffscreenArea(area);
461 pPriv->offscreenArea = NULL;
462 free(pLink);
463 }
464 }
465
466 if (pPriv->freeData) { /* pixmaps that were once in video ram */
467 free(pPix->devPrivate.ptr);
468 pPix->devPrivate.ptr = NULL;
469 }
470 }
471
472 XAA_SCREEN_PROLOGUE(pScreen, DestroyPixmap);
473 ret = (*pScreen->DestroyPixmap) (pPix);
474 XAA_SCREEN_EPILOGUE(pScreen, DestroyPixmap, XAADestroyPixmap);
475
476 return ret;
477}
478
479static Bool
480XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
481{
482 ScreenPtr pScreen = pWin->drawable.pScreen;
483 Bool ret;
484
485 XAA_SCREEN_PROLOGUE(pScreen, ChangeWindowAttributes);
486 ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
487 XAA_SCREEN_EPILOGUE(pScreen, ChangeWindowAttributes,
488 XAAChangeWindowAttributes);
489
490 /* we have to assume that shared memory pixmaps are dirty
491 because we can't wrap operations on them */
492
493 if ((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) &&
494 PIXMAP_IS_SHARED(pWin->background.pixmap)) {
495 XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap);
496
497 pPixPriv->flags |= DIRTY;
498 }
499 if ((mask & CWBorderPixmap) && !(pWin->borderIsPixel) &&
500 PIXMAP_IS_SHARED(pWin->border.pixmap)) {
501 XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap);
502
503 pPixPriv->flags |= DIRTY;
504 }
505
506 return ret;
507}
508
509/* These two aren't really needed for anything */
510
511static Bool
512XAAEnterVT(ScrnInfoPtr pScrn)
513{
514 Bool ret;
515 ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
516 XAAScreenPtr pScreenPriv =
517 (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
518
519 pScrn->EnterVT = pScreenPriv->EnterVT;
520 ret = ((*pScreenPriv->EnterVT) (pScrn));
521 pScreenPriv->EnterVT = pScrn->EnterVT;
522 pScrn->EnterVT = XAAEnterVT;
523 return ret;
524}
525
526static void
527XAALeaveVT(ScrnInfoPtr pScrn)
528{
529 ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
530 XAAScreenPtr pScreenPriv =
531 (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
532 XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
533
534 if (infoRec->NeedToSync) {
535 (*infoRec->Sync) (infoRec->pScrn);
536 infoRec->NeedToSync = FALSE;
537 }
538
539 pScrn->LeaveVT = pScreenPriv->LeaveVT;
540 (*pScreenPriv->LeaveVT) (pScrn);
541 pScreenPriv->LeaveVT = pScrn->LeaveVT;
542 pScrn->LeaveVT = XAALeaveVT;
543}
544
545typedef struct {
546 Bool UsingPixmapCache;
547 Bool CanDoColor8x8;
548 Bool CanDoMono8x8;
549} SavedCacheState, *SavedCacheStatePtr;
550
551static int
552XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
553{
554 ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
555 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
556 XAAScreenPtr pScreenPriv =
557 (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
558 int ret;
559
560 if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
561 SavedCacheStatePtr state = (SavedCacheStatePtr) infoRec->dgaSaves;
562
563 infoRec->UsingPixmapCache = state->UsingPixmapCache;
564 infoRec->CanDoColor8x8 = state->CanDoColor8x8;
565 infoRec->CanDoMono8x8 = state->CanDoMono8x8;
566 free(infoRec->dgaSaves);
567 infoRec->dgaSaves = NULL;
568 }
569
570 ret = (*pScreenPriv->SetDGAMode) (pScrn, num, devRet);
571 if (ret != Success)
572 return ret;
573
574 if (num && devRet->pPix) { /* accelerate this pixmap */
575 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
576 FBAreaPtr area;
577
578 if ((area = malloc(sizeof(FBArea)))) {
579 area->pScreen = pScreen;
580 area->box.x1 = 0;
581 area->box.x2 = 0;
582 area->box.y1 = devRet->mode->pixmapWidth;
583 area->box.y2 = devRet->mode->pixmapHeight;
584 area->granularity = 0;
585 area->MoveAreaCallback = 0;
586 area->RemoveAreaCallback = 0;
587 area->devPrivate.ptr = 0;
588
589 pixPriv->flags |= OFFSCREEN | DGA_PIXMAP;
590 pixPriv->offscreenArea = area;
591
592 if (!infoRec->dgaSaves) { /* save pixmap cache state */
593 SavedCacheStatePtr state = malloc(sizeof(SavedCacheState));
594
595 state->UsingPixmapCache = infoRec->UsingPixmapCache;
596 state->CanDoColor8x8 = infoRec->CanDoColor8x8;
597 state->CanDoMono8x8 = infoRec->CanDoMono8x8;
598 infoRec->dgaSaves = (char *) state;
599
600 infoRec->UsingPixmapCache = FALSE;
601 if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8)
602 infoRec->CanDoMono8x8 = FALSE;
603 if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8)
604 infoRec->CanDoColor8x8 = FALSE;
605 }
606 }
607 }
608
609 return ret;
610}
611
612static void
613XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable)
614{
615 ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
616 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
617 XAAScreenPtr pScreenPriv =
618 (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
619
620 if (!enable) {
621 if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
622 XAAMoveOutOffscreenPixmaps(pScreen);
623 if (infoRec->Flags & PIXMAP_CACHE)
624 XAAInvalidatePixmapCache(pScreen);
625 SwitchedOut = TRUE;
626 }
627
628 (*pScreenPriv->EnableDisableFBAccess) (pScrn, enable);
629
630 if (enable) {
631 if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
632 XAAMoveInOffscreenPixmaps(pScreen);
633 SwitchedOut = FALSE;
634 }
635}
diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c
deleted file mode 100644
index a36e0b71b..000000000
--- a/hw/xfree86/xaa/xaaInitAccel.c
+++ /dev/null
@@ -1,1571 +0,0 @@
1#ifdef HAVE_XORG_CONFIG_H
2#include <xorg-config.h>
3#endif
4
5#include <string.h>
6
7#include "misc.h"
8#include "xf86.h"
9#include "xf86_OSproc.h"
10
11#include <X11/X.h>
12#include "scrnintstr.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16#include "xf86fbman.h"
17#include "servermd.h"
18
19/*
20 * XAA Config options
21 */
22
23typedef enum {
24 XAAOPT_SCREEN_TO_SCREEN_COPY,
25 XAAOPT_SOLID_FILL_RECT,
26 XAAOPT_SOLID_FILL_TRAP,
27 XAAOPT_SOLID_TWO_POINT_LINE,
28 XAAOPT_SOLID_BRESENHAM_LINE,
29 XAAOPT_SOLID_HORVERT_LINE,
30 XAAOPT_DASHED_TWO_POINT_LINE,
31 XAAOPT_DASHED_BRESENHAM_LINE,
32 XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
33 XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
34 XAAOPT_COL_8x8_PATTERN_FILL_RECT,
35 XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
36 XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
37 XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
38 XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
39 XAAOPT_IMAGE_WRITE_RECT,
40 XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
41 XAAOPT_WRITE_BITMAP,
42 XAAOPT_WRITE_PIXMAP,
43 XAAOPT_PIXMAP_CACHE,
44 XAAOPT_OFFSCREEN_PIXMAPS,
45 XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE
46} XAAOpts;
47
48static const OptionInfoRec XAAOptions[] = {
49 {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy",
50 OPTV_BOOLEAN, {0}, FALSE},
51 {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect",
52 OPTV_BOOLEAN, {0}, FALSE},
53 {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap",
54 OPTV_BOOLEAN, {0}, FALSE},
55 {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine",
56 OPTV_BOOLEAN, {0}, FALSE},
57 {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine",
58 OPTV_BOOLEAN, {0}, FALSE},
59 {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine",
60 OPTV_BOOLEAN, {0}, FALSE},
61 {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine",
62 OPTV_BOOLEAN, {0}, FALSE},
63 {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine",
64 OPTV_BOOLEAN, {0}, FALSE},
65 {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect",
66 OPTV_BOOLEAN, {0}, FALSE},
67 {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap",
68 OPTV_BOOLEAN, {0}, FALSE},
69 {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect",
70 OPTV_BOOLEAN, {0}, FALSE},
71 {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap",
72 OPTV_BOOLEAN, {0}, FALSE},
73 {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill",
74 OPTV_BOOLEAN, {0}, FALSE},
75 {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
76 "XaaNoScanlineCPUToScreenColorExpandFill",
77 OPTV_BOOLEAN, {0}, FALSE},
78 {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill",
79 OPTV_BOOLEAN, {0}, FALSE},
80 {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect",
81 OPTV_BOOLEAN, {0}, FALSE},
82 {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect",
83 OPTV_BOOLEAN, {0}, FALSE},
84 {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap",
85 OPTV_BOOLEAN, {0}, FALSE},
86 {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap",
87 OPTV_BOOLEAN, {0}, FALSE},
88 {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache",
89 OPTV_BOOLEAN, {0}, FALSE},
90 {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps",
91 OPTV_BOOLEAN, {0}, FALSE},
92 {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps",
93 OPTV_BOOLEAN, {0}, FALSE},
94 {-1, NULL,
95 OPTV_NONE, {0}, FALSE}
96};
97
98static XF86ModuleVersionInfo xaaVersRec = {
99 "xaa",
100 MODULEVENDORSTRING,
101 MODINFOSTRING1,
102 MODINFOSTRING2,
103 XORG_VERSION_CURRENT,
104 XAA_VERSION_MAJOR,
105 XAA_VERSION_MINOR,
106 XAA_VERSION_RELEASE,
107 ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
108 ABI_VIDEODRV_VERSION,
109 MOD_CLASS_NONE,
110 {0, 0, 0, 0}
111};
112
113_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
114
115Bool
116XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
117{
118 int index = pScreen->myNum;
119 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
120 Bool HaveScreenToScreenCopy = FALSE;
121 Bool HaveColorExpansion = FALSE;
122 Bool HaveScanlineColorExpansion = FALSE;
123 Bool HaveSolidFillRect = FALSE;
124 Bool HaveMono8x8PatternFillRect = FALSE;
125 Bool HaveColor8x8PatternFillRect = FALSE;
126 Bool HaveSolidFillTrap = FALSE;
127 Bool HaveMono8x8PatternFillTrap = FALSE;
128 Bool HaveColor8x8PatternFillTrap = FALSE;
129 Bool HaveSolidTwoPointLine = FALSE;
130 Bool HaveSolidBresenhamLine = FALSE;
131 Bool HaveSolidHorVertLine = FALSE;
132 Bool HaveDashedTwoPointLine = FALSE;
133 Bool HaveDashedBresenhamLine = FALSE;
134 Bool HaveImageWriteRect = FALSE;
135 Bool HaveScanlineImageWriteRect = FALSE;
136 Bool HaveScreenToScreenColorExpandFill = FALSE;
137 OptionInfoPtr options;
138 int is_shared = 0;
139 int i;
140
141 options = xnfalloc(sizeof(XAAOptions));
142 (void) memcpy(options, XAAOptions, sizeof(XAAOptions));
143 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
144
145 infoRec->pScrn = pScrn;
146 infoRec->NeedToSync = FALSE;
147
148 /* must have a Sync function */
149 if (!infoRec->Sync)
150 return FALSE;
151 for (i = 0; i < pScrn->numEntities; i++) {
152 if (xf86IsEntityShared(pScrn->entityList[i]))
153 is_shared = 1;
154 }
155
156 /* If this PCI entity has IS_SHARED_ACCEL set in entityProp
157 * then a RestoreAccelState function is required
158 */
159 if (!infoRec->RestoreAccelState && is_shared)
160 return FALSE;
161
162 if (infoRec->RestoreAccelState) {
163 if (!XAAInitStateWrap(pScreen, infoRec))
164 return FALSE;
165 }
166
167 if (serverGeneration == 1)
168 xf86DrvMsg(index, X_INFO,
169 "Using XFree86 Acceleration Architecture (XAA)\n");
170
171 /************** Low Level *************/
172
173 if (!infoRec->SetClippingRectangle || !infoRec->DisableClipping) {
174 infoRec->ClippingFlags = 0;
175 infoRec->SetClippingRectangle = NULL;
176 infoRec->DisableClipping = NULL;
177 }
178
179 /**** CopyArea ****/
180
181 if (infoRec->SetupForScreenToScreenCopy &&
182 infoRec->SubsequentScreenToScreenCopy &&
183 !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
184 HaveScreenToScreenCopy = TRUE;
185 }
186 else {
187 infoRec->ScreenToScreenCopyFlags = 0;
188 infoRec->SetupForScreenToScreenCopy = NULL;
189 infoRec->SubsequentScreenToScreenCopy = NULL;
190 }
191
192 /**** Solid Filled Rects ****/
193
194 if (infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
195 !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
196 HaveSolidFillRect = TRUE;
197 if (infoRec->SubsequentSolidFillTrap &&
198 !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
199 HaveSolidFillTrap = TRUE;
200 else
201 infoRec->SubsequentSolidFillTrap = NULL;
202 }
203 else {
204 infoRec->SolidFillFlags = 0;
205 infoRec->SetupForSolidFill = NULL;
206 infoRec->SubsequentSolidFillRect = NULL;
207 infoRec->SubsequentSolidFillTrap = NULL;
208 }
209
210 /**** Solid lines ****/
211
212 if (infoRec->SetupForSolidLine) {
213 if (infoRec->SubsequentSolidTwoPointLine &&
214 !xf86ReturnOptValBool(options, XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
215 HaveSolidTwoPointLine = TRUE;
216 if (infoRec->SubsequentSolidBresenhamLine &&
217 !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE,
218 FALSE)) {
219 HaveSolidBresenhamLine = TRUE;
220
221 if (infoRec->SolidBresenhamLineErrorTermBits)
222 infoRec->SolidBresenhamLineErrorTermBits =
223 ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1);
224 }
225
226 if (infoRec->SubsequentSolidHorVertLine &&
227 !xf86ReturnOptValBool(options, XAAOPT_SOLID_HORVERT_LINE, FALSE))
228 HaveSolidHorVertLine = TRUE;
229 else if (HaveSolidTwoPointLine) {
230 infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsTwoPoint;
231 HaveSolidHorVertLine = TRUE;
232 }
233 else if (HaveSolidBresenhamLine) {
234 infoRec->SubsequentSolidHorVertLine =
235 XAASolidHorVertLineAsBresenham;
236 HaveSolidHorVertLine = TRUE;
237 }
238 }
239
240 /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */
241 if (!HaveSolidTwoPointLine &&
242 !HaveSolidBresenhamLine && !HaveSolidHorVertLine && HaveSolidFillRect) {
243 infoRec->SetupForSolidLine = infoRec->SetupForSolidFill;
244 infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects;
245 infoRec->SolidLineFlags = infoRec->SolidFillFlags;
246 HaveSolidHorVertLine = TRUE;
247 }
248
249 if (!HaveSolidTwoPointLine)
250 infoRec->SubsequentSolidTwoPointLine = NULL;
251 if (!HaveSolidBresenhamLine)
252 infoRec->SubsequentSolidBresenhamLine = NULL;
253 if (!HaveSolidHorVertLine)
254 infoRec->SubsequentSolidHorVertLine = NULL;
255
256 /* Disable all if nothing left over */
257 if (!HaveSolidTwoPointLine &&
258 !HaveSolidBresenhamLine && !HaveSolidHorVertLine) {
259 infoRec->SolidLineFlags = 0;
260 infoRec->SetupForSolidLine = NULL;
261 }
262
263 /**** 8x8 Mono Pattern Filled Rects ****/
264
265 if (infoRec->SetupForMono8x8PatternFill &&
266 infoRec->SubsequentMono8x8PatternFillRect &&
267 !xf86ReturnOptValBool(options,
268 XAAOPT_MONO_8x8_PATTERN_FILL_RECT, FALSE)) {
269 HaveMono8x8PatternFillRect = TRUE;
270 if (infoRec->SubsequentMono8x8PatternFillTrap &&
271 !xf86ReturnOptValBool(options,
272 XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, FALSE))
273 HaveMono8x8PatternFillTrap = TRUE;
274
275 if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
276 infoRec->CanDoMono8x8 = TRUE;
277 }
278 else { /* others require caching */
279 int min_pitch;
280
281 infoRec->PixmapCacheFlags |= CACHE_MONO_8x8;
282
283 switch (pScrn->bitsPerPixel) {
284 case 32:
285 min_pitch = 2;
286 break;
287 case 24:
288 min_pitch = 3;
289 break;
290 case 16:
291 min_pitch = 4;
292 break;
293 default:
294 min_pitch = 8;
295 break;
296 }
297
298 if (min_pitch > infoRec->MonoPatternPitch)
299 infoRec->MonoPatternPitch = min_pitch;
300
301 if (infoRec->Mono8x8PatternFillFlags &
302 HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
303 if (!infoRec->CacheWidthMono8x8Pattern ||
304 !infoRec->CacheHeightMono8x8Pattern) {
305 infoRec->CacheWidthMono8x8Pattern =
306 infoRec->MonoPatternPitch;
307 infoRec->CacheHeightMono8x8Pattern = 1;
308 }
309 }
310 else {
311 int numPerLine = 128 / infoRec->MonoPatternPitch;
312
313 if (!infoRec->CacheWidthMono8x8Pattern ||
314 !infoRec->CacheHeightMono8x8Pattern) {
315 infoRec->CacheWidthMono8x8Pattern =
316 numPerLine * infoRec->MonoPatternPitch;
317 infoRec->CacheHeightMono8x8Pattern =
318 (64 + numPerLine - 1) / numPerLine;
319 }
320 }
321 }
322 }
323 else {
324 infoRec->Mono8x8PatternFillFlags = 0;
325 infoRec->SetupForMono8x8PatternFill = NULL;
326 infoRec->SubsequentMono8x8PatternFillRect = NULL;
327 }
328
329 /**** Dashed lines ****/
330
331 if (infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
332 if (infoRec->SubsequentDashedTwoPointLine &&
333 !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE, FALSE))
334 HaveDashedTwoPointLine = TRUE;
335 if (infoRec->SubsequentDashedBresenhamLine &&
336 !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
337 FALSE)) {
338 HaveDashedBresenhamLine = TRUE;
339
340 if (infoRec->DashedBresenhamLineErrorTermBits)
341 infoRec->DashedBresenhamLineErrorTermBits =
342 ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1);
343 }
344 }
345
346 if (!HaveDashedTwoPointLine)
347 infoRec->SubsequentDashedTwoPointLine = NULL;
348 if (!HaveDashedBresenhamLine)
349 infoRec->SubsequentDashedBresenhamLine = NULL;
350
351 /* Disable all if nothing left over */
352 if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) {
353 infoRec->DashedLineFlags = 0;
354 infoRec->SetupForDashedLine = NULL;
355 }
356
357 /**** 8x8 Color Pattern Filled Rects ****/
358
359 if (infoRec->SetupForColor8x8PatternFill &&
360 infoRec->SubsequentColor8x8PatternFillRect &&
361 !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT,
362 FALSE)) {
363 HaveColor8x8PatternFillRect = TRUE;
364 if (infoRec->SubsequentColor8x8PatternFillTrap &&
365 !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
366 FALSE))
367 HaveColor8x8PatternFillTrap = TRUE;
368 else
369 infoRec->SubsequentColor8x8PatternFillTrap = NULL;
370
371 infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8;
372
373 if (infoRec->Color8x8PatternFillFlags &
374 HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
375 if (!infoRec->CacheWidthColor8x8Pattern ||
376 !infoRec->CacheHeightColor8x8Pattern) {
377 infoRec->CacheWidthColor8x8Pattern = 64;
378 infoRec->CacheHeightColor8x8Pattern = 1;
379 }
380 }
381 else {
382 if (!infoRec->CacheWidthColor8x8Pattern ||
383 !infoRec->CacheHeightColor8x8Pattern) {
384 infoRec->CacheWidthColor8x8Pattern = 128;
385 infoRec->CacheHeightColor8x8Pattern = 8;
386 }
387 }
388 }
389 else {
390 infoRec->Color8x8PatternFillFlags = 0;
391 infoRec->SetupForColor8x8PatternFill = NULL;
392 infoRec->SubsequentColor8x8PatternFillRect = NULL;
393 infoRec->SubsequentColor8x8PatternFillTrap = NULL;
394 }
395
396 /**** Color Expansion ****/
397
398 if (infoRec->SetupForCPUToScreenColorExpandFill &&
399 infoRec->ColorExpandBase &&
400 infoRec->SubsequentCPUToScreenColorExpandFill &&
401 !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
402 FALSE)) {
403 int dwordsNeeded = pScrn->virtualX;
404
405 infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
406 HaveColorExpansion = TRUE;
407
408 if (infoRec->CPUToScreenColorExpandFillFlags &
409 LEFT_EDGE_CLIPPING_NEGATIVE_X)
410 dwordsNeeded += 31;
411 dwordsNeeded = (dwordsNeeded + 31) >> 5;
412 if (dwordsNeeded > infoRec->ColorExpandRange)
413 infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED;
414 }
415 else {
416 infoRec->CPUToScreenColorExpandFillFlags = 0;
417 infoRec->SetupForCPUToScreenColorExpandFill = NULL;
418 infoRec->SubsequentCPUToScreenColorExpandFill = NULL;
419 }
420
421 /**** Scanline Color Expansion ****/
422
423 if (infoRec->SetupForScanlineCPUToScreenColorExpandFill &&
424 infoRec->SubsequentScanlineCPUToScreenColorExpandFill &&
425 infoRec->SubsequentColorExpandScanline &&
426 infoRec->ScanlineColorExpandBuffers &&
427 (infoRec->NumScanlineColorExpandBuffers > 0) &&
428 !xf86ReturnOptValBool(options,
429 XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
430 FALSE)) {
431 HaveScanlineColorExpansion = TRUE;
432 }
433 else {
434 infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
435 infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL;
436 infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL;
437 infoRec->SubsequentColorExpandScanline = NULL;
438 }
439
440 /**** Screen to Screen Color Expansion ****/
441
442 if (infoRec->SetupForScreenToScreenColorExpandFill &&
443 infoRec->SubsequentScreenToScreenColorExpandFill &&
444 !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
445 FALSE)) {
446 HaveScreenToScreenColorExpandFill = TRUE;
447 if (!infoRec->CacheColorExpandDensity)
448 infoRec->CacheColorExpandDensity = 1;
449 }
450 else {
451 infoRec->ScreenToScreenColorExpandFillFlags = 0;
452 infoRec->SetupForScreenToScreenColorExpandFill = NULL;
453 infoRec->SubsequentScreenToScreenColorExpandFill = NULL;
454 }
455
456 /**** Image Writes ****/
457
458 if (infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
459 infoRec->SubsequentImageWriteRect &&
460 !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
461
462 infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
463 if (infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
464 infoRec->ImageWriteRange = 0;
465 HaveImageWriteRect = TRUE;
466 }
467 else {
468 infoRec->ImageWriteFlags = 0;
469 infoRec->SetupForImageWrite = NULL;
470 infoRec->SubsequentImageWriteRect = NULL;
471 }
472
473 /**** Scanline Image Writes ****/
474
475 if (infoRec->SetupForScanlineImageWrite &&
476 infoRec->SubsequentScanlineImageWriteRect &&
477 infoRec->SubsequentImageWriteScanline &&
478 infoRec->ScanlineImageWriteBuffers &&
479 (infoRec->NumScanlineImageWriteBuffers > 0) &&
480 !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
481 FALSE)) {
482 HaveScanlineImageWriteRect = TRUE;
483 }
484 else {
485 infoRec->ScanlineImageWriteFlags = 0;
486 infoRec->SetupForScanlineImageWrite = NULL;
487 infoRec->SubsequentScanlineImageWriteRect = NULL;
488 infoRec->SubsequentImageWriteScanline = NULL;
489 }
490
491#ifndef __i386__
492 /* XAA makes some unaligned accesses when clipping is not available */
493#define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X)
494 if (HaveImageWriteRect &&
495 ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) {
496 HaveImageWriteRect = FALSE;
497 }
498 if (HaveScanlineImageWriteRect &&
499 ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS)) {
500 HaveScanlineImageWriteRect = FALSE;
501 }
502#endif
503
504 if (serverGeneration == 1) {
505 if (HaveScreenToScreenCopy)
506 xf86ErrorF("\tScreen to screen bit blits\n");
507 if (HaveSolidFillRect)
508 xf86ErrorF("\tSolid filled rectangles\n");
509 if (HaveSolidFillTrap)
510 xf86ErrorF("\tSolid filled trapezoids\n");
511 if (HaveMono8x8PatternFillRect)
512 xf86ErrorF("\t8x8 mono pattern filled rectangles\n");
513 if (HaveMono8x8PatternFillTrap)
514 xf86ErrorF("\t8x8 mono pattern filled trapezoids\n");
515 if (HaveColor8x8PatternFillRect)
516 xf86ErrorF("\t8x8 color pattern filled rectangles\n");
517 if (HaveColor8x8PatternFillTrap)
518 xf86ErrorF("\t8x8 color pattern filled trapezoids\n");
519
520 if (HaveColorExpansion)
521 xf86ErrorF("\tCPU to Screen color expansion\n");
522 else if (HaveScanlineColorExpansion)
523 xf86ErrorF("\tIndirect CPU to Screen color expansion\n");
524
525 if (HaveScreenToScreenColorExpandFill)
526 xf86ErrorF("\tScreen to Screen color expansion\n");
527
528 if (HaveSolidTwoPointLine || HaveSolidBresenhamLine)
529 xf86ErrorF("\tSolid Lines\n");
530 else if (HaveSolidHorVertLine)
531 xf86ErrorF("\tSolid Horizontal and Vertical Lines\n");
532
533 if (HaveDashedTwoPointLine || HaveDashedBresenhamLine)
534 xf86ErrorF("\tDashed Lines\n");
535
536 if (HaveImageWriteRect)
537 xf86ErrorF("\tImage Writes\n");
538 else if (HaveScanlineImageWriteRect)
539 xf86ErrorF("\tScanline Image Writes\n");
540
541 }
542
543#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
544
545 if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
546 xf86ReturnOptValBool(options,
547 XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, FALSE)) {
548 XAAMSG("\tOffscreen Pixmaps\n");
549 }
550 else {
551 infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
552 }
553
554 /************** Mid Level *************/
555
556 /**** ScreenToScreenBitBlt ****/
557
558 if (infoRec->ScreenToScreenBitBlt) {
559 XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n");
560 }
561 else if (HaveScreenToScreenCopy) {
562 infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt;
563 infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags;
564 }
565
566 /**** FillSolidRects ****/
567
568 if (infoRec->FillSolidRects) {
569 XAAMSG("\tDriver provided FillSolidRects replacement\n");
570 }
571 else if (HaveSolidFillRect) {
572 infoRec->FillSolidRects = XAAFillSolidRects;
573 infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags;
574 }
575
576 /**** FillSolidSpans ****/
577
578 if (infoRec->FillSolidSpans) {
579 XAAMSG("\tDriver provided FillSolidSpans replacement\n");
580 }
581 else if (HaveSolidFillRect) {
582 infoRec->FillSolidSpans = XAAFillSolidSpans;
583 infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags;
584 }
585
586 /**** FillMono8x8PatternRects ****/
587
588 if (infoRec->FillMono8x8PatternRects) {
589 XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n");
590 }
591 else if (HaveMono8x8PatternFillRect) {
592 infoRec->FillMono8x8PatternRects =
593 (infoRec->
594 Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
595 XAAFillMono8x8PatternRectsScreenOrigin : XAAFillMono8x8PatternRects;
596
597 infoRec->FillMono8x8PatternRectsFlags =
598 infoRec->Mono8x8PatternFillFlags;
599 }
600
601 /**** FillMono8x8PatternSpans ****/
602
603 if (infoRec->FillMono8x8PatternSpans) {
604 XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n");
605 }
606 else if (HaveMono8x8PatternFillRect) {
607 infoRec->FillMono8x8PatternSpans =
608 (infoRec->
609 Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
610 XAAFillMono8x8PatternSpansScreenOrigin : XAAFillMono8x8PatternSpans;
611
612 infoRec->FillMono8x8PatternSpansFlags =
613 infoRec->Mono8x8PatternFillFlags;
614 }
615
616 /**** FillColor8x8Rects ****/
617
618 if (infoRec->FillColor8x8PatternRects) {
619 XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n");
620 }
621 else if (HaveColor8x8PatternFillRect) {
622 infoRec->FillColor8x8PatternRects =
623 (infoRec->
624 Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
625 XAAFillColor8x8PatternRectsScreenOrigin :
626 XAAFillColor8x8PatternRects;
627
628 infoRec->FillColor8x8PatternRectsFlags =
629 infoRec->Color8x8PatternFillFlags;
630 }
631
632 /**** FillColor8x8Spans ****/
633
634 if (infoRec->FillColor8x8PatternSpans) {
635 XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n");
636 }
637 else if (HaveColor8x8PatternFillRect) {
638 infoRec->FillColor8x8PatternSpans =
639 (infoRec->
640 Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
641 XAAFillColor8x8PatternSpansScreenOrigin :
642 XAAFillColor8x8PatternSpans;
643
644 infoRec->FillColor8x8PatternSpansFlags =
645 infoRec->Color8x8PatternFillFlags;
646 }
647
648 /**** FillCacheBltRects ****/
649
650 if (infoRec->FillCacheBltRects) {
651 XAAMSG("\tDriver provided FillCacheBltRects replacement\n");
652 }
653 else if (HaveScreenToScreenCopy) {
654 infoRec->FillCacheBltRects = XAAFillCacheBltRects;
655 infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags;
656 }
657
658 /**** FillCacheBltSpans ****/
659
660 if (infoRec->FillCacheBltSpans) {
661 XAAMSG("\tDriver provided FillCacheBltSpans replacement\n");
662 }
663 else if (HaveScreenToScreenCopy) {
664 infoRec->FillCacheBltSpans = XAAFillCacheBltSpans;
665 infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags;
666 }
667
668 /**** FillCacheExpandRects ****/
669
670 if (infoRec->FillCacheExpandRects) {
671 XAAMSG("\tDriver provided FillCacheExpandRects replacement\n");
672 }
673 else if (HaveScreenToScreenColorExpandFill) {
674 infoRec->FillCacheExpandRects = XAAFillCacheExpandRects;
675 infoRec->FillCacheExpandRectsFlags =
676 infoRec->ScreenToScreenColorExpandFillFlags;
677 }
678
679 /**** FillCacheExpandSpans ****/
680
681 if (infoRec->FillCacheExpandSpans) {
682 XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n");
683 }
684 else if (HaveScreenToScreenColorExpandFill) {
685 infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans;
686 infoRec->FillCacheExpandSpansFlags =
687 infoRec->ScreenToScreenColorExpandFillFlags;
688 }
689
690 /**** FillColorExpandRects ****/
691
692 if (infoRec->FillColorExpandRects) {
693 XAAMSG("\tDriver provided FillColorExpandRects replacement\n");
694 }
695 else if (HaveColorExpansion) {
696 if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
697 if (infoRec->CPUToScreenColorExpandFillFlags &
698 BIT_ORDER_IN_BYTE_MSBFIRST) {
699 if (infoRec->CPUToScreenColorExpandFillFlags &
700 CPU_TRANSFER_BASE_FIXED)
701 infoRec->FillColorExpandRects =
702 XAAFillColorExpandRects3MSBFirstFixedBase;
703 else
704 infoRec->FillColorExpandRects =
705 XAAFillColorExpandRects3MSBFirst;
706 }
707 else {
708 if (infoRec->CPUToScreenColorExpandFillFlags &
709 CPU_TRANSFER_BASE_FIXED)
710 infoRec->FillColorExpandRects =
711 XAAFillColorExpandRects3LSBFirstFixedBase;
712 else
713 infoRec->FillColorExpandRects =
714 XAAFillColorExpandRects3LSBFirst;
715 }
716 }
717 else {
718 if (infoRec->CPUToScreenColorExpandFillFlags &
719 BIT_ORDER_IN_BYTE_MSBFIRST) {
720 if (infoRec->CPUToScreenColorExpandFillFlags &
721 CPU_TRANSFER_BASE_FIXED)
722 infoRec->FillColorExpandRects =
723 XAAFillColorExpandRectsMSBFirstFixedBase;
724 else
725 infoRec->FillColorExpandRects =
726 XAAFillColorExpandRectsMSBFirst;
727 }
728 else {
729 if (infoRec->CPUToScreenColorExpandFillFlags &
730 CPU_TRANSFER_BASE_FIXED)
731 infoRec->FillColorExpandRects =
732 XAAFillColorExpandRectsLSBFirstFixedBase;
733 else
734 infoRec->FillColorExpandRects =
735 XAAFillColorExpandRectsLSBFirst;
736 }
737 }
738 infoRec->FillColorExpandRectsFlags =
739 infoRec->CPUToScreenColorExpandFillFlags;
740 }
741 else if (HaveScanlineColorExpansion) {
742 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
743 TRIPLE_BITS_24BPP) {
744 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
745 BIT_ORDER_IN_BYTE_MSBFIRST)
746 infoRec->FillColorExpandRects =
747 XAAFillScanlineColorExpandRects3MSBFirst;
748 else
749 infoRec->FillColorExpandRects =
750 XAAFillScanlineColorExpandRects3LSBFirst;
751 }
752 else {
753 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
754 BIT_ORDER_IN_BYTE_MSBFIRST)
755 infoRec->FillColorExpandRects =
756 XAAFillScanlineColorExpandRectsMSBFirst;
757 else
758 infoRec->FillColorExpandRects =
759 XAAFillScanlineColorExpandRectsLSBFirst;
760 }
761 infoRec->FillColorExpandRectsFlags =
762 infoRec->ScanlineCPUToScreenColorExpandFillFlags;
763 }
764
765 /**** FillColorExpandSpans ****/
766
767 if (infoRec->FillColorExpandSpans) {
768 XAAMSG("\tDriver provided FillColorExpandSpans replacement\n");
769 }
770 else if (HaveColorExpansion) {
771 if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
772 if (infoRec->CPUToScreenColorExpandFillFlags &
773 BIT_ORDER_IN_BYTE_MSBFIRST) {
774 if (infoRec->CPUToScreenColorExpandFillFlags &
775 CPU_TRANSFER_BASE_FIXED)
776 infoRec->FillColorExpandSpans =
777 XAAFillColorExpandSpans3MSBFirstFixedBase;
778 else
779 infoRec->FillColorExpandSpans =
780 XAAFillColorExpandSpans3MSBFirst;
781 }
782 else {
783 if (infoRec->CPUToScreenColorExpandFillFlags &
784 CPU_TRANSFER_BASE_FIXED)
785 infoRec->FillColorExpandSpans =
786 XAAFillColorExpandSpans3LSBFirstFixedBase;
787 else
788 infoRec->FillColorExpandSpans =
789 XAAFillColorExpandSpans3LSBFirst;
790 }
791 }
792 else {
793 if (infoRec->CPUToScreenColorExpandFillFlags &
794 BIT_ORDER_IN_BYTE_MSBFIRST) {
795 if (infoRec->CPUToScreenColorExpandFillFlags &
796 CPU_TRANSFER_BASE_FIXED)
797 infoRec->FillColorExpandSpans =
798 XAAFillColorExpandSpansMSBFirstFixedBase;
799 else
800 infoRec->FillColorExpandSpans =
801 XAAFillColorExpandSpansMSBFirst;
802 }
803 else {
804 if (infoRec->CPUToScreenColorExpandFillFlags &
805 CPU_TRANSFER_BASE_FIXED)
806 infoRec->FillColorExpandSpans =
807 XAAFillColorExpandSpansLSBFirstFixedBase;
808 else
809 infoRec->FillColorExpandSpans =
810 XAAFillColorExpandSpansLSBFirst;
811 }
812 }
813 infoRec->FillColorExpandSpansFlags =
814 infoRec->CPUToScreenColorExpandFillFlags;
815 }
816 else if (HaveScanlineColorExpansion) {
817 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
818 TRIPLE_BITS_24BPP) {
819 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
820 BIT_ORDER_IN_BYTE_MSBFIRST)
821 infoRec->FillColorExpandSpans =
822 XAAFillScanlineColorExpandSpans3MSBFirst;
823 else
824 infoRec->FillColorExpandSpans =
825 XAAFillScanlineColorExpandSpans3LSBFirst;
826 }
827 else {
828 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
829 BIT_ORDER_IN_BYTE_MSBFIRST)
830 infoRec->FillColorExpandSpans =
831 XAAFillScanlineColorExpandSpansMSBFirst;
832 else
833 infoRec->FillColorExpandSpans =
834 XAAFillScanlineColorExpandSpansLSBFirst;
835 }
836 infoRec->FillColorExpandSpansFlags =
837 infoRec->ScanlineCPUToScreenColorExpandFillFlags;
838 }
839
840 /**** FillImageWriteRects ****/
841
842 if (infoRec->FillImageWriteRects) {
843 XAAMSG("\tDriver provided FillImageWriteRects replacement\n");
844 }
845 else if (HaveImageWriteRect &&
846 (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
847 (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
848 infoRec->FillImageWriteRects = XAAFillImageWriteRects;
849 infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags;
850 }
851
852 /**** WriteBitmap ****/
853
854 if (infoRec->WriteBitmap &&
855 !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
856 XAAMSG("\tDriver provided WriteBitmap replacement\n");
857 }
858 else if (HaveColorExpansion) {
859 if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
860 if (infoRec->CPUToScreenColorExpandFillFlags &
861 BIT_ORDER_IN_BYTE_MSBFIRST) {
862 if (infoRec->CPUToScreenColorExpandFillFlags &
863 CPU_TRANSFER_BASE_FIXED)
864 infoRec->WriteBitmap =
865 XAAWriteBitmapColorExpand3MSBFirstFixedBase;
866 else
867 infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst;
868 }
869 else {
870 if (infoRec->CPUToScreenColorExpandFillFlags &
871 CPU_TRANSFER_BASE_FIXED)
872 infoRec->WriteBitmap =
873 XAAWriteBitmapColorExpand3LSBFirstFixedBase;
874 else
875 infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst;
876 }
877 }
878 else {
879 if (infoRec->CPUToScreenColorExpandFillFlags &
880 BIT_ORDER_IN_BYTE_MSBFIRST) {
881 if (infoRec->CPUToScreenColorExpandFillFlags &
882 CPU_TRANSFER_BASE_FIXED)
883 infoRec->WriteBitmap =
884 XAAWriteBitmapColorExpandMSBFirstFixedBase;
885 else
886 infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst;
887 }
888 else {
889 if (infoRec->CPUToScreenColorExpandFillFlags &
890 CPU_TRANSFER_BASE_FIXED)
891 infoRec->WriteBitmap =
892 XAAWriteBitmapColorExpandLSBFirstFixedBase;
893 else
894 infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst;
895 }
896 }
897 infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags;
898 }
899 else if (HaveScanlineColorExpansion) {
900 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
901 TRIPLE_BITS_24BPP) {
902 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
903 BIT_ORDER_IN_BYTE_MSBFIRST)
904 infoRec->WriteBitmap =
905 XAAWriteBitmapScanlineColorExpand3MSBFirst;
906 else
907 infoRec->WriteBitmap =
908 XAAWriteBitmapScanlineColorExpand3LSBFirst;
909 }
910 else {
911 if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
912 BIT_ORDER_IN_BYTE_MSBFIRST)
913 infoRec->WriteBitmap =
914 XAAWriteBitmapScanlineColorExpandMSBFirst;
915 else
916 infoRec->WriteBitmap =
917 XAAWriteBitmapScanlineColorExpandLSBFirst;
918 }
919 infoRec->WriteBitmapFlags =
920 infoRec->ScanlineCPUToScreenColorExpandFillFlags;
921 }
922 else
923 infoRec->WriteBitmap = NULL;
924
925 /**** TE Glyphs ****/
926
927 if (infoRec->TEGlyphRenderer) {
928 XAAMSG("\tDriver provided TEGlyphRenderer replacement\n");
929 }
930 else if (HaveColorExpansion) {
931 infoRec->TEGlyphRendererFlags =
932 infoRec->CPUToScreenColorExpandFillFlags;
933
934 if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
935 if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
936 if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
937 infoRec->TEGlyphRenderer =
938 XAATEGlyphRenderer3MSBFirstFixedBase;
939 else
940 infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst;
941 }
942 else {
943 if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
944 infoRec->TEGlyphRenderer =
945 XAATEGlyphRenderer3LSBFirstFixedBase;
946 else
947 infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst;
948 }
949
950 if (!HaveSolidFillRect &&
951 (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
952 infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
953 XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
954 " without solid fills\n");
955 }
956 }
957 else {
958 if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
959 if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
960 infoRec->TEGlyphRenderer =
961 XAATEGlyphRendererMSBFirstFixedBase;
962 else
963 infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst;
964 }
965 else {
966 if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
967 infoRec->TEGlyphRenderer =
968 XAATEGlyphRendererLSBFirstFixedBase;
969 else
970 infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst;
971 }
972 }
973
974 if (!HaveSolidFillRect &&
975 (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
976 infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
977 XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
978 " without solid fills\n");
979 }
980
981 }
982 else if (HaveScanlineColorExpansion) {
983 infoRec->TEGlyphRendererFlags =
984 infoRec->ScanlineCPUToScreenColorExpandFillFlags;
985
986 if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
987 if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
988 infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst;
989 else
990 infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst;
991
992 if (!HaveSolidFillRect &&
993 (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
994 infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
995 XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
996 " without solid fills\n");
997 }
998 }
999 else {
1000 if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
1001 infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst;
1002 else
1003 infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst;
1004 }
1005
1006 if (!HaveSolidFillRect &&
1007 (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
1008 infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
1009 XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
1010 " without solid fills\n");
1011 }
1012 }
1013
1014 /**** NonTE Glyphs ****/
1015
1016 if (infoRec->NonTEGlyphRenderer) {
1017 XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n");
1018 }
1019 else if (infoRec->WriteBitmap &&
1020 !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
1021 infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer;
1022 infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags;
1023 }
1024
1025 /**** WritePixmap ****/
1026
1027 if (infoRec->WritePixmap &&
1028 !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
1029 XAAMSG("\tDriver provided WritePixmap replacement\n");
1030 }
1031 else if (HaveImageWriteRect) {
1032 infoRec->WritePixmap = XAAWritePixmap;
1033 infoRec->WritePixmapFlags =
1034 infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP;
1035 }
1036 else if (HaveScanlineImageWriteRect) {
1037 infoRec->WritePixmap = XAAWritePixmapScanline;
1038 infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags;
1039 }
1040 else
1041 infoRec->WritePixmap = NULL;
1042
1043 /**** ReadPixmap ****/
1044
1045 if (infoRec->ReadPixmap) {
1046 XAAMSG("\tDriver provided ReadPixmap replacement\n");
1047 }
1048
1049 /************** GC Level *************/
1050
1051 /**** CopyArea ****/
1052
1053 if (infoRec->CopyArea) {
1054 XAAMSG("\tDriver provided GC level CopyArea replacement\n");
1055 }
1056 else if (infoRec->ScreenToScreenBitBlt) {
1057 infoRec->CopyArea = XAACopyArea;
1058 infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags;
1059
1060 /* most GC level primitives use one mid-level primitive so
1061 the GC level primitive gets the mid-level primitive flag
1062 and we use that at GC validation time. But CopyArea uses
1063 more than one mid-level primitive so we have to essentially
1064 do a GC validation every time that primitive is used.
1065 The CopyAreaFlags would only be used for filtering out the
1066 common denominators. Here we assume that if you don't do
1067 ScreenToScreenBitBlt you aren't going to do the others.
1068 We also assume that ScreenToScreenBitBlt has the least
1069 restrictions. */
1070 }
1071
1072 if (infoRec->CopyPlane) {
1073 XAAMSG("\tDriver provided GC level CopyPlane replacement\n");
1074 }
1075 else if (infoRec->WriteBitmap &&
1076 !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) {
1077 infoRec->CopyPlane = XAACopyPlaneColorExpansion;
1078 infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags;
1079 }
1080
1081 if (infoRec->PushPixelsSolid) {
1082 XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n");
1083 }
1084 else if (infoRec->WriteBitmap &&
1085 !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
1086 infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion;
1087 infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags;
1088 }
1089
1090 if (infoRec->FillSolidRects) {
1091 if (!infoRec->PolyFillRectSolid) {
1092 infoRec->PolyFillRectSolid = XAAPolyFillRect;
1093 infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags;
1094 }
1095 }
1096 if (infoRec->FillSolidSpans) {
1097 if (!infoRec->FillSpansSolid) {
1098 infoRec->FillSpansSolid = XAAFillSpans;
1099 infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags;
1100 }
1101 }
1102
1103 if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
1104 infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
1105 infoRec->FillCacheExpandRects) {
1106 if (!infoRec->PolyFillRectStippled) {
1107
1108 infoRec->PolyFillRectStippled = XAAPolyFillRect;
1109 infoRec->PolyFillRectStippledFlags = 0;
1110 }
1111 }
1112
1113 if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
1114 infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
1115 infoRec->FillCacheExpandSpans) {
1116 if (!infoRec->FillSpansStippled) {
1117
1118 infoRec->FillSpansStippled = XAAFillSpans;
1119 infoRec->FillSpansStippledFlags = 0;
1120 }
1121 }
1122
1123 if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
1124 infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
1125 infoRec->FillCacheExpandRects) {
1126 if (!infoRec->PolyFillRectOpaqueStippled) {
1127
1128 infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect;
1129 infoRec->PolyFillRectOpaqueStippledFlags = 0;
1130 }
1131 }
1132
1133 if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
1134 infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
1135 infoRec->FillCacheExpandSpans) {
1136 if (!infoRec->FillSpansOpaqueStippled) {
1137
1138 infoRec->FillSpansOpaqueStippled = XAAFillSpans;
1139 infoRec->FillSpansOpaqueStippledFlags = 0;
1140 }
1141 }
1142
1143 if (infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
1144 infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) {
1145 if (!infoRec->PolyFillRectTiled) {
1146
1147 infoRec->PolyFillRectTiled = XAAPolyFillRect;
1148 infoRec->PolyFillRectTiledFlags = 0;
1149 }
1150 }
1151
1152 if (infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
1153 infoRec->FillCacheBltSpans) {
1154 if (!infoRec->FillSpansTiled) {
1155
1156 infoRec->FillSpansTiled = XAAFillSpans;
1157 infoRec->FillSpansTiledFlags = 0;
1158 }
1159 }
1160
1161 if (infoRec->TEGlyphRenderer &&
1162 !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) {
1163
1164 if (!infoRec->PolyText8TE) {
1165 infoRec->PolyText8TE = XAAPolyText8TEColorExpansion;
1166 infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags;
1167 }
1168
1169 if (!infoRec->PolyText16TE) {
1170 infoRec->PolyText16TE = XAAPolyText16TEColorExpansion;
1171 infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags;
1172 }
1173
1174 if (!infoRec->PolyGlyphBltTE) {
1175 infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion;
1176 infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
1177 }
1178 }
1179
1180 if (infoRec->TEGlyphRenderer &&
1181 !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
1182
1183 if (!infoRec->ImageText8TE) {
1184 infoRec->ImageText8TE = XAAImageText8TEColorExpansion;
1185 infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags;
1186 }
1187
1188 if (!infoRec->ImageText16TE) {
1189 infoRec->ImageText16TE = XAAImageText16TEColorExpansion;
1190 infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags;
1191 }
1192
1193 if (!infoRec->ImageGlyphBltTE) {
1194 infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion;
1195 infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
1196 }
1197 }
1198
1199 if (infoRec->NonTEGlyphRenderer) {
1200 if (!infoRec->PolyText8NonTE) {
1201 infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion;
1202 infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
1203 }
1204
1205 if (!infoRec->PolyText16NonTE) {
1206 infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion;
1207 infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
1208 }
1209 if (!infoRec->PolyGlyphBltNonTE) {
1210 infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion;
1211 infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
1212 }
1213 }
1214
1215 if (infoRec->NonTEGlyphRenderer && HaveSolidFillRect) {
1216 if (!infoRec->ImageText8NonTE) {
1217 infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion;
1218 infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
1219 }
1220
1221 if (!infoRec->ImageText16NonTE) {
1222 infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion;
1223 infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
1224 }
1225
1226 if (!infoRec->ImageGlyphBltNonTE) {
1227 infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion;
1228 infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
1229 }
1230 }
1231
1232 if (!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) {
1233 infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid;
1234 infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags;
1235 }
1236
1237 if (!infoRec->FillPolygonSolid && HaveSolidFillRect) {
1238 infoRec->FillPolygonSolid = XAAFillPolygonSolid;
1239 infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags;
1240 }
1241
1242 if (!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect ||
1243 HaveScreenToScreenColorExpandFill ||
1244 HaveScreenToScreenCopy)) {
1245 infoRec->FillPolygonStippled = XAAFillPolygonStippled;
1246 infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags;
1247 }
1248
1249 if (!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect ||
1250 HaveScreenToScreenColorExpandFill
1251 || HaveScreenToScreenCopy)) {
1252 infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled;
1253 infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags;
1254 }
1255
1256 if (!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect ||
1257 HaveScreenToScreenColorExpandFill ||
1258 HaveScreenToScreenCopy)) {
1259 infoRec->FillPolygonTiled = XAAFillPolygonTiled;
1260 infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags;
1261 }
1262
1263 if (!infoRec->PolyFillArcSolid && HaveSolidFillRect) {
1264 infoRec->PolyFillArcSolid = XAAPolyFillArcSolid;
1265 infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags;
1266 }
1267
1268 if (!infoRec->PolylinesWideSolid && HaveSolidFillRect) {
1269 infoRec->PolylinesWideSolid = XAAPolylinesWideSolid;
1270 infoRec->PolylinesWideSolidFlags =
1271 infoRec->SolidFillFlags | GXCOPY_ONLY;
1272 }
1273
1274 if (!infoRec->PutImage && (infoRec->WritePixmap ||
1275 (infoRec->WriteBitmap &&
1276 !(infoRec->
1277 WriteBitmapFlags & TRANSPARENCY_ONLY)))) {
1278 infoRec->PutImage = XAAPutImage;
1279
1280 /* See comment for CopyArea above. But here we make fewer
1281 assumptions. The driver can provide the PutImageFlags if
1282 it wants too */
1283 }
1284
1285 if (HaveSolidHorVertLine &&
1286 (HaveSolidBresenhamLine || (HaveSolidTwoPointLine &&
1287 (infoRec->
1288 ClippingFlags &
1289 HARDWARE_CLIP_SOLID_LINE)))) {
1290 if (!infoRec->PolylinesThinSolid) {
1291 infoRec->PolylinesThinSolid = XAAPolyLines;
1292 infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags;
1293 }
1294 if (!infoRec->PolySegmentThinSolid) {
1295 infoRec->PolySegmentThinSolid = XAAPolySegment;
1296 infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags;
1297 }
1298 }
1299
1300 if (HaveDashedBresenhamLine || (HaveDashedTwoPointLine &&
1301 (infoRec->
1302 ClippingFlags &
1303 HARDWARE_CLIP_DASHED_LINE))) {
1304 if (!infoRec->PolylinesThinDashed) {
1305 infoRec->PolylinesThinDashed = XAAPolyLinesDashed;
1306 infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags;
1307 }
1308 if (!infoRec->PolySegmentThinDashed) {
1309 infoRec->PolySegmentThinDashed = XAAPolySegmentDashed;
1310 infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags;
1311 }
1312 }
1313
1314 if (infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) {
1315 if (!infoRec->ComputeDash)
1316 infoRec->ComputeDash = XAAComputeDash;
1317 }
1318
1319 {
1320 Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
1321 infoRec->CPUToScreenTextureDstFormats &&
1322 infoRec->SetupForCPUToScreenTexture2 &&
1323 infoRec->SubsequentCPUToScreenTexture;
1324 Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats &&
1325 infoRec->CPUToScreenAlphaTextureDstFormats &&
1326 infoRec->SetupForCPUToScreenAlphaTexture2 &&
1327 infoRec->SubsequentCPUToScreenAlphaTexture;
1328
1329 if (!infoRec->Composite && (haveTexture || haveAlphaTexture))
1330 infoRec->Composite = XAADoComposite;
1331
1332 if (!infoRec->Glyphs && infoRec->WriteBitmap &&
1333 !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
1334 infoRec->Glyphs = XAADoGlyphs;
1335 }
1336 }
1337
1338 /************ Validation Functions **************/
1339
1340 if (!infoRec->ValidateCopyArea && infoRec->CopyArea) {
1341 infoRec->CopyAreaMask = GCWhenForced;
1342 if ((infoRec->CopyAreaFlags & GXCOPY_ONLY) ||
1343 (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE))
1344 infoRec->CopyAreaMask |= GCFunction;
1345 if (infoRec->CopyAreaFlags & NO_PLANEMASK)
1346 infoRec->CopyAreaMask |= GCPlaneMask;
1347 infoRec->ValidateCopyArea = XAAValidateCopyArea;
1348 }
1349
1350 if (!infoRec->ValidateCopyPlane && infoRec->CopyPlane) {
1351 infoRec->CopyPlaneMask = GCWhenForced;
1352 if ((infoRec->CopyPlaneFlags & GXCOPY_ONLY) ||
1353 (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE))
1354 infoRec->CopyPlaneMask |= GCFunction;
1355 if (infoRec->CopyPlaneFlags & NO_PLANEMASK)
1356 infoRec->CopyPlaneMask |= GCPlaneMask;
1357 if (infoRec->CopyPlaneFlags & RGB_EQUAL)
1358 infoRec->CopyPlaneMask |= GCForeground | GCBackground;
1359 infoRec->ValidateCopyPlane = XAAValidateCopyPlane;
1360 }
1361
1362 if (!infoRec->ValidatePutImage && infoRec->PutImage) {
1363 infoRec->PutImageMask = GCWhenForced;
1364 if ((infoRec->PutImageFlags & GXCOPY_ONLY) ||
1365 (infoRec->PutImageFlags & ROP_NEEDS_SOURCE))
1366 infoRec->PutImageMask |= GCFunction;
1367 if (infoRec->PutImageFlags & NO_PLANEMASK)
1368 infoRec->PutImageMask |= GCPlaneMask;
1369 if (infoRec->PutImageFlags & RGB_EQUAL)
1370 infoRec->PutImageMask |= GCForeground | GCBackground;
1371 infoRec->ValidatePutImage = XAAValidatePutImage;
1372 }
1373
1374 if (!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) {
1375 infoRec->PushPixelsMask = GCFillStyle;
1376 if ((infoRec->PushPixelsFlags & GXCOPY_ONLY) ||
1377 (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) ||
1378 (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY))
1379 infoRec->PushPixelsMask |= GCFunction;
1380 if (infoRec->PushPixelsFlags & NO_PLANEMASK)
1381 infoRec->PushPixelsMask |= GCPlaneMask;
1382 if (infoRec->PushPixelsFlags & RGB_EQUAL)
1383 infoRec->PushPixelsMask |= GCForeground;
1384 infoRec->ValidatePushPixels = XAAValidatePushPixels;
1385 }
1386
1387 /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon
1388 and PolyFillArcs have the same restrictions. If you supply GC
1389 level replacements for any of these and alter this relationship
1390 you may need to supply replacement validation routines */
1391
1392 if (!infoRec->ValidateFillSpans &&
1393 (infoRec->FillSpansSolid || infoRec->FillSpansStippled ||
1394 infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) {
1395
1396 int compositeFlags = infoRec->FillSpansSolidFlags |
1397 infoRec->FillSpansStippledFlags |
1398 infoRec->FillSpansOpaqueStippledFlags |
1399 infoRec->FillSpansTiledFlags;
1400
1401 infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple;
1402
1403 if ((compositeFlags & GXCOPY_ONLY) ||
1404 (compositeFlags & ROP_NEEDS_SOURCE))
1405 infoRec->FillSpansMask |= GCFunction;
1406 if (compositeFlags & NO_PLANEMASK)
1407 infoRec->FillSpansMask |= GCPlaneMask;
1408 if (compositeFlags & RGB_EQUAL)
1409 infoRec->FillSpansMask |= GCForeground;
1410 infoRec->ValidateFillSpans = XAAValidateFillSpans;
1411 }
1412
1413 /* By default XAA only provides Validations for the GlyphBlt
1414 functions and not the text higher up. This is because the
1415 Text8/16 and GlyphBlt are linked. If you break this linkage,
1416 you may need to have the driver supply its own Validation
1417 routines */
1418
1419 if (!infoRec->ValidatePolyGlyphBlt &&
1420 (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) {
1421 int compositeFlags = infoRec->PolyGlyphBltTEFlags |
1422 infoRec->PolyGlyphBltNonTEFlags;
1423
1424 infoRec->PolyGlyphBltMask = GCFillStyle | GCFont;
1425 if ((compositeFlags & GXCOPY_ONLY) ||
1426 (compositeFlags & ROP_NEEDS_SOURCE) ||
1427 (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY))
1428 infoRec->PolyGlyphBltMask |= GCFunction;
1429 if (compositeFlags & NO_PLANEMASK)
1430 infoRec->PolyGlyphBltMask |= GCPlaneMask;
1431 if (compositeFlags & RGB_EQUAL)
1432 infoRec->PolyGlyphBltMask |= GCForeground;
1433 infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt;
1434 }
1435
1436 if (!infoRec->ValidateImageGlyphBlt &&
1437 (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) {
1438 int compositeFlags = infoRec->ImageGlyphBltTEFlags |
1439 infoRec->ImageGlyphBltNonTEFlags;
1440
1441 if (infoRec->ImageGlyphBltNonTE)
1442 compositeFlags |= infoRec->SolidFillFlags;
1443
1444 infoRec->ImageGlyphBltMask = GCFont;
1445 if (compositeFlags & NO_PLANEMASK)
1446 infoRec->ImageGlyphBltMask |= GCPlaneMask;
1447 if (compositeFlags & RGB_EQUAL)
1448 infoRec->ImageGlyphBltMask |= GCForeground | GCBackground;
1449 infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt;
1450 }
1451
1452 /* By default XAA only provides a Validation function for the
1453 Polylines and does segments and polylines at the same time */
1454
1455 if (!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) {
1456 int compositeFlags = infoRec->PolyRectangleThinSolidFlags |
1457 infoRec->PolylinesWideSolidFlags |
1458 infoRec->PolylinesThinSolidFlags |
1459 infoRec->PolySegmentThinSolidFlags |
1460 infoRec->PolySegmentThinDashedFlags |
1461 infoRec->PolylinesThinDashedFlags;
1462
1463 infoRec->ValidatePolylines = XAAValidatePolylines;
1464 infoRec->PolylinesMask =
1465 infoRec->FillSpansMask | GCLineStyle | GCLineWidth;
1466
1467 if (infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed)
1468 infoRec->PolylinesMask |= GCDashList;
1469 if (compositeFlags & NO_PLANEMASK)
1470 infoRec->PolylinesMask |= GCPlaneMask;
1471 if ((compositeFlags & GXCOPY_ONLY) ||
1472 (compositeFlags & ROP_NEEDS_SOURCE))
1473 infoRec->PolylinesMask |= GCFunction;
1474 if (compositeFlags & RGB_EQUAL)
1475 infoRec->PolylinesMask |= GCForeground;
1476 }
1477
1478 /**** Fill choosers ****/
1479
1480 if (!infoRec->StippledFillChooser)
1481 infoRec->StippledFillChooser = XAAStippledFillChooser;
1482
1483 if (!infoRec->OpaqueStippledFillChooser)
1484 infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser;
1485
1486 if (!infoRec->TiledFillChooser)
1487 infoRec->TiledFillChooser = XAATiledFillChooser;
1488
1489 /**** Setup the pixmap cache ****/
1490
1491 if (infoRec->WriteBitmapToCache) {
1492 }
1493 else if (infoRec->WriteBitmap &&
1494 !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))
1495 infoRec->WriteBitmapToCache = XAAWriteBitmapToCache;
1496 else if (infoRec->Flags & LINEAR_FRAMEBUFFER)
1497 infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear;
1498 else
1499 infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
1500
1501 if (infoRec->WritePixmapToCache) {
1502 }
1503 else if (infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY))
1504 infoRec->WritePixmapToCache = XAAWritePixmapToCache;
1505 else if (infoRec->Flags & LINEAR_FRAMEBUFFER)
1506 infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear;
1507 else
1508 infoRec->Flags &= ~PIXMAP_CACHE;
1509
1510 if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
1511 infoRec->Flags &= ~PIXMAP_CACHE;
1512
1513 if (infoRec->WriteMono8x8PatternToCache) {
1514 }
1515 else if (infoRec->PixmapCacheFlags & CACHE_MONO_8x8) {
1516 if (infoRec->WritePixmapToCache)
1517 infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache;
1518 else
1519 infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8;
1520 }
1521
1522 if (infoRec->WriteColor8x8PatternToCache) {
1523 }
1524 else if (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) {
1525 if (infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache)
1526 infoRec->WriteColor8x8PatternToCache =
1527 XAAWriteColor8x8PatternToCache;
1528 else
1529 infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8;
1530 }
1531
1532 if (infoRec->CachePixelGranularity < 0) {
1533 switch (pScrn->bitsPerPixel) {
1534 case 24:
1535 case 8:
1536 infoRec->CachePixelGranularity = 4;
1537 break;
1538 case 16:
1539 infoRec->CachePixelGranularity = 2;
1540 break;
1541 case 32:
1542 infoRec->CachePixelGranularity = 1;
1543 break;
1544 default:
1545 break;
1546 }
1547
1548 if (BITMAP_SCANLINE_PAD == 64)
1549 infoRec->CachePixelGranularity *= 2;
1550 }
1551
1552 free(options);
1553
1554 if (!infoRec->CacheTile && infoRec->WritePixmapToCache)
1555 infoRec->CacheTile = XAACacheTile;
1556 if (!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache)
1557 infoRec->CacheMonoStipple = XAACacheMonoStipple;
1558 if (!infoRec->CacheStipple && infoRec->WriteBitmapToCache)
1559 infoRec->CacheStipple = XAACacheStipple;
1560 if (!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache)
1561 infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern;
1562 if (!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache)
1563 infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern;
1564
1565 if ((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) {
1566 infoRec->InitPixmapCache = XAAInitPixmapCache;
1567 infoRec->ClosePixmapCache = XAAClosePixmapCache;
1568 }
1569
1570 return TRUE;
1571}
diff --git a/hw/xfree86/xaa/xaaLine.c b/hw/xfree86/xaa/xaaLine.c
deleted file mode 100644
index d7c60975e..000000000
--- a/hw/xfree86/xaa/xaaLine.c
+++ /dev/null
@@ -1,422 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include <stdlib.h>
7
8#include <X11/X.h>
9#include "misc.h"
10#include "xf86.h"
11#include "xf86_OSproc.h"
12
13#include "scrnintstr.h"
14#include "pixmapstr.h"
15#include "miline.h"
16#include "xf86str.h"
17#include "xaa.h"
18#include "xaalocal.h"
19
20void
21#ifdef POLYSEGMENT
22 XAAPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg
23#else
24XAAPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */
25 int npt, /* number of points */
26 DDXPointPtr pptInit
27#endif
28 )
29{
30 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
31 BoxPtr pboxInit = RegionRects(pGC->pCompositeClip);
32 int nboxInit = RegionNumRects(pGC->pCompositeClip);
33 unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
34 int xorg = pDrawable->x;
35 int yorg = pDrawable->y;
36 int nbox;
37 BoxPtr pbox;
38
39#ifndef POLYSEGMENT
40 DDXPointPtr ppt;
41#endif
42 int x1, x2, y1, y2, tmp, len;
43
44 if (!nboxInit)
45 return;
46
47 if (infoRec->SolidLineFlags & LINE_LIMIT_COORDS) {
48 int minValX = infoRec->SolidLineLimits.x1;
49 int maxValX = infoRec->SolidLineLimits.x2;
50 int minValY = infoRec->SolidLineLimits.y1;
51 int maxValY = infoRec->SolidLineLimits.y2;
52
53#ifdef POLYSEGMENT
54 int n = nseg;
55 xSegment *s = pSeg;
56
57 while (n--)
58#else
59 int n = npt;
60 int xorgtmp = xorg;
61 int yorgtmp = yorg;
62
63 ppt = pptInit;
64 x2 = ppt->x + xorgtmp;
65 y2 = ppt->y + yorgtmp;
66 while (--n)
67#endif
68 {
69#ifdef POLYSEGMENT
70 x1 = s->x1 + xorg;
71 y1 = s->y1 + yorg;
72 x2 = s->x2 + xorg;
73 y2 = s->y2 + yorg;
74 s++;
75#else
76 x1 = x2;
77 y1 = y2;
78 ++ppt;
79 if (mode == CoordModePrevious) {
80 xorgtmp = x1;
81 yorgtmp = y1;
82 }
83 x2 = ppt->x + xorgtmp;
84 y2 = ppt->y + yorgtmp;
85#endif
86 if (x1 > maxValX || x1 < minValX ||
87 x2 > maxValX || x2 < minValX ||
88 y1 > maxValY || y1 < minValY || y2 > maxValY || y2 < minValY) {
89#ifdef POLYSEGMENT
90 XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
91#else
92 XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
93#endif
94 return;
95 }
96 }
97 }
98
99 (*infoRec->SetupForSolidLine) (infoRec->pScrn, pGC->fgPixel,
100 pGC->alu, pGC->planemask);
101
102#ifdef POLYSEGMENT
103 while (nseg--)
104#else
105 ppt = pptInit;
106 x2 = ppt->x + xorg;
107 y2 = ppt->y + yorg;
108 while (--npt)
109#endif
110 {
111 nbox = nboxInit;
112 pbox = pboxInit;
113
114#ifdef POLYSEGMENT
115 x1 = pSeg->x1 + xorg;
116 y1 = pSeg->y1 + yorg;
117 x2 = pSeg->x2 + xorg;
118 y2 = pSeg->y2 + yorg;
119 pSeg++;
120#else
121 x1 = x2;
122 y1 = y2;
123 ++ppt;
124 if (mode == CoordModePrevious) {
125 xorg = x1;
126 yorg = y1;
127 }
128 x2 = ppt->x + xorg;
129 y2 = ppt->y + yorg;
130#endif
131
132 if (x1 == x2) { /* vertical line */
133 /* make the line go top to bottom of screen, keeping
134 endpoint semantics
135 */
136 if (y1 > y2) {
137 tmp = y2;
138 y2 = y1 + 1;
139 y1 = tmp + 1;
140#ifdef POLYSEGMENT
141 if (pGC->capStyle != CapNotLast)
142 y1--;
143#endif
144 }
145#ifdef POLYSEGMENT
146 else if (pGC->capStyle != CapNotLast)
147 y2++;
148#endif
149 /* get to first band that might contain part of line */
150 while (nbox && (pbox->y2 <= y1)) {
151 pbox++;
152 nbox--;
153 }
154
155 /* stop when lower edge of box is beyond end of line */
156 while (nbox && (y2 >= pbox->y1)) {
157 if ((x1 >= pbox->x1) && (x1 < pbox->x2)) {
158 tmp = max(y1, pbox->y1);
159 len = min(y2, pbox->y2) - tmp;
160 if (len)
161 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
162 x1, tmp, len,
163 DEGREES_270);
164 }
165 nbox--;
166 pbox++;
167 }
168#ifndef POLYSEGMENT
169 y2 = ppt->y + yorg;
170#endif
171 }
172 else if (y1 == y2) { /* horizontal line */
173 /* force line from left to right, keeping endpoint semantics */
174 if (x1 > x2) {
175 tmp = x2;
176 x2 = x1 + 1;
177 x1 = tmp + 1;
178#ifdef POLYSEGMENT
179 if (pGC->capStyle != CapNotLast)
180 x1--;
181#endif
182 }
183#ifdef POLYSEGMENT
184 else if (pGC->capStyle != CapNotLast)
185 x2++;
186#endif
187
188 /* find the correct band */
189 while (nbox && (pbox->y2 <= y1)) {
190 pbox++;
191 nbox--;
192 }
193
194 /* try to draw the line, if we haven't gone beyond it */
195 if (nbox && (pbox->y1 <= y1)) {
196 int orig_y = pbox->y1;
197
198 /* when we leave this band, we're done */
199 while (nbox && (orig_y == pbox->y1)) {
200 if (pbox->x2 <= x1) {
201 /* skip boxes until one might contain start point */
202 nbox--;
203 pbox++;
204 continue;
205 }
206
207 /* stop if left of box is beyond right of line */
208 if (pbox->x1 >= x2) {
209 nbox = 0;
210 break;
211 }
212
213 tmp = max(x1, pbox->x1);
214 len = min(x2, pbox->x2) - tmp;
215 if (len)
216 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
217 tmp, y1, len,
218 DEGREES_0);
219 nbox--;
220 pbox++;
221 }
222 }
223#ifndef POLYSEGMENT
224 x2 = ppt->x + xorg;
225#endif
226 }
227 else { /* sloped line */
228 unsigned int oc1, oc2;
229 int dmin, dmaj, e, octant;
230
231 if (infoRec->SubsequentSolidBresenhamLine) {
232 if ((dmaj = x2 - x1) < 0) {
233 dmaj = -dmaj;
234 octant = XDECREASING;
235 }
236 else
237 octant = 0;
238
239 if ((dmin = y2 - y1) < 0) {
240 dmin = -dmin;
241 octant |= YDECREASING;
242 }
243
244 if (dmin >= dmaj) {
245 tmp = dmin;
246 dmin = dmaj;
247 dmaj = tmp;
248 octant |= YMAJOR;
249 }
250
251 e = -dmaj - ((bias >> octant) & 1);
252 len = dmaj;
253 dmin <<= 1;
254 dmaj <<= 1;
255 }
256 else { /* Muffle compiler */
257 dmin = dmaj = e = octant = len = 0;
258 }
259
260 while (nbox--) {
261 oc1 = oc2 = 0;
262 OUTCODES(oc1, x1, y1, pbox);
263 OUTCODES(oc2, x2, y2, pbox);
264 if (!(oc1 | oc2)) { /* unclipped */
265 if (infoRec->SubsequentSolidTwoPointLine) {
266 (*infoRec->SubsequentSolidTwoPointLine) (infoRec->pScrn,
267 x1, y1, x2, y2,
268#ifdef POLYSEGMENT
269 (pGC->
270 capStyle !=
271 CapNotLast) ?
272 0 :
273#endif
274 OMIT_LAST);
275 }
276 else {
277 (*infoRec->SubsequentSolidBresenhamLine) (infoRec->
278 pScrn, x1, y1,
279 dmaj, dmin, e,
280#ifdef POLYSEGMENT
281 (pGC->
282 capStyle !=
283 CapNotLast)
284 ? (len + 1) :
285#endif
286 len, octant);
287 }
288 break;
289 }
290 else if (oc1 & oc2) { /* completely clipped */
291 pbox++;
292 }
293 else if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE) {
294 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
295 pbox->x1, pbox->y1,
296 pbox->x2 - 1,
297 pbox->y2 - 1);
298
299 if (infoRec->SubsequentSolidBresenhamLine) {
300 (*infoRec->SubsequentSolidBresenhamLine) (infoRec->
301 pScrn, x1, y1,
302 dmaj, dmin, e,
303#ifdef POLYSEGMENT
304 (pGC->
305 capStyle !=
306 CapNotLast)
307 ? (len + 1) :
308#endif
309 len, octant);
310 }
311 else {
312 (*infoRec->SubsequentSolidTwoPointLine) (infoRec->pScrn,
313 x1, y1, x2, y2,
314#ifdef POLYSEGMENT
315 (pGC->
316 capStyle !=
317 CapNotLast) ?
318 0 :
319#endif
320 OMIT_LAST);
321 }
322 (*infoRec->DisableClipping) (infoRec->pScrn);
323 pbox++;
324 }
325 else {
326 int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
327 int clip1 = 0, clip2 = 0;
328 int err, adx, ady;
329
330 if (octant & YMAJOR) {
331 ady = dmaj >> 1;
332 adx = dmin >> 1;
333 }
334 else {
335 ady = dmin >> 1;
336 adx = dmaj >> 1;
337 }
338
339 if (miZeroClipLine(pbox->x1, pbox->y1,
340 pbox->x2 - 1, pbox->y2 - 1,
341 &new_x1, &new_y1, &new_x2, &new_y2,
342 adx, ady, &clip1, &clip2,
343 octant, bias, oc1, oc2) == -1) {
344 pbox++;
345 continue;
346 }
347
348 if (octant & YMAJOR)
349 len = abs(new_y2 - new_y1);
350 else
351 len = abs(new_x2 - new_x1);
352#ifdef POLYSEGMENT
353 if (clip2 != 0 || pGC->capStyle != CapNotLast)
354 len++;
355#else
356 len += (clip2 != 0);
357#endif
358 if (len) {
359 int abserr, clipdx, clipdy;
360
361 /* unwind bresenham error term to first point */
362 if (clip1) {
363 clipdx = abs(new_x1 - x1);
364 clipdy = abs(new_y1 - y1);
365
366 if (octant & YMAJOR)
367 err = e + clipdy * dmin - clipdx * dmaj;
368 else
369 err = e + clipdx * dmin - clipdy * dmaj;
370 }
371 else
372 err = e;
373
374#define range infoRec->SolidBresenhamLineErrorTermBits
375 abserr = abs(err);
376 while ((abserr & range) ||
377 (dmaj & range) || (dmin & range)) {
378 dmin >>= 1;
379 dmaj >>= 1;
380 abserr >>= 1;
381 err /= 2;
382 }
383
384 (*infoRec->SubsequentSolidBresenhamLine) (infoRec->
385 pScrn, new_x1,
386 new_y1, dmaj,
387 dmin, err,
388 len, octant);
389 }
390 pbox++;
391 }
392 } /* while (nbox--) */
393 } /* sloped line */
394 } /* while (nline--) */
395
396#ifndef POLYSEGMENT
397 /* paint the last point if the end style isn't CapNotLast.
398 (Assume that a projecting, butt, or round cap that is one
399 pixel wide is the same as the single pixel of the endpoint.)
400 */
401
402 if ((pGC->capStyle != CapNotLast) &&
403 ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
404 (ppt->y + yorg != pptInit->y + pDrawable->y) ||
405 (ppt == pptInit + 1))) {
406 nbox = nboxInit;
407 pbox = pboxInit;
408 while (nbox--) {
409 if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
410 (x2 < pbox->x2) && (y2 < pbox->y2)) {
411 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn, x2, y2,
412 1, DEGREES_0);
413 break;
414 }
415 else
416 pbox++;
417 }
418 }
419#endif
420
421 SET_SYNC_FLAG(infoRec);
422}
diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c
deleted file mode 100644
index 4379778f6..000000000
--- a/hw/xfree86/xaa/xaaLineMisc.c
+++ /dev/null
@@ -1,149 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "miline.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16
17void
18XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
19{
20 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
21
22 if (dir == DEGREES_0)
23 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, len, 1);
24 else
25 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, len);
26}
27
28void
29XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
30{
31 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
32
33 len--;
34
35 if (dir == DEGREES_0)
36 (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x + len, y, 0);
37 else
38 (*infoRec->SubsequentSolidTwoPointLine) (pScrn, x, y, x, y + len, 0);
39}
40
41void
42XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn,
43 int x, int y, int len, int dir)
44{
45 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
46
47 if (dir == DEGREES_0)
48 (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0,
49 -len, len, 0);
50 else
51 (*infoRec->SubsequentSolidBresenhamLine) (pScrn, x, y, len << 1, 0,
52 -len, len, YMAJOR);
53}
54
55void
56XAAComputeDash(GCPtr pGC)
57{
58 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
59 XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates,
60 XAAGetGCKey());
61 Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
62 int PatternLength = 0;
63 unsigned char *DashPtr = (unsigned char *) pGC->dash;
64 CARD32 *ptr;
65 int count = pGC->numInDashList;
66 int shift, value, direction;
67 Bool set;
68
69 free(pGCPriv->DashPattern);
70
71 pGCPriv->DashPattern = NULL;
72 pGCPriv->DashLength = 0;
73
74 while (count--)
75 PatternLength += *(DashPtr++);
76
77 if (!EvenDash)
78 PatternLength <<= 1;
79
80 if (PatternLength > infoRec->DashPatternMaxLength)
81 return;
82
83 if ((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
84 (PatternLength & (PatternLength - 1)))
85 return;
86
87 pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4);
88 if (!pGCPriv->DashPattern)
89 return;
90 pGCPriv->DashLength = PatternLength;
91
92 if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
93 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
94 direction = 1;
95 set = TRUE;
96 DashPtr = (unsigned char *) pGC->dash;
97 }
98 else {
99 direction = -1;
100 set = FALSE;
101 DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList - 1;
102 }
103
104 if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
105 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
106 shift = 32 - (PatternLength & 31);
107 else
108 shift = 0;
109
110 ptr = (CARD32 *) (pGCPriv->DashPattern);
111
112 CONCATENATE:
113
114 count = pGC->numInDashList;
115
116 while (count--) {
117 value = *DashPtr;
118 DashPtr += direction;
119 while (value) {
120 if (value < (32 - shift)) {
121 if (set)
122 *ptr |= XAAShiftMasks[value] << shift;
123 shift += value;
124 break;
125 }
126 else {
127 if (set)
128 *ptr |= ~0L << shift;
129 value -= (32 - shift);
130 shift = 0;
131 ptr++;
132 }
133 }
134 if (set)
135 set = FALSE;
136 else
137 set = TRUE;
138 }
139
140 if (!EvenDash) {
141 EvenDash = TRUE;
142 if (infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
143 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
144 DashPtr = (unsigned char *) pGC->dash;
145 else
146 DashPtr = (unsigned char *) pGC->dash + pGC->numInDashList;
147 goto CONCATENATE;
148 }
149}
diff --git a/hw/xfree86/xaa/xaaNonTEGlyph.c b/hw/xfree86/xaa/xaaNonTEGlyph.c
deleted file mode 100644
index bfe7f9a09..000000000
--- a/hw/xfree86/xaa/xaaNonTEGlyph.c
+++ /dev/null
@@ -1,192 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "xaa.h"
7#include "xaalocal.h"
8#include "xaacexp.h"
9#include "xf86.h"
10
11/* Not used anymore because the algorithm isn't correct. It doesn't
12 handle overlapping characters properly */
13
14#ifdef TRIPLE_BITS
15#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc3)
16#else
17#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc)
18#endif
19
20/********************************************************************
21
22 Here we have NonTEGlyphRenders for a bunch of different color
23 expansion types. The driver may provide its own renderer, but
24 this is the default one which renders using lower-level primitives
25 exported by the chipset driver.
26
27********************************************************************/
28
29/* Since the dimensions of the text string and the backing rectangle
30 do not always coincide, it is possible that wBack or wText
31 may be 0! The NonTEGlyphRender must always check for this. */
32
33/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not,
34 with TRIPLE_BITS or not. A total of 8 versions */
35
36/* if the backing rectangle and text are of the same dimensions
37 then we can draw in one pass */
38
39void
40#ifdef TRIPLE_BITS
41 EXPNAME(XAANonTEGlyphRenderer3) (
42#else
43 EXPNAME(XAANonTEGlyphRenderer) (
44#endif
45 ScrnInfoPtr pScrn,
46 int xText, int wText,
47 int y, int h, int skipleft, int startline,
48 NonTEGlyphInfo * glyphp,
49 int fg, int rop, unsigned int planemask) {
50 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
51 CARD32 *base = (CARD32 *) infoRec->ColorExpandBase;
52
53#ifdef TRIPLE_BITS
54 int dwords = ((3 * wText + 31) >> 5) * h;
55#else
56 int dwords = ((wText + 31) >> 5) * h;
57#endif
58
59 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, -1, rop,
60 planemask);
61 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, xText, y, wText, h,
62 0);
63
64#ifndef FIXEDBASE
65#ifdef TRIPLE_BITS
66 if ((((3 * wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
67#else
68 if ((((wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
69#endif
70 while (h--)
71 base = NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
72 else
73#endif
74 while (h--)
75 NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
76
77 if ((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) &&
78 (dwords & 1)) {
79 base = (CARD32 *) infoRec->ColorExpandBase;
80 base[0] = 0x00000000;
81 }
82
83 if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
84 (*infoRec->Sync) (pScrn);
85 else
86 SET_SYNC_FLAG(infoRec);
87}
88
89#ifndef FIXEDBASE
90/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
91
92void
93#ifdef TRIPLE_BITS
94 EXPNAME(XAANonTEGlyphRendererScanline3) (
95#else
96 EXPNAME(XAANonTEGlyphRendererScanline) (
97#endif
98 ScrnInfoPtr pScrn,
99 int xText, int wText,
100 int y, int h, int skipleft,
101 int startline,
102 NonTEGlyphInfo * glyphp, int fg,
103 int rop, unsigned int planemask) {
104 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
105 int bufferNo = 0;
106 CARD32 *base;
107
108 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, -1, rop,
109 planemask);
110 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, xText, y,
111 wText, h, 0);
112
113 while (h--) {
114 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
115 NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
116 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
117 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
118 bufferNo = 0;
119 }
120
121 SET_SYNC_FLAG(infoRec);
122}
123
124#endif
125
126/********************************************************************
127
128 Generic NonTE scanline rendering code.
129
130********************************************************************/
131
132CARD32 *
133NonTEGlyphFunc(CARD32 *base,
134 NonTEGlyphInfo * glyphp, int line, int TotalWidth, int skipleft)
135{
136 CARD32 bits = 0;
137 int shift = glyphp->width;
138
139 if (skipleft) {
140 if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
141 bits = SHIFT_R(glyphp->bitsp[line], skipleft);
142 shift -= skipleft;
143 }
144 else if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
145 bits = glyphp->bitsp[line];
146
147 while (TotalWidth > 32) {
148 while (shift < 32) {
149 glyphp++;
150 if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
151 bits |= SHIFT_L(glyphp->bitsp[line], shift);
152 shift += glyphp->width;
153 }
154#ifdef TRIPLE_BITS
155 WRITE_BITS3(bits);
156#else
157 WRITE_BITS(bits);
158#endif
159 shift &= 31;
160 if (shift && (line >= glyphp->firstline) && (line <= glyphp->lastline))
161 bits = SHIFT_R(glyphp->bitsp[line], glyphp->width - shift);
162 else
163 bits = 0;
164 TotalWidth -= 32;
165 }
166
167 if (TotalWidth) {
168 TotalWidth -= shift;
169 while (TotalWidth > 0) {
170 glyphp++;
171 if ((line >= glyphp->firstline) && (line <= glyphp->lastline))
172 bits |= SHIFT_L(glyphp->bitsp[line], shift);
173 shift += glyphp->width;
174 TotalWidth -= glyphp->width;
175 }
176#ifdef TRIPLE_BITS
177 if (shift >= 22) {
178 WRITE_BITS3(bits);
179 }
180 else if (shift >= 11) {
181 WRITE_BITS2(bits);
182 }
183 else {
184 WRITE_BITS1(bits);
185 }
186#else
187 WRITE_BITS(bits);
188#endif
189 }
190
191 return base;
192}
diff --git a/hw/xfree86/xaa/xaaNonTEText.c b/hw/xfree86/xaa/xaaNonTEText.c
deleted file mode 100644
index 35b43912b..000000000
--- a/hw/xfree86/xaa/xaaNonTEText.c
+++ /dev/null
@@ -1,591 +0,0 @@
1
2/********************************************************************
3
4 In this file we have GC level replacements for PolyText8/16,
5 ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional)
6 fonts. The idea is that everything in this file is device independent.
7 The mentioned GCOps are merely wrappers for the
8 PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
9 functions which calculate the boxes containing arbitrarily clipped
10 text and passes them to the NonTEGlyphRenderer which will usually
11 be a lower level XAA function which renders these clipped glyphs using
12 the basic color expansion functions exported by the chipset driver.
13 The NonTEGlyphRenderer itself may optionally be driver supplied to
14 facilitate work-arounds/optimizations at a higher level than usual.
15
16 Written by Mark Vojkovich (mvojkovi@ucsd.edu)
17
18********************************************************************/
19
20#ifdef HAVE_XORG_CONFIG_H
21#include <xorg-config.h>
22#endif
23
24#include <string.h>
25
26#include "misc.h"
27#include "xf86.h"
28#include "xf86_OSproc.h"
29
30#include <X11/X.h>
31#include <X11/fonts/font.h>
32#include "scrnintstr.h"
33#include "dixfontstr.h"
34#include "xf86str.h"
35#include "xaa.h"
36#include "xaacexp.h"
37#include "xaalocal.h"
38#include "gcstruct.h"
39#include "pixmapstr.h"
40
41static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
42 int xInit, int yInit, FontPtr font,
43 int fg, int bg, unsigned planemask,
44 RegionPtr cclip, int nglyph,
45 unsigned char *gBase,
46 CharInfoPtr * ppci);
47static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
48 int yInit, FontPtr font, int fg,
49 int rop, unsigned planemask,
50 RegionPtr cclip, int nglyph,
51 unsigned char *gBase,
52 CharInfoPtr * ppci);
53
54/********************************************************************
55
56 GC level replacements for PolyText8/16 and ImageText8/16
57 for NonTE fonts when using color expansion.
58
59********************************************************************/
60
61int
62XAAPolyText8NonTEColorExpansion(DrawablePtr pDraw,
63 GCPtr pGC, int x, int y, int count, char *chars)
64{
65 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
66 unsigned long n;
67 int width = 0;
68
69 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
70 (unsigned char *) chars, Linear8Bit, &n,
71 infoRec->CharInfo);
72
73 if (n) {
74 width = PolyGlyphBltNonTEColorExpansion(infoRec->pScrn,
75 x + pDraw->x, y + pDraw->y,
76 pGC->font, pGC->fgPixel,
77 pGC->alu, pGC->planemask,
78 pGC->pCompositeClip, n,
79 FONTGLYPHS(pGC->font),
80 infoRec->CharInfo);
81 }
82
83 return x + width;
84}
85
86int
87XAAPolyText16NonTEColorExpansion(DrawablePtr pDraw,
88 GCPtr pGC,
89 int x, int y, int count, unsigned short *chars)
90{
91 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
92 unsigned long n;
93 int width = 0;
94
95 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
96 (unsigned char *) chars,
97 (FONTLASTROW(pGC->font) ==
98 0) ? Linear16Bit : TwoD16Bit, &n,
99 infoRec->CharInfo);
100
101 if (n) {
102 width = PolyGlyphBltNonTEColorExpansion(infoRec->pScrn,
103 x + pDraw->x, y + pDraw->y,
104 pGC->font, pGC->fgPixel,
105 pGC->alu, pGC->planemask,
106 pGC->pCompositeClip, n,
107 FONTGLYPHS(pGC->font),
108 infoRec->CharInfo);
109 }
110
111 return x + width;
112}
113
114void
115XAAImageText8NonTEColorExpansion(DrawablePtr pDraw,
116 GCPtr pGC,
117 int x, int y, int count, char *chars)
118{
119 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
120 unsigned long n;
121
122 if (!RegionNumRects(pGC->pCompositeClip))
123 return;
124
125 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
126 (unsigned char *) chars, Linear8Bit, &n,
127 infoRec->CharInfo);
128
129 if (n)
130 ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, x + pDraw->x,
131 y + pDraw->y, pGC->font, pGC->fgPixel,
132 pGC->bgPixel, pGC->planemask,
133 pGC->pCompositeClip, n,
134 FONTGLYPHS(pGC->font),
135 infoRec->CharInfo);
136}
137
138void
139XAAImageText16NonTEColorExpansion(DrawablePtr pDraw,
140 GCPtr pGC,
141 int x,
142 int y, int count, unsigned short *chars)
143{
144 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
145 unsigned long n;
146
147 if (!RegionNumRects(pGC->pCompositeClip))
148 return;
149
150 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
151 (unsigned char *) chars,
152 (FONTLASTROW(pGC->font) ==
153 0) ? Linear16Bit : TwoD16Bit, &n,
154 infoRec->CharInfo);
155
156 if (n)
157 ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, x + pDraw->x,
158 y + pDraw->y, pGC->font, pGC->fgPixel,
159 pGC->bgPixel, pGC->planemask,
160 pGC->pCompositeClip, n,
161 FONTGLYPHS(pGC->font),
162 infoRec->CharInfo);
163}
164
165/********************************************************************
166
167 GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
168 NonTE fonts when using color expansion.
169
170********************************************************************/
171
172void
173XAAImageGlyphBltNonTEColorExpansion(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
174 pointer pglyphBase /* start of array of glyphs */
175 )
176{
177 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
178
179 if (!RegionNumRects(pGC->pCompositeClip))
180 return;
181
182 ImageGlyphBltNonTEColorExpansion(infoRec->pScrn, xInit + pDraw->x,
183 yInit + pDraw->y, pGC->font, pGC->fgPixel,
184 pGC->bgPixel, pGC->planemask,
185 pGC->pCompositeClip, nglyph,
186 (unsigned char *) pglyphBase, ppci);
187}
188
189void
190XAAPolyGlyphBltNonTEColorExpansion(DrawablePtr pDraw, GCPtr pGC, int xInit, int yInit, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
191 pointer pglyphBase /* start of array of glyphs */
192 )
193{
194 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
195
196 if (!RegionNumRects(pGC->pCompositeClip))
197 return;
198
199 PolyGlyphBltNonTEColorExpansion(infoRec->pScrn, xInit + pDraw->x,
200 yInit + pDraw->y, pGC->font, pGC->fgPixel,
201 pGC->alu, pGC->planemask,
202 pGC->pCompositeClip, nglyph,
203 (unsigned char *) pglyphBase, ppci);
204}
205
206/********************************************************************
207
208 ImageGlyphBltNonTEColorExpansion -
209 PolyGlyphBltNonTEColorExpansion -
210
211 These guys compute the clipped pieces of text and send it to
212 the lower-level function which will handle acceleration of
213 arbitrarily clipped text.
214
215********************************************************************/
216
217static int
218CollectCharacterInfo(NonTEGlyphPtr glyphs,
219 unsigned int nglyph, CharInfoPtr * ppci, FontPtr pfont)
220{
221 int i, w = 0;
222
223 for (i = 0; i < nglyph; i++, ppci++, glyphs++) {
224 glyphs->bits = (unsigned char *) ((*ppci)->bits);
225 glyphs->start = w + (*ppci)->metrics.leftSideBearing;
226 glyphs->end = w + (*ppci)->metrics.rightSideBearing;
227 glyphs->yoff = (*ppci)->metrics.ascent;
228 glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
229 glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
230 w += (*ppci)->metrics.characterWidth;
231 }
232 return w;
233}
234
235static void
236PolyGlyphBltAsSingleBitmap(ScrnInfoPtr pScrn,
237 int nglyph,
238 FontPtr font,
239 int xInit,
240 int yInit,
241 int nbox,
242 BoxPtr pbox, int fg, int rop, unsigned planemask)
243{
244 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
245 CARD32 *block, *pntr, *bits;
246 int pitch, topLine, botLine, top, bot, height;
247 int Left, Right, Top, Bottom;
248 int LeftEdge, RightEdge;
249 int bitPitch, shift, size, i, skippix;
250 NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
251 Bool extra;
252
253 Left = xInit + infoRec->GlyphInfo[0].start;
254 Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
255 Top = yInit - FONTMAXBOUNDS(font, ascent);
256 Bottom = yInit + FONTMAXBOUNDS(font, descent);
257
258 /* get into the first band that may contain part of our string */
259 while (nbox && (Top >= pbox->y2)) {
260 pbox++;
261 nbox--;
262 }
263
264 if (!nbox)
265 return;
266
267 pitch = (Right - Left + 31) >> 5;
268 size = (pitch << 2) * (Bottom - Top);
269 block = calloc(1, size);
270
271 topLine = 10000;
272 botLine = -10000;
273
274 while (nglyph--) {
275 top = -glyphs->yoff;
276 bot = top + glyphs->height;
277 if (top < topLine)
278 topLine = top;
279 if (bot > botLine)
280 botLine = bot;
281 skippix = glyphs->start - infoRec->GlyphInfo[0].start;
282 bits = (CARD32 *) glyphs->bits;
283 bitPitch = glyphs->srcwidth >> 2;
284 pntr = block + ((FONTMAXBOUNDS(font, ascent) + top) * pitch) +
285 (skippix >> 5);
286 shift = skippix & 31;
287 extra = ((shift + glyphs->end - glyphs->start) > 32);
288
289 for (i = top; i < bot; i++) {
290 *pntr |= SHIFT_L(*bits, shift);
291 if (extra)
292 *(pntr + 1) |= SHIFT_R(*bits, 32 - shift);
293 pntr += pitch;
294 bits += bitPitch;
295 }
296
297 glyphs++;
298 }
299
300 pntr = block + ((FONTMAXBOUNDS(font, ascent) + topLine) * pitch);
301
302 Top = yInit + topLine;
303 Bottom = yInit + botLine;
304
305 while (nbox && (Top >= pbox->y2)) {
306 pbox++;
307 nbox--;
308 }
309
310 while (nbox && (Bottom > pbox->y1)) {
311 LeftEdge = max(Left, pbox->x1);
312 RightEdge = min(Right, pbox->x2);
313
314 if (RightEdge > LeftEdge) {
315 skippix = LeftEdge - Left;
316 topLine = max(Top, pbox->y1);
317 botLine = min(Bottom, pbox->y2);
318 height = botLine - topLine;
319
320 if (height > 0)
321 (*infoRec->WriteBitmap) (pScrn, LeftEdge, topLine,
322 RightEdge - LeftEdge, height,
323 (unsigned char *) (pntr +
324 ((topLine -
325 Top) * pitch) +
326 (skippix >> 5)),
327 pitch << 2, skippix & 31, fg, -1, rop,
328 planemask);
329 }
330
331 nbox--;
332 pbox++;
333 }
334
335 free(block);
336}
337
338static void
339ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
340 int xInit, int yInit,
341 FontPtr font,
342 int fg, int bg,
343 unsigned planemask,
344 RegionPtr cclip,
345 int nglyph,
346 unsigned char *gBase, CharInfoPtr * ppci)
347{
348 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
349 int skippix, skipglyph, width, n, i;
350 int Left, Right, Top, Bottom;
351 int LeftEdge, RightEdge, ytop, ybot;
352 int nbox = RegionNumRects(cclip);
353 BoxPtr pbox = RegionRects(cclip);
354 Bool AlreadySetup = FALSE;
355
356 width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
357
358 /* find our backing rectangle dimensions */
359 Left = xInit;
360 Right = Left + width;
361 Top = yInit - FONTASCENT(font);
362 Bottom = yInit + FONTDESCENT(font);
363
364 /* get into the first band that may contain part of our box */
365 while (nbox && (Top >= pbox->y2)) {
366 pbox++;
367 nbox--;
368 }
369
370 while (nbox && (Bottom >= pbox->y1)) {
371 /* handle backing rect first */
372 LeftEdge = max(Left, pbox->x1);
373 RightEdge = min(Right, pbox->x2);
374 if (RightEdge > LeftEdge) {
375 ytop = max(Top, pbox->y1);
376 ybot = min(Bottom, pbox->y2);
377
378 if (ybot > ytop) {
379 if (!AlreadySetup) {
380 (*infoRec->SetupForSolidFill) (pScrn, bg, GXcopy,
381 planemask);
382 AlreadySetup = TRUE;
383 }
384 (*infoRec->SubsequentSolidFillRect) (pScrn,
385 LeftEdge, ytop,
386 RightEdge - LeftEdge,
387 ybot - ytop);
388 }
389 }
390 nbox--;
391 pbox++;
392 }
393
394 nbox = RegionNumRects(cclip);
395 pbox = RegionRects(cclip);
396
397 if (infoRec->WriteBitmap && (nglyph > 1) &&
398 ((FONTMAXBOUNDS(font, rightSideBearing) -
399 FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
400 PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
401 xInit, yInit, nbox, pbox,
402 fg, GXcopy, planemask);
403
404 return;
405 }
406
407 /* compute an approximate but covering bounding box */
408 Left = xInit + infoRec->GlyphInfo[0].start;
409 Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
410 Top = yInit - FONTMAXBOUNDS(font, ascent);
411 Bottom = yInit + FONTMAXBOUNDS(font, descent);
412
413 /* get into the first band that may contain part of our box */
414 while (nbox && (Top >= pbox->y2)) {
415 pbox++;
416 nbox--;
417 }
418
419 /* stop when the lower edge of the box is beyond our string */
420 while (nbox && (Bottom >= pbox->y1)) {
421 LeftEdge = max(Left, pbox->x1);
422 RightEdge = min(Right, pbox->x2);
423
424 if (RightEdge > LeftEdge) { /* we're possibly drawing something */
425 ytop = max(Top, pbox->y1);
426 ybot = min(Bottom, pbox->y2);
427 if (ybot > ytop) {
428 skippix = LeftEdge - xInit;
429 skipglyph = 0;
430 while (skippix >= infoRec->GlyphInfo[skipglyph].end)
431 skipglyph++;
432
433 skippix = RightEdge - xInit;
434 n = 0;
435 i = skipglyph;
436 while ((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
437 i++;
438 n++;
439 }
440
441 if (n)
442 (*infoRec->NonTEGlyphRenderer) (pScrn,
443 xInit, yInit, n,
444 infoRec->GlyphInfo +
445 skipglyph, pbox, fg, GXcopy,
446 planemask);
447 }
448 }
449
450 nbox--;
451 pbox++;
452 }
453}
454
455static int
456PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
457 int xInit, int yInit,
458 FontPtr font,
459 int fg, int rop,
460 unsigned planemask,
461 RegionPtr cclip,
462 int nglyph,
463 unsigned char *gBase, CharInfoPtr * ppci)
464{
465 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
466 int skippix, skipglyph, width, n, i;
467 int Left, Right, Top, Bottom;
468 int LeftEdge, RightEdge;
469 int nbox = RegionNumRects(cclip);
470 BoxPtr pbox = RegionRects(cclip);
471
472 width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
473
474 if (!nbox)
475 return width;
476
477 if ((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
478 ((FONTMAXBOUNDS(font, rightSideBearing) -
479 FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
480
481 PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
482 xInit, yInit, nbox, pbox,
483 fg, rop, planemask);
484
485 return width;
486 }
487
488 /* compute an approximate but covering bounding box */
489 Left = xInit + infoRec->GlyphInfo[0].start;
490 Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
491 Top = yInit - FONTMAXBOUNDS(font, ascent);
492 Bottom = yInit + FONTMAXBOUNDS(font, descent);
493
494 /* get into the first band that may contain part of our string */
495 while (nbox && (Top >= pbox->y2)) {
496 pbox++;
497 nbox--;
498 }
499
500 /* stop when the lower edge of the box is beyond our string */
501 while (nbox && (Bottom >= pbox->y1)) {
502 LeftEdge = max(Left, pbox->x1);
503 RightEdge = min(Right, pbox->x2);
504
505 if (RightEdge > LeftEdge) { /* we're possibly drawing something */
506
507 skippix = LeftEdge - xInit;
508 skipglyph = 0;
509 while (skippix >= infoRec->GlyphInfo[skipglyph].end)
510 skipglyph++;
511
512 skippix = RightEdge - xInit;
513 n = 0;
514 i = skipglyph;
515 while ((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
516 i++;
517 n++;
518 }
519
520 if (n)
521 (*infoRec->NonTEGlyphRenderer) (pScrn,
522 xInit, yInit, n,
523 infoRec->GlyphInfo + skipglyph,
524 pbox, fg, rop, planemask);
525 }
526
527 nbox--;
528 pbox++;
529 }
530 return width;
531}
532
533/* It is possible that the none of the glyphs passed to the
534 NonTEGlyphRenderer will be drawn. This function being called
535 indicates that part of the text string's bounding box is visible
536 but not necessarily that any of the characters are visible */
537
538void
539XAANonTEGlyphRenderer(ScrnInfoPtr pScrn,
540 int x, int y, int n,
541 NonTEGlyphPtr glyphs,
542 BoxPtr pbox, int fg, int rop, unsigned int planemask)
543{
544 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
545 int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
546 unsigned char *src;
547
548 for (i = 0; i < n; i++, glyphs++) {
549 x1 = x + glyphs->start;
550 x2 = x + glyphs->end;
551 y1 = y - glyphs->yoff;
552 y2 = y1 + glyphs->height;
553
554 if (y1 < pbox->y1) {
555 skiptop = pbox->y1 - y1;
556 y1 = pbox->y1;
557 }
558 else
559 skiptop = 0;
560 if (y2 > pbox->y2)
561 y2 = pbox->y2;
562 h = y2 - y1;
563 if (h <= 0)
564 continue;
565
566 if (x1 < pbox->x1) {
567 skipleft = pbox->x1 - x1;
568 x1 = pbox->x1;
569 }
570 else
571 skipleft = 0;
572 if (x2 > pbox->x2)
573 x2 = pbox->x2;
574
575 w = x2 - x1;
576
577 if (w > 0) {
578 src = glyphs->bits + (skiptop * glyphs->srcwidth);
579
580 if (skipleft) {
581 src += (skipleft >> 5) << 2;
582 skipleft &= 31;
583 }
584
585 (*infoRec->WriteBitmap) (pScrn, x1, y1, w, h, src,
586 glyphs->srcwidth, skipleft, fg, -1, rop,
587 planemask);
588 }
589 }
590
591}
diff --git a/hw/xfree86/xaa/xaaOffscreen.c b/hw/xfree86/xaa/xaaOffscreen.c
deleted file mode 100644
index 7d89fc17a..000000000
--- a/hw/xfree86/xaa/xaaOffscreen.c
+++ /dev/null
@@ -1,163 +0,0 @@
1
2/*
3 Copyright (c) 1999 - The XFree86 Project Inc.
4
5 Written by Mark Vojkovich
6
7*/
8
9#ifdef HAVE_XORG_CONFIG_H
10#include <xorg-config.h>
11#endif
12
13#include "misc.h"
14#include "xf86.h"
15#include "xf86_OSproc.h"
16
17#include <X11/X.h>
18#include "scrnintstr.h"
19#include "pixmapstr.h"
20#include "windowstr.h"
21#include "xf86str.h"
22#include "mi.h"
23#include "miline.h"
24#include "xaa.h"
25#include "xaalocal.h"
26#include "xaawrap.h"
27#include "xf86fbman.h"
28#include "servermd.h"
29
30void
31XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
32{
33 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
34 PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
35 XAAPixmapPtr pPriv;
36
37 while (pLink) {
38 pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
39 pLink->area = pPriv->offscreenArea;
40 XAAMoveOutOffscreenPixmap(pLink->pPix);
41 pLink = pLink->next;
42 }
43}
44
45void
46XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
47{
48 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
49 PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
50 PixmapPtr pPix, pScreenPix, tmpPix;
51 pointer data;
52 XAAPixmapPtr pPriv;
53 GCPtr pGC;
54 FBAreaPtr area;
55
56 pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
57
58 while (pLink) {
59 pPix = pLink->pPix;
60 pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
61 area = pLink->area;
62
63 data = pPix->devPrivate.ptr;
64 tmpPix = GetScratchPixmapHeader(pScreen,
65 pPix->drawable.width,
66 pPix->drawable.height,
67 pPix->drawable.depth,
68 pPix->drawable.bitsPerPixel,
69 pPix->devKind, data);
70
71 pPriv->freeData = FALSE;
72
73 pPix->drawable.x = area->box.x1;
74 pPix->drawable.y = area->box.y1;
75 pPix->devKind = pScreenPix->devKind;
76 pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
77 pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
78 pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
79
80 if (!tmpPix) {
81 pPriv->offscreenArea = area;
82 free(data);
83 pLink = pLink->next;
84 continue;
85 }
86
87 pGC = GetScratchGC(pPix->drawable.depth, pScreen);
88 ValidateGC((DrawablePtr) pPix, pGC);
89
90 (*pGC->ops->CopyArea) ((DrawablePtr) tmpPix, (DrawablePtr) pPix, pGC,
91 0, 0, pPix->drawable.width,
92 pPix->drawable.height, 0, 0);
93
94 free(data);
95 tmpPix->devPrivate.ptr = NULL;
96
97 FreeScratchGC(pGC);
98 FreeScratchPixmapHeader(tmpPix);
99
100 pPriv->offscreenArea = area;
101 pLink->area = NULL;
102 pLink = pLink->next;
103 }
104}
105
106void
107XAARemoveAreaCallback(FBAreaPtr area)
108{
109 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
110 PixmapPtr pPix = (PixmapPtr) area->devPrivate.ptr;
111 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
112
113 XAAMoveOutOffscreenPixmap(pPix);
114
115 pPriv->flags &= ~OFFSCREEN;
116
117 DELIST_OFFSCREEN_PIXMAP(pPix);
118}
119
120void
121XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
122{
123 ScreenPtr pScreen = pPix->drawable.pScreen;
124 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
125 int width, height, devKind, bitsPerPixel;
126 PixmapPtr tmpPix;
127 unsigned char *data;
128 GCPtr pGC;
129
130 width = pPix->drawable.width;
131 height = pPix->drawable.height;
132 bitsPerPixel = pPix->drawable.bitsPerPixel;
133
134 devKind = BitmapBytePad(width * bitsPerPixel);
135 if (!(data = malloc(devKind * height)))
136 FatalError("Out of memory\n");
137
138 tmpPix = GetScratchPixmapHeader(pScreen, width, height,
139 pPix->drawable.depth, bitsPerPixel, devKind,
140 data);
141 if (!tmpPix) {
142 free(data);
143 FatalError("Out of memory\n");
144 }
145
146 pGC = GetScratchGC(pPix->drawable.depth, pScreen);
147 ValidateGC((DrawablePtr) tmpPix, pGC);
148
149 (*pGC->ops->CopyArea) ((DrawablePtr) pPix, (DrawablePtr) tmpPix,
150 pGC, 0, 0, width, height, 0, 0);
151
152 FreeScratchGC(pGC);
153 FreeScratchPixmapHeader(tmpPix);
154
155 pPix->drawable.x = 0;
156 pPix->drawable.y = 0;
157 pPix->devKind = devKind;
158 pPix->devPrivate.ptr = data;
159 pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
160
161 pPriv->offscreenArea = NULL;
162 pPriv->freeData = TRUE;
163}
diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c
deleted file mode 100644
index 25d18da96..000000000
--- a/hw/xfree86/xaa/xaaOverlay.c
+++ /dev/null
@@ -1,122 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "windowstr.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16#include "xaawrap.h"
17#include "gcstruct.h"
18#include "pixmapstr.h"
19#include "mioverlay.h"
20
21#ifdef PANORAMIX
22#include "panoramiX.h"
23#include "panoramiXsrv.h"
24#endif
25
26static void
27XAACopyWindow8_32(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
28{
29 DDXPointPtr pptSrc, ppt;
30 RegionRec rgnDst;
31 BoxPtr pbox;
32 int dx, dy, nbox;
33 WindowPtr pwinRoot;
34 ScreenPtr pScreen = pWin->drawable.pScreen;
35 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
36 Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
37 RegionPtr borderClip = &pWin->borderClip;
38 Bool freeReg = FALSE;
39
40 if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
41 (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) {
42 XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
43 if (infoRec->pScrn->vtSema && infoRec->NeedToSync) {
44 (*infoRec->Sync) (infoRec->pScrn);
45 infoRec->NeedToSync = FALSE;
46 }
47 (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
48 XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAACopyWindow8_32);
49 return;
50 }
51
52 pwinRoot = pScreen->root;
53
54 if (doUnderlay)
55 freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
56
57 RegionNull(&rgnDst);
58
59 dx = ptOldOrg.x - pWin->drawable.x;
60 dy = ptOldOrg.y - pWin->drawable.y;
61 RegionTranslate(prgnSrc, -dx, -dy);
62 RegionIntersect(&rgnDst, borderClip, prgnSrc);
63
64 pbox = RegionRects(&rgnDst);
65 nbox = RegionNumRects(&rgnDst);
66 if (!nbox || !(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
67 RegionUninit(&rgnDst);
68 return;
69 }
70 ppt = pptSrc;
71
72 while (nbox--) {
73 ppt->x = pbox->x1 + dx;
74 ppt->y = pbox->y1 + dy;
75 ppt++;
76 pbox++;
77 }
78
79 infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
80 infoRec->ScratchGC.alu = GXcopy;
81
82 XAADoBitBlt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot,
83 &(infoRec->ScratchGC), &rgnDst, pptSrc);
84
85 free(pptSrc);
86 RegionUninit(&rgnDst);
87 if (freeReg)
88 RegionDestroy(borderClip);
89}
90
91static void
92XAASetColorKey8_32(ScreenPtr pScreen, int nbox, BoxPtr pbox)
93{
94 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
95 ScrnInfoPtr pScrn = infoRec->pScrn;
96
97 /* I'm counting on writes being clipped away while switched away.
98 If this isn't going to be true then I need to be wrapping instead. */
99 if (!infoRec->pScrn->vtSema)
100 return;
101
102 (*infoRec->FillSolidRects) (pScrn, pScrn->colorKey << 24, GXcopy,
103 0xff000000, nbox, pbox);
104
105 SET_SYNC_FLAG(infoRec);
106}
107
108void
109XAASetupOverlay8_32Planar(ScreenPtr pScreen)
110{
111 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
112 int i;
113
114 pScreen->CopyWindow = XAACopyWindow8_32;
115
116 if (!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
117 miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);
118
119 infoRec->FullPlanemask = ~0;
120 for (i = 0; i < 32; i++) /* haven't thought about this much */
121 infoRec->FullPlanemasks[i] = ~0;
122}
diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c
deleted file mode 100644
index 470694cbd..000000000
--- a/hw/xfree86/xaa/xaaOverlayDF.c
+++ /dev/null
@@ -1,906 +0,0 @@
1/*
2 Copyright (c) 1999 - The XFree86 Project Inc.
3
4 Written by Mark Vojkovich
5*/
6
7#ifdef HAVE_XORG_CONFIG_H
8#include <xorg-config.h>
9#endif
10
11#include "misc.h"
12#include "xf86.h"
13#include "xf86_OSproc.h"
14
15#include <X11/X.h>
16#include "scrnintstr.h"
17#include "pixmapstr.h"
18#include "windowstr.h"
19#include "xf86str.h"
20#include "mi.h"
21#include "miline.h"
22#include "xaa.h"
23#include "xaalocal.h"
24#include "xaawrap.h"
25#include "servermd.h"
26
27/* Screen funcs */
28
29static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
30static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr);
31
32static int XAAOverStippledFillChooser(GCPtr);
33static int XAAOverOpaqueStippledFillChooser(GCPtr);
34static int XAAOverTiledFillChooser(GCPtr);
35
36/* GC funcs */
37
38static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *,
39 int, int, int, int, int, int);
40static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr,
41 int, int, int, int, int, int, unsigned long);
42static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int,
43 int, int, int);
44static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle *);
45static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle *);
46static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr,
47 int, xRectangle *);
48static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle *);
49static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr,
50 int *, int);
51static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr,
52 int *, int);
53static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int,
54 DDXPointPtr, int *, int);
55static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr,
56 int *, int);
57static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *);
58static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int,
59 unsigned short *);
60static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char *);
61static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int,
62 unsigned short *);
63static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int,
64 unsigned int, CharInfoPtr *, pointer);
65static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int,
66 unsigned int, CharInfoPtr *, pointer);
67static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char *);
68static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int,
69 unsigned short *);
70static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char *);
71static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int,
72 unsigned short *);
73static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
74 unsigned int, CharInfoPtr *, pointer);
75static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
76 unsigned int, CharInfoPtr *, pointer);
77static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int,
78 xRectangle *);
79static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int,
80 DDXPointPtr);
81static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int,
82 DDXPointPtr);
83static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment *);
84static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int,
85 DDXPointPtr);
86static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment *);
87static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int,
88 DDXPointPtr);
89static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int,
90 DDXPointPtr);
91static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int,
92 DDXPointPtr);
93static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int,
94 DDXPointPtr);
95static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc *);
96static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
97 int, int, char *);
98
99typedef struct {
100 ScrnInfoPtr pScrn;
101 DepthChangeFuncPtr callback;
102 int currentDepth;
103/* GC funcs */
104 RegionPtr (*CopyArea) (DrawablePtr, DrawablePtr, GC *,
105 int, int, int, int, int, int);
106 RegionPtr (*CopyPlane) (DrawablePtr, DrawablePtr, GCPtr,
107 int, int, int, int, int, int, unsigned long);
108 void (*PushPixelsSolid) (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
109 void (*PolyFillRectSolid) (DrawablePtr, GCPtr, int, xRectangle *);
110 void (*PolyFillRectStippled) (DrawablePtr, GCPtr, int, xRectangle *);
111 void (*PolyFillRectOpaqueStippled) (DrawablePtr, GCPtr, int, xRectangle *);
112 void (*PolyFillRectTiled) (DrawablePtr, GCPtr, int, xRectangle *);
113 void (*FillSpansSolid) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, int);
114 void (*FillSpansStippled) (DrawablePtr, GCPtr, int, DDXPointPtr, int *,
115 int);
116 void (*FillSpansOpaqueStippled) (DrawablePtr, GCPtr, int, DDXPointPtr,
117 int *, int);
118 void (*FillSpansTiled) (DrawablePtr, GCPtr, int, DDXPointPtr, int *, int);
119 int (*PolyText8TE) (DrawablePtr, GCPtr, int, int, int, char *);
120 int (*PolyText16TE) (DrawablePtr, GCPtr, int, int, int, unsigned short *);
121 void (*ImageText8TE) (DrawablePtr, GCPtr, int, int, int, char *);
122 void (*ImageText16TE) (DrawablePtr, GCPtr, int, int, int, unsigned short *);
123 void (*ImageGlyphBltTE) (DrawablePtr, GCPtr, int, int, unsigned int,
124 CharInfoPtr *, pointer);
125 void (*PolyGlyphBltTE) (DrawablePtr, GCPtr, int, int, unsigned int,
126 CharInfoPtr *, pointer);
127 int (*PolyText8NonTE) (DrawablePtr, GCPtr, int, int, int, char *);
128 int (*PolyText16NonTE) (DrawablePtr, GCPtr, int, int, int,
129 unsigned short *);
130 void (*ImageText8NonTE) (DrawablePtr, GCPtr, int, int, int, char *);
131 void (*ImageText16NonTE) (DrawablePtr, GCPtr, int, int, int,
132 unsigned short *);
133 void (*ImageGlyphBltNonTE) (DrawablePtr, GCPtr, int, int, unsigned int,
134 CharInfoPtr *, pointer);
135 void (*PolyGlyphBltNonTE) (DrawablePtr, GCPtr, int, int, unsigned int,
136 CharInfoPtr *, pointer);
137 void (*PolyRectangleThinSolid) (DrawablePtr, GCPtr, int, xRectangle *);
138 void (*PolylinesWideSolid) (DrawablePtr, GCPtr, int, int, DDXPointPtr);
139
140 void (*PolylinesThinSolid) (DrawablePtr, GCPtr, int, int, DDXPointPtr);
141 void (*PolySegmentThinSolid) (DrawablePtr, GCPtr, int, xSegment *);
142 void (*PolylinesThinDashed) (DrawablePtr, GCPtr, int, int, DDXPointPtr);
143 void (*PolySegmentThinDashed) (DrawablePtr, GCPtr, int, xSegment *);
144 void (*FillPolygonSolid) (DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
145 void (*FillPolygonStippled) (DrawablePtr, GCPtr, int, int, int,
146 DDXPointPtr);
147 void (*FillPolygonOpaqueStippled) (DrawablePtr, GCPtr, int, int, int,
148 DDXPointPtr);
149 void (*FillPolygonTiled) (DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
150 void (*PolyFillArcSolid) (DrawablePtr, GCPtr, int, xArc *);
151 void (*PutImage) (DrawablePtr, GCPtr, int, int, int, int, int, int,
152 int, char *);
153 int (*StippledFillChooser) (GCPtr);
154 int (*OpaqueStippledFillChooser) (GCPtr);
155 int (*TiledFillChooser) (GCPtr);
156} XAAOverlayRec, *XAAOverlayPtr;
157
158static DevPrivateKeyRec XAAOverlayKeyRec;
159
160#define XAAOverlayKey (&XAAOverlayKeyRec)
161
162#define GET_OVERLAY_PRIV(pScreen) \
163 (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
164
165#define SWITCH_DEPTH(d) \
166 if(pOverPriv->currentDepth != d) { \
167 (*pOverPriv->callback)(pOverPriv->pScrn, d); \
168 pOverPriv->currentDepth = d; \
169 }
170
171Bool
172XAAInitDualFramebufferOverlay(ScreenPtr pScreen, DepthChangeFuncPtr callback)
173{
174 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
175 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
176 XAAOverlayPtr pOverPriv;
177
178 if (!dixRegisterPrivateKey(&XAAOverlayKeyRec, PRIVATE_SCREEN, 0))
179 return FALSE;
180
181 if (!(pOverPriv = malloc(sizeof(XAAOverlayRec))))
182 return FALSE;
183
184 dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
185
186 pOverPriv->pScrn = pScrn;
187 pOverPriv->callback = callback;
188 pOverPriv->currentDepth = -1;
189
190 /* Overwrite key screen functions. The XAA core will clean up */
191
192 pScreen->CopyWindow = XAAOverCopyWindow;
193 pScreen->WindowExposures = XAAOverWindowExposures;
194
195 pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
196 pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
197 pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;
198
199 infoRec->StippledFillChooser = XAAOverStippledFillChooser;
200 infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
201 infoRec->TiledFillChooser = XAAOverTiledFillChooser;
202
203 /* wrap all XAA GC rendering */
204
205 pOverPriv->CopyArea = infoRec->CopyArea;
206 pOverPriv->CopyPlane = infoRec->CopyPlane;
207 pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
208 pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
209 pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
210 pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
211 pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
212 pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
213 pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
214 pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
215 pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
216 pOverPriv->PolyText8TE = infoRec->PolyText8TE;
217 pOverPriv->PolyText16TE = infoRec->PolyText16TE;
218 pOverPriv->ImageText8TE = infoRec->ImageText8TE;
219 pOverPriv->ImageText16TE = infoRec->ImageText16TE;
220 pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
221 pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
222 pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
223 pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
224 pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
225 pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
226 pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
227 pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
228 pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
229 pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
230 pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
231 pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
232 pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
233 pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
234 pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
235 pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
236 pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
237 pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
238 pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
239 pOverPriv->PutImage = infoRec->PutImage;
240
241 if (infoRec->CopyArea)
242 infoRec->CopyArea = XAAOverCopyArea;
243 if (infoRec->CopyPlane)
244 infoRec->CopyPlane = XAAOverCopyPlane;
245 if (infoRec->PushPixelsSolid)
246 infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
247 if (infoRec->PolyFillRectSolid)
248 infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
249 if (infoRec->PolyFillRectStippled)
250 infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
251 if (infoRec->PolyFillRectOpaqueStippled)
252 infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
253 if (infoRec->PolyFillRectTiled)
254 infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
255 if (infoRec->FillSpansSolid)
256 infoRec->FillSpansSolid = XAAOverFillSpansSolid;
257 if (infoRec->FillSpansStippled)
258 infoRec->FillSpansStippled = XAAOverFillSpansStippled;
259 if (infoRec->FillSpansOpaqueStippled)
260 infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
261 if (infoRec->FillSpansTiled)
262 infoRec->FillSpansTiled = XAAOverFillSpansTiled;
263 if (infoRec->PolyText8TE)
264 infoRec->PolyText8TE = XAAOverPolyText8TE;
265 if (infoRec->PolyText16TE)
266 infoRec->PolyText16TE = XAAOverPolyText16TE;
267 if (infoRec->ImageText8TE)
268 infoRec->ImageText8TE = XAAOverImageText8TE;
269 if (infoRec->ImageText16TE)
270 infoRec->ImageText16TE = XAAOverImageText16TE;
271 if (infoRec->ImageGlyphBltTE)
272 infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
273 if (infoRec->PolyGlyphBltTE)
274 infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
275 if (infoRec->PolyText8NonTE)
276 infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
277 if (infoRec->PolyText16NonTE)
278 infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
279 if (infoRec->ImageText8NonTE)
280 infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
281 if (infoRec->ImageText16NonTE)
282 infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
283 if (infoRec->ImageGlyphBltNonTE)
284 infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
285 if (infoRec->PolyGlyphBltNonTE)
286 infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
287 if (infoRec->PolyRectangleThinSolid)
288 infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
289 if (infoRec->PolylinesWideSolid)
290 infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
291 if (infoRec->PolylinesThinSolid)
292 infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
293 if (infoRec->PolySegmentThinSolid)
294 infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
295 if (infoRec->PolylinesThinDashed)
296 infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
297 if (infoRec->PolySegmentThinDashed)
298 infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
299 if (infoRec->FillPolygonSolid)
300 infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
301 if (infoRec->FillPolygonStippled)
302 infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
303 if (infoRec->FillPolygonOpaqueStippled)
304 infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
305 if (infoRec->FillPolygonTiled)
306 infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
307 if (infoRec->PolyFillArcSolid)
308 infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
309 if (infoRec->PutImage)
310 infoRec->PutImage = XAAOverPutImage;
311
312 return TRUE;
313}
314
315/*********************** Screen functions ************************/
316
317void
318XAAOverCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
319{
320 ScreenPtr pScreen = pWin->drawable.pScreen;
321 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
322 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
323 ScrnInfoPtr pScrn = infoRec->pScrn;
324 DDXPointPtr ppt, pptSrc;
325 RegionRec rgnDst;
326 BoxPtr pbox;
327 int i, nbox, dx, dy;
328 WindowPtr pRoot = pScreen->root;
329
330 if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
331 XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
332 if (pScrn->vtSema && infoRec->NeedToSync) {
333 (*infoRec->Sync) (pScrn);
334 infoRec->NeedToSync = FALSE;
335 }
336 (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
337 XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAAOverCopyWindow);
338 return;
339 }
340
341 infoRec->ScratchGC.alu = GXcopy;
342 infoRec->ScratchGC.planemask = ~0;
343
344 RegionNull(&rgnDst);
345
346 dx = ptOldOrg.x - pWin->drawable.x;
347 dy = ptOldOrg.y - pWin->drawable.y;
348 RegionTranslate(prgnSrc, -dx, -dy);
349 RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
350
351 nbox = RegionNumRects(&rgnDst);
352 if (nbox && (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
353
354 pbox = RegionRects(&rgnDst);
355 for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
356 ppt->x = pbox->x1 + dx;
357 ppt->y = pbox->y1 + dy;
358 }
359
360 SWITCH_DEPTH(8);
361 XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
362 &(infoRec->ScratchGC), &rgnDst, pptSrc);
363
364 if (pWin->drawable.bitsPerPixel != 8) {
365 SWITCH_DEPTH(pScrn->depth);
366 XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
367 &(infoRec->ScratchGC), &rgnDst, pptSrc);
368 }
369
370 free(pptSrc);
371 }
372
373 RegionUninit(&rgnDst);
374
375 if (pWin->drawable.depth == 8) {
376 RegionNull(&rgnDst);
377 miSegregateChildren(pWin, &rgnDst, pScrn->depth);
378 if (RegionNotEmpty(&rgnDst)) {
379 RegionIntersect(&rgnDst, &rgnDst, prgnSrc);
380 nbox = RegionNumRects(&rgnDst);
381 if (nbox &&
382 (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {
383
384 pbox = RegionRects(&rgnDst);
385 for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
386 ppt->x = pbox->x1 + dx;
387 ppt->y = pbox->y1 + dy;
388 }
389
390 SWITCH_DEPTH(pScrn->depth);
391 XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
392 &(infoRec->ScratchGC), &rgnDst, pptSrc);
393 free(pptSrc);
394 }
395 }
396 RegionUninit(&rgnDst);
397 }
398}
399
400void
401XAAOverWindowExposures(WindowPtr pWin, RegionPtr pReg, RegionPtr pOtherReg)
402{
403 ScreenPtr pScreen = pWin->drawable.pScreen;
404 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
405
406 if ((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
407 if (RegionNumRects(pReg) && infoRec->FillSolidRects) {
408 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
409
410 SWITCH_DEPTH(8);
411 (*infoRec->FillSolidRects) (infoRec->pScrn,
412 infoRec->pScrn->colorKey, GXcopy, ~0,
413 RegionNumRects(pReg),
414 RegionRects(pReg));
415 miWindowExposures(pWin, pReg, pOtherReg);
416 return;
417 }
418 else if (infoRec->NeedToSync) {
419 (*infoRec->Sync) (infoRec->pScrn);
420 infoRec->NeedToSync = FALSE;
421 }
422 }
423
424 XAA_SCREEN_PROLOGUE(pScreen, WindowExposures);
425 (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
426 XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
427}
428
429/********************* Choosers *************************/
430
431static int
432XAAOverStippledFillChooser(GCPtr pGC)
433{
434 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
435 int ret;
436
437 ret = (*pOverPriv->StippledFillChooser) (pGC);
438
439 if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
440 ret = 0;
441 }
442
443 return ret;
444}
445
446static int
447XAAOverOpaqueStippledFillChooser(GCPtr pGC)
448{
449 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
450 int ret;
451
452 ret = (*pOverPriv->OpaqueStippledFillChooser) (pGC);
453
454 if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
455 ret = 0;
456 }
457
458 return ret;
459}
460
461static int
462XAAOverTiledFillChooser(GCPtr pGC)
463{
464 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
465 int ret;
466
467 ret = (*pOverPriv->TiledFillChooser) (pGC);
468
469 if ((pGC->depth == 8) && ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
470 ret = 0;
471 }
472
473 return ret;
474}
475
476/**************************** GC Functions **************************/
477
478static RegionPtr
479XAAOverCopyArea(DrawablePtr pSrc,
480 DrawablePtr pDst,
481 GC * pGC,
482 int srcx, int srcy, int width, int height, int dstx, int dsty)
483{
484 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
485
486 SWITCH_DEPTH(pGC->depth);
487
488 return (*pOverPriv->CopyArea) (pSrc, pDst,
489 pGC, srcx, srcy, width, height, dstx, dsty);
490}
491
492static RegionPtr
493XAAOverCopyPlane(DrawablePtr pSrc,
494 DrawablePtr pDst,
495 GCPtr pGC,
496 int srcx, int srcy,
497 int width, int height,
498 int dstx, int dsty, unsigned long bitPlane)
499{
500 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
501
502 SWITCH_DEPTH(pGC->depth);
503
504 return (*pOverPriv->CopyPlane) (pSrc, pDst,
505 pGC, srcx, srcy, width, height, dstx, dsty,
506 bitPlane);
507
508}
509
510static void
511XAAOverPushPixelsSolid(GCPtr pGC,
512 PixmapPtr pBitMap,
513 DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
514{
515 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
516
517 SWITCH_DEPTH(pGC->depth);
518
519 (*pOverPriv->PushPixelsSolid) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
520}
521
522static void
523XAAOverPolyFillRectSolid(DrawablePtr pDraw,
524 GCPtr pGC, int nrectFill, xRectangle *prectInit)
525{
526 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
527
528 SWITCH_DEPTH(pGC->depth);
529
530 (*pOverPriv->PolyFillRectSolid) (pDraw, pGC, nrectFill, prectInit);
531}
532
533static void
534XAAOverPolyFillRectStippled(DrawablePtr pDraw,
535 GCPtr pGC, int nrectFill, xRectangle *prectInit)
536{
537 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
538
539 SWITCH_DEPTH(pGC->depth);
540
541 (*pOverPriv->PolyFillRectStippled) (pDraw, pGC, nrectFill, prectInit);
542}
543
544static void
545XAAOverPolyFillRectOpaqueStippled(DrawablePtr pDraw,
546 GCPtr pGC,
547 int nrectFill, xRectangle *prectInit)
548{
549 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
550
551 SWITCH_DEPTH(pGC->depth);
552
553 (*pOverPriv->PolyFillRectOpaqueStippled) (pDraw, pGC, nrectFill, prectInit);
554}
555
556static void
557XAAOverPolyFillRectTiled(DrawablePtr pDraw,
558 GCPtr pGC, int nrectFill, xRectangle *prectInit)
559{
560 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
561
562 SWITCH_DEPTH(pGC->depth);
563
564 (*pOverPriv->PolyFillRectTiled) (pDraw, pGC, nrectFill, prectInit);
565}
566
567static void
568XAAOverFillSpansSolid(DrawablePtr pDraw,
569 GCPtr pGC,
570 int nInit, DDXPointPtr ppt, int *pwidth, int fSorted)
571{
572 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
573
574 SWITCH_DEPTH(pGC->depth);
575
576 (*pOverPriv->FillSpansSolid) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
577}
578
579static void
580XAAOverFillSpansStippled(DrawablePtr pDraw,
581 GCPtr pGC,
582 int nInit, DDXPointPtr ppt, int *pwidth, int fSorted)
583{
584 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
585
586 SWITCH_DEPTH(pGC->depth);
587
588 (*pOverPriv->FillSpansStippled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
589}
590
591static void
592XAAOverFillSpansOpaqueStippled(DrawablePtr pDraw,
593 GCPtr pGC,
594 int nInit,
595 DDXPointPtr ppt, int *pwidth, int fSorted)
596{
597 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
598
599 SWITCH_DEPTH(pGC->depth);
600
601 (*pOverPriv->FillSpansOpaqueStippled) (pDraw, pGC, nInit, ppt, pwidth,
602 fSorted);
603}
604
605static void
606XAAOverFillSpansTiled(DrawablePtr pDraw,
607 GCPtr pGC,
608 int nInit, DDXPointPtr ppt, int *pwidth, int fSorted)
609{
610 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
611
612 SWITCH_DEPTH(pGC->depth);
613
614 (*pOverPriv->FillSpansTiled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
615}
616
617static int
618XAAOverPolyText8TE(DrawablePtr pDraw,
619 GCPtr pGC, int x, int y, int count, char *chars)
620{
621 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
622
623 SWITCH_DEPTH(pGC->depth);
624
625 return (*pOverPriv->PolyText8TE) (pDraw, pGC, x, y, count, chars);
626}
627
628static int
629XAAOverPolyText16TE(DrawablePtr pDraw,
630 GCPtr pGC, int x, int y, int count, unsigned short *chars)
631{
632 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
633
634 SWITCH_DEPTH(pGC->depth);
635
636 return (*pOverPriv->PolyText16TE) (pDraw, pGC, x, y, count, chars);
637}
638
639static void
640XAAOverImageText8TE(DrawablePtr pDraw,
641 GCPtr pGC, int x, int y, int count, char *chars)
642{
643 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
644
645 SWITCH_DEPTH(pGC->depth);
646
647 (*pOverPriv->ImageText8TE) (pDraw, pGC, x, y, count, chars);
648}
649
650static void
651XAAOverImageText16TE(DrawablePtr pDraw,
652 GCPtr pGC, int x, int y, int count, unsigned short *chars)
653{
654 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
655
656 SWITCH_DEPTH(pGC->depth);
657
658 (*pOverPriv->ImageText16TE) (pDraw, pGC, x, y, count, chars);
659}
660
661static void
662XAAOverImageGlyphBltTE(DrawablePtr pDraw,
663 GCPtr pGC,
664 int xInit, int yInit,
665 unsigned int nglyph,
666 CharInfoPtr * ppci, pointer pglyphBase)
667{
668 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
669
670 SWITCH_DEPTH(pGC->depth);
671
672 (*pOverPriv->ImageGlyphBltTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
673 pglyphBase);
674}
675
676static void
677XAAOverPolyGlyphBltTE(DrawablePtr pDraw,
678 GCPtr pGC,
679 int xInit, int yInit,
680 unsigned int nglyph,
681 CharInfoPtr * ppci, pointer pglyphBase)
682{
683 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
684
685 SWITCH_DEPTH(pGC->depth);
686
687 (*pOverPriv->PolyGlyphBltTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
688 pglyphBase);
689}
690
691static int
692XAAOverPolyText8NonTE(DrawablePtr pDraw,
693 GCPtr pGC, int x, int y, int count, char *chars)
694{
695 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
696
697 SWITCH_DEPTH(pGC->depth);
698
699 return (*pOverPriv->PolyText8NonTE) (pDraw, pGC, x, y, count, chars);
700}
701
702static int
703XAAOverPolyText16NonTE(DrawablePtr pDraw,
704 GCPtr pGC,
705 int x, int y, int count, unsigned short *chars)
706{
707 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
708
709 SWITCH_DEPTH(pGC->depth);
710
711 return (*pOverPriv->PolyText16NonTE) (pDraw, pGC, x, y, count, chars);
712}
713
714static void
715XAAOverImageText8NonTE(DrawablePtr pDraw,
716 GCPtr pGC, int x, int y, int count, char *chars)
717{
718 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
719
720 SWITCH_DEPTH(pGC->depth);
721
722 (*pOverPriv->ImageText8NonTE) (pDraw, pGC, x, y, count, chars);
723}
724
725static void
726XAAOverImageText16NonTE(DrawablePtr pDraw,
727 GCPtr pGC,
728 int x, int y, int count, unsigned short *chars)
729{
730 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
731
732 SWITCH_DEPTH(pGC->depth);
733
734 (*pOverPriv->ImageText16NonTE) (pDraw, pGC, x, y, count, chars);
735}
736
737static void
738XAAOverImageGlyphBltNonTE(DrawablePtr pDraw,
739 GCPtr pGC,
740 int xInit, int yInit,
741 unsigned int nglyph,
742 CharInfoPtr * ppci, pointer pglyphBase)
743{
744 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
745
746 SWITCH_DEPTH(pGC->depth);
747
748 (*pOverPriv->ImageGlyphBltNonTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
749 pglyphBase);
750}
751
752static void
753XAAOverPolyGlyphBltNonTE(DrawablePtr pDraw,
754 GCPtr pGC,
755 int xInit, int yInit,
756 unsigned int nglyph,
757 CharInfoPtr * ppci, pointer pglyphBase)
758{
759 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
760
761 SWITCH_DEPTH(pGC->depth);
762
763 (*pOverPriv->PolyGlyphBltNonTE) (pDraw, pGC, xInit, yInit, nglyph, ppci,
764 pglyphBase);
765}
766
767static void
768XAAOverPolyRectangleThinSolid(DrawablePtr pDraw,
769 GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
770{
771 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
772
773 SWITCH_DEPTH(pGC->depth);
774
775 (*pOverPriv->PolyRectangleThinSolid) (pDraw, pGC, nRectsInit, pRectsInit);
776}
777
778static void
779XAAOverPolylinesWideSolid(DrawablePtr pDraw,
780 GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
781{
782 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
783
784 SWITCH_DEPTH(pGC->depth);
785
786 (*pOverPriv->PolylinesWideSolid) (pDraw, pGC, mode, npt, pPts);
787}
788
789static void
790XAAOverPolylinesThinSolid(DrawablePtr pDraw,
791 GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
792{
793 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
794
795 SWITCH_DEPTH(pGC->depth);
796
797 (*pOverPriv->PolylinesThinSolid) (pDraw, pGC, mode, npt, pPts);
798}
799
800static void
801XAAOverPolySegmentThinSolid(DrawablePtr pDraw,
802 GCPtr pGC, int nseg, xSegment * pSeg)
803{
804 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
805
806 SWITCH_DEPTH(pGC->depth);
807
808 (*pOverPriv->PolySegmentThinSolid) (pDraw, pGC, nseg, pSeg);
809}
810
811static void
812XAAOverPolylinesThinDashed(DrawablePtr pDraw,
813 GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
814{
815 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
816
817 SWITCH_DEPTH(pGC->depth);
818
819 (*pOverPriv->PolylinesThinDashed) (pDraw, pGC, mode, npt, pPts);
820}
821
822static void
823XAAOverPolySegmentThinDashed(DrawablePtr pDraw,
824 GCPtr pGC, int nseg, xSegment * pSeg)
825{
826 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
827
828 SWITCH_DEPTH(pGC->depth);
829
830 (*pOverPriv->PolySegmentThinDashed) (pDraw, pGC, nseg, pSeg);
831}
832
833static void
834XAAOverFillPolygonSolid(DrawablePtr pDraw,
835 GCPtr pGC,
836 int shape, int mode, int count, DDXPointPtr ptsIn)
837{
838 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
839
840 SWITCH_DEPTH(pGC->depth);
841
842 (*pOverPriv->FillPolygonSolid) (pDraw, pGC, shape, mode, count, ptsIn);
843}
844
845static void
846XAAOverFillPolygonStippled(DrawablePtr pDraw,
847 GCPtr pGC,
848 int shape, int mode, int count, DDXPointPtr ptsIn)
849{
850 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
851
852 SWITCH_DEPTH(pGC->depth);
853
854 (*pOverPriv->FillPolygonStippled) (pDraw, pGC, shape, mode, count, ptsIn);
855}
856
857static void
858XAAOverFillPolygonOpaqueStippled(DrawablePtr pDraw,
859 GCPtr pGC,
860 int shape,
861 int mode, int count, DDXPointPtr ptsIn)
862{
863 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
864
865 SWITCH_DEPTH(pGC->depth);
866
867 (*pOverPriv->FillPolygonOpaqueStippled) (pDraw, pGC, shape, mode, count,
868 ptsIn);
869}
870
871static void
872XAAOverFillPolygonTiled(DrawablePtr pDraw,
873 GCPtr pGC,
874 int shape, int mode, int count, DDXPointPtr ptsIn)
875{
876 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
877
878 SWITCH_DEPTH(pGC->depth);
879
880 (*pOverPriv->FillPolygonTiled) (pDraw, pGC, shape, mode, count, ptsIn);
881}
882
883static void
884XAAOverPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
885{
886 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
887
888 SWITCH_DEPTH(pGC->depth);
889
890 (*pOverPriv->PolyFillArcSolid) (pDraw, pGC, narcs, parcs);
891}
892
893static void
894XAAOverPutImage(DrawablePtr pDraw,
895 GCPtr pGC,
896 int depth,
897 int x,
898 int y, int w, int h, int leftPad, int format, char *pImage)
899{
900 XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
901
902 SWITCH_DEPTH(pGC->depth);
903
904 (*pOverPriv->PutImage) (pDraw, pGC, depth, x, y, w, h,
905 leftPad, format, pImage);
906}
diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c
deleted file mode 100644
index 53460b31e..000000000
--- a/hw/xfree86/xaa/xaaPCache.c
+++ /dev/null
@@ -1,2527 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include <string.h>
7
8#include "misc.h"
9#include "xf86.h"
10#include "xf86_OSproc.h"
11
12#include <X11/X.h>
13#include "scrnintstr.h"
14#include "gc.h"
15#include "mi.h"
16#include "pixmapstr.h"
17#include "windowstr.h"
18#include "regionstr.h"
19#include "servermd.h"
20#include "xf86str.h"
21#include "xaa.h"
22#include "xaacexp.h"
23#include "xaalocal.h"
24#include "xaawrap.h"
25
26#define MAX_COLOR 32
27#define MAX_MONO 32
28#define MAX_8 32
29#define MAX_128 32
30#define MAX_256 32
31#define MAX_512 16
32
33static int CacheInitIndex = -1;
34
35#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val)
36
37typedef struct _CacheLink {
38 int x;
39 int y;
40 int w;
41 int h;
42 struct _CacheLink *next;
43} CacheLink, *CacheLinkPtr;
44
45static void
46TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num)
47{
48 while (num--) {
49 array->x = list->x;
50 array->y = list->y;
51 array->w = list->w;
52 array->h = list->h;
53 array->serialNumber = 0;
54 array->fg = array->bg = -1;
55 list = list->next;
56 array++;
57 }
58}
59
60static CacheLinkPtr
61Enlist(CacheLinkPtr link, int x, int y, int w, int h)
62{
63 CacheLinkPtr newLink;
64
65 newLink = malloc(sizeof(CacheLink));
66 newLink->next = link;
67 newLink->x = x;
68 newLink->y = y;
69 newLink->w = w;
70 newLink->h = h;
71 return newLink;
72}
73
74static CacheLinkPtr
75Delist(CacheLinkPtr link)
76{
77 CacheLinkPtr ret = NULL;
78
79 if (link) {
80 ret = link->next;
81 free(link);
82 }
83 return ret;
84}
85
86static void
87FreeList(CacheLinkPtr link)
88{
89 CacheLinkPtr tmp;
90
91 while (link) {
92 tmp = link;
93 link = link->next;
94 free(tmp);
95 }
96}
97
98static CacheLinkPtr
99QuadLinks(CacheLinkPtr big, CacheLinkPtr little)
100{
101 /* CAUTION: This doesn't free big */
102 int w1, w2, h1, h2;
103
104 while (big) {
105 w1 = big->w >> 1;
106 w2 = big->w - w1;
107 h1 = big->h >> 1;
108 h2 = big->h - h1;
109
110 little = Enlist(little, big->x, big->y, w1, h1);
111 little = Enlist(little, big->x + w1, big->y, w2, h1);
112 little = Enlist(little, big->x, big->y + h1, w1, h2);
113 little = Enlist(little, big->x + w1, big->y + h1, w2, h2);
114
115 big = big->next;
116 }
117 return little;
118}
119
120static void
121SubdivideList(CacheLinkPtr * large, CacheLinkPtr * small)
122{
123 CacheLinkPtr big = *large;
124 CacheLinkPtr little = *small;
125 int size = big->w >> 1;
126
127 little = Enlist(little, big->x, big->y, size, size);
128 little = Enlist(little, big->x + size, big->y, size, size);
129 little = Enlist(little, big->x, big->y + size, size, size);
130 little = Enlist(little, big->x + size, big->y + size, size, size);
131 *small = little;
132 big = Delist(big);
133 *large = big;
134}
135
136static void
137FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
138{
139 if (!pPriv)
140 return;
141
142 free(pPriv->Info512);
143 free(pPriv->Info256);
144 free(pPriv->Info128);
145 free(pPriv->InfoColor);
146 free(pPriv->InfoMono);
147 free(pPriv->InfoPartial);
148
149 free(pPriv);
150}
151
152void
153XAAClosePixmapCache(ScreenPtr pScreen)
154{
155 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
156
157 if (infoRec->PixmapCachePrivate)
158 FreePixmapCachePrivate((XAAPixmapCachePrivatePtr) infoRec->
159 PixmapCachePrivate);
160
161 infoRec->PixmapCachePrivate = NULL;
162}
163
164static CacheLinkPtr
165ThinOutPartials(CacheLinkPtr ListPartial, int *num, int *maxw, int *maxh)
166{
167/* This guy's job is to get at least 4 big slots out of a list of fragments */
168
169 CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
170 int Num64, Num32, Num16, Num8, NumKeepers;
171 int w, h;
172
173 List64 = List32 = List16 = List8 = ListKeepers = NULL;
174 Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
175 w = h = 0;
176
177 /* We sort partials by how large a square tile they can cache.
178 If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile,
179 we free it. */
180
181 pCur = ListPartial;
182 while (pCur) {
183 next = pCur->next;
184 if ((pCur->w >= 64) && (pCur->h >= 64)) {
185 pCur->next = List64;
186 List64 = pCur;
187 Num64++;
188 }
189 else if ((pCur->w >= 32) && (pCur->h >= 32)) {
190 pCur->next = List32;
191 List32 = pCur;
192 Num32++;
193 }
194 else if ((pCur->w >= 16) && (pCur->h >= 16)) {
195 pCur->next = List16;
196 List16 = pCur;
197 Num16++;
198 }
199 else if ((pCur->w >= 8) && (pCur->h >= 8)) {
200 pCur->next = List8;
201 List8 = pCur;
202 Num8++;
203 }
204 else {
205 free(pCur);
206 }
207
208 pCur = next;
209 }
210
211 /* We save all the tiles from the largest bin that we can get
212 at least 4 of. If there are too few of a bigger slot, we
213 cut it in fourths to make smaller slots. */
214
215 if (Num64 >= 4) {
216 ListKeepers = List64;
217 List64 = NULL;
218 NumKeepers = Num64;
219 goto GOT_EM;
220 }
221 else if (Num64) {
222 List32 = QuadLinks(List64, List32);
223 Num32 += Num64 * 4;
224 Num64 = 0;
225 }
226
227 if (Num32 >= 4) {
228 ListKeepers = List32;
229 List32 = NULL;
230 NumKeepers = Num32;
231 goto GOT_EM;
232 }
233 else if (Num32) {
234 List16 = QuadLinks(List32, List16);
235 Num16 += Num32 * 4;
236 Num32 = 0;
237 }
238
239 if (Num16 >= 4) {
240 ListKeepers = List16;
241 List16 = NULL;
242 NumKeepers = Num16;
243 goto GOT_EM;
244 }
245 else if (Num16) {
246 List8 = QuadLinks(List16, List8);
247 Num8 += Num16 * 4;
248 Num16 = 0;
249 }
250
251 if (Num8 >= 4) {
252 ListKeepers = List8;
253 List8 = NULL;
254 NumKeepers = Num8;
255 goto GOT_EM;
256 }
257
258 GOT_EM:
259
260 /* Free the ones we aren't using */
261
262 if (List64)
263 FreeList(List64);
264 if (List32)
265 FreeList(List32);
266 if (List16)
267 FreeList(List16);
268 if (List8)
269 FreeList(List8);
270
271 /* Enlarge the slots if we can */
272
273 if (ListKeepers) {
274 CacheLinkPtr pLink = ListKeepers;
275
276 w = h = 128;
277
278 while (pLink) {
279 if (pLink->w < w)
280 w = pLink->w;
281 if (pLink->h < h)
282 h = pLink->h;
283 pLink = pLink->next;
284 }
285 }
286
287 *maxw = w;
288 *maxh = h;
289 *num = NumKeepers;
290 return ListKeepers;
291}
292
293static void
294ConvertColorToMono(CacheLinkPtr * ColorList,
295 int ColorW, int ColorH,
296 CacheLinkPtr * MonoList, int MonoW, int MonoH)
297{
298 int x, y, w;
299
300 x = (*ColorList)->x;
301 y = (*ColorList)->y;
302 *ColorList = Delist(*ColorList);
303
304 while (ColorH) {
305 ColorH -= MonoH;
306 for (w = 0; w <= (ColorW - MonoW); w += MonoW)
307 *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH);
308 }
309}
310
311static void
312ConvertAllPartialsTo8x8(int *NumMono, int *NumColor,
313 CacheLinkPtr ListPartial,
314 CacheLinkPtr * ListMono,
315 CacheLinkPtr * ListColor, XAAInfoRecPtr infoRec)
316{
317/* This guy extracts as many 8x8 slots as it can out of fragments */
318
319 int ColorH = infoRec->CacheHeightColor8x8Pattern;
320 int ColorW = infoRec->CacheWidthColor8x8Pattern;
321 int MonoH = infoRec->CacheHeightMono8x8Pattern;
322 int MonoW = infoRec->CacheWidthMono8x8Pattern;
323 int x, y, w, Height, Width;
324 Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
325 Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
326 CacheLinkPtr pLink = ListPartial;
327 CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
328
329 if (DoColor && DoMono) {
330 /* we assume color patterns take more space than color ones */
331 if (MonoH > ColorH)
332 ColorH = MonoH;
333 if (MonoW > ColorW)
334 ColorW = MonoW;
335 }
336
337 /* Break up the area into as many Color and Mono slots as we can */
338
339 while (pLink) {
340 Height = pLink->h;
341 Width = pLink->w;
342 x = pLink->x;
343 y = pLink->y;
344
345 if (DoColor) {
346 while (Height >= ColorH) {
347 Height -= ColorH;
348 for (w = 0; w <= (Width - ColorW); w += ColorW) {
349 ColorList =
350 Enlist(ColorList, x + w, y + Height, ColorW, ColorH);
351 (*NumColor)++;
352 }
353 }
354 }
355
356 if (DoMono && (Height >= MonoH)) {
357 while (Height >= MonoH) {
358 Height -= MonoH;
359 for (w = 0; w <= (Width - MonoW); w += MonoW) {
360 MonoList =
361 Enlist(MonoList, x + w, y + Height, MonoW, MonoH);
362 (*NumMono)++;
363 }
364 }
365 }
366
367 pLink = pLink->next;
368 }
369
370 *ListMono = MonoList;
371 *ListColor = ColorList;
372 FreeList(ListPartial);
373}
374
375static CacheLinkPtr
376ExtractOneThatFits(CacheLinkPtr * initList, int w, int h)
377{
378 CacheLinkPtr list = *initList;
379 CacheLinkPtr prev = NULL;
380
381 while (list) {
382 if ((list->w >= w) && (list->h >= h))
383 break;
384 prev = list;
385 list = list->next;
386 }
387
388 if (list) {
389 if (prev)
390 prev->next = list->next;
391 else
392 *initList = list->next;
393
394 list->next = NULL;
395 }
396
397 return list;
398}
399
400static CacheLinkPtr
401ConvertSomePartialsTo8x8(int *NumMono, int *NumColor, int *NumPartial,
402 CacheLinkPtr ListPartial,
403 CacheLinkPtr * ListMono,
404 CacheLinkPtr * ListColor,
405 int *maxw, int *maxh, XAAInfoRecPtr infoRec)
406{
407/* This guy tries to get 4 of each type of 8x8 slot requested out of
408 a list of fragments all while trying to retain some big fragments
409 for the cache blits */
410
411 int ColorH = infoRec->CacheHeightColor8x8Pattern;
412 int ColorW = infoRec->CacheWidthColor8x8Pattern;
413 int MonoH = infoRec->CacheHeightMono8x8Pattern;
414 int MonoW = infoRec->CacheWidthMono8x8Pattern;
415 Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
416 Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
417 CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
418 CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
419 int Num64, Num32, Num16, Num8, NumKeepers;
420 int w, h, Width, Height;
421 int MonosPerColor = 1;
422
423 if (DoColor && DoMono) {
424 /* we assume color patterns take more space than color ones */
425 if (MonoH > ColorH)
426 ColorH = MonoH;
427 if (MonoW > ColorW)
428 ColorW = MonoW;
429 MonosPerColor = (ColorH / MonoH) * (ColorW / MonoW);
430 }
431
432 List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList =
433 NULL;
434 Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
435 Width = Height = 0;
436
437 /* We sort partials by how large a square tile they can cache.
438 We make 8x8 patterns from the leftovers if we can. */
439
440 pCur = ListPartial;
441 while (pCur) {
442 next = pCur->next;
443 if ((pCur->w >= 64) && (pCur->h >= 64)) {
444 pCur->next = List64;
445 List64 = pCur;
446 Num64++;
447 }
448 else if ((pCur->w >= 32) && (pCur->h >= 32)) {
449 pCur->next = List32;
450 List32 = pCur;
451 Num32++;
452 }
453 else if ((pCur->w >= 16) && (pCur->h >= 16)) {
454 pCur->next = List16;
455 List16 = pCur;
456 Num16++;
457 }
458 else if ((pCur->w >= 8) && (pCur->h >= 8)) {
459 pCur->next = List8;
460 List8 = pCur;
461 Num8++;
462 }
463 else {
464 h = pCur->h;
465 if (DoColor && (pCur->w >= ColorW) && (h >= ColorH)) {
466 while (h >= ColorH) {
467 h -= ColorH;
468 for (w = 0; w <= (pCur->w - ColorW); w += ColorW) {
469 ColorList = Enlist(ColorList,
470 pCur->x + w, pCur->y + h, ColorW,
471 ColorH);
472 (*NumColor)++;
473 }
474 }
475 }
476 if (DoMono && (pCur->w >= MonoW) && (h >= MonoH)) {
477 while (h >= MonoH) {
478 h -= MonoH;
479 for (w = 0; w <= (pCur->w - MonoW); w += MonoW) {
480 MonoList = Enlist(MonoList,
481 pCur->x + w, pCur->y + h, MonoW,
482 MonoH);
483 (*NumMono)++;
484 }
485 }
486 }
487 free(pCur);
488 }
489
490 pCur = next;
491 }
492
493 /* Try to extract at least 4 of each type of 8x8 slot that we need */
494
495 if (DoColor) {
496 CacheLinkPtr theOne;
497
498 while (*NumColor < 4) {
499 theOne = NULL;
500 if (Num8) {
501 if ((theOne = ExtractOneThatFits(&List8, ColorW, ColorH)))
502 Num8--;
503 }
504 if (Num16 && !theOne) {
505 if ((theOne = ExtractOneThatFits(&List16, ColorW, ColorH)))
506 Num16--;
507 }
508 if (Num32 && !theOne) {
509 if ((theOne = ExtractOneThatFits(&List32, ColorW, ColorH)))
510 Num32--;
511 }
512 if (Num64 && !theOne) {
513 if ((theOne = ExtractOneThatFits(&List64, ColorW, ColorH)))
514 Num64--;
515 }
516
517 if (!theOne)
518 break;
519
520 ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
521 &MonoList, &ColorList, infoRec);
522
523 if (DoMono) {
524 while (*NumColor && (*NumMono < 4)) {
525 ConvertColorToMono(&ColorList, ColorW, ColorH,
526 &MonoList, MonoW, MonoH);
527 (*NumColor)--;
528 *NumMono += MonosPerColor;
529 }
530 }
531 }
532 }
533
534 if (DoMono) {
535 CacheLinkPtr theOne;
536
537 while (*NumMono < 4) {
538 theOne = NULL;
539 if (Num8) {
540 if ((theOne = ExtractOneThatFits(&List8, MonoW, MonoH)))
541 Num8--;
542 }
543 if (Num16 && !theOne) {
544 if ((theOne = ExtractOneThatFits(&List16, MonoW, MonoH)))
545 Num16--;
546 }
547 if (Num32 && !theOne) {
548 if ((theOne = ExtractOneThatFits(&List32, MonoW, MonoH)))
549 Num32--;
550 }
551 if (Num64 && !theOne) {
552 if ((theOne = ExtractOneThatFits(&List64, MonoW, MonoH)))
553 Num64--;
554 }
555
556 if (!theOne)
557 break;
558
559 ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
560 &MonoList, &ColorList, infoRec);
561 }
562 }
563
564 /* We save all the tiles from the largest bin that we can get
565 at least 4 of. If there are too few of a bigger slot, we
566 cut it in fourths to make smaller slots. */
567
568 if (Num64 >= 4) {
569 ListKeepers = List64;
570 List64 = NULL;
571 NumKeepers = Num64;
572 goto GOT_EM;
573 }
574 else if (Num64) {
575 List32 = QuadLinks(List64, List32);
576 Num32 += Num64 * 4;
577 Num64 = 0;
578 }
579
580 if (Num32 >= 4) {
581 ListKeepers = List32;
582 List32 = NULL;
583 NumKeepers = Num32;
584 goto GOT_EM;
585 }
586 else if (Num32) {
587 List16 = QuadLinks(List32, List16);
588 Num16 += Num32 * 4;
589 Num32 = 0;
590 }
591
592 if (Num16 >= 4) {
593 ListKeepers = List16;
594 List16 = NULL;
595 NumKeepers = Num16;
596 goto GOT_EM;
597 }
598 else if (Num16) {
599 List8 = QuadLinks(List16, List8);
600 Num8 += Num16 * 4;
601 Num16 = 0;
602 }
603
604 if (Num8 >= 4) {
605 ListKeepers = List8;
606 List8 = NULL;
607 NumKeepers = Num8;
608 goto GOT_EM;
609 }
610
611 GOT_EM:
612
613 /* Free the ones we aren't using */
614
615 if (List64)
616 ConvertAllPartialsTo8x8(NumMono, NumColor, List64,
617 &MonoList, &ColorList, infoRec);
618 if (List32)
619 ConvertAllPartialsTo8x8(NumMono, NumColor, List32,
620 &MonoList, &ColorList, infoRec);
621 if (List16)
622 ConvertAllPartialsTo8x8(NumMono, NumColor, List16,
623 &MonoList, &ColorList, infoRec);
624 if (List8)
625 ConvertAllPartialsTo8x8(NumMono, NumColor, List8,
626 &MonoList, &ColorList, infoRec);
627
628 /* Enlarge the slots if we can */
629
630 if (ListKeepers) {
631 CacheLinkPtr pLink = ListKeepers;
632
633 Width = Height = 128;
634
635 while (pLink) {
636 if (pLink->w < Width)
637 Width = pLink->w;
638 if (pLink->h < Height)
639 Height = pLink->h;
640 pLink = pLink->next;
641 }
642 }
643
644 *ListMono = MonoList;
645 *ListColor = ColorList;
646 *maxw = Width;
647 *maxh = Height;
648 *NumPartial = NumKeepers;
649 return ListKeepers;
650}
651
652void
653XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data)
654{
655 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
656 XAAInfoRecPtr infoRec = (XAAInfoRecPtr) data;
657 XAAPixmapCachePrivatePtr pCachePriv;
658 BoxPtr pBox = RegionRects(areas);
659 int nBox = RegionNumRects(areas);
660 int Num512, Num256, Num128, NumPartial, NumColor, NumMono;
661 int Target512, Target256;
662 CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono;
663 int x, y, w, h, ntotal, granularity, width, height, i;
664 int MaxPartialWidth, MaxPartialHeight;
665
666 infoRec->MaxCacheableTileWidth = 0;
667 infoRec->MaxCacheableTileHeight = 0;
668 infoRec->MaxCacheableStippleHeight = 0;
669 infoRec->MaxCacheableStippleWidth = 0;
670 infoRec->UsingPixmapCache = FALSE;
671
672 if (!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE))
673 return;
674
675 /* Allocate a persistent per-screen init flag to control messages */
676 if (CacheInitIndex < 0)
677 CacheInitIndex = xf86AllocateScrnInfoPrivateIndex();
678
679 /* free the old private data if it exists */
680 if (infoRec->PixmapCachePrivate) {
681 FreePixmapCachePrivate((XAAPixmapCachePrivatePtr) infoRec->
682 PixmapCachePrivate);
683 infoRec->PixmapCachePrivate = NULL;
684 }
685
686 Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0;
687 List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL;
688 granularity = infoRec->CachePixelGranularity;
689 if (granularity <= 1)
690 granularity = 0;
691
692 /* go through the boxes and break it into as many pieces as we can fit */
693
694 while (nBox--) {
695 x = pBox->x1;
696 if (granularity) {
697 int tmp = x % granularity;
698
699 if (tmp)
700 x += (granularity - tmp);
701 }
702 width = pBox->x2 - x;
703 if (width <= 0) {
704 pBox++;
705 continue;
706 }
707
708 y = pBox->y1;
709 height = pBox->y2 - y;
710
711 for (h = 0; h <= (height - 512); h += 512) {
712 for (w = 0; w <= (width - 512); w += 512) {
713 List512 = Enlist(List512, x + w, y + h, 512, 512);
714 Num512++;
715 }
716 for (; w <= (width - 256); w += 256) {
717 List256 = Enlist(List256, x + w, y + h, 256, 256);
718 List256 = Enlist(List256, x + w, y + h + 256, 256, 256);
719 Num256 += 2;
720 }
721 for (; w <= (width - 128); w += 128) {
722 List128 = Enlist(List128, x + w, y + h, 128, 128);
723 List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
724 List128 = Enlist(List128, x + w, y + h + 256, 128, 128);
725 List128 = Enlist(List128, x + w, y + h + 384, 128, 128);
726 Num128 += 4;
727 }
728 if (w < width) {
729 int d = width - w;
730
731 ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
732 ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
733 ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128);
734 ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128);
735 NumPartial += 4;
736 }
737 }
738 for (; h <= (height - 256); h += 256) {
739 for (w = 0; w <= (width - 256); w += 256) {
740 List256 = Enlist(List256, x + w, y + h, 256, 256);
741 Num256++;
742 }
743 for (; w <= (width - 128); w += 128) {
744 List128 = Enlist(List128, x + w, y + h, 128, 128);
745 List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
746 Num128 += 2;
747 }
748 if (w < width) {
749 int d = width - w;
750
751 ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
752 ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
753 NumPartial += 2;
754 }
755 }
756 for (; h <= (height - 128); h += 128) {
757 for (w = 0; w <= (width - 128); w += 128) {
758 List128 = Enlist(List128, x + w, y + h, 128, 128);
759 Num128++;
760 }
761 if (w < width) {
762 ListPartial = Enlist(ListPartial, x + w, y + h, width - w, 128);
763 NumPartial++;
764 }
765 }
766 if (h < height) {
767 int d = height - h;
768
769 for (w = 0; w <= (width - 128); w += 128) {
770 ListPartial = Enlist(ListPartial, x + w, y + h, 128, d);
771 NumPartial++;
772 }
773 if (w < width) {
774 ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d);
775 NumPartial++;
776 }
777 }
778 pBox++;
779 }
780
781/*
782 by this point we've carved the space into as many 512x512, 256x256
783 and 128x128 blocks as we could fit. We will then break larger
784 blocks into smaller ones if we need to. The rules are as follows:
785
786 512x512 -
787 1) Don't take up more than half the memory.
788 2) Don't bother if you can't get at least four.
789 3) Don't make more than MAX_512.
790 4) Don't have any of there are no 256x256s.
791
792 256x256 -
793 1) Don't take up more than a quarter of the memory enless there
794 aren't any 512x512s. Then we can take up to half.
795 2) Don't bother if you can't get at least four.
796 3) Don't make more than MAX_256.
797
798 128x128 -
799 1) Don't make more than MAX_128.
800
801 We don't bother with the partial blocks unless we can use them
802 for 8x8 pattern fills or we are short on larger blocks.
803
804*/
805
806 ntotal = Num128 + (Num256 << 2) + (Num512 << 4);
807
808 Target512 = ntotal >> 5;
809 if (Target512 < 4)
810 Target512 = 0;
811 if (!Target512)
812 Target256 = ntotal >> 3;
813 else
814 Target256 = ntotal >> 4;
815 if (Target256 < 4)
816 Target256 = 0;
817
818 if (Num512 && Num256 < 4) {
819 while (Num512 && Num256 < Target256) {
820 SubdivideList(&List512, &List256);
821 Num256 += 4;
822 Num512--;
823 }
824 }
825
826 if (!Num512) { /* no room */
827 }
828 else if ((Num512 < 4) || (!Target512)) {
829 while (Num512) {
830 SubdivideList(&List512, &List256);
831 Num256 += 4;
832 Num512--;
833 }
834 }
835 else if ((Num512 > MAX_512) || (Num512 > Target512)) {
836 while (Num512 > MAX_512) {
837 SubdivideList(&List512, &List256);
838 Num256 += 4;
839 Num512--;
840 }
841 while (Num512 > Target512) {
842 if (Num256 < MAX_256) {
843 SubdivideList(&List512, &List256);
844 Num256 += 4;
845 Num512--;
846 }
847 else
848 break;
849 }
850 }
851
852 if (!Num256) { /* no room */
853 }
854 else if ((Num256 < 4) || (!Target256)) {
855 while (Num256) {
856 SubdivideList(&List256, &List128);
857 Num128 += 4;
858 Num256--;
859 }
860 }
861 else if ((Num256 > MAX_256) || (Num256 > Target256)) {
862 while (Num256 > MAX_256) {
863 SubdivideList(&List256, &List128);
864 Num128 += 4;
865 Num256--;
866 }
867 while (Num256 > Target256) {
868 if (Num128 < MAX_128) {
869 SubdivideList(&List256, &List128);
870 Num128 += 4;
871 Num256--;
872 }
873 else
874 break;
875 }
876 }
877
878 if (Num128 && ((Num128 < 4) || (Num128 > MAX_128))) {
879 CacheLinkPtr next;
880 int max = (Num128 > MAX_128) ? MAX_128 : 0;
881
882 /*
883 * Note: next is set in this way to work around a code generation
884 * bug in gcc 2.7.2.3.
885 */
886 next = List128->next;
887 while (Num128 > max) {
888 List128->next = ListPartial;
889 ListPartial = List128;
890 if ((List128 = next))
891 next = List128->next;
892 NumPartial++;
893 Num128--;
894 }
895 }
896
897 MaxPartialHeight = MaxPartialWidth = 0;
898
899 /* at this point we have as many 512x512 and 256x256 slots as we
900 want but may have an excess of 128x128 slots. We still need
901 to find out if we need 8x8 slots. We take these from the
902 partials if we have them. Otherwise, we break some 128x128's */
903
904 if (!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) {
905 if (NumPartial) {
906 if (Num128) { /* don't bother with partials */
907 FreeList(ListPartial);
908 NumPartial = 0;
909 ListPartial = NULL;
910 }
911 else {
912 /* We have no big slots. Weed out the unusable partials */
913 ListPartial = ThinOutPartials(ListPartial, &NumPartial,
914 &MaxPartialWidth,
915 &MaxPartialHeight);
916 }
917 }
918 }
919 else {
920 int MonosPerColor = 1;
921 int ColorH = infoRec->CacheHeightColor8x8Pattern;
922 int ColorW = infoRec->CacheWidthColor8x8Pattern;
923 int MonoH = infoRec->CacheHeightMono8x8Pattern;
924 int MonoW = infoRec->CacheWidthMono8x8Pattern;
925 Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
926 Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
927
928 if (DoColor)
929 infoRec->CanDoColor8x8 = FALSE;
930 if (DoMono)
931 infoRec->CanDoMono8x8 = FALSE;
932
933 if (DoColor && DoMono) {
934 /* we assume color patterns take more space than color ones */
935 if (MonoH > ColorH)
936 ColorH = MonoH;
937 if (MonoW > ColorW)
938 ColorW = MonoW;
939 MonosPerColor = (ColorH / MonoH) * (ColorW / MonoW);
940 }
941
942 if (Num128) {
943 if (NumPartial) { /* use all for 8x8 slots */
944 ConvertAllPartialsTo8x8(&NumMono, &NumColor,
945 ListPartial, &ListMono, &ListColor,
946 infoRec);
947 NumPartial = 0;
948 ListPartial = NULL;
949 }
950
951 /* Get some 8x8 slots from the 128 slots */
952 while ((Num128 > 4) &&
953 ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) {
954 CacheLinkPtr tmp = NULL;
955
956 tmp = Enlist(tmp, List128->x, List128->y,
957 List128->w, List128->h);
958 List128 = Delist(List128);
959 Num128--;
960
961 ConvertAllPartialsTo8x8(&NumMono, &NumColor,
962 tmp, &ListMono, &ListColor, infoRec);
963 }
964 }
965 else if (NumPartial) {
966 /* We have share partials between 8x8 slots and tiles. */
967 ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor,
968 &NumPartial, ListPartial,
969 &ListMono, &ListColor,
970 &MaxPartialWidth,
971 &MaxPartialHeight, infoRec);
972 }
973
974 if (DoMono && DoColor) {
975 if (NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
976 int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
977
978 while (NumColor > max) {
979 ConvertColorToMono(&ListColor, ColorW, ColorH,
980 &ListMono, MonoW, MonoH);
981 NumColor--;
982 NumMono += MonosPerColor;
983 }
984 }
985
986 /* favor Mono slots over Color ones */
987 while ((NumColor > 4) && (NumMono < MAX_MONO)) {
988 ConvertColorToMono(&ListColor, ColorW, ColorH,
989 &ListMono, MonoW, MonoH);
990 NumColor--;
991 NumMono += MonosPerColor;
992 }
993 }
994
995 if (NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) {
996 int max = (NumMono > MAX_MONO) ? MAX_MONO : 0;
997
998 while (NumMono > max) {
999 ListMono = Delist(ListMono);
1000 NumMono--;
1001 }
1002 }
1003 if (NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
1004 int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
1005
1006 while (NumColor > max) {
1007 ListColor = Delist(ListColor);
1008 NumColor--;
1009 }
1010 }
1011 }
1012
1013 pCachePriv = calloc(1, sizeof(XAAPixmapCachePrivate));
1014 if (!pCachePriv) {
1015 if (Num512)
1016 FreeList(List512);
1017 if (Num256)
1018 FreeList(List256);
1019 if (Num128)
1020 FreeList(List128);
1021 if (NumPartial)
1022 FreeList(ListPartial);
1023 if (NumColor)
1024 FreeList(ListColor);
1025 if (NumMono)
1026 FreeList(ListMono);
1027 return;
1028 }
1029
1030 infoRec->PixmapCachePrivate = (char *) pCachePriv;
1031
1032 if (Num512) {
1033 pCachePriv->Info512 = calloc(Num512, sizeof(XAACacheInfoRec));
1034 if (!pCachePriv->Info512)
1035 Num512 = 0;
1036 if (Num512)
1037 TransferList(List512, pCachePriv->Info512, Num512);
1038 FreeList(List512);
1039 pCachePriv->Num512x512 = Num512;
1040 }
1041 if (Num256) {
1042 pCachePriv->Info256 = calloc(Num256, sizeof(XAACacheInfoRec));
1043 if (!pCachePriv->Info256)
1044 Num256 = 0;
1045 if (Num256)
1046 TransferList(List256, pCachePriv->Info256, Num256);
1047 FreeList(List256);
1048 pCachePriv->Num256x256 = Num256;
1049 }
1050 if (Num128) {
1051 pCachePriv->Info128 = calloc(Num128, sizeof(XAACacheInfoRec));
1052 if (!pCachePriv->Info128)
1053 Num128 = 0;
1054 if (Num128)
1055 TransferList(List128, pCachePriv->Info128, Num128);
1056 FreeList(List128);
1057 pCachePriv->Num128x128 = Num128;
1058 }
1059
1060 if (NumPartial) {
1061 pCachePriv->InfoPartial = calloc(NumPartial, sizeof(XAACacheInfoRec));
1062 if (!pCachePriv->InfoPartial)
1063 NumPartial = 0;
1064 if (NumPartial)
1065 TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
1066 FreeList(ListPartial);
1067 pCachePriv->NumPartial = NumPartial;
1068 }
1069
1070 if (NumColor) {
1071 pCachePriv->InfoColor = calloc(NumColor, sizeof(XAACacheInfoRec));
1072 if (!pCachePriv->InfoColor)
1073 NumColor = 0;
1074 if (NumColor)
1075 TransferList(ListColor, pCachePriv->InfoColor, NumColor);
1076 FreeList(ListColor);
1077 pCachePriv->NumColor = NumColor;
1078 }
1079
1080 if (NumMono) {
1081 pCachePriv->InfoMono = calloc(NumMono, sizeof(XAACacheInfoRec));
1082 if (!pCachePriv->InfoMono)
1083 NumMono = 0;
1084 if (NumMono)
1085 TransferList(ListMono, pCachePriv->InfoMono, NumMono);
1086 FreeList(ListMono);
1087 pCachePriv->NumMono = NumMono;
1088 }
1089
1090 if (NumPartial) {
1091 infoRec->MaxCacheableTileWidth = MaxPartialWidth;
1092 infoRec->MaxCacheableTileHeight = MaxPartialHeight;
1093 }
1094 if (Num128)
1095 infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128;
1096 if (Num256)
1097 infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256;
1098 if (Num512)
1099 infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512;
1100
1101 infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight;
1102 infoRec->MaxCacheableStippleWidth =
1103 infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel;
1104 if (infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP)
1105 infoRec->MaxCacheableStippleWidth /= 3;
1106
1107 if (NumMono) {
1108 if (!(infoRec->Mono8x8PatternFillFlags &
1109 (HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
1110 HARDWARE_PATTERN_PROGRAMMED_BITS))) {
1111 int numPerLine =
1112 infoRec->CacheWidthMono8x8Pattern / infoRec->MonoPatternPitch;
1113
1114 for (i = 0; i < 64; i++) {
1115 pCachePriv->MonoOffsets[i].y = i / numPerLine;
1116 pCachePriv->MonoOffsets[i].x = (i % numPerLine) *
1117 infoRec->MonoPatternPitch;
1118 }
1119 }
1120 infoRec->CanDoMono8x8 = TRUE;
1121 }
1122 if (NumColor) {
1123 if (!(infoRec->Color8x8PatternFillFlags &
1124 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
1125
1126 for (i = 0; i < 64; i++) {
1127 pCachePriv->ColorOffsets[i].y = i & 0x07;
1128 pCachePriv->ColorOffsets[i].x = i & ~0x07;
1129 }
1130 }
1131 infoRec->CanDoColor8x8 = TRUE;
1132 }
1133
1134 if (!CACHEINIT(pScrn)) {
1135 xf86ErrorF("\tSetting up tile and stipple cache:\n");
1136 if (NumPartial)
1137 xf86ErrorF("\t\t%i %ix%i slots\n",
1138 NumPartial, MaxPartialWidth, MaxPartialHeight);
1139 if (Num128)
1140 xf86ErrorF("\t\t%i 128x128 slots\n", Num128);
1141 if (Num256)
1142 xf86ErrorF("\t\t%i 256x256 slots\n", Num256);
1143 if (Num512)
1144 xf86ErrorF("\t\t%i 512x512 slots\n", Num512);
1145 if (NumColor)
1146 xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor);
1147 if (NumMono)
1148 xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono);
1149 }
1150
1151 if (!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) {
1152 if (!CACHEINIT(pScrn))
1153 xf86ErrorF("\t\tNot enough video memory for pixmap cache\n");
1154 }
1155 else
1156 infoRec->UsingPixmapCache = TRUE;
1157
1158 CACHEINIT(pScrn) = 1;
1159}
1160
1161#if X_BYTE_ORDER == X_BIG_ENDIAN
1162static CARD32 StippleMasks[4] = {
1163 0x80808080,
1164 0xC0C0C0C0,
1165 0x00000000,
1166 0xF0F0F0F0
1167};
1168#else
1169static CARD32 StippleMasks[4] = {
1170 0x01010101,
1171 0x03030303,
1172 0x00000000,
1173 0x0F0F0F0F
1174};
1175#endif
1176
1177Bool
1178XAACheckStippleReducibility(PixmapPtr pPixmap)
1179{
1180 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
1181 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
1182 CARD32 *IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
1183 int w = pPixmap->drawable.width;
1184 int h = pPixmap->drawable.height;
1185 int i;
1186 CARD32 bits[8];
1187 CARD32 mask = SHIFT_R(0xFFFFFFFF, 24);
1188
1189 pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR;
1190 pPriv->flags &= ~REDUCIBLE_TO_8x8;
1191
1192 if ((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
1193 return FALSE;
1194
1195 i = (h > 8) ? 8 : h;
1196
1197 switch (w) {
1198 case 32:
1199 while (i--) {
1200 bits[i] = IntPtr[i] & mask;
1201 if ((bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) ||
1202 (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 16)), 16)) ||
1203 (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 24)), 24)))
1204 return FALSE;
1205 }
1206 break;
1207 case 16:
1208 while (i--) {
1209 bits[i] = IntPtr[i] & mask;
1210 if (bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask, 8), 8))))
1211 return FALSE;
1212 }
1213 break;
1214 default:
1215 while (i--)
1216 bits[i] = IntPtr[i] & mask;
1217 break;
1218 }
1219
1220 switch (h) {
1221 case 32:
1222 if ((IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) ||
1223 (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) ||
1224 (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) ||
1225 (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) ||
1226 (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) ||
1227 (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) ||
1228 (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) ||
1229 (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31]))
1230 return FALSE;
1231 /* fall through */
1232 case 16:
1233 if ((IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) ||
1234 (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) ||
1235 (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) ||
1236 (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15]))
1237 return FALSE;
1238 case 8:
1239 break;
1240 case 1:
1241 bits[1] = bits[0];
1242 case 2:
1243 bits[2] = bits[0];
1244 bits[3] = bits[1];
1245 case 4:
1246 bits[4] = bits[0];
1247 bits[5] = bits[1];
1248 bits[6] = bits[2];
1249 bits[7] = bits[3];
1250 break;
1251 }
1252
1253 pPriv->flags |= REDUCIBLE_TO_8x8;
1254
1255 pPriv->pattern0 =
1256 bits[0] | SHIFT_L(bits[1], 8) | SHIFT_L(bits[2], 16) | SHIFT_L(bits[3],
1257 24);
1258 pPriv->pattern1 =
1259 bits[4] | SHIFT_L(bits[5], 8) | SHIFT_L(bits[6], 16) | SHIFT_L(bits[7],
1260 24);
1261
1262 if (w < 8) {
1263 pPriv->pattern0 &= StippleMasks[w - 1];
1264 pPriv->pattern1 &= StippleMasks[w - 1];
1265
1266 switch (w) {
1267 case 1:
1268 pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 1);
1269 pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 1);
1270 case 2:
1271 pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 2);
1272 pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 2);
1273 case 4:
1274 pPriv->pattern0 |= SHIFT_L(pPriv->pattern0, 4);
1275 pPriv->pattern1 |= SHIFT_L(pPriv->pattern1, 4);
1276 }
1277 }
1278
1279 if (infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
1280 pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
1281 pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
1282 }
1283
1284 return TRUE;
1285}
1286
1287Bool
1288XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono)
1289{
1290 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
1291 CARD32 *IntPtr;
1292 int w = pPixmap->drawable.width;
1293 int h = pPixmap->drawable.height;
1294 int pitch = pPixmap->devKind >> 2;
1295 int dwords, i, j;
1296
1297 pPriv->flags |= REDUCIBILITY_CHECKED;
1298 pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR);
1299
1300 if ((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
1301 return FALSE;
1302
1303 dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5;
1304 i = (h > 8) ? 8 : h;
1305
1306 if (w > 8) {
1307 IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
1308 switch (pPixmap->drawable.bitsPerPixel) {
1309 case 8:
1310 while (i--) {
1311 for (j = 2; j < dwords; j++)
1312 if (IntPtr[j] != IntPtr[j & 0x01])
1313 return FALSE;
1314 IntPtr += pitch;
1315 }
1316 break;
1317 case 16:
1318 while (i--) {
1319 for (j = 4; j < dwords; j++)
1320 if (IntPtr[j] != IntPtr[j & 0x03])
1321 return FALSE;
1322 IntPtr += pitch;
1323 }
1324 break;
1325 case 24:
1326 while (i--) {
1327 for (j = 6; j < dwords; j++)
1328 if (IntPtr[j] != IntPtr[j % 6])
1329 return FALSE;
1330 IntPtr += pitch;
1331 }
1332 break;
1333 case 32:
1334 while (i--) {
1335 for (j = 8; j < dwords; j++)
1336 if (IntPtr[j] != IntPtr[j & 0x07])
1337 return FALSE;
1338 IntPtr += pitch;
1339 }
1340 break;
1341 default:
1342 return FALSE;
1343 }
1344
1345 }
1346
1347 if (h == 32) {
1348 CARD32 *IntPtr2, *IntPtr3, *IntPtr4;
1349
1350 i = 8;
1351 IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
1352 IntPtr2 = IntPtr + (pitch << 3);
1353 IntPtr3 = IntPtr2 + (pitch << 3);
1354 IntPtr4 = IntPtr3 + (pitch << 3);
1355 while (i--) {
1356 for (j = 0; j < dwords; j++)
1357 if ((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) ||
1358 (IntPtr[j] != IntPtr4[j]))
1359 return FALSE;
1360 IntPtr += pitch;
1361 IntPtr2 += pitch;
1362 IntPtr3 += pitch;
1363 IntPtr4 += pitch;
1364 }
1365 }
1366 else if (h == 16) {
1367 CARD32 *IntPtr2;
1368
1369 i = 8;
1370 IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
1371 IntPtr2 = IntPtr + (pitch << 3);
1372 while (i--) {
1373 for (j = 0; j < dwords; j++)
1374 if (IntPtr[j] != IntPtr2[j])
1375 return FALSE;
1376 IntPtr += pitch;
1377 IntPtr2 += pitch;
1378 }
1379 }
1380
1381 pPriv->flags |= REDUCIBLE_TO_8x8;
1382
1383 if (checkMono) {
1384 XAAInfoRecPtr infoRec =
1385 GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
1386 unsigned char bits[8];
1387 int fg, bg = -1, x, y;
1388
1389 i = (h > 8) ? 8 : h;
1390 j = (w > 8) ? 8 : w;
1391
1392 if (pPixmap->drawable.bitsPerPixel == 8) {
1393 unsigned char *srcp = pPixmap->devPrivate.ptr;
1394
1395 fg = srcp[0];
1396 pitch = pPixmap->devKind;
1397 for (y = 0; y < i; y++) {
1398 bits[y] = 0;
1399 for (x = 0; x < j; x++) {
1400 if (srcp[x] != fg) {
1401 if (bg == -1)
1402 bg = srcp[x];
1403 else if (bg != srcp[x])
1404 return TRUE;
1405 }
1406 else
1407 bits[y] |= 1 << x;
1408 }
1409 srcp += pitch;
1410 }
1411 }
1412 else if (pPixmap->drawable.bitsPerPixel == 16) {
1413 unsigned short *srcp = (unsigned short *) pPixmap->devPrivate.ptr;
1414
1415 fg = srcp[0];
1416 pitch = pPixmap->devKind >> 1;
1417 for (y = 0; y < i; y++) {
1418 bits[y] = 0;
1419 for (x = 0; x < j; x++) {
1420 if (srcp[x] != fg) {
1421 if (bg == -1)
1422 bg = srcp[x];
1423 else if (bg != srcp[x])
1424 return TRUE;
1425 }
1426 else
1427 bits[y] |= 1 << x;
1428 }
1429 srcp += pitch;
1430 }
1431 }
1432 else if (pPixmap->drawable.bitsPerPixel == 24) {
1433 CARD32 val;
1434 unsigned char *srcp = pPixmap->devPrivate.ptr;
1435
1436 fg = *((CARD32 *) srcp) & 0x00FFFFFF;
1437 pitch = pPixmap->devKind;
1438 j *= 3;
1439 for (y = 0; y < i; y++) {
1440 bits[y] = 0;
1441 for (x = 0; x < j; x += 3) {
1442 val = *((CARD32 *) (srcp + x)) & 0x00FFFFFF;
1443 if (val != fg) {
1444 if (bg == -1)
1445 bg = val;
1446 else if (bg != val)
1447 return TRUE;
1448 }
1449 else
1450 bits[y] |= 1 << (x / 3);
1451 }
1452 srcp += pitch;
1453 }
1454 }
1455 else if (pPixmap->drawable.bitsPerPixel == 32) {
1456 IntPtr = (CARD32 *) pPixmap->devPrivate.ptr;
1457 fg = IntPtr[0];
1458 for (y = 0; y < i; y++) {
1459 bits[y] = 0;
1460 for (x = 0; x < j; x++) {
1461 if (IntPtr[x] != fg) {
1462 if (bg == -1)
1463 bg = IntPtr[x];
1464 else if (bg != IntPtr[x])
1465 return TRUE;
1466 }
1467 else
1468 bits[y] |= 1 << x;
1469 }
1470 IntPtr += pitch;
1471 }
1472 }
1473 else
1474 return TRUE;
1475
1476 pPriv->fg = fg;
1477 if (bg == -1)
1478 pPriv->bg = fg;
1479 else
1480 pPriv->bg = bg;
1481
1482 if (h < 8) {
1483 switch (h) {
1484 case 1:
1485 bits[1] = bits[0];
1486 case 2:
1487 bits[2] = bits[0];
1488 bits[3] = bits[1];
1489 case 4:
1490 bits[4] = bits[0];
1491 bits[5] = bits[1];
1492 bits[6] = bits[2];
1493 bits[7] = bits[3];
1494 break;
1495 }
1496 }
1497
1498 pPriv->pattern0 =
1499 bits[0] | (bits[1] << 8) | (bits[2] << 16) | (bits[3] << 24);
1500 pPriv->pattern1 =
1501 bits[4] | (bits[5] << 8) | (bits[6] << 16) | (bits[7] << 24);
1502
1503 if (w < 8) {
1504 switch (w) {
1505 case 1:
1506 pPriv->pattern0 |= (pPriv->pattern0 << 1);
1507 pPriv->pattern1 |= (pPriv->pattern1 << 1);
1508 case 2:
1509 pPriv->pattern0 |= (pPriv->pattern0 << 2);
1510 pPriv->pattern1 |= (pPriv->pattern1 << 2);
1511 case 4:
1512 pPriv->pattern0 |= (pPriv->pattern0 << 4);
1513 pPriv->pattern1 |= (pPriv->pattern1 << 4);
1514 }
1515 }
1516 pPriv->flags |= REDUCIBLE_TO_2_COLOR;
1517
1518 if (infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
1519 pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
1520 pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
1521 }
1522
1523 }
1524
1525 return TRUE;
1526}
1527
1528void
1529XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h)
1530{
1531 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1532
1533 (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, GXcopy, ~0, -1);
1534
1535 while ((w << 1) <= pCache->w) {
1536 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
1537 pCache->x + w, pCache->y, w,
1538 h);
1539 w <<= 1;
1540 }
1541 if (w != pCache->w) {
1542 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
1543 pCache->x + w, pCache->y,
1544 pCache->w - w, h);
1545 w = pCache->w;
1546 }
1547
1548 while ((h << 1) <= pCache->h) {
1549 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
1550 pCache->x, pCache->y + h, w,
1551 h);
1552 h <<= 1;
1553 }
1554 if (h != pCache->h) {
1555 (*infoRec->SubsequentScreenToScreenCopy) (pScrn, pCache->x, pCache->y,
1556 pCache->x, pCache->y + h, w,
1557 pCache->h - h);
1558 }
1559 SET_SYNC_FLAG(infoRec);
1560}
1561
1562XAACacheInfoPtr
1563XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
1564{
1565 int w = pPix->drawable.width;
1566 int h = pPix->drawable.height;
1567 int size = max(w, h);
1568 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1569 XAAPixmapCachePrivatePtr pCachePriv =
1570 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
1571 XAACacheInfoPtr pCache, cacheRoot = NULL;
1572 int i, max = 0;
1573 int *current;
1574
1575 if (size <= 128) {
1576 if (pCachePriv->Info128) {
1577 cacheRoot = pCachePriv->Info128;
1578 max = pCachePriv->Num128x128;
1579 current = &pCachePriv->Current128;
1580 }
1581 else {
1582 cacheRoot = pCachePriv->InfoPartial;
1583 max = pCachePriv->NumPartial;
1584 current = &pCachePriv->CurrentPartial;
1585 }
1586 }
1587 else if (size <= 256) {
1588 cacheRoot = pCachePriv->Info256;
1589 max = pCachePriv->Num256x256;
1590 current = &pCachePriv->Current256;
1591 }
1592 else if (size <= 512) {
1593 cacheRoot = pCachePriv->Info512;
1594 max = pCachePriv->Num512x512;
1595 current = &pCachePriv->Current512;
1596 }
1597 else { /* something's wrong */
1598 ErrorF("Something's wrong in XAACacheTile()\n");
1599 return pCachePriv->Info128;
1600 }
1601
1602 pCache = cacheRoot;
1603
1604 /* lets look for it */
1605 for (i = 0; i < max; i++, pCache++) {
1606 if (pCache->serialNumber == pPix->drawable.serialNumber) {
1607 pCache->trans_color = -1;
1608 return pCache;
1609 }
1610 }
1611
1612 pCache = &cacheRoot[(*current)++];
1613 if (*current >= max)
1614 *current = 0;
1615
1616 pCache->serialNumber = pPix->drawable.serialNumber;
1617 pCache->trans_color = pCache->bg = pCache->fg = -1;
1618 pCache->orig_w = w;
1619 pCache->orig_h = h;
1620 (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, w, h,
1621 pPix->devPrivate.ptr, pPix->devKind,
1622 pPix->drawable.bitsPerPixel,
1623 pPix->drawable.depth);
1624 if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
1625 ((w != pCache->w) || (h != pCache->h)))
1626 XAATileCache(pScrn, pCache, w, h);
1627
1628 return pCache;
1629}
1630
1631XAACacheInfoPtr
1632XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
1633{
1634 int w = pPix->drawable.width;
1635 int h = pPix->drawable.height;
1636 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1637 XAAPixmapCachePrivatePtr pCachePriv =
1638 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
1639 XAACacheInfoPtr pCache, cacheRoot = NULL;
1640 int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel;
1641 int *current;
1642 StippleScanlineProcPtr StippleFunc;
1643 unsigned char *data, *srcPtr, *dstPtr;
1644
1645 if ((h <= 128) && (w <= 128 * bpp)) {
1646 if (pCachePriv->Info128) {
1647 cacheRoot = pCachePriv->Info128;
1648 max = pCachePriv->Num128x128;
1649 current = &pCachePriv->Current128;
1650 }
1651 else {
1652 cacheRoot = pCachePriv->InfoPartial;
1653 max = pCachePriv->NumPartial;
1654 current = &pCachePriv->CurrentPartial;
1655 }
1656 }
1657 else if ((h <= 256) && (w <= 256 * bpp)) {
1658 cacheRoot = pCachePriv->Info256;
1659 max = pCachePriv->Num256x256;
1660 current = &pCachePriv->Current256;
1661 }
1662 else if ((h <= 512) && (w <= 526 * bpp)) {
1663 cacheRoot = pCachePriv->Info512;
1664 max = pCachePriv->Num512x512;
1665 current = &pCachePriv->Current512;
1666 }
1667 else { /* something's wrong */
1668 ErrorF("Something's wrong in XAACacheMonoStipple()\n");
1669 return pCachePriv->Info128;
1670 }
1671
1672 pCache = cacheRoot;
1673
1674 /* lets look for it */
1675 for (i = 0; i < max; i++, pCache++) {
1676 if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
1677 (pCache->fg == -1) && (pCache->bg == -1)) {
1678 pCache->trans_color = -1;
1679 return pCache;
1680 }
1681 }
1682
1683 pCache = &cacheRoot[(*current)++];
1684 if (*current >= max)
1685 *current = 0;
1686
1687 pCache->serialNumber = pPix->drawable.serialNumber;
1688 pCache->trans_color = pCache->bg = pCache->fg = -1;
1689 pCache->orig_w = w;
1690 pCache->orig_h = h;
1691
1692 if (w <= 32) {
1693 if (w & (w - 1))
1694 funcNo = 1;
1695 else
1696 funcNo = 0;
1697 }
1698 else
1699 funcNo = 2;
1700
1701 pad = BitmapBytePad(pCache->w * bpp);
1702 dwords = bytes_to_int32(pad);
1703 dstPtr = data = (unsigned char *) malloc(pad * pCache->h);
1704 srcPtr = (unsigned char *) pPix->devPrivate.ptr;
1705
1706 if (infoRec->
1707 ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
1708 StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo];
1709 else
1710 StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo];
1711
1712 /* don't bother generating more than we'll ever use */
1713 max = ((pScrn->displayWidth + w - 1) + 31) >> 5;
1714 if (dwords > max)
1715 dwords = max;
1716
1717 for (i = 0; i < h; i++) {
1718 (*StippleFunc) ((CARD32 *) dstPtr, (CARD32 *) srcPtr, 0, w, dwords);
1719 srcPtr += pPix->devKind;
1720 dstPtr += pad;
1721 }
1722
1723 while ((h << 1) <= pCache->h) {
1724 memcpy(data + (pad * h), data, pad * h);
1725 h <<= 1;
1726 }
1727
1728 if (h < pCache->h)
1729 memcpy(data + (pad * h), data, pad * (pCache->h - h));
1730
1731 (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y, pCache->w,
1732 pCache->h, data, pad, bpp, pScrn->depth);
1733
1734 free(data);
1735
1736 return pCache;
1737}
1738
1739XAACacheInfoPtr
1740XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
1741{
1742 int w = pPix->drawable.width;
1743 int h = pPix->drawable.height;
1744 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1745 XAAPixmapCachePrivatePtr pCachePriv =
1746 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
1747 XAACacheInfoPtr pCache, cacheRoot = NULL;
1748 int i, max = 0;
1749 int *current;
1750
1751 if ((h <= 128) && (w <= 128)) {
1752 if (pCachePriv->Info128) {
1753 cacheRoot = pCachePriv->Info128;
1754 max = pCachePriv->Num128x128;
1755 current = &pCachePriv->Current128;
1756 }
1757 else {
1758 cacheRoot = pCachePriv->InfoPartial;
1759 max = pCachePriv->NumPartial;
1760 current = &pCachePriv->CurrentPartial;
1761 }
1762 }
1763 else if ((h <= 256) && (w <= 256)) {
1764 cacheRoot = pCachePriv->Info256;
1765 max = pCachePriv->Num256x256;
1766 current = &pCachePriv->Current256;
1767 }
1768 else if ((h <= 512) && (w <= 526)) {
1769 cacheRoot = pCachePriv->Info512;
1770 max = pCachePriv->Num512x512;
1771 current = &pCachePriv->Current512;
1772 }
1773 else { /* something's wrong */
1774 ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n");
1775 return pCachePriv->Info128;
1776 }
1777
1778 pCache = cacheRoot;
1779
1780 /* lets look for it */
1781 for (i = 0; i < max; i++, pCache++) {
1782 if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
1783 (pCache->fg == -1) && (pCache->bg == -1)) {
1784 pCache->trans_color = -1;
1785 return pCache;
1786 }
1787 }
1788
1789 pCache = &cacheRoot[(*current)++];
1790 if (*current >= max)
1791 *current = 0;
1792
1793 pCache->serialNumber = pPix->drawable.serialNumber;
1794 pCache->trans_color = pCache->bg = pCache->fg = -1;
1795 pCache->orig_w = w;
1796 pCache->orig_h = h;
1797
1798 /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */
1799 (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y,
1800 pPix->drawable.width, pPix->drawable.height,
1801 pPix->devPrivate.ptr, pPix->devKind, 1, 2);
1802 if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) &&
1803 ((w != pCache->w) || (h != pCache->h)))
1804 XAATileCache(pScrn, pCache, w, h);
1805
1806 return pCache;
1807}
1808
1809XAACachePlanarMonoStippleProc
1810XAAGetCachePlanarMonoStipple(void)
1811{
1812 return XAACachePlanarMonoStipple;
1813}
1814
1815XAACacheInfoPtr
1816XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
1817{
1818 int w = pPix->drawable.width;
1819 int h = pPix->drawable.height;
1820 int size = max(w, h);
1821 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1822 XAAPixmapCachePrivatePtr pCachePriv =
1823 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
1824 XAACacheInfoPtr pCache, cacheRoot = NULL;
1825 int i, max = 0;
1826 int *current;
1827
1828 if (size <= 128) {
1829 if (pCachePriv->Info128) {
1830 cacheRoot = pCachePriv->Info128;
1831 max = pCachePriv->Num128x128;
1832 current = &pCachePriv->Current128;
1833 }
1834 else {
1835 cacheRoot = pCachePriv->InfoPartial;
1836 max = pCachePriv->NumPartial;
1837 current = &pCachePriv->CurrentPartial;
1838 }
1839 }
1840 else if (size <= 256) {
1841 cacheRoot = pCachePriv->Info256;
1842 max = pCachePriv->Num256x256;
1843 current = &pCachePriv->Current256;
1844 }
1845 else if (size <= 512) {
1846 cacheRoot = pCachePriv->Info512;
1847 max = pCachePriv->Num512x512;
1848 current = &pCachePriv->Current512;
1849 }
1850 else { /* something's wrong */
1851 ErrorF("Something's wrong in XAACacheStipple()\n");
1852 return pCachePriv->Info128;
1853 }
1854
1855 pCache = cacheRoot;
1856 /* lets look for it */
1857 if (bg == -1)
1858 for (i = 0; i < max; i++, pCache++) {
1859 if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
1860 (fg == pCache->fg) && (pCache->fg != pCache->bg)) {
1861 pCache->trans_color = pCache->bg;
1862 return pCache;
1863 }
1864 }
1865 else
1866 for (i = 0; i < max; i++, pCache++) {
1867 if ((pCache->serialNumber == pPix->drawable.serialNumber) &&
1868 (fg == pCache->fg) && (bg == pCache->bg)) {
1869 pCache->trans_color = -1;
1870 return pCache;
1871 }
1872 }
1873
1874 pCache = &cacheRoot[(*current)++];
1875 if (*current >= max)
1876 *current = 0;
1877
1878 pCache->serialNumber = pPix->drawable.serialNumber;
1879 pCache->fg = fg;
1880 if (bg == -1)
1881 pCache->trans_color = bg = fg ^ 1;
1882 else
1883 pCache->trans_color = -1;
1884 pCache->bg = bg;
1885
1886 pCache->orig_w = w;
1887 pCache->orig_h = h;
1888 (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y,
1889 pPix->drawable.width, pPix->drawable.height,
1890 pPix->devPrivate.ptr, pPix->devKind, fg,
1891 bg);
1892 if (!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
1893 ((w != pCache->w) || (h != pCache->h)))
1894 XAATileCache(pScrn, pCache, w, h);
1895
1896 return pCache;
1897}
1898
1899XAACacheInfoPtr
1900XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
1901{
1902 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1903 XAAPixmapCachePrivatePtr pCachePriv =
1904 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
1905 XAACacheInfoPtr pCache = pCachePriv->InfoMono;
1906 int i;
1907
1908 for (i = 0; i < pCachePriv->NumMono; i++, pCache++) {
1909 if (pCache->serialNumber &&
1910 (pCache->pat0 == pat0) && (pCache->pat1 == pat1))
1911 return pCache;
1912 }
1913
1914 /* OK, let's cache it */
1915 pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++];
1916 if (pCachePriv->CurrentMono >= pCachePriv->NumMono)
1917 pCachePriv->CurrentMono = 0;
1918
1919 pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */
1920 pCache->pat0 = pat0;
1921 pCache->pat1 = pat1;
1922
1923 (*infoRec->WriteMono8x8PatternToCache) (pScrn, pCache);
1924
1925 return pCache;
1926}
1927
1928XAACacheInfoPtr
1929XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
1930{
1931 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
1932 XAAPixmapCachePrivatePtr pCachePriv =
1933 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
1934 XAACacheInfoPtr pCache = pCachePriv->InfoColor;
1935 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
1936 int i;
1937
1938 if (!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) {
1939 for (i = 0; i < pCachePriv->NumColor; i++, pCache++) {
1940 if (pCache->serialNumber == pPix->drawable.serialNumber) {
1941 pCache->trans_color = -1;
1942 return pCache;
1943 }
1944 }
1945 pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
1946 if (pCachePriv->CurrentColor >= pCachePriv->NumColor)
1947 pCachePriv->CurrentColor = 0;
1948
1949 pCache->serialNumber = pPix->drawable.serialNumber;
1950 pCache->trans_color = pCache->fg = pCache->bg = -1;
1951 }
1952 else {
1953 int pat0 = pixPriv->pattern0;
1954 int pat1 = pixPriv->pattern1;
1955
1956 if (fg == -1) { /* it's a tile */
1957 fg = pixPriv->fg;
1958 bg = pixPriv->bg;
1959 }
1960
1961 if (bg == -1) { /* stipple */
1962 for (i = 0; i < pCachePriv->NumColor; i++, pCache++) {
1963 if (pCache->serialNumber &&
1964 (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
1965 (pCache->fg == fg) && (pCache->bg != fg)) {
1966 pCache->trans_color = pCache->bg;
1967 return pCache;
1968 }
1969 }
1970 }
1971 else { /* opaque stipple */
1972 for (i = 0; i < pCachePriv->NumColor; i++, pCache++) {
1973 if (pCache->serialNumber &&
1974 (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
1975 (pCache->fg == fg) && (pCache->bg == bg)) {
1976 pCache->trans_color = -1;
1977 return pCache;
1978 }
1979 }
1980 }
1981 pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
1982 if (pCachePriv->CurrentColor >= pCachePriv->NumColor)
1983 pCachePriv->CurrentColor = 0;
1984
1985 if (bg == -1)
1986 pCache->trans_color = bg = fg ^ 1;
1987 else
1988 pCache->trans_color = -1;
1989
1990 pCache->pat0 = pat0;
1991 pCache->pat1 = pat1;
1992 pCache->fg = fg;
1993 pCache->bg = bg;
1994 pCache->serialNumber = 1;
1995 }
1996
1997 (*infoRec->WriteColor8x8PatternToCache) (pScrn, pPix, pCache);
1998
1999 return pCache;
2000}
2001
2002void
2003XAAWriteBitmapToCache(ScrnInfoPtr pScrn,
2004 int x, int y, int w, int h,
2005 unsigned char *src, int srcwidth, int fg, int bg)
2006{
2007 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
2008
2009 (*infoRec->WriteBitmap) (pScrn, x, y, w, h, src, srcwidth,
2010 0, fg, bg, GXcopy, ~0);
2011}
2012
2013void
2014XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn,
2015 int x, int y, int w, int h,
2016 unsigned char *src, int srcwidth, int fg, int bg)
2017{
2018 ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
2019 PixmapPtr pScreenPix, pDstPix;
2020 ChangeGCVal gcvals[2];
2021 GCPtr pGC;
2022
2023 pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
2024
2025 pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width,
2026 y + h, pScreenPix->drawable.depth,
2027 pScreenPix->drawable.bitsPerPixel,
2028 pScreenPix->devKind,
2029 pScreenPix->devPrivate.ptr);
2030
2031 pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
2032 gcvals[0].val = fg;
2033 gcvals[1].val = bg;
2034 ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals);
2035 ValidateGC((DrawablePtr) pDstPix, pGC);
2036
2037 /* We've unwrapped already so these ops miss a sync */
2038 SYNC_CHECK(pScrn);
2039
2040 (*pGC->ops->PutImage) ((DrawablePtr) pDstPix, pGC, 1, x, y, w, h, 0,
2041 XYBitmap, (pointer) src);
2042
2043 FreeScratchGC(pGC);
2044 FreeScratchPixmapHeader(pDstPix);
2045}
2046
2047void
2048XAAWritePixmapToCache(ScrnInfoPtr pScrn,
2049 int x, int y, int w, int h,
2050 unsigned char *src, int srcwidth, int bpp, int depth)
2051{
2052 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
2053
2054 (*infoRec->WritePixmap) (pScrn, x, y, w, h, src, srcwidth,
2055 GXcopy, ~0, -1, bpp, depth);
2056}
2057
2058void
2059XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn,
2060 int x, int y, int w, int h,
2061 unsigned char *src,
2062 int srcwidth, int bpp, int depth)
2063{
2064 ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
2065 PixmapPtr pScreenPix, pDstPix;
2066 GCPtr pGC;
2067
2068 pScreenPix = (*pScreen->GetScreenPixmap) (pScreen);
2069
2070 pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h,
2071 depth, bpp, pScreenPix->devKind,
2072 pScreenPix->devPrivate.ptr);
2073
2074 pGC = GetScratchGC(depth, pScreen);
2075 ValidateGC((DrawablePtr) pDstPix, pGC);
2076
2077 /* We've unwrapped already so these ops miss a sync */
2078 SYNC_CHECK(pScrn);
2079
2080 if (bpp == BitsPerPixel(depth))
2081 (*pGC->ops->PutImage) ((DrawablePtr) pDstPix, pGC, depth, x, y, w,
2082 h, 0, ZPixmap, (pointer) src);
2083 else {
2084 PixmapPtr pSrcPix;
2085
2086 pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp,
2087 srcwidth, (pointer) src);
2088
2089 (*pGC->ops->CopyArea) ((DrawablePtr) pSrcPix, (DrawablePtr) pDstPix,
2090 pGC, 0, 0, w, h, x, y);
2091
2092 FreeScratchPixmapHeader(pSrcPix);
2093 }
2094
2095 FreeScratchGC(pGC);
2096 FreeScratchPixmapHeader(pDstPix);
2097}
2098
2099void
2100XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache)
2101{
2102 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
2103 XAAPixmapCachePrivatePtr pCachePriv =
2104 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
2105 unsigned char *data;
2106 int pad, Bpp = (pScrn->bitsPerPixel >> 3);
2107
2108 pCache->offsets = pCachePriv->MonoOffsets;
2109
2110 pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
2111
2112 data = (unsigned char *) malloc(pad * pCache->h);
2113 if (!data)
2114 return;
2115
2116 if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
2117 CARD32 *ptr = (CARD32 *) data;
2118
2119 ptr[0] = pCache->pat0;
2120 ptr[1] = pCache->pat1;
2121 }
2122 else {
2123 CARD32 *ptr;
2124 DDXPointPtr pPoint = pCache->offsets;
2125 int patx, paty, i;
2126
2127 for (i = 0; i < 64; i++, pPoint++) {
2128 patx = pCache->pat0;
2129 paty = pCache->pat1;
2130 XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3,
2131 (infoRec->Mono8x8PatternFillFlags &
2132 BIT_ORDER_IN_BYTE_MSBFIRST));
2133 ptr = (CARD32 *) (data + (pad * pPoint->y) + (Bpp * pPoint->x));
2134 ptr[0] = patx;
2135 ptr[1] = paty;
2136 }
2137 }
2138
2139 (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y,
2140 pCache->w, pCache->h, data, pad,
2141 pScrn->bitsPerPixel, pScrn->depth);
2142
2143 free(data);
2144}
2145
2146void
2147XAAWriteColor8x8PatternToCache(ScrnInfoPtr pScrn,
2148 PixmapPtr pPix, XAACacheInfoPtr pCache)
2149{
2150 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
2151 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
2152 XAAPixmapCachePrivatePtr pCachePriv =
2153 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
2154 int pad, i, w, h, nw, nh, Bpp;
2155 unsigned char *data, *srcPtr, *dstPtr;
2156
2157 pCache->offsets = pCachePriv->ColorOffsets;
2158
2159 if (pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
2160 CARD32 *ptr;
2161
2162 pad = BitmapBytePad(pCache->w);
2163 data = (unsigned char *) malloc(pad * pCache->h);
2164 if (!data)
2165 return;
2166
2167 if (infoRec->Color8x8PatternFillFlags &
2168 HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
2169 ptr = (CARD32 *) data;
2170 ptr[0] = pCache->pat0;
2171 ptr[1] = pCache->pat1;
2172 }
2173 else {
2174 int patx, paty;
2175
2176 ptr = (CARD32 *) data;
2177 ptr[0] = ptr[2] = pCache->pat0;
2178 ptr[1] = ptr[3] = pCache->pat1;
2179 for (i = 1; i < 8; i++) {
2180 patx = pCache->pat0;
2181 paty = pCache->pat1;
2182 XAARotateMonoPattern(&patx, &paty, i, 0,
2183 (infoRec->Mono8x8PatternFillFlags &
2184 BIT_ORDER_IN_BYTE_MSBFIRST));
2185 ptr = (CARD32 *) (data + (pad * i));
2186 ptr[0] = ptr[2] = patx;
2187 ptr[1] = ptr[3] = paty;
2188 }
2189 }
2190
2191 (*infoRec->WriteBitmapToCache) (pScrn, pCache->x, pCache->y,
2192 pCache->w, pCache->h, data, pad,
2193 pCache->fg, pCache->bg);
2194
2195 free(data);
2196 return;
2197 }
2198
2199 Bpp = pScrn->bitsPerPixel >> 3;
2200 h = min(8, pPix->drawable.height);
2201 w = min(8, pPix->drawable.width);
2202 pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
2203
2204 data = (unsigned char *) malloc(pad * pCache->h);
2205 if (!data)
2206 return;
2207
2208 /* Write and expand horizontally. */
2209 for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--;
2210 srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) {
2211 nw = w;
2212 memcpy(dstPtr, srcPtr, w * Bpp);
2213 while (nw != 8) {
2214 memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp);
2215 nw <<= 1;
2216 }
2217 }
2218 nh = h;
2219 /* Expand vertically. */
2220 while (nh != 8) {
2221 memcpy(data + (nh * pScrn->bitsPerPixel), data,
2222 nh * pScrn->bitsPerPixel);
2223 nh <<= 1;
2224 }
2225
2226 if (!(infoRec->Color8x8PatternFillFlags &
2227 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
2228 int j;
2229 unsigned char *ptr = data + (128 * Bpp);
2230
2231 memcpy(data + (64 * Bpp), data, 64 * Bpp);
2232 for (i = 1; i < 8; i++, ptr += (128 * Bpp)) {
2233 for (j = 0; j < 8; j++) {
2234 memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp,
2235 (8 - i) * Bpp);
2236 memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp,
2237 i * Bpp);
2238 }
2239 memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp);
2240 }
2241 }
2242
2243 (*infoRec->WritePixmapToCache) (pScrn, pCache->x, pCache->y,
2244 pCache->w, pCache->h, data, pad,
2245 pScrn->bitsPerPixel, pScrn->depth);
2246
2247 free(data);
2248}
2249
2250int
2251XAAStippledFillChooser(GCPtr pGC)
2252{
2253 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
2254 PixmapPtr pPixmap = pGC->stipple;
2255 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
2256
2257 if (!(pPriv->flags & REDUCIBILITY_CHECKED) &&
2258 (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
2259 XAACheckStippleReducibility(pPixmap);
2260 }
2261
2262 if (pPriv->flags & REDUCIBLE_TO_8x8) {
2263 if (infoRec->CanDoMono8x8 &&
2264 !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) &&
2265 ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags &
2266 TRANSPARENCY_GXCOPY_ONLY)) &&
2267 CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2268 CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2269 CHECK_FG(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2270 CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) {
2271
2272 return DO_MONO_8x8;
2273 }
2274
2275 if (infoRec->CanDoColor8x8 &&
2276 !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) &&
2277 ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags &
2278 TRANSPARENCY_GXCOPY_ONLY)) &&
2279 CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
2280 CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
2281 CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) {
2282
2283 return DO_COLOR_8x8;
2284 }
2285 }
2286
2287 if (infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
2288 (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
2289 (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
2290 infoRec->CacheColorExpandDensity) &&
2291 !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) &&
2292 ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags &
2293 TRANSPARENCY_GXCOPY_ONLY)) &&
2294 CHECK_ROP(pGC, infoRec->FillCacheExpandSpansFlags) &&
2295 CHECK_ROPSRC(pGC, infoRec->FillCacheExpandSpansFlags) &&
2296 CHECK_FG(pGC, infoRec->FillCacheExpandSpansFlags) &&
2297 CHECK_PLANEMASK(pGC, infoRec->FillCacheExpandSpansFlags)) {
2298
2299 return DO_CACHE_EXPAND;
2300 }
2301
2302 if (infoRec->UsingPixmapCache &&
2303 !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
2304 infoRec->FillCacheBltSpans &&
2305 (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
2306 (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
2307 !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) &&
2308 ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags &
2309 TRANSPARENCY_GXCOPY_ONLY)) &&
2310 CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
2311 CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
2312 CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
2313
2314 return DO_CACHE_BLT;
2315 }
2316
2317 if (infoRec->FillColorExpandSpans &&
2318 !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) &&
2319 ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags &
2320 TRANSPARENCY_GXCOPY_ONLY)) &&
2321 CHECK_ROP(pGC, infoRec->FillColorExpandSpansFlags) &&
2322 CHECK_ROPSRC(pGC, infoRec->FillColorExpandSpansFlags) &&
2323 CHECK_FG(pGC, infoRec->FillColorExpandSpansFlags) &&
2324 CHECK_PLANEMASK(pGC, infoRec->FillColorExpandSpansFlags)) {
2325
2326 return DO_COLOR_EXPAND;
2327 }
2328
2329 return 0;
2330}
2331
2332int
2333XAAOpaqueStippledFillChooser(GCPtr pGC)
2334{
2335 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
2336 PixmapPtr pPixmap = pGC->stipple;
2337 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
2338
2339 if (XAA_DEPTH_BUG(pGC))
2340 return 0;
2341
2342 if (!(pPriv->flags & REDUCIBILITY_CHECKED) &&
2343 (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
2344 XAACheckStippleReducibility(pPixmap);
2345 }
2346
2347 if (pPriv->flags & REDUCIBLE_TO_8x8) {
2348 if (infoRec->CanDoMono8x8 &&
2349 !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
2350 CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2351 CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2352 CHECK_COLORS(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2353 CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) {
2354
2355 return DO_MONO_8x8;
2356 }
2357
2358 if (infoRec->CanDoColor8x8 &&
2359 CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
2360 CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
2361 CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) {
2362
2363 return DO_COLOR_8x8;
2364 }
2365 }
2366
2367 if (infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
2368 (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
2369 (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
2370 infoRec->CacheColorExpandDensity) &&
2371 !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) &&
2372 CHECK_ROP(pGC, infoRec->FillCacheExpandSpansFlags) &&
2373 CHECK_ROPSRC(pGC, infoRec->FillCacheExpandSpansFlags) &&
2374 CHECK_COLORS(pGC, infoRec->FillCacheExpandSpansFlags) &&
2375 CHECK_PLANEMASK(pGC, infoRec->FillCacheExpandSpansFlags)) {
2376
2377 return DO_CACHE_EXPAND;
2378 }
2379
2380 if (infoRec->UsingPixmapCache &&
2381 !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
2382 infoRec->FillCacheBltSpans &&
2383 (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
2384 (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
2385 CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
2386 CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
2387 CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
2388
2389 return DO_CACHE_BLT;
2390 }
2391
2392 if (infoRec->FillColorExpandSpans &&
2393 !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) &&
2394 CHECK_ROP(pGC, infoRec->FillColorExpandSpansFlags) &&
2395 CHECK_ROPSRC(pGC, infoRec->FillColorExpandSpansFlags) &&
2396 CHECK_COLORS(pGC, infoRec->FillColorExpandSpansFlags) &&
2397 CHECK_PLANEMASK(pGC, infoRec->FillColorExpandSpansFlags)) {
2398
2399 return DO_COLOR_EXPAND;
2400 }
2401
2402 return 0;
2403}
2404
2405int
2406XAATiledFillChooser(GCPtr pGC)
2407{
2408 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
2409 PixmapPtr pPixmap = pGC->tile.pixmap;
2410 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
2411
2412 if (IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans &&
2413 CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
2414 CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
2415 CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
2416
2417 return DO_PIXMAP_COPY;
2418 }
2419
2420 if (!(pPriv->flags & REDUCIBILITY_CHECKED) &&
2421 (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
2422 XAACheckTileReducibility(pPixmap, infoRec->CanDoMono8x8);
2423 }
2424
2425 if (pPriv->flags & REDUCIBLE_TO_8x8) {
2426 if ((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 &&
2427 !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
2428 CHECK_ROP(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2429 CHECK_ROPSRC(pGC, infoRec->FillMono8x8PatternSpansFlags) &&
2430 (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) ||
2431 (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) &&
2432 CHECK_PLANEMASK(pGC, infoRec->FillMono8x8PatternSpansFlags)) {
2433
2434 return DO_MONO_8x8;
2435 }
2436
2437 if (infoRec->CanDoColor8x8 &&
2438 CHECK_ROP(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
2439 CHECK_ROPSRC(pGC, infoRec->FillColor8x8PatternSpansFlags) &&
2440 CHECK_PLANEMASK(pGC, infoRec->FillColor8x8PatternSpansFlags)) {
2441
2442 return DO_COLOR_8x8;
2443 }
2444 }
2445
2446 if (infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans &&
2447 (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
2448 (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
2449 CHECK_ROP(pGC, infoRec->FillCacheBltSpansFlags) &&
2450 CHECK_ROPSRC(pGC, infoRec->FillCacheBltSpansFlags) &&
2451 CHECK_PLANEMASK(pGC, infoRec->FillCacheBltSpansFlags)) {
2452
2453 return DO_CACHE_BLT;
2454 }
2455
2456 if (infoRec->FillImageWriteRects &&
2457 CHECK_NO_GXCOPY(pGC, infoRec->FillImageWriteRectsFlags) &&
2458 CHECK_ROP(pGC, infoRec->FillImageWriteRectsFlags) &&
2459 CHECK_ROPSRC(pGC, infoRec->FillImageWriteRectsFlags) &&
2460 CHECK_PLANEMASK(pGC, infoRec->FillImageWriteRectsFlags)) {
2461
2462 return DO_IMAGE_WRITE;
2463 }
2464
2465 return 0;
2466}
2467
2468static int RotateMasksX[8] = {
2469 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F,
2470 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101
2471};
2472
2473static int RotateMasksY[4] = {
2474 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF
2475};
2476
2477void
2478XAARotateMonoPattern(int *pat0, int *pat1, int xorg, int yorg, Bool msbfirst)
2479{
2480 int tmp, mask;
2481
2482 if (xorg) {
2483 if (msbfirst)
2484 xorg = 8 - xorg;
2485 mask = RotateMasksX[xorg];
2486 *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask);
2487 *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask);
2488 }
2489 if (yorg >= 4) {
2490 tmp = *pat0;
2491 *pat0 = *pat1;
2492 *pat1 = tmp;
2493 yorg -= 4;
2494 }
2495 if (yorg) {
2496 mask = RotateMasksY[yorg];
2497 yorg <<= 3;
2498 tmp = *pat0;
2499 *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask);
2500 *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask);
2501 }
2502}
2503
2504void
2505XAAInvalidatePixmapCache(ScreenPtr pScreen)
2506{
2507 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
2508 XAAPixmapCachePrivatePtr pCachePriv =
2509 (XAAPixmapCachePrivatePtr) infoRec->PixmapCachePrivate;
2510 int i;
2511
2512 if (!pCachePriv)
2513 return;
2514
2515 for (i = 0; i < pCachePriv->Num512x512; i++)
2516 (pCachePriv->Info512)[i].serialNumber = 0;
2517 for (i = 0; i < pCachePriv->Num256x256; i++)
2518 (pCachePriv->Info256)[i].serialNumber = 0;
2519 for (i = 0; i < pCachePriv->Num128x128; i++)
2520 (pCachePriv->Info128)[i].serialNumber = 0;
2521 for (i = 0; i < pCachePriv->NumPartial; i++)
2522 (pCachePriv->InfoPartial)[i].serialNumber = 0;
2523 for (i = 0; i < pCachePriv->NumMono; i++)
2524 (pCachePriv->InfoMono)[i].serialNumber = 0;
2525 for (i = 0; i < pCachePriv->NumColor; i++)
2526 (pCachePriv->InfoColor)[i].serialNumber = 0;
2527}
diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c
deleted file mode 100644
index 0721768ed..000000000
--- a/hw/xfree86/xaa/xaaPict.c
+++ /dev/null
@@ -1,654 +0,0 @@
1/*
2 *
3 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
14 *
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
22 */
23
24#ifdef HAVE_XORG_CONFIG_H
25#include <xorg-config.h>
26#endif
27
28#include <string.h>
29
30#include "misc.h"
31#include "xf86.h"
32#include "xf86_OSproc.h"
33
34#include <X11/X.h>
35#include "scrnintstr.h"
36#include "pixmapstr.h"
37#include "windowstr.h"
38#include "xf86str.h"
39#include "mi.h"
40#include "picturestr.h"
41#include "glyphstr.h"
42#include "picture.h"
43#include "mipict.h"
44#include "xaa.h"
45#include "xaalocal.h"
46#include "xaawrap.h"
47#include "xaacexp.h"
48#include "xf86fbman.h"
49#include "servermd.h"
50
51Bool
52XAAGetPixelFromRGBA(CARD32 *pixel,
53 CARD16 red,
54 CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format)
55{
56 int rbits, bbits, gbits, abits;
57 int rshift, bshift, gshift, ashift;
58
59 *pixel = 0;
60
61 if (!PICT_FORMAT_COLOR(format))
62 return FALSE;
63
64 rbits = PICT_FORMAT_R(format);
65 gbits = PICT_FORMAT_G(format);
66 bbits = PICT_FORMAT_B(format);
67 abits = PICT_FORMAT_A(format);
68
69 if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
70 bshift = 0;
71 gshift = bbits;
72 rshift = gshift + gbits;
73 ashift = rshift + rbits;
74 }
75 else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
76 rshift = 0;
77 gshift = rbits;
78 bshift = gshift + gbits;
79 ashift = bshift + bbits;
80 }
81 else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
82 bshift = PICT_FORMAT_BPP(format) - bbits;
83 gshift = bshift - gbits;
84 rshift = gshift - rbits;
85 ashift = 0;
86 }
87 else
88 return FALSE;
89
90 *pixel |= (blue >> (16 - bbits)) << bshift;
91 *pixel |= (red >> (16 - rbits)) << rshift;
92 *pixel |= (green >> (16 - gbits)) << gshift;
93 *pixel |= (alpha >> (16 - abits)) << ashift;
94
95 return TRUE;
96}
97
98Bool
99XAAGetRGBAFromPixel(CARD32 pixel,
100 CARD16 *red,
101 CARD16 *green, CARD16 *blue, CARD16 *alpha, CARD32 format)
102{
103 int rbits, bbits, gbits, abits;
104 int rshift, bshift, gshift, ashift;
105
106 if (!PICT_FORMAT_COLOR(format))
107 return FALSE;
108
109 rbits = PICT_FORMAT_R(format);
110 gbits = PICT_FORMAT_G(format);
111 bbits = PICT_FORMAT_B(format);
112 abits = PICT_FORMAT_A(format);
113
114 if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
115 bshift = 0;
116 gshift = bbits;
117 rshift = gshift + gbits;
118 ashift = rshift + rbits;
119 }
120 else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
121 rshift = 0;
122 gshift = rbits;
123 bshift = gshift + gbits;
124 ashift = bshift + bbits;
125 }
126 else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
127 bshift = PICT_FORMAT_BPP(format) - bbits;
128 gshift = bshift - gbits;
129 rshift = gshift - rbits;
130 ashift = 0;
131 }
132 else
133 return FALSE;
134
135 *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits);
136 while (rbits < 16) {
137 *red |= *red >> rbits;
138 rbits <<= 1;
139 }
140
141 *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits);
142 while (gbits < 16) {
143 *green |= *green >> gbits;
144 gbits <<= 1;
145 }
146
147 *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits);
148 while (bbits < 16) {
149 *blue |= *blue >> bbits;
150 bbits <<= 1;
151 }
152
153 if (abits) {
154 *alpha = ((pixel >> ashift) & ((1 << abits) - 1)) << (16 - abits);
155 while (abits < 16) {
156 *alpha |= *alpha >> abits;
157 abits <<= 1;
158 }
159 }
160 else
161 *alpha = 0xffff;
162
163 return TRUE;
164}
165
166/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
167
168void
169XAA_888_plus_PICT_a8_to_8888(CARD32 color, CARD8 *alphaPtr, /* in bytes */
170 int alphaPitch, CARD32 *dstPtr, int dstPitch, /* in dwords */
171 int width, int height)
172{
173 int x;
174
175 color &= 0x00ffffff;
176
177 while (height--) {
178 for (x = 0; x < width; x++)
179 dstPtr[x] = color | (alphaPtr[x] << 24);
180 dstPtr += dstPitch;
181 alphaPtr += alphaPitch;
182 }
183}
184
185#define DRAWABLE_IS_ON_CARD(pDraw) \
186 (pDraw->type == DRAWABLE_WINDOW || \
187 (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw)))
188
189Bool
190XAADoComposite(CARD8 op,
191 PicturePtr pSrc,
192 PicturePtr pMask,
193 PicturePtr pDst,
194 INT16 xSrc,
195 INT16 ySrc,
196 INT16 xMask,
197 INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
198{
199 ScreenPtr pScreen = pDst->pDrawable->pScreen;
200 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
201 RegionRec region;
202 CARD32 *formats, *dstformats;
203 int flags = 0;
204 BoxPtr pbox;
205 int nbox, w, h;
206
207 if (!RegionNumRects(pDst->pCompositeClip))
208 return TRUE;
209
210 if (!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable))
211 return FALSE;
212
213 if (DRAWABLE_IS_ON_CARD(pSrc->pDrawable))
214 return FALSE;
215
216 if (pSrc->transform || (pMask && pMask->transform))
217 return FALSE;
218
219 if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
220 return FALSE;
221
222 if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
223 (pMask && pMask->repeat && pMask->repeatType != RepeatNormal)) {
224 return FALSE;
225 }
226
227 xDst += pDst->pDrawable->x;
228 yDst += pDst->pDrawable->y;
229 xSrc += pSrc->pDrawable->x;
230 ySrc += pSrc->pDrawable->y;
231
232 if (pMask) {
233 if (pMask->componentAlpha)
234 return FALSE;
235
236 /* for now we only do it if there is a 1x1 (solid) source */
237
238 if ((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
239 CARD16 red, green, blue, alpha;
240 CARD32 pixel =
241 *((CARD32 *) (((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr));
242
243 if (!XAAGetRGBAFromPixel
244 (pixel, &red, &green, &blue, &alpha, pSrc->format))
245 return FALSE;
246
247 xMask += pMask->pDrawable->x;
248 yMask += pMask->pDrawable->y;
249
250 /* pull out color expandable operations here */
251 if ((pMask->format == PICT_a1) && (alpha == 0xffff) &&
252 (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat &&
253 !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) &&
254 (!(infoRec->WriteBitmapFlags & RGB_EQUAL) ||
255 ((red == green) && (green == blue)))) {
256 PixmapPtr pPix = (PixmapPtr) (pMask->pDrawable);
257 int skipleft;
258
259 if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
260 xSrc, ySrc, xMask, yMask, xDst,
261 yDst, width, height))
262 return TRUE;
263
264 nbox = RegionNumRects(&region);
265 pbox = RegionRects(&region);
266
267 if (!nbox)
268 return TRUE;
269
270 XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format);
271
272 xMask -= xDst;
273 yMask -= yDst;
274
275 while (nbox--) {
276 skipleft = pbox->x1 + xMask;
277
278 (*infoRec->WriteBitmap) (infoRec->pScrn,
279 pbox->x1, pbox->y1,
280 pbox->x2 - pbox->x1,
281 pbox->y2 - pbox->y1,
282 (unsigned char *) (pPix->
283 devPrivate.
284 ptr) +
285 (pPix->devKind *
286 (pbox->y1 + yMask)) +
287 ((skipleft >> 3) & ~3),
288 pPix->devKind, skipleft & 31,
289 pixel, -1, GXcopy, ~0);
290 pbox++;
291 }
292
293 /* WriteBitmap sets the Sync flag */
294 RegionUninit(&region);
295 return TRUE;
296 }
297
298 formats = infoRec->CPUToScreenAlphaTextureFormats;
299 dstformats = infoRec->CPUToScreenAlphaTextureDstFormats;
300 if (!formats || !dstformats)
301 return FALSE;
302
303 w = pMask->pDrawable->width;
304 h = pMask->pDrawable->height;
305
306 if (pMask->repeat) {
307 if ((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE)
308 ||
309 ((infoRec->
310 CPUToScreenAlphaTextureFlags &
311 XAA_RENDER_POWER_OF_2_TILE_ONLY) && ((h & (h - 1)) ||
312 (w & (w - 1))))) {
313 return FALSE;
314 }
315 flags |= XAA_RENDER_REPEAT;
316 }
317
318 if ((alpha != 0xffff) &&
319 (infoRec->
320 CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
321 return FALSE;
322
323 while (*formats != pMask->format) {
324 if (!(*formats))
325 return FALSE;
326 formats++;
327 }
328 while (*dstformats != pDst->format) {
329 if (!(*dstformats))
330 return FALSE;
331 dstformats++;
332 }
333
334 if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
335 xSrc, ySrc, xMask, yMask, xDst, yDst,
336 width, height))
337 return TRUE;
338
339 nbox = RegionNumRects(&region);
340 pbox = RegionRects(&region);
341
342 if (!nbox) {
343 RegionUninit(&region);
344 return TRUE;
345 }
346
347 if (!(infoRec->SetupForCPUToScreenAlphaTexture2) (infoRec->pScrn,
348 op, red, green,
349 blue, alpha,
350 pMask->format,
351 pDst->format,
352 ((PixmapPtr)
353 (pMask->
354 pDrawable))->
355 devPrivate.ptr,
356 ((PixmapPtr)
357 (pMask->
358 pDrawable))->
359 devKind, w, h,
360 flags)) {
361 RegionUninit(&region);
362 return FALSE;
363 }
364
365 xMask -= xDst;
366 yMask -= yDst;
367
368 while (nbox--) {
369 (*infoRec->SubsequentCPUToScreenAlphaTexture) (infoRec->pScrn,
370 pbox->x1,
371 pbox->y1,
372 pbox->x1 + xMask,
373 pbox->y1 + yMask,
374 pbox->x2 -
375 pbox->x1,
376 pbox->y2 -
377 pbox->y1);
378 pbox++;
379 }
380
381 SET_SYNC_FLAG(infoRec);
382 RegionUninit(&region);
383 return TRUE;
384 }
385 }
386 else {
387 formats = infoRec->CPUToScreenTextureFormats;
388 dstformats = infoRec->CPUToScreenTextureDstFormats;
389 if (!formats || !dstformats)
390 return FALSE;
391
392 w = pSrc->pDrawable->width;
393 h = pSrc->pDrawable->height;
394
395 if (pSrc->repeat) {
396 if ((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) ||
397 ((infoRec->CPUToScreenTextureFlags &
398 XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
399 ((h & (h - 1)) || (w & (w - 1))))) {
400 return FALSE;
401 }
402 flags |= XAA_RENDER_REPEAT;
403 }
404
405 while (*formats != pSrc->format) {
406 if (!(*formats))
407 return FALSE;
408 formats++;
409 }
410 while (*dstformats != pDst->format) {
411 if (!(*dstformats))
412 return FALSE;
413 dstformats++;
414 }
415
416 if (!miComputeCompositeRegion(&region, pSrc, pMask, pDst,
417 xSrc, ySrc, xMask, yMask, xDst, yDst,
418 width, height))
419 return TRUE;
420
421 nbox = RegionNumRects(&region);
422 pbox = RegionRects(&region);
423
424 if (!nbox) {
425 RegionUninit(&region);
426 return TRUE;
427 }
428
429 if (!(infoRec->SetupForCPUToScreenTexture2) (infoRec->pScrn,
430 op, pSrc->format,
431 pDst->format,
432 ((PixmapPtr)
433 (pSrc->pDrawable))->
434 devPrivate.ptr,
435 ((PixmapPtr)
436 (pSrc->pDrawable))->
437 devKind, w, h, flags)) {
438 RegionUninit(&region);
439 return FALSE;
440 }
441
442 xSrc -= xDst;
443 ySrc -= yDst;
444
445 while (nbox--) {
446 (*infoRec->SubsequentCPUToScreenTexture) (infoRec->pScrn,
447 pbox->x1, pbox->y1,
448 pbox->x1 + xSrc,
449 pbox->y1 + ySrc,
450 pbox->x2 - pbox->x1,
451 pbox->y2 - pbox->y1);
452 pbox++;
453 }
454
455 SET_SYNC_FLAG(infoRec);
456 RegionUninit(&region);
457 return TRUE;
458 }
459
460 return FALSE;
461}
462
463static void
464XAACompositeSrcCopy(PicturePtr pSrc,
465 PicturePtr pDst,
466 INT16 xSrc,
467 INT16 ySrc,
468 INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
469{
470 ScreenPtr pScreen = pDst->pDrawable->pScreen;
471 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
472 int i, nbox;
473 int xoff, yoff;
474 BoxPtr pbox;
475 DDXPointPtr pptSrc;
476 RegionRec region;
477
478 xDst += pDst->pDrawable->x;
479 yDst += pDst->pDrawable->y;
480 xSrc += pSrc->pDrawable->x;
481 ySrc += pSrc->pDrawable->y;
482
483 if (!miComputeCompositeRegion(&region, pSrc, NULL, pDst,
484 xSrc, ySrc, 0, 0, xDst, yDst, width, height))
485 return;
486
487 nbox = RegionNumRects(&region);
488 pbox = RegionRects(&region);
489
490 if (!nbox) {
491 RegionUninit(&region);
492 return;
493 }
494 pptSrc = malloc(sizeof(DDXPointRec) * nbox);
495 if (!pptSrc) {
496 RegionUninit(&region);
497 return;
498 }
499 xoff = xSrc - xDst;
500 yoff = ySrc - yDst;
501 for (i = 0; i < nbox; i++) {
502 pptSrc[i].x = pbox[i].x1 + xoff;
503 pptSrc[i].y = pbox[i].y1 + yoff;
504 }
505
506 infoRec->ScratchGC.planemask = ~0L;
507 infoRec->ScratchGC.alu = GXcopy;
508
509 XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
510 pptSrc);
511
512 free(pptSrc);
513 RegionUninit(&region);
514 return;
515}
516
517void
518XAAComposite(CARD8 op,
519 PicturePtr pSrc,
520 PicturePtr pMask,
521 PicturePtr pDst,
522 INT16 xSrc,
523 INT16 ySrc,
524 INT16 xMask,
525 INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
526{
527 ScreenPtr pScreen = pDst->pDrawable->pScreen;
528 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
529
530 XAA_RENDER_PROLOGUE(pScreen, Composite);
531
532 if (!pMask && infoRec->pScrn->vtSema &&
533 infoRec->ScreenToScreenBitBlt &&
534 pSrc->pDrawable &&
535 DRAWABLE_IS_ON_CARD(pSrc->pDrawable) &&
536 DRAWABLE_IS_ON_CARD(pDst->pDrawable) &&
537 !pSrc->transform &&
538 (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 &&
539 xSrc + width <= pSrc->pDrawable->width &&
540 ySrc + height <= pSrc->pDrawable->height)) &&
541 ((op == PictOpSrc &&
542 ((pSrc->format == pDst->format) ||
543 (pSrc->format == PICT_a8r8g8b8 && pDst->format == PICT_x8r8g8b8) ||
544 (pSrc->format == PICT_a8b8g8r8 && pDst->format == PICT_x8b8g8r8))) ||
545 (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
546 pSrc->format == pDst->format &&
547 (pSrc->format == PICT_x8r8g8b8 || pSrc->format == PICT_x8b8g8r8)))) {
548 XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height);
549 }
550 else if (!pSrc->pDrawable || (pMask && !pMask->pDrawable) ||
551 !infoRec->Composite ||
552 !(*infoRec->Composite) (op, pSrc, pMask, pDst,
553 xSrc, ySrc, xMask, yMask, xDst, yDst,
554 width, height)) {
555 if (infoRec->pScrn->vtSema &&
556 ((pSrc->pDrawable &&
557 (pSrc->pDrawable->type == DRAWABLE_WINDOW ||
558 IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
559 pDst->pDrawable->type == DRAWABLE_WINDOW ||
560 IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
561 SYNC_CHECK(pDst->pDrawable);
562 }
563 (*GetPictureScreen(pScreen)->Composite) (op,
564 pSrc,
565 pMask,
566 pDst,
567 xSrc,
568 ySrc,
569 xMask,
570 yMask,
571 xDst, yDst, width, height);
572 }
573
574 if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
575 (XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst->pDrawable)))->flags |= DIRTY;
576
577 XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
578}
579
580Bool
581XAADoGlyphs(CARD8 op,
582 PicturePtr pSrc,
583 PicturePtr pDst,
584 PictFormatPtr maskFormat,
585 INT16 xSrc,
586 INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
587{
588 ScreenPtr pScreen = pDst->pDrawable->pScreen;
589 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
590
591 if (!RegionNumRects(pDst->pCompositeClip))
592 return TRUE;
593
594 if (!infoRec->pScrn->vtSema ||
595 ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
596 !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
597 return FALSE;
598
599 if ((pSrc->pDrawable->type != DRAWABLE_PIXMAP) ||
600 IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))
601 return FALSE;
602
603 /*
604 * If it looks like we have a chance of being able to draw these
605 * glyphs with an accelerated Composite, do that now to avoid
606 * unneeded and costly syncs.
607 */
608 if (maskFormat) {
609 if (!infoRec->CPUToScreenAlphaTextureFormats)
610 return FALSE;
611 }
612 else {
613 if (!infoRec->CPUToScreenTextureFormats)
614 return FALSE;
615 }
616
617 miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
618
619 return TRUE;
620}
621
622void
623XAAGlyphs(CARD8 op,
624 PicturePtr pSrc,
625 PicturePtr pDst,
626 PictFormatPtr maskFormat,
627 INT16 xSrc,
628 INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
629{
630 ScreenPtr pScreen = pDst->pDrawable->pScreen;
631 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
632
633 XAA_RENDER_PROLOGUE(pScreen, Glyphs);
634
635 if (!pSrc->pDrawable || !infoRec->Glyphs ||
636 !(*infoRec->Glyphs) (op, pSrc, pDst, maskFormat,
637 xSrc, ySrc, nlist, list, glyphs)) {
638 if (infoRec->pScrn->vtSema &&
639 ((pSrc->pDrawable &&
640 (pSrc->pDrawable->type == DRAWABLE_WINDOW ||
641 IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
642 pDst->pDrawable->type == DRAWABLE_WINDOW ||
643 IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
644 SYNC_CHECK(pDst->pDrawable);
645 }
646 (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
647 xSrc, ySrc, nlist, list, glyphs);
648 }
649
650 if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
651 (XAA_GET_PIXMAP_PRIVATE((PixmapPtr) (pDst->pDrawable)))->flags |= DIRTY;
652
653 XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
654}
diff --git a/hw/xfree86/xaa/xaaROP.c b/hw/xfree86/xaa/xaaROP.c
deleted file mode 100644
index 3b6ec9385..000000000
--- a/hw/xfree86/xaa/xaaROP.c
+++ /dev/null
@@ -1,182 +0,0 @@
1#ifdef HAVE_XORG_CONFIG_H
2#include <xorg-config.h>
3#endif
4
5#include <X11/X.h>
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include "scrnintstr.h"
11#include "xf86str.h"
12#include "xaarop.h"
13#include "xaa.h"
14#include "xaalocal.h"
15
16int XAACopyROP[16] = {
17 ROP_0, /* GXclear */
18 ROP_DSa, /* GXand */
19 ROP_SDna, /* GXandReverse */
20 ROP_S, /* GXcopy */
21 ROP_DSna, /* GXandInverted */
22 ROP_D, /* GXnoop */
23 ROP_DSx, /* GXxor */
24 ROP_DSo, /* GXor */
25 ROP_DSon, /* GXnor */
26 ROP_DSxn, /* GXequiv */
27 ROP_Dn, /* GXinvert */
28 ROP_SDno, /* GXorReverse */
29 ROP_Sn, /* GXcopyInverted */
30 ROP_DSno, /* GXorInverted */
31 ROP_DSan, /* GXnand */
32 ROP_1 /* GXset */
33};
34
35int XAACopyROP_PM[16] = {
36 ROP_0, /* not used */
37 ROP_DSPnoa,
38 ROP_DPSnaon,
39 ROP_DPSDxax,
40 ROP_DPSana,
41 ROP_D, /* not used */
42 ROP_DPSax,
43 ROP_DPSao,
44 ROP_DPSaon,
45 ROP_DPSaxn,
46 ROP_Dn, /* not used */
47 ROP_DPSanan,
48 ROP_PSDPxox, /* is that correct ? */
49 ROP_DPSnao,
50 ROP_DSPnoan,
51 ROP_1 /* not used */
52};
53
54int XAAPatternROP[16] = {
55 ROP_0,
56 ROP_DPa,
57 ROP_PDna,
58 ROP_P,
59 ROP_DPna,
60 ROP_D,
61 ROP_DPx,
62 ROP_DPo,
63 ROP_DPon,
64 ROP_PDxn,
65 ROP_Dn,
66 ROP_PDno,
67 ROP_Pn,
68 ROP_DPno,
69 ROP_DPan,
70 ROP_1
71};
72
73int XAAPatternROP_PM[16] = {
74 ROP_DPna,
75 ROP_DPSnoa,
76 ROP_DSPnaon,
77 ROP_DSPDxax,
78 ROP_DPSana,
79 ROP_D,
80 ROP_DPSax,
81 ROP_DPSao,
82 ROP_DPSaon,
83 ROP_DPSaxn,
84 ROP_DPx,
85 ROP_DPSanan,
86 ROP_SPDSxox, /* is that correct ? */
87 ROP_DSPnao,
88 ROP_DPSnoan,
89 ROP_DPo
90};
91
92int
93XAAGetCopyROP(int i)
94{
95 return XAACopyROP[i];
96}
97
98int
99XAAGetCopyROP_PM(int i)
100{
101 return XAACopyROP_PM[i];
102}
103
104int
105XAAGetPatternROP(int i)
106{
107 return XAAPatternROP[i];
108}
109
110int
111XAAGetPatternROP_PM(int i)
112{
113 return XAAPatternROP_PM[i];
114}
115
116int
117XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop)
118{
119 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
120 int ret = 0;
121
122 pm &= infoRec->FullPlanemasks[pScrn->depth - 1];
123
124 if (pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
125 if (!NO_SRC_ROP(*rop))
126 ret |= ROP_PAT;
127 *rop = XAAPatternROP[*rop];
128 }
129 else {
130 switch (*rop) {
131 case GXnoop:
132 break;
133 case GXset:
134 case GXclear:
135 case GXinvert:
136 ret |= ROP_PAT;
137 *fg = pm;
138 if (*bg != -1)
139 *bg = pm;
140 break;
141 default:
142 ret |= ROP_PAT | ROP_SRC;
143 break;
144 }
145 *rop = XAAPatternROP_PM[*rop];
146 }
147
148 return ret;
149}
150
151int
152XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop)
153{
154 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
155 int ret = 0;
156
157 pm &= infoRec->FullPlanemasks[pScrn->depth - 1];
158
159 if (pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
160 if (!NO_SRC_ROP(*rop))
161 ret |= ROP_PAT;
162 *rop = XAAPatternROP[*rop];
163 }
164 else {
165 switch (*rop) {
166 case GXnoop:
167 break;
168 case GXset:
169 case GXclear:
170 case GXinvert:
171 ret |= ROP_PAT;
172 *fg = pm;
173 break;
174 default:
175 ret |= ROP_PAT | ROP_SRC;
176 break;
177 }
178 *rop = XAAPatternROP_PM[*rop];
179 }
180
181 return ret;
182}
diff --git a/hw/xfree86/xaa/xaaRect.c b/hw/xfree86/xaa/xaaRect.c
deleted file mode 100644
index 002090085..000000000
--- a/hw/xfree86/xaa/xaaRect.c
+++ /dev/null
@@ -1,121 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "pixmapstr.h"
13#include "xf86str.h"
14#include "xaa.h"
15#include "xaalocal.h"
16
17/*
18 Much of this file based on code by
19 Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
20*/
21
22void
23XAAPolyRectangleThinSolid(DrawablePtr pDrawable,
24 GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
25{
26 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
27 int nClipRects; /* number of clip rectangles */
28 BoxPtr pClipRects; /* points to the list of clip rects */
29 int xOrigin; /* Drawables x origin */
30 int yOrigin; /* Drawables x origin */
31 xRectangle *pRect; /* list of rects */
32 int nRects; /* running count of number of rects */
33 int origX1, origY1; /* original rectangle's U/L corner */
34 int origX2, origY2; /* original rectangle's L/R corner */
35 int clippedX1; /* clipped rectangle's left x */
36 int clippedY1; /* clipped rectangle's top y */
37 int clippedX2; /* clipped rectangle's right x */
38 int clippedY2; /* clipped rectangle's bottom y */
39 int clipXMin; /* upper left corner of clip rect */
40 int clipYMin; /* upper left corner of clip rect */
41 int clipXMax; /* lower right corner of clip rect */
42 int clipYMax; /* lower right corner of clip rect */
43 int width, height; /* width and height of rect */
44
45 nClipRects = RegionNumRects(pGC->pCompositeClip);
46 pClipRects = RegionRects(pGC->pCompositeClip);
47
48 if (!nClipRects)
49 return;
50
51 xOrigin = pDrawable->x;
52 yOrigin = pDrawable->y;
53
54 (*infoRec->SetupForSolidLine) (infoRec->pScrn,
55 pGC->fgPixel, pGC->alu, pGC->planemask);
56
57 for (; nClipRects > 0; nClipRects--, pClipRects++) {
58 clipYMin = pClipRects->y1;
59 clipYMax = pClipRects->y2 - 1;
60 clipXMin = pClipRects->x1;
61 clipXMax = pClipRects->x2 - 1;
62
63 for (pRect = pRectsInit, nRects = nRectsInit;
64 nRects > 0; nRects--, pRect++) {
65 /* translate rectangle data over to the drawable */
66 origX1 = pRect->x + xOrigin;
67 origY1 = pRect->y + yOrigin;
68 origX2 = origX1 + pRect->width;
69 origY2 = origY1 + pRect->height;
70
71 /* reject entire rectangle if completely outside clip rect */
72 if ((origX1 > clipXMax) || (origX2 < clipXMin) ||
73 (origY1 > clipYMax) || (origY2 < clipYMin))
74 continue;
75
76 /* clip the rectangle */
77 clippedX1 = max(origX1, clipXMin);
78 clippedX2 = min(origX2, clipXMax);
79 clippedY1 = max(origY1, clipYMin);
80 clippedY2 = min(origY2, clipYMax);
81
82 width = clippedX2 - clippedX1 + 1;
83
84 if (origY1 >= clipYMin) {
85 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
86 clippedX1, clippedY1,
87 width, DEGREES_0);
88
89 /* don't overwrite corner */
90 clippedY1++;
91 }
92
93 if ((origY2 <= clipYMax) && (origY1 != origY2)) {
94 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
95 clippedX1, clippedY2,
96 width, DEGREES_0);
97
98 /* don't overwrite corner */
99 clippedY2--;
100 }
101
102 if (clippedY2 < clippedY1)
103 continue;
104
105 height = clippedY2 - clippedY1 + 1;
106
107 /* draw vertical edges using lines if not clipped out */
108 if (origX1 >= clipXMin)
109 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
110 clippedX1, clippedY1,
111 height, DEGREES_270);
112
113 if ((origX2 <= clipXMax) && (origX2 != origX1))
114 (*infoRec->SubsequentSolidHorVertLine) (infoRec->pScrn,
115 clippedX2, clippedY1,
116 height, DEGREES_270);
117 }
118 }
119
120 SET_SYNC_FLAG(infoRec);
121}
diff --git a/hw/xfree86/xaa/xaaSpans.c b/hw/xfree86/xaa/xaaSpans.c
deleted file mode 100644
index f03452a46..000000000
--- a/hw/xfree86/xaa/xaaSpans.c
+++ /dev/null
@@ -1,876 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "pixmapstr.h"
13#include "xf86str.h"
14#include "mi.h"
15#include "mispans.h"
16#include "xaa.h"
17#include "xaalocal.h"
18
19static void XAARenderSolidSpans(GCPtr, int, DDXPointPtr, int *, int, int, int);
20static void XAARenderColor8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int,
21 int);
22static void XAARenderMono8x8Spans(GCPtr, int, DDXPointPtr, int *, int, int,
23 int);
24static void XAARenderCacheBltSpans(GCPtr, int, DDXPointPtr, int *, int, int,
25 int);
26static void XAARenderColorExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int,
27 int);
28static void XAARenderCacheExpandSpans(GCPtr, int, DDXPointPtr, int *, int, int,
29 int);
30static void XAARenderPixmapCopySpans(GCPtr, int, DDXPointPtr, int *, int, int,
31 int);
32
33void
34XAAFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, /* number of spans to fill */
35 DDXPointPtr pptInit, /* pointer to list of start points */
36 int *pwidthInit, /* pointer to list of n widths */
37 int fSorted)
38{
39 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
40 int type = 0;
41 ClipAndRenderSpansFunc function;
42 Bool fastClip = FALSE;
43
44 if ((nInit <= 0) || !pGC->planemask)
45 return;
46
47 if (!RegionNumRects(pGC->pCompositeClip))
48 return;
49
50 switch (pGC->fillStyle) {
51 case FillSolid:
52 type = DO_SOLID;
53 break;
54 case FillStippled:
55 type = (*infoRec->StippledFillChooser) (pGC);
56 break;
57 case FillOpaqueStippled:
58 if ((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid &&
59 CHECK_PLANEMASK(pGC, infoRec->FillSpansSolidFlags) &&
60 CHECK_ROP(pGC, infoRec->FillSpansSolidFlags) &&
61 CHECK_ROPSRC(pGC, infoRec->FillSpansSolidFlags) &&
62 CHECK_FG(pGC, infoRec->FillSpansSolidFlags))
63 type = DO_SOLID;
64 else
65 type = (*infoRec->OpaqueStippledFillChooser) (pGC);
66 break;
67 case FillTiled:
68 type = (*infoRec->TiledFillChooser) (pGC);
69 break;
70 }
71
72 switch (type) {
73 case DO_SOLID:
74 function = XAARenderSolidSpans;
75 if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL)
76 fastClip = TRUE;
77 break;
78 case DO_COLOR_8x8:
79 function = XAARenderColor8x8Spans;
80 if (infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL)
81 fastClip = TRUE;
82 break;
83 case DO_MONO_8x8:
84 function = XAARenderMono8x8Spans;
85 if (infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL)
86 fastClip = TRUE;
87 break;
88 case DO_CACHE_BLT:
89 function = XAARenderCacheBltSpans;
90 if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
91 fastClip = TRUE;
92 break;
93 case DO_COLOR_EXPAND:
94 function = XAARenderColorExpandSpans;
95 break;
96 case DO_CACHE_EXPAND:
97 function = XAARenderCacheExpandSpans;
98 if (infoRec->ClippingFlags &
99 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND)
100 fastClip = TRUE;
101 break;
102 case DO_PIXMAP_COPY:
103 function = XAARenderPixmapCopySpans;
104 if (infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
105 fastClip = TRUE;
106 break;
107 case DO_IMAGE_WRITE:
108 default:
109 (*XAAFallbackOps.FillSpans) (pDraw, pGC, nInit, pptInit,
110 pwidthInit, fSorted);
111 return;
112 }
113
114 if ((nInit < 10) || (RegionNumRects(pGC->pCompositeClip) != 1))
115 fastClip = FALSE;
116
117 if (fastClip) {
118 infoRec->ClipBox = &pGC->pCompositeClip->extents;
119 (*function) (pGC, nInit, pptInit, pwidthInit, fSorted,
120 pDraw->x, pDraw->y);
121 infoRec->ClipBox = NULL;
122 }
123 else
124 XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted,
125 function, pDraw->x, pDraw->y);
126}
127
128 /*********************\
129 | Solid Spans |
130 \*********************/
131
132static void
133XAARenderSolidSpans(GCPtr pGC,
134 int n,
135 DDXPointPtr ppt,
136 int *pwidth, int fSorted, int xorg, int yorg)
137{
138 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
139
140 (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel,
141 pGC->alu, pGC->planemask, n, ppt, pwidth,
142 fSorted);
143}
144
145 /************************\
146 | Mono 8x8 Spans |
147 \************************/
148
149static void
150XAARenderMono8x8Spans(GCPtr pGC,
151 int n,
152 DDXPointPtr ppt,
153 int *pwidth, int fSorted, int xorg, int yorg)
154{
155 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
156 XAAPixmapPtr pPriv;
157 int fg, bg;
158
159 switch (pGC->fillStyle) {
160 case FillStippled:
161 pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
162 fg = pGC->fgPixel;
163 bg = -1;
164 break;
165 case FillOpaqueStippled:
166 pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
167 fg = pGC->fgPixel;
168 bg = pGC->bgPixel;
169 break;
170 case FillTiled:
171 pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
172 fg = pPriv->fg;
173 bg = pPriv->bg;
174 break;
175 default: /* Muffle compiler */
176 pPriv = NULL; /* Kaboom */
177 fg = -1;
178 bg = -1;
179 break;
180 }
181
182 (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn,
183 fg, bg, pGC->alu, pGC->planemask,
184 n, ppt, pwidth, fSorted,
185 pPriv->pattern0, pPriv->pattern1,
186 (xorg + pGC->patOrg.x),
187 (yorg + pGC->patOrg.y));
188}
189
190 /*************************\
191 | Color 8x8 Spans |
192 \*************************/
193
194static void
195XAARenderColor8x8Spans(GCPtr pGC,
196 int n,
197 DDXPointPtr ppt,
198 int *pwidth, int fSorted, int xorg, int yorg)
199{
200 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
201 XAACacheInfoPtr pCache;
202 PixmapPtr pPix;
203 int fg, bg;
204
205 switch (pGC->fillStyle) {
206 case FillStippled:
207 pPix = pGC->stipple;
208 fg = pGC->fgPixel;
209 bg = -1;
210 break;
211 case FillOpaqueStippled:
212 pPix = pGC->stipple;
213 fg = pGC->fgPixel;
214 bg = pGC->bgPixel;
215 break;
216 case FillTiled:
217 pPix = pGC->tile.pixmap;
218 fg = -1;
219 bg = -1;
220 break;
221 default: /* Muffle compiler */
222 pPix = NULL;
223 fg = -1;
224 bg = -1;
225 break;
226 }
227
228 pCache = (*infoRec->CacheColor8x8Pattern) (infoRec->pScrn, pPix, fg, bg);
229
230 (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn,
231 pGC->alu, pGC->planemask, n, ppt,
232 pwidth, fSorted, pCache,
233 (yorg + pGC->patOrg.x),
234 (xorg + pGC->patOrg.y));
235}
236
237 /****************************\
238 | Color Expand Spans |
239 \****************************/
240
241static void
242XAARenderColorExpandSpans(GCPtr pGC,
243 int n,
244 DDXPointPtr ppt,
245 int *pwidth, int fSorted, int xorg, int yorg)
246{
247 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
248 int fg, bg;
249
250 switch (pGC->fillStyle) {
251 case FillStippled:
252 fg = pGC->fgPixel;
253 bg = -1;
254 break;
255 case FillOpaqueStippled:
256 fg = pGC->fgPixel;
257 bg = pGC->bgPixel;
258 break;
259 default: /* Muffle compiler */
260 fg = -1;
261 bg = -1;
262 break;
263 }
264
265 (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg,
266 pGC->alu, pGC->planemask, n, ppt, pwidth,
267 fSorted, (xorg + pGC->patOrg.x),
268 (yorg + pGC->patOrg.y), pGC->stipple);
269
270}
271
272 /*************************\
273 | Cache Blt Spans |
274 \*************************/
275
276static void
277XAARenderCacheBltSpans(GCPtr pGC,
278 int n,
279 DDXPointPtr ppt,
280 int *pwidth, int fSorted, int xorg, int yorg)
281{
282 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
283 XAACacheInfoPtr pCache;
284
285 switch (pGC->fillStyle) {
286 case FillStippled:
287 pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
288 pGC->fgPixel, -1);
289 break;
290 case FillOpaqueStippled:
291 pCache = (*infoRec->CacheStipple) (infoRec->pScrn, pGC->stipple,
292 pGC->fgPixel, pGC->bgPixel);
293 break;
294 case FillTiled:
295 pCache = (*infoRec->CacheTile) (infoRec->pScrn, pGC->tile.pixmap);
296 break;
297 default: /* Muffle compiler */
298 pCache = NULL;
299 break;
300 }
301
302 (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
303 pGC->alu, pGC->planemask, n, ppt, pwidth,
304 fSorted, pCache, (xorg + pGC->patOrg.x),
305 (yorg + pGC->patOrg.y));
306
307}
308
309 /****************************\
310 | Cache Expand Spans |
311 \****************************/
312
313static void
314XAARenderCacheExpandSpans(GCPtr pGC,
315 int n,
316 DDXPointPtr ppt,
317 int *pwidth, int fSorted, int xorg, int yorg)
318{
319 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
320 int fg, bg;
321
322 switch (pGC->fillStyle) {
323 case FillStippled:
324 fg = pGC->fgPixel;
325 bg = -1;
326 break;
327 case FillOpaqueStippled:
328 fg = pGC->fgPixel;
329 bg = pGC->bgPixel;
330 break;
331 default: /* Muffle compiler */
332 fg = -1;
333 bg = -1;
334 break;
335 }
336
337 (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg,
338 pGC->alu, pGC->planemask, n, ppt, pwidth,
339 fSorted, (xorg + pGC->patOrg.x),
340 (yorg + pGC->patOrg.y), pGC->stipple);
341}
342
343 /***************************\
344 | Pixmap Copy Spans |
345 \***************************/
346
347static void
348XAARenderPixmapCopySpans(GCPtr pGC,
349 int n,
350 DDXPointPtr ppt,
351 int *pwidth, int fSorted, int xorg, int yorg)
352{
353 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
354 XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
355 XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
356
357 pCache->x = pPriv->offscreenArea->box.x1;
358 pCache->y = pPriv->offscreenArea->box.y1;
359 pCache->w = pCache->orig_w = pPriv->offscreenArea->box.x2 - pCache->x;
360 pCache->h = pCache->orig_h = pPriv->offscreenArea->box.y2 - pCache->y;
361 pCache->trans_color = -1;
362
363 (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
364 pGC->alu, pGC->planemask, n, ppt, pwidth,
365 fSorted, pCache, (xorg + pGC->patOrg.x),
366 (yorg + pGC->patOrg.y));
367}
368
369 /****************\
370 | Solid |
371 \****************/
372
373void
374XAAFillSolidSpans(ScrnInfoPtr pScrn,
375 int fg, int rop,
376 unsigned int planemask,
377 int n, DDXPointPtr ppt, int *pwidth, int fSorted)
378{
379 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
380
381 (*infoRec->SetupForSolidFill) (pScrn, fg, rop, planemask);
382
383 if (infoRec->ClipBox)
384 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
385 infoRec->ClipBox->x1,
386 infoRec->ClipBox->y1,
387 infoRec->ClipBox->x2 - 1,
388 infoRec->ClipBox->y2 - 1);
389
390 while (n--) {
391 if (*pwidth > 0)
392 (*infoRec->SubsequentSolidFillRect) (pScrn, ppt->x, ppt->y,
393 *pwidth, 1);
394 ppt++;
395 pwidth++;
396 }
397
398 if (infoRec->ClipBox)
399 (*infoRec->DisableClipping) (infoRec->pScrn);
400
401 SET_SYNC_FLAG(infoRec);
402}
403
404 /***************\
405 | Mono 8x8 |
406 \***************/
407
408void
409XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
410 int fg, int bg, int rop,
411 unsigned int planemask,
412 int n,
413 DDXPointPtr ppt,
414 int *pwidth, int fSorted,
415 int pattern0, int pattern1,
416 int xorigin, int yorigin)
417{
418 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
419 int patx = pattern0, paty = pattern1;
420 int xorg = (-xorigin) & 0x07;
421 int yorg = (-yorigin) & 0x07;
422
423 if (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
424 if (!(infoRec->Mono8x8PatternFillFlags &
425 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
426 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
427 (infoRec->Mono8x8PatternFillFlags &
428 BIT_ORDER_IN_BYTE_MSBFIRST));
429 xorg = patx;
430 yorg = paty;
431 }
432 }
433 else {
434 XAACacheInfoPtr pCache =
435 (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
436 patx = pCache->x;
437 paty = pCache->y;
438 if (!(infoRec->Mono8x8PatternFillFlags &
439 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
440 int slot = (yorg << 3) + xorg;
441
442 patx += pCache->offsets[slot].x;
443 paty += pCache->offsets[slot].y;
444 xorg = patx;
445 yorg = paty;
446 }
447 }
448
449 (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
450 fg, bg, rop, planemask);
451
452 if (infoRec->ClipBox)
453 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
454 infoRec->ClipBox->x1,
455 infoRec->ClipBox->y1,
456 infoRec->ClipBox->x2 - 1,
457 infoRec->ClipBox->y2 - 1);
458
459 while (n--) {
460 (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
461 xorg, yorg, ppt->x,
462 ppt->y, *pwidth, 1);
463 ppt++;
464 pwidth++;
465 }
466
467 if (infoRec->ClipBox)
468 (*infoRec->DisableClipping) (infoRec->pScrn);
469
470 SET_SYNC_FLAG(infoRec);
471}
472
473void
474XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn,
475 int fg, int bg, int rop,
476 unsigned int planemask,
477 int n,
478 DDXPointPtr ppt,
479 int *pwidth, int fSorted,
480 int pattern0, int pattern1, int xorigin, int yorigin)
481{
482 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
483 int patx = pattern0, paty = pattern1;
484 int xorg, yorg, slot;
485 XAACacheInfoPtr pCache = NULL;
486
487 if (!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)) {
488 pCache = (*infoRec->CacheMono8x8Pattern) (pScrn, pattern0, pattern1);
489 patx = pCache->x;
490 paty = pCache->y;
491 }
492
493 (*infoRec->SetupForMono8x8PatternFill) (pScrn, patx, paty,
494 fg, bg, rop, planemask);
495
496 if (infoRec->ClipBox)
497 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
498 infoRec->ClipBox->x1,
499 infoRec->ClipBox->y1,
500 infoRec->ClipBox->x2 - 1,
501 infoRec->ClipBox->y2 - 1);
502
503 while (n--) {
504 xorg = (ppt->x - xorigin) & 0x07;
505 yorg = (ppt->y - yorigin) & 0x07;
506
507 if (!(infoRec->Mono8x8PatternFillFlags &
508 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
509 if (infoRec->Mono8x8PatternFillFlags &
510 HARDWARE_PATTERN_PROGRAMMED_BITS) {
511 patx = pattern0;
512 paty = pattern1;
513 XAARotateMonoPattern(&patx, &paty, xorg, yorg,
514 (infoRec->Mono8x8PatternFillFlags &
515 BIT_ORDER_IN_BYTE_MSBFIRST));
516 xorg = patx;
517 yorg = paty;
518 }
519 else {
520 slot = (yorg << 3) + xorg;
521 xorg = patx + pCache->offsets[slot].x;
522 yorg = paty + pCache->offsets[slot].y;
523 }
524 }
525
526 (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn,
527 xorg, yorg, ppt->x,
528 ppt->y, *pwidth, 1);
529 ppt++;
530 pwidth++;
531 }
532
533 if (infoRec->ClipBox)
534 (*infoRec->DisableClipping) (infoRec->pScrn);
535
536 SET_SYNC_FLAG(infoRec);
537}
538
539 /****************\
540 | Color 8x8 |
541 \****************/
542
543void
544XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
545 int rop,
546 unsigned int planemask,
547 int n,
548 DDXPointPtr ppt,
549 int *pwidth, int fSorted,
550 XAACacheInfoPtr pCache,
551 int xorigin, int yorigin)
552{
553 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
554 int patx = pCache->x, paty = pCache->y;
555 int xorg = (-xorigin) & 0x07;
556 int yorg = (-yorigin) & 0x07;
557
558 if (!(infoRec->Color8x8PatternFillFlags &
559 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
560 int slot = (yorg << 3) + xorg;
561
562 paty += pCache->offsets[slot].y;
563 patx += pCache->offsets[slot].x;
564 xorg = patx;
565 yorg = paty;
566 }
567
568 (*infoRec->SetupForColor8x8PatternFill) (pScrn, patx, paty,
569 rop, planemask,
570 pCache->trans_color);
571
572 if (infoRec->ClipBox)
573 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
574 infoRec->ClipBox->x1,
575 infoRec->ClipBox->y1,
576 infoRec->ClipBox->x2 - 1,
577 infoRec->ClipBox->y2 - 1);
578
579 while (n--) {
580 (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
581 xorg, yorg, ppt->x,
582 ppt->y, *pwidth, 1);
583 ppt++;
584 pwidth++;
585 }
586
587 if (infoRec->ClipBox)
588 (*infoRec->DisableClipping) (infoRec->pScrn);
589
590 SET_SYNC_FLAG(infoRec);
591}
592
593void
594XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn,
595 int rop,
596 unsigned int planemask,
597 int n,
598 DDXPointPtr ppt,
599 int *pwidth, int fSorted,
600 XAACacheInfoPtr pCache, int xorigin, int yorigin)
601{
602 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
603 int xorg, yorg, slot;
604
605 (*infoRec->SetupForColor8x8PatternFill) (pScrn, pCache->x, pCache->y,
606 rop, planemask,
607 pCache->trans_color);
608
609 if (infoRec->ClipBox)
610 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
611 infoRec->ClipBox->x1,
612 infoRec->ClipBox->y1,
613 infoRec->ClipBox->x2 - 1,
614 infoRec->ClipBox->y2 - 1);
615
616 while (n--) {
617 xorg = (ppt->x - xorigin) & 0x07;
618 yorg = (ppt->y - yorigin) & 0x07;
619
620 if (!(infoRec->Color8x8PatternFillFlags &
621 HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
622 slot = (yorg << 3) + xorg;
623 yorg = pCache->y + pCache->offsets[slot].y;
624 xorg = pCache->x + pCache->offsets[slot].x;
625 }
626
627 (*infoRec->SubsequentColor8x8PatternFillRect) (pScrn,
628 xorg, yorg, ppt->x,
629 ppt->y, *pwidth, 1);
630 ppt++;
631 pwidth++;
632 }
633
634 if (infoRec->ClipBox)
635 (*infoRec->DisableClipping) (infoRec->pScrn);
636
637 SET_SYNC_FLAG(infoRec);
638}
639
640 /*****************\
641 | Cache Blit |
642 \*****************/
643
644void
645XAAFillCacheBltSpans(ScrnInfoPtr pScrn,
646 int rop,
647 unsigned int planemask,
648 int n,
649 DDXPointPtr ppt,
650 int *pwidth,
651 int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg)
652{
653 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
654 int x, w, phaseX, phaseY, blit_w;
655
656 (*infoRec->SetupForScreenToScreenCopy) (pScrn, 1, 1, rop, planemask,
657 pCache->trans_color);
658
659 if (infoRec->ClipBox)
660 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
661 infoRec->ClipBox->x1,
662 infoRec->ClipBox->y1,
663 infoRec->ClipBox->x2 - 1,
664 infoRec->ClipBox->y2 - 1);
665
666 while (n--) {
667 x = ppt->x;
668 w = *pwidth;
669 phaseX = (x - xorg) % pCache->orig_w;
670 if (phaseX < 0)
671 phaseX += pCache->orig_w;
672 phaseY = (ppt->y - yorg) % pCache->orig_h;
673 if (phaseY < 0)
674 phaseY += pCache->orig_h;
675
676 while (1) {
677 blit_w = pCache->w - phaseX;
678 if (blit_w > w)
679 blit_w = w;
680
681 (*infoRec->SubsequentScreenToScreenCopy) (pScrn,
682 pCache->x + phaseX,
683 pCache->y + phaseY, x,
684 ppt->y, blit_w, 1);
685
686 w -= blit_w;
687 if (!w)
688 break;
689 x += blit_w;
690 phaseX = (phaseX + blit_w) % pCache->orig_w;
691 }
692 ppt++;
693 pwidth++;
694 }
695
696 if (infoRec->ClipBox)
697 (*infoRec->DisableClipping) (infoRec->pScrn);
698
699 SET_SYNC_FLAG(infoRec);
700}
701
702 /****************\
703 | Cache Expand |
704 \****************/
705
706void
707XAAFillCacheExpandSpans(ScrnInfoPtr pScrn,
708 int fg, int bg, int rop,
709 unsigned int planemask,
710 int n,
711 DDXPointPtr ppt,
712 int *pwidth,
713 int fSorted, int xorg, int yorg, PixmapPtr pPix)
714{
715 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
716 int x, w, phaseX, phaseY, blit_w, cacheWidth;
717 XAACacheInfoPtr pCache;
718
719 pCache = (*infoRec->CacheMonoStipple) (pScrn, pPix);
720
721 cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
722 infoRec->CacheColorExpandDensity;
723
724 (*infoRec->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop,
725 planemask);
726
727 if (infoRec->ClipBox)
728 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
729 infoRec->ClipBox->x1,
730 infoRec->ClipBox->y1,
731 infoRec->ClipBox->x2 - 1,
732 infoRec->ClipBox->y2 - 1);
733
734 while (n--) {
735 x = ppt->x;
736 w = *pwidth;
737 phaseX = (x - xorg) % pCache->orig_w;
738 if (phaseX < 0)
739 phaseX += pCache->orig_w;
740 phaseY = (ppt->y - yorg) % pCache->orig_h;
741 if (phaseY < 0)
742 phaseY += pCache->orig_h;
743
744 while (1) {
745 blit_w = cacheWidth - phaseX;
746 if (blit_w > w)
747 blit_w = w;
748
749 (*infoRec->SubsequentScreenToScreenColorExpandFill) (pScrn, x,
750 ppt->y, blit_w,
751 1, pCache->x,
752 pCache->y +
753 phaseY,
754 phaseX);
755
756 w -= blit_w;
757 if (!w)
758 break;
759 x += blit_w;
760 phaseX = (phaseX + blit_w) % pCache->orig_w;
761 }
762 ppt++;
763 pwidth++;
764 }
765
766 if (infoRec->ClipBox)
767 (*infoRec->DisableClipping) (infoRec->pScrn);
768
769 SET_SYNC_FLAG(infoRec);
770}
771
772void
773XAAClipAndRenderSpans(GCPtr pGC,
774 DDXPointPtr ppt,
775 int *pwidth,
776 int nspans,
777 int fSorted,
778 ClipAndRenderSpansFunc func, int xorg, int yorg)
779{
780 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
781 DDXPointPtr pptNew, pptBase;
782 int *pwidthBase, *pwidthNew;
783 int Right, numRects, MaxBoxes;
784
785 MaxBoxes = infoRec->PreAllocSize / (sizeof(DDXPointRec) + sizeof(int));
786 pptBase = (DDXPointRec *) infoRec->PreAllocMem;
787 pwidthBase = (int *) (&pptBase[MaxBoxes]);
788
789 pptNew = pptBase;
790 pwidthNew = pwidthBase;
791
792 numRects = RegionNumRects(pGC->pCompositeClip);
793
794 if (numRects == 1) {
795 BoxPtr pextent = RegionRects(pGC->pCompositeClip);
796
797 while (nspans--) {
798 if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) {
799 pptNew->x = max(pextent->x1, ppt->x);
800 Right = ppt->x + *pwidth;
801 *pwidthNew = min(pextent->x2, Right) - pptNew->x;
802
803 if (*pwidthNew > 0) {
804 pptNew->y = ppt->y;
805 pptNew++;
806 pwidthNew++;
807
808 if (pptNew >= (pptBase + MaxBoxes)) {
809 (*func) (pGC, MaxBoxes, pptBase, pwidthBase, fSorted,
810 xorg, yorg);
811 pptNew = pptBase;
812 pwidthNew = pwidthBase;
813 }
814 }
815 }
816 ppt++;
817 pwidth++;
818 }
819 }
820 else if (numRects) {
821 BoxPtr pbox;
822 int nbox;
823
824 while (nspans--) {
825 nbox = numRects;
826 pbox = RegionRects(pGC->pCompositeClip);
827
828 /* find the first band */
829 while (nbox && (pbox->y2 <= ppt->y)) {
830 pbox++;
831 nbox--;
832 }
833
834 if (nbox && (pbox->y1 <= ppt->y)) {
835 int orig_y = pbox->y1;
836
837 Right = ppt->x + *pwidth;
838 while (nbox && (orig_y == pbox->y1)) {
839 if (pbox->x2 <= ppt->x) {
840 nbox--;
841 pbox++;
842 continue;
843 }
844
845 if (pbox->x1 >= Right) {
846 nbox = 0;
847 break;
848 }
849
850 pptNew->x = max(pbox->x1, ppt->x);
851 *pwidthNew = min(pbox->x2, Right) - pptNew->x;
852 if (*pwidthNew > 0) {
853 pptNew->y = ppt->y;
854 pptNew++;
855 pwidthNew++;
856
857 if (pptNew >= (pptBase + MaxBoxes)) {
858 (*func) (pGC, MaxBoxes, pptBase, pwidthBase,
859 fSorted, xorg, yorg);
860 pptNew = pptBase;
861 pwidthNew = pwidthBase;
862 }
863 }
864 pbox++;
865 nbox--;
866 }
867 }
868 ppt++;
869 pwidth++;
870 }
871 }
872
873 if (pptNew != pptBase)
874 (*func) (pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted,
875 xorg, yorg);
876}
diff --git a/hw/xfree86/xaa/xaaStateChange.c b/hw/xfree86/xaa/xaaStateChange.c
deleted file mode 100644
index cd2b601c4..000000000
--- a/hw/xfree86/xaa/xaaStateChange.c
+++ /dev/null
@@ -1,1665 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "misc.h"
7#include "xf86.h"
8#include "xf86_OSproc.h"
9
10#include <X11/X.h>
11#include "scrnintstr.h"
12#include "pixmapstr.h"
13#include "windowstr.h"
14#include "xf86str.h"
15#include "mi.h"
16#include "miline.h"
17#include "xaa.h"
18#include "xaalocal.h"
19#include "xaawrap.h"
20#include "servermd.h"
21
22#define XAA_STATE_WRAP(func) do {\
23if(infoRec->func) { \
24 pStatePriv->func = infoRec->func;\
25 infoRec->func = XAAStateWrap##func;\
26}} while(0)
27
28/* Wrap all XAA functions and allocate our private structure.
29 */
30
31typedef struct _XAAStateWrapRec {
32 ScrnInfoPtr pScrn;
33 void (*RestoreAccelState) (ScrnInfoPtr pScrn);
34 void (*Sync) (ScrnInfoPtr pScrn);
35 void (*SetupForScreenToScreenCopy) (ScrnInfoPtr pScrn, int xdir, int ydir,
36 int rop, unsigned int planemask,
37 int trans_color);
38 void (*SetupForSolidFill) (ScrnInfoPtr pScrn, int color, int rop,
39 unsigned int planemask);
40 void (*SetupForSolidLine) (ScrnInfoPtr pScrn, int color, int rop,
41 unsigned int planemask);
42 void (*SetupForDashedLine) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
43 unsigned int planemask, int length,
44 unsigned char *pattern);
45 void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top,
46 int right, int bottom);
47 void (*DisableClipping) (ScrnInfoPtr pScrn);
48 void (*SetupForMono8x8PatternFill) (ScrnInfoPtr pScrn, int patx, int paty,
49 int fg, int bg, int rop,
50 unsigned int planemask);
51 void (*SetupForColor8x8PatternFill) (ScrnInfoPtr pScrn, int patx, int paty,
52 int rop, unsigned int planemask,
53 int transparency_color);
54 void (*SetupForCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn, int fg,
55 int bg, int rop,
56 unsigned int planemask);
57 void (*SetupForScanlineCPUToScreenColorExpandFill) (ScrnInfoPtr pScrn,
58 int fg, int bg, int rop,
59 unsigned int planemask);
60 void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
61 int fg, int bg, int rop,
62 unsigned int planemask);
63 void (*SetupForImageWrite) (ScrnInfoPtr pScrn, int rop,
64 unsigned int planemask, int transparency_color,
65 int bpp, int depth);
66 void (*SetupForScanlineImageWrite) (ScrnInfoPtr pScrn, int rop,
67 unsigned int planemask,
68 int transparency_color,
69 int bpp, int depth);
70 void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
71 void (*ScreenToScreenBitBlt) (ScrnInfoPtr pScrn, int nbox,
72 DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
73 int ydir, int alu, unsigned int planmask);
74 void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
75 unsigned char *src, int srcwidth, int skipleft,
76 int fg, int bg, int rop, unsigned int planemask);
77 void (*FillSolidRects) (ScrnInfoPtr pScrn, int fg, int rop,
78 unsigned int planemask, int nBox, BoxPtr pBox);
79 void (*FillMono8x8PatternRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
80 unsigned int planemask, int nBox,
81 BoxPtr pBox, int pat0, int pat1,
82 int xorg, int yorg);
83 void (*FillColor8x8PatternRects) (ScrnInfoPtr pScrn, int rop,
84 unsigned int planemask, int nBox,
85 BoxPtr pBox, int xorg, int yorg,
86 XAACacheInfoPtr pCache);
87 void (*FillCacheBltRects) (ScrnInfoPtr pScrn, int rop,
88 unsigned int planemask, int nBox, BoxPtr pBox,
89 int xorg, int yorg, XAACacheInfoPtr pCache);
90 void (*FillColorExpandRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
91 unsigned int planemask, int nBox,
92 BoxPtr pBox, int xorg, int yorg,
93 PixmapPtr pPix);
94 void (*FillCacheExpandRects) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
95 unsigned int planemask, int nBox, BoxPtr pBox,
96 int xorg, int yorg, PixmapPtr pPix);
97 void (*FillImageWriteRects) (ScrnInfoPtr pScrn, int rop,
98 unsigned int planemask, int nBox, BoxPtr pBox,
99 int xorg, int yorg, PixmapPtr pPix);
100 void (*FillSolidSpans) (ScrnInfoPtr pScrn, int fg, int rop,
101 unsigned int planemask, int n, DDXPointPtr points,
102 int *widths, int fSorted);
103 void (*FillMono8x8PatternSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
104 unsigned int planemask, int n,
105 DDXPointPtr points, int *widths,
106 int fSorted, int pat0, int pat1,
107 int xorg, int yorg);
108 void (*FillColor8x8PatternSpans) (ScrnInfoPtr pScrn, int rop,
109 unsigned int planemask, int n,
110 DDXPointPtr points, int *widths,
111 int fSorted, XAACacheInfoPtr pCache,
112 int xorg, int yorg);
113 void (*FillCacheBltSpans) (ScrnInfoPtr pScrn, int rop,
114 unsigned int planemask, int n,
115 DDXPointPtr points, int *widths, int fSorted,
116 XAACacheInfoPtr pCache, int xorg, int yorg);
117 void (*FillColorExpandSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
118 unsigned int planemask, int n,
119 DDXPointPtr points, int *widths, int fSorted,
120 int xorg, int yorg, PixmapPtr pPix);
121 void (*FillCacheExpandSpans) (ScrnInfoPtr pScrn, int fg, int bg, int rop,
122 unsigned int planemask, int n,
123 DDXPointPtr ppt, int *pwidth, int fSorted,
124 int xorg, int yorg, PixmapPtr pPix);
125 void (*TEGlyphRenderer) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
126 int skipleft, int startline, unsigned int **glyphs,
127 int glyphWidth, int fg, int bg, int rop,
128 unsigned planemask);
129 void (*NonTEGlyphRenderer) (ScrnInfoPtr pScrn, int x, int y, int n,
130 NonTEGlyphPtr glyphs, BoxPtr pbox, int fg,
131 int rop, unsigned int planemask);
132 void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
133 unsigned char *src, int srcwidth, int rop,
134 unsigned int planemask, int transparency_color,
135 int bpp, int depth);
136 void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
137 unsigned char *dst, int dstwidth, int bpp, int depth);
138 RegionPtr (*CopyArea) (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
139 GC * pGC, int srcx, int srcy, int width, int height,
140 int dstx, int dsty);
141 RegionPtr (*CopyPlane) (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
142 int srcx, int srcy, int width, int height, int dstx,
143 int dsty, unsigned long bitPlane);
144 void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap,
145 DrawablePtr pDrawable, int dx, int dy, int xOrg,
146 int yOrg);
147 void (*PolyFillRectSolid) (DrawablePtr pDraw, GCPtr pGC, int nrectFill,
148 xRectangle *prectInit);
149 void (*PolyFillRectStippled) (DrawablePtr pDraw, GCPtr pGC, int nrectFill,
150 xRectangle *prectInit);
151 void (*PolyFillRectOpaqueStippled) (DrawablePtr pDraw, GCPtr pGC,
152 int nrectFill, xRectangle *prectInit);
153 void (*PolyFillRectTiled) (DrawablePtr pDraw, GCPtr pGC, int nrectFill,
154 xRectangle *prectInit);
155 void (*FillSpansSolid) (DrawablePtr pDraw, GCPtr pGC, int nInit,
156 DDXPointPtr ppt, int *pwidth, int fSorted);
157 void (*FillSpansStippled) (DrawablePtr pDraw, GCPtr pGC, int nInit,
158 DDXPointPtr ppt, int *pwidth, int fSorted);
159 void (*FillSpansOpaqueStippled) (DrawablePtr pDraw, GCPtr pGC, int nInit,
160 DDXPointPtr ppt, int *pwidth, int fSorted);
161 void (*FillSpansTiled) (DrawablePtr pDraw, GCPtr pGC, int nInit,
162 DDXPointPtr ppt, int *pwidth, int fSorted);
163 int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
164 char *chars);
165 int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
166 unsigned short *chars);
167 void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
168 char *chars);
169 void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
170 int count, unsigned short *chars);
171 void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
172 int yInit, unsigned int nglyph, CharInfoPtr * ppci,
173 pointer pglyphBase);
174 void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
175 int yInit, unsigned int nglyph, CharInfoPtr * ppci,
176 pointer pglyphBase);
177 int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
178 int count, char *chars);
179 int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
180 int count, unsigned short *chars);
181 void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
182 int count, char *chars);
183 void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
184 int count, unsigned short *chars);
185 void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
186 int yInit, unsigned int nglyph,
187 CharInfoPtr * ppci, pointer pglyphBase);
188 void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
189 int yInit, unsigned int nglyph,
190 CharInfoPtr * ppci, pointer pglyphBase);
191 void (*PolyRectangleThinSolid) (DrawablePtr pDrawable, GCPtr pGC,
192 int nRectsInit, xRectangle *pRectsInit);
193 void (*PolylinesWideSolid) (DrawablePtr pDrawable, GCPtr pGC, int mode,
194 int npt, DDXPointPtr pPts);
195 void (*PolylinesThinSolid) (DrawablePtr pDrawable, GCPtr pGC, int mode,
196 int npt, DDXPointPtr pPts);
197 void (*PolySegmentThinSolid) (DrawablePtr pDrawable, GCPtr pGC, int nseg,
198 xSegment * pSeg);
199 void (*PolylinesThinDashed) (DrawablePtr pDrawable, GCPtr pGC, int mode,
200 int npt, DDXPointPtr pPts);
201 void (*PolySegmentThinDashed) (DrawablePtr pDrawable, GCPtr pGC, int nseg,
202 xSegment * pSeg);
203 void (*FillPolygonSolid) (DrawablePtr pDrawable, GCPtr pGC, int shape,
204 int mode, int count, DDXPointPtr ptsIn);
205 void (*FillPolygonStippled) (DrawablePtr pDrawable, GCPtr pGC, int shape,
206 int mode, int count, DDXPointPtr ptsIn);
207 void (*FillPolygonOpaqueStippled) (DrawablePtr pDrawable, GCPtr pGC,
208 int shape, int mode, int count,
209 DDXPointPtr ptsIn);
210 void (*FillPolygonTiled) (DrawablePtr pDrawable, GCPtr pGC, int shape,
211 int mode, int count, DDXPointPtr ptsIn);
212 void (*PolyFillArcSolid) (DrawablePtr pDraw, GCPtr pGC, int narcs,
213 xArc * parcs);
214 void (*PutImage) (DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
215 int w, int h, int leftPad, int format, char *pImage);
216 ValidateGCProcPtr ValidateFillSpans;
217 ValidateGCProcPtr ValidateSetSpans;
218 ValidateGCProcPtr ValidatePutImage;
219 ValidateGCProcPtr ValidateCopyArea;
220 ValidateGCProcPtr ValidateCopyPlane;
221 ValidateGCProcPtr ValidatePolyPoint;
222 ValidateGCProcPtr ValidatePolylines;
223 ValidateGCProcPtr ValidatePolySegment;
224 ValidateGCProcPtr ValidatePolyRectangle;
225 ValidateGCProcPtr ValidatePolyArc;
226 ValidateGCProcPtr ValidateFillPolygon;
227 ValidateGCProcPtr ValidatePolyFillRect;
228 ValidateGCProcPtr ValidatePolyFillArc;
229 ValidateGCProcPtr ValidatePolyText8;
230 ValidateGCProcPtr ValidatePolyText16;
231 ValidateGCProcPtr ValidateImageText8;
232 ValidateGCProcPtr ValidateImageText16;
233 ValidateGCProcPtr ValidatePolyGlyphBlt;
234 ValidateGCProcPtr ValidateImageGlyphBlt;
235 ValidateGCProcPtr ValidatePushPixels;
236 void (*ComputeDash) (GCPtr pGC);
237 void (*InitPixmapCache) (ScreenPtr pScreen, RegionPtr areas, pointer data);
238 void (*ClosePixmapCache) (ScreenPtr pScreen);
239 int (*StippledFillChooser) (GCPtr pGC);
240 int (*OpaqueStippledFillChooser) (GCPtr pGC);
241 int (*TiledFillChooser) (GCPtr pGC);
242 XAACacheInfoPtr(*CacheTile) (ScrnInfoPtr Scrn, PixmapPtr pPix);
243 XAACacheInfoPtr(*CacheStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix, int fg,
244 int bg);
245 XAACacheInfoPtr(*CacheMonoStipple) (ScrnInfoPtr Scrn, PixmapPtr pPix);
246 XAACacheInfoPtr(*CacheMono8x8Pattern) (ScrnInfoPtr Scrn, int pat0,
247 int pat1);
248 XAACacheInfoPtr(*CacheColor8x8Pattern) (ScrnInfoPtr Scrn, PixmapPtr pPix,
249 int fg, int bg);
250 void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
251 unsigned char *src, int srcwidth, int fg,
252 int bg);
253 void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
254 unsigned char *src, int srcwidth, int bpp,
255 int depth);
256 void (*WriteMono8x8PatternToCache) (ScrnInfoPtr pScrn,
257 XAACacheInfoPtr pCache);
258 void (*WriteColor8x8PatternToCache) (ScrnInfoPtr pScrn, PixmapPtr pPix,
259 XAACacheInfoPtr pCache);
260 GetImageProcPtr GetImage;
261 GetSpansProcPtr GetSpans;
262 CopyWindowProcPtr CopyWindow;
263 Bool (*SetupForCPUToScreenAlphaTexture2) (ScrnInfoPtr pScrn, int op,
264 CARD16 red, CARD16 green,
265 CARD16 blue, CARD16 alpha,
266 CARD32 maskFormat,
267 CARD32 dstFormat, CARD8 *alphaPtr,
268 int alphaPitch, int width,
269 int height, int flags);
270 Bool (*SetupForCPUToScreenTexture2) (ScrnInfoPtr pScrn, int op,
271 CARD32 srcFormat, CARD32 dstFormat,
272 CARD8 *texPtr, int texPitch, int width,
273 int height, int flags);
274} XAAStateWrapRec, *XAAStateWrapPtr;
275
276static DevPrivateKeyRec XAAStateKeyRec;
277
278#define XAAStateKey (&XAAStateKeyRec)
279
280/* Wrap functions start here */
281#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
282(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
283
284#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
285(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
286
287#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
288(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
289
290#define STATE_CHECK_SP(pStatePriv) {\
291 ScrnInfoPtr pScrn = pStatePriv->pScrn;\
292 int i = 0;\
293 int need_change = 0;\
294 while(i < pScrn->numEntities) {\
295 if(xf86IsEntityShared(pScrn->entityList[i]) &&\
296 xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
297 need_change = 1;\
298 xf86SetLastScrnFlag(pScrn->entityList[i],\
299 pScrn->scrnIndex);\
300 }\
301 i++;\
302 }\
303 if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
304}
305
306#define STATE_CHECK_PSCRN(pScrn) {\
307 int i = 0;\
308 int need_change = 0;\
309 while(i < pScrn->numEntities) {\
310 if(xf86IsEntityShared(pScrn->entityList[i]) &&\
311 xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
312 need_change = 1;\
313 xf86SetLastScrnFlag(pScrn->entityList[i],\
314 pScrn->scrnIndex);\
315 }\
316 i++;\
317 }\
318 if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
319}
320
321static void
322XAAStateWrapSync(ScrnInfoPtr pScrn)
323{
324 GET_STATEPRIV_PSCRN(pScrn);
325 STATE_CHECK_PSCRN(pScrn);
326
327 (*pStatePriv->Sync) (pScrn);
328}
329
330static void
331XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
332 int rop, unsigned int planemask,
333 int trans_color)
334{
335 GET_STATEPRIV_PSCRN(pScrn);
336 STATE_CHECK_PSCRN(pScrn);
337
338 (*pStatePriv->SetupForScreenToScreenCopy) (pScrn, xdir, ydir, rop,
339 planemask, trans_color);
340}
341
342static void
343XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
344 unsigned int planemask)
345{
346 GET_STATEPRIV_PSCRN(pScrn);
347 STATE_CHECK_PSCRN(pScrn);
348
349 (*pStatePriv->SetupForSolidFill) (pScrn, color, rop, planemask);
350}
351
352static void
353XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
354 unsigned int planemask)
355{
356 GET_STATEPRIV_PSCRN(pScrn);
357 STATE_CHECK_PSCRN(pScrn);
358
359 (*pStatePriv->SetupForSolidLine) (pScrn, color, rop, planemask);
360}
361
362static void
363XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
364 unsigned int planemask, int length,
365 unsigned char *pattern)
366{
367 GET_STATEPRIV_PSCRN(pScrn);
368 STATE_CHECK_PSCRN(pScrn);
369
370 (*pStatePriv->SetupForDashedLine) (pScrn, fg, bg, rop, planemask, length,
371 pattern);
372}
373
374static void
375XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top,
376 int right, int bottom)
377{
378 GET_STATEPRIV_PSCRN(pScrn);
379 STATE_CHECK_PSCRN(pScrn);
380
381 (*pStatePriv->SetClippingRectangle) (pScrn, left, top, right, bottom);
382}
383
384static void
385XAAStateWrapDisableClipping(ScrnInfoPtr pScrn)
386{
387 GET_STATEPRIV_PSCRN(pScrn);
388 STATE_CHECK_PSCRN(pScrn);
389
390 (*pStatePriv->DisableClipping) (pScrn);
391}
392
393static void
394XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
395 int fg, int bg, int rop,
396 unsigned int planemask)
397{
398 GET_STATEPRIV_PSCRN(pScrn);
399 STATE_CHECK_PSCRN(pScrn);
400
401 (*pStatePriv->SetupForMono8x8PatternFill) (pScrn, patx, paty, fg, bg, rop,
402 planemask);
403}
404
405static void
406XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
407 int rop, unsigned int planemask,
408 int transparency_color)
409{
410 GET_STATEPRIV_PSCRN(pScrn);
411 STATE_CHECK_PSCRN(pScrn);
412
413 (*pStatePriv->SetupForColor8x8PatternFill) (pScrn, patx, paty, rop,
414 planemask, transparency_color);
415}
416
417static void
418XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg,
419 int bg, int rop,
420 unsigned int planemask)
421{
422 GET_STATEPRIV_PSCRN(pScrn);
423 STATE_CHECK_PSCRN(pScrn);
424
425 (*pStatePriv->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
426 planemask);
427}
428
429static void
430XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
431 int fg, int bg,
432 int rop,
433 unsigned int planemask)
434{
435 GET_STATEPRIV_PSCRN(pScrn);
436 STATE_CHECK_PSCRN(pScrn);
437
438 (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg,
439 rop, planemask);
440}
441
442static void
443XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
444 int fg, int bg, int rop,
445 unsigned int planemask)
446{
447 GET_STATEPRIV_PSCRN(pScrn);
448 STATE_CHECK_PSCRN(pScrn);
449
450 (*pStatePriv->SetupForScreenToScreenColorExpandFill) (pScrn, fg, bg, rop,
451 planemask);
452}
453
454static void
455XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
456 unsigned int planemask, int transparency_color,
457 int bpp, int depth)
458{
459 GET_STATEPRIV_PSCRN(pScrn);
460 STATE_CHECK_PSCRN(pScrn);
461
462 (*pStatePriv->SetupForImageWrite) (pScrn, rop, planemask,
463 transparency_color, bpp, depth);
464}
465
466static void
467XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
468 unsigned int planemask,
469 int transparency_color,
470 int bpp, int depth)
471{
472 GET_STATEPRIV_PSCRN(pScrn);
473 STATE_CHECK_PSCRN(pScrn);
474
475 (*pStatePriv->SetupForScanlineImageWrite) (pScrn, rop, planemask,
476 transparency_color, bpp, depth);
477}
478
479static void
480XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth)
481{
482 GET_STATEPRIV_PSCRN(pScrn);
483 STATE_CHECK_PSCRN(pScrn);
484
485 (*pStatePriv->SetupForImageRead) (pScrn, bpp, depth);
486}
487
488static void
489XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
490 DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
491 int ydir, int alu, unsigned int planmask)
492{
493 GET_STATEPRIV_PSCRN(pScrn);
494 STATE_CHECK_PSCRN(pScrn);
495
496 (*pStatePriv->ScreenToScreenBitBlt) (pScrn, nbox,
497 pptSrc, pbox, xdir,
498 ydir, alu, planmask);
499}
500
501static void
502XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
503 unsigned char *src, int srcwidth, int skipleft,
504 int fg, int bg, int rop, unsigned int planemask)
505{
506 GET_STATEPRIV_PSCRN(pScrn);
507 STATE_CHECK_PSCRN(pScrn);
508
509 (*pStatePriv->WriteBitmap) (pScrn, x, y, w, h,
510 src, srcwidth, skipleft,
511 fg, bg, rop, planemask);
512}
513
514static void
515XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
516 unsigned int planemask, int nBox, BoxPtr pBox)
517{
518 GET_STATEPRIV_PSCRN(pScrn);
519 STATE_CHECK_PSCRN(pScrn);
520
521 (*pStatePriv->FillSolidRects) (pScrn, fg, rop, planemask, nBox, pBox);
522}
523
524static void
525XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg,
526 int rop, unsigned int planemask, int nBox,
527 BoxPtr pBox, int pat0, int pat1,
528 int xorg, int yorg)
529{
530 GET_STATEPRIV_PSCRN(pScrn);
531 STATE_CHECK_PSCRN(pScrn);
532
533 (*pStatePriv->FillMono8x8PatternRects) (pScrn, fg, bg,
534 rop, planemask, nBox,
535 pBox, pat0, pat1, xorg, yorg);
536}
537
538static void
539XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop,
540 unsigned int planemask, int nBox,
541 BoxPtr pBox, int xorg, int yorg,
542 XAACacheInfoPtr pCache)
543{
544 GET_STATEPRIV_PSCRN(pScrn);
545 STATE_CHECK_PSCRN(pScrn);
546
547 (*pStatePriv->FillColor8x8PatternRects) (pScrn, rop,
548 planemask, nBox,
549 pBox, xorg, yorg, pCache);
550}
551
552static void
553XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop,
554 unsigned int planemask, int nBox, BoxPtr pBox,
555 int xorg, int yorg, XAACacheInfoPtr pCache)
556{
557 GET_STATEPRIV_PSCRN(pScrn);
558 STATE_CHECK_PSCRN(pScrn);
559
560 (*pStatePriv->FillCacheBltRects) (pScrn, rop,
561 planemask, nBox, pBox,
562 xorg, yorg, pCache);
563}
564
565static void
566XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
567 unsigned int planemask, int nBox,
568 BoxPtr pBox, int xorg, int yorg,
569 PixmapPtr pPix)
570{
571 GET_STATEPRIV_PSCRN(pScrn);
572 STATE_CHECK_PSCRN(pScrn);
573
574 (*pStatePriv->FillColorExpandRects) (pScrn, fg, bg, rop,
575 planemask, nBox,
576 pBox, xorg, yorg, pPix);
577}
578
579static void
580XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
581 unsigned int planemask, int nBox,
582 BoxPtr pBox, int xorg, int yorg,
583 PixmapPtr pPix)
584{
585 GET_STATEPRIV_PSCRN(pScrn);
586 STATE_CHECK_PSCRN(pScrn);
587
588 (*pStatePriv->FillCacheExpandRects) (pScrn, fg, bg, rop,
589 planemask, nBox,
590 pBox, xorg, yorg, pPix);
591}
592
593static void
594XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop,
595 unsigned int planemask, int nBox, BoxPtr pBox,
596 int xorg, int yorg, PixmapPtr pPix)
597{
598 GET_STATEPRIV_PSCRN(pScrn);
599 STATE_CHECK_PSCRN(pScrn);
600
601 (*pStatePriv->FillImageWriteRects) (pScrn, rop,
602 planemask, nBox, pBox,
603 xorg, yorg, pPix);
604}
605
606static void
607XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop,
608 unsigned int planemask, int n, DDXPointPtr points,
609 int *widths, int fSorted)
610{
611 GET_STATEPRIV_PSCRN(pScrn);
612 STATE_CHECK_PSCRN(pScrn);
613
614 (*pStatePriv->FillSolidSpans) (pScrn, fg, rop,
615 planemask, n, points, widths, fSorted);
616}
617
618static void
619XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg,
620 int rop, unsigned int planemask, int n,
621 DDXPointPtr points, int *widths,
622 int fSorted, int pat0, int pat1,
623 int xorg, int yorg)
624{
625 GET_STATEPRIV_PSCRN(pScrn);
626 STATE_CHECK_PSCRN(pScrn);
627
628 (*pStatePriv->FillMono8x8PatternSpans) (pScrn, fg, bg,
629 rop, planemask, n,
630 points, widths,
631 fSorted, pat0, pat1, xorg, yorg);
632}
633
634static void
635XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop,
636 unsigned int planemask, int n,
637 DDXPointPtr points, int *widths,
638 int fSorted, XAACacheInfoPtr pCache,
639 int xorg, int yorg)
640{
641 GET_STATEPRIV_PSCRN(pScrn);
642 STATE_CHECK_PSCRN(pScrn);
643
644 (*pStatePriv->FillColor8x8PatternSpans) (pScrn, rop,
645 planemask, n,
646 points, widths,
647 fSorted, pCache, xorg, yorg);
648}
649
650static void
651XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop,
652 unsigned int planemask, int n,
653 DDXPointPtr points, int *widths,
654 int fSorted, XAACacheInfoPtr pCache,
655 int xorg, int yorg)
656{
657 GET_STATEPRIV_PSCRN(pScrn);
658 STATE_CHECK_PSCRN(pScrn);
659
660 (*pStatePriv->FillCacheBltSpans) (pScrn, rop,
661 planemask, n,
662 points, widths,
663 fSorted, pCache, xorg, yorg);
664}
665
666static void
667XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
668 unsigned int planemask, int n,
669 DDXPointPtr points, int *widths, int fSorted,
670 int xorg, int yorg, PixmapPtr pPix)
671{
672 GET_STATEPRIV_PSCRN(pScrn);
673 STATE_CHECK_PSCRN(pScrn);
674
675 (*pStatePriv->FillColorExpandSpans) (pScrn, fg, bg, rop,
676 planemask, n,
677 points, widths, fSorted,
678 xorg, yorg, pPix);
679}
680
681static void
682XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
683 unsigned int planemask, int n,
684 DDXPointPtr ppt, int *pwidth, int fSorted,
685 int xorg, int yorg, PixmapPtr pPix)
686{
687 GET_STATEPRIV_PSCRN(pScrn);
688 STATE_CHECK_PSCRN(pScrn);
689
690 (*pStatePriv->FillCacheExpandSpans) (pScrn, fg, bg, rop,
691 planemask, n,
692 ppt, pwidth, fSorted,
693 xorg, yorg, pPix);
694}
695
696static void
697XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h,
698 int skipleft, int startline,
699 unsigned int **glyphs,
700 int glyphWidth, int fg, int bg, int rop,
701 unsigned planemask)
702{
703 GET_STATEPRIV_PSCRN(pScrn);
704 STATE_CHECK_PSCRN(pScrn);
705
706 (*pStatePriv->TEGlyphRenderer) (pScrn, x, y, w, h,
707 skipleft, startline,
708 glyphs, glyphWidth, fg, bg, rop, planemask);
709}
710
711static void
712XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
713 NonTEGlyphPtr glyphs, BoxPtr pbox,
714 int fg, int rop, unsigned int planemask)
715{
716 GET_STATEPRIV_PSCRN(pScrn);
717 STATE_CHECK_PSCRN(pScrn);
718
719 (*pStatePriv->NonTEGlyphRenderer) (pScrn, x, y, n,
720 glyphs, pbox, fg, rop, planemask);
721}
722
723static void
724XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
725 unsigned char *src, int srcwidth, int rop,
726 unsigned int planemask, int transparency_color,
727 int bpp, int depth)
728{
729 GET_STATEPRIV_PSCRN(pScrn);
730 STATE_CHECK_PSCRN(pScrn);
731
732 (*pStatePriv->WritePixmap) (pScrn, x, y, w, h,
733 src, srcwidth, rop,
734 planemask, transparency_color, bpp, depth);
735}
736
737static void
738XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
739 unsigned char *dst, int dstwidth, int bpp, int depth)
740{
741 GET_STATEPRIV_PSCRN(pScrn);
742 STATE_CHECK_PSCRN(pScrn);
743
744 (*pStatePriv->ReadPixmap) (pScrn, x, y, w, h, dst, dstwidth, bpp, depth);
745}
746
747static RegionPtr
748XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
749 GC * pGC, int srcx, int srcy, int width, int height,
750 int dstx, int dsty)
751{
752 GET_STATEPRIV_GC(pGC);
753 STATE_CHECK_SP(pStatePriv);
754
755 return (*pStatePriv->CopyArea) (pSrcDrawable, pDstDrawable,
756 pGC, srcx, srcy, width, height, dstx, dsty);
757}
758
759static RegionPtr
760XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
761 int srcx, int srcy, int width, int height,
762 int dstx, int dsty, unsigned long bitPlane)
763{
764 GET_STATEPRIV_GC(pGC);
765 STATE_CHECK_SP(pStatePriv);
766
767 return (*pStatePriv->CopyPlane) (pSrc, pDst, pGC,
768 srcx, srcy, width, height,
769 dstx, dsty, bitPlane);
770}
771
772static void
773XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap,
774 DrawablePtr pDrawable, int dx, int dy, int xOrg,
775 int yOrg)
776{
777 GET_STATEPRIV_GC(pGC);
778 STATE_CHECK_SP(pStatePriv);
779
780 (*pStatePriv->PushPixelsSolid) (pGC, pBitMap,
781 pDrawable, dx, dy, xOrg, yOrg);
782}
783
784static void
785XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
786 xRectangle *prectInit)
787{
788 GET_STATEPRIV_GC(pGC);
789 STATE_CHECK_SP(pStatePriv);
790
791 (*pStatePriv->PolyFillRectSolid) (pDraw, pGC, nrectFill, prectInit);
792}
793
794static void
795XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
796 xRectangle *prectInit)
797{
798 GET_STATEPRIV_GC(pGC);
799 STATE_CHECK_SP(pStatePriv);
800
801 (*pStatePriv->PolyFillRectStippled) (pDraw, pGC, nrectFill, prectInit);
802}
803
804static void
805XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC,
806 int nrectFill, xRectangle *prectInit)
807{
808 GET_STATEPRIV_GC(pGC);
809 STATE_CHECK_SP(pStatePriv);
810
811 (*pStatePriv->PolyFillRectOpaqueStippled) (pDraw, pGC,
812 nrectFill, prectInit);
813}
814
815static void
816XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
817 xRectangle *prectInit)
818{
819 GET_STATEPRIV_GC(pGC);
820 STATE_CHECK_SP(pStatePriv);
821
822 (*pStatePriv->PolyFillRectTiled) (pDraw, pGC, nrectFill, prectInit);
823}
824
825static void
826XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit,
827 DDXPointPtr ppt, int *pwidth, int fSorted)
828{
829 GET_STATEPRIV_GC(pGC);
830 STATE_CHECK_SP(pStatePriv);
831
832 (*pStatePriv->FillSpansSolid) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
833}
834
835static void
836XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
837 DDXPointPtr ppt, int *pwidth, int fSorted)
838{
839 GET_STATEPRIV_GC(pGC);
840 STATE_CHECK_SP(pStatePriv);
841
842 (*pStatePriv->FillSpansStippled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
843}
844
845static void
846XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
847 DDXPointPtr ppt, int *pwidth, int fSorted)
848{
849 GET_STATEPRIV_GC(pGC);
850 STATE_CHECK_SP(pStatePriv);
851
852 (*pStatePriv->FillSpansOpaqueStippled) (pDraw, pGC, nInit,
853 ppt, pwidth, fSorted);
854}
855
856static void
857XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit,
858 DDXPointPtr ppt, int *pwidth, int fSorted)
859{
860 GET_STATEPRIV_GC(pGC);
861 STATE_CHECK_SP(pStatePriv);
862
863 (*pStatePriv->FillSpansTiled) (pDraw, pGC, nInit, ppt, pwidth, fSorted);
864}
865
866static int
867XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
868 char *chars)
869{
870 GET_STATEPRIV_GC(pGC);
871 STATE_CHECK_SP(pStatePriv);
872
873 return (*pStatePriv->PolyText8TE) (pDraw, pGC, x, y, count, chars);
874}
875
876static int
877XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
878 unsigned short *chars)
879{
880 GET_STATEPRIV_GC(pGC);
881 STATE_CHECK_SP(pStatePriv);
882
883 return (*pStatePriv->PolyText16TE) (pDraw, pGC, x, y, count, chars);
884}
885
886static void
887XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
888 int count, char *chars)
889{
890 GET_STATEPRIV_GC(pGC);
891 STATE_CHECK_SP(pStatePriv);
892
893 (*pStatePriv->ImageText8TE) (pDraw, pGC, x, y, count, chars);
894}
895
896static void
897XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
898 int count, unsigned short *chars)
899{
900 GET_STATEPRIV_GC(pGC);
901 STATE_CHECK_SP(pStatePriv);
902
903 (*pStatePriv->ImageText16TE) (pDraw, pGC, x, y, count, chars);
904}
905
906static void
907XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
908 int yInit, unsigned int nglyph, CharInfoPtr * ppci,
909 pointer pglyphBase)
910{
911 GET_STATEPRIV_GC(pGC);
912 STATE_CHECK_SP(pStatePriv);
913
914 (*pStatePriv->ImageGlyphBltTE) (pDrawable, pGC, xInit,
915 yInit, nglyph, ppci, pglyphBase);
916}
917
918static void
919XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
920 int yInit, unsigned int nglyph, CharInfoPtr * ppci,
921 pointer pglyphBase)
922{
923 GET_STATEPRIV_GC(pGC);
924 STATE_CHECK_SP(pStatePriv);
925
926 (*pStatePriv->PolyGlyphBltTE) (pDrawable, pGC, xInit,
927 yInit, nglyph, ppci, pglyphBase);
928}
929
930static int
931XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
932 int count, char *chars)
933{
934 GET_STATEPRIV_GC(pGC);
935 STATE_CHECK_SP(pStatePriv);
936
937 return (*pStatePriv->PolyText8NonTE) (pDraw, pGC, x, y, count, chars);
938}
939
940static int
941XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
942 int count, unsigned short *chars)
943{
944 GET_STATEPRIV_GC(pGC);
945 STATE_CHECK_SP(pStatePriv);
946
947 return (*pStatePriv->PolyText16NonTE) (pDraw, pGC, x, y, count, chars);
948}
949
950static void
951XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
952 int count, char *chars)
953{
954 GET_STATEPRIV_GC(pGC);
955 STATE_CHECK_SP(pStatePriv);
956
957 (*pStatePriv->ImageText8NonTE) (pDraw, pGC, x, y, count, chars);
958}
959
960static void
961XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
962 int count, unsigned short *chars)
963{
964 GET_STATEPRIV_GC(pGC);
965 STATE_CHECK_SP(pStatePriv);
966
967 (*pStatePriv->ImageText16NonTE) (pDraw, pGC, x, y, count, chars);
968}
969
970static void
971XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
972 int yInit, unsigned int nglyph,
973 CharInfoPtr * ppci, pointer pglyphBase)
974{
975 GET_STATEPRIV_GC(pGC);
976 STATE_CHECK_SP(pStatePriv);
977
978 (*pStatePriv->ImageGlyphBltNonTE) (pDrawable, pGC, xInit,
979 yInit, nglyph, ppci, pglyphBase);
980}
981
982static void
983XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
984 int yInit, unsigned int nglyph,
985 CharInfoPtr * ppci, pointer pglyphBase)
986{
987 GET_STATEPRIV_GC(pGC);
988 STATE_CHECK_SP(pStatePriv);
989
990 (*pStatePriv->PolyGlyphBltNonTE) (pDrawable, pGC, xInit,
991 yInit, nglyph, ppci, pglyphBase);
992}
993
994static void
995XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable, GCPtr pGC,
996 int nRectsInit, xRectangle *pRectsInit)
997{
998 GET_STATEPRIV_GC(pGC);
999 STATE_CHECK_SP(pStatePriv);
1000
1001 (*pStatePriv->PolyRectangleThinSolid) (pDrawable, pGC,
1002 nRectsInit, pRectsInit);
1003}
1004
1005static void
1006XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
1007 int npt, DDXPointPtr pPts)
1008{
1009 GET_STATEPRIV_GC(pGC);
1010 STATE_CHECK_SP(pStatePriv);
1011
1012 (*pStatePriv->PolylinesWideSolid) (pDrawable, pGC, mode, npt, pPts);
1013}
1014
1015static void
1016XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
1017 int npt, DDXPointPtr pPts)
1018{
1019 GET_STATEPRIV_GC(pGC);
1020 STATE_CHECK_SP(pStatePriv);
1021
1022 (*pStatePriv->PolylinesThinSolid) (pDrawable, pGC, mode, npt, pPts);
1023}
1024
1025static void
1026XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg,
1027 xSegment * pSeg)
1028{
1029 GET_STATEPRIV_GC(pGC);
1030 STATE_CHECK_SP(pStatePriv);
1031
1032 (*pStatePriv->PolySegmentThinSolid) (pDrawable, pGC, nseg, pSeg);
1033}
1034
1035static void
1036XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode,
1037 int npt, DDXPointPtr pPts)
1038{
1039 GET_STATEPRIV_GC(pGC);
1040 STATE_CHECK_SP(pStatePriv);
1041
1042 (*pStatePriv->PolylinesThinDashed) (pDrawable, pGC, mode, npt, pPts);
1043}
1044
1045static void
1046XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg,
1047 xSegment * pSeg)
1048{
1049 GET_STATEPRIV_GC(pGC);
1050 STATE_CHECK_SP(pStatePriv);
1051
1052 (*pStatePriv->PolySegmentThinDashed) (pDrawable, pGC, nseg, pSeg);
1053}
1054
1055static void
1056XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape,
1057 int mode, int count, DDXPointPtr ptsIn)
1058{
1059 GET_STATEPRIV_GC(pGC);
1060 STATE_CHECK_SP(pStatePriv);
1061
1062 (*pStatePriv->FillPolygonSolid) (pDrawable, pGC, shape, mode, count, ptsIn);
1063}
1064
1065static void
1066XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape,
1067 int mode, int count, DDXPointPtr ptsIn)
1068{
1069 GET_STATEPRIV_GC(pGC);
1070 STATE_CHECK_SP(pStatePriv);
1071
1072 (*pStatePriv->FillPolygonStippled) (pDrawable, pGC, shape,
1073 mode, count, ptsIn);
1074}
1075
1076static void
1077XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC,
1078 int shape, int mode, int count,
1079 DDXPointPtr ptsIn)
1080{
1081 GET_STATEPRIV_GC(pGC);
1082 STATE_CHECK_SP(pStatePriv);
1083
1084 (*pStatePriv->FillPolygonOpaqueStippled) (pDrawable, pGC,
1085 shape, mode, count, ptsIn);
1086}
1087
1088static void
1089XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape,
1090 int mode, int count, DDXPointPtr ptsIn)
1091{
1092 GET_STATEPRIV_GC(pGC);
1093 STATE_CHECK_SP(pStatePriv);
1094
1095 (*pStatePriv->FillPolygonTiled) (pDrawable, pGC, shape, mode, count, ptsIn);
1096}
1097
1098static void
1099XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs,
1100 xArc * parcs)
1101{
1102 GET_STATEPRIV_GC(pGC);
1103 STATE_CHECK_SP(pStatePriv);
1104
1105 (*pStatePriv->PolyFillArcSolid) (pDraw, pGC, narcs, parcs);
1106}
1107
1108static void
1109XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
1110 int w, int h, int leftPad, int format, char *pImage)
1111{
1112 GET_STATEPRIV_GC(pGC);
1113 STATE_CHECK_SP(pStatePriv);
1114
1115 (*pStatePriv->PutImage) (pDraw, pGC, depth, x, y,
1116 w, h, leftPad, format, pImage);
1117}
1118
1119static void
1120XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes,
1121 DrawablePtr pDraw)
1122{
1123 GET_STATEPRIV_GC(pGC);
1124 STATE_CHECK_SP(pStatePriv);
1125
1126 (*pStatePriv->ValidateFillSpans) (pGC, changes, pDraw);
1127}
1128
1129static void
1130XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes,
1131 DrawablePtr pDraw)
1132{
1133 GET_STATEPRIV_GC(pGC);
1134 STATE_CHECK_SP(pStatePriv);
1135
1136 (*pStatePriv->ValidateSetSpans) (pGC, changes, pDraw);
1137}
1138
1139static void
1140XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes,
1141 DrawablePtr pDraw)
1142{
1143 GET_STATEPRIV_GC(pGC);
1144 STATE_CHECK_SP(pStatePriv);
1145
1146 (*pStatePriv->ValidatePutImage) (pGC, changes, pDraw);
1147}
1148
1149static void
1150XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes,
1151 DrawablePtr pDraw)
1152{
1153 GET_STATEPRIV_GC(pGC);
1154 STATE_CHECK_SP(pStatePriv);
1155
1156 (*pStatePriv->ValidateCopyArea) (pGC, changes, pDraw);
1157}
1158
1159static void
1160XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes,
1161 DrawablePtr pDraw)
1162{
1163 GET_STATEPRIV_GC(pGC);
1164 STATE_CHECK_SP(pStatePriv);
1165
1166 (*pStatePriv->ValidateCopyPlane) (pGC, changes, pDraw);
1167}
1168
1169static void
1170XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes,
1171 DrawablePtr pDraw)
1172{
1173 GET_STATEPRIV_GC(pGC);
1174 STATE_CHECK_SP(pStatePriv);
1175
1176 (*pStatePriv->ValidatePolyPoint) (pGC, changes, pDraw);
1177}
1178
1179static void
1180XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes,
1181 DrawablePtr pDraw)
1182{
1183 GET_STATEPRIV_GC(pGC);
1184 STATE_CHECK_SP(pStatePriv);
1185
1186 (*pStatePriv->ValidatePolylines) (pGC, changes, pDraw);
1187}
1188
1189static void
1190XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes,
1191 DrawablePtr pDraw)
1192{
1193 GET_STATEPRIV_GC(pGC);
1194 STATE_CHECK_SP(pStatePriv);
1195
1196 (*pStatePriv->ValidatePolySegment) (pGC, changes, pDraw);
1197}
1198
1199static void
1200XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes,
1201 DrawablePtr pDraw)
1202{
1203 GET_STATEPRIV_GC(pGC);
1204 STATE_CHECK_SP(pStatePriv);
1205
1206 (*pStatePriv->ValidatePolyRectangle) (pGC, changes, pDraw);
1207}
1208
1209static void
1210XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
1211{
1212 GET_STATEPRIV_GC(pGC);
1213 STATE_CHECK_SP(pStatePriv);
1214
1215 (*pStatePriv->ValidatePolyArc) (pGC, changes, pDraw);
1216}
1217
1218static void
1219XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes,
1220 DrawablePtr pDraw)
1221{
1222 GET_STATEPRIV_GC(pGC);
1223 STATE_CHECK_SP(pStatePriv);
1224
1225 (*pStatePriv->ValidateFillPolygon) (pGC, changes, pDraw);
1226}
1227
1228static void
1229XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes,
1230 DrawablePtr pDraw)
1231{
1232 GET_STATEPRIV_GC(pGC);
1233 STATE_CHECK_SP(pStatePriv);
1234
1235 (*pStatePriv->ValidatePolyFillRect) (pGC, changes, pDraw);
1236}
1237
1238static void
1239XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes,
1240 DrawablePtr pDraw)
1241{
1242 GET_STATEPRIV_GC(pGC);
1243 STATE_CHECK_SP(pStatePriv);
1244
1245 (*pStatePriv->ValidatePolyFillArc) (pGC, changes, pDraw);
1246}
1247
1248static void
1249XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes,
1250 DrawablePtr pDraw)
1251{
1252 GET_STATEPRIV_GC(pGC);
1253 STATE_CHECK_SP(pStatePriv);
1254
1255 (*pStatePriv->ValidatePolyText8) (pGC, changes, pDraw);
1256}
1257
1258static void
1259XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes,
1260 DrawablePtr pDraw)
1261{
1262 GET_STATEPRIV_GC(pGC);
1263 STATE_CHECK_SP(pStatePriv);
1264
1265 (*pStatePriv->ValidatePolyText16) (pGC, changes, pDraw);
1266}
1267
1268static void
1269XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes,
1270 DrawablePtr pDraw)
1271{
1272 GET_STATEPRIV_GC(pGC);
1273 STATE_CHECK_SP(pStatePriv);
1274
1275 (*pStatePriv->ValidateImageText8) (pGC, changes, pDraw);
1276}
1277
1278static void
1279XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes,
1280 DrawablePtr pDraw)
1281{
1282 GET_STATEPRIV_GC(pGC);
1283 STATE_CHECK_SP(pStatePriv);
1284
1285 (*pStatePriv->ValidateImageText16) (pGC, changes, pDraw);
1286}
1287
1288static void
1289XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes,
1290 DrawablePtr pDraw)
1291{
1292 GET_STATEPRIV_GC(pGC);
1293 STATE_CHECK_SP(pStatePriv);
1294
1295 (*pStatePriv->ValidatePolyGlyphBlt) (pGC, changes, pDraw);
1296}
1297
1298static void
1299XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes,
1300 DrawablePtr pDraw)
1301{
1302 GET_STATEPRIV_GC(pGC);
1303 STATE_CHECK_SP(pStatePriv);
1304 (*pStatePriv->ValidateImageGlyphBlt) (pGC, changes, pDraw);
1305}
1306
1307static void
1308XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes,
1309 DrawablePtr pDraw)
1310{
1311 GET_STATEPRIV_GC(pGC);
1312 STATE_CHECK_SP(pStatePriv);
1313
1314 (*pStatePriv->ValidatePushPixels) (pGC, changes, pDraw);
1315}
1316
1317static void
1318XAAStateWrapComputeDash(GCPtr pGC)
1319{
1320 GET_STATEPRIV_GC(pGC);
1321 STATE_CHECK_SP(pStatePriv);
1322
1323 (*pStatePriv->ComputeDash) (pGC);
1324}
1325
1326static void
1327XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data)
1328{
1329 GET_STATEPRIV_SCREEN(pScreen);
1330 STATE_CHECK_SP(pStatePriv);
1331
1332 (*pStatePriv->InitPixmapCache) (pScreen, areas, data);
1333}
1334
1335static void
1336XAAStateWrapClosePixmapCache(ScreenPtr pScreen)
1337{
1338 GET_STATEPRIV_SCREEN(pScreen);
1339 STATE_CHECK_SP(pStatePriv);
1340
1341 (*pStatePriv->ClosePixmapCache) (pScreen);
1342}
1343
1344static int
1345XAAStateWrapStippledFillChooser(GCPtr pGC)
1346{
1347 GET_STATEPRIV_GC(pGC);
1348 STATE_CHECK_SP(pStatePriv);
1349
1350 return (*pStatePriv->StippledFillChooser) (pGC);
1351}
1352
1353static int
1354XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC)
1355{
1356 GET_STATEPRIV_GC(pGC);
1357 STATE_CHECK_SP(pStatePriv);
1358
1359 return (*pStatePriv->OpaqueStippledFillChooser) (pGC);
1360}
1361
1362static int
1363XAAStateWrapTiledFillChooser(GCPtr pGC)
1364{
1365 GET_STATEPRIV_GC(pGC);
1366 STATE_CHECK_SP(pStatePriv);
1367
1368 return (*pStatePriv->TiledFillChooser) (pGC);
1369}
1370
1371static XAACacheInfoPtr
1372XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
1373{
1374 GET_STATEPRIV_PSCRN(pScrn);
1375 STATE_CHECK_PSCRN(pScrn);
1376
1377 return (*pStatePriv->CacheTile) (pScrn, pPix);
1378}
1379
1380static XAACacheInfoPtr
1381XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
1382{
1383 GET_STATEPRIV_PSCRN(pScrn);
1384 STATE_CHECK_PSCRN(pScrn);
1385
1386 return (*pStatePriv->CacheStipple) (pScrn, pPix, fg, bg);
1387}
1388
1389static XAACacheInfoPtr
1390XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
1391{
1392 GET_STATEPRIV_PSCRN(pScrn);
1393 STATE_CHECK_PSCRN(pScrn);
1394
1395 return (*pStatePriv->CacheMonoStipple) (pScrn, pPix);
1396}
1397
1398static XAACacheInfoPtr
1399XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
1400{
1401 GET_STATEPRIV_PSCRN(pScrn);
1402 STATE_CHECK_PSCRN(pScrn);
1403
1404 return (*pStatePriv->CacheMono8x8Pattern) (pScrn, pat0, pat1);
1405}
1406
1407static XAACacheInfoPtr
1408XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix,
1409 int fg, int bg)
1410{
1411 GET_STATEPRIV_PSCRN(pScrn);
1412 STATE_CHECK_PSCRN(pScrn);
1413
1414 return (*pStatePriv->CacheColor8x8Pattern) (pScrn, pPix, fg, bg);
1415}
1416
1417static void
1418XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
1419 unsigned char *src, int srcwidth, int fg, int bg)
1420{
1421 GET_STATEPRIV_PSCRN(pScrn);
1422 STATE_CHECK_PSCRN(pScrn);
1423
1424 (*pStatePriv->WriteBitmapToCache) (pScrn, x, y, w, h,
1425 src, srcwidth, fg, bg);
1426}
1427
1428static void
1429XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
1430 unsigned char *src, int srcwidth, int bpp,
1431 int depth)
1432{
1433 GET_STATEPRIV_PSCRN(pScrn);
1434 STATE_CHECK_PSCRN(pScrn);
1435
1436 (*pStatePriv->WritePixmapToCache) (pScrn, x, y, w, h,
1437 src, srcwidth, bpp, depth);
1438}
1439
1440static void
1441XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn,
1442 XAACacheInfoPtr pCache)
1443{
1444 GET_STATEPRIV_PSCRN(pScrn);
1445 STATE_CHECK_PSCRN(pScrn);
1446
1447 (*pStatePriv->WriteMono8x8PatternToCache) (pScrn, pCache);
1448}
1449
1450static void
1451XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix,
1452 XAACacheInfoPtr pCache)
1453{
1454 GET_STATEPRIV_PSCRN(pScrn);
1455 STATE_CHECK_PSCRN(pScrn);
1456
1457 (*pStatePriv->WriteColor8x8PatternToCache) (pScrn, pPix, pCache);
1458}
1459
1460static void
1461XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
1462 unsigned int format, unsigned long planeMask,
1463 char *pdstLine)
1464{
1465 GET_STATEPRIV_SCREEN(pDrawable->pScreen);
1466 STATE_CHECK_SP(pStatePriv);
1467
1468 (*pStatePriv->GetImage) (pDrawable, sx, sy, w, h,
1469 format, planeMask, pdstLine);
1470}
1471
1472static void
1473XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
1474 int *pwidth, int nspans, char *pdstStart)
1475{
1476 GET_STATEPRIV_SCREEN(pDrawable->pScreen);
1477 STATE_CHECK_SP(pStatePriv);
1478
1479 (*pStatePriv->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
1480}
1481
1482static void
1483XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
1484 RegionPtr prgnSrc)
1485{
1486 GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen);
1487 STATE_CHECK_SP(pStatePriv);
1488
1489 (*pStatePriv->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
1490}
1491
1492static Bool
1493XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
1494 int op, CARD16 red,
1495 CARD16 green,
1496 CARD16 blue,
1497 CARD16 alpha,
1498 CARD32 srcFormat,
1499 CARD32 dstFormat,
1500 CARD8 *alphaPtr,
1501 int alphaPitch,
1502 int width, int height, int flags)
1503{
1504 GET_STATEPRIV_PSCRN(pScrn);
1505 STATE_CHECK_PSCRN(pScrn);
1506
1507 return (*pStatePriv->SetupForCPUToScreenAlphaTexture2) (pScrn, op, red,
1508 green, blue, alpha,
1509 srcFormat,
1510 dstFormat, alphaPtr,
1511 alphaPitch, width,
1512 height, flags);
1513}
1514
1515static Bool
1516XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
1517 CARD32 srcFormat,
1518 CARD32 dstFormat,
1519 CARD8 *texPtr, int texPitch,
1520 int width, int height, int flags)
1521{
1522 GET_STATEPRIV_PSCRN(pScrn);
1523 STATE_CHECK_PSCRN(pScrn);
1524
1525 return (*pStatePriv->SetupForCPUToScreenTexture2) (pScrn, op, srcFormat,
1526 dstFormat, texPtr,
1527 texPitch, width, height,
1528 flags);
1529}
1530
1531/* Setup Function */
1532Bool
1533XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
1534{
1535 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1536 XAAStateWrapPtr pStatePriv;
1537 int i = 0;
1538
1539 if (!dixRegisterPrivateKey(&XAAStateKeyRec, PRIVATE_SCREEN, 0))
1540 return FALSE;
1541 if (!(pStatePriv = malloc(sizeof(XAAStateWrapRec))))
1542 return FALSE;
1543 dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
1544 pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
1545 pStatePriv->pScrn = pScrn;
1546
1547 /* Initialize the last screen to -1 so whenever an accel function
1548 * is called the proper state is setup
1549 */
1550 while (i < pScrn->numEntities) {
1551 xf86SetLastScrnFlag(pScrn->entityList[i], -1);
1552 i++;
1553 }
1554/* Do the wrapping */
1555 XAA_STATE_WRAP(Sync);
1556 XAA_STATE_WRAP(SetupForScreenToScreenCopy);
1557 XAA_STATE_WRAP(SetupForSolidFill);
1558 XAA_STATE_WRAP(SetupForSolidLine);
1559 XAA_STATE_WRAP(SetupForDashedLine);
1560 XAA_STATE_WRAP(SetClippingRectangle);
1561 XAA_STATE_WRAP(DisableClipping);
1562 XAA_STATE_WRAP(SetupForMono8x8PatternFill);
1563 XAA_STATE_WRAP(SetupForColor8x8PatternFill);
1564 XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill);
1565 XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill);
1566 XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill);
1567 XAA_STATE_WRAP(SetupForImageWrite);
1568 XAA_STATE_WRAP(SetupForScanlineImageWrite);
1569 XAA_STATE_WRAP(SetupForImageRead);
1570 XAA_STATE_WRAP(ScreenToScreenBitBlt);
1571 XAA_STATE_WRAP(WriteBitmap);
1572 XAA_STATE_WRAP(FillSolidRects);
1573 XAA_STATE_WRAP(FillMono8x8PatternRects);
1574 XAA_STATE_WRAP(FillColor8x8PatternRects);
1575 XAA_STATE_WRAP(FillCacheBltRects);
1576 XAA_STATE_WRAP(FillColorExpandRects);
1577 XAA_STATE_WRAP(FillCacheExpandRects);
1578 XAA_STATE_WRAP(FillImageWriteRects);
1579 XAA_STATE_WRAP(FillSolidSpans);
1580 XAA_STATE_WRAP(FillMono8x8PatternSpans);
1581 XAA_STATE_WRAP(FillColor8x8PatternSpans);
1582 XAA_STATE_WRAP(FillCacheBltSpans);
1583 XAA_STATE_WRAP(FillColorExpandSpans);
1584 XAA_STATE_WRAP(FillCacheExpandSpans);
1585 XAA_STATE_WRAP(TEGlyphRenderer);
1586 XAA_STATE_WRAP(NonTEGlyphRenderer);
1587 XAA_STATE_WRAP(WritePixmap);
1588 XAA_STATE_WRAP(ReadPixmap);
1589 XAA_STATE_WRAP(CopyArea);
1590 XAA_STATE_WRAP(CopyPlane);
1591 XAA_STATE_WRAP(PushPixelsSolid);
1592 XAA_STATE_WRAP(PolyFillRectSolid);
1593 XAA_STATE_WRAP(PolyFillRectStippled);
1594 XAA_STATE_WRAP(PolyFillRectOpaqueStippled);
1595 XAA_STATE_WRAP(PolyFillRectTiled);
1596 XAA_STATE_WRAP(FillSpansSolid);
1597 XAA_STATE_WRAP(FillSpansStippled);
1598 XAA_STATE_WRAP(FillSpansOpaqueStippled);
1599 XAA_STATE_WRAP(FillSpansTiled);
1600 XAA_STATE_WRAP(PolyText8TE);
1601 XAA_STATE_WRAP(PolyText16TE);
1602 XAA_STATE_WRAP(ImageText8TE);
1603 XAA_STATE_WRAP(ImageText16TE);
1604 XAA_STATE_WRAP(ImageGlyphBltTE);
1605 XAA_STATE_WRAP(PolyGlyphBltTE);
1606 XAA_STATE_WRAP(PolyText8NonTE);
1607 XAA_STATE_WRAP(PolyText16NonTE);
1608 XAA_STATE_WRAP(ImageText8NonTE);
1609 XAA_STATE_WRAP(ImageText16NonTE);
1610 XAA_STATE_WRAP(ImageGlyphBltNonTE);
1611 XAA_STATE_WRAP(PolyGlyphBltNonTE);
1612 XAA_STATE_WRAP(PolyRectangleThinSolid);
1613 XAA_STATE_WRAP(PolylinesWideSolid);
1614 XAA_STATE_WRAP(PolylinesThinSolid);
1615 XAA_STATE_WRAP(PolySegmentThinSolid);
1616 XAA_STATE_WRAP(PolylinesThinDashed);
1617 XAA_STATE_WRAP(PolySegmentThinDashed);
1618 XAA_STATE_WRAP(FillPolygonSolid);
1619 XAA_STATE_WRAP(FillPolygonStippled);
1620 XAA_STATE_WRAP(FillPolygonOpaqueStippled);
1621 XAA_STATE_WRAP(FillPolygonTiled);
1622 XAA_STATE_WRAP(PolyFillArcSolid);
1623 XAA_STATE_WRAP(PutImage);
1624 XAA_STATE_WRAP(ValidateFillSpans);
1625 XAA_STATE_WRAP(ValidateSetSpans);
1626 XAA_STATE_WRAP(ValidatePutImage);
1627 XAA_STATE_WRAP(ValidateCopyArea);
1628 XAA_STATE_WRAP(ValidateCopyPlane);
1629 XAA_STATE_WRAP(ValidatePolyPoint);
1630 XAA_STATE_WRAP(ValidatePolylines);
1631 XAA_STATE_WRAP(ValidatePolySegment);
1632 XAA_STATE_WRAP(ValidatePolyRectangle);
1633 XAA_STATE_WRAP(ValidatePolyArc);
1634 XAA_STATE_WRAP(ValidateFillPolygon);
1635 XAA_STATE_WRAP(ValidatePolyFillRect);
1636 XAA_STATE_WRAP(ValidatePolyFillArc);
1637 XAA_STATE_WRAP(ValidatePolyText8);
1638 XAA_STATE_WRAP(ValidatePolyText16);
1639 XAA_STATE_WRAP(ValidateImageText8);
1640 XAA_STATE_WRAP(ValidateImageText16);
1641 XAA_STATE_WRAP(ValidatePolyGlyphBlt);
1642 XAA_STATE_WRAP(ValidateImageGlyphBlt);
1643 XAA_STATE_WRAP(ValidatePushPixels);
1644 XAA_STATE_WRAP(ComputeDash);
1645 XAA_STATE_WRAP(InitPixmapCache);
1646 XAA_STATE_WRAP(ClosePixmapCache);
1647 XAA_STATE_WRAP(StippledFillChooser);
1648 XAA_STATE_WRAP(OpaqueStippledFillChooser);
1649 XAA_STATE_WRAP(TiledFillChooser);
1650 XAA_STATE_WRAP(CacheTile);
1651 XAA_STATE_WRAP(CacheStipple);
1652 XAA_STATE_WRAP(CacheMonoStipple);
1653 XAA_STATE_WRAP(CacheMono8x8Pattern);
1654 XAA_STATE_WRAP(CacheColor8x8Pattern);
1655 XAA_STATE_WRAP(WriteBitmapToCache);
1656 XAA_STATE_WRAP(WritePixmapToCache);
1657 XAA_STATE_WRAP(WriteMono8x8PatternToCache);
1658 XAA_STATE_WRAP(WriteColor8x8PatternToCache);
1659 XAA_STATE_WRAP(GetImage);
1660 XAA_STATE_WRAP(GetSpans);
1661 XAA_STATE_WRAP(CopyWindow);
1662 XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
1663 XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
1664 return TRUE;
1665}
diff --git a/hw/xfree86/xaa/xaaStipple.c b/hw/xfree86/xaa/xaaStipple.c
deleted file mode 100644
index fc74e3988..000000000
--- a/hw/xfree86/xaa/xaaStipple.c
+++ /dev/null
@@ -1,915 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "xaa.h"
7#include "xaalocal.h"
8#include "xaacexp.h"
9#include "xf86.h"
10
11static CARD32 *StipplePowerOfTwo(CARD32 *, CARD32 *, int, int, int);
12static CARD32 *StipplePowerOfTwo_Inverted(CARD32 *, CARD32 *, int, int, int);
13static CARD32 *StippleUpTo32(CARD32 *, CARD32 *, int, int, int);
14static CARD32 *StippleUpTo32_Inverted(CARD32 *, CARD32 *, int, int, int);
15static CARD32 *StippleOver32(CARD32 *, CARD32 *, int, int, int);
16static CARD32 *StippleOver32_Inverted(CARD32 *, CARD32 *, int, int, int);
17
18#ifdef TRIPLE_BITS
19#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc3)
20#define stipple_get_scanline_func EXPNAME(XAAGetStippleScanlineFunc3)
21#else
22#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc)
23#define stipple_get_scanline_func EXPNAME(XAAGetStippleScanlineFunc)
24#endif
25
26StippleScanlineProcPtr stipple_scanline_func[6] = {
27 StipplePowerOfTwo,
28 StippleUpTo32,
29 StippleOver32,
30 StipplePowerOfTwo_Inverted,
31 StippleUpTo32_Inverted,
32 StippleOver32_Inverted
33};
34
35StippleScanlineProcPtr *
36stipple_get_scanline_func(void)
37{
38 return stipple_scanline_func;
39}
40
41#ifdef FIXEDBASE
42#define DEST(i) *dest
43#define RETURN(i) return(dest)
44#else
45#define DEST(i) dest[i]
46#define RETURN(i) return(dest + i)
47#endif
48
49/* TRIPLE_BITS pattern expansion */
50#ifdef TRIPLE_BITS
51#define EXPAND_PAT \
52 CARD32 pat1 = byte_expand3[pat & 0xFF], \
53 pat2 = byte_expand3[(pat & 0xFF00) >> 8], \
54 pat3 = byte_expand3[(pat & 0xFF0000) >> 16], \
55 pat4 = byte_expand3[(pat & 0xFF000000) >> 24], \
56 patA = pat1 | (pat2 << 24), \
57 patB = (pat2 >> 8) | (pat3 << 16), \
58 patC = (pat3 >> 16) | (pat4 << 8)
59#ifdef FIXED_BASE
60#define WRITE_PAT1 { \
61 *dest = patA; }
62#define WRITE_PAT2 { \
63 *dest = patA; \
64 *dest = patB; }
65#define WRITE_PAT3 { \
66 *dest = patA; \
67 *dest = patB; \
68 *dest = patC; }
69#else
70#define WRITE_PAT1 { \
71 *(dest++) = patA; }
72#define WRITE_PAT2 { \
73 *(dest) = patA; \
74 *(dest + 1) = patB; \
75 dest += 2; }
76#define WRITE_PAT3 { \
77 *(dest) = patA; \
78 *(dest + 1) = patB; \
79 *(dest + 2) = patC; \
80 dest += 3; }
81#endif
82#endif
83
84#if !defined(FIXEDBASE) && !defined(MSBFIRST) && !defined(TRIPLE_BITS)
85
86unsigned int XAAShiftMasks[32] = {
87 /* gcc is rather pedantic about SHIFT_R(0xFFFFFFFF,32) */
88 0x00000000, SHIFT_R(0xFFFFFFFF, 31),
89 SHIFT_R(0xFFFFFFFF, 30), SHIFT_R(0xFFFFFFFF, 29),
90 SHIFT_R(0xFFFFFFFF, 28), SHIFT_R(0xFFFFFFFF, 27),
91 SHIFT_R(0xFFFFFFFF, 26), SHIFT_R(0xFFFFFFFF, 25),
92 SHIFT_R(0xFFFFFFFF, 24), SHIFT_R(0xFFFFFFFF, 23),
93 SHIFT_R(0xFFFFFFFF, 22), SHIFT_R(0xFFFFFFFF, 21),
94 SHIFT_R(0xFFFFFFFF, 20), SHIFT_R(0xFFFFFFFF, 19),
95 SHIFT_R(0xFFFFFFFF, 18), SHIFT_R(0xFFFFFFFF, 17),
96 SHIFT_R(0xFFFFFFFF, 16), SHIFT_R(0xFFFFFFFF, 15),
97 SHIFT_R(0xFFFFFFFF, 14), SHIFT_R(0xFFFFFFFF, 13),
98 SHIFT_R(0xFFFFFFFF, 12), SHIFT_R(0xFFFFFFFF, 11),
99 SHIFT_R(0xFFFFFFFF, 10), SHIFT_R(0xFFFFFFFF, 9),
100 SHIFT_R(0xFFFFFFFF, 8), SHIFT_R(0xFFFFFFFF, 7),
101 SHIFT_R(0xFFFFFFFF, 6), SHIFT_R(0xFFFFFFFF, 5),
102 SHIFT_R(0xFFFFFFFF, 4), SHIFT_R(0xFFFFFFFF, 3),
103 SHIFT_R(0xFFFFFFFF, 2), SHIFT_R(0xFFFFFFFF, 1)
104};
105
106#endif
107
108void
109#ifdef TRIPLE_BITS
110 EXPNAME(XAAFillColorExpandRects3) (
111#else
112 EXPNAME(XAAFillColorExpandRects) (
113#endif
114 ScrnInfoPtr pScrn,
115 int fg, int bg, int rop,
116 unsigned int planemask,
117 int nBox,
118 BoxPtr pBox,
119 int xorg, int yorg, PixmapPtr pPix) {
120 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
121 CARD32 *base;
122 Bool TwoPass = FALSE, FirstPass = TRUE;
123 StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
124 int stipplewidth = pPix->drawable.width;
125 int stippleheight = pPix->drawable.height;
126 int srcwidth = pPix->devKind;
127 int dwords, srcy, srcx, funcNo = 2, h;
128 unsigned char *src = (unsigned char *) pPix->devPrivate.ptr;
129 unsigned char *srcp;
130 int flag;
131
132 if (stipplewidth <= 32) {
133 if (stipplewidth & (stipplewidth - 1))
134 funcNo = 1;
135 else
136 funcNo = 0;
137 }
138 StippleFunc = stipple_scanline_func[funcNo];
139 SecondFunc = stipple_scanline_func[funcNo];
140 FirstFunc = stipple_scanline_func[funcNo + 3];
141
142#ifdef TRIPLE_BITS
143 if ((bg == -1) ||
144 (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
145 (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
146 (CHECK_RGB_EQUAL(bg))))) {
147#else
148 if ((bg == -1) ||
149 !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
150#endif
151 /* one pass */
152 }
153 else if ((rop == GXcopy) && infoRec->FillSolidRects) {
154 /* one pass but we fill background rects first */
155 (*infoRec->FillSolidRects) (pScrn, bg, rop, planemask, nBox, pBox);
156 bg = -1;
157 }
158 else {
159 /* gotta do two passes */
160 TwoPass = TRUE;
161 }
162
163 if (!TwoPass)
164 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
165 planemask);
166
167 while (nBox--) {
168#ifdef TRIPLE_BITS
169 dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
170#else
171 dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
172#endif
173
174 SECOND_PASS:
175 if (TwoPass) {
176 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn,
177 (FirstPass) ? bg :
178 fg, -1, rop,
179 planemask);
180 StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
181 }
182
183 h = pBox->y2 - pBox->y1;
184 flag = (infoRec->CPUToScreenColorExpandFillFlags
185 & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
186
187 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, pBox->x1,
188 pBox->y1,
189 pBox->x2 - pBox->x1,
190 h, 0);
191
192 base = (CARD32 *) infoRec->ColorExpandBase;
193
194 srcy = (pBox->y1 - yorg) % stippleheight;
195 if (srcy < 0)
196 srcy += stippleheight;
197 srcx = (pBox->x1 - xorg) % stipplewidth;
198 if (srcx < 0)
199 srcx += stipplewidth;
200
201 srcp = (srcwidth * srcy) + src;
202
203#ifndef FIXEDBASE
204 if ((dwords * h) <= infoRec->ColorExpandRange) {
205 while (h--) {
206 base =
207 (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth,
208 dwords);
209 srcy++;
210 srcp += srcwidth;
211 if (srcy >= stippleheight) {
212 srcy = 0;
213 srcp = src;
214 }
215 }
216 }
217 else
218#endif
219 while (h--) {
220 (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth,
221 dwords);
222 srcy++;
223 srcp += srcwidth;
224 if (srcy >= stippleheight) {
225 srcy = 0;
226 srcp = src;
227 }
228 }
229
230 if (flag) {
231 base = (CARD32 *) infoRec->ColorExpandBase;
232 base[0] = 0x00000000;
233 }
234
235 if (TwoPass) {
236 if (FirstPass) {
237 FirstPass = FALSE;
238 goto SECOND_PASS;
239 }
240 else
241 FirstPass = TRUE;
242 }
243
244 pBox++;
245 }
246
247 if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
248 (*infoRec->Sync) (pScrn);
249 else
250 SET_SYNC_FLAG(infoRec);
251}
252
253void
254#ifdef TRIPLE_BITS
255 EXPNAME(XAAFillColorExpandSpans3) (
256#else
257 EXPNAME(XAAFillColorExpandSpans) (
258#endif
259 ScrnInfoPtr pScrn,
260 int fg, int bg, int rop,
261 unsigned int planemask,
262 int n,
263 DDXPointPtr ppt,
264 int *pwidth,
265 int fSorted,
266 int xorg, int yorg, PixmapPtr pPix) {
267 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
268 CARD32 *base;
269 Bool TwoPass = FALSE, FirstPass = TRUE;
270 StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
271 int stipplewidth = pPix->drawable.width;
272 int stippleheight = pPix->drawable.height;
273 int dwords, srcy, srcx, funcNo = 2;
274 unsigned char *srcp;
275
276 if (stipplewidth <= 32) {
277 if (stipplewidth & (stipplewidth - 1))
278 funcNo = 1;
279 else
280 funcNo = 0;
281 }
282 StippleFunc = stipple_scanline_func[funcNo];
283 SecondFunc = stipple_scanline_func[funcNo];
284 FirstFunc = stipple_scanline_func[funcNo + 3];
285
286#ifdef TRIPLE_BITS
287 if ((bg == -1) ||
288 (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
289 (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
290 (CHECK_RGB_EQUAL(bg))))) {
291#else
292 if ((bg == -1) ||
293 !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
294#endif
295 /* one pass */
296 }
297 else if ((rop == GXcopy) && infoRec->FillSolidSpans) {
298 /* one pass but we fill background rects first */
299 (*infoRec->FillSolidSpans) (pScrn, bg, rop, planemask, n, ppt, pwidth,
300 fSorted);
301 bg = -1;
302 }
303 else {
304 /* gotta do two passes */
305 TwoPass = TRUE;
306 }
307
308 if (!TwoPass)
309 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
310 planemask);
311
312 while (n--) {
313#ifdef TRIPLE_BITS
314 dwords = (3 * *pwidth + 31) >> 5;
315#else
316 dwords = (*pwidth + 31) >> 5;
317#endif
318
319 srcy = (ppt->y - yorg) % stippleheight;
320 if (srcy < 0)
321 srcy += stippleheight;
322 srcx = (ppt->x - xorg) % stipplewidth;
323 if (srcx < 0)
324 srcx += stipplewidth;
325
326 srcp = (pPix->devKind * srcy) + (unsigned char *) pPix->devPrivate.ptr;
327
328 SECOND_PASS:
329 if (TwoPass) {
330 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn,
331 (FirstPass) ? bg :
332 fg, -1, rop,
333 planemask);
334 StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
335 }
336
337 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, ppt->x, ppt->y,
338 *pwidth, 1, 0);
339
340 base = (CARD32 *) infoRec->ColorExpandBase;
341
342 (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords);
343
344 if ((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD)
345 && (dwords & 0x01)) {
346 base = (CARD32 *) infoRec->ColorExpandBase;
347 base[0] = 0x00000000;
348 }
349
350 if (TwoPass) {
351 if (FirstPass) {
352 FirstPass = FALSE;
353 goto SECOND_PASS;
354 }
355 else
356 FirstPass = TRUE;
357 }
358
359 ppt++;
360 pwidth++;
361 }
362
363 if (infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
364 (*infoRec->Sync) (pScrn);
365 else
366 SET_SYNC_FLAG(infoRec);
367}
368
369#ifndef FIXEDBASE
370
371void
372#ifdef TRIPLE_BITS
373 EXPNAME(XAAFillScanlineColorExpandRects3) (
374#else
375 EXPNAME(XAAFillScanlineColorExpandRects) (
376#endif
377 ScrnInfoPtr pScrn,
378 int fg, int bg, int rop,
379 unsigned int planemask,
380 int nBox,
381 BoxPtr pBox,
382 int xorg, int yorg,
383 PixmapPtr pPix) {
384 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
385 CARD32 *base;
386 Bool TwoPass = FALSE, FirstPass = TRUE;
387 StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
388 int stipplewidth = pPix->drawable.width;
389 int stippleheight = pPix->drawable.height;
390 int srcwidth = pPix->devKind;
391 int dwords, srcy, srcx, funcNo = 2, bufferNo, h;
392 unsigned char *src = pPix->devPrivate.ptr;
393 unsigned char *srcp;
394
395 if (stipplewidth <= 32) {
396 if (stipplewidth & (stipplewidth - 1))
397 funcNo = 1;
398 else
399 funcNo = 0;
400 }
401 StippleFunc = stipple_scanline_func[funcNo];
402 SecondFunc = stipple_scanline_func[funcNo];
403 FirstFunc = stipple_scanline_func[funcNo + 3];
404
405#ifdef TRIPLE_BITS
406 if ((bg == -1) ||
407 (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
408 && (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
409 (CHECK_RGB_EQUAL(bg))))) {
410#else
411 if ((bg == -1) ||
412 !(infoRec->
413 ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
414#endif
415 /* one pass */
416 }
417 else if ((rop == GXcopy) && infoRec->FillSolidRects) {
418 /* one pass but we fill background rects first */
419 (*infoRec->FillSolidRects) (pScrn, bg, rop, planemask, nBox, pBox);
420 bg = -1;
421 }
422 else {
423 /* gotta do two passes */
424 TwoPass = TRUE;
425 }
426
427 if (!TwoPass)
428 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg,
429 rop, planemask);
430
431 while (nBox--) {
432#ifdef TRIPLE_BITS
433 dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
434#else
435 dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
436#endif
437
438 SECOND_PASS:
439 if (TwoPass) {
440 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn,
441 (FirstPass)
442 ? bg : fg,
443 -1, rop,
444 planemask);
445 StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
446 }
447
448 h = pBox->y2 - pBox->y1;
449
450 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn,
451 pBox->x1,
452 pBox->y1,
453 pBox->x2 -
454 pBox->x1, h,
455 0);
456
457 bufferNo = 0;
458
459 srcy = (pBox->y1 - yorg) % stippleheight;
460 if (srcy < 0)
461 srcy += stippleheight;
462 srcx = (pBox->x1 - xorg) % stipplewidth;
463 if (srcx < 0)
464 srcx += stipplewidth;
465
466 srcp = (srcwidth * srcy) + src;
467
468 while (h--) {
469 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
470 (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords);
471 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
472 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
473 bufferNo = 0;
474 srcy++;
475 srcp += srcwidth;
476 if (srcy >= stippleheight) {
477 srcy = 0;
478 srcp = src;
479 }
480 }
481
482 if (TwoPass) {
483 if (FirstPass) {
484 FirstPass = FALSE;
485 goto SECOND_PASS;
486 }
487 else
488 FirstPass = TRUE;
489 }
490
491 pBox++;
492 }
493
494 SET_SYNC_FLAG(infoRec);
495}
496
497void
498#ifdef TRIPLE_BITS
499 EXPNAME(XAAFillScanlineColorExpandSpans3) (
500#else
501 EXPNAME(XAAFillScanlineColorExpandSpans) (
502#endif
503 ScrnInfoPtr pScrn,
504 int fg, int bg, int rop,
505 unsigned int planemask,
506 int n,
507 DDXPointPtr ppt,
508 int *pwidth,
509 int fSorted,
510 int xorg, int yorg,
511 PixmapPtr pPix) {
512 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
513 CARD32 *base;
514 Bool TwoPass = FALSE, FirstPass = TRUE;
515 StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
516 int stipplewidth = pPix->drawable.width;
517 int stippleheight = pPix->drawable.height;
518 int dwords, srcy, srcx, funcNo = 2;
519 unsigned char *srcp;
520
521 if (stipplewidth <= 32) {
522 if (stipplewidth & (stipplewidth - 1))
523 funcNo = 1;
524 else
525 funcNo = 0;
526 }
527 StippleFunc = stipple_scanline_func[funcNo];
528 SecondFunc = stipple_scanline_func[funcNo];
529 FirstFunc = stipple_scanline_func[funcNo + 3];
530
531#ifdef TRIPLE_BITS
532 if ((bg == -1) ||
533 (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
534 && (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
535 (CHECK_RGB_EQUAL(bg))))) {
536#else
537 if ((bg == -1) ||
538 !(infoRec->
539 ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
540#endif
541 /* one pass */
542 }
543 else if ((rop == GXcopy) && infoRec->FillSolidSpans) {
544 /* one pass but we fill background rects first */
545 (*infoRec->FillSolidSpans) (pScrn, bg, rop, planemask, n, ppt, pwidth,
546 fSorted);
547 bg = -1;
548 }
549 else {
550 /* gotta do two passes */
551 TwoPass = TRUE;
552 }
553
554 if (!TwoPass)
555 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg,
556 rop, planemask);
557
558 while (n--) {
559#ifdef TRIPLE_BITS
560 dwords = (3 * *pwidth + 31) >> 5;
561#else
562 dwords = (*pwidth + 31) >> 5;
563#endif
564
565 srcy = (ppt->y - yorg) % stippleheight;
566 if (srcy < 0)
567 srcy += stippleheight;
568 srcx = (ppt->x - xorg) % stipplewidth;
569 if (srcx < 0)
570 srcx += stipplewidth;
571
572 srcp = (pPix->devKind * srcy) + (unsigned char *) pPix->devPrivate.ptr;
573
574 SECOND_PASS:
575 if (TwoPass) {
576 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn,
577 (FirstPass)
578 ? bg : fg,
579 -1, rop,
580 planemask);
581 StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
582 }
583
584 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, ppt->x,
585 ppt->y,
586 *pwidth, 1,
587 0);
588
589 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[0];
590
591 (*StippleFunc) (base, (CARD32 *) srcp, srcx, stipplewidth, dwords);
592 (*infoRec->SubsequentColorExpandScanline) (pScrn, 0);
593
594 if (TwoPass) {
595 if (FirstPass) {
596 FirstPass = FALSE;
597 goto SECOND_PASS;
598 }
599 else
600 FirstPass = TRUE;
601 }
602
603 ppt++;
604 pwidth++;
605 }
606
607 SET_SYNC_FLAG(infoRec);
608}
609
610#endif
611
612static CARD32 *
613StipplePowerOfTwo(CARD32 *dest, CARD32 *src, int shift, int width, int dwords)
614{
615 CARD32 pat = *src;
616
617 if (width < 32) {
618 pat &= XAAShiftMasks[width];
619 while (width < 32) {
620 pat |= SHIFT_L(pat, width);
621 width <<= 1;
622 }
623 }
624
625 if (shift)
626 pat = SHIFT_R(pat, shift) | SHIFT_L(pat, 32 - shift);
627
628#ifdef MSBFIRST
629 pat = SWAP_BITS_IN_BYTES(pat);
630#endif
631
632#ifdef TRIPLE_BITS
633 {
634 EXPAND_PAT;
635
636 while (dwords >= 3) {
637 WRITE_PAT3;
638 dwords -= 3;
639 }
640 if (dwords == 2) {
641 WRITE_PAT2;
642 }
643 else if (dwords == 1) {
644 WRITE_PAT1;
645 }
646
647 return dest;
648 }
649#else /* TRIPLE_BITS */
650 while (dwords >= 4) {
651 DEST(0) = pat;
652 DEST(1) = pat;
653 DEST(2) = pat;
654 DEST(3) = pat;
655 dwords -= 4;
656#ifndef FIXEDBASE
657 dest += 4;
658#endif
659 }
660
661 if (!dwords)
662 return dest;
663 DEST(0) = pat;
664 if (dwords == 1)
665 RETURN(1);
666 DEST(1) = pat;
667 if (dwords == 2)
668 RETURN(2);
669 DEST(2) = pat;
670 RETURN(3);
671#endif /* TRIPLE_BITS */
672}
673
674static CARD32 *
675StipplePowerOfTwo_Inverted(CARD32 *dest, CARD32 *src,
676 int shift, int width, int dwords)
677{
678 CARD32 pat = *src;
679
680 if (width < 32) {
681 pat &= XAAShiftMasks[width];
682 while (width < 32) {
683 pat |= SHIFT_L(pat, width);
684 width <<= 1;
685 }
686 }
687
688 if (shift)
689 pat = SHIFT_R(pat, shift) | SHIFT_L(pat, 32 - shift);
690
691#ifdef MSBFIRST
692 pat = SWAP_BITS_IN_BYTES(pat);
693#endif
694
695 pat = ~pat;
696
697#ifdef TRIPLE_BITS
698 {
699 EXPAND_PAT;
700
701 while (dwords >= 3) {
702 WRITE_PAT3;
703 dwords -= 3;
704 }
705 if (dwords == 2) {
706 WRITE_PAT2;
707 }
708 else if (dwords == 1) {
709 WRITE_PAT1;
710 }
711
712 return dest;
713 }
714#else /* TRIPLE_BITS */
715 while (dwords >= 4) {
716 DEST(0) = pat;
717 DEST(1) = pat;
718 DEST(2) = pat;
719 DEST(3) = pat;
720 dwords -= 4;
721#ifndef FIXEDBASE
722 dest += 4;
723#endif
724 }
725
726 if (!dwords)
727 return dest;
728 DEST(0) = pat;
729 if (dwords == 1)
730 RETURN(1);
731 DEST(1) = pat;
732 if (dwords == 2)
733 RETURN(2);
734 DEST(2) = pat;
735 RETURN(3);
736#endif /* TRIPLE_BITS */
737}
738
739static CARD32 *
740StippleUpTo32(CARD32 *base, CARD32 *src, int shift, int width, int dwords)
741{
742 CARD32 pat = *src & XAAShiftMasks[width];
743
744 while (width <= 15) {
745 pat |= SHIFT_L(pat, width);
746 width <<= 1;
747 }
748 pat |= SHIFT_L(pat, width);
749
750 while (dwords--) {
751 CARD32 bits = SHIFT_R(pat, shift) | SHIFT_L(pat, width - shift);
752
753#ifdef TRIPLE_BITS
754 if (dwords >= 2) {
755 WRITE_BITS3(bits);
756 dwords -= 2;
757 }
758 else if (dwords > 0) {
759 WRITE_BITS2(bits);
760 dwords--;
761 }
762 else {
763 WRITE_BITS1(bits);
764 }
765#else
766 WRITE_BITS(bits);
767#endif
768
769 shift += 32;
770 shift %= width;
771 }
772 return base;
773}
774
775static CARD32 *
776StippleUpTo32_Inverted(CARD32 *base, CARD32 *src,
777 int shift, int width, int dwords)
778{
779 CARD32 pat = *src & XAAShiftMasks[width];
780
781 while (width <= 15) {
782 pat |= SHIFT_L(pat, width);
783 width <<= 1;
784 }
785 pat |= SHIFT_L(pat, width);
786
787 while (dwords--) {
788 CARD32 bits = ~(SHIFT_R(pat, shift) | SHIFT_L(pat, width - shift));
789
790#ifdef TRIPLE_BITS
791 if (dwords >= 2) {
792 WRITE_BITS3(bits);
793 dwords -= 2;
794 }
795 else if (dwords > 0) {
796 WRITE_BITS2(bits);
797 dwords--;
798 }
799 else {
800 WRITE_BITS1(bits);
801 }
802#else
803 WRITE_BITS(bits);
804#endif
805
806 shift += 32;
807 shift %= width;
808 }
809 return base;
810}
811
812static CARD32 *
813StippleOver32(CARD32 *base, CARD32 *src, int offset, int width, int dwords)
814{
815 CARD32 *srcp;
816 CARD32 bits;
817 int bitsleft, shift, usable;
818
819 while (dwords--) {
820 bitsleft = width - offset;
821 srcp = src + (offset >> 5);
822 shift = offset & 31;
823 usable = 32 - shift;
824
825 if (bitsleft < 32) {
826 if (bitsleft <= usable) {
827 bits = SHIFT_L(*src, bitsleft) |
828 (SHIFT_R(*srcp, shift) & XAAShiftMasks[bitsleft]);
829 }
830 else {
831 bits = SHIFT_L(*src, bitsleft) |
832 (SHIFT_L(srcp[1], usable) & XAAShiftMasks[bitsleft]) |
833 (SHIFT_R(*srcp, shift) & XAAShiftMasks[usable]);
834 }
835 }
836 else if (shift)
837 bits = SHIFT_R(*srcp, shift) | SHIFT_L(srcp[1], usable);
838 else
839 bits = *srcp;
840
841#ifdef TRIPLE_BITS
842 if (dwords >= 2) {
843 WRITE_BITS3(bits);
844 dwords -= 2;
845 }
846 else if (dwords > 0) {
847 WRITE_BITS2(bits);
848 dwords--;
849 }
850 else {
851 WRITE_BITS1(bits);
852 }
853#else
854 WRITE_BITS(bits);
855#endif
856
857 offset += 32;
858 offset %= width;
859 }
860 return base;
861}
862
863static CARD32 *
864StippleOver32_Inverted(CARD32 *base, CARD32 *src,
865 int offset, int width, int dwords)
866{
867 CARD32 *srcp;
868 CARD32 bits;
869 int bitsleft, shift, usable;
870
871 while (dwords--) {
872 bitsleft = width - offset;
873 srcp = src + (offset >> 5);
874 shift = offset & 31;
875 usable = 32 - shift;
876
877 if (bitsleft < 32) {
878 if (bitsleft <= usable) {
879 bits = SHIFT_L(*src, bitsleft) |
880 (SHIFT_R(*srcp, shift) & XAAShiftMasks[bitsleft]);
881 }
882 else {
883 bits = SHIFT_L(*src, bitsleft) |
884 (SHIFT_L(srcp[1], usable) & XAAShiftMasks[bitsleft]) |
885 (SHIFT_R(*srcp, shift) & XAAShiftMasks[usable]);
886 }
887 }
888 else if (shift)
889 bits = SHIFT_R(*srcp, shift) | SHIFT_L(srcp[1], usable);
890 else
891 bits = *srcp;
892
893 bits = ~bits;
894
895#ifdef TRIPLE_BITS
896 if (dwords >= 2) {
897 WRITE_BITS3(bits);
898 dwords -= 2;
899 }
900 else if (dwords > 0) {
901 WRITE_BITS2(bits);
902 dwords--;
903 }
904 else {
905 WRITE_BITS1(bits);
906 }
907#else
908 WRITE_BITS(bits);
909#endif
910
911 offset += 32;
912 offset %= width;
913 }
914 return base;
915}
diff --git a/hw/xfree86/xaa/xaaTEGlyph.c b/hw/xfree86/xaa/xaaTEGlyph.c
deleted file mode 100644
index 2926c1df2..000000000
--- a/hw/xfree86/xaa/xaaTEGlyph.c
+++ /dev/null
@@ -1,1083 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include "xaa.h"
7#include "xaalocal.h"
8#include "xaacexp.h"
9#include "xf86.h"
10
11/* scanline function for TRIPLE_BITS_24BPP */
12static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width);
13
14/* Loop unrolled functions for common font widths */
15static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp,
16 int line, int width, int glyphwidth);
17static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp,
18 int line, int width, int glyphwidth);
19static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp,
20 int line, int width, int glyphwidth);
21static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp,
22 int line, int width, int glyphwidth);
23static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp,
24 int line, int width, int glyphwidth);
25static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp,
26 int line, int width, int glyphwidth);
27static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp,
28 int line, int width, int glyphwidth);
29static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp,
30 int line, int width, int glyphwidth);
31
32#ifdef USEASSEMBLER
33#ifdef FIXEDBASE
34#ifdef MSBFIRST
35CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base,
36 unsigned int **glyphp,
37 int line, int width,
38 int glyphwidth);
39CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base,
40 unsigned int **glyphp,
41 int line, int width,
42 int glyphwidth);
43CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base,
44 unsigned int **glyphp,
45 int line, int width,
46 int glyphwidth);
47#else
48CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base,
49 unsigned int **glyphp,
50 int line, int width,
51 int glyphwidth);
52CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base,
53 unsigned int **glyphp,
54 int line, int width,
55 int glyphwidth);
56CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base,
57 unsigned int **glyphp,
58 int line, int width,
59 int glyphwidth);
60#endif
61#else
62#ifdef MSBFIRST
63CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp,
64 int line, int width, int glyphwidth);
65CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp,
66 int line, int width, int glyphwidth);
67CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp,
68 int line, int width, int glyphwidth);
69#else
70CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp,
71 int line, int width, int glyphwidth);
72CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp,
73 int line, int width, int glyphwidth);
74CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp,
75 int line, int width, int glyphwidth);
76#endif
77#endif
78#else
79static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp,
80 int line, int width, int glyphwidth);
81static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp,
82 int line, int width, int glyphwidth);
83static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp,
84 int line, int width, int glyphwidth);
85#endif
86
87#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc)
88#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc)
89
90GlyphScanlineFuncPtr glyph_scanline_func[32] = {
91 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
92 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
93 DrawTETextScanlineGeneric,
94#ifdef USEASSEMBLER
95#ifdef FIXEDBASE
96#ifdef MSBFIRST
97 DrawTETextScanlineWidth6PMSBFirstFixedBase,
98 DrawTETextScanlineWidth7,
99 DrawTETextScanlineWidth8PMSBFirstFixedBase,
100 DrawTETextScanlineWidth9PMSBFirstFixedBase,
101#else
102 DrawTETextScanlineWidth6PLSBFirstFixedBase,
103 DrawTETextScanlineWidth7,
104 DrawTETextScanlineWidth8PLSBFirstFixedBase,
105 DrawTETextScanlineWidth9PLSBFirstFixedBase,
106#endif
107#else
108#ifdef MSBFIRST
109 DrawTETextScanlineWidth6PMSBFirst,
110 DrawTETextScanlineWidth7,
111 DrawTETextScanlineWidth8PMSBFirst,
112 DrawTETextScanlineWidth9PMSBFirst,
113#else
114 DrawTETextScanlineWidth6PLSBFirst,
115 DrawTETextScanlineWidth7,
116 DrawTETextScanlineWidth8PLSBFirst,
117 DrawTETextScanlineWidth9PLSBFirst,
118#endif
119#endif
120#else
121 DrawTETextScanlineWidth6, DrawTETextScanlineWidth7,
122 DrawTETextScanlineWidth8, DrawTETextScanlineWidth9,
123#endif
124 DrawTETextScanlineWidth10,
125 DrawTETextScanlineGeneric, DrawTETextScanlineWidth12,
126 DrawTETextScanlineGeneric, DrawTETextScanlineWidth14,
127 DrawTETextScanlineGeneric, DrawTETextScanlineWidth16,
128 DrawTETextScanlineGeneric, DrawTETextScanlineWidth18,
129 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
130 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
131 DrawTETextScanlineGeneric, DrawTETextScanlineWidth24,
132 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
133 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
134 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
135 DrawTETextScanlineGeneric, DrawTETextScanlineGeneric
136};
137
138GlyphScanlineFuncPtr *
139glyph_get_scanline_func(void)
140{
141 return glyph_scanline_func;
142}
143
144/********************************************************************
145
146 Here we have TEGlyphRenders for a bunch of different color
147 expansion types. The driver may provide its own renderer, but
148 this is the default one which renders using lower-level primitives
149 exported by the chipset driver.
150
151********************************************************************/
152
153/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not.
154 A total of 4 versions */
155
156void
157
158EXPNAME(XAATEGlyphRenderer) (ScrnInfoPtr pScrn,
159 int x, int y, int w, int h, int skipleft,
160 int startline, unsigned int **glyphs,
161 int glyphWidth, int fg, int bg, int rop,
162 unsigned planemask) {
163 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
164 CARD32 *base;
165 GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
166 int dwords = 0;
167
168 if ((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
169 (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
170 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
171 bg = -1;
172 }
173
174 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
175 planemask);
176
177 if (skipleft &&
178 (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
179 (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
180 (skipleft > x)))) {
181 /* draw the first character only */
182
183 int count = h, line = startline;
184 int width = glyphWidth - skipleft;
185
186 if (width > w)
187 width = w;
188
189 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, width, h,
190 0);
191
192 base = (CARD32 *) infoRec->ColorExpandBase;
193
194 while (count--) {
195 register CARD32 tmp = SHIFT_R(glyphs[0][line++], skipleft);
196
197 WRITE_BITS(tmp);
198 }
199
200 w -= width;
201 if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
202 ((((width + 31) >> 5) * h) & 1)) {
203 base = (CARD32 *) infoRec->ColorExpandBase;
204 base[0] = 0x00000000;
205 }
206 if (!w)
207 goto THE_END;
208 glyphs++;
209 x += width;
210 skipleft = 0; /* nicely aligned again */
211 }
212
213 w += skipleft;
214 x -= skipleft;
215 dwords = ((w + 31) >> 5) * h;
216
217 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
218 skipleft);
219
220 base = (CARD32 *) infoRec->ColorExpandBase;
221
222#ifndef FIXEDBASE
223 if ((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
224 while (h--) {
225 base = (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth);
226 }
227 else
228#endif
229 while (h--) {
230 (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth);
231 }
232
233 if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
234 (dwords & 1)) {
235 base = (CARD32 *) infoRec->ColorExpandBase;
236 base[0] = 0x00000000;
237 }
238
239 THE_END:
240
241 if (infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
242 (*infoRec->Sync) (pScrn);
243 else
244 SET_SYNC_FLAG(infoRec);
245}
246
247/********************************************************************
248
249 This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer
250 with the non FIXEDBASE LSB_FIRST code before tripling, and possibly
251 reversing the bits and sending them to the screen
252
253********************************************************************/
254
255void
256
257EXPNAME(XAATEGlyphRenderer3) (ScrnInfoPtr pScrn,
258 int x, int y, int w, int h, int skipleft,
259 int startline, unsigned int **glyphs,
260 int glyphWidth, int fg, int bg, int rop,
261 unsigned planemask) {
262 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
263 CARD32 *base, *mem;
264 GlyphScanlineFuncPtr GlyphFunc =
265 XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
266 int dwords = 0;
267
268 if ((bg != -1) &&
269 ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
270 ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
271 (!CHECK_RGB_EQUAL(bg))))) {
272 (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
273 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
274 bg = -1;
275 }
276
277 (*infoRec->SetupForCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
278 planemask);
279
280 if (skipleft) {
281 /* draw the first character only */
282
283 int count = h, line = startline;
284 int width = glyphWidth - skipleft;
285 CARD32 bits;
286
287 if (width > w)
288 width = w;
289 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, width, h,
290 0);
291
292 base = (CARD32 *) infoRec->ColorExpandBase;
293
294 while (count--) {
295 bits = SHIFT_R(glyphs[0][line++], skipleft);
296 if (width >= 22) {
297 WRITE_BITS3(bits);
298 }
299 else if (width >= 11) {
300 WRITE_BITS2(bits);
301 }
302 else {
303 WRITE_BITS1(bits);
304 }
305 }
306
307 w -= width;
308 if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
309 ((((3 * width + 31) >> 5) * h) & 1)) {
310 base = (CARD32 *) infoRec->ColorExpandBase;
311 base[0] = 0x00000000;
312 }
313 if (!w)
314 goto THE_END;
315 glyphs++;
316 x += width;
317 skipleft = 0; /* nicely aligned again */
318 }
319
320 dwords = ((3 * w + 31) >> 5) * h;
321 mem = (CARD32 *) malloc(((w + 31) >> 3) * sizeof(char));
322 if (!mem)
323 return;
324
325 (*infoRec->SubsequentCPUToScreenColorExpandFill) (pScrn, x, y, w, h, 0);
326
327 base = (CARD32 *) infoRec->ColorExpandBase;
328
329#ifndef FIXEDBASE
330 if ((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
331 while (h--) {
332 (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth);
333 base = DrawTextScanline3(base, mem, w);
334 }
335 else
336#endif
337 while (h--) {
338 (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth);
339 DrawTextScanline3(base, mem, w);
340 }
341
342 free(mem);
343
344 if ((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
345 (dwords & 1)) {
346 base = (CARD32 *) infoRec->ColorExpandBase;
347 base[0] = 0x00000000;
348 }
349
350 THE_END:
351
352 if (infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
353 (*infoRec->Sync) (pScrn);
354 else
355 SET_SYNC_FLAG(infoRec);
356}
357
358#ifndef FIXEDBASE
359/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
360
361void
362
363EXPNAME(XAATEGlyphRendererScanline) (ScrnInfoPtr pScrn,
364 int x, int y, int w, int h, int skipleft,
365 int startline, unsigned int **glyphs,
366 int glyphWidth, int fg, int bg, int rop,
367 unsigned planemask) {
368 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
369 int bufferNo;
370 CARD32 *base;
371 GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
372
373 if ((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
374 (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
375 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
376 bg = -1;
377 }
378
379 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
380 planemask);
381
382 if (skipleft &&
383 (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
384 (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
385 (skipleft > x)))) {
386 /* draw the first character only */
387
388 int count = h, line = startline;
389 int width = glyphWidth - skipleft;
390
391 if (width > w)
392 width = w;
393
394 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y,
395 width, h, 0);
396
397 bufferNo = 0;
398
399 while (count--) {
400 register CARD32 tmp = SHIFT_R(glyphs[0][line++], skipleft);
401
402 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
403 WRITE_BITS(tmp);
404 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
405 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
406 bufferNo = 0;
407 }
408
409 w -= width;
410 if (!w)
411 goto THE_END;
412 glyphs++;
413 x += width;
414 skipleft = 0; /* nicely aligned again */
415 }
416
417 w += skipleft;
418 x -= skipleft;
419
420 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
421 skipleft);
422
423 bufferNo = 0;
424
425 while (h--) {
426 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
427 (*GlyphFunc) (base, glyphs, startline++, w, glyphWidth);
428 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
429 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
430 bufferNo = 0;
431 }
432
433 THE_END:
434
435 SET_SYNC_FLAG(infoRec);
436}
437
438void
439
440EXPNAME(XAATEGlyphRendererScanline3) (ScrnInfoPtr pScrn,
441 int x, int y, int w, int h, int skipleft,
442 int startline, unsigned int **glyphs,
443 int glyphWidth, int fg, int bg, int rop,
444 unsigned planemask) {
445 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
446 int bufferNo;
447 CARD32 *base, *mem;
448 GlyphScanlineFuncPtr GlyphFunc =
449 XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
450
451 if ((bg != -1) &&
452 ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
453 ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
454 (!CHECK_RGB_EQUAL(bg))))) {
455 (*infoRec->SetupForSolidFill) (pScrn, bg, rop, planemask);
456 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
457 bg = -1;
458 }
459
460 (*infoRec->SetupForScanlineCPUToScreenColorExpandFill) (pScrn, fg, bg, rop,
461 planemask);
462
463 if (skipleft) {
464 /* draw the first character only */
465
466 int count = h, line = startline;
467 int width = glyphWidth - skipleft;
468 CARD32 bits;
469
470 if (width > w)
471 width = w;
472
473 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y,
474 width, h, 0);
475
476 bufferNo = 0;
477
478 while (count--) {
479 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
480 bits = SHIFT_R(glyphs[0][line++], skipleft);
481 if (width >= 22) {
482 WRITE_BITS3(bits);
483 }
484 else if (width >= 11) {
485 WRITE_BITS2(bits);
486 }
487 else {
488 WRITE_BITS1(bits);
489 }
490 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
491 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
492 bufferNo = 0;
493 }
494
495 w -= width;
496 if (!w)
497 goto THE_END;
498 glyphs++;
499 x += width;
500 skipleft = 0; /* nicely aligned again */
501 }
502
503 w += skipleft;
504 x -= skipleft;
505 mem = (CARD32 *) malloc(((w + 31) >> 3) * sizeof(char));
506 if (!mem)
507 return;
508
509 (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill) (pScrn, x, y, w, h,
510 skipleft);
511
512 bufferNo = 0;
513
514 while (h--) {
515 base = (CARD32 *) infoRec->ScanlineColorExpandBuffers[bufferNo];
516 (*GlyphFunc) (mem, glyphs, startline++, w, glyphWidth);
517 DrawTextScanline3(base, mem, w);
518 (*infoRec->SubsequentColorExpandScanline) (pScrn, bufferNo++);
519 if (bufferNo >= infoRec->NumScanlineColorExpandBuffers)
520 bufferNo = 0;
521 }
522
523 free(mem);
524
525 THE_END:
526
527 SET_SYNC_FLAG(infoRec);
528}
529
530#endif
531
532/********************************************************************
533
534 TRIPLE_BITS_24BPP scanline rendering code.
535
536********************************************************************/
537
538static CARD32 *
539DrawTextScanline3(CARD32 *base, CARD32 *mem, int width)
540{
541
542 while (width > 32) {
543 WRITE_BITS3(*mem);
544 mem++;
545 width -= 32;
546 }
547 if (width) {
548 if (width >= 22) {
549 WRITE_BITS3(*mem);
550 }
551 else if (width >= 11) {
552 WRITE_BITS2(*mem);
553 }
554 else {
555 WRITE_BITS1(*mem);
556 }
557 }
558
559 return base;
560}
561
562/********************************************************************
563
564 Generic TE scanline rendering code.
565
566********************************************************************/
567
568static CARD32 *
569DrawTETextScanlineGeneric(CARD32 *base,
570 unsigned int **glyphp,
571 int line, int width, int glyphwidth)
572{
573 CARD32 bits = (*glyphp)[line];
574 int shift = glyphwidth;
575
576 while (width > 32) {
577 while (shift < 32) {
578 glyphp++;
579 bits |= SHIFT_L((*glyphp)[line], shift);
580 shift += glyphwidth;
581 }
582 WRITE_BITS(bits);
583 shift &= 31;
584 if (shift)
585 bits = SHIFT_R((*glyphp)[line], (glyphwidth - shift));
586 else
587 bits = 0;
588 width -= 32;
589 }
590
591 if (width) {
592 width -= shift;
593 while (width > 0) {
594 glyphp++;
595 bits |= SHIFT_L((*glyphp)[line], shift);
596 shift += glyphwidth;
597 width -= glyphwidth;
598 }
599 WRITE_BITS(bits);
600 }
601
602 return base;
603}
604
605/********************************************************************
606
607 Loop unrolled TE font scanline rendering code
608
609********************************************************************/
610
611#ifndef USEASSEMBLER
612static CARD32 *
613DrawTETextScanlineWidth6(CARD32 *base,
614 unsigned int **glyphp,
615 int line, int width, int glyphwidth)
616{
617 while (1) {
618 unsigned int bits;
619
620 bits = glyphp[0][line];
621 bits |= SHIFT_L(glyphp[1][line], 6);
622 bits |= SHIFT_L(glyphp[2][line], 12);
623 bits |= SHIFT_L(glyphp[3][line], 18);
624 bits |= SHIFT_L(glyphp[4][line], 24);
625 bits |= SHIFT_L(glyphp[5][line], 30);
626 WRITE_IN_BITORDER(base, 0, bits);
627 CHECKRETURN(1);
628 bits = SHIFT_R(glyphp[5][line], 2);
629 bits |= SHIFT_L(glyphp[6][line], 4);
630 bits |= SHIFT_L(glyphp[7][line], 10);
631 bits |= SHIFT_L(glyphp[8][line], 16);
632 bits |= SHIFT_L(glyphp[9][line], 22);
633 bits |= SHIFT_L(glyphp[10][line], 28);
634 WRITE_IN_BITORDER(base, 1, bits);
635 CHECKRETURN(2);
636 bits = SHIFT_R(glyphp[10][line], 4);
637 bits |= SHIFT_L(glyphp[11][line], 2);
638 bits |= SHIFT_L(glyphp[12][line], 8);
639 bits |= SHIFT_L(glyphp[13][line], 14);
640 bits |= SHIFT_L(glyphp[14][line], 20);
641 bits |= SHIFT_L(glyphp[15][line], 26);
642 WRITE_IN_BITORDER(base, 2, bits);
643 CHECKRETURN(3);
644#ifndef FIXEDBASE
645 base += 3;
646#endif
647 width -= 96;
648 glyphp += 16;
649 }
650 return base;
651}
652#endif
653
654static CARD32 *
655DrawTETextScanlineWidth7(CARD32 *base,
656 unsigned int **glyphp,
657 int line, int width, int glyphwidth)
658{
659 while (1) {
660 unsigned int bits;
661
662 bits = glyphp[0][line];
663 bits |= SHIFT_L(glyphp[1][line], 7);
664 bits |= SHIFT_L(glyphp[2][line], 14);
665 bits |= SHIFT_L(glyphp[3][line], 21);
666 bits |= SHIFT_L(glyphp[4][line], 28);
667 WRITE_IN_BITORDER(base, 0, bits);
668 CHECKRETURN(1);
669 bits = SHIFT_R(glyphp[4][line], 4);
670 bits |= SHIFT_L(glyphp[5][line], 3);
671 bits |= SHIFT_L(glyphp[6][line], 10);
672 bits |= SHIFT_L(glyphp[7][line], 17);
673 bits |= SHIFT_L(glyphp[8][line], 24);
674 bits |= SHIFT_L(glyphp[9][line], 31);
675 WRITE_IN_BITORDER(base, 1, bits);
676 CHECKRETURN(2);
677 bits = SHIFT_R(glyphp[9][line], 1);
678 bits |= SHIFT_L(glyphp[10][line], 6);
679 bits |= SHIFT_L(glyphp[11][line], 13);
680 bits |= SHIFT_L(glyphp[12][line], 20);
681 bits |= SHIFT_L(glyphp[13][line], 27);
682 WRITE_IN_BITORDER(base, 2, bits);
683 CHECKRETURN(3);
684 bits = SHIFT_R(glyphp[13][line], 5);
685 bits |= SHIFT_L(glyphp[14][line], 2);
686 bits |= SHIFT_L(glyphp[15][line], 9);
687 bits |= SHIFT_L(glyphp[16][line], 16);
688 bits |= SHIFT_L(glyphp[17][line], 23);
689 bits |= SHIFT_L(glyphp[18][line], 30);
690 WRITE_IN_BITORDER(base, 3, bits);
691 CHECKRETURN(4);
692 bits = SHIFT_R(glyphp[18][line], 2);
693 bits |= SHIFT_L(glyphp[19][line], 5);
694 bits |= SHIFT_L(glyphp[20][line], 12);
695 bits |= SHIFT_L(glyphp[21][line], 19);
696 bits |= SHIFT_L(glyphp[22][line], 26);
697 WRITE_IN_BITORDER(base, 4, bits);
698 CHECKRETURN(5);
699 bits = SHIFT_R(glyphp[22][line], 6);
700 bits |= SHIFT_L(glyphp[23][line], 1);
701 bits |= SHIFT_L(glyphp[24][line], 8);
702 bits |= SHIFT_L(glyphp[25][line], 15);
703 bits |= SHIFT_L(glyphp[26][line], 22);
704 bits |= SHIFT_L(glyphp[27][line], 29);
705 WRITE_IN_BITORDER(base, 5, bits);
706 CHECKRETURN(6);
707 bits = SHIFT_R(glyphp[27][line], 3);
708 bits |= SHIFT_L(glyphp[28][line], 4);
709 bits |= SHIFT_L(glyphp[29][line], 11);
710 bits |= SHIFT_L(glyphp[30][line], 18);
711 bits |= SHIFT_L(glyphp[31][line], 25);
712 WRITE_IN_BITORDER(base, 6, bits);
713 CHECKRETURN(7);
714#ifndef FIXEDBASE
715 base += 7;
716#endif
717 width -= 224;
718 glyphp += 32;
719 }
720 return base;
721}
722
723#ifndef USEASSEMBLER
724static CARD32 *
725DrawTETextScanlineWidth8(CARD32 *base,
726 unsigned int **glyphp,
727 int line, int width, int glyphwidth)
728{
729 while (1) {
730 unsigned int bits;
731
732 bits = glyphp[0][line];
733 bits |= SHIFT_L(glyphp[1][line], 8);
734 bits |= SHIFT_L(glyphp[2][line], 16);
735 bits |= SHIFT_L(glyphp[3][line], 24);
736 WRITE_IN_BITORDER(base, 0, bits);
737 CHECKRETURN(1);
738 bits = glyphp[4][line];
739 bits |= SHIFT_L(glyphp[5][line], 8);
740 bits |= SHIFT_L(glyphp[6][line], 16);
741 bits |= SHIFT_L(glyphp[7][line], 24);
742 WRITE_IN_BITORDER(base, 1, bits);
743 CHECKRETURN(2);
744#ifndef FIXEDBASE
745 base += 2;
746#endif
747 width -= 64;
748 glyphp += 8;
749 }
750 return base;
751}
752#endif
753
754#ifndef USEASSEMBLER
755static CARD32 *
756DrawTETextScanlineWidth9(CARD32 *base,
757 unsigned int **glyphp,
758 int line, int width, int glyphwidth)
759{
760 while (1) {
761 unsigned int bits;
762
763 bits = glyphp[0][line];
764 bits |= SHIFT_L(glyphp[1][line], 9);
765 bits |= SHIFT_L(glyphp[2][line], 18);
766 bits |= SHIFT_L(glyphp[3][line], 27);
767 WRITE_IN_BITORDER(base, 0, bits);
768 CHECKRETURN(1);
769 bits = SHIFT_R(glyphp[3][line], 5);
770 bits |= SHIFT_L(glyphp[4][line], 4);
771 bits |= SHIFT_L(glyphp[5][line], 13);
772 bits |= SHIFT_L(glyphp[6][line], 22);
773 bits |= SHIFT_L(glyphp[7][line], 31);
774 WRITE_IN_BITORDER(base, 1, bits);
775 CHECKRETURN(2);
776 bits = SHIFT_R(glyphp[7][line], 1);
777 bits |= SHIFT_L(glyphp[8][line], 8);
778 bits |= SHIFT_L(glyphp[9][line], 17);
779 bits |= SHIFT_L(glyphp[10][line], 26);
780 WRITE_IN_BITORDER(base, 2, bits);
781 CHECKRETURN(3);
782 bits = SHIFT_R(glyphp[10][line], 6);
783 bits |= SHIFT_L(glyphp[11][line], 3);
784 bits |= SHIFT_L(glyphp[12][line], 12);
785 bits |= SHIFT_L(glyphp[13][line], 21);
786 bits |= SHIFT_L(glyphp[14][line], 30);
787 WRITE_IN_BITORDER(base, 3, bits);
788 CHECKRETURN(4);
789 bits = SHIFT_R(glyphp[14][line], 2);
790 bits |= SHIFT_L(glyphp[15][line], 7);
791 bits |= SHIFT_L(glyphp[16][line], 16);
792 bits |= SHIFT_L(glyphp[17][line], 25);
793 WRITE_IN_BITORDER(base, 4, bits);
794 CHECKRETURN(5);
795 bits = SHIFT_R(glyphp[17][line], 7);
796 bits |= SHIFT_L(glyphp[18][line], 2);
797 bits |= SHIFT_L(glyphp[19][line], 11);
798 bits |= SHIFT_L(glyphp[20][line], 20);
799 bits |= SHIFT_L(glyphp[21][line], 29);
800 WRITE_IN_BITORDER(base, 5, bits);
801 CHECKRETURN(6);
802 bits = SHIFT_R(glyphp[21][line], 3);
803 bits |= SHIFT_L(glyphp[22][line], 6);
804 bits |= SHIFT_L(glyphp[23][line], 15);
805 bits |= SHIFT_L(glyphp[24][line], 24);
806 WRITE_IN_BITORDER(base, 6, bits);
807 CHECKRETURN(7);
808 bits = SHIFT_R(glyphp[24][line], 8);
809 bits |= SHIFT_L(glyphp[25][line], 1);
810 bits |= SHIFT_L(glyphp[26][line], 10);
811 bits |= SHIFT_L(glyphp[27][line], 19);
812 bits |= SHIFT_L(glyphp[28][line], 28);
813 WRITE_IN_BITORDER(base, 7, bits);
814 CHECKRETURN(8);
815 bits = SHIFT_R(glyphp[28][line], 4);
816 bits |= SHIFT_L(glyphp[29][line], 5);
817 bits |= SHIFT_L(glyphp[30][line], 14);
818 bits |= SHIFT_L(glyphp[31][line], 23);
819 WRITE_IN_BITORDER(base, 8, bits);
820 CHECKRETURN(9);
821#ifndef FIXEDBASE
822 base += 9;
823#endif
824 width -= 288;
825 glyphp += 32;
826 }
827 return base;
828}
829#endif
830
831static CARD32 *
832DrawTETextScanlineWidth10(CARD32 *base,
833 unsigned int **glyphp,
834 int line, int width, int glyphwidth)
835{
836 while (1) {
837 unsigned int bits;
838
839 bits = glyphp[0][line];
840 bits |= SHIFT_L(glyphp[1][line], 10);
841 bits |= SHIFT_L(glyphp[2][line], 20);
842 bits |= SHIFT_L(glyphp[3][line], 30);
843 WRITE_IN_BITORDER(base, 0, bits);
844 CHECKRETURN(1);
845 bits = SHIFT_R(glyphp[3][line], 2);
846 bits |= SHIFT_L(glyphp[4][line], 8);
847 bits |= SHIFT_L(glyphp[5][line], 18);
848 bits |= SHIFT_L(glyphp[6][line], 28);
849 WRITE_IN_BITORDER(base, 1, bits);
850 CHECKRETURN(2);
851 bits = SHIFT_R(glyphp[6][line], 4);
852 bits |= SHIFT_L(glyphp[7][line], 6);
853 bits |= SHIFT_L(glyphp[8][line], 16);
854 bits |= SHIFT_L(glyphp[9][line], 26);
855 WRITE_IN_BITORDER(base, 2, bits);
856 CHECKRETURN(3);
857 bits = SHIFT_R(glyphp[9][line], 6);
858 bits |= SHIFT_L(glyphp[10][line], 4);
859 bits |= SHIFT_L(glyphp[11][line], 14);
860 bits |= SHIFT_L(glyphp[12][line], 24);
861 WRITE_IN_BITORDER(base, 3, bits);
862 CHECKRETURN(4);
863 bits = SHIFT_R(glyphp[12][line], 8);
864 bits |= SHIFT_L(glyphp[13][line], 2);
865 bits |= SHIFT_L(glyphp[14][line], 12);
866 bits |= SHIFT_L(glyphp[15][line], 22);
867 WRITE_IN_BITORDER(base, 4, bits);
868 CHECKRETURN(5);
869#ifndef FIXEDBASE
870 base += 5;
871#endif
872 width -= 160;
873 glyphp += 16;
874 }
875 return base;
876}
877
878static CARD32 *
879DrawTETextScanlineWidth12(CARD32 *base,
880 unsigned int **glyphp,
881 int line, int width, int glyphwidth)
882{
883 while (1) {
884 unsigned int bits;
885
886 bits = glyphp[0][line];
887 bits |= SHIFT_L(glyphp[1][line], 12);
888 bits |= SHIFT_L(glyphp[2][line], 24);
889 WRITE_IN_BITORDER(base, 0, bits);
890 CHECKRETURN(1);
891 bits = SHIFT_R(glyphp[2][line], 8);
892 bits |= SHIFT_L(glyphp[3][line], 4);
893 bits |= SHIFT_L(glyphp[4][line], 16);
894 bits |= SHIFT_L(glyphp[5][line], 28);
895 WRITE_IN_BITORDER(base, 1, bits);
896 CHECKRETURN(2);
897 bits = SHIFT_R(glyphp[5][line], 4);
898 bits |= SHIFT_L(glyphp[6][line], 8);
899 bits |= SHIFT_L(glyphp[7][line], 20);
900 WRITE_IN_BITORDER(base, 2, bits);
901 CHECKRETURN(3);
902#ifndef FIXEDBASE
903 base += 3;
904#endif
905 width -= 96;
906 glyphp += 8;
907 }
908 return base;
909}
910
911static CARD32 *
912DrawTETextScanlineWidth14(CARD32 *base,
913 unsigned int **glyphp,
914 int line, int width, int glyphwidth)
915{
916 while (1) {
917 unsigned int bits;
918
919 bits = glyphp[0][line];
920 bits |= SHIFT_L(glyphp[1][line], 14);
921 bits |= SHIFT_L(glyphp[2][line], 28);
922 WRITE_IN_BITORDER(base, 0, bits);
923 CHECKRETURN(1);
924 bits = SHIFT_R(glyphp[2][line], 4);
925 bits |= SHIFT_L(glyphp[3][line], 10);
926 bits |= SHIFT_L(glyphp[4][line], 24);
927 WRITE_IN_BITORDER(base, 1, bits);
928 CHECKRETURN(2);
929 bits = SHIFT_R(glyphp[4][line], 8);
930 bits |= SHIFT_L(glyphp[5][line], 6);
931 bits |= SHIFT_L(glyphp[6][line], 20);
932 WRITE_IN_BITORDER(base, 2, bits);
933 CHECKRETURN(3);
934 bits = SHIFT_R(glyphp[6][line], 12);
935 bits |= SHIFT_L(glyphp[7][line], 2);
936 bits |= SHIFT_L(glyphp[8][line], 16);
937 bits |= SHIFT_L(glyphp[9][line], 30);
938 WRITE_IN_BITORDER(base, 3, bits);
939 CHECKRETURN(4);
940 bits = SHIFT_R(glyphp[9][line], 2);
941 bits |= SHIFT_L(glyphp[10][line], 12);
942 bits |= SHIFT_L(glyphp[11][line], 26);
943 WRITE_IN_BITORDER(base, 4, bits);
944 CHECKRETURN(5);
945 bits = SHIFT_R(glyphp[11][line], 6);
946 bits |= SHIFT_L(glyphp[12][line], 8);
947 bits |= SHIFT_L(glyphp[13][line], 22);
948 WRITE_IN_BITORDER(base, 5, bits);
949 CHECKRETURN(6);
950 bits = SHIFT_R(glyphp[13][line], 10);
951 bits |= SHIFT_L(glyphp[14][line], 4);
952 bits |= SHIFT_L(glyphp[15][line], 18);
953 WRITE_IN_BITORDER(base, 6, bits);
954 CHECKRETURN(7);
955#ifndef FIXEDBASE
956 base += 7;
957#endif
958 width -= 224;
959 glyphp += 16;
960 }
961 return base;
962}
963
964static CARD32 *
965DrawTETextScanlineWidth16(CARD32 *base,
966 unsigned int **glyphp,
967 int line, int width, int glyphwidth)
968{
969 while (1) {
970 unsigned int bits;
971
972 bits = glyphp[0][line];
973 bits |= SHIFT_L(glyphp[1][line], 16);
974 WRITE_IN_BITORDER(base, 0, bits);
975 CHECKRETURN(1);
976 bits = glyphp[2][line];
977 bits |= SHIFT_L(glyphp[3][line], 16);
978 WRITE_IN_BITORDER(base, 1, bits);
979 CHECKRETURN(2);
980 bits = glyphp[4][line];
981 bits |= SHIFT_L(glyphp[5][line], 16);
982 WRITE_IN_BITORDER(base, 2, bits);
983 CHECKRETURN(3);
984 bits = glyphp[6][line];
985 bits |= SHIFT_L(glyphp[7][line], 16);
986 WRITE_IN_BITORDER(base, 3, bits);
987 CHECKRETURN(4);
988#ifndef FIXEDBASE
989 base += 4;
990#endif
991 width -= 128;
992 glyphp += 8;
993 }
994 return base;
995}
996
997static CARD32 *
998DrawTETextScanlineWidth18(CARD32 *base,
999 unsigned int **glyphp,
1000 int line, int width, int glyphwidth)
1001{
1002 while (1) {
1003 unsigned int bits;
1004
1005 bits = glyphp[0][line];
1006 bits |= SHIFT_L(glyphp[1][line], 18);
1007 WRITE_IN_BITORDER(base, 0, bits);
1008 CHECKRETURN(1);
1009 bits = SHIFT_R(glyphp[1][line], 14);
1010 bits |= SHIFT_L(glyphp[2][line], 4);
1011 bits |= SHIFT_L(glyphp[3][line], 22);
1012 WRITE_IN_BITORDER(base, 1, bits);
1013 CHECKRETURN(2);
1014 bits = SHIFT_R(glyphp[3][line], 10);
1015 bits |= SHIFT_L(glyphp[4][line], 8);
1016 bits |= SHIFT_L(glyphp[5][line], 26);
1017 WRITE_IN_BITORDER(base, 2, bits);
1018 CHECKRETURN(3);
1019 bits = SHIFT_R(glyphp[5][line], 6);
1020 bits |= SHIFT_L(glyphp[6][line], 12);
1021 bits |= SHIFT_L(glyphp[7][line], 30);
1022 WRITE_IN_BITORDER(base, 3, bits);
1023 CHECKRETURN(4);
1024 bits = SHIFT_R(glyphp[7][line], 2);
1025 bits |= SHIFT_L(glyphp[8][line], 16);
1026 WRITE_IN_BITORDER(base, 4, bits);
1027 CHECKRETURN(5);
1028 bits = SHIFT_R(glyphp[8][line], 16);
1029 bits |= SHIFT_L(glyphp[9][line], 2);
1030 bits |= SHIFT_L(glyphp[10][line], 20);
1031 WRITE_IN_BITORDER(base, 5, bits);
1032 CHECKRETURN(6);
1033 bits = SHIFT_R(glyphp[10][line], 12);
1034 bits |= SHIFT_L(glyphp[11][line], 6);
1035 bits |= SHIFT_L(glyphp[12][line], 24);
1036 WRITE_IN_BITORDER(base, 6, bits);
1037 CHECKRETURN(7);
1038 bits = SHIFT_R(glyphp[12][line], 8);
1039 bits |= SHIFT_L(glyphp[13][line], 10);
1040 bits |= SHIFT_L(glyphp[14][line], 28);
1041 WRITE_IN_BITORDER(base, 7, bits);
1042 CHECKRETURN(8);
1043 bits = SHIFT_R(glyphp[14][line], 4);
1044 bits |= SHIFT_L(glyphp[15][line], 14);
1045 WRITE_IN_BITORDER(base, 8, bits);
1046 CHECKRETURN(9);
1047#ifndef FIXEDBASE
1048 base += 9;
1049#endif
1050 width -= 288;
1051 glyphp += 16;
1052 }
1053 return base;
1054}
1055
1056static CARD32 *
1057DrawTETextScanlineWidth24(CARD32 *base,
1058 unsigned int **glyphp,
1059 int line, int width, int glyphwidth)
1060{
1061 while (1) {
1062 unsigned int bits;
1063
1064 bits = glyphp[0][line];
1065 bits |= SHIFT_L(glyphp[1][line], 24);
1066 WRITE_IN_BITORDER(base, 0, bits);
1067 CHECKRETURN(1);
1068 bits = SHIFT_R(glyphp[1][line], 8);
1069 bits |= SHIFT_L(glyphp[2][line], 16);
1070 WRITE_IN_BITORDER(base, 1, bits);
1071 CHECKRETURN(2);
1072 bits = SHIFT_R(glyphp[2][line], 16);
1073 bits |= SHIFT_L(glyphp[3][line], 8);
1074 WRITE_IN_BITORDER(base, 2, bits);
1075 CHECKRETURN(3);
1076#ifndef FIXEDBASE
1077 base += 3;
1078#endif
1079 width -= 96;
1080 glyphp += 4;
1081 }
1082 return base;
1083}
diff --git a/hw/xfree86/xaa/xaaTEText.c b/hw/xfree86/xaa/xaaTEText.c
deleted file mode 100644
index a5ef44768..000000000
--- a/hw/xfree86/xaa/xaaTEText.c
+++ /dev/null
@@ -1,295 +0,0 @@
1
2/********************************************************************
3
4 In this file we have GC level replacements for PolyText8/16,
5 ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts.
6 The idea is that everything in this file is device independent.
7 The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion
8 which calculates the boxes containing arbitrarily clipped text
9 and passes them to the TEGlyphRenderer which will usually be a lower
10 level XAA function which renders these clipped glyphs using
11 the basic color expansion functions exported by the chipset driver.
12 The TEGlyphRenderer itself may optionally be driver supplied to
13 facilitate work-arounds/optimizations at a higher level than usual.
14
15 v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu)
16
17********************************************************************/
18
19#ifdef HAVE_XORG_CONFIG_H
20#include <xorg-config.h>
21#endif
22
23#include "misc.h"
24#include "xf86.h"
25#include "xf86_OSproc.h"
26
27#include <X11/X.h>
28#include <X11/fonts/font.h>
29#include "scrnintstr.h"
30#include "dixfontstr.h"
31#include "xf86str.h"
32#include "xaa.h"
33#include "xaalocal.h"
34#include "gcstruct.h"
35#include "pixmapstr.h"
36
37static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
38 int yInit, FontPtr font, int fg, int bg,
39 int rop, unsigned int planemask,
40 RegionPtr cclip, int nglyph,
41 unsigned char *gBase,
42 CharInfoPtr * ppci);
43
44/********************************************************************
45
46 GC level replacements for PolyText8/16 and ImageText8/16
47 for TE fonts when using color expansion.
48
49********************************************************************/
50
51int
52XAAPolyText8TEColorExpansion(DrawablePtr pDraw,
53 GCPtr pGC, int x, int y, int count, char *chars)
54{
55 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
56 unsigned long n;
57
58 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
59 (unsigned char *) chars, Linear8Bit, &n,
60 infoRec->CharInfo);
61
62 /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */
63 if (n)
64 XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
65 pGC->font, pGC->fgPixel, -1, pGC->alu,
66 pGC->planemask, pGC->pCompositeClip, n,
67 FONTGLYPHS(pGC->font), infoRec->CharInfo);
68
69 return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
70}
71
72int
73XAAPolyText16TEColorExpansion(DrawablePtr pDraw,
74 GCPtr pGC,
75 int x, int y, int count, unsigned short *chars)
76{
77 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
78 unsigned long n;
79
80 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
81 (unsigned char *) chars,
82 (FONTLASTROW(pGC->font) ==
83 0) ? Linear16Bit : TwoD16Bit, &n,
84 infoRec->CharInfo);
85
86 if (n)
87 XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
88 pGC->font, pGC->fgPixel, -1, pGC->alu,
89 pGC->planemask, pGC->pCompositeClip, n,
90 FONTGLYPHS(pGC->font), infoRec->CharInfo);
91
92 return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
93}
94
95void
96XAAImageText8TEColorExpansion(DrawablePtr pDraw,
97 GCPtr pGC, int x, int y, int count, char *chars)
98{
99 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
100 unsigned long n;
101
102 if (!RegionNumRects(pGC->pCompositeClip))
103 return;
104
105 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
106 (unsigned char *) chars, Linear8Bit, &n,
107 infoRec->CharInfo);
108
109 if (n)
110 XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
111 pGC->font, pGC->fgPixel, pGC->bgPixel,
112 GXcopy, pGC->planemask, pGC->pCompositeClip,
113 n, FONTGLYPHS(pGC->font),
114 infoRec->CharInfo);
115}
116
117void
118XAAImageText16TEColorExpansion(DrawablePtr pDraw,
119 GCPtr pGC,
120 int x, int y, int count, unsigned short *chars)
121{
122 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
123 unsigned long n;
124
125 if (!RegionNumRects(pGC->pCompositeClip))
126 return;
127
128 (*pGC->font->get_glyphs) (pGC->font, (unsigned long) count,
129 (unsigned char *) chars,
130 (FONTLASTROW(pGC->font) ==
131 0) ? Linear16Bit : TwoD16Bit, &n,
132 infoRec->CharInfo);
133
134 if (n)
135 XAAGlyphBltTEColorExpansion(infoRec->pScrn, x + pDraw->x, y + pDraw->y,
136 pGC->font, pGC->fgPixel, pGC->bgPixel,
137 GXcopy, pGC->planemask, pGC->pCompositeClip,
138 n, FONTGLYPHS(pGC->font),
139 infoRec->CharInfo);
140}
141
142/********************************************************************
143
144 GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
145 TE fonts when using color expansion.
146
147********************************************************************/
148
149void
150XAAImageGlyphBltTEColorExpansion(DrawablePtr pDrawable,
151 GCPtr pGC,
152 int xInit, int yInit,
153 unsigned int nglyph,
154 CharInfoPtr * ppci, pointer pglyphBase)
155{
156 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
157
158 if (!RegionNumRects(pGC->pCompositeClip))
159 return;
160
161 XAAGlyphBltTEColorExpansion(infoRec->pScrn, xInit + pDrawable->x,
162 yInit + pDrawable->y, pGC->font, pGC->fgPixel,
163 pGC->bgPixel, GXcopy, pGC->planemask,
164 pGC->pCompositeClip, nglyph,
165 (unsigned char *) pglyphBase, ppci);
166}
167
168void
169XAAPolyGlyphBltTEColorExpansion(DrawablePtr pDrawable,
170 GCPtr pGC,
171 int xInit, int yInit,
172 unsigned int nglyph,
173 CharInfoPtr * ppci, pointer pglyphBase)
174{
175 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
176
177 if (!RegionNumRects(pGC->pCompositeClip))
178 return;
179
180 XAAGlyphBltTEColorExpansion(infoRec->pScrn, xInit + pDrawable->x,
181 yInit + pDrawable->y, pGC->font, pGC->fgPixel,
182 -1, pGC->alu, pGC->planemask,
183 pGC->pCompositeClip, nglyph,
184 (unsigned char *) pglyphBase, ppci);
185}
186
187/********************************************************************
188
189 XAAGlyphBltTEColorExpansion -
190
191 This guy computes the clipped pieces of text and sends it to
192 the lower-level function which will handle acceleration of
193 arbitrarily clipped text.
194
195********************************************************************/
196
197static void
198XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn,
199 int xInit, int yInit,
200 FontPtr font,
201 int fg, int bg,
202 int rop,
203 unsigned int planemask,
204 RegionPtr cclip,
205 int nglyph,
206 unsigned char *gBase, CharInfoPtr * ppci)
207{
208 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
209 int skippix, skipglyphs;
210 int Left, Right, Top, Bottom;
211 int LeftEdge, RightEdge, ytop, ybot;
212 int nbox = RegionNumRects(cclip);
213 BoxPtr pbox = RegionRects(cclip);
214 unsigned int **glyphs = NULL;
215 int glyphWidth = FONTMAXBOUNDS(font, characterWidth);
216
217 /* find the size of the box */
218 Left = xInit;
219 Right = Left + (glyphWidth * nglyph);
220 Top = yInit - FONTASCENT(font);
221 Bottom = yInit + FONTDESCENT(font);
222
223 /* get into the first band that may contain part of our string */
224 while (nbox && (Top >= pbox->y2)) {
225 pbox++;
226 nbox--;
227 }
228
229 /* stop when the lower edge of the box is beyond our string */
230 while (nbox && (Bottom > pbox->y1)) {
231 LeftEdge = max(Left, pbox->x1);
232 RightEdge = min(Right, pbox->x2);
233
234 if (RightEdge > LeftEdge) { /* we have something to draw */
235 unsigned int *fallbackBits = NULL;
236
237 ytop = max(Top, pbox->y1);
238 ybot = min(Bottom, pbox->y2);
239
240 if ((skippix = LeftEdge - Left)) {
241 skipglyphs = skippix / glyphWidth;
242 skippix %= glyphWidth;
243 }
244 else
245 skipglyphs = 0;
246
247 if (!glyphs) {
248 int count;
249
250 glyphs = (unsigned int **) (infoRec->PreAllocMem);
251
252 for (count = 0; count < nglyph; count++) {
253 glyphs[count] = (unsigned int *)
254 FONTGLYPHBITS(gBase, *ppci++);
255 if (!glyphs[count]) {
256 /* Glyphs with NULL bits do exist in the wild.
257 Replace with blank bits in that case */
258
259 if (!fallbackBits) {
260 int fontHeight = Bottom - Top + 1;
261
262 fallbackBits = calloc(glyphWidth * fontHeight, 1);
263 if (!fallbackBits)
264 return;
265 }
266 glyphs[count] = fallbackBits;
267 }
268 }
269
270 /* our new unrolled TE code only writes DWORDS at a time
271 so it can read up to 6 characters past the last one
272 we're displaying */
273 glyphs[count + 0] = glyphs[0];
274 glyphs[count + 1] = glyphs[0];
275 glyphs[count + 2] = glyphs[0];
276 glyphs[count + 3] = glyphs[0];
277 glyphs[count + 4] = glyphs[0];
278 glyphs[count + 5] = glyphs[0];
279 }
280
281 /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */
282
283 (*infoRec->TEGlyphRenderer) (pScrn,
284 LeftEdge, ytop, RightEdge - LeftEdge,
285 ybot - ytop, skippix, ytop - Top,
286 glyphs + skipglyphs, glyphWidth, fg,
287 bg, rop, planemask);
288
289 free(fallbackBits);
290 }
291
292 nbox--;
293 pbox++;
294 }
295}
diff --git a/hw/xfree86/xaa/xaaTables.c b/hw/xfree86/xaa/xaaTables.c
deleted file mode 100644
index 35641da59..000000000
--- a/hw/xfree86/xaa/xaaTables.c
+++ /dev/null
@@ -1,152 +0,0 @@
1#ifdef HAVE_XORG_CONFIG_H
2#include <xorg-config.h>
3#endif
4#include "xaalocal.h"
5/*
6 * This is a table of 24-bit values, indexed with an 8-bit byte value, then
7 * expands each bit to three consecutive bits. This is required for color
8 * expansion in 24bpp mode with the coprocessor in 8bpp mode, with LSB-first
9 * bit order within a byte.
10 */
11
12unsigned int byte_expand3[256] = {
13 0x000000, 0x000007, 0x000038, 0x00003F, 0x0001C0, 0x0001C7, 0x0001F8,
14 0x0001FF,
15 0x000E00, 0x000E07, 0x000E38, 0x000E3F, 0x000FC0, 0x000FC7, 0x000FF8,
16 0x000FFF,
17 0x007000, 0x007007, 0x007038, 0x00703F, 0x0071C0, 0x0071C7, 0x0071F8,
18 0x0071FF,
19 0x007E00, 0x007E07, 0x007E38, 0x007E3F, 0x007FC0, 0x007FC7, 0x007FF8,
20 0x007FFF,
21 0x038000, 0x038007, 0x038038, 0x03803F, 0x0381C0, 0x0381C7, 0x0381F8,
22 0x0381FF,
23 0x038E00, 0x038E07, 0x038E38, 0x038E3F, 0x038FC0, 0x038FC7, 0x038FF8,
24 0x038FFF,
25 0x03F000, 0x03F007, 0x03F038, 0x03F03F, 0x03F1C0, 0x03F1C7, 0x03F1F8,
26 0x03F1FF,
27 0x03FE00, 0x03FE07, 0x03FE38, 0x03FE3F, 0x03FFC0, 0x03FFC7, 0x03FFF8,
28 0x03FFFF,
29 0x1C0000, 0x1C0007, 0x1C0038, 0x1C003F, 0x1C01C0, 0x1C01C7, 0x1C01F8,
30 0x1C01FF,
31 0x1C0E00, 0x1C0E07, 0x1C0E38, 0x1C0E3F, 0x1C0FC0, 0x1C0FC7, 0x1C0FF8,
32 0x1C0FFF,
33 0x1C7000, 0x1C7007, 0x1C7038, 0x1C703F, 0x1C71C0, 0x1C71C7, 0x1C71F8,
34 0x1C71FF,
35 0x1C7E00, 0x1C7E07, 0x1C7E38, 0x1C7E3F, 0x1C7FC0, 0x1C7FC7, 0x1C7FF8,
36 0x1C7FFF,
37 0x1F8000, 0x1F8007, 0x1F8038, 0x1F803F, 0x1F81C0, 0x1F81C7, 0x1F81F8,
38 0x1F81FF,
39 0x1F8E00, 0x1F8E07, 0x1F8E38, 0x1F8E3F, 0x1F8FC0, 0x1F8FC7, 0x1F8FF8,
40 0x1F8FFF,
41 0x1FF000, 0x1FF007, 0x1FF038, 0x1FF03F, 0x1FF1C0, 0x1FF1C7, 0x1FF1F8,
42 0x1FF1FF,
43 0x1FFE00, 0x1FFE07, 0x1FFE38, 0x1FFE3F, 0x1FFFC0, 0x1FFFC7, 0x1FFFF8,
44 0x1FFFFF,
45 0xE00000, 0xE00007, 0xE00038, 0xE0003F, 0xE001C0, 0xE001C7, 0xE001F8,
46 0xE001FF,
47 0xE00E00, 0xE00E07, 0xE00E38, 0xE00E3F, 0xE00FC0, 0xE00FC7, 0xE00FF8,
48 0xE00FFF,
49 0xE07000, 0xE07007, 0xE07038, 0xE0703F, 0xE071C0, 0xE071C7, 0xE071F8,
50 0xE071FF,
51 0xE07E00, 0xE07E07, 0xE07E38, 0xE07E3F, 0xE07FC0, 0xE07FC7, 0xE07FF8,
52 0xE07FFF,
53 0xE38000, 0xE38007, 0xE38038, 0xE3803F, 0xE381C0, 0xE381C7, 0xE381F8,
54 0xE381FF,
55 0xE38E00, 0xE38E07, 0xE38E38, 0xE38E3F, 0xE38FC0, 0xE38FC7, 0xE38FF8,
56 0xE38FFF,
57 0xE3F000, 0xE3F007, 0xE3F038, 0xE3F03F, 0xE3F1C0, 0xE3F1C7, 0xE3F1F8,
58 0xE3F1FF,
59 0xE3FE00, 0xE3FE07, 0xE3FE38, 0xE3FE3F, 0xE3FFC0, 0xE3FFC7, 0xE3FFF8,
60 0xE3FFFF,
61 0xFC0000, 0xFC0007, 0xFC0038, 0xFC003F, 0xFC01C0, 0xFC01C7, 0xFC01F8,
62 0xFC01FF,
63 0xFC0E00, 0xFC0E07, 0xFC0E38, 0xFC0E3F, 0xFC0FC0, 0xFC0FC7, 0xFC0FF8,
64 0xFC0FFF,
65 0xFC7000, 0xFC7007, 0xFC7038, 0xFC703F, 0xFC71C0, 0xFC71C7, 0xFC71F8,
66 0xFC71FF,
67 0xFC7E00, 0xFC7E07, 0xFC7E38, 0xFC7E3F, 0xFC7FC0, 0xFC7FC7, 0xFC7FF8,
68 0xFC7FFF,
69 0xFF8000, 0xFF8007, 0xFF8038, 0xFF803F, 0xFF81C0, 0xFF81C7, 0xFF81F8,
70 0xFF81FF,
71 0xFF8E00, 0xFF8E07, 0xFF8E38, 0xFF8E3F, 0xFF8FC0, 0xFF8FC7, 0xFF8FF8,
72 0xFF8FFF,
73 0xFFF000, 0xFFF007, 0xFFF038, 0xFFF03F, 0xFFF1C0, 0xFFF1C7, 0xFFF1F8,
74 0xFFF1FF,
75 0xFFFE00, 0xFFFE07, 0xFFFE38, 0xFFFE3F, 0xFFFFC0, 0xFFFFC7, 0xFFFFF8,
76 0xFFFFFF
77};
78
79/*
80 * This is a table of 24-bit values, indexed with an 8-bit byte value,
81 * that reverses the bit order of a byte and then expands each bit to three
82 * consecutive bits. This is required for color expansion in 24bpp mode
83 * with the coprocessor in 8bpp mode, with MSB-first bit order within a
84 * byte.
85 */
86
87unsigned int byte_reversed_expand3[256] = {
88 0x000000, 0x0000E0, 0x00001C, 0x0000FC, 0x008003, 0x0080E3, 0x00801F,
89 0x0080FF,
90 0x007000, 0x0070E0, 0x00701C, 0x0070FC, 0x00F003, 0x00F0E3, 0x00F01F,
91 0x00F0FF,
92 0x000E00, 0x000EE0, 0x000E1C, 0x000EFC, 0x008E03, 0x008EE3, 0x008E1F,
93 0x008EFF,
94 0x007E00, 0x007EE0, 0x007E1C, 0x007EFC, 0x00FE03, 0x00FEE3, 0x00FE1F,
95 0x00FEFF,
96 0xC00100, 0xC001E0, 0xC0011C, 0xC001FC, 0xC08103, 0xC081E3, 0xC0811F,
97 0xC081FF,
98 0xC07100, 0xC071E0, 0xC0711C, 0xC071FC, 0xC0F103, 0xC0F1E3, 0xC0F11F,
99 0xC0F1FF,
100 0xC00F00, 0xC00FE0, 0xC00F1C, 0xC00FFC, 0xC08F03, 0xC08FE3, 0xC08F1F,
101 0xC08FFF,
102 0xC07F00, 0xC07FE0, 0xC07F1C, 0xC07FFC, 0xC0FF03, 0xC0FFE3, 0xC0FF1F,
103 0xC0FFFF,
104 0x380000, 0x3800E0, 0x38001C, 0x3800FC, 0x388003, 0x3880E3, 0x38801F,
105 0x3880FF,
106 0x387000, 0x3870E0, 0x38701C, 0x3870FC, 0x38F003, 0x38F0E3, 0x38F01F,
107 0x38F0FF,
108 0x380E00, 0x380EE0, 0x380E1C, 0x380EFC, 0x388E03, 0x388EE3, 0x388E1F,
109 0x388EFF,
110 0x387E00, 0x387EE0, 0x387E1C, 0x387EFC, 0x38FE03, 0x38FEE3, 0x38FE1F,
111 0x38FEFF,
112 0xF80100, 0xF801E0, 0xF8011C, 0xF801FC, 0xF88103, 0xF881E3, 0xF8811F,
113 0xF881FF,
114 0xF87100, 0xF871E0, 0xF8711C, 0xF871FC, 0xF8F103, 0xF8F1E3, 0xF8F11F,
115 0xF8F1FF,
116 0xF80F00, 0xF80FE0, 0xF80F1C, 0xF80FFC, 0xF88F03, 0xF88FE3, 0xF88F1F,
117 0xF88FFF,
118 0xF87F00, 0xF87FE0, 0xF87F1C, 0xF87FFC, 0xF8FF03, 0xF8FFE3, 0xF8FF1F,
119 0xF8FFFF,
120 0x070000, 0x0700E0, 0x07001C, 0x0700FC, 0x078003, 0x0780E3, 0x07801F,
121 0x0780FF,
122 0x077000, 0x0770E0, 0x07701C, 0x0770FC, 0x07F003, 0x07F0E3, 0x07F01F,
123 0x07F0FF,
124 0x070E00, 0x070EE0, 0x070E1C, 0x070EFC, 0x078E03, 0x078EE3, 0x078E1F,
125 0x078EFF,
126 0x077E00, 0x077EE0, 0x077E1C, 0x077EFC, 0x07FE03, 0x07FEE3, 0x07FE1F,
127 0x07FEFF,
128 0xC70100, 0xC701E0, 0xC7011C, 0xC701FC, 0xC78103, 0xC781E3, 0xC7811F,
129 0xC781FF,
130 0xC77100, 0xC771E0, 0xC7711C, 0xC771FC, 0xC7F103, 0xC7F1E3, 0xC7F11F,
131 0xC7F1FF,
132 0xC70F00, 0xC70FE0, 0xC70F1C, 0xC70FFC, 0xC78F03, 0xC78FE3, 0xC78F1F,
133 0xC78FFF,
134 0xC77F00, 0xC77FE0, 0xC77F1C, 0xC77FFC, 0xC7FF03, 0xC7FFE3, 0xC7FF1F,
135 0xC7FFFF,
136 0x3F0000, 0x3F00E0, 0x3F001C, 0x3F00FC, 0x3F8003, 0x3F80E3, 0x3F801F,
137 0x3F80FF,
138 0x3F7000, 0x3F70E0, 0x3F701C, 0x3F70FC, 0x3FF003, 0x3FF0E3, 0x3FF01F,
139 0x3FF0FF,
140 0x3F0E00, 0x3F0EE0, 0x3F0E1C, 0x3F0EFC, 0x3F8E03, 0x3F8EE3, 0x3F8E1F,
141 0x3F8EFF,
142 0x3F7E00, 0x3F7EE0, 0x3F7E1C, 0x3F7EFC, 0x3FFE03, 0x3FFEE3, 0x3FFE1F,
143 0x3FFEFF,
144 0xFF0100, 0xFF01E0, 0xFF011C, 0xFF01FC, 0xFF8103, 0xFF81E3, 0xFF811F,
145 0xFF81FF,
146 0xFF7100, 0xFF71E0, 0xFF711C, 0xFF71FC, 0xFFF103, 0xFFF1E3, 0xFFF11F,
147 0xFFF1FF,
148 0xFF0F00, 0xFF0FE0, 0xFF0F1C, 0xFF0FFC, 0xFF8F03, 0xFF8FE3, 0xFF8F1F,
149 0xFF8FFF,
150 0xFF7F00, 0xFF7FE0, 0xFF7F1C, 0xFF7FFC, 0xFFFF03, 0xFFFFE3, 0xFFFF1F,
151 0xFFFFFF,
152};
diff --git a/hw/xfree86/xaa/xaaWideLine.c b/hw/xfree86/xaa/xaaWideLine.c
deleted file mode 100644
index b8a53c1c8..000000000
--- a/hw/xfree86/xaa/xaaWideLine.c
+++ /dev/null
@@ -1,924 +0,0 @@
1/*
2
3XAAPolylinesWideSolid does not maintain a span list and subsequently does
4not follow the "touch-each-pixel-once" rules for wide lines and arcs.
5This means it can only be used in the case where we have
6miSpansEasyRop(pGC->alu). Since we clip spans on the fly, we
7limited usage of this function to one rect situations. This
8function is used only for solid lines.
9
10 Adapted from miWideLine by Mark Vojkovich (mvojkovi@ucsd.edu)
11Original mi code written by Keith Packard.
12
13*/
14
15#ifdef HAVE_XORG_CONFIG_H
16#include <xorg-config.h>
17#endif
18
19#include <math.h>
20
21#include "misc.h"
22#include "xf86.h"
23#include "xf86_OSproc.h"
24
25#include <X11/X.h>
26#include "windowstr.h"
27#include "gcstruct.h"
28#include "regionstr.h"
29#include "miwideline.h"
30#include "mi.h"
31#include "xf86str.h"
32#include "xaa.h"
33#include "xaalocal.h"
34
35#define DRAW_POINT(pScrn, x, y) \
36 if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1); \
37 else XAAPointHelper(pScrn, x, y)
38
39#define FILL_RECT(pScrn, x, y, w, h) \
40 if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); \
41 else XAAFillRectHelper(pScrn, x, y, w, h)
42
43#define FILL_SPAN(pScrn, x, y, w) \
44 if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, 1); \
45 else XAASpanHelper(pScrn, x, y, w)
46
47#define CLIPSTEPEDGE(edgey,edge,edgeleft) \
48 if (ybase == edgey) { \
49 if (edgeleft) { \
50 if (edge->x > xcl) \
51 xcl = edge->x; \
52 } else { \
53 if (edge->x < xcr) \
54 xcr = edge->x; \
55 } \
56 edgey++; \
57 edge->x += edge->stepx; \
58 edge->e += edge->dx; \
59 if (edge->e > 0) { \
60 edge->x += edge->signdx; \
61 edge->e -= edge->dy; \
62 } \
63 }
64
65static void
66XAAPointHelper(ScrnInfoPtr pScrn, int x, int y)
67{
68 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
69 BoxPtr extents = infoRec->ClipBox;
70
71 if ((x >= extents->x1) && (x < extents->x2) &&
72 (y >= extents->y1) && (y < extents->y2))
73 (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, 1, 1);
74}
75
76static void
77XAAFillRectHelper(ScrnInfoPtr pScrn, int x1, int y1, int dx, int dy)
78{
79 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
80 BoxPtr extents = infoRec->ClipBox;
81 int x2 = x1 + dx;
82 int y2 = y1 + dy;
83
84 if (x1 < extents->x1)
85 x1 = extents->x1;
86 if (x2 >= extents->x2)
87 x2 = extents->x2;
88 if ((dx = x2 - x1) < 1)
89 return;
90 if (y1 < extents->y1)
91 y1 = extents->y1;
92 if (y2 >= extents->y2)
93 y2 = extents->y2;
94 if ((dy = y2 - y1) < 1)
95 return;
96
97 (*infoRec->SubsequentSolidFillRect) (pScrn, x1, y1, dx, dy);
98}
99
100static void
101XAASpanHelper(ScrnInfoPtr pScrn, int x1, int y, int width)
102{
103 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
104 BoxPtr extents = infoRec->ClipBox;
105 int x2;
106
107 if ((y < extents->y1) || (y >= extents->y2))
108 return;
109
110 x2 = x1 + width;
111 if (x1 < extents->x1)
112 x1 = extents->x1;
113 if (x2 > extents->x2)
114 x2 = extents->x2;
115 width = x2 - x1;
116
117 if (width > 0)
118 (*infoRec->SubsequentSolidFillRect) (pScrn, x1, y, width, 1);
119
120}
121
122#define FixError(x, dx, dy, e, sign, step, h) { \
123 e += (h) * dx; \
124 x += (h) * step; \
125 if(e > 0) { \
126 x += e * sign/dy; \
127 e %= dy; \
128 if(e) { \
129 x += sign; \
130 e -= dy; \
131 } \
132 } \
133}
134
135static void
136XAAFillPolyHelper(GCPtr pGC, int y, /* start y coordinate */
137 int overall_height, /* height of entire segment */
138 PolyEdgePtr left, PolyEdgePtr right,
139 int left_count, int right_count)
140{
141 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
142 BoxPtr extents = infoRec->ClipBox;
143 int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx;
144 int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx;
145 int height, left_height, right_height;
146 int xorg;
147 Bool hardClip;
148
149 if ((y >= extents->y2) || ((y + overall_height) <= extents->y1))
150 return;
151
152 /* Muffle compiler */
153 left_x = left_e = left_stepx = left_signdx = left_dy = left_dx = 0;
154 right_x = right_e = right_stepx = right_signdx = right_dy = right_dx = 0;
155
156 left_height = right_height = 0;
157 xorg = 0;
158
159 hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
160
161 while ((left_count || left_height) && (right_count || right_height)) {
162 if (!left_height && left_count) {
163 left_height = left->height;
164 left_x = left->x + xorg;
165 left_stepx = left->stepx;
166 left_signdx = left->signdx;
167 left_e = left->e;
168 left_dy = left->dy;
169 left_dx = left->dx;
170 left_count--;
171 left++;
172 }
173 if (!right_height && right_count) {
174 right_height = right->height;
175 right_x = right->x + xorg + 1;
176 right_stepx = right->stepx;
177 right_signdx = right->signdx;
178 right_e = right->e;
179 right_dy = right->dy;
180 right_dx = right->dx;
181 right_count--;
182 right++;
183 }
184
185 height = (left_height > right_height) ? right_height : left_height;
186
187 left_height -= height;
188 right_height -= height;
189
190 if (hardClip && infoRec->SubsequentSolidFillTrap && (height > 6)) {
191 int right_DX, left_DX;
192
193 right_DX = (right_dx * right_signdx) + (right_stepx * right_dy);
194 left_DX = (left_dx * left_signdx) + (left_stepx * left_dy);
195
196 (*infoRec->SubsequentSolidFillTrap) (infoRec->pScrn, y, height,
197 left_x, left_DX, left_dy,
198 left_e, right_x - 1, right_DX,
199 right_dy, right_e);
200
201 FixError(left_x, left_dx, left_dy, left_e, left_signdx,
202 left_stepx, height);
203 FixError(right_x, right_dx, right_dy, right_e, right_signdx,
204 right_stepx, height);
205 y += height;
206 continue;
207 }
208
209 while (height--) {
210 if (right_x > left_x) {
211 FILL_SPAN(infoRec->pScrn, left_x, y, right_x - left_x);
212 }
213 y++;
214
215 left_x += left_stepx;
216 left_e += left_dx;
217 if (left_e > 0) {
218 left_x += left_signdx;
219 left_e -= left_dy;
220 }
221 right_x += right_stepx;
222 right_e += right_dx;
223 if (right_e > 0) {
224 right_x += right_signdx;
225 right_e -= right_dy;
226 }
227
228 }
229 }
230}
231
232static void
233XAAWideSegment(GCPtr pGC,
234 int x1, int y1, int x2, int y2,
235 Bool projectLeft, Bool projectRight,
236 LineFacePtr leftFace, LineFacePtr rightFace)
237{
238 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
239 double l, L, r;
240 double xa, ya;
241 double projectXoff, projectYoff;
242 double k;
243 double maxy;
244 int x, y;
245 int dx, dy;
246 int finaly;
247 PolyEdgePtr left, right;
248 PolyEdgePtr top, bottom;
249 int lefty, righty, topy, bottomy;
250 int signdx;
251 PolyEdgeRec lefts[2], rights[2];
252 LineFacePtr tface;
253 int lw = pGC->lineWidth;
254 Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
255
256 /* draw top-to-bottom always */
257 if ((y2 < y1) || ((y2 == y1) && (x2 < x1))) {
258 x = x1;
259 x1 = x2;
260 x2 = x;
261
262 y = y1;
263 y1 = y2;
264 y2 = y;
265
266 x = projectLeft;
267 projectLeft = projectRight;
268 projectRight = x;
269
270 tface = leftFace;
271 leftFace = rightFace;
272 rightFace = tface;
273 }
274
275 dy = y2 - y1;
276 signdx = 1;
277 dx = x2 - x1;
278 if (dx < 0)
279 signdx = -1;
280
281 leftFace->x = x1;
282 leftFace->y = y1;
283 leftFace->dx = dx;
284 leftFace->dy = dy;
285
286 rightFace->x = x2;
287 rightFace->y = y2;
288 rightFace->dx = -dx;
289 rightFace->dy = -dy;
290
291 if (!dy) {
292 rightFace->xa = 0;
293 rightFace->ya = (double) lw / 2.0;
294 rightFace->k = -(double) (lw * dx) / 2.0;
295 leftFace->xa = 0;
296 leftFace->ya = -rightFace->ya;
297 leftFace->k = rightFace->k;
298 x = x1;
299 if (projectLeft)
300 x -= (lw >> 1);
301 y = y1 - (lw >> 1);
302 dx = x2 - x;
303 if (projectRight)
304 dx += ((lw + 1) >> 1);
305 dy = lw;
306 FILL_RECT(infoRec->pScrn, x, y, dx, dy);
307 }
308 else if (!dx) {
309 leftFace->xa = (double) lw / 2.0;
310 leftFace->ya = 0;
311 leftFace->k = (double) (lw * dy) / 2.0;
312 rightFace->xa = -leftFace->xa;
313 rightFace->ya = 0;
314 rightFace->k = leftFace->k;
315 y = y1;
316 if (projectLeft)
317 y -= lw >> 1;
318 x = x1 - (lw >> 1);
319 dy = y2 - y;
320 if (projectRight)
321 dy += ((lw + 1) >> 1);
322 dx = lw;
323 FILL_RECT(infoRec->pScrn, x, y, dx, dy);
324 }
325 else {
326 l = ((double) lw) / 2.0;
327 L = sqrt((double) (dx * dx + dy * dy));
328
329 if (dx < 0) {
330 right = &rights[1];
331 left = &lefts[0];
332 top = &rights[0];
333 bottom = &lefts[1];
334 }
335 else {
336 right = &rights[0];
337 left = &lefts[1];
338 top = &lefts[0];
339 bottom = &rights[1];
340 }
341 r = l / L;
342
343 /* coord of upper bound at integral y */
344 ya = -r * dx;
345 xa = r * dy;
346
347 projectXoff = -ya;
348 projectYoff = xa;
349
350 /* xa * dy - ya * dx */
351 k = l * L;
352
353 leftFace->xa = xa;
354 leftFace->ya = ya;
355 leftFace->k = k;
356 rightFace->xa = -xa;
357 rightFace->ya = -ya;
358 rightFace->k = k;
359
360 if (projectLeft)
361 righty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
362 k, dx, dy, x1, y1, 0, right);
363 else
364 righty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 0, right);
365
366 /* coord of lower bound at integral y */
367 ya = -ya;
368 xa = -xa;
369
370 /* xa * dy - ya * dx */
371 k = -k;
372
373 if (projectLeft)
374 lefty = miPolyBuildEdge(xa - projectXoff, ya - projectYoff,
375 k, dx, dy, x1, y1, 1, left);
376 else
377 lefty = miPolyBuildEdge(xa, ya, k, dx, dy, x1, y1, 1, left);
378
379 /* coord of top face at integral y */
380
381 if (signdx > 0) {
382 ya = -ya;
383 xa = -xa;
384 }
385
386 if (projectLeft) {
387 double xap = xa - projectXoff;
388 double yap = ya - projectYoff;
389
390 topy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
391 -dy, dx, x1, y1, dx > 0, top);
392 }
393 else
394 topy = miPolyBuildEdge(xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top);
395
396 /* coord of bottom face at integral y */
397
398 if (projectRight) {
399 double xap = xa + projectXoff;
400 double yap = ya + projectYoff;
401
402 bottomy = miPolyBuildEdge(xap, yap, xap * dx + yap * dy,
403 -dy, dx, x2, y2, dx < 0, bottom);
404 maxy = -ya + projectYoff;
405 }
406 else {
407 bottomy = miPolyBuildEdge(xa, ya, 0.0,
408 -dy, dx, x2, y2, dx < 0, bottom);
409 maxy = -ya;
410 }
411
412 finaly = ICEIL(maxy) + y2;
413
414 if (dx < 0) {
415 left->height = bottomy - lefty;
416 right->height = finaly - righty;
417 top->height = righty - topy;
418 }
419 else {
420 right->height = bottomy - righty;
421 left->height = finaly - lefty;
422 top->height = lefty - topy;
423 }
424 bottom->height = finaly - bottomy;
425 XAAFillPolyHelper(pGC, topy,
426 bottom->height + bottomy - topy, lefts, rights, 2, 2);
427 }
428}
429
430static void
431XAALineArcI(GCPtr pGC, int xorg, int yorg)
432{
433 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
434 int x, y, e, ex;
435 int slw = pGC->lineWidth;
436 Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
437
438 y = (slw >> 1) + 1;
439 if (slw & 1)
440 e = -((y << 2) + 3);
441 else
442 e = -(y << 3);
443 ex = -4;
444 x = 0;
445 while (y) {
446 e += (y << 3) - 4;
447 while (e >= 0) {
448 x++;
449 e += (ex = -((x << 3) + 4));
450 }
451 y--;
452 slw = (x << 1) + 1;
453 if ((e == ex) && (slw > 1))
454 slw--;
455
456 FILL_SPAN(infoRec->pScrn, xorg - x, yorg - y, slw);
457
458 if ((y != 0) && ((slw > 1) || (e != ex))) {
459 FILL_SPAN(infoRec->pScrn, xorg - x, yorg + y, slw);
460 }
461 }
462}
463
464static void
465XAALineArcD(GCPtr pGC,
466 double xorg,
467 double yorg,
468 PolyEdgePtr edge1,
469 int edgey1,
470 Bool edgeleft1, PolyEdgePtr edge2, int edgey2, Bool edgeleft2)
471{
472 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
473 double radius, x0, y0, el, er, yk, xlk, xrk, k;
474 int xbase, ybase, y, boty, xl, xr, xcl, xcr;
475 int ymin, ymax;
476 Bool edge1IsMin, edge2IsMin;
477 int ymin1, ymin2;
478 Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
479
480 xbase = floor(xorg);
481 x0 = xorg - xbase;
482 ybase = ICEIL(yorg);
483 y0 = yorg - ybase;
484
485 xlk = x0 + x0 + 1.0;
486 xrk = x0 + x0 - 1.0;
487 yk = y0 + y0 - 1.0;
488 radius = ((double) pGC->lineWidth) / 2.0;
489 y = floor(radius - y0 + 1.0);
490 ybase -= y;
491 ymin = ybase;
492 ymax = 65536;
493 edge1IsMin = FALSE;
494 ymin1 = edgey1;
495 if (edge1->dy >= 0) {
496 if (!edge1->dy) {
497 if (edgeleft1)
498 edge1IsMin = TRUE;
499 else
500 ymax = edgey1;
501 edgey1 = 65536;
502 }
503 else if ((edge1->signdx < 0) == edgeleft1)
504 edge1IsMin = TRUE;
505 }
506 edge2IsMin = FALSE;
507 ymin2 = edgey2;
508 if (edge2->dy >= 0) {
509 if (!edge2->dy) {
510 if (edgeleft2)
511 edge2IsMin = TRUE;
512 else
513 ymax = edgey2;
514 edgey2 = 65536;
515 }
516 else if ((edge2->signdx < 0) == edgeleft2)
517 edge2IsMin = TRUE;
518 }
519 if (edge1IsMin) {
520 ymin = ymin1;
521 if (edge2IsMin && (ymin1 > ymin2))
522 ymin = ymin2;
523 }
524 else if (edge2IsMin)
525 ymin = ymin2;
526 el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0);
527 er = el + xrk;
528 xl = 1;
529 xr = 0;
530 if (x0 < 0.5) {
531 xl = 0;
532 el -= xlk;
533 }
534 boty = (y0 < -0.5) ? 1 : 0;
535 if (ybase + y - boty > ymax)
536 boty = ymax - ybase - y;
537 while (y > boty) {
538 k = (y << 1) + yk;
539 er += k;
540 while (er > 0.0) {
541 xr++;
542 er += xrk - (xr << 1);
543 }
544 el += k;
545 while (el >= 0.0) {
546 xl--;
547 el += (xl << 1) - xlk;
548 }
549 y--;
550 ybase++;
551 if (ybase < ymin)
552 continue;
553 xcl = xl + xbase;
554 xcr = xr + xbase;
555 CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
556 CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
557 if (xcr >= xcl) {
558 FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
559 }
560 }
561 er = xrk - (xr << 1) - er;
562 el = (xl << 1) - xlk - el;
563 boty = floor(-y0 - radius + 1.0);
564 if (ybase + y - boty > ymax)
565 boty = ymax - ybase - y;
566 while (y > boty) {
567 k = (y << 1) + yk;
568 er -= k;
569 while ((er >= 0.0) && (xr >= 0)) {
570 xr--;
571 er += xrk - (xr << 1);
572 }
573 el -= k;
574 while ((el > 0.0) && (xl <= 0)) {
575 xl++;
576 el += (xl << 1) - xlk;
577 }
578 y--;
579 ybase++;
580 if (ybase < ymin)
581 continue;
582 xcl = xl + xbase;
583 xcr = xr + xbase;
584 CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
585 CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
586 if (xcr >= xcl) {
587 FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
588 }
589 }
590}
591
592static void
593XAALineArc(GCPtr pGC,
594 LineFacePtr leftFace,
595 LineFacePtr rightFace, double xorg, double yorg, Bool isInt)
596{
597 int xorgi, yorgi;
598 PolyEdgeRec edge1, edge2;
599 int edgey1, edgey2;
600 Bool edgeleft1, edgeleft2;
601
602 if (isInt) {
603 xorgi = leftFace ? leftFace->x : rightFace->x;
604 yorgi = leftFace ? leftFace->y : rightFace->y;
605 }
606 else { /* Muffle compiler */
607 xorgi = yorgi = 0;
608 }
609 edgey1 = 65536;
610 edgey2 = 65536;
611 edge1.x = 0; /* not used, keep memory checkers happy */
612 edge1.dy = -1;
613 edge2.x = 0; /* not used, keep memory checkers happy */
614 edge2.dy = -1;
615 edgeleft1 = FALSE;
616 edgeleft2 = FALSE;
617
618 if ((pGC->lineWidth > 2) &&
619 ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
620 (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) {
621 if (isInt) {
622 xorg = (double) xorgi;
623 yorg = (double) yorgi;
624 }
625
626 if (leftFace && rightFace)
627 miRoundJoinClip(leftFace, rightFace, &edge1, &edge2,
628 &edgey1, &edgey2, &edgeleft1, &edgeleft2);
629 else if (leftFace)
630 edgey1 = miRoundCapClip(leftFace, isInt, &edge1, &edgeleft1);
631 else if (rightFace)
632 edgey2 = miRoundCapClip(rightFace, isInt, &edge2, &edgeleft2);
633
634 isInt = FALSE;
635 }
636
637 if (isInt) {
638 if (pGC->lineWidth == 1) {
639 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
640 Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
641
642 DRAW_POINT(infoRec->pScrn, xorgi, yorgi);
643 }
644 else
645 XAALineArcI(pGC, xorgi, yorgi);
646 }
647 else
648 XAALineArcD(pGC, xorg, yorg, &edge1, edgey1, edgeleft1,
649 &edge2, edgey2, edgeleft2);
650
651}
652
653static void
654XAALineJoin(GCPtr pGC, LineFacePtr pLeft, LineFacePtr pRight)
655{
656 double mx = 0, my = 0;
657 double denom = 0;
658 PolyVertexRec vertices[4];
659 PolySlopeRec slopes[4];
660 int edgecount;
661 PolyEdgeRec left[4], right[4];
662 int nleft, nright;
663 int y, height;
664 int swapslopes;
665 int joinStyle = pGC->joinStyle;
666 int lw = pGC->lineWidth;
667
668 if (lw == 1) {
669 /* Lines going in the same direction have no join */
670 if ((pLeft->dx >= 0) == (pRight->dx <= 0))
671 return;
672 if (joinStyle != JoinRound) {
673 denom = -pLeft->dx * (double) pRight->dy + pRight->dx *
674 (double) pLeft->dy;
675 if (denom == 0.0)
676 return; /* no join to draw */
677 }
678 if (joinStyle != JoinMiter) {
679 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
680 Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
681
682 DRAW_POINT(infoRec->pScrn, pLeft->x, pLeft->y);
683 return;
684 }
685 }
686 else {
687 if (joinStyle == JoinRound) {
688 XAALineArc(pGC, pLeft, pRight, (double) 0.0, (double) 0.0, TRUE);
689 return;
690 }
691 denom = -pLeft->dx * (double) pRight->dy + pRight->dx *
692 (double) pLeft->dy;
693 if (denom == 0.0)
694 return; /* no join to draw */
695 }
696
697 swapslopes = 0;
698 if (denom > 0) {
699 pLeft->xa = -pLeft->xa;
700 pLeft->ya = -pLeft->ya;
701 pLeft->dx = -pLeft->dx;
702 pLeft->dy = -pLeft->dy;
703 }
704 else {
705 swapslopes = 1;
706 pRight->xa = -pRight->xa;
707 pRight->ya = -pRight->ya;
708 pRight->dx = -pRight->dx;
709 pRight->dy = -pRight->dy;
710 }
711
712 vertices[0].x = pRight->xa;
713 vertices[0].y = pRight->ya;
714 slopes[0].dx = -pRight->dy;
715 slopes[0].dy = pRight->dx;
716 slopes[0].k = 0;
717
718 vertices[1].x = 0;
719 vertices[1].y = 0;
720 slopes[1].dx = pLeft->dy;
721 slopes[1].dy = -pLeft->dx;
722 slopes[1].k = 0;
723
724 vertices[2].x = pLeft->xa;
725 vertices[2].y = pLeft->ya;
726
727 if (joinStyle == JoinMiter) {
728 my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
729 pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) /
730 denom;
731 if (pLeft->dy != 0)
732 mx = pLeft->xa + (my - pLeft->ya) *
733 (double) pLeft->dx / (double) pLeft->dy;
734 else
735 mx = pRight->xa + (my - pRight->ya) *
736 (double) pRight->dx / (double) pRight->dy;
737
738 /* check miter limit */
739 if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
740 joinStyle = JoinBevel;
741 }
742
743 if (joinStyle == JoinMiter) {
744 slopes[2].dx = pLeft->dx;
745 slopes[2].dy = pLeft->dy;
746 slopes[2].k = pLeft->k;
747 if (swapslopes) {
748 slopes[2].dx = -slopes[2].dx;
749 slopes[2].dy = -slopes[2].dy;
750 slopes[2].k = -slopes[2].k;
751 }
752 vertices[3].x = mx;
753 vertices[3].y = my;
754 slopes[3].dx = pRight->dx;
755 slopes[3].dy = pRight->dy;
756 slopes[3].k = pRight->k;
757 if (swapslopes) {
758 slopes[3].dx = -slopes[3].dx;
759 slopes[3].dy = -slopes[3].dy;
760 slopes[3].k = -slopes[3].k;
761 }
762 edgecount = 4;
763 }
764 else {
765 double scale, dx, dy, adx, ady;
766
767 adx = dx = pRight->xa - pLeft->xa;
768 ady = dy = pRight->ya - pLeft->ya;
769 if (adx < 0)
770 adx = -adx;
771 if (ady < 0)
772 ady = -ady;
773 scale = ady;
774 if (adx > ady)
775 scale = adx;
776 slopes[2].dx = (dx * 65536) / scale;
777 slopes[2].dy = (dy * 65536) / scale;
778 slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
779 (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
780 edgecount = 3;
781 }
782
783 y = miPolyBuildPoly(vertices, slopes, edgecount, pLeft->x, pLeft->y,
784 left, right, &nleft, &nright, &height);
785 XAAFillPolyHelper(pGC, y, height, left, right, nleft, nright);
786}
787
788void
789XAAPolylinesWideSolid(DrawablePtr pDrawable,
790 GCPtr pGC, int mode, int npt, DDXPointPtr pPts)
791{
792 XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
793 int x1, y1, x2, y2;
794 Bool projectLeft, projectRight;
795 LineFaceRec leftFace, rightFace, prevRightFace, firstFace;
796 int first = TRUE;
797 Bool somethingDrawn = FALSE;
798 Bool selfJoin = FALSE;
799 int xorg = pDrawable->x;
800 int yorg = pDrawable->y;
801 Bool hardClip = FALSE;
802
803 if (!RegionNumRects(pGC->pCompositeClip))
804 return;
805
806 if (RegionNumRects(pGC->pCompositeClip) != 1) {
807 miWideLine(pDrawable, pGC, mode, npt, pPts);
808 return;
809 }
810
811 x2 = pPts->x;
812 y2 = pPts->y;
813 if (npt > 1) {
814 if (mode == CoordModePrevious) {
815 int nptTmp;
816 register DDXPointPtr pPtsTmp;
817
818 x1 = x2;
819 y1 = y2;
820 nptTmp = npt;
821 pPtsTmp = pPts + 1;
822 while (--nptTmp) {
823 x1 += pPtsTmp->x;
824 y1 += pPtsTmp->y;
825 ++pPtsTmp;
826 }
827 if ((x2 == x1) && (y2 == y1))
828 selfJoin = TRUE;
829 }
830 else if ((x2 == pPts[npt - 1].x) && (y2 == pPts[npt - 1].y))
831 selfJoin = TRUE;
832 }
833
834 projectLeft = ((pGC->capStyle == CapProjecting) && !selfJoin);
835 projectRight = FALSE;
836
837 (*infoRec->SetupForSolidFill) (infoRec->pScrn, pGC->fgPixel, pGC->alu,
838 pGC->planemask);
839
840 infoRec->ClipBox = &pGC->pCompositeClip->extents;
841
842 if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) {
843 hardClip = TRUE;
844 (*infoRec->SetClippingRectangle) (infoRec->pScrn,
845 infoRec->ClipBox->x1,
846 infoRec->ClipBox->y1,
847 infoRec->ClipBox->x2 - 1,
848 infoRec->ClipBox->y2 - 1);
849 }
850
851 x2 += xorg;
852 y2 += yorg;
853 while (--npt) {
854 x1 = x2;
855 y1 = y2;
856 ++pPts;
857 x2 = pPts->x;
858 y2 = pPts->y;
859 if (mode == CoordModePrevious) {
860 x2 += x1;
861 y2 += y1;
862 }
863 else {
864 x2 += xorg;
865 y2 += yorg;
866 }
867 if ((x1 != x2) || (y1 != y2)) {
868 somethingDrawn = TRUE;
869 if ((npt == 1) && (pGC->capStyle == CapProjecting) && !selfJoin)
870 projectRight = TRUE;
871 XAAWideSegment(pGC, x1, y1, x2, y2,
872 projectLeft, projectRight, &leftFace, &rightFace);
873 if (first) {
874 if (selfJoin)
875 firstFace = leftFace;
876 else if (pGC->capStyle == CapRound) {
877 if (pGC->lineWidth == 1) {
878 DRAW_POINT(infoRec->pScrn, x1, y1);
879 }
880 else
881 XAALineArc(pGC, &leftFace, (LineFacePtr) NULL,
882 (double) 0.0, (double) 0.0, TRUE);
883 }
884 }
885 else
886 XAALineJoin(pGC, &leftFace, &prevRightFace);
887
888 prevRightFace = rightFace;
889 first = FALSE;
890 projectLeft = FALSE;
891 }
892 if (npt == 1 && somethingDrawn) {
893 if (selfJoin)
894 XAALineJoin(pGC, &firstFace, &rightFace);
895 else if (pGC->capStyle == CapRound) {
896 if (pGC->lineWidth == 1) {
897 DRAW_POINT(infoRec->pScrn, x2, y2);
898 }
899 else
900 XAALineArc(pGC, (LineFacePtr) NULL, &rightFace,
901 (double) 0.0, (double) 0.0, TRUE);
902 }
903 }
904 }
905 /* handle crock where all points are coincedent */
906 if (!somethingDrawn) {
907 projectLeft = (pGC->capStyle == CapProjecting);
908 XAAWideSegment(pGC, x2, y2, x2, y2, projectLeft, projectLeft,
909 &leftFace, &rightFace);
910 if (pGC->capStyle == CapRound) {
911 XAALineArc(pGC, &leftFace, (LineFacePtr) NULL,
912 (double) 0.0, (double) 0.0, TRUE);
913 rightFace.dx = -1; /* sleezy hack to make it work */
914 XAALineArc(pGC, (LineFacePtr) NULL, &rightFace,
915 (double) 0.0, (double) 0.0, TRUE);
916 }
917 }
918
919 infoRec->ClipBox = NULL;
920 if (hardClip)
921 (*infoRec->DisableClipping) (infoRec->pScrn);
922
923 SET_SYNC_FLAG(infoRec);
924}
diff --git a/hw/xfree86/xaa/xaacexp.h b/hw/xfree86/xaa/xaacexp.h
deleted file mode 100644
index 6fde54c65..000000000
--- a/hw/xfree86/xaa/xaacexp.h
+++ /dev/null
@@ -1,126 +0,0 @@
1
2#ifdef HAVE_XORG_CONFIG_H
3#include <xorg-config.h>
4#endif
5
6#include <X11/Xarch.h>
7
8#ifndef FIXEDBASE
9#define CHECKRETURN(b) if(width <= ((b) * 32)) return(base + (b))
10#else
11#define CHECKRETURN(b) if(width <= ((b) * 32)) return(base)
12#endif
13
14#if X_BYTE_ORDER == X_BIG_ENDIAN
15#define SHIFT_L(value, shift) ((value) >> (shift))
16#define SHIFT_R(value, shift) ((value) << (shift))
17#else
18#define SHIFT_L(value, shift) ((value) << (shift))
19#define SHIFT_R(value, shift) ((value) >> (shift))
20#endif
21
22#ifndef MSBFIRST
23#ifdef FIXEDBASE
24#define WRITE_IN_BITORDER(dest, offset, data) *(dest) = data;
25#else
26#define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = data;
27#endif
28#else
29#ifdef FIXEDBASE
30#define WRITE_IN_BITORDER(dest, offset, data) *(dest) = SWAP_BITS_IN_BYTES(data);
31#else
32#define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = SWAP_BITS_IN_BYTES(data)
33#endif
34#endif
35
36#ifdef FIXEDBASE
37#ifdef MSBFIRST
38#define WRITE_BITS(b) *base = SWAP_BITS_IN_BYTES(b)
39#define WRITE_BITS1(b) { \
40 *base = byte_reversed_expand3[(b) & 0xFF] | \
41 byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; }
42#define WRITE_BITS2(b) { \
43 *base = byte_reversed_expand3[(b) & 0xFF] | \
44 byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
45 *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
46 byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; }
47#define WRITE_BITS3(b) { \
48 *base = byte_reversed_expand3[(b) & 0xFF] | \
49 byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
50 *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
51 byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
52 *base = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
53 byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; }
54#else
55#define WRITE_BITS(b) *base = (b)
56#define WRITE_BITS1(b) { \
57 *base = byte_expand3[(b) & 0xFF] | \
58 byte_expand3[((b) & 0xFF00) >> 8] << 24; }
59#define WRITE_BITS2(b) { \
60 *base = byte_expand3[(b) & 0xFF] | \
61 byte_expand3[((b) & 0xFF00) >> 8] << 24; \
62 *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
63 byte_expand3[((b) & 0xFF0000) >> 16] << 16; }
64#define WRITE_BITS3(b) { \
65 *base = byte_expand3[(b) & 0xFF] | \
66 byte_expand3[((b) & 0xFF00) >> 8] << 24; \
67 *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
68 byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
69 *base = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
70 byte_expand3[((b) & 0xFF000000) >> 24] << 8; }
71#endif
72#else
73#ifdef MSBFIRST
74#define WRITE_BITS(b) *(base++) = SWAP_BITS_IN_BYTES(b)
75#define WRITE_BITS1(b) { \
76 *(base++) = byte_reversed_expand3[(b) & 0xFF] | \
77 byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; }
78#define WRITE_BITS2(b) { \
79 *(base) = byte_reversed_expand3[(b) & 0xFF] | \
80 byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
81 *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
82 byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
83 base += 2; }
84#define WRITE_BITS3(b) { \
85 *(base) = byte_reversed_expand3[(b) & 0xFF] | \
86 byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
87 *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
88 byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
89 *(base + 2) = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
90 byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; \
91 base += 3; }
92#else
93#define WRITE_BITS(b) *(base++) = (b)
94#define WRITE_BITS1(b) { \
95 *(base++) = byte_expand3[(b) & 0xFF] | \
96 byte_expand3[((b) & 0xFF00) >> 8] << 24; }
97#define WRITE_BITS2(b) { \
98 *(base) = byte_expand3[(b) & 0xFF] | \
99 byte_expand3[((b) & 0xFF00) >> 8] << 24; \
100 *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
101 byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
102 base += 2; }
103#define WRITE_BITS3(b) { \
104 *(base) = byte_expand3[(b) & 0xFF] | \
105 byte_expand3[((b) & 0xFF00) >> 8] << 24; \
106 *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
107 byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
108 *(base + 2) = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
109 byte_expand3[((b) & 0xFF000000) >> 24] << 8; \
110 base += 3; }
111#endif
112#endif
113
114#ifdef FIXEDBASE
115#ifdef MSBFIRST
116#define EXPNAME(x) x##MSBFirstFixedBase
117#else
118#define EXPNAME(x) x##LSBFirstFixedBase
119#endif
120#else
121#ifdef MSBFIRST
122#define EXPNAME(x) x##MSBFirst
123#else
124#define EXPNAME(x) x##LSBFirst
125#endif
126#endif
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
deleted file mode 100644
index 61d9eebe5..000000000
--- a/hw/xfree86/xaa/xaalocal.h
+++ /dev/null
@@ -1,1437 +0,0 @@
1
2#ifndef _XAALOCAL_H
3#define _XAALOCAL_H
4
5#ifdef HAVE_XORG_CONFIG_H
6#include <xorg-config.h>
7#endif
8
9/* This file is very unorganized ! */
10
11#include "gcstruct.h"
12#include "regionstr.h"
13#include "xf86fbman.h"
14#include "xaa.h"
15#include "mi.h"
16#include "picturestr.h"
17
18#define GCWhenForced (GCArcMode << 1)
19
20#define DO_COLOR_8x8 0x00000001
21#define DO_MONO_8x8 0x00000002
22#define DO_CACHE_BLT 0x00000003
23#define DO_COLOR_EXPAND 0x00000004
24#define DO_CACHE_EXPAND 0x00000005
25#define DO_IMAGE_WRITE 0x00000006
26#define DO_PIXMAP_COPY 0x00000007
27#define DO_SOLID 0x00000008
28
29typedef CARD32 *(*GlyphScanlineFuncPtr) (CARD32 *base, unsigned int **glyphp,
30 int line, int nglyph, int width);
31
32typedef CARD32 *(*StippleScanlineProcPtr) (CARD32 *, CARD32 *, int, int, int);
33
34typedef void (*RectFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
35 XAACacheInfoPtr);
36typedef void (*TrapFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
37 int, int, int, int, int, int, XAACacheInfoPtr);
38
39typedef struct _XAAScreen {
40 CreateGCProcPtr CreateGC;
41 CloseScreenProcPtr CloseScreen;
42 GetImageProcPtr GetImage;
43 GetSpansProcPtr GetSpans;
44 CopyWindowProcPtr CopyWindow;
45 WindowExposuresProcPtr WindowExposures;
46 CreatePixmapProcPtr CreatePixmap;
47 DestroyPixmapProcPtr DestroyPixmap;
48 ChangeWindowAttributesProcPtr ChangeWindowAttributes;
49 XAAInfoRecPtr AccelInfoRec;
50 Bool (*EnterVT) (ScrnInfoPtr);
51 void (*LeaveVT) (ScrnInfoPtr);
52 int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr);
53 void (*EnableDisableFBAccess) (ScrnInfoPtr, Bool);
54 CompositeProcPtr Composite;
55 GlyphsProcPtr Glyphs;
56} XAAScreenRec, *XAAScreenPtr;
57
58#define OPS_ARE_PIXMAP 0x00000001
59#define OPS_ARE_ACCEL 0x00000002
60
61typedef struct _XAAGC {
62 GCOps *wrapOps;
63 GCFuncs *wrapFuncs;
64 GCOps *XAAOps;
65 int DashLength;
66 unsigned char *DashPattern;
67 unsigned long changes;
68 unsigned long flags;
69} XAAGCRec, *XAAGCPtr;
70
71#define REDUCIBILITY_CHECKED 0x00000001
72#define REDUCIBLE_TO_8x8 0x00000002
73#define REDUCIBLE_TO_2_COLOR 0x00000004
74#define DIRTY 0x00010000
75#define OFFSCREEN 0x00020000
76#define DGA_PIXMAP 0x00040000
77#define SHARED_PIXMAP 0x00080000
78#define LOCKED_PIXMAP 0x00100000
79
80#define REDUCIBILITY_MASK \
81 (REDUCIBILITY_CHECKED | REDUCIBLE_TO_8x8 | REDUCIBLE_TO_2_COLOR)
82
83typedef struct _XAAPixmap {
84 unsigned long flags;
85 CARD32 pattern0;
86 CARD32 pattern1;
87 int fg;
88 int bg;
89 FBAreaPtr offscreenArea;
90 Bool freeData;
91} XAAPixmapRec, *XAAPixmapPtr;
92
93extern _X_EXPORT Bool
94 XAACreateGC(GCPtr pGC);
95
96extern _X_EXPORT Bool
97 XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
98
99extern _X_EXPORT RegionPtr
100
101XAABitBlt(DrawablePtr pSrcDrawable,
102 DrawablePtr pDstDrawable,
103 GC * pGC,
104 int srcx,
105 int srcy,
106 int width,
107 int height,
108 int dstx,
109 int dsty,
110 void (*doBitBlt) (DrawablePtr, DrawablePtr, GCPtr, RegionPtr,
111 DDXPointPtr), unsigned long bitPlane);
112
113extern _X_EXPORT void
114
115XAAScreenToScreenBitBlt(ScrnInfoPtr pScrn,
116 int nbox,
117 DDXPointPtr pptSrc,
118 BoxPtr pbox,
119 int xdir, int ydir, int alu, unsigned int planemask);
120
121extern _X_EXPORT void
122
123XAADoBitBlt(DrawablePtr pSrc,
124 DrawablePtr pDst, GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc);
125
126extern _X_EXPORT void
127
128XAADoImageWrite(DrawablePtr pSrc,
129 DrawablePtr pDst,
130 GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc);
131
132extern _X_EXPORT void
133
134XAADoImageRead(DrawablePtr pSrc,
135 DrawablePtr pDst,
136 GC * pGC, RegionPtr prgnDst, DDXPointPtr pptSrc);
137
138extern _X_EXPORT void
139 XAACopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
140
141extern _X_EXPORT RegionPtr
142
143XAACopyArea(DrawablePtr pSrcDrawable,
144 DrawablePtr pDstDrawable,
145 GC * pGC,
146 int srcx, int srcy, int width, int height, int dstx, int dsty);
147
148extern _X_EXPORT void
149 XAAValidateCopyArea(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
150
151extern _X_EXPORT void
152 XAAValidatePutImage(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
153
154extern _X_EXPORT void
155 XAAValidateCopyPlane(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
156
157extern _X_EXPORT void
158 XAAValidatePushPixels(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
159
160extern _X_EXPORT void
161 XAAValidateFillSpans(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
162
163extern _X_EXPORT void
164 XAAValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
165
166extern _X_EXPORT void
167 XAAValidateImageGlyphBlt(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
168
169extern _X_EXPORT void
170 XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
171
172extern _X_EXPORT RegionPtr
173
174XAACopyPlaneColorExpansion(DrawablePtr pSrc,
175 DrawablePtr pDst,
176 GCPtr pGC,
177 int srcx,
178 int srcy,
179 int width,
180 int height,
181 int dstx, int dsty, unsigned long bitPlane);
182
183extern _X_EXPORT void
184
185XAAPushPixelsSolidColorExpansion(GCPtr pGC,
186 PixmapPtr pBitMap,
187 DrawablePtr pDrawable,
188 int dx, int dy, int xOrg, int yOrg);
189
190extern _X_EXPORT void
191
192XAAWriteBitmapColorExpandMSBFirstFixedBase(ScrnInfoPtr pScrn,
193 int x, int y, int w, int h,
194 unsigned char *src,
195 int srcwidth,
196 int skipleft,
197 int fg, int bg,
198 int rop, unsigned int planemask);
199
200extern _X_EXPORT void
201
202XAAWriteBitmapColorExpand3MSBFirstFixedBase(ScrnInfoPtr pScrn,
203 int x, int y, int w, int h,
204 unsigned char *src,
205 int srcwidth,
206 int skipleft,
207 int fg, int bg,
208 int rop, unsigned int planemask);
209
210extern _X_EXPORT void
211
212XAAWriteBitmapColorExpandMSBFirst(ScrnInfoPtr pScrn,
213 int x, int y, int w, int h,
214 unsigned char *src,
215 int srcwidth,
216 int skipleft,
217 int fg, int bg,
218 int rop, unsigned int planemask);
219
220extern _X_EXPORT void
221
222XAAWriteBitmapColorExpand3MSBFirst(ScrnInfoPtr pScrn,
223 int x, int y, int w, int h,
224 unsigned char *src,
225 int srcwidth,
226 int skipleft,
227 int fg, int bg,
228 int rop, unsigned int planemask);
229
230extern _X_EXPORT void
231
232XAAWriteBitmapColorExpandLSBFirstFixedBase(ScrnInfoPtr pScrn,
233 int x, int y, int w, int h,
234 unsigned char *src,
235 int srcwidth,
236 int skipleft,
237 int fg, int bg,
238 int rop, unsigned int planemask);
239
240extern _X_EXPORT void
241
242XAAWriteBitmapColorExpand3LSBFirstFixedBase(ScrnInfoPtr pScrn,
243 int x, int y, int w, int h,
244 unsigned char *src,
245 int srcwidth,
246 int skipleft,
247 int fg, int bg,
248 int rop, unsigned int planemask);
249
250extern _X_EXPORT void
251
252XAAWriteBitmapColorExpandLSBFirst(ScrnInfoPtr pScrn,
253 int x, int y, int w, int h,
254 unsigned char *src,
255 int srcwidth,
256 int skipleft,
257 int fg, int bg,
258 int rop, unsigned int planemask);
259
260extern _X_EXPORT void
261
262XAAWriteBitmapColorExpand3LSBFirst(ScrnInfoPtr pScrn,
263 int x, int y, int w, int h,
264 unsigned char *src,
265 int srcwidth,
266 int skipleft,
267 int fg, int bg,
268 int rop, unsigned int planemask);
269
270extern _X_EXPORT void
271
272XAAWriteBitmapScanlineColorExpandMSBFirst(ScrnInfoPtr pScrn,
273 int x, int y, int w, int h,
274 unsigned char *src,
275 int srcwidth,
276 int skipleft,
277 int fg, int bg,
278 int rop, unsigned int planemask);
279
280extern _X_EXPORT void
281
282XAAWriteBitmapScanlineColorExpand3MSBFirst(ScrnInfoPtr pScrn,
283 int x, int y, int w, int h,
284 unsigned char *src,
285 int srcwidth,
286 int skipleft,
287 int fg, int bg,
288 int rop, unsigned int planemask);
289
290extern _X_EXPORT void
291
292XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase(ScrnInfoPtr pScrn,
293 int x, int y, int w, int h,
294 unsigned char *src,
295 int srcwidth,
296 int skipleft,
297 int fg, int bg,
298 int rop,
299 unsigned int planemask);
300
301extern _X_EXPORT void
302
303XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase(ScrnInfoPtr pScrn,
304 int x, int y, int w, int h,
305 unsigned char *src,
306 int srcwidth,
307 int skipleft,
308 int fg, int bg,
309 int rop,
310 unsigned int planemask);
311
312extern _X_EXPORT void
313
314XAAWriteBitmapScanlineColorExpandLSBFirst(ScrnInfoPtr pScrn,
315 int x, int y, int w, int h,
316 unsigned char *src,
317 int srcwidth,
318 int skipleft,
319 int fg, int bg,
320 int rop, unsigned int planemask);
321
322extern _X_EXPORT void
323
324XAAWriteBitmapScanlineColorExpand3LSBFirst(ScrnInfoPtr pScrn,
325 int x, int y, int w, int h,
326 unsigned char *src,
327 int srcwidth,
328 int skipleft,
329 int fg, int bg,
330 int rop, unsigned int planemask);
331
332extern _X_EXPORT void
333
334XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase(ScrnInfoPtr pScrn,
335 int x, int y, int w, int h,
336 unsigned char *src,
337 int srcwidth,
338 int skipleft,
339 int fg, int bg,
340 int rop,
341 unsigned int planemask);
342
343extern _X_EXPORT void
344
345XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase(ScrnInfoPtr pScrn,
346 int x, int y, int w, int h,
347 unsigned char *src,
348 int srcwidth,
349 int skipleft,
350 int fg, int bg,
351 int rop,
352 unsigned int planemask);
353
354extern _X_EXPORT void
355
356XAAWritePixmap(ScrnInfoPtr pScrn,
357 int x, int y, int w, int h,
358 unsigned char *src,
359 int srcwidth,
360 int rop,
361 unsigned int planemask,
362 int transparency_color, int bpp, int depth);
363
364extern _X_EXPORT void
365
366XAAWritePixmapScanline(ScrnInfoPtr pScrn,
367 int x, int y, int w, int h,
368 unsigned char *src,
369 int srcwidth,
370 int rop,
371 unsigned int planemask,
372 int transparency_color, int bpp, int depth);
373
374typedef void (*ClipAndRenderRectsFunc) (GCPtr, int, BoxPtr, int, int);
375
376extern _X_EXPORT void
377
378XAAClipAndRenderRects(GCPtr pGC,
379 ClipAndRenderRectsFunc func,
380 int nrectFill, xRectangle *prectInit, int xorg, int yorg);
381
382typedef void (*ClipAndRenderSpansFunc) (GCPtr, int, DDXPointPtr, int *,
383 int, int, int);
384
385extern _X_EXPORT void
386
387XAAClipAndRenderSpans(GCPtr pGC,
388 DDXPointPtr ppt,
389 int *pwidth,
390 int nspans,
391 int fSorted,
392 ClipAndRenderSpansFunc func, int xorg, int yorg);
393
394extern _X_EXPORT void
395
396XAAFillSolidRects(ScrnInfoPtr pScrn,
397 int fg, int rop,
398 unsigned int planemask, int nBox, BoxPtr pBox);
399
400extern _X_EXPORT void
401
402XAAFillMono8x8PatternRects(ScrnInfoPtr pScrn,
403 int fg, int bg, int rop,
404 unsigned int planemask,
405 int nBox,
406 BoxPtr pBox, int pat0, int pat1, int xorg, int yorg);
407
408extern _X_EXPORT void
409
410XAAFillMono8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
411 int fg, int bg, int rop,
412 unsigned int planemask,
413 int nBox,
414 BoxPtr pBox,
415 int pat0, int pat1, int xorg, int yorg);
416
417extern _X_EXPORT void
418
419XAAFillColor8x8PatternRectsScreenOrigin(ScrnInfoPtr pScrn,
420 int rop,
421 unsigned int planemask,
422 int nBox,
423 BoxPtr pBox,
424 int xorigin, int yorigin,
425 XAACacheInfoPtr pCache);
426
427extern _X_EXPORT void
428
429XAAFillColor8x8PatternRects(ScrnInfoPtr pScrn,
430 int rop,
431 unsigned int planemask,
432 int nBox,
433 BoxPtr pBox,
434 int xorigin, int yorigin, XAACacheInfoPtr pCache);
435
436extern _X_EXPORT void
437
438XAAFillCacheBltRects(ScrnInfoPtr pScrn,
439 int rop,
440 unsigned int planemask,
441 int nBox,
442 BoxPtr pBox, int xorg, int yorg, XAACacheInfoPtr pCache);
443
444extern _X_EXPORT void
445
446XAAFillCacheExpandRects(ScrnInfoPtr pScrn,
447 int fg, int bg, int rop,
448 unsigned int planemask,
449 int nBox,
450 BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix);
451
452extern _X_EXPORT void
453
454XAAFillImageWriteRects(ScrnInfoPtr pScrn,
455 int rop,
456 unsigned int planemask,
457 int nBox,
458 BoxPtr pBox, int xorg, int yorg, PixmapPtr pPix);
459
460extern _X_EXPORT void
461
462XAAPolyFillRect(DrawablePtr pDraw,
463 GCPtr pGC, int nrectFill, xRectangle *prectInit);
464
465extern _X_EXPORT void
466
467XAATEGlyphRendererMSBFirstFixedBase(ScrnInfoPtr pScrn,
468 int x, int y, int w, int h, int skipleft,
469 int startline, unsigned int **glyphs,
470 int glyphWidth, int fg, int bg, int rop,
471 unsigned planemask);
472
473extern _X_EXPORT void
474
475XAATEGlyphRenderer3MSBFirstFixedBase(ScrnInfoPtr pScrn,
476 int x, int y, int w, int h, int skipleft,
477 int startline, unsigned int **glyphs,
478 int glyphWidth, int fg, int bg, int rop,
479 unsigned planemask);
480
481extern _X_EXPORT void
482
483XAATEGlyphRendererMSBFirst(ScrnInfoPtr pScrn,
484 int x, int y, int w, int h, int skipleft,
485 int startline, unsigned int **glyphs, int glyphWidth,
486 int fg, int bg, int rop, unsigned planemask);
487
488extern _X_EXPORT void
489
490XAATEGlyphRenderer3MSBFirst(ScrnInfoPtr pScrn,
491 int x, int y, int w, int h, int skipleft,
492 int startline, unsigned int **glyphs,
493 int glyphWidth, int fg, int bg, int rop,
494 unsigned planemask);
495
496extern _X_EXPORT void
497
498XAATEGlyphRendererLSBFirstFixedBase(ScrnInfoPtr pScrn,
499 int x, int y, int w, int h, int skipleft,
500 int startline, unsigned int **glyphs,
501 int glyphWidth, int fg, int bg, int rop,
502 unsigned planemask);
503
504extern _X_EXPORT void
505
506XAATEGlyphRenderer3LSBFirstFixedBase(ScrnInfoPtr pScrn,
507 int x, int y, int w, int h, int skipleft,
508 int startline, unsigned int **glyphs,
509 int glyphWidth, int fg, int bg, int rop,
510 unsigned planemask);
511
512extern _X_EXPORT void
513
514XAATEGlyphRendererLSBFirst(ScrnInfoPtr pScrn,
515 int x, int y, int w, int h, int skipleft,
516 int startline, unsigned int **glyphs, int glyphWidth,
517 int fg, int bg, int rop, unsigned planemask);
518
519extern _X_EXPORT void
520
521XAATEGlyphRenderer3LSBFirst(ScrnInfoPtr pScrn,
522 int x, int y, int w, int h, int skipleft,
523 int startline, unsigned int **glyphs,
524 int glyphWidth, int fg, int bg, int rop,
525 unsigned planemask);
526
527extern _X_EXPORT void
528
529XAATEGlyphRendererScanlineMSBFirst(ScrnInfoPtr pScrn,
530 int x, int y, int w, int h, int skipleft,
531 int startline, unsigned int **glyphs,
532 int glyphWidth, int fg, int bg, int rop,
533 unsigned planemask);
534
535extern _X_EXPORT void
536
537XAATEGlyphRendererScanline3MSBFirst(ScrnInfoPtr pScrn,
538 int x, int y, int w, int h, int skipleft,
539 int startline, unsigned int **glyphs,
540 int glyphWidth, int fg, int bg, int rop,
541 unsigned planemask);
542
543extern _X_EXPORT void
544
545XAATEGlyphRendererScanlineLSBFirst(ScrnInfoPtr pScrn,
546 int x, int y, int w, int h, int skipleft,
547 int startline, unsigned int **glyphs,
548 int glyphWidth, int fg, int bg, int rop,
549 unsigned planemask);
550
551extern _X_EXPORT void
552
553XAATEGlyphRendererScanline3LSBFirst(ScrnInfoPtr pScrn,
554 int x, int y, int w, int h, int skipleft,
555 int startline, unsigned int **glyphs,
556 int glyphWidth, int fg, int bg, int rop,
557 unsigned planemask);
558
559extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32]) (CARD32
560 *base,
561 unsigned
562 int
563 **glyphp,
564 int line,
565 int
566 nglyph,
567 int
568 width);
569
570extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32]) (CARD32 *base,
571 unsigned int
572 **glyphp,
573 int line,
574 int nglyph,
575 int width);
576
577extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32]) (CARD32
578 *base,
579 unsigned
580 int
581 **glyphp,
582 int line,
583 int
584 nglyph,
585 int
586 width);
587
588extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32]) (CARD32 *base,
589 unsigned int
590 **glyphp,
591 int line,
592 int nglyph,
593 int width);
594
595extern _X_EXPORT GlyphScanlineFuncPtr
596 *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void);
597extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirst(void);
598extern _X_EXPORT GlyphScanlineFuncPtr
599 *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void);
600extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirst(void);
601
602extern _X_EXPORT void
603
604XAAFillColorExpandRectsLSBFirst(ScrnInfoPtr pScrn,
605 int fg, int bg, int rop,
606 unsigned int planemask,
607 int nBox,
608 BoxPtr pBox,
609 int xorg, int yorg, PixmapPtr pPix);
610
611extern _X_EXPORT void
612
613XAAFillColorExpandRects3LSBFirst(ScrnInfoPtr pScrn,
614 int fg, int bg, int rop,
615 unsigned int planemask,
616 int nBox,
617 BoxPtr pBox,
618 int xorg, int yorg, PixmapPtr pPix);
619
620extern _X_EXPORT void
621
622XAAFillColorExpandRectsLSBFirstFixedBase(ScrnInfoPtr pScrn,
623 int fg, int bg, int rop,
624 unsigned int planemask,
625 int nBox,
626 BoxPtr pBox,
627 int xorg, int yorg, PixmapPtr pPix);
628
629extern _X_EXPORT void
630
631XAAFillColorExpandRects3LSBFirstFixedBase(ScrnInfoPtr pScrn,
632 int fg, int bg, int rop,
633 unsigned int planemask,
634 int nBox,
635 BoxPtr pBox,
636 int xorg, int yorg, PixmapPtr pPix);
637
638extern _X_EXPORT void
639
640XAAFillColorExpandRectsMSBFirst(ScrnInfoPtr pScrn,
641 int fg, int bg, int rop,
642 unsigned int planemask,
643 int nBox,
644 BoxPtr pBox,
645 int xorg, int yorg, PixmapPtr pPix);
646
647extern _X_EXPORT void
648
649XAAFillColorExpandRects3MSBFirst(ScrnInfoPtr pScrn,
650 int fg, int bg, int rop,
651 unsigned int planemask,
652 int nBox,
653 BoxPtr pBox,
654 int xorg, int yorg, PixmapPtr pPix);
655
656extern _X_EXPORT void
657
658XAAFillColorExpandRectsMSBFirstFixedBase(ScrnInfoPtr pScrn,
659 int fg, int bg, int rop,
660 unsigned int planemask,
661 int nBox,
662 BoxPtr pBox,
663 int xorg, int yorg, PixmapPtr pPix);
664
665extern _X_EXPORT void
666
667XAAFillColorExpandRects3MSBFirstFixedBase(ScrnInfoPtr pScrn,
668 int fg, int bg, int rop,
669 unsigned int planemask,
670 int nBox,
671 BoxPtr pBox,
672 int xorg, int yorg, PixmapPtr pPix);
673
674extern _X_EXPORT void
675
676XAAFillScanlineColorExpandRectsLSBFirst(ScrnInfoPtr pScrn,
677 int fg, int bg, int rop,
678 unsigned int planemask,
679 int nBox,
680 BoxPtr pBox,
681 int xorg, int yorg, PixmapPtr pPix);
682
683extern _X_EXPORT void
684
685XAAFillScanlineColorExpandRects3LSBFirst(ScrnInfoPtr pScrn,
686 int fg, int bg, int rop,
687 unsigned int planemask,
688 int nBox,
689 BoxPtr pBox,
690 int xorg, int yorg, PixmapPtr pPix);
691
692extern _X_EXPORT void
693
694XAAFillScanlineColorExpandRectsMSBFirst(ScrnInfoPtr pScrn,
695 int fg, int bg, int rop,
696 unsigned int planemask,
697 int nBox,
698 BoxPtr pBox,
699 int xorg, int yorg, PixmapPtr pPix);
700
701extern _X_EXPORT void
702
703XAAFillScanlineColorExpandRects3MSBFirst(ScrnInfoPtr pScrn,
704 int fg, int bg, int rop,
705 unsigned int planemask,
706 int nBox,
707 BoxPtr pBox,
708 int xorg, int yorg, PixmapPtr pPix);
709
710extern _X_EXPORT void
711
712XAAFillColorExpandSpansLSBFirst(ScrnInfoPtr pScrn,
713 int fg, int bg, int rop,
714 unsigned int planemask,
715 int n,
716 DDXPointPtr ppt,
717 int *pwidth,
718 int fSorted,
719 int xorg, int yorg, PixmapPtr pPix);
720
721extern _X_EXPORT void
722
723XAAFillColorExpandSpans3LSBFirst(ScrnInfoPtr pScrn,
724 int fg, int bg, int rop,
725 unsigned int planemask,
726 int n,
727 DDXPointPtr ppt,
728 int *pwidth,
729 int fSorted,
730 int xorg, int yorg, PixmapPtr pPix);
731
732extern _X_EXPORT void
733
734XAAFillColorExpandSpansLSBFirstFixedBase(ScrnInfoPtr pScrn,
735 int fg, int bg, int rop,
736 unsigned int planemask,
737 int n,
738 DDXPointPtr ppt,
739 int *pwidth,
740 int fSorted,
741 int xorg, int yorg, PixmapPtr pPix);
742
743extern _X_EXPORT void
744
745XAAFillColorExpandSpans3LSBFirstFixedBase(ScrnInfoPtr pScrn,
746 int fg, int bg, int rop,
747 unsigned int planemask,
748 int n,
749 DDXPointPtr ppt,
750 int *pwidth,
751 int fSorted,
752 int xorg, int yorg, PixmapPtr pPix);
753
754extern _X_EXPORT void
755
756XAAFillColorExpandSpansMSBFirst(ScrnInfoPtr pScrn,
757 int fg, int bg, int rop,
758 unsigned int planemask,
759 int n,
760 DDXPointPtr ppt,
761 int *pwidth,
762 int fSorted,
763 int xorg, int yorg, PixmapPtr pPix);
764
765extern _X_EXPORT void
766
767XAAFillColorExpandSpans3MSBFirst(ScrnInfoPtr pScrn,
768 int fg, int bg, int rop,
769 unsigned int planemask,
770 int n,
771 DDXPointPtr ppt,
772 int *pwidth,
773 int fSorted,
774 int xorg, int yorg, PixmapPtr pPix);
775
776extern _X_EXPORT void
777
778XAAFillColorExpandSpansMSBFirstFixedBase(ScrnInfoPtr pScrn,
779 int fg, int bg, int rop,
780 unsigned int planemask,
781 int n,
782 DDXPointPtr ppt,
783 int *pwidth,
784 int fSorted,
785 int xorg, int yorg, PixmapPtr pPix);
786
787extern _X_EXPORT void
788
789XAAFillColorExpandSpans3MSBFirstFixedBase(ScrnInfoPtr pScrn,
790 int fg, int bg, int rop,
791 unsigned int planemask,
792 int n,
793 DDXPointPtr ppt,
794 int *pwidth,
795 int fSorted,
796 int xorg, int yorg, PixmapPtr pPix);
797
798extern _X_EXPORT void
799
800XAAFillScanlineColorExpandSpansLSBFirst(ScrnInfoPtr pScrn,
801 int fg, int bg, int rop,
802 unsigned int planemask,
803 int n,
804 DDXPointPtr ppt,
805 int *pwidth,
806 int fSorted,
807 int xorg, int yorg, PixmapPtr pPix);
808
809extern _X_EXPORT void
810
811XAAFillScanlineColorExpandSpans3LSBFirst(ScrnInfoPtr pScrn,
812 int fg, int bg, int rop,
813 unsigned int planemask,
814 int n,
815 DDXPointPtr ppt,
816 int *pwidth,
817 int fSorted,
818 int xorg, int yorg, PixmapPtr pPix);
819
820extern _X_EXPORT void
821
822XAAPutImage(DrawablePtr pDraw,
823 GCPtr pGC,
824 int depth,
825 int x, int y, int w, int h, int leftPad, int format, char *pImage);
826
827extern _X_EXPORT void
828
829XAAFillScanlineColorExpandSpansMSBFirst(ScrnInfoPtr pScrn,
830 int fg, int bg, int rop,
831 unsigned int planemask,
832 int n,
833 DDXPointPtr ppt,
834 int *pwidth,
835 int fSorted,
836 int xorg, int yorg, PixmapPtr pPix);
837
838extern _X_EXPORT void
839
840XAAFillScanlineColorExpandSpans3MSBFirst(ScrnInfoPtr pScrn,
841 int fg, int bg, int rop,
842 unsigned int planemask,
843 int n,
844 DDXPointPtr ppt,
845 int *pwidth,
846 int fSorted,
847 int xorg, int yorg, PixmapPtr pPix);
848
849extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6]) (CARD32
850 *base,
851 CARD32
852 *src,
853 int
854 offset,
855 int
856 width,
857 int
858 dwords);
859
860extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirst[6]) (CARD32 *base,
861 CARD32 *src,
862 int offset,
863 int width,
864 int dwords);
865
866extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6]) (CARD32
867 *base,
868 CARD32
869 *src,
870 int
871 offset,
872 int
873 width,
874 int
875 dwords);
876
877extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirst[6]) (CARD32 *base,
878 CARD32 *src,
879 int offset,
880 int width,
881 int dwords);
882
883extern _X_EXPORT StippleScanlineProcPtr
884 *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
885extern _X_EXPORT StippleScanlineProcPtr
886 *XAAGetStippleScanlineFuncMSBFirst(void);
887extern _X_EXPORT StippleScanlineProcPtr
888 *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
889extern _X_EXPORT StippleScanlineProcPtr
890 *XAAGetStippleScanlineFuncLSBFirst(void);
891extern _X_EXPORT StippleScanlineProcPtr
892 *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void);
893extern _X_EXPORT StippleScanlineProcPtr
894 *XAAGetStippleScanlineFunc3MSBFirst(void);
895extern _X_EXPORT StippleScanlineProcPtr
896 *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void);
897extern _X_EXPORT StippleScanlineProcPtr
898 *XAAGetStippleScanlineFunc3LSBFirst(void);
899
900extern _X_EXPORT int
901
902XAAPolyText8TEColorExpansion(DrawablePtr pDraw,
903 GCPtr pGC, int x, int y, int count, char *chars);
904
905extern _X_EXPORT int
906
907XAAPolyText16TEColorExpansion(DrawablePtr pDraw,
908 GCPtr pGC,
909 int x, int y, int count, unsigned short *chars);
910
911extern _X_EXPORT void
912
913XAAImageText8TEColorExpansion(DrawablePtr pDraw,
914 GCPtr pGC, int x, int y, int count, char *chars);
915
916extern _X_EXPORT void
917
918XAAImageText16TEColorExpansion(DrawablePtr pDraw,
919 GCPtr pGC,
920 int x, int y, int count, unsigned short *chars);
921
922extern _X_EXPORT void
923
924XAAImageGlyphBltTEColorExpansion(DrawablePtr pDrawable,
925 GCPtr pGC,
926 int xInit, int yInit,
927 unsigned int nglyph,
928 CharInfoPtr * ppci, pointer pglyphBase);
929
930extern _X_EXPORT void
931
932XAAPolyGlyphBltTEColorExpansion(DrawablePtr pDrawable,
933 GCPtr pGC,
934 int xInit, int yInit,
935 unsigned int nglyph,
936 CharInfoPtr * ppci, pointer pglyphBase);
937
938extern _X_EXPORT int
939
940XAAPolyText8NonTEColorExpansion(DrawablePtr pDraw,
941 GCPtr pGC,
942 int x, int y, int count, char *chars);
943
944extern _X_EXPORT int
945
946XAAPolyText16NonTEColorExpansion(DrawablePtr pDraw,
947 GCPtr pGC,
948 int x, int y,
949 int count, unsigned short *chars);
950
951extern _X_EXPORT void
952
953XAAImageText8NonTEColorExpansion(DrawablePtr pDraw,
954 GCPtr pGC,
955 int x, int y, int count, char *chars);
956
957extern _X_EXPORT void
958
959XAAImageText16NonTEColorExpansion(DrawablePtr pDraw,
960 GCPtr pGC,
961 int x, int y,
962 int count, unsigned short *chars);
963
964extern _X_EXPORT void
965
966XAAImageGlyphBltNonTEColorExpansion(DrawablePtr pDrawable,
967 GCPtr pGC,
968 int xInit, int yInit,
969 unsigned int nglyph,
970 CharInfoPtr * ppci, pointer pglyphBase);
971
972extern _X_EXPORT void
973
974XAAPolyGlyphBltNonTEColorExpansion(DrawablePtr pDrawable,
975 GCPtr pGC,
976 int xInit, int yInit,
977 unsigned int nglyph,
978 CharInfoPtr * ppci, pointer pglyphBase);
979
980extern _X_EXPORT void XAANonTEGlyphRenderer(ScrnInfoPtr pScrn,
981 int x, int y, int n,
982 NonTEGlyphPtr glyphs,
983 BoxPtr pbox,
984 int fg, int rop,
985 unsigned int planemask);
986
987extern _X_EXPORT void
988
989XAAFillSolidSpans(ScrnInfoPtr pScrn,
990 int fg, int rop,
991 unsigned int planemask,
992 int n, DDXPointPtr ppt, int *pwidth, int fSorted);
993
994extern _X_EXPORT void
995
996XAAFillMono8x8PatternSpans(ScrnInfoPtr pScrn,
997 int fg, int bg, int rop,
998 unsigned int planemask,
999 int n,
1000 DDXPointPtr ppt,
1001 int *pwidth, int fSorted,
1002 int patx, int paty, int xorg, int yorg);
1003
1004extern _X_EXPORT void
1005
1006XAAFillMono8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
1007 int fg, int bg, int rop,
1008 unsigned int planemask,
1009 int n,
1010 DDXPointPtr ppt,
1011 int *pwidth, int fSorted,
1012 int patx, int paty, int xorg, int yorg);
1013
1014extern _X_EXPORT void
1015
1016XAAFillColor8x8PatternSpansScreenOrigin(ScrnInfoPtr pScrn,
1017 int rop,
1018 unsigned int planemask,
1019 int n,
1020 DDXPointPtr ppt,
1021 int *pwidth, int fSorted,
1022 XAACacheInfoPtr,
1023 int xorigin, int yorigin);
1024
1025extern _X_EXPORT void
1026
1027XAAFillColor8x8PatternSpans(ScrnInfoPtr pScrn,
1028 int rop,
1029 unsigned int planemask,
1030 int n,
1031 DDXPointPtr ppt,
1032 int *pwidth, int fSorted,
1033 XAACacheInfoPtr, int xorigin, int yorigin);
1034
1035extern _X_EXPORT void
1036
1037XAAFillCacheBltSpans(ScrnInfoPtr pScrn,
1038 int rop,
1039 unsigned int planemask,
1040 int n,
1041 DDXPointPtr points,
1042 int *widths,
1043 int fSorted, XAACacheInfoPtr pCache, int xorg, int yorg);
1044
1045extern _X_EXPORT void
1046
1047XAAFillCacheExpandSpans(ScrnInfoPtr pScrn,
1048 int fg, int bg, int rop,
1049 unsigned int planemask,
1050 int n,
1051 DDXPointPtr ppt,
1052 int *pwidth,
1053 int fSorted, int xorg, int yorg, PixmapPtr pPix);
1054
1055extern _X_EXPORT void
1056
1057XAAFillSpans(DrawablePtr pDrawable,
1058 GC * pGC,
1059 int nInit, DDXPointPtr pptInit, int *pwidth, int fSorted);
1060
1061extern _X_EXPORT void
1062 XAAInitPixmapCache(ScreenPtr pScreen, RegionPtr areas, pointer data);
1063
1064extern _X_EXPORT void
1065
1066XAAWriteBitmapToCache(ScrnInfoPtr pScrn,
1067 int x, int y, int w, int h,
1068 unsigned char *src, int srcwidth, int fg, int bg);
1069
1070extern _X_EXPORT void
1071
1072XAAWriteBitmapToCacheLinear(ScrnInfoPtr pScrn,
1073 int x, int y, int w, int h,
1074 unsigned char *src, int srcwidth, int fg, int bg);
1075
1076extern _X_EXPORT void
1077
1078XAAWritePixmapToCache(ScrnInfoPtr pScrn,
1079 int x, int y, int w, int h,
1080 unsigned char *src, int srcwidth, int bpp, int depth);
1081
1082extern _X_EXPORT void
1083
1084XAAWritePixmapToCacheLinear(ScrnInfoPtr pScrn,
1085 int x, int y, int w, int h,
1086 unsigned char *src,
1087 int srcwidth, int bpp, int depth);
1088
1089extern _X_EXPORT void
1090 XAASolidHorVertLineAsRects(ScrnInfoPtr pScrn, int x, int y, int len, int dir);
1091
1092extern _X_EXPORT void
1093
1094XAASolidHorVertLineAsTwoPoint(ScrnInfoPtr pScrn,
1095 int x, int y, int len, int dir);
1096
1097extern _X_EXPORT void
1098
1099XAASolidHorVertLineAsBresenham(ScrnInfoPtr pScrn,
1100 int x, int y, int len, int dir);
1101
1102extern _X_EXPORT void
1103
1104XAAPolyRectangleThinSolid(DrawablePtr pDrawable,
1105 GCPtr pGC, int nRectsInit, xRectangle *pRectsInit);
1106
1107extern _X_EXPORT void
1108
1109XAAPolylinesWideSolid(DrawablePtr pDrawable,
1110 GCPtr pGC, int mode, int npt, DDXPointPtr pPts);
1111
1112extern _X_EXPORT void
1113
1114XAAFillPolygonSolid(DrawablePtr pDrawable,
1115 GCPtr pGC,
1116 int shape, int mode, int count, DDXPointPtr ptsIn);
1117
1118extern _X_EXPORT void
1119
1120XAAFillPolygonStippled(DrawablePtr pDrawable,
1121 GCPtr pGC,
1122 int shape, int mode, int count, DDXPointPtr ptsIn);
1123
1124extern _X_EXPORT void
1125
1126XAAFillPolygonTiled(DrawablePtr pDrawable,
1127 GCPtr pGC,
1128 int shape, int mode, int count, DDXPointPtr ptsIn);
1129
1130extern _X_EXPORT int
1131
1132XAAIsEasyPolygon(DDXPointPtr ptsIn,
1133 int count,
1134 BoxPtr extents,
1135 int origin,
1136 DDXPointPtr * topPoint, int *topY, int *bottomY, int shape);
1137
1138extern _X_EXPORT void
1139
1140XAAFillPolygonHelper(ScrnInfoPtr pScrn,
1141 DDXPointPtr ptsIn,
1142 int count,
1143 DDXPointPtr topPoint,
1144 int y,
1145 int maxy,
1146 int origin,
1147 RectFuncPtr RectFunc,
1148 TrapFuncPtr TrapFunc,
1149 int xorg, int yorg, XAACacheInfoPtr pCache);
1150
1151extern _X_EXPORT void
1152 XAAPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg);
1153
1154extern _X_EXPORT void
1155
1156XAAPolyLines(DrawablePtr pDrawable,
1157 GCPtr pGC, int mode, int npt, DDXPointPtr pptInit);
1158
1159extern _X_EXPORT void
1160
1161XAAPolySegmentDashed(DrawablePtr pDrawable,
1162 GCPtr pGC, int nseg, xSegment * pSeg);
1163
1164extern _X_EXPORT void
1165
1166XAAPolyLinesDashed(DrawablePtr pDrawable,
1167 GCPtr pGC, int mode, int npt, DDXPointPtr pptInit);
1168
1169extern _X_EXPORT void
1170 XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache);
1171
1172extern _X_EXPORT void
1173
1174XAAWriteColor8x8PatternToCache(ScrnInfoPtr pScrn,
1175 PixmapPtr pPix, XAACacheInfoPtr pCache);
1176
1177extern _X_EXPORT void
1178
1179XAARotateMonoPattern(int *pat0, int *pat1,
1180 int xoffset, int yoffset, Bool msbfirst);
1181
1182extern _X_EXPORT void XAAComputeDash(GCPtr pGC);
1183
1184extern _X_EXPORT void XAAMoveDWORDS_FixedBase(register CARD32 *dest,
1185 register CARD32 *src,
1186 register int dwords);
1187
1188extern _X_EXPORT void XAAMoveDWORDS_FixedSrc(register CARD32 *dest,
1189 register CARD32 *src,
1190 register int dwords);
1191
1192extern _X_EXPORT void XAAMoveDWORDS(register CARD32 *dest,
1193 register CARD32 *src, register int dwords);
1194
1195extern _X_EXPORT int
1196
1197XAAGetRectClipBoxes(GCPtr pGC,
1198 BoxPtr pboxClippedBase,
1199 int nrectFill, xRectangle *prectInit);
1200
1201extern _X_EXPORT void
1202 XAASetupOverlay8_32Planar(ScreenPtr);
1203
1204extern _X_EXPORT void
1205 XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs);
1206
1207extern _X_EXPORT XAACacheInfoPtr XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix);
1208
1209extern _X_EXPORT XAACacheInfoPtr
1210XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
1211
1212extern _X_EXPORT XAACacheInfoPtr
1213XAACachePlanarMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
1214
1215typedef XAACacheInfoPtr(*XAACachePlanarMonoStippleProc) (ScrnInfoPtr,
1216 PixmapPtr);
1217extern _X_EXPORT XAACachePlanarMonoStippleProc
1218XAAGetCachePlanarMonoStipple(void);
1219
1220extern _X_EXPORT XAACacheInfoPtr
1221XAACacheStipple(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
1222
1223extern _X_EXPORT XAACacheInfoPtr
1224XAACacheMono8x8Pattern(ScrnInfoPtr Scrn, int pat0, int pat1);
1225
1226extern _X_EXPORT XAACacheInfoPtr
1227XAACacheColor8x8Pattern(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
1228
1229extern _X_EXPORT void
1230 XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h);
1231
1232extern _X_EXPORT void XAAClosePixmapCache(ScreenPtr pScreen);
1233void XAAInvalidatePixmapCache(ScreenPtr pScreen);
1234
1235extern _X_EXPORT Bool XAACheckStippleReducibility(PixmapPtr pPixmap);
1236extern _X_EXPORT Bool XAACheckTileReducibility(PixmapPtr pPixmap,
1237 Bool checkMono);
1238
1239extern _X_EXPORT int XAAStippledFillChooser(GCPtr pGC);
1240extern _X_EXPORT int XAAOpaqueStippledFillChooser(GCPtr pGC);
1241extern _X_EXPORT int XAATiledFillChooser(GCPtr pGC);
1242
1243extern _X_EXPORT void XAAMoveInOffscreenPixmaps(ScreenPtr pScreen);
1244extern _X_EXPORT void XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen);
1245extern _X_EXPORT void XAARemoveAreaCallback(FBAreaPtr area);
1246extern _X_EXPORT void XAAMoveOutOffscreenPixmap(PixmapPtr pPix);
1247extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen,
1248 XAAInfoRecPtr infoRec);
1249
1250extern _X_EXPORT void
1251
1252XAAComposite(CARD8 op,
1253 PicturePtr pSrc,
1254 PicturePtr pMask,
1255 PicturePtr pDst,
1256 INT16 xSrc,
1257 INT16 ySrc,
1258 INT16 xMask,
1259 INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
1260
1261extern _X_EXPORT Bool
1262
1263XAADoComposite(CARD8 op,
1264 PicturePtr pSrc,
1265 PicturePtr pMask,
1266 PicturePtr pDst,
1267 INT16 xSrc,
1268 INT16 ySrc,
1269 INT16 xMask,
1270 INT16 yMask,
1271 INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
1272
1273extern _X_EXPORT void
1274
1275XAAGlyphs(CARD8 op,
1276 PicturePtr pSrc,
1277 PicturePtr pDst,
1278 PictFormatPtr maskFormat,
1279 INT16 xSrc,
1280 INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
1281
1282extern _X_EXPORT Bool
1283
1284XAADoGlyphs(CARD8 op,
1285 PicturePtr pSrc,
1286 PicturePtr pDst,
1287 PictFormatPtr maskFormat,
1288 INT16 xSrc,
1289 INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
1290
1291/* helpers */
1292extern _X_EXPORT void
1293 XAA_888_plus_PICT_a8_to_8888(CARD32 color, CARD8 *alphaPtr, /* in bytes */
1294 int alphaPitch, CARD32 *dstPtr, int dstPitch, /* in dwords */
1295 int width, int height);
1296
1297extern _X_EXPORT Bool
1298
1299XAAGetRGBAFromPixel(CARD32 pixel,
1300 CARD16 *red,
1301 CARD16 *green, CARD16 *blue, CARD16 *alpha, CARD32 format);
1302
1303extern _X_EXPORT Bool
1304
1305XAAGetPixelFromRGBA(CARD32 *pixel,
1306 CARD16 red,
1307 CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format);
1308
1309/* XXX should be static */
1310extern _X_EXPORT GCOps XAAFallbackOps;
1311extern _X_EXPORT GCOps *XAAGetFallbackOps(void);
1312extern _X_EXPORT GCFuncs XAAGCFuncs;
1313extern _X_EXPORT DevPrivateKey XAAGetScreenKey(void);
1314extern _X_EXPORT DevPrivateKey XAAGetGCKey(void);
1315extern _X_EXPORT DevPrivateKey XAAGetPixmapKey(void);
1316
1317extern _X_EXPORT unsigned int XAAShiftMasks[32];
1318
1319extern _X_EXPORT unsigned int byte_expand3[256], byte_reversed_expand3[256];
1320
1321extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
1322
1323#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\
1324 dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey())
1325
1326#define GET_XAASCREENPTR_FROM_GC(pGC)\
1327 dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey())
1328
1329#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\
1330 dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey())
1331
1332#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\
1333((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec
1334
1335#define GET_XAAINFORECPTR_FROM_GC(pGC)\
1336((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
1337
1338#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\
1339((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
1340
1341#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\
1342((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
1343
1344#define XAA_GET_PIXMAP_PRIVATE(pix)\
1345 (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey())
1346
1347#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
1348
1349#define CHECK_FG(pGC, flags) \
1350 (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->fgPixel))
1351
1352#define CHECK_BG(pGC, flags) \
1353 (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->bgPixel))
1354
1355#define CHECK_ROP(pGC, flags) \
1356 (!(flags & GXCOPY_ONLY) || (pGC->alu == GXcopy))
1357
1358#define CHECK_ROPSRC(pGC, flags) \
1359 (!(flags & ROP_NEEDS_SOURCE) || ((pGC->alu != GXclear) && \
1360 (pGC->alu != GXnoop) && (pGC->alu != GXinvert) && \
1361 (pGC->alu != GXset)))
1362
1363#define CHECK_PLANEMASK(pGC, flags) \
1364 (!(flags & NO_PLANEMASK) || \
1365 ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == \
1366 infoRec->FullPlanemasks[pGC->depth - 1]))
1367
1368#define CHECK_COLORS(pGC, flags) \
1369 (!(flags & RGB_EQUAL) || \
1370 (CHECK_RGB_EQUAL(pGC->fgPixel) && CHECK_RGB_EQUAL(pGC->bgPixel)))
1371
1372#define CHECK_NO_GXCOPY(pGC, flags) \
1373 ((pGC->alu != GXcopy) || !(flags & NO_GXCOPY) || \
1374 ((pGC->planemask & infoRec->FullPlanemask) != infoRec->FullPlanemask))
1375
1376#define IS_OFFSCREEN_PIXMAP(pPix)\
1377 ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)
1378
1379#define PIXMAP_IS_SHARED(pPix)\
1380 ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & SHARED_PIXMAP)
1381
1382#define OFFSCREEN_PIXMAP_LOCKED(pPix)\
1383 ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & LOCKED_PIXMAP)
1384
1385#define XAA_DEPTH_BUG(pGC) \
1386 ((pGC->depth == 32) && (pGC->bgPixel == 0xffffffff))
1387
1388#define DELIST_OFFSCREEN_PIXMAP(pPix) { \
1389 PixmapLinkPtr _pLink, _prev; \
1390 _pLink = infoRec->OffscreenPixmaps; \
1391 _prev = NULL; \
1392 while(_pLink) { \
1393 if(_pLink->pPix == pPix) { \
1394 if(_prev) _prev->next = _pLink->next; \
1395 else infoRec->OffscreenPixmaps = _pLink->next; \
1396 free(_pLink); \
1397 break; \
1398 } \
1399 _prev = _pLink; \
1400 _pLink = _pLink->next; \
1401 }}
1402
1403#define SWAP_BITS_IN_BYTES(v) \
1404 (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \
1405 ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \
1406 ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \
1407 ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7))
1408
1409/*
1410 * Moved XAAPixmapCachePrivate here from xaaPCache.c, since driver
1411 * replacements for CacheMonoStipple need access to it
1412 */
1413
1414typedef struct {
1415 int Num512x512;
1416 int Current512;
1417 XAACacheInfoPtr Info512;
1418 int Num256x256;
1419 int Current256;
1420 XAACacheInfoPtr Info256;
1421 int Num128x128;
1422 int Current128;
1423 XAACacheInfoPtr Info128;
1424 int NumMono;
1425 int CurrentMono;
1426 XAACacheInfoPtr InfoMono;
1427 int NumColor;
1428 int CurrentColor;
1429 XAACacheInfoPtr InfoColor;
1430 int NumPartial;
1431 int CurrentPartial;
1432 XAACacheInfoPtr InfoPartial;
1433 DDXPointRec MonoOffsets[64];
1434 DDXPointRec ColorOffsets[64];
1435} XAAPixmapCachePrivate, *XAAPixmapCachePrivatePtr;
1436
1437#endif /* _XAALOCAL_H */
diff --git a/hw/xfree86/xaa/xaawrap.h b/hw/xfree86/xaa/xaawrap.h
deleted file mode 100644
index 2d2d7881a..000000000
--- a/hw/xfree86/xaa/xaawrap.h
+++ /dev/null
@@ -1,75 +0,0 @@
1
2#define XAA_SCREEN_PROLOGUE(pScreen, field)\
3 ((pScreen)->field = \
4 ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
5
6#define XAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\
7 ((pScreen)->field = wrapper)
8
9#define XAA_GC_FUNC_PROLOGUE(pGC)\
10 XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
11 (pGC)->funcs = pGCPriv->wrapFuncs;\
12 if(pGCPriv->flags)\
13 (pGC)->ops = pGCPriv->wrapOps
14
15#define XAA_GC_FUNC_EPILOGUE(pGC)\
16 pGCPriv->wrapFuncs = (pGC)->funcs;\
17 (pGC)->funcs = &XAAGCFuncs;\
18 if(pGCPriv->flags) {\
19 pGCPriv->wrapOps = (pGC)->ops;\
20 (pGC)->ops = (pGCPriv->flags & OPS_ARE_ACCEL) ? pGCPriv->XAAOps :\
21 &XAAPixmapOps;\
22 }
23
24#define XAA_GC_OP_PROLOGUE(pGC)\
25 XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
26 GCFuncs *oldFuncs = pGC->funcs;\
27 pGC->funcs = pGCPriv->wrapFuncs;\
28 pGC->ops = pGCPriv->wrapOps
29
30#define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\
31 XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
32 GCFuncs *oldFuncs = pGC->funcs;\
33 if(!RegionNumRects(pGC->pCompositeClip)) return; \
34 pGC->funcs = pGCPriv->wrapFuncs;\
35 pGC->ops = pGCPriv->wrapOps
36
37#define XAA_GC_OP_EPILOGUE(pGC)\
38 pGCPriv->wrapOps = pGC->ops;\
39 pGC->funcs = oldFuncs;\
40 pGC->ops = pGCPriv->XAAOps
41
42#define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\
43 XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
44 XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\
45 GCFuncs *oldFuncs = pGC->funcs;\
46 pGC->funcs = pGCPriv->wrapFuncs;\
47 pGC->ops = pGCPriv->wrapOps; \
48 SYNC_CHECK(pGC)
49
50#define XAA_PIXMAP_OP_EPILOGUE(pGC)\
51 pGCPriv->wrapOps = pGC->ops;\
52 pGC->funcs = oldFuncs;\
53 pGC->ops = &XAAPixmapOps;\
54 pixPriv->flags |= DIRTY
55
56#ifdef HAVE_XORG_CONFIG_H
57#include <xorg-config.h>
58#endif
59
60#define XAA_RENDER_PROLOGUE(pScreen,field)\
61 (GetPictureScreen(pScreen)->field = \
62 ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
63
64#define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\
65 (GetPictureScreen(pScreen)->field = wrapper)
66
67/* This also works fine for drawables */
68
69#define SYNC_CHECK(pGC) {\
70 XAAInfoRecPtr infoRec =\
71((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec; \
72 if(infoRec->NeedToSync) {\
73 (*infoRec->Sync)(infoRec->pScrn);\
74 infoRec->NeedToSync = FALSE;\
75 }}