summaryrefslogtreecommitdiff
path: root/hw/kdrive/savage/s3draw.h
diff options
context:
space:
mode:
authorDirk Hohndel <dirk.hohndel@intel.com>1999-11-19 13:54:06 +0000
committerDirk Hohndel <dirk.hohndel@intel.com>1999-11-19 13:54:06 +0000
commitf13b792a3a8d307a18cd6a41aa5a06622009e42f (patch)
tree5d7e7eb1dd3d69a9a408d0082c031c6121d625ea /hw/kdrive/savage/s3draw.h
3336. Fx up new MMIO macros (#3337, Matt Grossman).xf-3_9_16fxf-3_9_16exf-3_9_16dxf-3_9_16Z
3335. Clean up compiler warnings in lib/font/bitmap (#3411, Matt Grossman). 3334. TGA fixes, add sync on green (#3410, Matt Grossman). 3333. Fix NULL pointer dereference in libXaw (#3406, Christopher Sekiya). 3332. Add Rage128 support (#3405, Rik Faith, funded by ATI). 3331. Add MTRR support for NetBSD and OpenBSD. Add new NetBSD aperture driver (#3404, Matthieu Herrb). 3330. Xterm patch #121 (#3402, Thomas Dickey). 3329. Rendition driver bugfixes and alpha related cleanups (#3400, Dejan Ilic, Marc Langenbach, Egbert Eich). 3328. Add void input device (#3392, Frederic Lepied). 3327. Changed the Xon serial option to be able to select xon/xoff for input, output or both. Add support for Graphire models. Change wacom init phase to use new Xoff option (#3391, Frederic Lepied). 3326. Change the SwapAxes option to SwapXY in elographics/microtouch driver to match an already existing option in the Dynapro driver. Add a Focus class capability to the elographics driver (#3395, Patrick Lecoanet). 3325. Update mouse rate handling (#3388, Harald Koenig). 3324. Fix NULL pointer dereference in misprite.c (#3380, Edward Wang). 3323. Add FBDev and ShadowFB support to glint driver. Add new option "NoWriteBitmap" (#3383, Michel Daenzer). 3322. Update SuperProbe to handle S3 Savage4, Savage200 and clean up Trio3D/Savage3D detection (#3382,3384 Harald Koenig). 3321. Add new framebuffer code and tiny X DDX architecture (#3379, Keith Packard). 3320. Add DGA2 documentation (#3378, Mark Vojkovich). 3319. Update XFree86 manpage wrt -bpp/-depth/-fbbpp (#3377, Andy Isaacson). 3318. Make SuperProbe check primary cards, only (#3374, Harald Koenig). 3317. Add SilkenMouse to *BSD (#3373, Matthieu Herrb). 3316. Allow SilkenMouse to work if not all drivers of an OS support SIGIO (#3372, Keith Packard). 3315. Fix a few problems in TGA driver and add support for backing store and SilkenMouse (#3371, Matt Grossman). 3314. Add smarter scheduler (#3370, Keith Packard). 3313. Xterm patch #120 (#3369, Thomas Dickey). 3312. Enable xf86SetKbdRate function on Solaris 8 (#3364, David Holland). 3311. Fix some bugs and add acceleration to Rendition server (#3360, Dejan Ilic). 3310. Make raw DDC information available as properties in the root window (#3357, Andrew Aitchison). 3309. Fix for xf86CreateRootWindow (#3355, Andrew Aitchison). 3308. Add manpage for the chips driver (#3353, David Bateman). 3307. Update contact info (#3352, Andrew van der Stock). 3306. Add kbd rate support for Linux (#3363, Harald Koenig). 3305. Update Portuguese XKB map (#3351, Joao Esteves, Francisco Colaco). 3304. Fix text clipping in 3dfx driver (#3349, Henrik Harmsen). 3303. Fix S3 ViRGE hw cursor (#3348, Harald Koenig). 3302. Fix clipping in 3dfx driver (#3342, Daryll Strauss). 3301. Enable SilkenMouse for 3dfx driver (#3341, Henrik Harmsen). 3300. Enable SIGIO support on LynxOS (#3339, Thomas Mueller). 3299. Get TRUE defined in sigio.c. Fix xterm compile problem on ISC (#3338, Michael Rohleder). 3298. Correct DPMS suspend/standby modes for 3dfx driver (#3336, Henrik Harmsen) 3297. Xterm patch #119 (#3335, Thomas Dickey).
Diffstat (limited to 'hw/kdrive/savage/s3draw.h')
-rw-r--r--hw/kdrive/savage/s3draw.h372
1 files changed, 372 insertions, 0 deletions
diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h
new file mode 100644
index 000000000..14dd1688e
--- /dev/null
+++ b/hw/kdrive/savage/s3draw.h
@@ -0,0 +1,372 @@
+/*
+ * $Id$
+ *
+ * Copyright 1999 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+/* $XFree86: $ */
+
+#ifndef _S3DRAW_H_
+#define _S3DRAW_H_
+
+extern int s3GCPrivateIndex;
+extern int s3WindowPrivateIndex;
+
+typedef struct _s3Pattern {
+ S3PatternCache *cache;
+ int id;
+ PixmapPtr pPixmap;
+ int fillStyle;
+ int xrot, yrot;
+ unsigned int fore, back;
+} s3PatternRec, *s3PatternPtr;
+
+typedef struct _s3PrivGC {
+ int type; /* type of drawable validated against */
+ s3PatternPtr pPattern; /* pattern */
+} s3PrivGCRec, *s3PrivGCPtr;
+
+#define s3GetGCPrivate(g) ((s3PrivGCPtr) \
+ (g)->devPrivates[s3GCPrivateIndex].ptr)
+
+#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g)
+
+#define s3GetWindowPrivate(w) ((s3PatternPtr) \
+ (w)->devPrivates[s3WindowPrivateIndex].ptr)
+
+#define s3SetWindowPrivate(w,p) (\
+ (w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p)
+
+
+void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern);
+
+#define SetupS3(s) KdScreenPriv(s); \
+ s3CardInfo(pScreenPriv); \
+ S3Ptr s3 = s3c->s3
+
+#define WIDEN(x) ((unsigned long) (x))
+#define MERGE(a,b) ((WIDEN(a) << 16) | WIDEN(b))
+
+#define _s3SetFg(s3,_fg) { \
+ DRAW_DEBUG ((DEBUG_REGISTERS, " fg <- 0x%x", _fg));\
+ s3->fg = (_fg); \
+}
+
+#define _s3SetBg(s3,_bg) { \
+ DRAW_DEBUG ((DEBUG_REGISTERS, " bg <- 0x%x", _bg));\
+ s3->bg = (_bg); \
+}
+
+#define _s3SetWriteMask(s3,_mask) {\
+ DRAW_DEBUG((DEBUG_REGISTERS," write_mask <- 0x%x", _mask)); \
+ s3->write_mask = (_mask); \
+}
+
+#define _s3SetReadMask(s3,_mask) {\
+ DRAW_DEBUG((DEBUG_REGISTERS," read_mask <- 0x%x", _mask)); \
+ s3->read_mask = (_mask); \
+}
+
+#define _s3SetPixelControl(s3,_ctl) { \
+ DRAW_DEBUG((DEBUG_REGISTERS, " pix_cntl <- 0x%x", PIX_CNTL | (_ctl))); \
+ s3->pix_cntl = PIX_CNTL | (_ctl); \
+}
+
+#define _s3SetFgMix(s3,_mix) { \
+ DRAW_DEBUG((DEBUG_REGISTERS, " fg_mix <- 0x%x", _mix)); \
+ s3->enh_fg_mix = (_mix); \
+}
+
+#define _s3SetBgMix(s3,_mix) { \
+ DRAW_DEBUG((DEBUG_REGISTERS, " bg_mix <- 0x%x", _mix)); \
+ s3->enh_bg_mix = (_mix); \
+}
+
+#define _s3SetMix(s3,fg_mix,bg_mix) { \
+ DRAW_DEBUG((DEBUG_REGISTERS, " alt_mix <- 0x%x", MERGE(fg_mix,bg_mix))); \
+ s3->alt_mix = MERGE(fg_mix,bg_mix); \
+}
+
+#define _s3SetCur(s3,_x,_y) { \
+ DRAW_DEBUG ((DEBUG_REGISTERS, " alt_curxy <- 0x%x", MERGE(_x,_y))); \
+ s3->alt_curxy = MERGE(_x,_y); \
+}
+
+#define _s3SetStep(s3,_x,_y) { \
+ DRAW_DEBUG ((DEBUG_REGISTERS, " alt_step <- 0x%x", MERGE(_x,_y))); \
+ s3->alt_step = MERGE(_x,_y); \
+}
+
+#define _s3SetErr(s3,_e) { \
+ DRAW_DEBUG ((DEBUG_REGISTERS, " err_term <- 0x%x", _e)); \
+ s3->err_term = (_e); \
+}
+
+#define _s3SetPcnt(s3,_x,_y) { \
+ DRAW_DEBUG ((DEBUG_REGISTERS, " alt_pcnt <- 0x%x", MERGE(_x,_y))); \
+ s3->alt_pcnt = MERGE(_x,_y); \
+}
+
+#define _s3SetScissorsTl(s3,t,l) {\
+ DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_tl <- 0x%x", MERGE(t,l))); \
+ s3->scissors_tl = MERGE(t,l); \
+}
+
+#define _s3SetScissorsBr(s3,b,r) {\
+ DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_br <- 0x%x", MERGE(b,r))); \
+ s3->scissors_br = MERGE(b,r); \
+}
+
+#define _s3CmdWait(s3)
+
+#define _s3SetCmd(s3,_cmd) { \
+ DRAW_DEBUG((DEBUG_REGISTERS, " cmd <- 0x%x", _cmd)); \
+ _s3CmdWait(s3); \
+ s3->cmd_gp_stat = (_cmd); \
+ { CARD32 __junk__; __junk__ = s3->cmd_gp_stat; } \
+}
+
+#define _s3SetSolidFill(s3,pix,alu,mask) { \
+ DRAW_DEBUG((DEBUG_SET,"set fill 0x%x %d 0x%x",pix,alu,mask)); \
+ _s3SetFg (s3, pix); \
+ _s3SetWriteMask(s3,mask); \
+ _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL | MIX_SRC); \
+ _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+#define _s3SolidRect(s3,x,y,w,h) {\
+ DRAW_DEBUG((DEBUG_RENDER,"solid rect %d,%d %dx%d",x,y,w,h)); \
+ _s3CmdWait(s3); \
+ _s3SetCur(s3, x, y); \
+ _s3SetPcnt (s3, (w)-1, (h)-1); \
+ _s3SetCmd (s3, CMD_RECT|INC_X|INC_Y|DRAW|WRTDATA); \
+ DRAW_DEBUG((DEBUG_RENDER," done")); \
+}
+
+#define _s3SolidLine(s3,maj,min,len,cmd) { \
+ DRAW_DEBUG ((DEBUG_RENDER, "solid line 0x%x 0x%x 0x%x", maj, min, cmd)); \
+ _s3CmdWait(s3); \
+ _s3SetPcnt(s3, (len), 0); \
+ _s3SetStep(s3, 2*((min) - (maj)), 2*(min)); \
+ _s3SetErr(s3, 2*(min) - (maj)); \
+ _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \
+}
+
+#define _s3SetTile(s3,alu,mask) { \
+ DRAW_DEBUG ((DEBUG_SET,"set tile %d 0x%x", alu, mask)); \
+ _s3SetWriteMask(s3, mask); \
+ _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT|s3alu[alu]); \
+ _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+/*
+ * For some reason, MIX_DST doesn't work in this mode; use MIX_OR with
+ * an explicit 0 pixel value
+ */
+#define _s3SetStipple(s3,alu,mask,_fg) {\
+ DRAW_DEBUG ((DEBUG_SET,"set stipple 0x%x %d 0x%x", _fg, alu, mask)); \
+ _s3SetFg (s3, _fg); \
+ _s3SetBg (s3, 0); \
+ _s3SetWriteMask(s3,mask); \
+ _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|MIX_OR); \
+ _s3SetPixelControl (s3, MIXSEL_EXPBLT); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+#define _s3SetOpaqueStipple(s3,alu,mask,_fg,_bg) {\
+ DRAW_DEBUG ((DEBUG_SET,"set opaque stipple 0x%x 0x%x %d 0x%x", _fg, _bg, alu, mask)); \
+ _s3SetFg (s3, _fg); \
+ _s3SetBg (s3, _bg); \
+ _s3SetWriteMask(s3,mask); \
+ _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \
+ _s3SetPixelControl (s3, MIXSEL_EXPBLT); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+#define _s3PatRect(s3,px,py,x,y,w,h) {\
+ DRAW_DEBUG ((DEBUG_RENDER, "pat rect %d,%d %dx%d", x,y,w,h)); \
+ _s3CmdWait(s3); \
+ _s3SetCur (s3, px, py); \
+ _s3SetStep (s3, x, y); \
+ _s3SetPcnt (s3, (w)-1, (h)-1); \
+ _s3SetCmd (s3, CMD_PATBLT|INC_X|INC_Y|DRAW|PLANAR|WRTDATA); \
+ DRAW_DEBUG((DEBUG_RENDER," done")); \
+}
+
+#define _s3SetBlt(s3,alu,mask) { \
+ DRAW_DEBUG ((DEBUG_SET,"set blt %d 0x%x", alu, mask)); \
+ _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \
+ _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT | s3alu[alu]); \
+ _s3SetWriteMask(s3, mask); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+#define _s3Blt(s3,_sx,_sy,_dx,_dy,_w,_h,_dir) { \
+ DRAW_DEBUG ((DEBUG_RENDER, "blt %d,%d -> %d,%d %dx%d 0x%x", \
+ _sx,_sy,_dx,_dy,_w,_h,_dir)); \
+ _s3CmdWait(s3); \
+ _s3SetCur(s3,_sx,_sy); \
+ _s3SetStep(s3,_dx,_dy); \
+ _s3SetPcnt(s3,(_w)-1,(_h)-1); \
+ _s3SetCmd (s3, CMD_BITBLT | (_dir) | DRAW | WRTDATA); \
+ DRAW_DEBUG((DEBUG_RENDER," done")); \
+}
+
+#define _s3SetOpaquePlaneBlt(s3,alu,mask,_fg,_bg) {\
+ DRAW_DEBUG ((DEBUG_SET,"set opaque plane blt 0x%x 0x%x %d 0x%x", \
+ _fg, _bg, alu, mask)); \
+ _s3SetFg(s3,_fg); \
+ _s3SetBg(s3,_bg); \
+ _s3SetWriteMask(s3,mask); \
+ _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \
+ _s3SetPixelControl(s3,MIXSEL_EXPPC); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+#define _s3SetTransparentPlaneBlt(s3,alu,mask,_fg) {\
+ DRAW_DEBUG ((DEBUG_SET,"set transparent plane blt 0x%x %d 0x%x", \
+ _fg, alu, mask)); \
+ _s3SetFg(s3,_fg); \
+ _s3SetWriteMask(s3,mask); \
+ _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|MIX_DST); \
+ _s3SetPixelControl(s3,MIXSEL_EXPPC); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+/* Across the plane blt */
+#define _s3PlaneBlt(s3,x,y,w,h) {\
+ DRAW_DEBUG ((DEBUG_RENDER, "plane blt %d,%d %dx%d", x,y,w,h)); \
+ _s3CmdWait(s3); \
+ _s3SetCur(s3, x, y); \
+ _s3SetPcnt (s3, (w)-1, (h)-1); \
+ _s3SetCmd (s3, \
+ CMD_RECT| /* Fill rectangle */ \
+ BYTSEQ| /* LSB byte order */ \
+ _32BIT| /* 32 bit data on 32 bit boundaries */ \
+ PCDATA| /* Data from CPU */ \
+ INC_X|INC_Y| /* X and Y both increasing */ \
+ DRAW| /* Draw, not move */ \
+ PLANAR| /* multi pixel */ \
+ WRTDATA); \
+ DRAW_DEBUG((DEBUG_RENDER," done")); \
+}
+
+#define _s3SetClip(s3,pbox) {\
+ DRAW_DEBUG ((DEBUG_SET, "set clip %dx%d -> %dx%d ", \
+ pbox->x1, pbox->y1, pbox->x2, pbox->y2)); \
+ _s3WaitEmpty(s3); \
+ _s3SetScissorsTl(s3,(pbox)->x1, (pbox)->y1); \
+ _s3SetScissorsBr(s3,(pbox)->x2 - 1, (pbox)->y2 - 1); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+#define _s3ResetClip(s3,pScreen) { \
+ DRAW_DEBUG ((DEBUG_SET, "reset clip")); \
+ _s3WaitEmpty(s3); \
+ _s3SetScissorsTl(s3,0,0); \
+ _s3SetScissorsBr(s3,pScreen->width - 1, pScreen->height - 1); \
+ DRAW_DEBUG((DEBUG_SET," done")); \
+}
+
+RegionPtr
+s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty);
+
+RegionPtr
+s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane);
+
+void
+s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
+ unsigned long pixel, int alu, unsigned long planemask);
+
+void
+s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
+ int alu, unsigned long planemask, s3PatternPtr pPattern);
+
+void
+s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+
+void
+s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+
+void
+s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
+
+void
+s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+
+void
+s3PolyGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase);
+
+void
+s3ImageGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+
+void
+s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
+ int xInit, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase);
+
+void
+s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y,
+ unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase);
+
+void
+s3Polylines (DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int nptInit, DDXPointPtr pptInit);
+
+void
+s3PolySegment (DrawablePtr pDrawable, GCPtr pGC,
+ int nsegInit, xSegment *pSegInit);
+
+void
+s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox,
+ unsigned long pixel, int alu, unsigned long planemask);
+
+void s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable);
+
+void
+s3CheckGCFill (GCPtr pGC);
+
+void
+s3MoveGCFill (GCPtr pGC);
+
+#endif