diff options
author | Kevin E Martin <kem@kem.org> | 2004-09-17 15:38:19 +0000 |
---|---|---|
committer | Kevin E Martin <kem@kem.org> | 2004-09-17 15:38:19 +0000 |
commit | 0e3171a83a79c1495b842daf07b3eeee4c9fd612 (patch) | |
tree | 165558ee6a9a2735616787fbc4a07f77a9af81f0 /hw/kdrive/pcmcia | |
parent | 516f452e78170bc643117a71bd2246a83b071316 (diff) |
Update the XORG_DATE for the release.XORG-6_8_1
Update cygwin release version.
Update documentation for release.
Diffstat (limited to 'hw/kdrive/pcmcia')
-rw-r--r-- | hw/kdrive/pcmcia/Imakefile | 13 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/modes.h | 66 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/pcmcia.c | 1200 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/pcmcia.h | 268 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/pcmciacurs.c | 452 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/pcmciarotate.c | 335 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/pcmciashadow.c | 200 | ||||
-rw-r--r-- | hw/kdrive/pcmcia/pcmciastub.c | 63 |
8 files changed, 0 insertions, 2597 deletions
diff --git a/hw/kdrive/pcmcia/Imakefile b/hw/kdrive/pcmcia/Imakefile deleted file mode 100644 index 29da5c418..000000000 --- a/hw/kdrive/pcmcia/Imakefile +++ /dev/null @@ -1,13 +0,0 @@ -XCOMM $RCSId: $ -KDRIVE=.. -#include "../Kdrive.tmpl" - -SRCS = pcmcia.c pcmciacurs.c pcmciastub.c pcmciashadow.c pcmciarotate.c - -OBJS = pcmcia.o pcmciacurs.o pcmciastub.o pcmciashadow.o pcmciarotate.o - -INCLUDES = -I. $(KDINCS) -I$(KDRIVE)/fbdev - -NormalLibraryObjectRule() -NormalLibraryTarget(pcmcia,$(OBJS)) -DependTarget() diff --git a/hw/kdrive/pcmcia/modes.h b/hw/kdrive/pcmcia/modes.h deleted file mode 100644 index 9087e9e74..000000000 --- a/hw/kdrive/pcmcia/modes.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ -/* $RCSId: $ */ - -#define V_NHSYNC 0x01 -#define V_NVSYNC 0x02 -#define V_PHSYNC 0x04 -#define V_PVSYNC 0x08 -#define V_INTERLACE 0x10 - -pcmciaDisplayModeRec pcmciaDefaultModes [] = { -/* 640x400 @ 70Hz (VGA) hsync: 37.9kHz */ - {640, 400, 70 ,31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC}, -/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */ - {640, 480, 60 ,25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC}, -/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */ - {640, 480, 72 ,31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC}, -/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */ - {640, 480, 75 ,31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC}, -/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */ - {640, 480, 85 ,36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC}, -/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */ - {800, 600, 56 ,36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */ - {800, 600, 60 ,40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */ - {800, 600, 72 ,50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */ - {800, 600, 75 ,49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */ - {800, 600, 85 ,56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC}, -/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */ - {1024, 768, 43 ,44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE}, -/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */ - {1024, 768, 60 ,65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC}, -/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */ - {1024, 768, 70 ,75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC}, -/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */ - {1024, 768, 75 ,78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC}, -/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */ - {1024, 768, 85 ,94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC}, -/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */ - {1152, 864, 75 ,108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -}; diff --git a/hw/kdrive/pcmcia/pcmcia.c b/hw/kdrive/pcmcia/pcmcia.c deleted file mode 100644 index 087b0a604..000000000 --- a/hw/kdrive/pcmcia/pcmcia.c +++ /dev/null @@ -1,1200 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * A driver for the following PCMCIA cards... - * Hewlett Packards HP VGA Out (Model F1252A) - * Colorgraphics Voyager VGA - * - * Tested running under a Compaq IPAQ Pocket PC running Linux - */ -/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmcia.c,v 1.6 2002/10/14 18:01:41 keithp Exp $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "pcmcia.h" -#define extern -#include <asm/io.h> -#undef extern - -#define CLOCK 14318 /* KHz */ -#define CLK_N(a,b) (a & 0xff) -#define CLK_M(a,b) ((b) & 0x3f) -#define CLK_K(a,b) (((b) >> 6) & 3) -#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b))) - -extern void -tridentUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); -extern void -cirrusUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); - -static Bool -tridentSetCLK(int clock, CARD8 *a, CARD8 *b); - -static Bool -CirrusFindClock(int freq, int *num_out, int *den_out); - -Bool -pcmciaCardInit (KdCardInfo *card) -{ - pcmciaCardInfo *pcmciac; - CARD8 r9; - - pcmciac = (pcmciaCardInfo *) xalloc (sizeof (pcmciaCardInfo)); - if (!pcmciac) - return FALSE; - - pcmciac->cop_base = (CARD8 *) KdMapDevice (PCMCIA_COP_BASE(card), - PCMCIA_COP_SIZE(card)); - - r9 = pcmciaReadIndex (pcmciac, 0x3c4, 0x09); - /* - * Crude detection.... - * The trident chip has a read only register at 0x09, which returns 0x4. - * If it's not that, we assume the cirrus chip. - * BREAKAGE.! If we have an anonymous PCMCIA card inserted, we could - * potentially smash something here. FIXME ! - */ - if (r9 == 0x04) { - ErrorF("PCMCIA: Found HP VGA card\n"); - pcmciac->HP = TRUE; /* Select HP VGA Out Card */ - } else { - ErrorF("PCMCIA: Found Voyager VGA card\n"); - pcmciac->HP = FALSE; /* Select Voyager VGA Card */ - } - - if (pcmciac->HP) { - /* needed by the accelerator - later */ - pcmciac->cop = (Cop *) (pcmciac->cop_base + TRIDENT_COP_OFF(card)); - } - - /* - * Map frame buffer - */ - if (pcmciac->HP) - pcmciac->fb = KdMapDevice (0x2ce00000, 0x80000); - else - pcmciac->fb = KdMapDevice (0x2c0a0000, 0x10000); /*64K bank switched*/ - - if (!pcmciac->fb) - return FALSE; - - pcmciac->window = 0; - - card->driver = pcmciac; - - return TRUE; -} - -Bool -pcmciaModeSupported (KdScreenInfo *screen, - const KdMonitorTiming *t) -{ - KdCardInfo *card = screen->card; - pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver; - - if (pcmciac->HP) - { - CARD8 a, b; - if (!tridentSetCLK (t->clock, &a, &b)) - return FALSE; - } - else - { - int a, b; - if (!CirrusFindClock (t->clock, &a, &b)) - return FALSE; - } - - /* width must be a multiple of 16 */ - if (t->horizontal & 0xf) - return FALSE; - return TRUE; -} - -Bool -pcmciaModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver; - int screen_size; - int pixel_width; - int byte_width; - int fb; - - if (screen->fb[0].depth == 8) - screen->fb[0].bitsPerPixel = 8; - else if (screen->fb[0].depth == 15 || screen->fb[0].depth == 16) - screen->fb[0].bitsPerPixel = 16; - else - return FALSE; - - screen_size = 0; - screen->fb[0].pixelStride = screen->width; - screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3); - screen->fb[0].frameBuffer = pcmciac->fb; - screen_size = screen->fb[0].byteStride * screen->height; - - return screen_size <= pcmciac->memory; -} - -Bool -pcmciaScreenInit (KdScreenInfo *screen) -{ - pcmciaCardInfo *pcmciac = screen->card->driver; - pcmciaScreenInfo *pcmcias; - int screen_size, memory; - int i; - const KdMonitorTiming *t; - - pcmcias = (pcmciaScreenInfo *) xalloc (sizeof (pcmciaScreenInfo)); - if (!pcmcias) - return FALSE; - memset (pcmcias, '\0', sizeof (pcmciaScreenInfo)); - - /* if (!pcmciac->cop) */ - screen->dumb = TRUE; - - if (screen->fb[0].depth < 8) - screen->fb[0].depth = 8; - - /* default to 16bpp */ - if (!screen->fb[0].depth) - screen->fb[0].depth = 16; - - /* default to 60Hz refresh */ - if (!screen->width || !screen->height) - { - screen->width = 640; - screen->height = 400; - screen->rate = 60; - } - - pcmciac->memory = 512 * 1024; - if (pcmciac->HP && !screen->softCursor && screen->fb[0].depth == 8) - { - /* ack, bail on the HW cursor for everything -- no ARGB falback */ - pcmcias->cursor_base = 0; -#if 0 - /* Let's do hw cursor for the HP card, only in 8bit mode though */ - pcmcias->cursor_base = pcmcias->screen + pcmciac->memory - 4096; - pcmciac->memory -= 4096; -#endif - } - - pcmcias->screen = pcmciac->fb; - screen->driver = pcmcias; - - t = KdFindMode (screen, pcmciaModeSupported); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - pcmcias->randr = screen->randr; - - if (!KdTuneMode (screen, pcmciaModeUsable, pcmciaModeSupported)) - { - xfree (pcmcias); - return FALSE; - } - - switch (screen->fb[0].depth) { - case 4: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 8: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 15: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x03e0; - screen->fb[0].redMask = 0x7c00; - break; - case 16: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x07e0; - screen->fb[0].redMask = 0xf800; - break; - } - - return TRUE; -} - -void * -tridentWindowLinear (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - if (!pScreenPriv->enabled) - return 0; - - *size = pScreenPriv->screen->fb[0].byteStride; - return (CARD8 *) pcmciac->fb + row * pScreenPriv->screen->fb[0].byteStride + offset; -} - -void * -cirrusWindowWindowed (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - int bank, boffset; - - if (!pScreenPriv->enabled) - return 0; - - bank = (row * pScreenPriv->screen->fb[0].byteStride) / 0x1000; - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0B, 0x0c); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x09, bank); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0A, bank); - *size = pScreenPriv->screen->fb[0].byteStride; - return (CARD8 *) pcmciac->fb + (row * pScreenPriv->screen->fb[0].byteStride) - (bank * 0x1000) + offset; -} - -LayerPtr -pcmciaLayerCreate (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - ShadowUpdateProc update; - ShadowWindowProc window; - PixmapPtr pPixmap; - int kind; - - if (pcmciac->HP) { - window = tridentWindowLinear; - if (pcmcias->randr == RR_Rotate_0) - update = tridentUpdatePacked; - else - update = pcmciaUpdateRotatePacked; - } else { - window = cirrusWindowWindowed; - if (pcmcias->randr == RR_Rotate_0) - update = cirrusUpdatePacked; - else - update = pcmciaUpdateRotatePacked; - } - - if (!update) - abort (); - - kind = LAYER_SHADOW; - pPixmap = 0; - - return LayerCreate (pScreen, kind, screen->fb[0].depth, - pPixmap, update, window, pcmcias->randr, 0); -} - -void -pcmciaConfigureScreen (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - FbdevPriv *priv = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; - KdMouseMatrix m; - - KdComputeMouseMatrix (&m, pcmcias->randr, - screen->width, screen->height); - - if (m.matrix[0][0]) - { - pScreen->width = screen->width; - pScreen->height = screen->height; - pScreen->mmWidth = screen->width_mm; - pScreen->mmHeight = screen->height_mm; - } - else - { - pScreen->width = screen->height; - pScreen->height = screen->width; - pScreen->mmWidth = screen->height_mm; - pScreen->mmHeight = screen->width_mm; - } - KdSetMouseMatrix (&m); -} - -#ifdef RANDR - -Bool -pcmciaRandRSupported (ScreenPtr pScreen, - const KdMonitorTiming *t) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - KdScreenInfo *screen = pScreenPriv->screen; - int screen_size; - int byteStride; - - /* Make sure the clock is supported */ - if (!pcmciaModeSupported (screen, t)) - return FALSE; - /* Check for sufficient memory */ - byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3); - screen_size = byteStride * screen->height; - - return screen_size <= pcmciac->memory; -} - -Bool -pcmciaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - KdScreenPriv(pScreen); - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - - *rotations = (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270| - RR_Reflect_X|RR_Reflect_Y); - - return KdRandRGetInfo (pScreen, pcmcias->randr, pcmciaRandRSupported); -} - -int -pcmciaLayerAdd (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - if (!LayerWindowAdd (pScreen, pLayer, pWin)) - return WT_STOPWALKING; - - return WT_WALKCHILDREN; -} - -int -pcmciaLayerRemove (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - LayerWindowRemove (pScreen, pLayer, pWin); - - return WT_WALKCHILDREN; -} - -pcmciaRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - FbdevPriv *priv = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - Bool wasEnabled = pScreenPriv->enabled; - int newwidth, newheight; - LayerPtr pNewLayer; - int kind; - int oldrandr = pcmcias->randr; - PixmapPtr pPixmap; - const KdMonitorTiming *t; - - randr = KdAddRotation (screen->randr, randr); - - t = KdRandRGetTiming (pScreen, pcmciaRandRSupported, rate, pSize); - - if (wasEnabled) - KdDisableScreen (pScreen); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - pcmcias->randr = randr; - pcmciaConfigureScreen (pScreen); - - pNewLayer = pcmciaLayerCreate (pScreen); - - if (!pNewLayer) - { - pcmcias->randr = oldrandr; - pcmciaConfigureScreen (pScreen); - if (wasEnabled) - KdEnableScreen (pScreen); - return FALSE; - } - - if (WalkTree (pScreen, pcmciaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING) - { - WalkTree (pScreen, pcmciaLayerRemove, (pointer) pNewLayer); - LayerDestroy (pScreen, pNewLayer); - pcmcias->randr = oldrandr; - pcmciaConfigureScreen (pScreen); - if (wasEnabled) - KdEnableScreen (pScreen); - return FALSE; - } - WalkTree (pScreen, pcmciaLayerRemove, (pointer) pcmcias->pLayer); - LayerDestroy (pScreen, pcmcias->pLayer); - pcmcias->pLayer = pNewLayer; - if (wasEnabled) - KdEnableScreen (pScreen); - return TRUE; -} - -Bool -pcmciaRandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit (pScreen)) - return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = pcmciaRandRGetInfo; - pScrPriv->rrSetConfig = pcmciaRandRSetConfig; - return TRUE; -} -#endif - -Bool -pcmciaInitScreen (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - FbdevPriv *priv = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - - if (!LayerStartInit (pScreen)) - return FALSE; - if (!LayerFinishInit (pScreen)) - return FALSE; - - pcmciaConfigureScreen (pScreen); - - pcmcias->pLayer = pcmciaLayerCreate (pScreen); - if (!pcmcias->pLayer) - return FALSE; -#ifdef RANDR - if (!pcmciaRandRInit (pScreen)) - return FALSE; -#endif - return TRUE; -} - -CARD8 -pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index) -{ - CARD8 value; - - pcmciac->cop_base[port] = index; - value = pcmciac->cop_base[port+1]; - return value; -} - -void -pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value) -{ - pcmciac->cop_base[port] = index; - pcmciac->cop_base[port+1] = value; -} - -CARD8 -pcmciaReadReg (pcmciaCardInfo *pcmciac, CARD16 port) -{ - CARD8 value; - - value = pcmciac->cop_base[port]; - - return value; -} - -void -pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value) -{ - pcmciac->cop_base[port] = value; -} - - -void -pcmciaPause () -{ - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = 50 * 1000; - select (1, 0, 0, 0, &tv); -} - -void -pcmciaPreserve (KdCardInfo *card) -{ -} - -/* CLOCK_FACTOR is double the osc freq in kHz (osc = 14.31818 MHz) */ -#define CLOCK_FACTOR 28636 - -/* stability constraints for internal VCO -- MAX_VCO also determines the maximum Video pixel clock */ -#define MIN_VCO CLOCK_FACTOR -#define MAX_VCO 111000 - -/* clock in kHz is (numer * CLOCK_FACTOR / (denom & 0x3E)) >> (denom & 1) */ -#define VCOVAL(n, d) \ - ((((n) & 0x7F) * CLOCK_FACTOR / ((d) & 0x3E)) ) - -#define CLOCKVAL(n, d) \ - (VCOVAL(n, d) >> ((d) & 1)) - -static Bool -CirrusFindClock(int freq, int *num_out, int *den_out) -{ - int n; - int num = 0, den = 0; - int mindiff; - - /* - * If max_clock is greater than the MAX_VCO default, ignore - * MAX_VCO. On the other hand, if MAX_VCO is higher than max_clock, - * make use of the higher MAX_VCO value. - */ - - mindiff = freq; - for (n = 0x10; n < 0x7f; n++) { - int d; - for (d = 0x14; d < 0x3f; d++) { - int c, diff; - /* Avoid combinations that can be unstable. */ - if ((VCOVAL(n, d) < MIN_VCO) || (VCOVAL(n, d) > MAX_VCO)) - continue; - c = CLOCKVAL(n, d); - diff = abs(c - freq); - if (diff < mindiff) { - mindiff = diff; - num = n; - den = d; - } - } - } - if (n == 0x80) - return FALSE; - - *num_out = num; - *den_out = den; - - return TRUE; -} - - -static Bool -tridentSetCLK(int clock, CARD8 *a, CARD8 *b) -{ - int powerup[4] = { 1,2,4,8 }; - int clock_diff = 750; - int freq, ffreq; - int m, n, k; - int p, q, r, s; - int startn, endn; - int endm, endk; - - p = q = r = s = 0; - - startn = 0; - endn = 121; - endm = 31; - endk = 1; - - freq = clock; - - for (k=0;k<=endk;k++) - for (n=startn;n<=endn;n++) - for (m=1;m<=endm;m++) - { - ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) )); - if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) - { - clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; - p = n; q = m; r = k; s = ffreq; - } - } - -#if 0 - ErrorF ("ffreq %d clock %d\n", s, clock); -#endif - if (s == 0) - return FALSE; - - /* N is first 7bits, first M bit is 8th bit */ - *a = ((1 & q) << 7) | p; - /* first 4bits are rest of M, 1bit for K value */ - *b = (((q & 0xFE) >> 1) | (r << 4)); - return TRUE; -} - -Bool -pcmciaEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; - int i,j; - unsigned char Sequencer[6]; - unsigned char CRTC[31]; - unsigned char Graphics[9]; - unsigned char Attribute[21]; - unsigned char MiscOutReg; - const KdMonitorTiming *t; - int hactive, hblank, hfp, hbp; - int vactive, vblank, vfp, vbp; - - int h_active; - int h_total; - int h_display_end; - int h_sync_start; - int h_sync_end; - int h_skew = 0; - - int v_active; - int v_total; - int v_sync_start; - int v_sync_end; - int v_skew = 0; - - t = KdFindMode (screen, pcmciaModeSupported); - - hactive = t->horizontal; - hfp = t->hfp; - hbp = t->hbp; - hblank = t->hblank; - - h_active = hactive; - h_sync_start = hactive + hfp; - h_sync_end = hactive + hblank - hbp; - h_total = hactive + hblank; - - vactive = t->vertical; - vfp = t->vfp; - vbp = t->vbp; - vblank = t->vblank; - - v_active = vactive; - v_sync_start = vactive + vfp; - v_sync_end = vactive + vblank - vbp; - v_total = vactive + vblank; - - /* - * compute correct Hsync & Vsync polarity - */ - - MiscOutReg = 0x23; - if (t->hpol == KdSyncNegative) - MiscOutReg |= 0x40; - if (t->vpol == KdSyncNegative) - MiscOutReg |= 0x80; - - /* - * Time Sequencer - */ - if (pScreenPriv->screen->fb[0].depth == 4) - Sequencer[0] = 0x02; - else - Sequencer[0] = 0x00; - Sequencer[1] = 0x01; - Sequencer[2] = 0x0F; - Sequencer[3] = 0x00; /* Font select */ - if (pScreenPriv->screen->fb[0].depth < 8) - Sequencer[4] = 0x06; /* Misc */ - else - Sequencer[4] = 0x0E; /* Misc */ - Sequencer[5] = 0x00; - - /* - * CRTC Controller - */ - CRTC[0] = ((h_total) >> 3) - 5; - CRTC[1] = (hactive >> 3) - 1; - CRTC[2] = ((min(h_sync_start,h_active)) >> 3) - 1; - CRTC[3] = ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F) | 0x80; - i = (((h_skew << 2) + 0x10) & ~0x1F); - if (i < 0x80) - CRTC[3] |= i; - CRTC[4] = (h_sync_start >> 3); - CRTC[5] = (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2) - | (((h_sync_end >> 3)) & 0x1F); - - CRTC[6] = (v_total - 2) & 0xFF; - CRTC[7] = (((v_total - 2) & 0x100) >> 8) - | (((v_active - 1) & 0x100) >> 7) - | ((v_sync_start & 0x100) >> 6) - | ((((min(v_sync_start,v_active)) - 1) & 0x100) >> 5) - | 0x10 - | (((v_total - 2) & 0x200) >> 4) - | (((v_active - 1) & 0x200) >> 3) - | ((v_sync_start & 0x200) >> 2); - CRTC[8] = 0x00; - CRTC[9] = ((((min(v_sync_start,v_active))-1) & 0x200) >> 4) | 0x40; - CRTC[10] = 0x00; - CRTC[11] = 0x00; - CRTC[12] = 0x00; - CRTC[13] = 0x00; - CRTC[14] = 0x00; - CRTC[15] = 0x00; - CRTC[16] = v_sync_start & 0xFF; - CRTC[17] = (v_sync_end & 0x0F) | 0x20; - CRTC[18] = (v_active - 1) & 0xFF; - if (pScreenPriv->screen->fb[0].depth == 4) - CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 4; - else - if (pScreenPriv->screen->fb[0].depth == 8) - CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 3; - else - if (pScreenPriv->screen->fb[0].depth == 16 || - pScreenPriv->screen->fb[0].depth == 15) - CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 2; - CRTC[20] = 0x00; - CRTC[21] = ((min(v_sync_end,v_active)) - 1) & 0xFF; - CRTC[22] = ((min(v_sync_end,v_active)) - 1) & 0xFF; - if (pScreenPriv->screen->fb[0].depth < 8) - CRTC[23] = 0xE3; - else - CRTC[23] = 0xC3; - CRTC[24] = 0xFF; - CRTC[25] = 0x00; - CRTC[26] = 0x00; -#if 0 - if (!pcmciac->HP) - if (mode.Flags & V_INTERLACE) CRTC[26] |= 0x01; -#endif - if (pcmciac->HP) - CRTC[27] = 0x00; - else - CRTC[27] = 0x22; - CRTC[28] = 0x00; - CRTC[29] = 0x00; - CRTC[30] = 0x80; -#if 0 - if (pcmciac->HP) - if (mode.Flags & V_INTERLACE) CRTC[30] |= 0x04; -#endif - -{ - int nExtBits = 0; - CARD32 ExtBits; - CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6; - - CRTC[3] = (CRTC[3] & ~0x1F) - | ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F); - CRTC[5] = (CRTC[5] & ~0x80) - | (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2); - ExtBits = (((min(h_sync_end,h_total)) >> 3) - 1) & ExtBitMask; - - /* First the horizontal case */ - if ((((min(h_sync_end,h_total)) >> 3) == (h_total >> 3))) - { - int i = (CRTC[3] & 0x1F) - | ((CRTC[5] & 0x80) >> 2) - | ExtBits; - if ((i-- > ((((min(h_sync_start,h_active)) >> 3) - 1) - & (0x3F | ExtBitMask))) - && ((min(h_sync_end,h_total)) == h_total)) - i = 0; - CRTC[3] = (CRTC[3] & ~0x1F) | (i & 0x1F); - CRTC[5] = (CRTC[5] & ~0x80) | ((i << 2) & 0x80); - ExtBits = i & ExtBitMask; - } -} -{ - CARD32 ExtBits; - CARD32 ExtBitMask = 0; - /* If width is not known nBits should be 0. In this - * case BitMask is set to 0 so we can check for it. */ - CARD32 BitMask = 0; - int VBlankStart = ((min(v_sync_start,v_active)) - 1) & 0xFF; - CRTC[22] = ((min(v_sync_end,v_total)) - 1) & 0xFF; - ExtBits = ((min(v_sync_end,v_total)) - 1) & ExtBitMask; - - if ((min(v_sync_end,v_total)) == v_total) - /* Null top overscan */ - { - int i = CRTC[22] | ExtBits; - if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) - || ((i > VBlankStart) && /* 8-bit case */ - ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */ - !(CRTC[9] & 0x9F)) /* 1 scanline/row */ - i = 0; - else - i = (i - 1); - CRTC[22] = i & 0xFF; - ExtBits = i & 0xFF00; - } -} - - /* - * Graphics Display Controller - */ - Graphics[0] = 0x00; - Graphics[1] = 0x00; - Graphics[2] = 0x00; - Graphics[3] = 0x00; - Graphics[4] = 0x00; - if (pScreenPriv->screen->fb[0].depth == 4) - Graphics[5] = 0x02; - else - Graphics[5] = 0x40; - Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */ - Graphics[7] = 0x0F; - Graphics[8] = 0xFF; - - Attribute[0] = 0x00; /* standard colormap translation */ - Attribute[1] = 0x01; - Attribute[2] = 0x02; - Attribute[3] = 0x03; - Attribute[4] = 0x04; - Attribute[5] = 0x05; - Attribute[6] = 0x06; - Attribute[7] = 0x07; - Attribute[8] = 0x08; - Attribute[9] = 0x09; - Attribute[10] = 0x0A; - Attribute[11] = 0x0B; - Attribute[12] = 0x0C; - Attribute[13] = 0x0D; - Attribute[14] = 0x0E; - Attribute[15] = 0x0F; - if (pScreenPriv->screen->fb[0].depth == 4) - Attribute[16] = 0x81; - else - Attribute[16] = 0x41; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) - Attribute[17] = 0x00; - else - Attribute[17] = 0xFF; - Attribute[18] = 0x0F; - Attribute[19] = 0x00; - Attribute[20] = 0x00; - - /* Wake up the card */ - if (pcmciac->HP) { - pcmciaWriteReg(pcmciac, 0x3c3, 0x1); - pcmciaWriteReg(pcmciac, 0x46e8, 0x10); - } else { - pcmciaWriteReg(pcmciac, 0x105, 0x1); - pcmciaWriteReg(pcmciac, 0x46e8, 0x1f); - pcmciaWriteReg(pcmciac, 0x102, 0x1); - pcmciaWriteReg(pcmciac, 0x46e8, 0xf); - pcmciaWriteReg(pcmciac, 0x3c3, 0x1); - } - - if (pcmciac->HP) { - /* unlock */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x11, 0x92); - j = pcmciaReadIndex(pcmciac, 0x3c4, 0xb); - pcmciaWriteIndex(pcmciac, 0x3c4, 0xe, 0xc2); - - /* switch on dac */ - pcmciaWriteIndex(pcmciac, 0x3d4, 0x29, 0x24); - /* switch on the accelerator */ - pcmciaWriteIndex(pcmciac, 0x3d4, 0x36, 0x80); - - /* bump up memory clk */ - pcmciaWriteReg(pcmciac, 0x43c6, 0x65); - pcmciaWriteReg(pcmciac, 0x43c7, 0x00); - } else { - /* unlock */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x06, 0x12); - pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg); - } - - /* synchronous reset */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0); - - pcmciaWriteReg(pcmciac, 0x3da, 0x10); - - for (i=0;i<6;i++) - pcmciaWriteIndex(pcmciac, 0x3c4, i, Sequencer[i]); - - if (pcmciac->HP) { - /* Stick chip into color mode */ - pcmciaWriteIndex(pcmciac, 0x3ce, 0x2f, 0x06); - /* Switch on Linear addressing */ - pcmciaWriteIndex(pcmciac, 0x3d4, 0x21, 0x2e); - } else { - /* Stick chip into 8bit access mode - ugh! */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x0F, 0x20); /* 0x26 ? */ - /* reset mclk */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x1F, 0); - } - - pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0x3); - - for (i=0;i<31;i++) - pcmciaWriteIndex(pcmciac, 0x3d4, i, CRTC[i]); - - for (i=0;i<9;i++) - pcmciaWriteIndex(pcmciac, 0x3ce, i, Graphics[i]); - - j = pcmciaReadReg(pcmciac, 0x3da); - - for (i=0;i<21;i++) { - pcmciaWriteReg(pcmciac, 0x3c0, i); - pcmciaWriteReg(pcmciac, 0x3c0, Attribute[i]); - } - - j = pcmciaReadReg(pcmciac, 0x3da); - pcmciaWriteReg(pcmciac, 0x3c0, 0x20); - - j = pcmciaReadReg(pcmciac, 0x3c8); - j = pcmciaReadReg(pcmciac, 0x3c6); - j = pcmciaReadReg(pcmciac, 0x3c6); - j = pcmciaReadReg(pcmciac, 0x3c6); - j = pcmciaReadReg(pcmciac, 0x3c6); - switch (pScreenPriv->screen->fb[0].depth) { - /* This is here for completeness, when/if we ever do 4bpp */ - case 4: - pcmciaWriteReg(pcmciac, 0x3c6, 0x0); - if (pcmciac->HP) { - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x90); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00); - } else - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x00); - break; - case 8: - pcmciaWriteReg(pcmciac, 0x3c6, 0x0); - if (pcmciac->HP) { - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x92); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00); - } else - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x01); - break; - case 15: - if (pcmciac->HP) { - pcmciaWriteReg(pcmciac, 0x3c6, 0x10); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04); - } else { - pcmciaWriteReg(pcmciac, 0x3c6, 0xC0); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03); - } - break; - case 16: - if (pcmciac->HP) { - pcmciaWriteReg(pcmciac, 0x3c6, 0x30); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04); - } else { - pcmciaWriteReg(pcmciac, 0x3c6, 0xC1); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03); - } - break; - } - j = pcmciaReadReg(pcmciac, 0x3c8); - - pcmciaWriteReg(pcmciac, 0x3c6, 0xff); - - for (i=0;i<256;i++) { - pcmciaWriteReg(pcmciac, 0x3c8, i); - pcmciaWriteReg(pcmciac, 0x3c9, i); - pcmciaWriteReg(pcmciac, 0x3c9, i); - pcmciaWriteReg(pcmciac, 0x3c9, i); - } - - /* Set the Clock */ - if (pcmciac->HP) { - CARD8 a,b; - int clock = t->clock; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) - clock *= 2; - tridentSetCLK(clock, &a, &b); - pcmciaWriteReg(pcmciac, 0x43c8, a); - pcmciaWriteReg(pcmciac, 0x43c9, b); - } else { - int num, den; - unsigned char tmp; - int clock = t->clock; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) - clock *= 2; - - CirrusFindClock(clock, &num, &den); - - tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x0d); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x0d, (tmp & 0x80) | num); - tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x1d); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x1d, (tmp & 0xc0) | den); - } - pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg | 0x08); - -#if 1 - for (i=1;i<0x3f;i++) - ErrorF("0x3c4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3c4, i)); - - ErrorF("\n"); - - for (i=0;i<0x3f;i++) - ErrorF("0x3ce:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3ce, i)); - - ErrorF("\n"); - - for (i=0;i<0x3f;i++) - ErrorF("0x3d4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3d4, i)); -#endif - - return TRUE; -} - -void -pcmciaDisable (ScreenPtr pScreen) -{ -} - -const CARD8 tridentDPMSModes[4] = { - 0x00, /* KD_DPMS_NORMAL */ - 0x01, /* KD_DPMS_STANDBY */ - 0x02, /* KD_DPMS_SUSPEND */ - 0x03, /* KD_DPMS_POWERDOWN */ -}; - -Bool -pcmciaDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - if (pcmciac->HP) { - pcmciaWriteIndex (pcmciac, 0x3ce, 0x23, tridentDPMSModes[mode]); - pcmciaPause (); - } else { - /* Voyager */ - } - - return TRUE; -} - -void -pcmciaRestore (KdCardInfo *card) -{ -} - -void -pcmciaScreenFini (KdScreenInfo *screen) -{ - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; - - xfree (pcmcias); - screen->driver = 0; -} - -void -pcmciaCardFini (KdCardInfo *card) -{ - pcmciaCardInfo *pcmciac = card->driver; - - if (pcmciac->cop_base) - KdUnmapDevice ((void *) pcmciac->cop_base, PCMCIA_COP_SIZE(card)); -} - -void -pcmciaGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - while (ndef--) - { - pcmciaWriteReg (pcmciac, 0x3C7, pdefs->pixel); - pdefs->red = pcmciaReadReg (pcmciac, 0x3C9) << 10; - pdefs->green = pcmciaReadReg (pcmciac, 0x3C9) << 10; - pdefs->blue = pcmciaReadReg (pcmciac, 0x3C9) << 10; - pdefs++; - } -} - -void -pcmciaPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - while (ndef--) - { - pcmciaWriteReg (pcmciac, 0x3C8, pdefs->pixel); - pcmciaWriteReg (pcmciac, 0x3C9, pdefs->red >> 10); - pcmciaWriteReg (pcmciac, 0x3C9, pdefs->green >> 10); - pcmciaWriteReg (pcmciac, 0x3C9, pdefs->blue >> 10); - pdefs++; - } -} - - -KdCardFuncs pcmciaFuncs = { - pcmciaCardInit, /* cardinit */ - pcmciaScreenInit, /* scrinit */ - pcmciaInitScreen, /* initScreen */ - pcmciaPreserve, /* preserve */ - pcmciaEnable, /* enable */ - pcmciaDPMS, /* dpms */ - pcmciaDisable, /* disable */ - pcmciaRestore, /* restore */ - pcmciaScreenFini, /* scrfini */ - pcmciaCardFini, /* cardfini */ - - pcmciaCursorInit, /* initCursor */ - pcmciaCursorEnable, /* enableCursor */ - pcmciaCursorDisable, /* disableCursor */ - pcmciaCursorFini, /* finiCursor */ - pcmciaRecolorCursor, /* recolorCursor */ - -#if 0 /* not yet */ - pcmciaDrawInit, /* initAccel */ - pcmciaDrawEnable, /* enableAccel */ - pcmciaDrawSync, /* syncAccel */ - pcmciaDrawDisable, /* disableAccel */ - pcmciaDrawFini, /* finiAccel */ -#else - 0, - 0, - 0, - 0, - 0, -#endif - - pcmciaGetColors, /* getColors */ - pcmciaPutColors, /* putColors */ -}; diff --git a/hw/kdrive/pcmcia/pcmcia.h b/hw/kdrive/pcmcia/pcmcia.h deleted file mode 100644 index cb4d13a6c..000000000 --- a/hw/kdrive/pcmcia/pcmcia.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ -/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmcia.h,v 1.1 2001/05/23 08:56:09 alanh Exp $ */ - -#ifndef _PCMCIA_H_ -#define _PCMCIA_H_ - -#include <fbdev.h> - -/* - * offset from ioport beginning - */ - -#define PCMCIA_COP_BASE(c) 0x20000000 -#define PCMCIA_COP_SIZE(c) 0x10000 -#define TRIDENT_COP_OFF(c) 0x2100 - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _cop { - VOL32 src_start_xy; /* 0x00 */ - VOL32 src_end_xy; /* 0x04 */ - VOL32 dst_start_xy; /* 0x08 */ - VOL32 dst_end_xy; /* 0x0c */ - VOL32 alpha; /* 0x10 */ - CARD8 pad14[0xc]; /* 0x14 */ - VOL32 multi; /* 0x20 */ - -#define COP_MULTI_CLIP_TOP_LEFT 0x10000000 -#define COP_MULTI_DEPTH 0x40000000 -#define COP_MULTI_COLOR_KEY 0x70000000 -#define COP_MULTI_STYLE 0x50000000 -#define COP_MULTI_PATTERN 0x80000000 -#define COP_MULTI_ROP 0x90000000 -#define COP_MULTI_STRIDE 0x60000000 -#define COP_MULTI_Z 0xa0000000 -#define COP_MULTI_ALPHA 0xb0000000 -#define COP_MULTI_TEXTURE 0xd0000000 -#define COP_MULTI_TEXTURE_BOUND 0xe0000000 -#define COP_MULTI_TEXTURE_ADVANCED 0x20000000 -#define COP_MULTI_MASK 0xf0000000 - -#define COP_DEPTH_8 0x00000000 -#define COP_DEPTH_16 0x00000001 -#define COP_DEPTH_24_32 0x00000002 -#define COP_DEPTH_15 0x00000005 -#define COP_DEPTH_DITHER_DISABLE 0x00000008 - - -#define COP_ALPHA_SRC_BLEND_0 0x00000000 -#define COP_ALPHA_SRC_BLEND_1 0x00000001 -#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002 -#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003 -#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004 -#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005 -#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006 -#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007 -#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008 -#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009 -#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A -#define COP_ALPHA_SRC_BLEND_BG 0x0000000B - -#define COP_ALPHA_DST_BLEND_0 0x00000000 -#define COP_ALPHA_DST_BLEND_1 0x00000010 -#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020 -#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030 -#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040 -#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050 -#define COP_ALPHA_DST_BLEND_DST_A 0x00000060 -#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070 -#define COP_ALPHA_DST_BLEND_DST_C 0x00000080 -#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090 -#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0 - -#define COP_ALPHA_RESULT_ALPHA 0x00100000 -#define COP_ALPHA_DEST_ALPHA 0x00200000 -#define COP_ALPHA_SOURCE_ALPHA 0x00400000 -#define COP_ALPHA_WRITE_ENABLE 0x00800000 -#define COP_ALPHA_TEST_ENABLE 0x01000000 -#define COP_ALPHA_BLEND_ENABLE 0x02000000 -#define COP_ALPHA_DEST_VALUE 0x04000000 -#define COP_ALPHA_SOURCE_VALUE 0x08000000 - - VOL32 command; /* 0x24 */ -#define COP_OP_NULL 0x00000000 -#define COP_OP_LINE 0x20000000 -#define COP_OP_BLT 0x80000000 -#define COP_OP_TEXT 0x90000000 -#define COP_OP_POLY 0xb0000000 -#define COP_OP_POLY2 0xe0000000 -#define COP_SCL_EXPAND 0x00800000 -#define COP_SCL_OPAQUE 0x00400000 -#define COP_SCL_REVERSE 0x00200000 -#define COP_SCL_MONO_OFF 0x001c0000 -#define COP_LIT_TEXTURE 0x00004000 -#define COP_BILINEAR 0x00002000 -#define COP_OP_ZBUF 0x00000800 -#define COP_OP_ROP 0x00000400 -#define COP_OP_FG 0x00000200 -#define COP_OP_FB 0x00000080 -#define COP_X_REVERSE 0x00000004 -#define COP_CLIP 0x00000001 - VOL32 texture_format; /* 0x28 */ - CARD8 pad2c[0x4]; /* 0x2c */ - - VOL32 clip_bottom_right; /* 0x30 */ - VOL32 dataIII; /* 0x34 */ - VOL32 dataIV; /* 0x38 */ - CARD8 pad3c[0x8]; /* 0x3c */ - - VOL32 fg; /* 0x44 */ - VOL32 bg; /* 0x48 */ - CARD8 pad4c[0x4]; /* 0x4c */ - - VOL32 pattern_fg; /* 0x50 */ - VOL32 pattern_bg; /* 0x54 */ - CARD8 pad58[0xc]; /* 0x58 */ - - VOL32 status; /* 0x64 */ -#define COP_STATUS_BE_BUSY 0x80000000 -#define COP_STATUS_DPE_BUSY 0x20000000 -#define COP_STATUS_MI_BUSY 0x10000000 -#define COP_STATUS_FIFO_BUSY 0x08000000 -#define COP_STATUS_WB_BUSY 0x00800000 -#define COP_STATUS_Z_FAILED 0x00400000 -#define COP_STATUS_EFFECTIVE 0x00200000 -#define COP_STATUS_LEFT_VIEW 0x00080000 - - CARD8 pad68[0x4]; /* 0x68 */ - - VOL32 src_offset; /* 0x6c */ - VOL32 z_offset; /* 0x70 */ - CARD8 pad74[0x4]; /* 0x74 */ - - VOL32 display_offset; /* 0x78 */ - VOL32 dst_offset; /* 0x7c */ - CARD8 pad80[0x34]; /* 0x80 */ - - VOL32 semaphore; /* 0xb4 */ -} Cop; - -#define TRI_XY(x,y) ((y) << 16 | (x)) - -typedef struct _pcmciaCardInfo { - CARD8 *fb; - Bool HP; - CARD32 memory; - CARD8 *cop_base; - Cop *cop; - CARD32 *window; - CARD32 cop_depth; - CARD32 cop_stride; -} pcmciaCardInfo; - -#define getpcmciaCardInfo(kd) ((pcmciaCardInfo *) ((kd)->card->driver)) -#define pcmciaCardInfo(kd) pcmciaCardInfo *pcmciac = getpcmciaCardInfo(kd) - -typedef struct _pcmciaCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} pcmciaCursor; - -#define PCMCIA_CURSOR_WIDTH 64 -#define PCMCIA_CURSOR_HEIGHT 64 - -typedef struct _pcmciaScreenInfo { - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - int randr; - LayerPtr pLayer; - pcmciaCursor cursor; -} pcmciaScreenInfo; - -#define getpcmciaScreenInfo(kd) ((pcmciaScreenInfo *) ((kd)->screen->driver)) -#define pcmciaScreenInfo(kd) pcmciaScreenInfo *pcmcias = getpcmciaScreenInfo(kd) - -Bool -pcmciaDrawInit (ScreenPtr pScreen); - -void -pcmciaDrawEnable (ScreenPtr pScreen); - -void -pcmciaDrawSync (ScreenPtr pScreen); - -void -pcmciaDrawDisable (ScreenPtr pScreen); - -void -pcmciaDrawFini (ScreenPtr pScreen); - -CARD8 -pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index); - -void -pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value); - -void -pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value); - -Bool -pcmciaCursorInit (ScreenPtr pScreen); - -void -pcmciaCursorEnable (ScreenPtr pScreen); - -void -pcmciaCursorDisable (ScreenPtr pScreen); - -void -pcmciaCursorFini (ScreenPtr pScreen); - -void -pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -void -pcmciaUpdateRotatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); - -typedef struct _pcmciaDisplayModeRec { - int Width; - int Height; - int Refresh; - int Clock; /* pixel clock freq */ - int HDisplay; /* horizontal timing */ - int HSyncStart; - int HSyncEnd; - int HTotal; - int HSkew; - int VDisplay; /* vertical timing */ - int VSyncStart; - int VSyncEnd; - int VTotal; - int VScan; - int Flags; -} pcmciaDisplayModeRec, *pcmciaDisplayModePtr; - -extern KdCardFuncs pcmciaFuncs; - -#endif /* _PCMCIA_H_ */ diff --git a/hw/kdrive/pcmcia/pcmciacurs.c b/hw/kdrive/pcmcia/pcmciacurs.c deleted file mode 100644 index 1cb86cfe9..000000000 --- a/hw/kdrive/pcmcia/pcmciacurs.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ -/* $RCSId: $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "pcmcia.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - pcmciaCardInfo(pScreenPriv); \ - pcmciaScreenInfo(pScreenPriv); \ - pcmciaCursor *pCurPriv = &pcmcias->cursor - -static void -_pcmciaMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - - /* This is the recommended order to move the cursor */ - if (pcmciac->HP) { - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x40, xlow); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x41, xhigh); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x42, ylow); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x43, yhigh); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x46, xoff); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x47, yoff); - } else { - x >>= 3; - y >>= 3; - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - /* Don't be alarmed, yes the upper 3bits of the index are correct */ - pcmciaWriteIndex (pcmciac, 0x3c4, 0x10 | xhigh << 5, xlow); - pcmciaWriteIndex (pcmciac, 0x3c4, 0x11 | yhigh << 5, ylow); - } -} - -static void -pcmciaMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _pcmciaMoveCursor (pScreen, x, y); -} - -static void -pcmciaAllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -pcmciaSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CARD32 fg, bg; - - fg = pCurPriv->source; - bg = pCurPriv->mask; - - if (pcmciac->HP) { - /* - * This trident chip uses the palette for it's cursor colors - ouch! - * We enforce it to always stay the black/white colors as we don't - * want it to muck with the overscan color. Tough. Use softCursor - * if you want to change cursor colors. - */ - pcmciaWriteReg (pcmciac, 0x3c8, 0xff); /* DAC 0 */ - pcmciaWriteReg (pcmciac, 0x3c9, 0x00); - pcmciaWriteReg (pcmciac, 0x3c9, 0x00); - pcmciaWriteReg (pcmciac, 0x3c9, 0x00); - pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 255 */ - pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); - pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); - pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); - } else { - CARD8 temp; - temp = pcmciaReadIndex(pcmciac, 0x3c4, 0x12); - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, (temp & 0xFE) | 0x02); - - pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 256 */ - pcmciaWriteReg (pcmciac, 0x3c9, fg); - pcmciaWriteReg (pcmciac, 0x3c9, fg >> 8); - pcmciaWriteReg (pcmciac, 0x3c9, fg >> 16); - pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 257 */ - pcmciaWriteReg (pcmciac, 0x3c9, bg); - pcmciaWriteReg (pcmciac, 0x3c9, bg >> 8); - pcmciaWriteReg (pcmciac, 0x3c9, bg >> 16); - - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, temp); - } -} - -void -pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - pcmciaAllocCursorColors (pScreen); - pcmciaSetCursorColors (pScreen); -} - -#define InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -static void -pcmciaLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD8 *ram; - CARD32 *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - - /* - * Allocate new colors - */ - pcmciaAllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - if (pcmciac->HP) { - ram = (CARD8 *) pcmcias->cursor_base; - } else { - /* The last bank */ - ram = (CARD8 *) pcmciac->fb; - pcmciaWriteIndex (pcmciac, 0x3ce, 0x09, 0x7f); - pcmciaWriteIndex (pcmciac, 0x3ce, 0x0A, 0x7f); - } - - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > PCMCIA_CURSOR_HEIGHT) - h = PCMCIA_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; - - for (i = 0; i < PCMCIA_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < PCMCIA_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - InvertBits32(m); - InvertBits32(s); - } - else - { - m = 0; - s = 0; - } - - /* Do 8bit access */ - *ram++ = (m & 0xff); - *ram++ = (m & 0xff00) >> 8; - *ram++ = (m & 0xff0000) >> 16; - *ram++ = (m & 0xff000000) >> 24; - *ram++ = (s & 0xff); - *ram++ = (s & 0xff00) >> 8; - *ram++ = (s & 0xff0000) >> 16; - *ram++ = (s & 0xff000000) >> 24; - } - } - - /* Set address for cursor bits */ - if (pcmciac->HP) { - offset = pcmcias->cursor_base - (CARD8 *) pcmcias->screen; - offset >>= 10; - pcmciaWriteIndex (pcmciac, 0x3d4, 0x44, (CARD8) (offset & 0xff)); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x45, (CARD8) (offset >> 8)); - } else { - pcmciaWriteIndex (pcmciac, 0x3c4, 0x13, 15); /* ?? */ - } - - /* Set new color */ - pcmciaSetCursorColors (pScreen); - - /* Enable the cursor */ - if (pcmciac->HP) - pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0xc1); - else - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0x05); - - /* Move to new position */ - pcmciaMoveCursor (pScreen, x, y); -} - -static void -pcmciaUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - if (pcmciac->HP) - pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0); - else - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0); -} - -static Bool -pcmciaRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - pcmciaLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -pcmciaUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -pcmciaSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - pcmciaLoadCursor (pScreen, x, y); - else - pcmciaUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec pcmciaPointerSpriteFuncs = { - pcmciaRealizeCursor, - pcmciaUnrealizeCursor, - pcmciaSetCursor, - pcmciaMoveCursor, -}; - -static void -pcmciaQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -pcmciaCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pcmcias->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = PCMCIA_CURSOR_WIDTH; - pCurPriv->height= PCMCIA_CURSOR_HEIGHT; - pScreen->QueryBestSize = pcmciaQueryBestSize; - miPointerInitialize (pScreen, - &pcmciaPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -pcmciaCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - pcmciaLoadCursor (pScreen, x, y); - } - else - pcmciaUnloadCursor (pScreen); - } -} - -void -pcmciaCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - pcmciaUnloadCursor (pScreen); - } - } -} - -void -pcmciaCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/pcmcia/pcmciarotate.c b/hw/kdrive/pcmcia/pcmciarotate.c deleted file mode 100644 index 6ac7efbfd..000000000 --- a/hw/kdrive/pcmcia/pcmciarotate.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * $RCSId: xc/programs/Xserver/miext/shadow/shrotate.c,v 1.3 2001/07/21 04:13:26 keithp Exp $ - * - * Copyright © 2001 Keith Packard - * - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/X.h> -#include "scrnintstr.h" -#include "windowstr.h" -#include "font.h" -#include "dixfontstr.h" -#include "fontstruct.h" -#include "mi.h" -#include "regionstr.h" -#include "globals.h" -#include "gcstruct.h" -#include "shadow.h" -#include "fb.h" - -/* - * These indicate which way the source (shadow) is scanned when - * walking the screen in a particular direction - */ - -#define LEFT_TO_RIGHT 1 -#define RIGHT_TO_LEFT -1 -#define TOP_TO_BOTTOM 2 -#define BOTTOM_TO_TOP -2 - -typedef CARD16 PcBits; -typedef INT32 PcStride; - -#define PC_SHIFT 4 -#define PC_UNIT (1 << PC_SHIFT) -#define PC_HALFUNIT (1 << (PC_SHIFT-1)) -#define PC_MASK (PC_UNIT - 1) -#define PC_ALLONES ((PcBits) -1) - -#define PcScrRight(x,b) FbScrRight(x,b) -#define PcScrLeft(x,b) FbScrLeft(x,b) -#define PcBitsMask(x,w) (PcScrRight(PC_ALLONES,(x) & PC_MASK) & \ - PcScrLeft(PC_ALLONES,(PC_UNIT - ((x) + (w))) & PC_MASK)) - -#define pcGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ - PixmapPtr _pPix; \ - if ((pDrawable)->type != DRAWABLE_PIXMAP) \ - _pPix = fbGetWindowPixmap(pDrawable); \ - else \ - _pPix = (PixmapPtr) (pDrawable); \ - (pointer) = (PcBits *) _pPix->devPrivate.ptr; \ - (stride) = ((int) _pPix->devKind) / sizeof (PcBits); \ - (bpp) = _pPix->drawable.bitsPerPixel; \ - (xoff) = 0; \ - (yoff) = 0; \ -} - -void -pcmciaUpdateRotatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - PcBits *shaBits; - PcStride shaStride; - int shaBpp; - int shaXoff, shaYoff; - int box_x1, box_x2, box_y1, box_y2; - int sha_x1, sha_y1; - int scr_x1, scr_x2, scr_y1, scr_y2, scr_w, scr_h; - int scr_x, scr_y; - int w; - int pixelsPerBits; - int pixelsMask; - PcStride shaStepOverY, shaStepDownY, shaStepOverX, shaStepDownX; - PcBits *shaLine, *sha; - int shaHeight = pShadow->drawable.height; - int shaWidth = pShadow->drawable.width; - PcBits shaMask; - int shaFirstShift, shaShift; - int o_x_dir; - int o_y_dir; - int x_dir; - int y_dir; - - pcGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); - pixelsPerBits = (sizeof (PcBits) * 8) / shaBpp; - pixelsMask = ~(pixelsPerBits - 1); - shaMask = PcBitsMask (PC_UNIT-shaBpp, shaBpp); - /* - * Compute rotation related constants to walk the shadow - */ - o_x_dir = LEFT_TO_RIGHT; - o_y_dir = TOP_TO_BOTTOM; - if (pBuf->randr & SHADOW_REFLECT_X) - o_x_dir = -o_x_dir; - if (pBuf->randr & SHADOW_REFLECT_Y) - o_y_dir = -o_y_dir; - switch (pBuf->randr & (SHADOW_ROTATE_ALL)) { - case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */ - default: - x_dir = o_x_dir; - y_dir = o_y_dir; - break; - case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */ - x_dir = o_y_dir; - y_dir = -o_x_dir; - break; - case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */ - x_dir = -o_x_dir; - y_dir = -o_y_dir; - break; - case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */ - x_dir = -o_y_dir; - y_dir = o_x_dir; - break; - } - switch (x_dir) { - case LEFT_TO_RIGHT: - shaStepOverX = shaBpp; - shaStepOverY = 0; - break; - case TOP_TO_BOTTOM: - shaStepOverX = 0; - shaStepOverY = shaStride; - break; - case RIGHT_TO_LEFT: - shaStepOverX = -shaBpp; - shaStepOverY = 0; - break; - case BOTTOM_TO_TOP: - shaStepOverX = 0; - shaStepOverY = -shaStride; - break; - } - switch (y_dir) { - case TOP_TO_BOTTOM: - shaStepDownX = 0; - shaStepDownY = shaStride; - break; - case RIGHT_TO_LEFT: - shaStepDownX = -shaBpp; - shaStepDownY = 0; - break; - case BOTTOM_TO_TOP: - shaStepDownX = 0; - shaStepDownY = -shaStride; - break; - case LEFT_TO_RIGHT: - shaStepDownX = shaBpp; - shaStepDownY = 0; - break; - } - - while (nbox--) - { - box_x1 = pbox->x1; - box_y1 = pbox->y1; - box_x2 = pbox->x2; - box_y2 = pbox->y2; - pbox++; - - /* - * Compute screen and shadow locations for this box - */ - switch (x_dir) { - case LEFT_TO_RIGHT: - scr_x1 = box_x1 & pixelsMask; - scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; - - sha_x1 = scr_x1; - break; - case TOP_TO_BOTTOM: - scr_x1 = box_y1 & pixelsMask; - scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; - - sha_y1 = scr_x1; - break; - case RIGHT_TO_LEFT: - scr_x1 = (shaWidth - box_x2) & pixelsMask; - scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; - - sha_x1 = (shaWidth - scr_x1 - 1); - break; - case BOTTOM_TO_TOP: - scr_x1 = (shaHeight - box_y2) & pixelsMask; - scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; - - sha_y1 = (shaHeight - scr_x1 - 1); - break; - } - switch (y_dir) { - case TOP_TO_BOTTOM: - scr_y1 = box_y1; - scr_y2 = box_y2; - - sha_y1 = scr_y1; - break; - case RIGHT_TO_LEFT: - scr_y1 = (shaWidth - box_x2); - scr_y2 = (shaWidth - box_x1); - - sha_x1 = box_x2 - 1; - break; - case BOTTOM_TO_TOP: - scr_y1 = shaHeight - box_y2; - scr_y2 = shaHeight - box_y1; - - sha_y1 = box_y2 - 1; - break; - case LEFT_TO_RIGHT: - scr_y1 = box_x1; - scr_y2 = box_x2; - - sha_x1 = box_x1; - break; - } - scr_w = ((scr_x2 - scr_x1) * shaBpp) >> PC_SHIFT; - scr_h = scr_y2 - scr_y1; - scr_y = scr_y1; - - /* shift amount for first pixel on screen */ - shaFirstShift = PC_UNIT - ((sha_x1 * shaBpp) & PC_MASK) - shaBpp; - - /* pointer to shadow data first placed on screen */ - shaLine = (shaBits + - sha_y1 * shaStride + - ((sha_x1 * shaBpp) >> PC_SHIFT)); - - /* - * Copy the bits, always write across the physical frame buffer - * to take advantage of write combining. - */ - while (scr_h--) - { - int p; - PcBits bits; - PcBits *win; - int i; - CARD32 winSize; - - sha = shaLine; - shaShift = shaFirstShift; - w = scr_w; - scr_x = scr_x1 * shaBpp >> PC_SHIFT; - - while (w) - { - /* - * Map some of this line - */ - win = (PcBits *) (*pBuf->window) (pScreen, - scr_y, - scr_x << 1, - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - i = (winSize >> 1); - if (i > w) - i = w; - w -= i; - scr_x += i; - /* - * Copy the portion of the line mapped - */ - while (i--) - { - bits = 0; - p = pixelsPerBits; - /* - * Build one word of output from multiple inputs - * - * Note that for 90/270 rotations, this will walk - * down the shadow hitting each scanline once. - * This is probably not very efficient. - */ - while (p--) - { - bits = PcScrLeft(bits, shaBpp); - bits |= PcScrRight (*sha, shaShift) & shaMask; - - shaShift -= shaStepOverX; - if (shaShift >= PC_UNIT) - { - shaShift -= PC_UNIT; - sha--; - } - else if (shaShift < 0) - { - shaShift += PC_UNIT; - sha++; - } - sha += shaStepOverY; - } - *win++ = bits; - } - } - scr_y++; - shaFirstShift -= shaStepDownX; - if (shaFirstShift >= PC_UNIT) - { - shaFirstShift -= PC_UNIT; - shaLine--; - } - else if (shaFirstShift < 0) - { - shaFirstShift += PC_UNIT; - shaLine++; - } - shaLine += shaStepDownY; - } - } -} diff --git a/hw/kdrive/pcmcia/pcmciashadow.c b/hw/kdrive/pcmcia/pcmciashadow.c deleted file mode 100644 index abe73a0ba..000000000 --- a/hw/kdrive/pcmcia/pcmciashadow.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ -/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmciashadow.c,v 1.1 2001/05/23 08:56:09 alanh Exp $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/X.h> -#include "scrnintstr.h" -#include "windowstr.h" -#include "font.h" -#include "dixfontstr.h" -#include "fontstruct.h" -#include "mi.h" -#include "regionstr.h" -#include "globals.h" -#include "gcstruct.h" -#include "shadow.h" -#include "fb.h" - -void -tridentUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - PixmapPtr pShadow = pBuf->pPixmap; - shadowScrPriv(pScreen); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - FbBits *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - int shaXoff, shaYoff; /* XXX assumed to be zero */ - int x, y, w, h, width; - int i; - FbBits *winBase, *win; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = pbox->x1 * shaBpp; - y = pbox->y1; - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; - - scrLine = (x >> FB_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - x &= FB_MASK; - w = (w + x + FB_MASK) >> FB_SHIFT; - - while (h--) - { - winSize = 0; - scrBase = 0; - width = w; - scr = scrLine; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (FbBits *) (*pBuf->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (FbBits); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - { - CARD16 *sha16 = (CARD16*)sha; - CARD16 *win16 = (CARD16*)win; - while (i--) - { - *win16++ = *sha16++; - *win16++ = *sha16++; - } - } - } - shaLine += shaStride; - y++; - } - pbox++; - } -} - -void -cirrusUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - PixmapPtr pShadow = pBuf->pPixmap; - shadowScrPriv(pScreen); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - FbBits *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - int shaXoff, shaYoff; /* XXX assumed to be zero */ - int x, y, w, h, width; - int i; - FbBits *winBase, *win; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = pbox->x1 * shaBpp; - y = pbox->y1; - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; - - scrLine = (x >> FB_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - x &= FB_MASK; - w = (w + x + FB_MASK) >> FB_SHIFT; - - while (h--) - { - winSize = 0; - scrBase = 0; - width = w; - scr = scrLine; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (FbBits *) (*pBuf->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (FbBits); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - { - CARD8 *sha8 = (CARD8*)sha; - CARD8 *win8 = (CARD8*)win; - while (i--) - { - *win8++ = *sha8++; - *win8++ = *sha8++; - *win8++ = *sha8++; - *win8++ = *sha8++; - } - } - } - shaLine += shaStride; - y++; - } - pbox++; - } -} diff --git a/hw/kdrive/pcmcia/pcmciastub.c b/hw/kdrive/pcmcia/pcmciastub.c deleted file mode 100644 index b2145eab5..000000000 --- a/hw/kdrive/pcmcia/pcmciastub.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ -/* $RCSId: xc/programs/Xserver/hw/kdrive/pcmcia/pcmciastub.c,v 1.1 2001/05/23 08:56:09 alanh Exp $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "pcmcia.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - - KdCardInfoAdd (&pcmciaFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); -} - -extern pcmciaDisplayModeRec pcmciaDefaultModes[]; - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} |