summaryrefslogtreecommitdiff
path: root/hw/kdrive/igs/igs.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2000-05-06 22:17:53 +0000
committerKeith Packard <keithp@keithp.com>2000-05-06 22:17:53 +0000
commit3731c184d69e3c1face0c731926433d522d48067 (patch)
tree687fa152bbb27d72d12e64b248f71b255311d087 /hw/kdrive/igs/igs.c
parent4b54f22b6accf438f31fbbe79877545c38375351 (diff)
Lots of Tiny-X changes:
Add overlay support in the Tiny-X Savage4 driver (required changing lots of Tiny-X code). Savage4 now support 8/16, 8/32 overlays. Add IGS Cyberpro 5050 driver. This chip has bus support for embeded systems.
Diffstat (limited to 'hw/kdrive/igs/igs.c')
-rw-r--r--hw/kdrive/igs/igs.c201
1 files changed, 201 insertions, 0 deletions
diff --git a/hw/kdrive/igs/igs.c b/hw/kdrive/igs/igs.c
new file mode 100644
index 000000000..62b31af48
--- /dev/null
+++ b/hw/kdrive/igs/igs.c
@@ -0,0 +1,201 @@
+/*
+ * $XFree86$
+ *
+ * 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.
+ */
+
+#include "igs.h"
+
+Bool
+igsCardInit (KdCardInfo *card)
+{
+ int k;
+ char *pixels;
+ IgsCardInfo *igsc;
+
+ igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo));
+ if (!igsc)
+ return FALSE;
+
+ memset (igsc, '\0', sizeof (IgsCardInfo));
+
+ igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0],
+ 4096 * 1024);
+
+ igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] +
+ IGS_COP_OFFSET,
+ sizeof (Cop5xxx));
+
+ igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] +
+ IGS_COP_DATA,
+ IGS_COP_DATA_LEN);
+
+ card->driver = igsc;
+
+ return TRUE;
+}
+
+Bool
+igsScreenInit (KdScreenInfo *screen)
+{
+ IgsCardInfo *igsc = screen->card->driver;
+ int fb = 0;
+
+ if (screen->fb[fb].depth >= 24)
+ {
+ screen->fb[fb].depth = 24;
+ if (screen->fb[fb].bitsPerPixel != 24)
+ screen->fb[fb].bitsPerPixel = 32;
+ }
+ else if (screen->fb[fb].depth >= 16)
+ {
+ screen->fb[fb].depth = 16;
+ screen->fb[fb].bitsPerPixel = 16;
+ }
+ else if (screen->fb[fb].depth >= 15)
+ {
+ screen->fb[fb].depth = 15;
+ screen->fb[fb].bitsPerPixel = 16;
+ }
+ else
+ {
+ screen->fb[fb].depth = 8;
+ screen->fb[fb].bitsPerPixel = 8;
+ }
+ switch (screen->fb[fb].depth) {
+ case 8:
+ screen->fb[fb].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+ screen->fb[fb].blueMask = 0x00;
+ screen->fb[fb].greenMask = 0x00;
+ screen->fb[fb].redMask = 0x00;
+ break;
+ case 15:
+ screen->fb[fb].visuals = (1 << TrueColor);
+ screen->fb[fb].blueMask = 0x001f;
+ screen->fb[fb].greenMask = 0x03e0;
+ screen->fb[fb].redMask = 0x7c00;
+ break;
+ case 16:
+ screen->fb[fb].visuals = (1 << TrueColor);
+ screen->fb[fb].blueMask = 0x001f;
+ screen->fb[fb].greenMask = 0x07e0;
+ screen->fb[fb].redMask = 0xf800;
+ break;
+ case 24:
+ screen->fb[fb].visuals = (1 << TrueColor);
+ screen->fb[fb].blueMask = 0x0000ff;
+ screen->fb[fb].greenMask = 0x00ff00;
+ screen->fb[fb].redMask = 0xff0000;
+ break;
+ }
+ screen->fb[fb].pixelStride = screen->width;
+ screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
+ screen->fb[fb].frameBuffer = igsc->frameBuffer;
+ if (!igsc->cop)
+ screen->dumb = TRUE;
+ return TRUE;
+}
+
+Bool
+igsInitScreen(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+void
+igsPreserve (KdCardInfo *card)
+{
+}
+
+void
+igsEnable (ScreenPtr pScreen)
+{
+}
+
+Bool
+igsDPMS (ScreenPtr pScreen, int mode)
+{
+ return TRUE;
+}
+
+void
+igsDisable (ScreenPtr pScreen)
+{
+}
+
+void
+igsRestore (KdCardInfo *card)
+{
+}
+
+void
+igsScreenFini (KdScreenInfo *screen)
+{
+}
+
+void
+igsCardFini (KdCardInfo *card)
+{
+ IgsCardInfo *igsc = card->driver;
+
+ if (igsc->copData)
+ KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN);
+ if (igsc->cop)
+ KdUnmapDevice (igsc->cop, sizeof (Cop5xxx));
+ if (igsc->frameBuffer)
+ KdUnmapDevice (igsc->frameBuffer, 4096 * 1024);
+ xfree (igsc);
+ card->driver = 0;
+}
+
+KdCardFuncs igsFuncs = {
+ igsCardInit, /* cardinit */
+ igsScreenInit, /* scrinit */
+ igsInitScreen,
+ igsPreserve, /* preserve */
+ igsEnable, /* enable */
+ igsDPMS, /* dpms */
+ igsDisable, /* disable */
+ igsRestore, /* restore */
+ igsScreenFini, /* scrfini */
+ igsCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ igsDrawInit, /* initAccel */
+ igsDrawEnable, /* enableAccel */
+ igsDrawSync, /* drawSync */
+ igsDrawDisable, /* disableAccel */
+ igsDrawFini, /* finiAccel */
+
+ 0, /* getColors */
+ 0, /* putColors */
+};