diff options
Diffstat (limited to 'hw/kdrive/igs')
-rw-r--r-- | hw/kdrive/igs/Imakefile | 13 | ||||
-rw-r--r-- | hw/kdrive/igs/igs.c | 669 | ||||
-rw-r--r-- | hw/kdrive/igs/igs.h | 329 | ||||
-rw-r--r-- | hw/kdrive/igs/igscmap.c | 64 | ||||
-rw-r--r-- | hw/kdrive/igs/igscurs.c | 347 | ||||
-rw-r--r-- | hw/kdrive/igs/igsdraw.c | 1538 | ||||
-rw-r--r-- | hw/kdrive/igs/igsdraw.h | 260 | ||||
-rw-r--r-- | hw/kdrive/igs/igsreg.c | 971 | ||||
-rw-r--r-- | hw/kdrive/igs/igsreg.h | 157 | ||||
-rw-r--r-- | hw/kdrive/igs/igsstub.c | 72 |
10 files changed, 0 insertions, 4420 deletions
diff --git a/hw/kdrive/igs/Imakefile b/hw/kdrive/igs/Imakefile deleted file mode 100644 index 2214ee5ba..000000000 --- a/hw/kdrive/igs/Imakefile +++ /dev/null @@ -1,13 +0,0 @@ -XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/igs/Imakefile,v 1.2 2000/05/24 23:52:47 keithp Exp $ -KDRIVE=.. -#include "../Kdrive.tmpl" - -SRCS = igs.c igscmap.c igscurs.c igsdraw.c igsreg.c igsstub.c - -OBJS = igs.o igscmap.o igscurs.o igsdraw.o igsreg.o igsstub.o - -INCLUDES = -I. $(KDINCS) - -NormalLibraryObjectRule() -NormalLibraryTarget(igs,$(OBJS)) -DependTarget() diff --git a/hw/kdrive/igs/igs.c b/hw/kdrive/igs/igs.c deleted file mode 100644 index 1b0907d4f..000000000 --- a/hw/kdrive/igs/igs.c +++ /dev/null @@ -1,669 +0,0 @@ -/* - * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igs.c,v 1.2 2000/05/24 23:52:47 keithp Exp $ - * - * Copyright © 1999 SuSE, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "igs.h" - -Bool -igsCardInit (KdCardInfo *card) -{ - int k; - char *pixels; - IgsCardInfo *igsc; - - igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo)); - if (!igsc) - return FALSE; - - memset (igsc, '\0', sizeof (IgsCardInfo)); - - igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0] + - IGS_FB, - IGS_MEM); - - igsc->vga = (VOL8 *) KdMapDevice (card->attr.address[0] + - IGS_VGA, - 64 * 1024); - - igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] + - IGS_COP_OFFSET, - sizeof (Cop5xxx)); - - igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] + - IGS_COP_DATA, - IGS_COP_DATA_LEN); - - igsRegInit (&igsc->igsvga, igsc->vga); - - card->driver = igsc; - - return TRUE; -} - -Bool -igsModeSupported (KdScreenInfo *screen, - const KdMonitorTiming *t) -{ - /* make sure the clock isn't too fast */ - if (t->clock > IGS_MAX_CLOCK) - return FALSE; - /* width must be a multiple of 16 */ - if (t->horizontal & 0xf) - return FALSE; - return TRUE; -} - -Bool -igsModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - int screen_size; - int pixel_width; - int byte_width; - int fb = 0; - - screen_size = 0; - if (screen->fb[fb].depth >= 24) - { - screen->fb[fb].depth = 24; - if (screen->fb[fb].bitsPerPixel != 24) - screen->fb[fb].bitsPerPixel = 32; - } - else if (screen->fb[fb].depth >= 16) - { - screen->fb[fb].depth = 16; - screen->fb[fb].bitsPerPixel = 16; - } - else if (screen->fb[fb].depth >= 15) - { - screen->fb[fb].depth = 15; - screen->fb[fb].bitsPerPixel = 16; - } - else if (screen->fb[fb].depth >= 12) - { - screen->fb[fb].depth = 12; - screen->fb[fb].bitsPerPixel = 16; - } - else - { - screen->fb[fb].depth = 8; - screen->fb[fb].bitsPerPixel = 8; - } - - byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3); - pixel_width = screen->width; - screen->fb[fb].pixelStride = pixel_width; - screen->fb[fb].byteStride = byte_width; - screen_size += byte_width * screen->height; - - return TRUE; -} - -Bool -igsScreenInit (KdScreenInfo *screen) -{ - IgsCardInfo *igsc = screen->card->driver; - int fb = 0; - IgsScreenInfo *igss; - int screen_size, memory; - int pattern_size; - int tile_size; - int stipple_size; - int poffset, boffset; - const KdMonitorTiming *t; - - if (!screen->width || !screen->height) - { - screen->width = 800; - screen->height = 600; - screen->rate = 72; - } - if (!screen->fb[0].depth) - screen->fb[0].depth = 8; - - t = KdFindMode (screen, igsModeSupported); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - if (!KdTuneMode (screen, igsModeUsable, igsModeSupported)) - { - return FALSE; - } - - igss = (IgsScreenInfo *) xalloc (sizeof (IgsScreenInfo)); - if (!igss) - return FALSE; - - memset (igss, '\0', sizeof (IgsScreenInfo)); - - screen_size = screen->fb[fb].byteStride * screen->height; - memory = IGS_MEM; - memory -= screen_size; - if (memory >= 1024) - { - igss->cursor_offset = memory - 1024; -#if BITMAP_BIT_ORDER == MSBFirst - igss->cursor_base = (CARD8 *) KdMapDevice (card->attr.address[0] + - igss->cursor_offset, - 1024); -#else - igss->cursor_base = igsc->frameBuffer + igss->cursor_offset; -#endif - memory -= 1024; - } - else - igss->cursor_base = 0; - - tile_size = IgsTileSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN; - stipple_size = IgsStippleSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN; - pattern_size = tile_size + stipple_size; - if (memory >= pattern_size) - { - boffset = screen_size; - poffset = boffset * 8 / screen->fb[fb].bitsPerPixel; - igss->tile.offset = poffset; - igss->tile.base = igsc->frameBuffer + boffset; - - boffset = screen_size + tile_size; - poffset = boffset * 8 / screen->fb[fb].bitsPerPixel; - igss->stipple.offset = poffset; - igss->stipple.base = igsc->frameBuffer + boffset; - - memory -= pattern_size; - } - else - { - igss->tile.base = 0; - igss->stipple.base = 0; - } - - switch (screen->fb[fb].depth) { - case 8: - screen->fb[fb].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[fb].blueMask = 0x00; - screen->fb[fb].greenMask = 0x00; - screen->fb[fb].redMask = 0x00; - break; - case 15: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x001f; - screen->fb[fb].greenMask = 0x03e0; - screen->fb[fb].redMask = 0x7c00; - break; - case 16: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x001f; - screen->fb[fb].greenMask = 0x07e0; - screen->fb[fb].redMask = 0xf800; - break; - case 24: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x0000ff; - screen->fb[fb].greenMask = 0x00ff00; - screen->fb[fb].redMask = 0xff0000; - break; - } - - screen->fb[fb].pixelStride = screen->width; - screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3); - screen->fb[fb].frameBuffer = igsc->frameBuffer; - if (!igsc->cop) - screen->dumb = TRUE; - screen->driver = igss; - return TRUE; -} - -Bool -igsInitScreen(ScreenPtr pScreen) -{ - return TRUE; -} - -void -igsPreserve (KdCardInfo *card) -{ - IgsCardInfo *igsc = card->driver; - IgsVga *igsvga = &igsc->igsvga; - - igsSave (igsvga); -} - -void -igsSetBlank (IgsVga *igsvga, Bool blank) -{ - igsSetImm(igsvga, igs_screen_off, blank ? 1 : 0); -} - -void -igsSetSync (IgsCardInfo *igsc, int hsync, int vsync) -{ - IgsVga *igsvga = &igsc->igsvga; - - igsSet (igsvga, igs_mexhsyn, hsync); - igsSet (igsvga, igs_mexvsyn, vsync); - VgaFlush (&igsvga->card); -} - - -/* - * Clock synthesis: - * - * scale = p ? (2 * p) : 1 - * f_out = f_ref * ((M + 1) / ((N + 1) * scale)) - * - * Constraints: - * - * 1. 115MHz <= f_ref * ((M + 1) / (N + 1)) <= 260 MHz - * 2. N >= 1 - * - * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) - * Horizontal refresh rate = clock / (hsize + hblank) - */ - -/* all in kHz */ - -void -igsGetClock (int target, int *Mp, int *Np, int *Pp, int maxM, int maxN, int maxP, int minVco) -{ - int M, N, P, bestM, bestN; - int f_vco, f_out; - int err, abserr, besterr; - - /* - * Compute correct P value to keep VCO in range - */ - for (P = 0; P <= maxP; P++) - { - f_vco = target * IGS_SCALE(P); - if (f_vco >= minVco) - break; - } - - /* M = f_out / f_ref * ((N + 1) * IGS_SCALE(P)); */ - besterr = target; - for (N = 1; N <= maxN; N++) - { - M = ((target * (N + 1) * IGS_SCALE(P) + (IGS_CLOCK_REF/2)) + IGS_CLOCK_REF/2) / IGS_CLOCK_REF - 1; - if (0 <= M && M <= maxM) - { - f_out = IGS_CLOCK(M,N,P); - err = target - f_out; - if (err < 0) - err = -err; - if (err < besterr) - { - besterr = err; - bestM = M; - bestN = N; - } - } - } - *Mp = bestM; - *Np = bestN; - *Pp = P; -} - -Bool -igsEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - KdScreenInfo *screen = pScreenPriv->screen; - IgsCardInfo *igsc = card->driver; - IgsVga *igsvga = &igsc->igsvga; - const KdMonitorTiming *t; - int hactive, hblank, hfp, hbp; - int vactive, vblank, vfp, vbp; - int hsize; - int fb = 0; - int m, n, r; - int h_total; - int h_display_end; - int h_blank_start; - int h_blank_end; - int h_sync_start; - int h_sync_end; - int h_screen_off; - int v_total; - int v_retrace_start; - int v_retrace_end; - int v_display_end; - int v_blank_start; - int v_blank_end; - int offset; - int num_fetch; - int m_m, m_n, m_r; - - - igsSetBlank (igsvga, TRUE); - - t = KdFindMode (screen, igsModeSupported); - - igsGetClock (t->clock, &m, &n, &r, 2047, 255, 7, IGS_MIN_VCO); - - /* - * Set the chip so that 0x400000 is a big-endian frame buffer - * with the correct byte swapping enabled - */ - igsSet (igsvga, igs_biga22force, 0); - igsSet (igsvga, igs_biga22en, 1); - igsSet (igsvga, igs_biga24en, 1); - /* - * Enable 8-bit DACs - */ - igsSet (igsvga, igs_rampwdn, 0); - igsSet (igsvga, igs_dac6_8, 1); - igsSet (igsvga, igs_dacpwdn, 0); - /* - * Set overscan to black - */ - igsSet (igsvga, igs_overscan_red, 0x00); - igsSet (igsvga, igs_overscan_green, 0x00); - igsSet (igsvga, igs_overscan_blue, 0x00); - /* - * Enable PCI retries - */ - igsSet (igsvga, igs_iow_retry, 1); - igsSet (igsvga, igs_mw_retry, 1); - igsSet (igsvga, igs_mr_retry, 1); - igsSet (igsvga, igs_pci_burst_write, 1); - igsSet (igsvga, igs_pci_burst_read, 1); - /* - * Set FIFO - */ - igsSet (igsvga, igs_memgopg, 1); - igsSet (igsvga, igs_memr2wpg, 0); - igsSet (igsvga, igs_crtff16, 0); - igsSet (igsvga, igs_fifomust, 0xff); - igsSet (igsvga, igs_fifogen, 0xff); - /* - * Enable CRT reg access - */ - igsSetImm (igsvga, igs_ena_vr_access, 1); - igsSetImm (igsvga, igs_crt_protect, 0); - - hfp = t->hfp; - hbp = t->hbp; - hblank = t->hblank; - hactive = t->horizontal; - offset = screen->fb[0].byteStride; - - vfp = t->vfp; - vbp = t->vbp; - vblank = t->vblank; - vactive = t->vertical; - - /* - * Compute character lengths for horizontal timing values - */ - hactive = screen->width / 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - offset /= 8; - - switch (screen->fb[fb].bitsPerPixel) { - case 8: - igsSet (igsvga, igs_overscan_red, pScreen->blackPixel); - igsSet (igsvga, igs_overscan_green, pScreen->blackPixel); - igsSet (igsvga, igs_overscan_blue, pScreen->blackPixel); - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8); - igsSet (igsvga, igs_mode_sel, IGS_MODE_8); - igsSet (igsvga, igs_ramdacbypass, 0); - break; - case 16: - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_16); - igsSet (igsvga, igs_ramdacbypass, 1); - switch (screen->fb[fb].depth) { - case 12: - igsSet (igsvga, igs_mode_sel, IGS_MODE_4444); - break; - case 15: - igsSet (igsvga, igs_mode_sel, IGS_MODE_5551); - break; - case 16: - igsSet (igsvga, igs_mode_sel, IGS_MODE_565); - break; - } - break; - case 24: - igsSet (igsvga, igs_ramdacbypass, 1); - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8); - igsSet (igsvga, igs_mode_sel, IGS_MODE_888); - break; - case 32: - igsSet (igsvga, igs_ramdacbypass, 1); - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_32); - igsSet (igsvga, igs_mode_sel, IGS_MODE_8888); - break; - } - - /* - * Compute horizontal register values from timings - */ - h_total = hactive + hblank - 5; - h_display_end = hactive - 1; - - h_sync_start = hactive + hfp; - h_sync_end = hactive + hblank - hbp; - /* - * pad the blank values narrow a bit and use the border_select to - * eliminate the remaining border; don't know why, but it doesn't - * work in the documented fashion - */ - h_blank_start = hactive - 1; - h_blank_end = hactive + hblank - 1 - 1; - - num_fetch = (t->horizontal * screen->fb[fb].bitsPerPixel / 64) + 1; - - v_total = vactive + vblank - 2; - v_display_end = vactive - 1; - - v_blank_start = vactive - 1; - v_blank_end = v_blank_start + vblank - 1; - - v_retrace_start = vactive + vfp; - v_retrace_end = vactive + vblank - vbp; - -#if 0 -#define chk(a,b,c) fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", a, igsGet(igsvga, b), c); - - chk("h_total", igs_h_total, h_total); - chk("h_display_end", igs_h_de_end, h_display_end); - chk("h_sync_start", igs_h_rstart, h_sync_start); - chk("h_sync_end", igs_h_rend, h_sync_end&0x1f); - chk("h_blank_start", igs_h_bstart, h_blank_start); - chk("h_blank_end", igs_h_bend, h_blank_end&0x3f); - chk("offset", igs_offset, offset); - chk("num_fetch", igs_num_fetch, num_fetch); - - chk("v_total", igs_v_total, v_total); - chk("v_display_end", igs_v_de_end, v_display_end); - chk("v_blank_start", igs_v_bstart, v_blank_start); - chk("v_blank_end", igs_v_bend, v_blank_end&0xf); - chk("v_retrace_start", igs_v_rstart, v_retrace_start); - chk("v_retrace_end", igs_v_rend, v_retrace_end&0xf); - chk("vclk_m", igs_vclk_m, m); - chk("vclk_n", igs_vclk_n, n); - chk("vclk_p", igs_vclk_p, r); - - fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", "vclk", - IGS_CLOCK(igsGet(igsvga,igs_vclk_m), - igsGet(igsvga,igs_vclk_n), - igsGet(igsvga,igs_vclk_p)), - IGS_CLOCK(m,n,r)); -#endif - igsSet (igsvga, igs_h_total, h_total); - igsSet (igsvga, igs_h_de_end, h_display_end); - igsSet (igsvga, igs_h_rstart, h_sync_start); - igsSet (igsvga, igs_h_rend, h_sync_end); - igsSet (igsvga, igs_h_bstart, h_blank_start); - igsSet (igsvga, igs_h_bend, h_blank_end); - igsSet (igsvga, igs_offset, offset); - igsSet (igsvga, igs_num_fetch, num_fetch); - - igsSet (igsvga, igs_v_total, v_total); - igsSet (igsvga, igs_v_de_end, v_display_end); - igsSet (igsvga, igs_v_bstart, v_blank_start); - igsSet (igsvga, igs_v_bend, v_blank_end&0xf); - igsSet (igsvga, igs_v_rstart, v_retrace_start); - igsSet (igsvga, igs_v_rend, v_retrace_end&0xf); - - igsSet (igsvga, igs_vclk_m, m); - igsSet (igsvga, igs_vclk_n, n); - igsSet (igsvga, igs_vclk_p, r); - igsSet (igsvga, igs_vfsel, IGS_CLOCK(m, n, 0) >= 180000); - VgaFlush (&igsvga->card); - - igsSetImm (igsvga, igs_frqlat, 0); - igsSetImm (igsvga, igs_frqlat, 1); - igsSetImm (igsvga, igs_frqlat, 0); - - igsSetBlank (igsvga, FALSE); -#if 0 -#define dbg(a,b) fprintf(stderr, "%20.20s = 0x%x\n", a, igsGet(igsvga,b)) - -#include "reg.dbg" - - { - VGA16 reg; - char buf[128]; - - for (reg = 0; reg < IGS_NREG; reg++) - fprintf(stderr, "%20.20s = 0x%02x\n", igsRegName(buf, reg), - VgaFetch (&igsvga->card, reg)); - } -#endif - return TRUE; -} - -Bool -igsDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - IgsCardInfo *igsc = pScreenPriv->card->driver; - IgsVga *igsvga = &igsc->igsvga; - - switch (mode) { - case KD_DPMS_NORMAL: - igsSetSync (igsc, 0, 0); - igsSetBlank (igsvga, FALSE); - break; - case KD_DPMS_STANDBY: - igsSetBlank (igsvga, TRUE); - igsSetSync (igsc, 1, 0); - break; - case KD_DPMS_SUSPEND: - igsSetBlank (igsvga, TRUE); - igsSetSync (igsc, 0, 1); - break; - case KD_DPMS_POWERDOWN: - igsSetBlank (igsvga, TRUE); - igsSetSync (igsc, 1, 1); - break; - } - return TRUE; -} - -void -igsDisable (ScreenPtr pScreen) -{ -} - -void -igsRestore (KdCardInfo *card) -{ - IgsCardInfo *igsc = card->driver; - IgsVga *igsvga = &igsc->igsvga; - - igsReset (igsvga); -} - -void -igsScreenFini (KdScreenInfo *screen) -{ - IgsScreenInfo *igss = (IgsScreenInfo *) screen->driver; - -#if BITMAP_BIT_ORDER == MSBFirst - if (igss->cursor_base) - KdUnmapDevice ((void *) igss->cursor_base, 1024); -#endif - xfree (igss); - screen->driver = 0; -} - -void -igsCardFini (KdCardInfo *card) -{ - IgsCardInfo *igsc = card->driver; - - if (igsc->copData) - KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN); - if (igsc->cop) - KdUnmapDevice ((void *) igsc->cop, sizeof (Cop5xxx)); - if (igsc->vga) - KdUnmapDevice ((void *) igsc->vga, 64 * 1024); - if (igsc->frameBuffer) - KdUnmapDevice (igsc->frameBuffer, IGS_MEM); - xfree (igsc); - card->driver = 0; -} - -KdCardFuncs igsFuncs = { - igsCardInit, /* cardinit */ - igsScreenInit, /* scrinit */ - igsInitScreen, - igsPreserve, /* preserve */ - igsEnable, /* enable */ - igsDPMS, /* dpms */ - igsDisable, /* disable */ - igsRestore, /* restore */ - igsScreenFini, /* scrfini */ - igsCardFini, /* cardfini */ - - igsCursorInit, /* initCursor */ - igsCursorEnable, /* enableCursor */ - igsCursorDisable, /* disableCursor */ - igsCursorFini, /* finiCursor */ - 0, /* recolorCursor */ - - igsDrawInit, /* initAccel */ - igsDrawEnable, /* enableAccel */ - igsDrawSync, /* drawSync */ - igsDrawDisable, /* disableAccel */ - igsDrawFini, /* finiAccel */ - - igsGetColors, /* getColors */ - igsPutColors, /* putColors */ -}; diff --git a/hw/kdrive/igs/igs.h b/hw/kdrive/igs/igs.h deleted file mode 100644 index 264425022..000000000 --- a/hw/kdrive/igs/igs.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igs.h,v 1.1 2000/05/06 22:17:43 keithp Exp $ - * - * Copyright © 1999 SuSE, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifndef _IGS_H_ -#define _IGS_H_ - -#include "kdrive.h" -#include "igsreg.h" - -extern KdCardFuncs igsFuncs; - -/* - * FB 0x00000000 - * VGA 0x00800000 - * Blt window 0x008a0000 - * Coprocessor 0x008bf000 - */ - -#if BITMAP_BIT_ORDER == MSBFirst -#define IGS_FB 0x00400000 -#else -#define IGS_FB 0x00000000 -#endif -#define IGS_VGA 0x00800000 -#define IGS_COP_DATA 0x008a0000 -#define IGS_COP_DATA_LEN 0x00010000 -#define IGS_COP_OFFSET 0x008bf000 -/* give audio 1/2 meg at end */ -#if 1 -#define IGS_MEM ((4096-512)*1024) -#else -#define IGS_MEM ((4096)*1024) -#endif - -#define IGS_CLOCK_REF 24576 /* KHz */ - -#define IGS_SCALE(p) ((p) ? (2 * (p)) : 1) - -#define IGS_CLOCK(m,n,p) ((IGS_CLOCK_REF * ((m) + 1)) / (((n) + 1) * IGS_SCALE(p))) - -#define IGS_MAX_CLOCK 260000 - -#define IGS_MIN_VCO 115000 - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _Cop5xxx { - VOL8 pad000[0x10]; /* 0x000 */ - - VOL32 control; /* 0x010 */ -#define IGS_CONTROL_HBLTW_RDYZ 0x0100 -#define IGS_CONTROL_MALLWBEPTZ 0x0200 -#define IGS_CONTROL_CMDFF 0x0400 -#define IGS_CONTROL_SOP 0x0800 -#define IGS_CONTROL_OPS 0x1000 -#define IGS_CONTROL_TER 0x2000 -#define IGS_CONTROL_HBACKZ 0x4000 -#define IGS_CONTROL_BUSY 0x8000 - - VOL8 pad014[0x04]; /* 0x014 */ - - VOL32 src1_stride; /* 0x018 */ - - VOL32 format; /* 0x01c */ - -#define IGS_FORMAT_8BPP 0 -#define IGS_FORMAT_16BPP 1 -#define IGS_FORMAT_24BPP 2 -#define IGS_FORMAT_32BPP 3 - - VOL32 bres_error; /* 0x020 */ - VOL32 bres_k1; /* 0x024 */ - VOL32 bres_k2; /* 0x028 */ - VOL8 pad02c[0x1c]; /* 0x02c */ - - VOL32 mix; /* 0x048 */ -#define IGS_MIX_FG 0x00ff -#define IGS_MIX_BG 0xff00 -#define IGS_MAKE_MIX(fg,bg) ((fg) | ((bg) << 8)) - -#define IGS_MIX_ZERO 0x0 -#define IGS_MIX_SRC_AND_DST 0x1 -#define IGS_MIX_SRC_AND_NOT_DST 0x2 -#define IGS_MIX_SRC 0x3 -#define IGS_MIX_NOT_SRC_AND_DST 0x4 -#define IGS_MIX_DST 0x5 -#define IGS_MIX_SRC_XOR_DST 0x6 -#define IGS_MIX_SRC_OR_DST 0x7 -#define IGS_MIX_NOT_SRC_AND_NOT_DST 0x8 -#define IGS_MIX_SRC_XOR_NOT_DST 0x9 -#define IGS_MIX_NOT_DST 0xa -#define IGS_MIX_SRC_OR_NOT_DST 0xb -#define IGS_MIX_NOT_SRC 0xc -#define IGS_MIX_NOT_SRC_OR_DST 0xd -#define IGS_MIX_NOT_SRC_OR_NOT_DST 0xe -#define IGS_MIX_ONE 0xf - - VOL32 colorComp; /* 0x04c */ - VOL32 planemask; /* 0x050 */ - - VOL8 pad054[0x4]; /* 0x054 */ - - VOL32 fg; /* 0x058 */ - VOL32 bg; /* 0x05c */ - VOL32 dim; /* 0x060 */ -#define IGS_MAKE_DIM(w,h) ((w) | ((h) << 16)) - VOL8 pad5[0x0c]; /* 0x064 */ - - VOL32 src1_base_address; /* 0x070 */ - VOL8 pad074[0x04]; /* 0x074 */ - - VOL32 rotate; /* 0x078 */ -#define IGS_MAKE_ROTATE(x,y) ((x) | ((y) << 16)) - VOL32 operation; /* 0x07c */ - -/* OCT[2:0] */ -#define IGS_DRAW_X_MAJOR 0x00000000 -#define IGS_DRAW_Y_MAJOR 0x00000001 -#define IGS_DRAW_T_B 0x00000000 -#define IGS_DRAW_B_T 0x00000002 -#define IGS_DRAW_L_R 0x00000000 -#define IGS_DRAW_R_L 0x00000004 - -/* Draw_Mode[1:0] */ -#define IGS_DRAW_ALL 0x00000000 -#define IGS_DRAW_NOT_FIRST 0x00000010 -#define IGS_DRAW_NOT_LAST 0x00000020 -#define IGS_DRAW_NOT_FIRST_LAST 0x00000030 - -/* TRPS[1:0] */ -#define IGS_TRANS_SRC1 0x00000000 -#define IGS_TRANS_SRC2 0x00000100 -#define IGS_TRANS_DST 0x00000200 -/* TRPS2 Transparent Invert */ -#define IGS_TRANS_INVERT 0x00000400 -/* TRPS3, Transparent Enable */ -#define IGS_TRANS_ENABLE 0x00000800 - -/* PPS[3:0], Pattern Pixel Select */ -#define IGS_PIXEL_TEXT_OPAQUE 0x00001000 -#define IGS_PIXEL_STIP_OPAQUE 0x00002000 -#define IGS_PIXEL_LINE_OPAQUE 0x00003000 -#define IGS_PIXEL_TEXT_TRANS 0x00005000 -#define IGS_PIXEL_STIP_TRANS 0x00006000 -#define IGS_PIXEL_LINE_TRANS 0x00007000 -#define IGS_PIXEL_FG 0x00008000 -#define IGS_PIXEL_TILE 0x00009000 -#define IGS_PIXEL_TILE_OPAQUE 0x0000d000 - -/* HostBltEnable[1:0] */ -#define IGS_HBLT_DISABLE 0x00000000 -#define IGS_HBLT_READ 0x00010000 -#define IGS_HBLT_WRITE_1 0x00020000 -#define IGS_HBLT_WRITE_2 0x00030000 - -/* Src2MapSelect[2:0], Src2 map select mode */ -#define IGS_SRC2_NORMAL 0x00000000 -#define IGS_SRC2_MONO_OPAQUE 0x00100000 -#define IGS_SRC2_FG 0x00200000 -#define IGS_SRC2_MONO_TRANS 0x00500000 - -/* StepFunction[3:0], Step function select */ -#define IGS_STEP_DRAW_AND_STEP 0x04000000 -#define IGS_STEP_LINE_DRAW 0x05000000 -#define IGS_STEP_PXBLT 0x08000000 -#define IGS_STEP_INVERT_PXBLT 0x09000000 -#define IGS_STEP_TERNARY_PXBLT 0x0b000000 - -/* FGS */ -#define IGS_FGS_FG 0x00000000 -#define IGS_FGS_SRC 0x20000000 - -/* BGS */ -#define IGS_BGS_BG 0x00000000 -#define IGS_BGS_SRC 0x80000000 - VOL8 pad080[0x90]; /* 0x080 */ - - VOL32 debug_control; /* 0x110 */ - VOL8 pad114[0x04]; /* 0x114 */ - - VOL32 src2_stride; /* 0x118 */ - VOL8 pad11c[0x14]; /* 0x11c */ - - VOL32 extension; /* 0x130 */ - -#define IGS_BURST_ENABLE 0x01 -#define IGS_STYLE_LINE 0x02 -#define IGS_ADDITIONAL_WAIT 0x04 -#define IGS_BLOCK_COP_REG 0x08 -#define IGS_TURBO_MONO 0x10 -#define IGS_SELECT_SAMPLE 0x40 -#define IGS_MDSBL_RD_B_WR 0x80 -#define IGS_WRMRSTZ 0x100 -#define IGS_TEST_MTST 0x200 - - VOL32 style_line; /* 0x134 */ -#define IGS_MAKE_STILE_LINE(roll_over,inc,pattern,accumulator) \ - ((roll_over) | \ - ((style_line_inc) << 8) | \ - ((style_line_patern) << 16) | \ - ((style_line_accumullator) << 24)) - VOL32 style_line_pattern_index; /* 0x138 */ - - VOL32 mono_burst_total; /* 0x13c */ - VOL8 pad140[0x10]; /* 0x140 */ - - VOL32 pat_x_rotate; /* 0x150 */ - VOL8 pad154[0x1c]; /* 0x154 */ - - VOL32 src1_start; /* 0x170 */ - VOL32 src2_start; /* 0x174 */ - VOL32 dst_start; /* 0x178 */ - VOL8 pad17c[0x9c]; /* 0x17c */ - - VOL32 dst_stride; /* 0x218 */ -} Cop5xxx; - -typedef struct _igsCardInfo { - Cop5xxx *cop; - VOL8 *vga; - VOL32 *copData; - CARD8 *frameBuffer; - IgsVga igsvga; -} IgsCardInfo; - -#define getIgsCardInfo(kd) ((IgsCardInfo *) ((kd)->card->driver)) -#define igsCardInfo(kd) IgsCardInfo *igsc = getIgsCardInfo(kd) - -typedef struct _igsCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} IgsCursor; - -#define IGS_CURSOR_WIDTH 64 -#define IGS_CURSOR_HEIGHT 64 - -typedef struct _igsPattern { - INT32 xrot, yrot; - CARD32 serial_number; - CARD8 *base; - CARD32 offset; -} IgsPattern; - -#define IGS_NUM_PATTERN 8 -#define IGS_PATTERN_WIDTH 8 -#define IGS_PATTERN_HEIGHT 8 - -typedef struct _igsPatternCache { - CARD8 *base; - CARD32 offset; - IgsPattern pattern[IGS_NUM_PATTERN]; - int next; -} IgsPatternCache; - -typedef struct _igsScreenInfo { - CARD8 *cursor_base; - CARD32 cursor_offset; - IgsCursor cursor; - IgsPatternCache tile; - IgsPatternCache stipple; -} IgsScreenInfo; - -#define IgsTileSize(bpp) (IGS_PATTERN_WIDTH*(bpp)/8*IGS_PATTERN_HEIGHT) -#define IgsStippleSize(bpp) (IGS_PATTERN_WIDTH/8*IGS_PATTERN_HEIGHT) - -#define getIgsScreenInfo(kd) ((IgsScreenInfo *) ((kd)->screen->driver)) -#define igsScreenInfo(kd) IgsScreenInfo *igss = getIgsScreenInfo(kd) - -Bool -igsDrawInit (ScreenPtr pScreen); - -void -igsDrawEnable (ScreenPtr pScreen); - -void -igsDrawDisable (ScreenPtr pScreen); - -void -igsDrawSync (ScreenPtr pScreen); - -void -igsDrawFini (ScreenPtr pScreen); - -void -igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -void -igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -Bool -igsCursorInit (ScreenPtr pScreen); - -void -igsCursorEnable (ScreenPtr pScreen); - -void -igsCursorDisable (ScreenPtr pScreen); - -void -igsCursorFini (ScreenPtr pScreen); - -#endif /* _IGS_H_ */ diff --git a/hw/kdrive/igs/igscmap.c b/hw/kdrive/igs/igscmap.c deleted file mode 100644 index e6dc04e7b..000000000 --- a/hw/kdrive/igs/igscmap.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $RCSId: $ - * - * Copyright © 2000 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 "igs.h" - -#define IGS_DAC_SHIFT 8 -void -igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - IgsVga *igsvga = &igsc->igsvga; - - while (ndef--) - { - igsSetImm (igsvga, igs_dac_read_index, pdefs->pixel); - pdefs->red = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; - pdefs->green = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; - pdefs->blue = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; - pdefs++; - } -} - -void -igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - IgsVga *igsvga = &igsc->igsvga; - - while (ndef--) - { - igsSetImm (igsvga, igs_dac_write_index, pdefs->pixel); - igsSetImm (igsvga, igs_dac_data, pdefs->red >> IGS_DAC_SHIFT); - igsSetImm (igsvga, igs_dac_data, pdefs->green >> IGS_DAC_SHIFT); - igsSetImm (igsvga, igs_dac_data, pdefs->blue >> IGS_DAC_SHIFT); - pdefs++; - } -} - diff --git a/hw/kdrive/igs/igscurs.c b/hw/kdrive/igs/igscurs.c deleted file mode 100644 index 6bdc61658..000000000 --- a/hw/kdrive/igs/igscurs.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * $RCSId: $ - * - * Copyright © 2000 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 "igs.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - igsCardInfo(pScreenPriv); \ - igsScreenInfo(pScreenPriv); \ - IgsCursor *pCurPriv = &igss->cursor; \ - IgsVga *igsvga = &igsc->igsvga - -static void -_igsMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - 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; - } - - igsSet (igsvga, igs_sprite_x, x); - igsSet (igsvga, igs_sprite_preset_x, xoff); - igsSet (igsvga, igs_sprite_y, y); - igsSet (igsvga, igs_sprite_preset_y, yoff); -} - -static void -igsMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _igsMoveCursor (pScreen, x, y); - VgaFlush (&igsvga->card); -} - - -static void -igsSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - igsSetImm (igsvga, igs_cursor_write_index, 0); - igsSetImm (igsvga, igs_cursor_data, pCursor->backRed >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->backGreen >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->backBlue >> 8); - igsSetImm (igsvga, igs_cursor_write_index, 1); - igsSetImm (igsvga, igs_cursor_data, pCursor->foreRed >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->foreGreen >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->foreBlue >> 8); -} - -#if BITMAP_BIT_ORDER == MSBFirst -#define IgsAdjustCursor(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ - v = ((v & 0x00ff00ff) << 8) | ((v >> 8) & 0x00ff00ff); \ - v = ((v & 0x0000ffff) <<16) | ((v >>16) & 0x0000ffff); \ -} -#else -#define IgsAdjustCursor(v) -#endif - -#define ExplodeBits2(v) (((v) & 1) | (((v) & 2) << 1)) -#define ExplodeBits4(v) ((ExplodeBits2((v) >> 2) << 4) | \ - (ExplodeBits2((v) & 0x3))) -#define ExplodeBits8(v) ((ExplodeBits4((v) >> 4) << 8) | \ - (ExplodeBits4((v) & 0xf))) -#define ExplodeBits16(v) ((ExplodeBits8((v) >> 8) << 16) | \ - (ExplodeBits8((v) & 0xff))) -static void -igsLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - CARD32 b0, b1; - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (CARD32 *) igss->cursor_base; - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > IGS_CURSOR_HEIGHT) - h = IGS_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ - - for (i = 0; i < IGS_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < IGS_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - IgsAdjustCursor(m); - IgsAdjustCursor(s); - } - else - { - m = 0; - s = 0; - } - s &= m; - m = ~m; - b0 = ExplodeBits16(s&0xffff) | (ExplodeBits16(m&0xffff)<<1); - b1 = ExplodeBits16(s>>16) | (ExplodeBits16(m>>16)<<1); - *ram++ = b0; - *ram++ = b1; - } - } - - /* Set new color */ - igsSetCursorColors (pScreen); - - /* Set address for cursor bits */ - offset = igss->cursor_offset; - offset >>= 10; - igsSet (igsvga, igs_sprite_addr, offset); - - /* Assume TV interpolation off */ - igsSet (igsvga, igs_hcshf, 3); - /* Enable the cursor */ - igsSet (igsvga, igs_sprite_visible, 1); - igsSet (igsvga, igs_sprite_64x64, 1); - /* Move to new position */ - _igsMoveCursor (pScreen, x, y); - - VgaFlush (&igsvga->card); -} - -static void -igsUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - igsSet (igsvga, igs_sprite_visible, 0); - VgaFlush (&igsvga->card); -} - -static Bool -igsRealizeCursor (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); - igsLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -igsUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -igsSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - igsLoadCursor (pScreen, x, y); - else - igsUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec igsPointerSpriteFuncs = { - igsRealizeCursor, - igsUnrealizeCursor, - igsSetCursor, - igsMoveCursor, -}; - -static void -igsQueryBestSize (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 -igsCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!igss->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = IGS_CURSOR_WIDTH; - pCurPriv->height= IGS_CURSOR_HEIGHT; - pScreen->QueryBestSize = igsQueryBestSize; - miPointerInitialize (pScreen, - &igsPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -igsCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - igsLoadCursor (pScreen, x, y); - } - else - igsUnloadCursor (pScreen); - } -} - -void -igsCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - igsUnloadCursor (pScreen); - } - } -} - -void -igsCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/igs/igsdraw.c b/hw/kdrive/igs/igsdraw.c deleted file mode 100644 index d92ea6653..000000000 --- a/hw/kdrive/igs/igsdraw.c +++ /dev/null @@ -1,1538 +0,0 @@ -/* - * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsdraw.c,v 1.1 2000/05/06 22:17:43 keithp Exp $ - * - * Copyright © 2000 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 "igs.h" -#include "igsdraw.h" - -#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" - -CARD8 igsPatRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -/* - * Handle pixel transfers - */ - -#define BURST -#ifdef BURST -#define PixTransDeclare VOL32 *pix_trans_base = igsc->copData,\ - *pix_trans = pix_trans_base -#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 16384) pix_trans = pix_trans_base -#define PixTransStore(t) *pix_trans++ = (t) -#else -#define PixTransDeclare VOL32 *pix_trans = igsc->copData -#define PixTransStart(n) -#define PixTransStore(t) *pix_trans = (t) -#endif - -static IgsPattern * -igsSetPattern (ScreenPtr pScreen, - PixmapPtr pPixmap, - CARD8 fillStyle, - INT32 xrot, - INT32 yrot) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - igsScreenInfo(pScreenPriv); - int i; - IgsPatternCache *c; - IgsPattern *p; - - if (fillStyle == FillTiled) - c = &igss->tile; - else - c = &igss->stipple; - for (i = 0; i < IGS_NUM_PATTERN; i++) - { - p = &c->pattern[i]; - if (p->serial_number == pPixmap->drawable.serialNumber && - p->xrot == xrot && - p->yrot == yrot) - { - return p; - } - } - p = &c->pattern[c->next]; - if (++c->next == IGS_NUM_PATTERN) - c->next = 0; - p->serial_number = pPixmap->drawable.serialNumber; - p->xrot = xrot; - p->yrot = yrot; - - if (fillStyle != FillTiled) - { - FbStip *pix; - FbStride pixStride; - int pixBpp; - int pixXoff, pixYoff; - CARD8 tmp[8]; - CARD32 *pat; - int stipX, stipY; - int y; - FbStip bits; - - fbGetStipDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, pixXoff, pixYoff); - - modulus (-yrot - pixYoff, pPixmap->drawable.height, stipY); - modulus (-xrot - pixXoff, FB_UNIT, stipX); - - pat = (CARD32 *) p->base; - - for (y = 0; y < 8; y++) - { - bits = pix[stipY * pixStride]; - FbRotLeft (bits, stipX); - tmp[y] = (CARD8) bits; - stipY++; - if (stipY == pPixmap->drawable.height) - stipY = 0; - } - for (i = 0; i < 2; i++) - { - bits = (tmp[i*4+0] | - (tmp[i*4+1] << 8) | - (tmp[i*4+2] << 16) | - (tmp[i*4+3] << 24)); - IgsAdjustBits32 (bits); - *pat++ = bits; - } - } - else - { - FbBits *pix; - FbStride pixStride; - int pixBpp; - FbBits *pat; - FbStride patStride; - int patBpp; - int patXoff, patYoff; - - fbGetDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, patXoff, patYoff); - - pat = (FbBits *) p->base; - patBpp = pixBpp; - patStride = (patBpp * IGS_PATTERN_WIDTH) / (8 * sizeof (FbBits)); - - fbTile (pat, patStride, 0, - patBpp * IGS_PATTERN_WIDTH, IGS_PATTERN_HEIGHT, - - pix, pixStride, - pPixmap->drawable.width * pixBpp, - pPixmap->drawable.height, - GXcopy, FB_ALLONES, pixBpp, - (xrot - patXoff) * pixBpp, yrot - patYoff); - } - return p; -} - -void -igsFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - - _igsSetSolidRect(cop,alu,planemask,pixel,cmd); - while (nBox--) - { - _igsRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -void -igsFillBoxTiled (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - PixmapPtr pPixmap, int xrot, int yrot, int alu) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - IgsPattern *p = igsSetPattern (pDrawable->pScreen, - pPixmap, - FillTiled, - xrot, yrot); - - _igsSetTiledRect(cop,alu,planemask,p->offset,cmd); - while (nBox--) - { - _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -void -igsFillBoxStippled (DrawablePtr pDrawable, GCPtr pGC, - int nBox, BoxPtr pBox) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int xrot = pGC->patOrg.x + pDrawable->x; - int yrot = pGC->patOrg.y + pDrawable->y; - IgsPattern *p = igsSetPattern (pDrawable->pScreen, - pGC->stipple, - pGC->fillStyle, - xrot, yrot); - if (pGC->fillStyle == FillStippled) - { - _igsSetStippledRect (cop,pGC->alu,planemask,pGC->fgPixel,p->offset,cmd); - } - else - { - _igsSetOpaqueStippledRect (cop,pGC->alu,planemask, - pGC->fgPixel,pGC->bgPixel,p->offset,cmd); - } - while (nBox--) - { - _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - - -void -igsStipple (ScreenPtr pScreen, - CARD32 cmd, - FbStip *psrcBase, - FbStride widthSrc, - int srcx, - int srcy, - int dstx, - int dsty, - int width, - int height) -{ - SetupIgs(pScreen); - FbStip *psrcLine, *psrc; - FbStride widthRest; - FbStip bits, tmp, lastTmp; - int leftShift, rightShift; - int nl, nlMiddle; - int r; - PixTransDeclare; - - /* Compute blt address and parameters */ - psrc = psrcBase + srcy * widthSrc + (srcx >> 5); - nlMiddle = (width + 31) >> 5; - leftShift = srcx & 0x1f; - rightShift = 32 - leftShift; - widthRest = widthSrc - nlMiddle; - - _igsPlaneBlt(cop,dstx,dsty,width,height,cmd); - - if (leftShift == 0) - { - while (height--) - { - nl = nlMiddle; - PixTransStart(nl); - while (nl--) - { - tmp = *psrc++; - IgsAdjustBits32 (tmp); - PixTransStore (tmp); - } - psrc += widthRest; - } - } - else - { - widthRest--; - while (height--) - { - bits = *psrc++; - nl = nlMiddle; - PixTransStart(nl); - while (nl--) - { - tmp = FbStipLeft(bits, leftShift); - bits = *psrc++; - tmp |= FbStipRight(bits, rightShift); - IgsAdjustBits32(tmp); - PixTransStore (tmp); - } - psrc += widthRest; - } - } -} - -void -igsCopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupIgs(pDstDrawable->pScreen); - int srcX, srcY, dstX, dstY; - int w, h; - CARD32 flags; - CARD32 cmd; - CARD8 alu; - - if (pGC) - { - alu = pGC->alu; - if (sourceInvarient (pGC->alu)) - { - igsFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); - return; - } - } - else - alu = GXcopy; - - _igsSetBlt(cop,alu,pGC->planemask,reverse,upsidedown,cmd); - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - if (reverse) - dstX = pbox->x2 - 1; - else - dstX = pbox->x1; - srcX = dstX + dx; - - if (upsidedown) - dstY = pbox->y2 - 1; - else - dstY = pbox->y1; - - srcY = dstY + dy; - - _igsBlt (cop, srcX, srcY, dstX, dstY, w, h, cmd); - pbox++; - } - KdMarkSync (pDstDrawable->pScreen); -} - -RegionPtr -igsCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - KdScreenPriv(pDstDrawable->pScreen); - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pSrcDrawable->type == DRAWABLE_WINDOW && - pDstDrawable->type == DRAWABLE_WINDOW) - { - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, igsCopyNtoN, 0, 0); - } - return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, dsty); -} - -typedef struct _igs1toNargs { - unsigned long copyPlaneFG, copyPlaneBG; - Bool opaque; -} igs1toNargs; - -void -igsCopy1toN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupIgs(pDstDrawable->pScreen); - - igs1toNargs *args = closure; - int dstx, dsty; - FbStip *psrcBase; - FbStride widthSrc; - int srcBpp; - int srcXoff, srcYoff; - CARD32 cmd; - - if (args->opaque && sourceInvarient (pGC->alu)) - { - igsFillBoxSolid (pDstDrawable, nbox, pbox, - pGC->bgPixel, pGC->alu, pGC->planemask); - return; - } - - fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); - - if (args->opaque) - { - _igsSetOpaquePlaneBlt (cop, pGC->alu, pGC->planemask, args->copyPlaneFG, - args->copyPlaneBG, cmd); - } - else - { - _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, - args->copyPlaneFG, cmd); - } - - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - - igsStipple (pDstDrawable->pScreen, cmd, - psrcBase, widthSrc, - dstx + dx - srcXoff, dsty + dy - srcYoff, - dstx, dsty, - pbox->x2 - dstx, pbox->y2 - dsty); - pbox++; - } - KdMarkSync (pDstDrawable->pScreen); -} - -RegionPtr -igsCopyPlane (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty, - unsigned long bitPlane) -{ - RegionPtr ret; - igs1toNargs args; - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pDstDrawable->type == DRAWABLE_WINDOW && - pSrcDrawable->depth == 1) - { - args.copyPlaneFG = pGC->fgPixel; - args.copyPlaneBG = pGC->bgPixel; - args.opaque = TRUE; - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, igsCopy1toN, bitPlane, &args); - } - return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); -} - -#if 0 -/* would you believe this is slower than fb? */ -void -igsPushPixels (GCPtr pGC, - PixmapPtr pBitmap, - DrawablePtr pDrawable, - int w, - int h, - int x, - int y) -{ - igs1toNargs args; - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pDrawable->type == DRAWABLE_WINDOW && - pGC->fillStyle == FillSolid) - { - args.opaque = FALSE; - args.copyPlaneFG = pGC->fgPixel; - (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC, - 0, 0, w, h, x, y, igsCopy1toN, 1, &args); - } - else - { - KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); - } -} -#else -#define igsPushPixels KdCheckPushPixels -#endif - -BOOL -igsFillOk (GCPtr pGC) -{ - FbBits depthMask; - - depthMask = FbFullMask(pGC->depth); - if ((pGC->planemask & depthMask) != depthMask) - return FALSE; - switch (pGC->fillStyle) { - case FillSolid: - return TRUE; - case FillTiled: - return (igsPatternDimOk (pGC->tile.pixmap->drawable.width) && - igsPatternDimOk (pGC->tile.pixmap->drawable.height)); - case FillStippled: - case FillOpaqueStippled: - return (igsPatternDimOk (pGC->stipple->drawable.width) && - igsPatternDimOk (pGC->stipple->drawable.height)); - } - return FALSE; -} - -void -igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - SetupIgs(pDrawable->pScreen); - DDXPointPtr pptFree; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - int *pwidthFree;/* copies of the pointers to free */ - CARD32 cmd; - int nTmp; - INT16 x, y; - int width; - IgsPattern *p; - - if (!igsFillOk (pGC)) - { - KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); - return; - } - nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); - pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) DEALLOCATE_LOCAL(pptFree); - if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); - return; - } - n = miClipSpans(fbGetCompositeClip(pGC), - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - switch (pGC->fillStyle) { - case FillSolid: - _igsSetSolidRect(cop,pGC->alu,pGC->planemask,pGC->fgPixel,cmd); - break; - case FillTiled: - p = igsSetPattern (pDrawable->pScreen, - pGC->tile.pixmap, - FillTiled, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y); - _igsSetTiledRect (cop,pGC->alu,pGC->planemask,p->offset,cmd); - break; - default: - p = igsSetPattern (pDrawable->pScreen, - pGC->stipple, - pGC->fillStyle, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y); - if (pGC->fillStyle == FillStippled) - { - _igsSetStippledRect (cop,pGC->alu,pGC->planemask, - pGC->fgPixel,p->offset,cmd); - } - else - { - _igsSetOpaqueStippledRect (cop,pGC->alu,pGC->planemask, - pGC->fgPixel,pGC->bgPixel,p->offset,cmd); - } - break; - } - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - width = *pwidth++; - if (width) - { - _igsPatRect(cop,x,y,width,1,cmd); - } - } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); - KdMarkSync (pDrawable->pScreen); -} - -#define NUM_STACK_RECTS 1024 - -void -igsPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - SetupIgs(pDrawable->pScreen); - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); - int numRects; - int n; - int xorg, yorg; - int x, y; - - if (!igsFillOk (pGC)) - { - KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); - return; - } - prgnClip = fbGetCompositeClip (pGC); - xorg = pDrawable->x; - yorg = pDrawable->y; - - if (xorg || yorg) - { - prect = prectInit; - n = nrectFill; - while(n--) - { - prect->x += xorg; - prect->y += yorg; - prect++; - } - } - - prect = prectInit; - - numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; - if (numRects > NUM_STACK_RECTS) - { - pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec)); - if (!pboxClippedBase) - return; - } - else - pboxClippedBase = stackRects; - - pboxClipped = pboxClippedBase; - - if (REGION_NUM_RECTS(prgnClip) == 1) - { - int x1, y1, x2, y2, bx2, by2; - - pextent = REGION_RECTS(prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) - { - if ((pboxClipped->x1 = prect->x) < x1) - pboxClipped->x1 = x1; - - if ((pboxClipped->y1 = prect->y) < y1) - pboxClipped->y1 = y1; - - bx2 = (int) prect->x + (int) prect->width; - if (bx2 > x2) - bx2 = x2; - pboxClipped->x2 = bx2; - - by2 = (int) prect->y + (int) prect->height; - if (by2 > y2) - by2 = y2; - pboxClipped->y2 = by2; - - prect++; - if ((pboxClipped->x1 < pboxClipped->x2) && - (pboxClipped->y1 < pboxClipped->y2)) - { - pboxClipped++; - } - } - } - else - { - int x1, y1, x2, y2, bx2, by2; - - pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); - x1 = pextent->x1; - y1 = pextent->y1; - x2 = pextent->x2; - y2 = pextent->y2; - while (nrectFill--) - { - BoxRec box; - - if ((box.x1 = prect->x) < x1) - box.x1 = x1; - - if ((box.y1 = prect->y) < y1) - box.y1 = y1; - - bx2 = (int) prect->x + (int) prect->width; - if (bx2 > x2) - bx2 = x2; - box.x2 = bx2; - - by2 = (int) prect->y + (int) prect->height; - if (by2 > y2) - by2 = y2; - box.y2 = by2; - - prect++; - - if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) - continue; - - n = REGION_NUM_RECTS (prgnClip); - pbox = REGION_RECTS(prgnClip); - - /* clip the rectangle to each box in the clip region - this is logically equivalent to calling Intersect() - */ - while(n--) - { - pboxClipped->x1 = max(box.x1, pbox->x1); - pboxClipped->y1 = max(box.y1, pbox->y1); - pboxClipped->x2 = min(box.x2, pbox->x2); - pboxClipped->y2 = min(box.y2, pbox->y2); - pbox++; - - /* see if clipping left anything */ - if(pboxClipped->x1 < pboxClipped->x2 && - pboxClipped->y1 < pboxClipped->y2) - { - pboxClipped++; - } - } - } - } - if (pboxClipped != pboxClippedBase) - { - switch (pGC->fillStyle) { - case FillSolid: - igsFillBoxSolid(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->fgPixel, pGC->alu, pGC->planemask); - break; - case FillTiled: - igsFillBoxTiled(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->tile.pixmap, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y, - pGC->alu); - break; - case FillStippled: - case FillOpaqueStippled: - igsFillBoxStippled (pDrawable, pGC, - pboxClipped-pboxClippedBase, pboxClippedBase); - break; - } - } - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} - -int -igsTextInRegion (GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppci) -{ - int w; - FontPtr pfont = pGC->font; - BoxRec bbox; - - if (FONTCONSTMETRICS(pfont)) - w = FONTMAXBOUNDS(pfont,characterWidth) * nglyph; - else - { - w = 0; - while (nglyph--) - w += (*ppci++)->metrics.characterWidth; - } - if (w < 0) - { - bbox.x1 = x + w; - bbox.x2 = x; - } - else - { - bbox.x1 = x; - bbox.x2 = x + w; - } - w = FONTMINBOUNDS(pfont,leftSideBearing); - if (w < 0) - bbox.x1 += w; - w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); - if (w > 0) - bbox.x2 += w; - bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); - bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); - - return RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox); -} - -void -igsGlyphBltClipped (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - Bool image) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int h; - int w; - int xBack, yBack; - int hBack, wBack; - int lw; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *bits; - BoxPtr extents; - BoxRec bbox; - CARD32 b; - CharInfoPtr *ppci; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - RegionPtr pClip = fbGetCompositeClip(pGC); - BoxPtr pBox; - int nbox; - int x1, y1, x2, y2; - unsigned char alu; - Bool set; - PixTransDeclare; - - if (image) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - h = nglyph; - ppci = ppciInit; - while (h--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - if (wBack) - { - _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd); - for (nbox = REGION_NUM_RECTS (pClip), - pBox = REGION_RECTS (pClip); - nbox--; - pBox++) - { - x1 = xBack; - x2 = xBack + wBack; - y1 = yBack; - y2 = yBack + hBack; - if (x1 < pBox->x1) x1 = pBox->x1; - if (x2 > pBox->x2) x2 = pBox->x2; - if (y1 < pBox->y1) y1 = pBox->y1; - if (y2 > pBox->y2) y2 = pBox->y2; - if (x1 < x2 && y1 < y2) - { - _igsRect (cop, x1, y1, x2 - x1, y2 - y1, cmd); - } - } - KdMarkSync (pDrawable->pScreen); - } - } - else - { - wBack = 0; - alu = pGC->alu; - } - - ppci = ppciInit; - set = FALSE; - while (nglyph--) - { - pci = *ppci++; - h = pci->metrics.ascent + pci->metrics.descent; - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - x1 = x + pci->metrics.leftSideBearing; - y1 = y - pci->metrics.ascent; - bbox.x1 = x1; - bbox.y1 = y1; - bbox.x2 = x1 + w; - bbox.y2 = y1 + h; - switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox)) - { - case rgnIN: - lw = h * ((w + 31) >> 5); - if (lw) - { - if (!set) - { - _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd); - set = TRUE; - } - _igsPlaneBlt(cop, - x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, - w, h, cmd); - bits = (unsigned long *) pci->bits; - PixTransStart (lw); - while (lw--) - { - b = *bits++; - IgsAdjustBits32 (b); - PixTransStore(b); - } - KdMarkSync (pDrawable->pScreen); - } - break; - case rgnPART: - set = FALSE; - KdCheckSync (pDrawable->pScreen); - fbPutXYImage (pDrawable, - pClip, - fbPriv->fg, - fbPriv->bg, - fbPriv->pm, - alu, - FALSE, - x1, y1, - w, h, - (FbStip *) pci->bits, - (w + 31) >> 5, - 0); - break; - case rgnOUT: - break; - } - x += pci->metrics.characterWidth; - } -} - -void -igsGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - Bool image) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int h; - int w; - int xBack, yBack; - int hBack, wBack; - int lw; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *bits; - BoxPtr extents; - BoxRec bbox; - CARD32 b; - CharInfoPtr *ppci; - unsigned char alu; - PixTransDeclare; - - /* - * Paint background for image text - */ - if (image) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - h = nglyph; - ppci = ppciInit; - while (h--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - if (wBack) - { - _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd); - _igsRect (cop, xBack, yBack, wBack, hBack, cmd); - } - } - else - { - wBack = 0; - alu = pGC->alu; - } - - _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd); - ppci = ppciInit; - while (nglyph--) - { - pci = *ppci++; - h = pci->metrics.ascent + pci->metrics.descent; - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - lw = h * ((w + 31) >> 5); - if (lw) - { - _igsPlaneBlt(cop, - x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, - w, h, cmd); - bits = (unsigned long *) pci->bits; - PixTransStart(lw); - while (lw--) - { - b = *bits++; - IgsAdjustBits32 (b); - PixTransStore(b); - } - } - x += pci->metrics.characterWidth; - } - KdMarkSync (pDrawable->pScreen); -} - -void -igsTEGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, - int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - Bool image) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int x, y; - int h, lw, lwTmp; - int w; - FontPtr pfont = pGC->font; - unsigned long *char1, *char2, *char3, *char4; - int widthGlyphs, widthGlyph; - BoxRec bbox; - CARD32 tmp; - PixTransDeclare; - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - if (!widthGlyph) - return; - - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - if (!h) - return; - - x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing); - y = yInit - FONTASCENT(pfont); - - if (image) - { - _igsSetOpaquePlaneBlt (cop, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel, cmd); - } - else - { - _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, pGC->fgPixel, cmd); - } - -#if BITMAP_BIT_ORDER == LSBFirst -#define SHIFT << -#else -#define SHIFT >> -#endif - -#define LoopIt(count, w, loadup, fetch) \ - while (nglyph >= count) \ - { \ - nglyph -= count; \ - _igsPlaneBlt (cop, x, y, w, h, cmd); \ - x += w; \ - loadup \ - lwTmp = h; \ - PixTransStart(h); \ - while (lwTmp--) { \ - tmp = fetch; \ - IgsAdjustBits32(tmp); \ - PixTransStore(tmp); \ - } \ - } - - if (widthGlyph <= 8) - { - widthGlyphs = widthGlyph << 2; - LoopIt(4, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits; - char4 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | ((*char3++ | (*char4++ - SHIFT widthGlyph)) - SHIFT widthGlyph)) - SHIFT widthGlyph))) - } - else if (widthGlyph <= 10) - { - widthGlyphs = (widthGlyph << 1) + widthGlyph; - LoopIt(3, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph))) - } - else if (widthGlyph <= 16) - { - widthGlyphs = widthGlyph << 1; - LoopIt(2, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | (*char2++ SHIFT widthGlyph))) - } - lw = h * ((widthGlyph + 31) >> 5); - while (nglyph--) - { - _igsPlaneBlt (cop, x, y, widthGlyph, h, cmd); - x += widthGlyph; - char1 = (unsigned long *) (*ppci++)->bits; - lwTmp = lw; - PixTransStart(lw); - while (lwTmp--) - { - tmp = *char1++; - IgsAdjustBits32(tmp); - PixTransStore(tmp); - } - } - KdMarkSync (pDrawable->pScreen); -} - -/* - * Blt glyphs using image transfer window - */ - -void -igsPolyGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - if (pGC->fillStyle != FillSolid || - fbGetGCPrivate(pGC)->pm != FB_ALLONES) - { - KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - return; - } - x += pDrawable->x; - y += pDrawable->y; - - switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) { - case rgnIN: - if (TERMINALFONT(pGC->font)) - igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE); - else - igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE); - break; - case rgnPART: - igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, FALSE); - break; - case rgnOUT: - break; - } -} - -void -igsImageGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - if (fbGetGCPrivate(pGC)->pm != FB_ALLONES) - { - KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - return; - } - x += pDrawable->x; - y += pDrawable->y; - - switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) { - case rgnIN: - if (TERMINALFONT(pGC->font)) - igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE); - else - igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE); - break; - case rgnPART: - igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, TRUE); - break; - case rgnOUT: - break; - } -} - -static void -igsInvalidatePattern (IgsPatternCache *c, - PixmapPtr pPixmap) -{ - int i; - - if (c->base) - { - for (i = 0; i < IGS_NUM_PATTERN; i++) - { - if (c->pattern[i].serial_number == pPixmap->drawable.serialNumber) - c->pattern[i].serial_number = ~0; - } - } -} - -static void -igsInitPattern (IgsPatternCache *c, int bsize, int psize) -{ - int i; - int boffset; - int poffset; - - for (i = 0; i < IGS_NUM_PATTERN; i++) - { - boffset = i * bsize; - poffset = i * psize; - c->pattern[i].xrot = -1; - c->pattern[i].yrot = -1; - c->pattern[i].serial_number = ~0; - c->pattern[i].offset = c->offset + poffset; - c->pattern[i].base = c->base + boffset; - } - c->next = 0; -} - -static const GCOps igsOps = { - igsFillSpans, - KdCheckSetSpans, - KdCheckPutImage, - igsCopyArea, - igsCopyPlane, - KdCheckPolyPoint, - KdCheckPolylines, - KdCheckPolySegment, - miPolyRectangle, - KdCheckPolyArc, - miFillPolygon, - igsPolyFillRect, - KdCheckPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - igsImageGlyphBlt, - igsPolyGlyphBlt, - igsPushPixels, -#ifdef NEED_LINEHELPER - ,NULL -#endif -}; - -void -igsValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) -{ - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - - fbValidateGC (pGC, changes, pDrawable); - - if (pDrawable->type == DRAWABLE_WINDOW) - pGC->ops = (GCOps *) &igsOps; - else - pGC->ops = (GCOps *) &fbGCOps; -} - -GCFuncs igsGCFuncs = { - igsValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -int -igsCreateGC (GCPtr pGC) -{ - if (!fbCreateGC (pGC)) - return FALSE; - - if (pGC->depth != 1) - pGC->funcs = &igsGCFuncs; - - return TRUE; -} - -void -igsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - KdScreenPriv(pScreen); - RegionRec rgnDst; - int dx, dy; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - - REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); - - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - 0, - &rgnDst, dx, dy, igsCopyNtoN, 0, 0); - - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - -void -igsPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) -{ - KdScreenPriv(pWin->drawable.pScreen); - PixmapPtr pTile; - - if (!REGION_NUM_RECTS(pRegion)) - return; - switch (what) { - case PW_BACKGROUND: - switch (pWin->backgroundState) { - case None: - return; - case ParentRelative: - do { - pWin = pWin->parent; - } while (pWin->backgroundState == ParentRelative); - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, - what); - return; - case BackgroundPixmap: - pTile = pWin->background.pixmap; - if (igsPatternDimOk (pTile->drawable.width) && - igsPatternDimOk (pTile->drawable.height)) - { - igsFillBoxTiled ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pTile, - pWin->drawable.x, pWin->drawable.y, GXcopy); - return; - } - break; - case BackgroundPixel: - igsFillBoxSolid((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pWin->background.pixel, GXcopy, ~0); - return; - } - break; - case PW_BORDER: - if (pWin->borderIsPixel) - { - igsFillBoxSolid((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pWin->border.pixel, GXcopy, ~0); - return; - } - else - { - pTile = pWin->border.pixmap; - if (igsPatternDimOk (pTile->drawable.width) && - igsPatternDimOk (pTile->drawable.height)) - { - igsFillBoxTiled ((DrawablePtr)pWin, - (int)REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), - pTile, - pWin->drawable.x, pWin->drawable.y, GXcopy); - return; - } - } - break; - } - KdCheckPaintWindow (pWin, pRegion, what); -} - -Bool -igsDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - igsScreenInfo(pScreenPriv); - int i; - int pattern_size; - int boffset, poffset; - - KdScreenInitAsync (pScreen); - - /* - * Replace various fb screen functions - */ - pScreen->CreateGC = igsCreateGC; - pScreen->CopyWindow = igsCopyWindow; - pScreen->PaintWindowBackground = igsPaintWindow; - pScreen->PaintWindowBorder = igsPaintWindow; - - /* - * Initialize patterns - */ - if (igss->tile.base) - { - pattern_size = IgsTileSize(pScreenPriv->screen->fb[0].bitsPerPixel); - igsInitPattern (&igss->tile, - pattern_size, - pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel); - pattern_size = IgsStippleSize(pScreenPriv->screen->fb[0].bitsPerPixel); - igsInitPattern (&igss->stipple, - pattern_size, - pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel); - } - return TRUE; -} - -void -igsDrawEnable (ScreenPtr pScreen) -{ - SetupIgs(pScreen); - CARD32 cmd; - CARD32 base; - CARD16 stride; - CARD32 format; - - stride = pScreenPriv->screen->fb[0].pixelStride; - _igsWaitIdleEmpty(cop); - _igsReset(cop); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - format = IGS_FORMAT_8BPP; - break; - case 16: - format = IGS_FORMAT_16BPP; - break; - case 24: - format = IGS_FORMAT_24BPP; - break; - case 32: - format = IGS_FORMAT_32BPP; - break; - } - cop->format = format; - cop->dst_stride = stride - 1; - cop->src1_stride = stride - 1; - cop->src2_stride = stride - 1; - cop->src1_start = 0; - cop->src2_start = 0; - cop->extension |= IGS_BLOCK_COP_REG | IGS_BURST_ENABLE; - - _igsSetSolidRect(cop, GXcopy, ~0, pScreen->blackPixel, cmd); - _igsRect (cop, 0, 0, - pScreenPriv->screen->width, pScreenPriv->screen->height, - cmd); - _igsWaitIdleEmpty (cop); -} - -void -igsDrawDisable (ScreenPtr pScreen) -{ -} - -void -igsDrawFini (ScreenPtr pScreen) -{ -} - -void -igsDrawSync (ScreenPtr pScreen) -{ - SetupIgs(pScreen); - - _igsWaitIdleEmpty(cop); -} diff --git a/hw/kdrive/igs/igsdraw.h b/hw/kdrive/igs/igsdraw.h deleted file mode 100644 index c969826b1..000000000 --- a/hw/kdrive/igs/igsdraw.h +++ /dev/null @@ -1,260 +0,0 @@ -/* - * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsdraw.h,v 1.1 2000/05/06 22:17:43 keithp Exp $ - * - * Copyright © 2000 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. - */ - -#ifndef _IGSDRAW_H_ -#define _IGSDRAW_H_ - -extern CARD8 igsPatRop[]; - -#define SetupIgs(s) KdScreenPriv(s); \ - igsCardInfo(pScreenPriv); \ - Cop5xxx *cop = igsc->cop; \ - int cop_stride = pScreenPriv->screen->fb[0].pixelStride - -#define _igsWaitLoop(cop,mask,value) { \ - int __loop = 1000000; \ - while (((cop)->control & (mask)) != (value)) { \ - if (--__loop <= 0) { \ - FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \ - } \ - } \ -} - -#define _igsWaitDone(cop) _igsWaitLoop(cop, \ - (IGS_CONTROL_BUSY| \ - IGS_CONTROL_MALLWBEPTZ), \ - 0) - -#if 1 -#define _igsWaitFull(cop) _igsWaitLoop(cop, \ - IGS_CONTROL_CMDFF, \ - 0) -#else -#define _igsWaitFull(cop) _igsWaitDone(cop) -#endif - -#define _igsWaitIdleEmpty(cop) _igsWaitDone(cop) -#define _igsWaitHostBltAck(cop) _igsWaitLoop(cop, \ - (IGS_CONTROL_HBACKZ| \ - IGS_CONTROL_CMDFF), \ - 0) - -#define _igsReset(cop) ((cop)->control = 0) - -#define IgsInvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -#define IgsInvertBits16(v) { \ - v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ - v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ - v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ -} - -#define IgsInvertBits8(v) { \ - v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ - v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ - v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ -} - -#define IgsByteSwap32(x) ((x) = (((x) >> 24) | \ - (((x) >> 8) & 0xff00) | \ - (((x) << 8) & 0xff0000) | \ - ((x) << 24))) - -#define IgsByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8)) - -#define igsPatternDimOk(d) ((d) <= IGS_PATTERN_WIDTH && (((d) & ((d) - 1)) == 0)) - -#if BITMAP_BIT_ORDER == LSBFirst -#define IgsAdjustBits32(b) IgsInvertBits32(b) -#define IgsAdjustBits16(x) IgsInvertBits16(x) -#else -#define IgsAdjustBits32(x) IgsByteSwap32(x) -#define IgsAdjustBits16(x) IgsByteSwap16(x) -#endif - -#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->fg = (pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsSetTiledRect(cop,alu,pm,base,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_stride = IGS_PATTERN_WIDTH - 1; \ - (cop)->src1_start = (base); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_TILE | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_SRC | \ - IGS_BGS_BG); \ -} - -#define _igsSetStippledRect(cop,alu,pm,pix,base,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_start = (base); \ - (cop)->fg = (pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_STIP_TRANS | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsSetOpaqueStippledRect(cop,alu,pm,_fg,_bg,base,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_start = (base); \ - (cop)->fg = (_fg); \ - (cop)->bg = (_bg); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_STIP_OPAQUE | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsRect(cop,x,y,w,h,cmd) { \ - _igsWaitFull(cop); \ - (cop)->dst_start = (x) + (y) * (cop_stride); \ - (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ - (cop)->operation = (cmd); \ -} - -#define _igsPatRect(cop,x,y,w,h,cmd) { \ - _igsWaitFull(cop); \ - (cop)->dst_start = (x) + (y) * (cop_stride); \ - (cop)->rotate = IGS_MAKE_ROTATE(x&7,y&7); \ - (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ - (cop)->operation = (cmd); \ -} - -#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_stride = cop_stride - 1; \ - (cmd) = (IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_SRC | \ - IGS_BGS_BG); \ - if (backwards) (cmd) |= IGS_DRAW_R_L; \ - if (upsidedown) (cmd) |= IGS_DRAW_B_T; \ -} - -#if 0 -#define _igsPreparePlaneBlt(cop) { \ - _igsReset(cop); \ - (cop)->dst_stride = cop_stride - 1; \ - (cop)->src1_stride = cop_stride - 1; \ - (cop)->src2_stride = cop_stride - 1; \ - (cop)->format = IGS_FORMAT_16BPP; \ - (cop)->src1_start = 0; \ - (cop)->src2_start = 0; \ -} -#else -#define _igsPreparePlaneBlt(cop) -#endif - -#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \ - _igsWaitIdleEmpty(cop); \ - _igsPreparePlaneBlt(cop); \ - (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \ - (cop)->fg = (fg_pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_WRITE_2 | \ - IGS_SRC2_MONO_TRANS | \ - IGS_STEP_TERNARY_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \ - _igsWaitIdleEmpty(cop); \ - _igsPreparePlaneBlt(cop); \ - (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \ - (cop)->fg = (fg_pix); \ - (cop)->bg = (bg_pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_WRITE_2 | \ - IGS_SRC2_MONO_OPAQUE | \ - IGS_STEP_TERNARY_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \ -/* _igsWaitFull(cop); */ \ - (cop)->dst_start = (x) + (y) * (cop_stride); \ - (cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \ - (cop)->operation = (cmd); \ -/* _igsWaitHostBltAck(cop); */ \ -} - -#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \ - _igsWaitFull(cop); \ - (cop)->dst_start = (dx) + (dy) * cop_stride; \ - (cop)->src1_start = (sx) + (sy) * cop_stride; \ - (cop)->src1_stride = cop_stride - 1; \ - (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ - (cop)->operation = (cmd); \ -} - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#endif diff --git a/hw/kdrive/igs/igsreg.c b/hw/kdrive/igs/igsreg.c deleted file mode 100644 index d63fce035..000000000 --- a/hw/kdrive/igs/igsreg.c +++ /dev/null @@ -1,971 +0,0 @@ -/* - * $RCSId: $ - * - * Copyright © 2000 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 "igsreg.h" -#include <stdio.h> - -#define CR00 IGS_CR+0x00 -#define CR01 IGS_CR+0x01 -#define CR02 IGS_CR+0x02 -#define CR03 IGS_CR+0x03 -#define CR04 IGS_CR+0x04 -#define CR05 IGS_CR+0x05 -#define CR06 IGS_CR+0x06 -#define CR07 IGS_CR+0x07 -#define CR08 IGS_CR+0x08 -#define CR09 IGS_CR+0x09 -#define CR0A IGS_CR+0x0A -#define CR0B IGS_CR+0x0B -#define CR0C IGS_CR+0x0C -#define CR0D IGS_CR+0x0D -#define CR0E IGS_CR+0x0E -#define CR0F IGS_CR+0x0F -#define CR10 IGS_CR+0x10 -#define CR11 IGS_CR+0x11 -#define CR12 IGS_CR+0x12 -#define CR13 IGS_CR+0x13 -#define CR14 IGS_CR+0x14 -#define CR15 IGS_CR+0x15 -#define CR16 IGS_CR+0x16 -#define CR17 IGS_CR+0x17 -#define CR18 IGS_CR+0x18 -#define CR19 IGS_CR+0x19 -#define CR1A IGS_CR+0x1A -#define CR1B IGS_CR+0x1B -#define CR1C IGS_CR+0x1C -#define CR1D IGS_CR+0x1D -#define CR1E IGS_CR+0x1E -#define CR1F IGS_CR+0x1F -#define CR20 IGS_CR+0x20 -#define CR21 IGS_CR+0x21 -#define CR22 IGS_CR+0x22 -#define CR23 IGS_CR+0x23 -#define CR24 IGS_CR+0x24 -#define CR25 IGS_CR+0x25 -#define CR26 IGS_CR+0x26 -#define CR27 IGS_CR+0x27 -#define CR28 IGS_CR+0x28 -#define CR29 IGS_CR+0x29 -#define CR2A IGS_CR+0x2A -#define CR2B IGS_CR+0x2B -#define CR2C IGS_CR+0x2C -#define CR2D IGS_CR+0x2D -#define CR2E IGS_CR+0x2E -#define CR2F IGS_CR+0x2F -#define CR30 IGS_CR+0x30 -#define CR31 IGS_CR+0x31 -#define CR32 IGS_CR+0x32 -#define CR33 IGS_CR+0x33 -#define CR34 IGS_CR+0x34 -#define CR35 IGS_CR+0x35 -#define CR36 IGS_CR+0x36 -#define CR37 IGS_CR+0x37 -#define CR38 IGS_CR+0x38 -#define CR39 IGS_CR+0x39 -#define CR3A IGS_CR+0x3A -#define CR3B IGS_CR+0x3B -#define CR3C IGS_CR+0x3C -#define CR3D IGS_CR+0x3D -#define CR3E IGS_CR+0x3E -#define CR3F IGS_CR+0x3F -#define CR40 IGS_CR+0x40 -#define CR41 IGS_CR+0x41 -#define CR42 IGS_CR+0x42 -#define CR43 IGS_CR+0x43 -#define CR44 IGS_CR+0x44 -#define CR45 IGS_CR+0x45 -#define CR46 IGS_CR+0x46 -#define CR47 IGS_CR+0x47 -#define CR48 IGS_CR+0x48 - -#define CR_FIRST CR00 -#define CR_LAST CR48 - -#define SR00 IGS_SR+0x00 -#define SR01 IGS_SR+0x01 -#define SR02 IGS_SR+0x02 -#define SR03 IGS_SR+0x03 -#define SR04 IGS_SR+0x04 - -#define SR_FIRST SR00 -#define SR_LAST SR04 - -#define AR00 IGS_AR+0x00 -#define AR01 IGS_AR+0x01 -#define AR02 IGS_AR+0x02 -#define AR03 IGS_AR+0x03 -#define AR04 IGS_AR+0x04 -#define AR05 IGS_AR+0x05 -#define AR06 IGS_AR+0x06 -#define AR07 IGS_AR+0x07 -#define AR08 IGS_AR+0x08 -#define AR09 IGS_AR+0x09 -#define AR0A IGS_AR+0x0A -#define AR0B IGS_AR+0x0B -#define AR0C IGS_AR+0x0C -#define AR0D IGS_AR+0x0D -#define AR0E IGS_AR+0x0E -#define AR0F IGS_AR+0x0F -#define AR10 IGS_AR+0x10 -#define AR11 IGS_AR+0x11 -#define AR12 IGS_AR+0x12 -#define AR13 IGS_AR+0x13 -#define AR14 IGS_AR+0x14 - -#define AR_FIRST AR00 -#define AR_LAST AR14 - -#define GR00 IGS_GR+0x00 -#define GR01 IGS_GR+0x01 -#define GR02 IGS_GR+0x02 -#define GR03 IGS_GR+0x03 -#define GR04 IGS_GR+0x04 -#define GR05 IGS_GR+0x05 -#define GR06 IGS_GR+0x06 -#define GR07 IGS_GR+0x07 -#define GR08 IGS_GR+0x08 -#define GR09 IGS_GR+0x09 -#define GR0A IGS_GR+0x0A -#define GR0B IGS_GR+0x0B -#define GR0C IGS_GR+0x0C -#define GR0D IGS_GR+0x0D -#define GR0E IGS_GR+0x0E -#define GR0F IGS_GR+0x0F -#define GR10 IGS_GR+0x10 -#define GR11 IGS_GR+0x11 -#define GR12 IGS_GR+0x12 -#define GR13 IGS_GR+0x13 -#define GR14 IGS_GR+0x14 -#define GR15 IGS_GR+0x15 -#define GR16 IGS_GR+0x16 -#define GR17 IGS_GR+0x17 -#define GR18 IGS_GR+0x18 -#define GR19 IGS_GR+0x19 -#define GR1A IGS_GR+0x1A -#define GR1B IGS_GR+0x1B -#define GR1C IGS_GR+0x1C -#define GR1D IGS_GR+0x1D -#define GR1E IGS_GR+0x1E -#define GR1F IGS_GR+0x1F -#define GR20 IGS_GR+0x20 -#define GR21 IGS_GR+0x21 -#define GR22 IGS_GR+0x22 -#define GR23 IGS_GR+0x23 -#define GR24 IGS_GR+0x24 -#define GR25 IGS_GR+0x25 -#define GR26 IGS_GR+0x26 -#define GR27 IGS_GR+0x27 -#define GR28 IGS_GR+0x28 -#define GR29 IGS_GR+0x29 -#define GR2A IGS_GR+0x2A -#define GR2B IGS_GR+0x2B -#define GR2C IGS_GR+0x2C -#define GR2D IGS_GR+0x2D -#define GR2E IGS_GR+0x2E -#define GR2F IGS_GR+0x2F -#define GR30 IGS_GR+0x30 -#define GR31 IGS_GR+0x31 -#define GR32 IGS_GR+0x32 -#define GR33 IGS_GR+0x33 -#define GR34 IGS_GR+0x34 -#define GR35 IGS_GR+0x35 -#define GR36 IGS_GR+0x36 -#define GR37 IGS_GR+0x37 -#define GR38 IGS_GR+0x38 -#define GR39 IGS_GR+0x39 -#define GR3A IGS_GR+0x3A -#define GR3B IGS_GR+0x3B -#define GR3C IGS_GR+0x3C -#define GR3D IGS_GR+0x3D -#define GR3E IGS_GR+0x3E -#define GR3F IGS_GR+0x3F -#define GR40 IGS_GR+0x40 -#define GR41 IGS_GR+0x41 -#define GR42 IGS_GR+0x42 -#define GR43 IGS_GR+0x43 -#define GR44 IGS_GR+0x44 -#define GR45 IGS_GR+0x45 -#define GR46 IGS_GR+0x46 -#define GR47 IGS_GR+0x47 -#define GR48 IGS_GR+0x48 -#define GR49 IGS_GR+0x49 -#define GR4A IGS_GR+0x4A -#define GR4B IGS_GR+0x4B -#define GR4C IGS_GR+0x4C -#define GR4D IGS_GR+0x4D -#define GR4E IGS_GR+0x4E -#define GR4F IGS_GR+0x4F -#define GR50 IGS_GR+0x50 -#define GR51 IGS_GR+0x51 -#define GR52 IGS_GR+0x52 -#define GR53 IGS_GR+0x53 -#define GR54 IGS_GR+0x54 -#define GR55 IGS_GR+0x55 -#define GR56 IGS_GR+0x56 -#define GR57 IGS_GR+0x57 -#define GR58 IGS_GR+0x58 -#define GR59 IGS_GR+0x59 -#define GR5A IGS_GR+0x5A -#define GR5B IGS_GR+0x5B -#define GR5C IGS_GR+0x5C -#define GR5D IGS_GR+0x5D -#define GR5E IGS_GR+0x5E -#define GR5F IGS_GR+0x5F -#define GR60 IGS_GR+0x60 -#define GR61 IGS_GR+0x61 -#define GR62 IGS_GR+0x62 -#define GR63 IGS_GR+0x63 -#define GR64 IGS_GR+0x64 -#define GR65 IGS_GR+0x65 -#define GR66 IGS_GR+0x66 -#define GR67 IGS_GR+0x67 -#define GR68 IGS_GR+0x68 -#define GR69 IGS_GR+0x69 -#define GR6A IGS_GR+0x6A -#define GR6B IGS_GR+0x6B -#define GR6C IGS_GR+0x6C -#define GR6D IGS_GR+0x6D -#define GR6E IGS_GR+0x6E -#define GR6F IGS_GR+0x6F -#define GR70 IGS_GR+0x70 -#define GR71 IGS_GR+0x71 -#define GR72 IGS_GR+0x72 -#define GR73 IGS_GR+0x73 -#define GR74 IGS_GR+0x74 -#define GR75 IGS_GR+0x75 -#define GR76 IGS_GR+0x76 -#define GR77 IGS_GR+0x77 -#define GR78 IGS_GR+0x78 -#define GR79 IGS_GR+0x79 -#define GR7A IGS_GR+0x7A -#define GR7B IGS_GR+0x7B -#define GR7C IGS_GR+0x7C -#define GR7D IGS_GR+0x7D -#define GR7E IGS_GR+0x7E -#define GR7F IGS_GR+0x7F -#define GR80 IGS_GR+0x80 -#define GR81 IGS_GR+0x81 -#define GR82 IGS_GR+0x82 -#define GR83 IGS_GR+0x83 -#define GR84 IGS_GR+0x84 -#define GR85 IGS_GR+0x85 -#define GR86 IGS_GR+0x86 -#define GR87 IGS_GR+0x87 -#define GR88 IGS_GR+0x88 -#define GR89 IGS_GR+0x89 -#define GR8A IGS_GR+0x8A -#define GR8B IGS_GR+0x8B -#define GR8C IGS_GR+0x8C -#define GR8D IGS_GR+0x8D -#define GR8E IGS_GR+0x8E -#define GR8F IGS_GR+0x8F -#define GR90 IGS_GR+0x90 -#define GR91 IGS_GR+0x91 -#define GR92 IGS_GR+0x92 -#define GR93 IGS_GR+0x93 -#define GR94 IGS_GR+0x94 -#define GR95 IGS_GR+0x95 -#define GR96 IGS_GR+0x96 -#define GR97 IGS_GR+0x97 -#define GR98 IGS_GR+0x98 -#define GR99 IGS_GR+0x99 -#define GR9A IGS_GR+0x9A -#define GR9B IGS_GR+0x9B -#define GR9C IGS_GR+0x9C -#define GR9D IGS_GR+0x9D -#define GR9E IGS_GR+0x9E -#define GR9F IGS_GR+0x9F -#define GRA0 IGS_GR+0xA0 -#define GRA1 IGS_GR+0xA1 -#define GRA2 IGS_GR+0xA2 -#define GRA3 IGS_GR+0xA3 -#define GRA4 IGS_GR+0xA4 -#define GRA5 IGS_GR+0xA5 -#define GRA6 IGS_GR+0xA6 -#define GRA7 IGS_GR+0xA7 -#define GRA8 IGS_GR+0xA8 -#define GRA9 IGS_GR+0xA9 -#define GRAA IGS_GR+0xAA -#define GRAB IGS_GR+0xAB -#define GRAC IGS_GR+0xAC -#define GRAD IGS_GR+0xAD -#define GRAE IGS_GR+0xAE -#define GRAF IGS_GR+0xAF -#define GRB0 IGS_GR+0xB0 -#define GRB1 IGS_GR+0xB1 -#define GRB2 IGS_GR+0xB2 -#define GRB3 IGS_GR+0xB3 -#define GRB4 IGS_GR+0xB4 -#define GRB5 IGS_GR+0xB5 -#define GRB6 IGS_GR+0xB6 -#define GRB7 IGS_GR+0xB7 -#define GRB8 IGS_GR+0xB8 -#define GRB9 IGS_GR+0xB9 -#define GRBA IGS_GR+0xBA -#define GRBB IGS_GR+0xBB -#define GRBC IGS_GR+0xBC -#define GRBD IGS_GR+0xBD -#define GRBE IGS_GR+0xBE -#define GRBF IGS_GR+0xBF - -#define GR_FIRST GR00 -#define GR_LAST GRBF - -#define GREX3C IGS_GREX+(0x3c-IGS_GREXBASE) - -VgaReg igs_h_total[] = { - CR00, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_de_end[] = { - CR01, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_bstart[] = { - CR02, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_bend[] = { - CR03, 0, 5, - CR05, 7, 1, - VGA_REG_END -}; - -VgaReg igs_de_skew[] = { - CR03, 5, 2, - VGA_REG_END -}; - -VgaReg igs_ena_vr_access[] = { - CR03, 7, 1, - VGA_REG_END -}; - -VgaReg igs_h_rstart[] = { - CR04, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_rend[] = { - CR05, 0, 5, - VGA_REG_END -}; - -VgaReg igs_h_rdelay[] = { - CR05, 5, 2, - VGA_REG_END -}; - -VgaReg igs_v_total[] = { - CR06, 0, 8, - CR07, 0, 1, - CR07, 5, 1, - GR11, 0, 1, - VGA_REG_END -}; - -VgaReg igs_v_rstart[] = { - CR10, 0, 8, - CR07, 2, 1, - CR07, 7, 1, - GR11, 2, 1, - VGA_REG_END -}; - -VgaReg igs_v_rend[] = { - CR11, 0, 4, - VGA_REG_END -}; - -VgaReg igs_clear_v_int[] = { - CR11, 4, 1, - VGA_REG_END -}; - -VgaReg igs_disable_v_int[] = { - CR11, 5, 1, - VGA_REG_END -}; - -VgaReg igs_bandwidth[] = { - CR11, 6, 1, - VGA_REG_END -}; - -VgaReg igs_crt_protect[] = { - CR11, 7, 1, - VGA_REG_END -}; - -VgaReg igs_v_de_end[] = { - CR12, 0, 8, - CR07, 1, 1, - CR07, 6, 1, - GR11, 1, 1, - VGA_REG_END -}; - -VgaReg igs_offset[] = { - CR13, 0, 8, - GR15, 4, 2, - VGA_REG_END -}; - -VgaReg igs_v_bstart[] = { - CR15, 0, 8, - CR07, 3, 1, - CR09, 5, 1, - GR11, 3, 1, - VGA_REG_END -}; - -VgaReg igs_v_bend[] = { - CR16, 0, 7, - VGA_REG_END -}; - -VgaReg igs_linecomp[] = { - CR18, 0, 8, - CR07, 4, 1, - CR09, 6, 1, - GR11, 4, 1, - VGA_REG_END -}; - -VgaReg igs_ivideo[] = { - GR11, 5, 1, - VGA_REG_END -}; - -VgaReg igs_num_fetch[] = { - GR14, 0, 8, - GR15, 0, 2, - VGA_REG_END -}; - -VgaReg igs_wcrt0[] = { - CR1F, 0, 1, - VGA_REG_END -}; - -VgaReg igs_wcrt1[] = { - CR1F, 1, 1, - VGA_REG_END -}; - -VgaReg igs_rcrts1[] = { - CR1F, 4, 1, - VGA_REG_END -}; - -VgaReg igs_selwk[] = { - CR1F, 6, 1, - VGA_REG_END -}; - -VgaReg igs_dot_clock_8[] = { - SR01, 0, 1, - VGA_REG_END -}; - -VgaReg igs_screen_off[] = { - SR01, 5, 1, - VGA_REG_END -}; - -VgaReg igs_enable_write_plane[] = { - SR02, 0, 4, - VGA_REG_END -}; - -VgaReg igs_mexhsyn[] = { - GR16, 0, 2, - VGA_REG_END -}; - -VgaReg igs_mexvsyn[] = { - GR16, 2, 2, - VGA_REG_END -}; - -VgaReg igs_pci_burst_write[] = { - GR30, 5, 1, - VGA_REG_END -}; - -VgaReg igs_pci_burst_read[] = { - GR30, 7, 1, - VGA_REG_END -}; - -VgaReg igs_iow_retry[] = { - GREX3C, 0, 1, - VGA_REG_END -}; - -VgaReg igs_mw_retry[] = { - GREX3C, 1, 1, - VGA_REG_END -}; - -VgaReg igs_mr_retry[] = { - GREX3C, 2, 1, - VGA_REG_END -}; - - - -VgaReg igs_biga22en[] = { - GR3D, 4, 1, - VGA_REG_END -}; - -VgaReg igs_biga24en[] = { - GR3D, 5, 1, - VGA_REG_END -}; - -VgaReg igs_biga22force[] = { - GR3D, 6, 1, - VGA_REG_END -}; - -VgaReg igs_bigswap[] = { - GR3F, 0, 6, - VGA_REG_END -}; - -/* #define IGS_BIGSWAP_8 0x3f */ -/* #define IGS_BIGSWAP_16 0x2a */ -/* #define IGS_BIGSWAP_32 0x00 */ - -VgaReg igs_sprite_x[] = { - GR50, 0, 8, - GR51, 0, 3, - VGA_REG_END -}; - -VgaReg igs_sprite_preset_x[] = { - GR52, 0, 6, - VGA_REG_END -}; - -VgaReg igs_sprite_y[] = { - GR53, 0, 8, - GR54, 0, 3, - VGA_REG_END -}; - -VgaReg igs_sprite_preset_y[] = { - GR55, 0, 6, - VGA_REG_END -}; - -VgaReg igs_sprite_visible[] = { - GR56, 0, 1, - VGA_REG_END -}; - -VgaReg igs_sprite_64x64[] = { - GR56, 1, 1, - VGA_REG_END -}; - -VgaReg igs_mgrext[] = { - GR57, 0, 1, - VGA_REG_END -}; - -VgaReg igs_hcshf[] = { - GR57, 4, 2, - VGA_REG_END -}; - -VgaReg igs_mbpfix[] = { - GR57, 6, 2, - VGA_REG_END -}; - -VgaReg igs_overscan_red[] = { - GR58, 0, 8, - VGA_REG_END -}; - -VgaReg igs_overscan_green[] = { - GR59, 0, 8, - VGA_REG_END -}; - -VgaReg igs_overscan_blue[] = { - GR5A, 0, 8, - VGA_REG_END -}; - -VgaReg igs_memgopg[] = { - GR73, 2, 1, - VGA_REG_END -}; - -VgaReg igs_memr2wpg[] = { - GR73, 1, 1, - VGA_REG_END -}; - -VgaReg igs_crtff16[] = { - GR73, 3, 1, - VGA_REG_END -}; - -VgaReg igs_fifomust[] = { - GR74, 0, 5, - VGA_REG_END -}; - -VgaReg igs_fifogen[] = { - GR75, 0, 5, - VGA_REG_END -}; - -VgaReg igs_mode_sel[] = { - GR77, 0, 4, - VGA_REG_END -}; - -/* #define IGS_MODE_TEXT 0 */ -/* #define IGS_MODE_8 1 */ -/* #define IGS_MODE_565 2 */ -/* #define IGS_MODE_5551 6 */ -/* #define IGS_MODE_8888 3 */ -/* #define IGS_MODE_888 4 */ -/* #define IGS_MODE_332 9 */ -/* #define IGS_MODE_4444 10 */ - -VgaReg igs_sprite_addr[] = { - GR7E, 0, 8, - GR7F, 0, 4, - VGA_REG_END -}; - -VgaReg igs_fastmpie[] = { - GR9E, 0, 1, - VGA_REG_END -}; - -VgaReg igs_vclk_m[] = { - GRB0, 0, 8, - GRBA, 0, 3, - VGA_REG_END -}; - -VgaReg igs_vclk_n[] = { - GRB1, 0, 5, - GRBA, 3, 3, - VGA_REG_END -}; - -VgaReg igs_vfsel[] = { - GRB1, 5, 1, - VGA_REG_END -}; - -VgaReg igs_vclk_p[] = { - GRB1, 6, 2, - GRBA, 6, 1, - VGA_REG_END -}; - -VgaReg igs_frqlat[] = { - GRB9, 7, 1, - VGA_REG_END -}; - - -VgaReg igs_dac_mask[] = { - IGS_DAC + 0, 0, 8, - VGA_REG_END -}; - -VgaReg igs_dac_read_index[] = { - IGS_DAC + 1, 0, 8, - VGA_REG_END -}; - -VgaReg igs_dac_write_index[] = { - IGS_DAC + 2, 0, 8, - VGA_REG_END -}; - -VgaReg igs_dac_data[] = { - IGS_DAC + 3, 0, 8, - VGA_REG_END -}; - -VgaReg igs_rampwdn[] = { - IGS_DACEX + 0, 0, 1, - VGA_REG_END -}; - -VgaReg igs_dac6_8[] = { - IGS_DACEX + 0, 1, 1, - VGA_REG_END -}; - -VgaReg igs_ramdacbypass[] = { - IGS_DACEX + 0, 4, 1, - VGA_REG_END -}; - -VgaReg igs_dacpwdn[] = { - IGS_DACEX + 0, 6, 1, - VGA_REG_END -}; - -VgaReg igs_cursor_read_index[] = { - IGS_DACEX + 1, 0, 8, - VGA_REG_END -}; - -VgaReg igs_cursor_write_index[] = { - IGS_DACEX + 2, 0, 8, - VGA_REG_END -}; - -VgaReg igs_cursor_data[] = { - IGS_DACEX + 3, 0, 8, - VGA_REG_END -}; - -VGA8 -_igsInb (VgaCard *card, VGA16 port) -{ - VGAVOL8 *reg; - - if (card->closure) - return VgaReadMemb ((VGA32) card->closure + port); - else - return VgaInb (port); -} - -void -_igsOutb (VgaCard *card, VGA8 value, VGA16 port) -{ - if (card->closure) - VgaWriteMemb (value, (VGA32) card->closure + port); - else - VgaOutb (value, port); -} - -void -_igsRegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write) -{ - if (reg < IGS_SR + IGS_NSR) - { - map->access = VgaAccessIndIo; - map->port = 0x3c4; - map->addr = 0; - map->value = 1; - map->index = reg - IGS_SR; - } - else if (reg < IGS_GR + IGS_NGR) - { - map->access = VgaAccessIndIo; - map->port = 0x3ce; - map->addr = 0; - map->value = 1; - map->index = reg - IGS_GR; - } - else if (reg < IGS_GREX + IGS_NGREX) - { - VGA8 gr33; - - map->access = VgaAccessDone; - _igsOutb (card, 0x33, 0x3ce); - gr33 = _igsInb (card, 0x3cf); - _igsOutb (card, gr33 | 0x40, 0x3cf); - _igsOutb (card, IGS_GREXBASE + reg - IGS_GREX, 0x3ce); - if (write) - _igsOutb (card, map->value, 0x3cf); - else - map->value = _igsInb (card, 0x3cf); - _igsOutb (card, 0x33, 0x3ce); - _igsOutb (card, gr33, 0x3cf); - return; - } - else if (reg < IGS_AR + IGS_NAR) - { - reg -= IGS_AR; - map->access = VgaAccessDone; - /* reset AFF to index */ - (void) _igsInb (card, 0x3da); - if (reg >= 16) - reg |= 0x20; - _igsOutb (card, reg, 0x3c0); - if (write) - _igsOutb (card, map->value, 0x3c0); - else - map->value = _igsInb (card, 0x3c1); - if (!(reg & 0x20)) - { - /* enable video display again */ - (void) _igsInb (card, 0x3da); - _igsOutb (card, 0x20, 0x3c0); - } - return; - } - else if (reg < IGS_CR + IGS_NCR) - { - map->access = VgaAccessIndIo; - map->port = 0x3d4; - map->addr = 0; - map->value = 1; - map->index = reg - IGS_CR; - } - else if (reg < IGS_DAC + IGS_NDAC) - { - map->access = VgaAccessIo; - map->port = 0x3c6 + reg - IGS_DAC; - } - else if (reg < IGS_DACEX + IGS_NDACEX) - { - VGA8 gr56; - reg = 0x3c6 + reg - IGS_DACEX; - map->access = VgaAccessDone; - _igsOutb (card, 0x56, 0x3ce); - gr56 = _igsInb (card, 0x3cf); - _igsOutb (card, gr56 | 4, 0x3cf); - if (write) - _igsOutb (card, map->value, reg); - else - map->value = _igsInb (card, reg); - _igsOutb (card, gr56, 0x3cf); - return; - } - else switch (reg) { - case IGS_MISC_OUT: - map->access = VgaAccessIo; - if (write) - map->port = 0x3c2; - else - map->port = 0x3cc; - break; - case IGS_INPUT_STATUS_1: - map->access = VgaAccessIo; - map->port = 0x3da; - break; - } - if (card->closure) - { - map->port = map->port + (VGA32) card->closure; - if (map->access == VgaAccessIo) - map->access = VgaAccessMem; - if (map->access == VgaAccessIndIo) - map->access = VgaAccessIndMem; - } -} - -VgaSave igsSaves[] = { - CR00, CR18, - SR01, SR02, - GR11, GRBA, - IGS_MISC_OUT, IGS_MISC_OUT, - VGA_SAVE_END -}; - -void -igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio) -{ - igsvga->card.map = _igsRegMap; - igsvga->card.closure = (void *) mmio; - igsvga->card.max = IGS_NREG; - igsvga->card.values = igsvga->values; - igsvga->card.saves = igsSaves; -} - -void -igsSave (IgsVga *igsvga) -{ - igsSetImm (igsvga, igs_wcrt0, 1); - igsSetImm (igsvga, igs_wcrt1, 1); - igsSetImm (igsvga, igs_rcrts1, 1); - igsSetImm (igsvga, igs_selwk, 1); - VgaPreserve (&igsvga->card); -} - -void -igsReset (IgsVga *igsvga) -{ - VgaRestore (&igsvga->card); - igsSetImm (igsvga, igs_frqlat, 0); - igsSetImm (igsvga, igs_frqlat, 1); - igsSetImm (igsvga, igs_frqlat, 0); - VgaFinish (&igsvga->card); -} - -char * -igsRegName(char *buf, VGA16 reg) -{ - if (reg < IGS_SR + IGS_NSR) - { - sprintf (buf, " SR%02X", reg - IGS_SR); - } - else if (reg < IGS_GR + IGS_NGR) - { - sprintf (buf, " GR%02X", reg - IGS_GR); - } - else if (reg < IGS_GREX + IGS_NGREX) - { - sprintf (buf, " GRX%02X", reg - IGS_GREX + IGS_GREXBASE); - } - else if (reg < IGS_AR + IGS_NAR) - { - sprintf (buf, " AR%02X", reg - IGS_AR); - } - else if (reg < IGS_CR + IGS_NCR) - { - sprintf (buf, " CR%02X", reg - IGS_CR); - } - else if (reg < IGS_DAC + IGS_NDAC) - { - sprintf (buf, " DAC%02X", reg - IGS_DAC); - } - else if (reg < IGS_DACEX + IGS_NDACEX) - { - sprintf (buf, "DACX%02X", reg - IGS_DACEX); - } - else switch (reg) { - case IGS_MISC_OUT: - sprintf (buf, "MISC_O"); - break; - case IGS_INPUT_STATUS_1: - sprintf (buf, "IN_S_1"); - break; - } - return buf; -} diff --git a/hw/kdrive/igs/igsreg.h b/hw/kdrive/igs/igsreg.h deleted file mode 100644 index ddccd8907..000000000 --- a/hw/kdrive/igs/igsreg.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * $RCSId: $ - * - * Copyright © 2000 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. - */ - -#ifndef _IGSREG_H_ -#define _IGSREG_H_ - -#include "vga.h" - -#define IGS_SR 0 -#define IGS_NSR 5 -#define IGS_GR (IGS_SR+IGS_NSR) -#define IGS_NGR 0xC0 -#define IGS_GREX (IGS_GR+IGS_NGR) -#define IGS_GREXBASE 0x3c -#define IGS_NGREX 1 -#define IGS_AR (IGS_GREX+IGS_NGREX) -#define IGS_NAR 0x15 -#define IGS_CR (IGS_AR+IGS_NAR) -#define IGS_NCR 0x48 -#define IGS_DAC (IGS_CR+IGS_NCR) -#define IGS_NDAC 4 -#define IGS_DACEX (IGS_DAC+IGS_NDAC) -#define IGS_NDACEX 4 -#define IGS_MISC_OUT (IGS_DACEX + IGS_NDACEX) -#define IGS_INPUT_STATUS_1 (IGS_MISC_OUT+1) -#define IGS_NREG (IGS_INPUT_STATUS_1+1) - -extern VgaReg igs_h_total[]; -extern VgaReg igs_h_de_end[]; -extern VgaReg igs_h_bstart[]; -extern VgaReg igs_h_bend[]; -extern VgaReg igs_de_skew[]; -extern VgaReg igs_ena_vr_access[]; -extern VgaReg igs_h_rstart[]; -extern VgaReg igs_h_rend[]; -extern VgaReg igs_h_rdelay[]; -extern VgaReg igs_v_total[]; -extern VgaReg igs_v_rstart[]; -extern VgaReg igs_v_rend[]; -extern VgaReg igs_clear_v_int[]; -extern VgaReg igs_disable_v_int[]; -extern VgaReg igs_bandwidth[]; -extern VgaReg igs_crt_protect[]; -extern VgaReg igs_v_de_end[]; -extern VgaReg igs_offset[]; -extern VgaReg igs_v_bstart[]; -extern VgaReg igs_v_bend[]; -extern VgaReg igs_linecomp[]; -extern VgaReg igs_ivideo[]; -extern VgaReg igs_num_fetch[]; -extern VgaReg igs_wcrt0[]; -extern VgaReg igs_wcrt1[]; -extern VgaReg igs_rcrts1[]; -extern VgaReg igs_selwk[]; -extern VgaReg igs_dot_clock_8[]; -extern VgaReg igs_screen_off[]; -extern VgaReg igs_enable_write_plane[]; -extern VgaReg igs_mexhsyn[]; -extern VgaReg igs_mexvsyn[]; -extern VgaReg igs_pci_burst_write[]; -extern VgaReg igs_pci_burst_read[]; -extern VgaReg igs_iow_retry[]; -extern VgaReg igs_mw_retry[]; -extern VgaReg igs_mr_retry[]; -extern VgaReg igs_biga22en[]; -extern VgaReg igs_biga24en[]; -extern VgaReg igs_biga22force[]; -extern VgaReg igs_bigswap[]; -#define IGS_BIGSWAP_8 0x3f -#define IGS_BIGSWAP_16 0x2a -#define IGS_BIGSWAP_32 0x00 -extern VgaReg igs_sprite_x[]; -extern VgaReg igs_sprite_preset_x[]; -extern VgaReg igs_sprite_y[]; -extern VgaReg igs_sprite_preset_y[]; -extern VgaReg igs_sprite_visible[]; -extern VgaReg igs_sprite_64x64[]; -extern VgaReg igs_mgrext[]; -extern VgaReg igs_hcshf[]; -extern VgaReg igs_mbpfix[]; -extern VgaReg igs_overscan_red[]; -extern VgaReg igs_overscan_green[]; -extern VgaReg igs_overscan_blue[]; -extern VgaReg igs_memgopg[]; -extern VgaReg igs_memr2wpg[]; -extern VgaReg igs_crtff16[]; -extern VgaReg igs_fifomust[]; -extern VgaReg igs_fifogen[]; -extern VgaReg igs_mode_sel[]; -#define IGS_MODE_TEXT 0 -#define IGS_MODE_8 1 -#define IGS_MODE_565 2 -#define IGS_MODE_5551 6 -#define IGS_MODE_8888 3 -#define IGS_MODE_888 4 -#define IGS_MODE_332 9 -#define IGS_MODE_4444 10 -extern VgaReg igs_sprite_addr[]; -extern VgaReg igs_fastmpie[]; -extern VgaReg igs_vclk_m[]; -extern VgaReg igs_vclk_n[]; -extern VgaReg igs_vfsel[]; -extern VgaReg igs_vclk_p[]; -extern VgaReg igs_frqlat[]; -extern VgaReg igs_dac_mask[]; -extern VgaReg igs_dac_read_index[]; -extern VgaReg igs_dac_write_index[]; -extern VgaReg igs_dac_data[]; -extern VgaReg igs_rampwdn[]; -extern VgaReg igs_dac6_8[]; -extern VgaReg igs_ramdacbypass[]; -extern VgaReg igs_dacpwdn[]; -extern VgaReg igs_cursor_read_index[]; -extern VgaReg igs_cursor_write_index[]; -extern VgaReg igs_cursor_data[]; - -#define igsGet(sv,r) VgaGet(&(sv)->card, (r)) -#define igsGetImm(sv,r) VgaGetImm(&(sv)->card, (r)) -#define igsSet(sv,r,v) VgaSet(&(sv)->card, (r), (v)) -#define igsSetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v)) - -typedef struct _igsVga { - VgaCard card; - VgaValue values[IGS_NREG]; -} IgsVga; - -void -igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio); - -void -igsSave (IgsVga *igsvga); - -void -igsReset (IgsVga *igsvga); - -#endif /* _IGSREG_H_ */ diff --git a/hw/kdrive/igs/igsstub.c b/hw/kdrive/igs/igsstub.c deleted file mode 100644 index 00dd450f8..000000000 --- a/hw/kdrive/igs/igsstub.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $RCSId: xc/programs/Xserver/hw/kdrive/igs/igsstub.c,v 1.2 2000/05/24 23:52:48 keithp Exp $ - * - * Copyright © 2000 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 "igs.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - CARD32 count; - - count = 0; -#ifdef EMBED - attr.address[0] = 0x10000000; /* Adomo Wing video base address */ - attr.io = 0; - attr.naddr = 1; -#else - while (LinuxFindPci (0x10ea, 0x5000, count, &attr)) -#endif - { - KdCardInfoAdd (&igsFuncs, &attr, 0); - count++; - } -} - -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 (); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} |