summaryrefslogtreecommitdiff
path: root/hw/kdrive/mga
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kdrive/mga')
-rw-r--r--hw/kdrive/mga/Makefile.am34
-rw-r--r--hw/kdrive/mga/g400_common.h192
-rw-r--r--hw/kdrive/mga/g400_composite.c306
-rw-r--r--hw/kdrive/mga/mga.c244
-rw-r--r--hw/kdrive/mga/mga.h168
-rw-r--r--hw/kdrive/mga/mgadraw.c317
-rw-r--r--hw/kdrive/mga/mgastub.c66
7 files changed, 0 insertions, 1327 deletions
diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am
deleted file mode 100644
index 66b2636b1..000000000
--- a/hw/kdrive/mga/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-INCLUDES = \
- @KDRIVE_INCS@ \
- -I$(top_srcdir)/hw/kdrive/vesa \
- @XSERVER_CFLAGS@
-
-bin_PROGRAMS = Xmga
-
-noinst_LIBRARIES = libmga.a
-
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
-libmga_a_SOURCES = \
- mgadraw.c \
- g400_composite.c \
- g400_common.h \
- mga.c \
- mga.h
-
-Xmga_SOURCES = \
- mgastub.c
-
-MGA_LIBS = \
- libmga.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@
-
-Xmga_LDADD = \
- $(MGA_LIBS) \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-Xmga_DEPENDENCIES = $(MGA_LIBS) @KDRIVE_LIBS@
diff --git a/hw/kdrive/mga/g400_common.h b/hw/kdrive/mga/g400_common.h
deleted file mode 100644
index a62f8dae8..000000000
--- a/hw/kdrive/mga/g400_common.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2004 Damien Ciabrini
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $Header$ */
-
-#ifndef __G400_COMMON_H__
-#define __G400_COMMON_H__
-
-/* Color registers */
-#define MGA_REG_DR4 (0x1CD0)
-#define MGA_REG_DR6 (0x1CD8)
-#define MGA_REG_DR7 (0x1CDC)
-#define MGA_REG_DR8 (0x1CE0)
-#define MGA_REG_DR10 (0x1CE8)
-#define MGA_REG_DR11 (0x1CEC)
-#define MGA_REG_DR12 (0x1CF0)
-#define MGA_REG_DR14 (0x1CF8)
-#define MGA_REG_DR15 (0x1CFC)
-
-/* Alpha registers */
-#define MGA_REG_ALPHASTART (0x2C70)
-#define MGA_REG_ALPHAXINC (0x2C74)
-#define MGA_REG_ALPHAYINC (0x2C78)
-#define MGA_REG_ALPHACTRL (0x2C7C)
-# define MGA_SRC_ZERO (0x00000000)
-# define MGA_SRC_ONE (0x00000001)
-# define MGA_SRC_DST_COLOR (0x00000002)
-# define MGA_SRC_ONE_MINUS_DST_COLOR (0x00000003)
-# define MGA_SRC_ALPHA (0x00000004)
-# define MGA_SRC_ONE_MINUS_SRC_ALPHA (0x00000005)
-# define MGA_SRC_DST_ALPHA (0x00000006)
-# define MGA_SRC_ONE_MINUS_DST_ALPHA (0x00000007)
-# define MGA_SRC_SRC_ALPHA_SATURATE (0x00000008)
-
-# define MGA_DST_ZERO (0x00000000)
-# define MGA_DST_ONE (0x00000010)
-# define MGA_DST_SRC_COLOR (0x00000020)
-# define MGA_DST_ONE_MINUS_SRC_COLOR (0x00000030)
-# define MGA_DST_SRC_ALPHA (0x00000040)
-# define MGA_DST_ONE_MINUS_SRC_ALPHA (0x00000050)
-# define MGA_DST_DST_ALPHA (0x00000060)
-# define MGA_DST_ONE_MINUS_DST_ALPHA (0x00000070)
-
-# define MGA_ALPHACHANNEL (0x00000100)
-# define MGA_VIDEOALPHA (0x00000200)
-# define MGA_DIFFUSEDALPHA (0x01000000)
-# define MGA_MODULATEDALPHA (0x02000000)
-
-/* Textures registers */
-#define MGA_REG_TEXORG (0x2c24)
-#define MGA_REG_TEXORG1 (0x2ca4)
-#define MGA_REG_TEXWIDTH (0x2C28)
-#define MGA_REG_TEXHEIGHT (0x2C2C)
-#define MGA_REG_TMR0 (0x2C00)
-#define MGA_REG_TMR1 (0x2C04)
-#define MGA_REG_TMR2 (0x2C08)
-#define MGA_REG_TMR3 (0x2C0C)
-#define MGA_REG_TMR4 (0x2C10)
-#define MGA_REG_TMR5 (0x2C14)
-#define MGA_REG_TMR6 (0x2C18)
-#define MGA_REG_TMR7 (0x2C1C)
-#define MGA_REG_TMR8 (0x2C20)
-
-/* Texture Control Registers */
-#define MGA_REG_TEXCTL (0x2C30)
-# define MGA_TW4 (0x00000000)
-# define MGA_TW8 (0x00000001)
-# define MGA_TW15 (0x00000002)
-# define MGA_TW16 (0x00000003)
-# define MGA_TW12 (0x00000004)
-# define MGA_TW32 (0x00000006)
-# define MGA_TW8A (0x00000007)
-# define MGA_TW8AL (0x00000008)
-# define MGA_TW422 (0x0000000A)
-# define MGA_TW422UYVY (0x0000000B)
-# define MGA_PITCHEXT (0x00000100)
-# define MGA_NOPERSPECTIVE (0x00200000)
-# define MGA_TAKEY (0x02000000)
-# define MGA_TAMASK (0x04000000)
-# define MGA_CLAMPUV (0x18000000)
-#define MGA_REG_TEXCTL2 (0x2C3C)
-# define MGA_G400_TC2_MAGIC (0x00008000)
-# define MGA_TC2_DECALBLEND (0x00000001)
-# define MGA_TC2_IDECAL (0x00000002)
-# define MGA_TC2_DECALDIS (0x00000004)
-# define MGA_TC2_CKSTRANSDIS (0x00000010)
-# define MGA_TC2_BORDEREN (0x00000020)
-# define MGA_TC2_SPECEN (0x00000040)
-# define MGA_TC2_DUALTEX (0x00000080)
-# define MGA_TC2_TABLEFOG (0x00000100)
-# define MGA_TC2_BUMPMAP (0x00000200)
-# define MGA_TC2_SELECT_TMU1 (0x80000000)
-#define MGA_REG_TEXFILTER (0x2C58)
-# define MGA_MIN_NRST (0x00000000)
-# define MGA_MIN_BILIN (0x00000002)
-# define MGA_MIN_ANISO (0x0000000D)
-# define MGA_MAG_NRST (0x00000000)
-# define MGA_MAG_BILIN (0x00000020)
-
-/* Multi-Textures Control Registers */
-#define MGA_REG_TDUALSTAGE0 (0x2CF8)
-#define MGA_REG_TDUALSTAGE1 (0x2CFC)
-# define MGA_TDS_COLOR_ARG2_DIFFUSE (0x00000000)
-# define MGA_TDS_COLOR_ARG2_SPECULAR (0x00000001)
-# define MGA_TDS_COLOR_ARG2_FCOL (0x00000002)
-# define MGA_TDS_COLOR_ARG2_PREVSTAGE (0x00000003)
-# define MGA_TDS_COLOR_ALPHA_DIFFUSE (0x00000000)
-# define MGA_TDS_COLOR_ALPHA_FCOL (0x00000004)
-# define MGA_TDS_COLOR_ALPHA_CURRTEX (0x00000008)
-# define MGA_TDS_COLOR_ALPHA_PREVTEX (0x0000000c)
-# define MGA_TDS_COLOR_ALPHA_PREVSTAGE (0x00000010)
-# define MGA_TDS_COLOR_ARG1_REPLICATEALPHA (0x00000020)
-# define MGA_TDS_COLOR_ARG1_INV (0x00000040)
-# define MGA_TDS_COLOR_ARG2_REPLICATEALPHA (0x00000080)
-# define MGA_TDS_COLOR_ARG2_INV (0x00000100)
-# define MGA_TDS_COLOR_ALPHA1INV (0x00000200)
-# define MGA_TDS_COLOR_ALPHA2INV (0x00000400)
-# define MGA_TDS_COLOR_ARG1MUL_ALPHA1 (0x00000800)
-# define MGA_TDS_COLOR_ARG2MUL_ALPHA2 (0x00001000)
-# define MGA_TDS_COLOR_ARG1ADD_MULOUT (0x00002000)
-# define MGA_TDS_COLOR_ARG2ADD_MULOUT (0x00004000)
-# define MGA_TDS_COLOR_MODBRIGHT_2X (0x00008000)
-# define MGA_TDS_COLOR_MODBRIGHT_4X (0x00010000)
-# define MGA_TDS_COLOR_ADD_SUB (0x00000000)
-# define MGA_TDS_COLOR_ADD_ADD (0x00020000)
-# define MGA_TDS_COLOR_ADD2X (0x00040000)
-# define MGA_TDS_COLOR_ADDBIAS (0x00080000)
-# define MGA_TDS_COLOR_BLEND (0x00100000)
-# define MGA_TDS_COLOR_SEL_ARG1 (0x00000000)
-# define MGA_TDS_COLOR_SEL_ARG2 (0x00200000)
-# define MGA_TDS_COLOR_SEL_ADD (0x00400000)
-# define MGA_TDS_COLOR_SEL_MUL (0x00600000)
-# define MGA_TDS_ALPHA_ARG1_INV (0x00800000)
-# define MGA_TDS_ALPHA_ARG2_DIFFUSE (0x00000000)
-# define MGA_TDS_ALPHA_ARG2_FCOL (0x01000000)
-# define MGA_TDS_ALPHA_ARG2_PREVTEX (0x02000000)
-# define MGA_TDS_ALPHA_ARG2_PREVSTAGE (0x03000000)
-# define MGA_TDS_ALPHA_ARG2_INV (0x04000000)
-# define MGA_TDS_ALPHA_ADD (0x08000000)
-# define MGA_TDS_ALPHA_ADDBIAS (0x10000000)
-# define MGA_TDS_ALPHA_ADD2X (0x20000000)
-# define MGA_TDS_ALPHA_SEL_ARG1 (0x00000000)
-# define MGA_TDS_ALPHA_SEL_ARG2 (0x40000000)
-# define MGA_TDS_ALPHA_SEL_ADD (0x80000000)
-# define MGA_TDS_ALPHA_SEL_MUL (0xc0000000)
-
-
-
-/* Composition Prototypes. MMIO Access */
-Bool
-mgaPrepareBlend(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture,
- PixmapPtr pSrc, PixmapPtr pDst);
-
-void
-mgaBlend(int srcX, int srcY, int dstX, int dstY, int width, int height);
-
-void
-mgaDoneBlend(void);
-
-Bool
-mgaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
- PicturePtr pDstPicture, PixmapPtr pSrc,
- PixmapPtr pMask, PixmapPtr pDst);
-
-void
-mgaComposite(int srcX, int srcY, int maskX, int maskY,
- int dstX, int dstY, int w, int h);
-
-void
-mgaDoneComposite(void);
-
-#endif
diff --git a/hw/kdrive/mga/g400_composite.c b/hw/kdrive/mga/g400_composite.c
deleted file mode 100644
index 11e550487..000000000
--- a/hw/kdrive/mga/g400_composite.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2004 Damien Ciabrini
- *
- * 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 Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $Header$ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mga.h"
-#include "g400_common.h"
-
-
-static PixmapPtr currentSrc;
-static PixmapPtr currentMask;
-
-static CARD32 mgaBlendOP[14] = {
- /* Clear */
- MGA_SRC_ZERO | MGA_DST_ZERO,
- /* Src */
- MGA_SRC_ONE | MGA_DST_ZERO,
- /* Dst */
- MGA_SRC_ZERO | MGA_DST_ONE,
- /* Over */
- MGA_SRC_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA,
- /* OverReverse */
- MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE,
- /* In */
- MGA_SRC_DST_ALPHA | MGA_DST_ZERO,
- /* InReverse */
- MGA_SRC_ZERO | MGA_DST_SRC_ALPHA,
- /* Out */
- MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ZERO,
- /* OutReverse */
- MGA_SRC_ZERO | MGA_DST_ONE_MINUS_SRC_ALPHA,
- /* Atop */
- MGA_SRC_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA,
- /* AtopReverse */
- MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_SRC_ALPHA,
- /* Xor */
- MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA,
- /* Add */
- MGA_SRC_ONE | MGA_DST_ONE,
- /* Saturate */
- MGA_SRC_SRC_ALPHA_SATURATE | MGA_DST_ONE
-};
-
-
-static int MGA_LOG2( int val )
-{
- int ret = 0;
-
- while (val >> ret)
- ret++;
-
- return ((1 << (ret-1)) == val) ? (ret-1) : ret;
-}
-
-
-Bool
-mgaPrepareBlend (int op,
- PicturePtr pSrcPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pDst)
-{
- return mgaPrepareComposite (op, pSrcPicture, NULL, pDstPicture,
- pSrc, NULL, pDst);
-}
-
-void
-mgaBlend (int srcX,
- int srcY,
- int dstX,
- int dstY,
- int width,
- int height)
-{
- mgaComposite (srcX, srcY, 0, 0, dstX, dstY, width, height);
-}
-
-void
-mgaDoneBlend (void)
-{
- mgaDoneComposite ();
-}
-
-
-
-static Bool
-PrepareSourceTexture (int tmu,
- PicturePtr pSrcPicture,
- PixmapPtr pSrc)
-{
- KdScreenPriv (pSrc->drawable.pScreen);
- int mem_base=(int)pScreenPriv->screen->memory_base;
- int pitch = pSrc->devKind / (pSrc->drawable.bitsPerPixel >> 3);
-
- int w = pSrc->drawable.width;
- int h = pSrc->drawable.height;
- int w_log2 = MGA_LOG2(w);
- int h_log2 = MGA_LOG2(h);
-
- int texctl=MGA_PITCHEXT | ((pitch&0x7ff)<<9) |
- MGA_TAKEY | MGA_CLAMPUV | MGA_NOPERSPECTIVE;
- int texctl2=MGA_G400_TC2_MAGIC;
-
- if ((w > 2047) || (h > 2047))
- MGA_FALLBACK(("Picture too large for composition (%dx%d)\n", w, h));
-
- switch (pSrcPicture->format) {
- case PICT_a8r8g8b8:
- case PICT_x8r8g8b8:
- case PICT_a8b8g8r8:
- case PICT_x8b8g8r8:
- texctl |= MGA_TW32;
- break;
- case PICT_r5g6b5:
- case PICT_b5g6r5:
- texctl |= MGA_TW16;
- break;
- case PICT_a8:
- texctl |= MGA_TW8A;
- break;
- default:
- MGA_FALLBACK(("unsupported Picture format for composition (%x)\n",
- pSrcPicture->format));
- }
-
- if (tmu == 1) texctl2 |= MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1;
-
- mgaWaitAvail (6);
- MGA_OUT32 (mmio, MGA_REG_TEXCTL2, texctl2);
- MGA_OUT32 (mmio, MGA_REG_TEXCTL, texctl);
- /* Source (texture) address + pitch */
- MGA_OUT32 (mmio, MGA_REG_TEXORG, ((int)pSrc->devPrivate.ptr - mem_base));
- MGA_OUT32 (mmio, MGA_REG_TEXWIDTH, (w-1)<<18 | ((8-w_log2)&63)<<9 | w_log2);
- MGA_OUT32 (mmio, MGA_REG_TEXHEIGHT, (h-1)<<18 | ((8-h_log2)&63)<<9 | h_log2);
- /* Disable filtering since we aren't doing stretch blit */
- MGA_OUT32 (mmio, MGA_REG_TEXFILTER, (0x10<<21) | MGA_MAG_NRST | MGA_MIN_NRST);
-
- if (tmu == 1) {
- mgaWaitAvail (1);
- MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX);
- }
-
- return TRUE;
-}
-
-Bool
-mgaPrepareComposite (int op,
- PicturePtr pSrcPicture,
- PicturePtr pMaskPicture,
- PicturePtr pDstPicture,
- PixmapPtr pSrc,
- PixmapPtr pMask,
- PixmapPtr pDst)
-{
- KdScreenPriv (pSrc->drawable.pScreen);
- int mem_base=(int)pScreenPriv->screen->memory_base;
- int cmd;
-
- /* sometimes mgaPrepareComposite is given the same pointer for Src
- * and Mask. PSrcPicture is an unsupported format (x8b8g8r8) whereas
- * pMaskPicture is supported (a8r8g8b8). We Choose to render a
- * simple blend and using pMaskPicture as the Source.
- */
- if (pMask == pSrc) {
- pMask=NULL;
- pMaskPicture=NULL;
- }
-
- mgaWaitIdle();
- /* Init MGA (clipping) */
- mgaSetup (pSrc->drawable.pScreen, pDst->drawable.bitsPerPixel, 5);
- MGA_OUT32 (mmio, MGA_REG_TMR1, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR2, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR3, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR4, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR5, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR6, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR7, 0);
- MGA_OUT32 (mmio, MGA_REG_TMR8, 0x10000);
-
- /* Destination flags */
- mgaWaitAvail (2);
- MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDst->devPrivate.ptr - mem_base));
- MGA_OUT32 (mmio, MGA_REG_PITCH,
- pDst->devKind / (pDst->drawable.bitsPerPixel >> 3));
-
- /* Source(s) flags */
- if (!PrepareSourceTexture (0, pSrcPicture, pSrc)) return FALSE;
- if (pMask != NULL)
- if (!PrepareSourceTexture (1, pMaskPicture, pMask)) return FALSE;
-
- /* MultiTexture modulation */
- mgaWaitAvail (2);
- MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE0, MGA_TDS_COLOR_SEL_ARG1);
- if (pMask != NULL) {
- if (PICT_FORMAT_A (pSrcPicture->format) == 0) {
- MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE1,
- MGA_TDS_COLOR_ARG2_PREVSTAGE | MGA_TDS_COLOR_SEL_ARG2 |
- MGA_TDS_ALPHA_SEL_ARG1);
- } else {
- MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE1,
- MGA_TDS_COLOR_ARG2_PREVSTAGE | MGA_TDS_COLOR_SEL_ARG2 |
- MGA_TDS_ALPHA_ARG2_PREVSTAGE | MGA_TDS_ALPHA_SEL_MUL);
- }
- } else {
- MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE1, 0);
- }
-
- cmd = MGA_OPCOD_TEXTURE_TRAP | MGA_ATYPE_RSTR | 0x000c0000 |
- MGA_DWGCTL_SHIFTZERO | MGA_DWGCTL_SGNZERO | MGA_DWGCTL_ARZERO |
- MGA_ATYPE_I;
-
- mgaWaitAvail (2);
- MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
- MGA_OUT32 (mmio, MGA_REG_ALPHACTRL, MGA_ALPHACHANNEL | mgaBlendOP[op]);
-
- currentSrc=pSrc;
- currentMask=pMask;
-
- return TRUE;
-}
-
-void
-mgaComposite (int srcX,
- int srcY,
- int maskX,
- int maskY,
- int dstX,
- int dstY,
- int width,
- int height)
-{
- int src_w2 = MGA_LOG2 (currentSrc->drawable.width);
- int src_h2 = MGA_LOG2 (currentSrc->drawable.height);
-
- /* Source positions can be outside source textures' boundaries.
- * We clamp the values here to avoid rendering glitches.
- */
- srcX=srcX % currentSrc->drawable.width;
- srcY=srcY % currentSrc->drawable.height;
- maskX=maskX % currentMask->drawable.width;
- maskY=maskY % currentMask->drawable.height;
-
- mgaWaitAvail (4);
- /* Start position in the texture */
- MGA_OUT32 (mmio, MGA_REG_TMR6, srcX<<(20-src_w2));
- MGA_OUT32 (mmio, MGA_REG_TMR7, srcY<<(20-src_h2));
- /* Increments (1 since we aren't doing stretch blit) */
- MGA_OUT32 (mmio, MGA_REG_TMR0, 1<<(20-src_w2));
- MGA_OUT32 (mmio, MGA_REG_TMR3, 1<<(20-src_h2));
-
- if (currentMask != NULL) {
- int mask_w2 = MGA_LOG2 (currentMask->drawable.width);
- int mask_h2 = MGA_LOG2 (currentMask->drawable.height);
-
- mgaWaitAvail (6);
- MGA_OUT32 (mmio, MGA_REG_TEXCTL2,
- MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1);
-
- MGA_OUT32 (mmio, MGA_REG_TMR6, maskX<<(20-mask_w2));
- MGA_OUT32 (mmio, MGA_REG_TMR7, maskY<<(20-mask_h2));
- MGA_OUT32 (mmio, MGA_REG_TMR0, 1<<(20-mask_w2));
- MGA_OUT32 (mmio, MGA_REG_TMR3, 1<<(20-mask_h2));
-
- MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX);
- }
-
- /* Destination Bounding Box
- * (Boundary Right | Boundary Left, Y dest | Height)
- */
- mgaWaitAvail (2);
- MGA_OUT32 (mmio, MGA_REG_FXBNDRY,
- ((dstX + width) << 16) | (dstX & 0xffff));
- MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC,
- (dstY << 16) | (height & 0xffff));
-}
-
-void
-mgaDoneComposite (void)
-{
-
-}
diff --git a/hw/kdrive/mga/mga.c b/hw/kdrive/mga/mga.c
deleted file mode 100644
index 561e80389..000000000
--- a/hw/kdrive/mga/mga.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mga.h"
-
-static Bool
-mgaCardInit (KdCardInfo *card)
-{
- MgaCardInfo *mgac;
-
- mgac = (MgaCardInfo *) xalloc (sizeof (MgaCardInfo));
- if (!mgac)
- return FALSE;
-
- mgaMapReg (card, mgac);
-
- if (!vesaInitialize (card, &mgac->vesa))
- {
- xfree (mgac);
- return FALSE;
- }
-
- mgac->fifo_size = 0;
-
- card->driver = mgac;
-
- return TRUE;
-}
-
-static Bool
-mgaScreenInit (KdScreenInfo *screen)
-{
- MgaScreenInfo *mgas;
-
- mgas = (MgaScreenInfo *) xalloc (sizeof (MgaScreenInfo));
- if (!mgas)
- return FALSE;
- memset (mgas, '\0', sizeof (MgaScreenInfo));
- if (!vesaScreenInitialize (screen, &mgas->vesa))
- {
- xfree (mgas);
- return FALSE;
- }
-#if 0
- /* if (!mgac->reg)
- screen->dumb = TRUE; */
-
- if (mgas->vesa.mapping != VESA_LINEAR)
- screen->dumb = TRUE;
-
- fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping);
-#endif
- screen->driver = mgas;
- return TRUE;
-}
-
-static Bool
-mgaInitScreen (ScreenPtr pScreen)
-{
- return vesaInitScreen (pScreen);
-}
-
-static Bool
-mgaFinishInitScreen (ScreenPtr pScreen)
-{
- Bool ret;
-
- ret = vesaFinishInitScreen (pScreen);
-
- return ret;
-}
-
-static Bool
-mgaCreateResources (ScreenPtr pScreen)
-{
- return vesaCreateResources (pScreen);
-}
-
-static void
-mgaPreserve (KdCardInfo *card)
-{
- vesaPreserve (card);
-}
-
-Bool
-mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac)
-{
- mgac->reg_base = (CARD8 *) KdMapDevice (MGA_REG_BASE (card),
- MGA_REG_SIZE (card));
-
- if (!mgac->reg_base)
- {
- return FALSE;
- }
-
- KdSetMappedMode (MGA_REG_BASE (card),
- MGA_REG_SIZE (card),
- KD_MAPPED_MODE_REGISTERS);
-
- return TRUE;
-}
-
-void
-mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac)
-{
- if (mgac->reg_base)
- {
- KdResetMappedMode (MGA_REG_BASE (card),
- MGA_REG_SIZE (card),
- KD_MAPPED_MODE_REGISTERS);
- KdUnmapDevice ((void *) mgac->reg_base, MGA_REG_SIZE (card));
- mgac->reg_base = 0;
- /* mgac->reg = 0; */
- }
-}
-
-void
-mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac)
-{
- if (!mgac->reg_base)
- mgaMapReg (card, mgac);
-}
-
-void
-mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac)
-{
- mgaUnmapReg (card, mgac);
-}
-
-static Bool
-mgaDPMS (ScreenPtr pScreen, int mode)
-{
- /* XXX */
- return TRUE;
-}
-
-static Bool
-mgaEnable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- MgaCardInfo *mgac = pScreenPriv->card->driver;
-
- if (!vesaEnable (pScreen))
- return FALSE;
-
- mgaSetMMIO (pScreenPriv->card, mgac);
- mgaDPMS (pScreen, KD_DPMS_NORMAL);
-
- return TRUE;
-}
-
-static void
-mgaDisable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- MgaCardInfo *mgac = pScreenPriv->card->driver;
-
- mgaResetMMIO (pScreenPriv->card, mgac);
-
- vesaDisable (pScreen);
-}
-
-static void
-mgaRestore (KdCardInfo *card)
-{
- MgaCardInfo *mgac = card->driver;
-
- mgaResetMMIO (card, mgac);
- vesaRestore (card);
-}
-
-static void
-mgaScreenFini (KdScreenInfo *screen)
-{
- MgaScreenInfo *mgas = (MgaScreenInfo *) screen->driver;
-
- vesaScreenFini (screen);
- xfree (mgas);
- screen->driver = 0;
-}
-
-static void
-mgaCardFini (KdCardInfo *card)
-{
- MgaCardInfo *mgac = (MgaCardInfo *)card->driver;
-
- mgaUnmapReg (card, mgac);
- vesaCardFini (card);
-}
-
-KdCardFuncs mgaFuncs = {
- mgaCardInit, /* cardinit */
- mgaScreenInit, /* scrinit */
- mgaInitScreen, /* initScreen */
- mgaFinishInitScreen, /* finishInitScreen */
- mgaCreateResources, /* createRes */
- mgaPreserve, /* preserve */
- mgaEnable, /* enable */
- mgaDPMS, /* dpms */
- mgaDisable, /* disable */
- mgaRestore, /* restore */
- mgaScreenFini, /* scrfini */
- mgaCardFini, /* cardfini */
-
- 0, /* initCursor */
- 0, /* enableCursor */
- 0, /* disableCursor */
- 0, /* finiCursor */
- 0, /* recolorCursor */
-
- mgaDrawInit, /* initAccel */
- mgaDrawEnable, /* enableAccel */
- mgaDrawSync, /* syncAccel */
- mgaDrawDisable, /* disableAccel */
- mgaDrawFini, /* finiAccel */
-
- vesaGetColors, /* getColors */
- vesaPutColors, /* putColors */
-};
-
diff --git a/hw/kdrive/mga/mga.h b/hw/kdrive/mga/mga.h
deleted file mode 100644
index 3b3462063..000000000
--- a/hw/kdrive/mga/mga.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003-2004 Anders Carlsson
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $Header$ */
-
-#ifndef _MGA_H_
-#define _MGA_H_
-#include <vesa.h>
-#include <klinux.h>
-
-#define MGA_REG_BASE(c) ((c)->attr.address[1])
-#define MGA_REG_SIZE(c) (0x4000)
-
-#define MGA_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
-#define MGA_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
-
-#define MGA_REG_EXEC (0x0100)
-#define MGA_REG_DWGCTL (0x1c00)
-#define MGA_REG_PLNWT (0x1c1c)
-#define MGA_REG_FCOL (0x1c24)
-#define MGA_REG_MACCESS (0x1c04)
-#define MGA_REG_SGN (0x1c58)
-#define MGA_REG_AR0 (0x1c60)
-#define MGA_REG_AR1 (0x1c64)
-#define MGA_REG_AR2 (0x1c68)
-#define MGA_REG_AR3 (0x1c6C)
-#define MGA_REG_AR4 (0x1c70)
-#define MGA_REG_AR5 (0x1c74)
-#define MGA_REG_AR6 (0x1c78)
-
-#define MGA_REG_CXBNDRY (0x1c80)
-#define MGA_REG_FXBNDRY (0x1c84)
-#define MGA_REG_YDSTLEN (0x1c88)
-#define MGA_REG_PITCH (0x1c8c)
-#define MGA_REG_YTOP (0x1c98)
-#define MGA_REG_YBOT (0x1c9c)
-#define MGA_REG_FIFOSTATUS (0x1e10)
-#define MGA_REG_STATUS (0x1e14)
-#define MGA_REG_SRCORG (0x2cb4)
-#define MGA_REG_DSTORG (0x2cb8)
-
-#define MGA_G4XX_DEVICE_ID (0x0525)
-
-#define MGA_PW8 (0)
-#define MGA_PW16 (1)
-#define MGA_PW24 (2)
-#define MGA_PW32 (3)
-
-/* Drawing opcodes */
-#define MGA_OPCOD_TRAP (4)
-#define MGA_OPCOD_TEXTURE_TRAP (6)
-#define MGA_OPCOD_BITBLT (8)
-
-#define MGA_DWGCTL_SOLID (1 << 11)
-#define MGA_DWGCTL_ARZERO (1 << 12)
-#define MGA_DWGCTL_SGNZERO (1 << 13)
-#define MGA_DWGCTL_SHIFTZERO (1 << 14)
-
-#define MGA_DWGCTL_BFCOL (2 << 25)
-
-#define MGA_ATYPE_RPL (0 << 4)
-#define MGA_ATYPE_RSTR (1 << 4)
-#define MGA_ATYPE_ZI (3 << 4)
-#define MGA_ATYPE_BLK (4 << 4)
-#define MGA_ATYPE_I (7 << 4)
-
-typedef volatile CARD8 VOL8;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD32 VOL32;
-
-typedef struct _mgaCardInfo {
- VesaCardPrivRec vesa;
- CARD8 *reg_base;
- int fifo_size;
-} MgaCardInfo;
-
-#define getMgaCardInfo(kd) ((MgaCardInfo *) ((kd)->card->driver))
-#define mgaCardInfo(kd) MgaCardInfo *mgac = getMgaCardInfo(kd)
-
-typedef struct _mgaScreenInfo {
- VesaScreenPrivRec vesa;
-
- int pitch;
- int pw;
-
-} MgaScreenInfo;
-
-#define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver))
-#define mgaScreenInfo(kd) MgaScreenInfo *mgas = getMgaScreenInfo(kd)
-
-
-VOL8 *mmio;
-
-
-Bool
-mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac);
-
-void
-mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac);
-
-void
-mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
-
-void
-mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
-
-Bool
-mgaDrawSetup (ScreenPtr pScreen);
-
-Bool
-mgaDrawInit (ScreenPtr pScreen);
-
-void
-mgaDrawEnable (ScreenPtr pScreen);
-
-void
-mgaDrawSync (ScreenPtr pScreen);
-
-void
-mgaDrawDisable (ScreenPtr pScreen);
-
-void
-mgaDrawFini (ScreenPtr pScreen);
-
-extern KdCardFuncs mgaFuncs;
-
-
-void
-mgaWaitAvail (int n);
-
-void
-mgaWaitIdle (void);
-
-Bool
-mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait);
-
-
-#if 0
-#define MGA_FALLBACK(x) \
-do { \
- ErrorF x; \
- return FALSE; \
-} while (0);
-#else
-#define MGA_FALLBACK(x) return FALSE;
-#endif
-
-#endif /* _MGA_H_ */
diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c
deleted file mode 100644
index 269ce6100..000000000
--- a/hw/kdrive/mga/mgadraw.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003-2004 Anders Carlsson
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mga.h"
-#include "g400_common.h"
-#include <unistd.h>
-
-CARD32 mgaRop[16] = {
- /* GXclear */ MGA_ATYPE_RPL | 0x00000000, /* 0 */
- /* GXand */ MGA_ATYPE_RSTR | 0x00080000, /* src AND dst */
- /* GXandReverse */ MGA_ATYPE_RSTR | 0x00040000, /* src AND NOT dst */
- /* GXcopy */ MGA_ATYPE_RSTR | 0x000c0000, /* src */
- /* GXandInverted */ MGA_ATYPE_RSTR | 0x00020000, /* NOT src AND dst */
- /* GXnoop */ MGA_ATYPE_RSTR | 0x000a0000, /* dst */
- /* GXxor */ MGA_ATYPE_RSTR | 0x00060000, /* src XOR dst */
- /* GXor */ MGA_ATYPE_RSTR | 0x000e0000, /* src OR dst */
- /* GXnor */ MGA_ATYPE_RSTR | 0x00010000, /* NOT src AND NOT dst */
- /* GXequiv */ MGA_ATYPE_RSTR | 0x00090000, /* NOT src XOR dst */
- /* GXinvert */ MGA_ATYPE_RSTR | 0x00050000, /* NOT dst */
- /* GXorReverse */ MGA_ATYPE_RSTR | 0x000d0000, /* src OR NOT dst */
- /* GXcopyInverted */ MGA_ATYPE_RPL | 0x00030000, /* NOT src */
- /* GXorInverted */ MGA_ATYPE_RSTR | 0x000b0000, /* NOT src OR dst */
- /* GXnand */ MGA_ATYPE_RSTR | 0x00070000, /* NOT src OR NOT dst */
- /* GXset */ MGA_ATYPE_RPL | 0x000f0000 /* 1 */
-};
-
-VOL8 *mmio;
-int fifo_size;
-int pitch, src_pitch;
-int dir;
-
-void
-mgaWaitAvail (int n)
-{
- if (fifo_size < n) {
- while ((fifo_size = MGA_IN32 (mmio, MGA_REG_FIFOSTATUS) & 0xff) < n)
- ;
- }
-
- fifo_size -= n;
-}
-
-void
-mgaWaitIdle (void)
-{
- while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000);
-}
-
-Bool
-mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait)
-{
- KdScreenPriv (pScreen);
- mgaScreenInfo (pScreenPriv);
- mgaCardInfo (pScreenPriv);
-
- fifo_size = 0;
- mmio = mgac->reg_base;
- pitch = mgas->pitch;
-
- if (!mmio)
- return FALSE;
-
- mgaWaitAvail (wait + 4);
- /* Set the format of the destination pixmap */
- switch (dest_bpp) {
- case 8:
- MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW8);
- break;
- case 16:
- MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW16);
- break;
- case 24:
- case 32:
- MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW24);
- break;
- }
- MGA_OUT32 (mmio, MGA_REG_CXBNDRY, 0xffff0000);
- MGA_OUT32 (mmio, MGA_REG_YTOP, 0x00000000);
- MGA_OUT32 (mmio, MGA_REG_YBOT, 0x007fffff);
-
- return TRUE;
-}
-
-static Bool
-mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
-{
-
- KdScreenPriv(pPixmap->drawable.pScreen);
- int cmd;
- int dst_org;
- /* We must pad pm and fg depending on the format of the
- * destination pixmap
- */
- switch (pPixmap->drawable.bitsPerPixel) {
- case 16:
- fg |= fg << 16;
- pm |= pm << 16;
- break;
- case 8:
- fg |= (fg << 8) | (fg << 16) | (fg << 24);
- pm |= (pm << 8) | (pm << 16) | (pm << 24);
- break;
- }
-
- cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO |
- MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
-
- dst_org = (int)pPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base;
-
- mgaSetup (pPixmap->drawable.pScreen, pPixmap->drawable.bitsPerPixel, 5);
- MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org);
- MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3));
- MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
- MGA_OUT32 (mmio, MGA_REG_FCOL, fg);
- MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
-
- return TRUE;
-}
-
-static void
-mgaSolid (int x1, int y1, int x2, int y2)
-{
- mgaWaitAvail (2);
- MGA_OUT32 (mmio, MGA_REG_FXBNDRY, (x2 << 16) | (x1 & 0xffff));
- MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (y1 << 16) | (y2 - y1));
-}
-
-static void
-mgaDoneSolid (void)
-{
- mgaWaitIdle();
-}
-
-#define BLIT_LEFT 1
-#define BLIT_UP 4
-
-static Bool
-mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap,
- int dx, int dy, int alu, Pixel pm)
-{
- KdScreenPriv(pSrcPixmap->drawable.pScreen);
-
- int cmd;
-
- cmd = MGA_OPCOD_BITBLT | MGA_DWGCTL_BFCOL | MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
-
- dir = 0;
-
- if (dy < 0)
- dir |= BLIT_UP;
- if (dx < 0)
- dir |= BLIT_LEFT;
-
- mgaSetup (pSrcPixmap->drawable.pScreen,
- pDstPixmap->drawable.bitsPerPixel, 7);
-
- MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pSrcPixmap->devPrivate.ptr -
- (int)pScreenPriv->screen->memory_base));
- MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr -
- (int)pScreenPriv->screen->memory_base));
- MGA_OUT32 (mmio, MGA_REG_PITCH, (pDstPixmap->devKind /
- (pDstPixmap->drawable.bitsPerPixel >> 3)));
- src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3);
-
- MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
- MGA_OUT32 (mmio, MGA_REG_SGN, dir);
- MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
- MGA_OUT32 (mmio, MGA_REG_AR5, src_pitch * (dy < 0 ? -1 : 1) );
-
- return TRUE;
-}
-
-static void
-mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h)
-{
- int start, end;
-
- if (dir & BLIT_UP)
- {
- srcY += h - 1;
- dstY += h - 1;
- }
-
- w--;
- start = end = srcY * src_pitch + srcX;
-
- if (dir & BLIT_LEFT)
- start += w;
- else
- end += w;
-
- mgaWaitAvail (4);
- MGA_OUT32 (mmio, MGA_REG_AR0, end);
- MGA_OUT32 (mmio, MGA_REG_AR3, start);
- MGA_OUT32 (mmio, MGA_REG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff));
- MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (dstY << 16) | h);
-}
-
-static void
-mgaDoneCopy (void)
-{
- mgaWaitIdle();
-}
-
-static Bool
-mgaUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) {
- /* fprintf(stderr,"Upload to Screen %p [%d]\n",src,src_pitch); */
- return TRUE;
-}
-
-KaaScreenInfoRec mgaKaa = {
- mgaPrepareSolid,
- mgaSolid,
- mgaDoneSolid,
-
- mgaPrepareCopy,
- mgaCopy,
- mgaDoneCopy,
-
- 192, /* 192 Offscreen byte alignment */
- 128, /* Pitch alignment is in sets of 32 pixels, and we need to
- cover 32bpp, so 128 bytes */
- KAA_OFFSCREEN_PIXMAPS /* Flags */
-};
-
-Bool
-mgaDrawInit (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
-
- if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) {
- mgaKaa.PrepareBlend=mgaPrepareBlend;
- mgaKaa.Blend=mgaBlend;
- mgaKaa.DoneBlend=mgaDoneBlend;
- mgaKaa.PrepareComposite=mgaPrepareComposite;
- mgaKaa.Composite=mgaComposite;
- mgaKaa.DoneComposite=mgaDoneComposite;
- }
- /*mgaKaa.UploadToScreen=mgaUploadToScreen;*/
-
- if (!kaaDrawInit (pScreen, &mgaKaa))
- return FALSE;
-
- return TRUE;
-}
-
-void
-mgaDrawEnable (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- mgaScreenInfo (pScreenPriv);
-
- mgas->pitch = pScreenPriv->screen->width;
-
- switch (pScreenPriv->screen->fb[0].depth) {
- case 8:
- mgas->pw = MGA_PW8;
- break;
- case 16:
- mgas->pw = MGA_PW16;
- break;
- case 24:
- case 32:
- mgas->pw = MGA_PW24;
- break;
- default:
- FatalError ("unsupported pixel format");
- }
-
- KdMarkSync (pScreen);
-}
-
-void
-mgaDrawDisable (ScreenPtr pScreen)
-{
-}
-
-void
-mgaDrawFini (ScreenPtr pScreen)
-{
-}
-
-void
-mgaDrawSync (ScreenPtr pScreen)
-{
- KdScreenPriv (pScreen);
- mgaCardInfo (pScreenPriv);
-
- mmio = mgac->reg_base;
-
- mgaWaitIdle ();
-}
diff --git a/hw/kdrive/mga/mgastub.c b/hw/kdrive/mga/mgastub.c
deleted file mode 100644
index 56b9d7149..000000000
--- a/hw/kdrive/mga/mgastub.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * $Id$
- *
- * Copyright © 2003 Anders Carlsson
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Anders Carlsson not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Anders Carlsson makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $Header$ */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "mga.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
-
- if (LinuxFindPci (0x102b, 0x0525, 0, &attr))
- KdCardInfoAdd (&mgaFuncs, &attr, 0);
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- KdInitOutput (pScreenInfo, argc, argv);
-}
-
-void
-InitInput (int argc, char **argv)
-{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-}
-
-void
-ddxUseMsg (void)
-{
- KdUseMsg();
- vesaUseMsg();
-}
-
-int
-ddxProcessArgument (int argc, char **argv, int i)
-{
- int ret;
-
- if (!(ret = vesaProcessArgument (argc, argv, i)))
- ret = KdProcessArgument(argc, argv, i);
- return ret;
-}