summaryrefslogtreecommitdiff
path: root/hw/kdrive/trio
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kdrive/trio')
-rw-r--r--hw/kdrive/trio/Imakefile20
-rw-r--r--hw/kdrive/trio/s3.c1016
-rw-r--r--hw/kdrive/trio/s3.h1203
-rw-r--r--hw/kdrive/trio/s3clock.c88
-rw-r--r--hw/kdrive/trio/s3cmap.c73
-rw-r--r--hw/kdrive/trio/s3curs.c419
-rw-r--r--hw/kdrive/trio/s3stub.c68
7 files changed, 0 insertions, 2887 deletions
diff --git a/hw/kdrive/trio/Imakefile b/hw/kdrive/trio/Imakefile
deleted file mode 100644
index 1cc1ecaac..000000000
--- a/hw/kdrive/trio/Imakefile
+++ /dev/null
@@ -1,20 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $
-XCOMM $RCSId: xc/programs/Xserver/hw/nvfb/Imakefile,v 3.8 1996/12/23 06:30:19 dawes Exp $
-KDRIVE=..
-#include "../Kdrive.tmpl"
-
-SRCS = s3.c s3clock.c s3cmap.c s3curs.c s3draw.c s3gc.c s3stub.c
-
-OBJS = s3.o s3clock.o s3cmap.o s3curs.o s3draw.o s3gc.o s3stub.o
-
-INCLUDES = -I. $(KDINCS)
-
-DEFINES = -DS3_TRIO
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(trio,$(OBJS))
-DependTarget()
-
-LinkSourceFile(s3draw.h,../savage)
-LinkSourceFile(s3draw.c,../savage)
-LinkSourceFile(s3gc.c,../savage)
diff --git a/hw/kdrive/trio/s3.c b/hw/kdrive/trio/s3.c
deleted file mode 100644
index c8359733b..000000000
--- a/hw/kdrive/trio/s3.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
- * Id: s3.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3.c,v 1.4 2000/05/06 22:17:52 keithp Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-#define REGISTERS_OFFSET (0x1000000)
-#define PACKED_OFFSET (0x8100)
-
-
-CARD8
-_s3ReadIndexRegister (volatile CARD8 *base, CARD8 index)
-{
- CARD8 ret;
- *base = index;
- ret = *(base + 1);
- DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x -> 0x%02x",
- ((int) base) & 0xfff, index, ret));
- return ret;
-}
-
-void
-_s3WriteIndexRegister (volatile CARD8 *base, CARD8 index, CARD8 value)
-{
- DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x <- 0x%02x",
- ((int) base) & 0xfff, index, value));
- *base = index;
- *(base + 1) = value;
-}
-
-/*
- * Map the S3 card and detect its configuration. Do not touch the card
- */
-
-static void
-_s3LoadCrtc (S3Ptr s3, S3Crtc *crtc)
-{
- crtc->h_total_0_7 = GetCrtc (s3, 0x00);
- crtc->h_display_end_0_7 = GetCrtc (s3, 0x01);
- crtc->h_blank_start_0_7 = GetCrtc (s3, 0x02);
- crtc->_h_blank_end = GetCrtc (s3, 0x03);
- crtc->h_sync_start_0_7 = GetCrtc (s3, 0x04);
- crtc->_h_sync_end = GetCrtc (s3, 0x05);
- crtc->v_total_0_7 = GetCrtc (s3, 0x06);
- crtc->crtc_overflow = GetCrtc (s3, 0x07);
- crtc->preset_row_scan = GetCrtc (s3, 0x08);
- crtc->_max_scan_line = GetCrtc (s3, 0x09);
-
- crtc->start_address_8_15 = GetCrtc (s3, 0x0c);
- crtc->start_address_0_7 = GetCrtc (s3, 0x0d);
-
- crtc->v_retrace_start_0_7 = GetCrtc (s3, 0x10);
- crtc->_v_retrace_end = GetCrtc (s3, 0x11);
- crtc->v_display_end_0_7 = GetCrtc (s3, 0x12);
- crtc->screen_off_0_7 = GetCrtc (s3, 0x13);
-
- crtc->v_blank_start_0_7 = GetCrtc (s3, 0x15);
- crtc->v_blank_end_0_7 = GetCrtc (s3, 0x16);
-
- crtc->line_compare_0_7 = GetCrtc (s3, 0x18);
-
- crtc->memory_configuration = GetCrtc (s3, 0x31);
-
- crtc->misc_1 = GetCrtc (s3, 0x3a);
- crtc->h_start_fifo_fetch_0_7 = GetCrtc (s3, 0x3b);
-
- crtc->mode_control = GetCrtc (s3, 0x42);
-
- crtc->hardware_cursor_mode = GetCrtc (s3, 0x45);
- crtc->cursor_address_8_15 = GetCrtc (s3, 0x4C);
- crtc->cursor_address_0_7 = GetCrtc (s3, 0x4D);
-
- crtc->extended_system_control_1 = GetCrtc (s3, 0x50);
- crtc->extended_system_control_2 = GetCrtc (s3, 0x51);
-
- crtc->extended_memory_control = GetCrtc (s3, 0x53);
-
- crtc->extended_ramdac_control = GetCrtc (s3, 0x55);
-
- crtc->extended_horizontal_overflow = GetCrtc (s3, 0x5d);
- crtc->extended_vertical_overflow = GetCrtc (s3, 0x5e);
-
- crtc->l_parm_0_7 = GetCrtc (s3, 0x62);
-
- crtc->extended_misc_control = GetCrtc (s3, 0x65);
-
- crtc->extended_misc_control_2 = GetCrtc (s3, 0x67);
-
- crtc->configuration_3 = GetCrtc (s3, 0x68);
-
- crtc->extended_system_control_3 = GetCrtc (s3, 0x69);
-
- crtc->extended_bios_5 = GetCrtc (s3, 0x6d);
-
- crtc->extended_sequencer_b = GetSrtc (s3, 0x0b);
- crtc->extended_sequencer_d = GetSrtc (s3, 0x0d);
- crtc->dclk_value_low = GetSrtc (s3, 0x12);
- crtc->dclk_value_high = GetSrtc (s3, 0x13);
- crtc->control_2 = GetSrtc (s3, 0x15);
- crtc->ramdac_control = GetSrtc (s3, 0x18);
-
-/* combine values */
-
- switch (crtc_ge_screen_width(crtc)) {
- case 0:
- if (crtc->enable_two_page)
- crtc->ge_screen_pitch = 2048;
- else
- crtc->ge_screen_pitch = 1024;
- break;
- case 1:
- crtc->ge_screen_pitch = 640;
- break;
- case 2:
- /* ignore magic 1600x1200x4 mode */
- crtc->ge_screen_pitch = 800;
- break;
- case 3:
- crtc->ge_screen_pitch = 1280;
- break;
- case 4:
- crtc->ge_screen_pitch = 1152;
- break;
- case 5:
- crtc->ge_screen_pitch = 0; /* reserved */
- break;
- case 6:
- crtc->ge_screen_pitch = 1600;
- break;
- case 7:
- crtc->ge_screen_pitch = 0; /* reserved */
- break;
- }
- switch (crtc->pixel_length) {
- case 0:
- crtc->bits_per_pixel = 8;
- crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8;
- break;
- case 1:
- crtc->bits_per_pixel = 16;
- crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 4;
- break;
- case 3:
- crtc->bits_per_pixel = 32;
- crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8;
- break;
- }
- crtc->double_pixel_mode = 0;
- switch (crtc->color_mode) {
- case 0x0:
- crtc->depth = 8; break;
- case 0x1:
- crtc->depth = 8; crtc->double_pixel_mode = 1; break;
- case 0x3:
- crtc->depth = 15; break;
- case 0x5:
- crtc->depth = 16; break;
- case 0x7:
- crtc->depth = 24; break; /* unused */
- case 0xd:
- crtc->depth = 24; break;
- }
-}
-
-static void
-_s3SetBlank (S3Ptr s3, Bool blank)
-{
- CARD8 clock_mode;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "3c4 at 0x%x\n", &s3->crt_vga_3c4));
- clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01);
- if (blank)
- clock_mode |= 0x20;
- else
- clock_mode &= ~0x20;
- _s3WaitVRetrace (s3);
- _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, clock_mode);
- DRAW_DEBUG ((DEBUG_S3INIT, "blank is set to 0x%x", clock_mode));
-}
-
-static void
-_s3SetDepth (S3Ptr s3, S3Crtc *crtc)
-{
- CARD8 save_3c2;
- _s3SetBlank (s3, TRUE);
- PutCrtc(s3, 0x38, 0x48);
- PutCrtc(s3, 0x39, 0xA0);
- PutCrtc(s3, 0x00, crtc->h_total_0_7);
- PutCrtc(s3, 0x01, crtc->h_display_end_0_7);
- PutCrtc(s3, 0x02, crtc->h_blank_start_0_7);
- PutCrtc(s3, 0x03, crtc->_h_blank_end);
- PutCrtc(s3, 0x04, crtc->h_sync_start_0_7);
- PutCrtc(s3, 0x05, crtc->_h_sync_end);
- PutCrtc(s3, 0x06, crtc->v_total_0_7);
- PutCrtc(s3, 0x07, crtc->crtc_overflow);
- PutCrtc(s3, 0x09, crtc->_max_scan_line);
- PutCrtc(s3, 0x0c, crtc->start_address_8_15);
- PutCrtc(s3, 0x0d, crtc->start_address_0_7);
- PutCrtc(s3, 0x10, crtc->v_retrace_start_0_7);
- PutCrtc(s3, 0x11, crtc->_v_retrace_end);
- PutCrtc(s3, 0x12, crtc->v_display_end_0_7);
- PutCrtc(s3, 0x13, crtc->screen_off_0_7);
- PutCrtc(s3, 0x15, crtc->v_blank_start_0_7);
- PutCrtc(s3, 0x16, crtc->v_blank_end_0_7);
- PutCrtc(s3, 0x18, crtc->line_compare_0_7);
- PutCrtc(s3, 0x31, crtc->memory_configuration);
- PutCrtc(s3, 0x3a, crtc->misc_1);
- PutCrtc(s3, 0x3b, crtc->h_start_fifo_fetch_0_7);
- PutCrtc(s3, 0x42, crtc->mode_control);
- PutCrtc(s3, 0x45, crtc->hardware_cursor_mode);
- PutCrtc(s3, 0x4c, crtc->cursor_address_8_15);
- PutCrtc(s3, 0x4d, crtc->cursor_address_0_7);
- PutCrtc(s3, 0x50, crtc->extended_system_control_1);
- PutCrtc(s3, 0x51, crtc->extended_system_control_2);
- PutCrtc(s3, 0x53, crtc->extended_memory_control);
- PutCrtc(s3, 0x55, crtc->extended_ramdac_control);
- PutCrtc(s3, 0x5d, crtc->extended_horizontal_overflow);
- PutCrtc(s3, 0x5e, crtc->extended_vertical_overflow);
- PutCrtc(s3, 0x62, crtc->l_parm_0_7);
- PutCrtc(s3, 0x65, crtc->extended_misc_control);
- PutCrtc(s3, 0x67, crtc->extended_misc_control_2);
- PutCrtc(s3, 0x68, crtc->configuration_3);
- PutCrtc(s3, 0x69, crtc->extended_system_control_3);
- PutCrtc(s3, 0x6d, crtc->extended_bios_5);
- PutCrtc(s3, 0x39, 0x00);
- PutCrtc(s3, 0x38, 0x00);
- PutSrtc(s3, 0x0b, crtc->extended_sequencer_b);
- PutSrtc(s3, 0x0d, crtc->extended_sequencer_d);
- /*
- * Move new dclk/mclk values into PLL
- */
- save_3c2 = s3->crt_vga_3cc;
- DRAW_DEBUG ((DEBUG_S3INIT, "save_3c2 0x%x", save_3c2));
- s3->crt_vga_3c2 = save_3c2 | 0x0c;
-
- PutSrtc(s3, 0x12, crtc->dclk_value_low);
- PutSrtc(s3, 0x13, crtc->dclk_value_high);
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Set PLL load enable, frobbing clk_load..."));
- crtc->dfrq_en = 1;
- PutSrtc(s3, 0x15, crtc->control_2);
- PutSrtc(s3, 0x18, crtc->ramdac_control);
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Clk load frobbed, restoring 3c2 to 0x%x", save_3c2));
- s3->crt_vga_3c2 = save_3c2;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Enabling display"));
- _s3SetBlank (s3, FALSE);
-}
-
-void
-_s3RestoreCrtc (S3Ptr s3, S3Crtc *crtc)
-{
- _s3SetDepth (s3, crtc);
-}
-
-s3Reset (S3CardInfo *s3c)
-{
- S3Ptr s3 = s3c->s3;
- S3Save *save = &s3c->save;
- CARD8 *cursor_base;
-
- LockS3 (s3c);
-
- _s3UnlockExt (s3);
-
- _s3RestoreCrtc (s3, &save->crtc);
-
- /* set foreground */
- /* Reset cursor color stack pointers */
- (void) GetCrtc(s3, 0x45);
- PutCrtc(s3, 0x4a, save->cursor_fg);
- /* XXX for deeper screens? */
-
- /* set background */
- /* Reset cursor color stack pointers */
- (void) GetCrtc(s3, 0x45);
- PutCrtc(s3, 0x4b, save->cursor_bg);
-
- _s3LockExt (s3);
-
- /* graphics engine state */
- s3->alt_mix = save->alt_mix;
- s3->write_mask = save->write_mask;
- s3->fg = save->fg;
- s3->bg = save->bg;
- /* XXX should save and restore real values? */
- s3->scissors_tl = 0x00000000;
- s3->scissors_br = 0x0fff0fff;
-
- _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, save->clock_mode);
- PutCrtc(s3, 0x39, save->lock2);
- PutCrtc(s3, 0x38, save->lock1);
-
- UnlockS3 (s3c);
-}
-
-void
-s3Save (S3CardInfo *s3c)
-{
- S3Ptr s3 = s3c->s3;
- S3Save *save = &s3c->save;
- S3Crtc newCrtc;
- CARD8 t1, t2;
- CARD8 *cursor_base;
-
- LockS3 (s3c);
-
- save->alt_mix = s3->alt_mix;
- save->write_mask = s3->write_mask;
- save->fg = s3->fg;
- save->bg = s3->bg;
-
- save->lock1 = GetCrtc(s3, 0x38);
- save->lock2 = GetCrtc(s3, 0x39);
- save->clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01);
-
- _s3UnlockExt (s3);
- save->cursor_fg = GetCrtc(s3, 0x4a);
- save->cursor_bg = GetCrtc(s3, 0x4b);
-
- _s3LoadCrtc (s3, &save->crtc);
-
- _s3LockExt (s3);
-
- UnlockS3 (s3c);
-}
-Bool
-s3CardInit (KdCardInfo *card)
-{
- S3CardInfo *s3c;
- S3Ptr s3;
- int size;
- CARD8 *registers;
- CARD32 s3Address = card->attr.address[0];
- CARD8 *temp_buffer;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "s3CardInit"));
- s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo));
- if (!s3c)
- {
- DRAW_DEBUG ((DEBUG_FAILURE, "can't alloc s3 card info"));
- goto bail0;
- }
-
- memset (s3c, '\0', sizeof (S3CardInfo));
-
- card->driver = s3c;
-
- fprintf (stderr, "S3 at 0x%x\n", s3Address);
- registers = KdMapDevice (s3Address + REGISTERS_OFFSET,
- sizeof (S3) + PACKED_OFFSET);
- if (!registers)
- {
- ErrorF ("Can't map s3 device\n");
- goto bail2;
- }
- s3 = (S3Ptr) (registers + PACKED_OFFSET);
- s3c->registers = registers;
- s3c->s3 = s3;
-
- s3->crt_vga_3c3 = 1; /* wake up part from deep sleep */
- s3->crt_vga_3c2 = 0x01 | 0x02 | 0x0c;
-
- s3->crt_vga_3c4 = 0x58;
- s3->crt_vga_3c5 = 0x10 | 0x3;
-
- /*
- * Can't trust S3 register value for frame buffer amount, must compute
- */
- temp_buffer = KdMapDevice (s3Address, 4096 * 1024);
-
- s3c->memory = KdFrameBufferSize (temp_buffer, 4096 * 1024);
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Detected frame buffer %d", s3c->memory));
-
- KdUnmapDevice (temp_buffer, 4096 * 1024);
-
- if (!s3c->memory)
- {
- ErrorF ("Can't detect s3 frame buffer\n");
- goto bail3;
- }
-
- s3c->frameBuffer = KdMapDevice (s3Address, s3c->memory);
- if (!s3c->frameBuffer)
- {
- ErrorF ("Can't map s3 frame buffer\n");
- goto bail3;
- }
-
- card->driver = s3c;
-
- return TRUE;
-bail3:
- KdUnmapDevice ((void *) s3, sizeof (S3));
-bail2:
-bail1:
- xfree (s3c);
-bail0:
- return FALSE;
-}
-
-Bool
-s3ModeSupported (KdScreenInfo *screen,
- const KdMonitorTiming *t)
-{
- if (t->horizontal != 1600 &&
- t->horizontal != 1280 &&
- t->horizontal != 1152 &&
- t->horizontal != 1024 &&
- t->horizontal != 800 &&
- t->horizontal != 640)
- return FALSE;
- if (t->clock > S3_MAX_CLOCK * 2)
- return FALSE;
- return TRUE;
-}
-
-Bool
-s3ModeUsable (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
- int screen_size;
- int pixel_width;
- int byte_width;
-
- if (screen->fb[0].depth >= 24)
- {
- screen->fb[0].depth = 24;
- screen->fb[0].bitsPerPixel = 32;
- }
- else if (screen->fb[0].depth >= 16)
- {
- screen->fb[0].depth = 16;
- screen->fb[0].bitsPerPixel = 16;
- }
- else if (screen->fb[0].depth >= 15)
- {
- screen->fb[0].depth = 15;
- screen->fb[0].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[0].depth = 8;
- screen->fb[0].bitsPerPixel = 8;
- }
-
- byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
- pixel_width = screen->width;
- screen->fb[0].pixelStride = pixel_width;
- screen->fb[0].byteStride = byte_width;
-
- screen_size = byte_width * screen->height;
-
- return screen_size <= s3c->memory;
-}
-
-Bool
-s3ScreenInit (KdScreenInfo *screen)
-{
- KdCardInfo *card = screen->card;
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
- S3ScreenInfo *s3s;
- int screen_size;
- int memory;
- int requested_memory;
- int v_total, h_total;
- int byte_width;
- int pixel_width;
- int m, n, r;
- int i;
- const KdMonitorTiming *t;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "s3ScreenInit"));
- s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo));
- if (!s3s)
- return FALSE;
-
- memset (s3s, '\0', sizeof (S3ScreenInfo));
-
- if (!screen->width || !screen->height)
- {
- screen->width = 800;
- screen->height = 600;
- screen->rate = 72;
- }
- if (!screen->fb[0].depth)
- screen->fb[0].depth = 8;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Requested parameters %dx%dx%d",
- screen->width, screen->height, screen->rate));
- t = KdFindMode (screen, s3ModeSupported);
- screen->rate = t->rate;
- screen->width = t->horizontal;
- screen->height = t->vertical;
- s3GetClock (t->clock, &m, &n, &r, 127, 31, 3);
-#if 0
- fprintf (stderr, "computed %d,%d,%d (%d) provided %d,%d,%d (%d)\n",
- m, n, r, S3_CLOCK(m,n,r),
- t->dac_m, t->dac_n, t->dac_r,
- S3_CLOCK(t->dac_m, t->dac_n, t->dac_r));
-#endif
- /*
- * Can only operate in pixel-doubled mode at 8 bits per pixel
- */
- if (screen->fb[0].depth > 8 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK)
- screen->fb[0].depth = 8;
-
- if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported))
- {
- xfree (s3s);
- return FALSE;
- }
-
- memory = s3c->memory - screen_size;
-
- /*
- * Stick frame buffer at start of memory
- */
- screen->fb[0].frameBuffer = s3c->frameBuffer;
-
- /*
- * Stick cursor at end of memory
- */
- if (memory >= 2048)
- {
- s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048);
- memory -= 2048;
- }
- else
- s3s->cursor_base = 0;
-
- /*
- * Use remaining memory for off-screen storage, but only use
- * one piece (either right or bottom).
- */
- if (memory >= byte_width * S3_TILE_SIZE)
- {
- s3s->fb[0].offscreen = s3c->frameBuffer + screen_size;
- s3s->fb[0].offscreen_x = 0;
- s3s->fb[0].offscreen_y = screen_size / byte_width;
- s3s->fb[0].offscreen_width = pixel_width;
- s3s->fb[0].offscreen_height = memory / byte_width;
- memory -= s3s->fb[0].offscreen_height * byte_width;
- }
- else if (pixel_width - screen->width >= S3_TILE_SIZE)
- {
- s3s->fb[0].offscreen = s3c->frameBuffer + screen->width;
- s3s->fb[0].offscreen_x = screen->width;
- s3s->fb[0].offscreen_y = 0;
- s3s->fb[0].offscreen_width = pixel_width - screen->width;
- s3s->fb[0].offscreen_height = screen->height;
- }
- else
- s3s->fb[0].offscreen = 0;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "depth %d bits %d", screen->fb[0].depth, screen->fb[0].bitsPerPixel));
-
- DRAW_DEBUG ((DEBUG_S3INIT, "Screen size %dx%d memory %d",
- screen->width, screen->height, s3c->memory));
- DRAW_DEBUG ((DEBUG_S3INIT, "frame buffer 0x%x cursor 0x%x offscreen 0x%x",
- s3c->frameBuffer, s3s->cursor_base, s3s->offscreen));
- DRAW_DEBUG ((DEBUG_S3INIT, "offscreen %dx%d+%d+%d",
- s3s->offscreen_width, s3s->offscreen_height,
- s3s->offscreen_x, s3s->offscreen_y));
-
- switch (screen->fb[0].depth) {
- case 8:
- screen->fb[0].visuals = ((1 << StaticGray) |
- (1 << GrayScale) |
- (1 << StaticColor) |
- (1 << PseudoColor) |
- (1 << TrueColor) |
- (1 << DirectColor));
- screen->fb[0].blueMask = 0x00;
- screen->fb[0].greenMask = 0x00;
- screen->fb[0].redMask = 0x00;
- break;
- case 15:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x03e0;
- screen->fb[0].redMask = 0x7c00;
- break;
- case 16:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x001f;
- screen->fb[0].greenMask = 0x07e0;
- screen->fb[0].redMask = 0xf800;
- break;
- case 24:
- screen->fb[0].visuals = (1 << TrueColor);
- screen->fb[0].blueMask = 0x0000ff;
- screen->fb[0].greenMask = 0x00ff00;
- screen->fb[0].redMask = 0xff0000;
- break;
- }
-
- screen->driver = s3s;
-
- return TRUE;
-}
-
-void
-s3Preserve (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
-
- s3Save (s3c);
-}
-
-/*
- * Enable the card for rendering. Manipulate the initial settings
- * of the card here.
- */
-Bool
-s3Enable (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- KdScreenInfo *screen = pScreenPriv->screen;
- s3CardInfo (pScreenPriv);
- s3ScreenInfo (pScreenPriv);
-
- S3Crtc crtcR, *crtc;
- int hactive, hblank, hfp, hbp;
- int vactive, vblank, vfp, vbp;
- int hsize;
-
- 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 h_start_fifo_fetch;
-
- int v_total;
- int v_retrace_start;
- int v_retrace_end;
- int v_display_end;
- int v_blank_start;
- int v_blank_end;
-
- int h_adjust;
- int h_sync_extend_;
- int h_blank_extend_;
- int i;
- CARD16 cursor_address;
- const KdMonitorTiming *t;
- int m, n, r;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "s3Enable"));
-
- DRAW_DEBUG ((DEBUG_S3INIT, "requested bpp %d current %d",
- pScreenPriv->bitsPerPixel, s3c->save.crtc.bits_per_pixel));
-
- t = KdFindMode (screen, s3ModeSupported);
-
- hfp = t->hfp;
- hbp = t->hbp;
- hblank = t->hblank;
- hactive = t->horizontal;
-
- vfp = t->vfp;
- vbp = t->vbp;
- vblank = t->vblank;
- vactive = t->vertical;
-
- crtcR = s3c->save.crtc;
- crtc = &crtcR;
-
- s3GetClock (t->clock, &m, &n, &r, 127, 31, 3);
- crtc->dclk_pll_m_trio = m;
- crtc->dclk_pll_n_trio = n;
- crtc->dclk_pll_r_trio = r;
-
- crtc->alt_refresh_count = 0x02;
- crtc->enable_alt_refresh = 1;
- crtc->enable_256_or_more = 1;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "memory_bus_size %d\n", crtc->memory_bus_size));
- crtc->memory_bus_size = 1;
-
- crtc->dclk_over_2 = 0;
- crtc->dclk_invert = 0;
- crtc->enable_clock_double = 0;
- crtc->delay_blank = 0;
- crtc->extended_bios_5 = 0;
- /*
- * Compute character lengths for horizontal timing values
- */
- switch (screen->fb[0].bitsPerPixel) {
- case 8:
- hactive = screen->width / 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- h_screen_off = hactive;
- crtc->pixel_length = 0;
- crtc->color_mode = 0;
- /*
- * Set up for double-pixel mode, switch color modes,
- * divide the dclk and delay h blank by 2 dclks
- */
- if (S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio,
- crtc->dclk_pll_r_trio) > S3_MAX_CLOCK)
- {
- DRAW_DEBUG ((DEBUG_S3INIT, "S3 clock %g > 80MHz, using pixel double mode",
- S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio,
- crtc->dclk_pll_r_trio)));
- crtc->color_mode = 1;
- crtc->dclk_over_2 = 1;
- crtc->enable_clock_double = 1;
- crtc->delay_blank = 2;
- crtc->extended_bios_5 = 2;
- }
- h_adjust = 1;
- break;
- case 16:
- hactive = screen->width / 4;
- hblank /= 4;
- hfp /= 4;
- hbp /= 4;
- h_screen_off = hactive;
- crtc->pixel_length = 1;
- crtc->extended_bios_5 = 2;
- if (crtc->depth == 15)
- crtc->color_mode = 3;
- else
- crtc->color_mode = 5;
- h_adjust = 2;
- break;
- case 32:
- hactive = screen->width / 8;
- hblank /= 8;
- hfp /= 8;
- hbp /= 8;
- h_screen_off = hactive * 4;
- crtc->pixel_length = 3;
- crtc->color_mode = 0xd;
- h_adjust = 1;
- break;
- }
-
- /*
- * X server starts frame buffer at top of memory
- */
- DRAW_DEBUG ((DEBUG_S3INIT, "Old start address 0x%x\n",
- crtc_start_address (crtc)));
- crtc_set_start_address (crtc, 0);
-
- /*
- * Compute horizontal register values from timings
- */
- h_total = hactive + hblank - 5;
- h_display_end = hactive - 1;
- h_blank_start = h_display_end;
- h_blank_end = h_blank_start + hblank - h_adjust;
- h_sync_start = hactive + hfp + h_adjust;
- h_sync_end = h_sync_start + hblank - hbp - hfp;
- h_start_fifo_fetch = h_total - 5;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x sync_start 0x%x\n",
- h_blank_end, h_sync_end, h_sync_start));
-
- if (h_blank_end - h_blank_start > 0x40)
- h_blank_extend_ = 1;
- else
- h_blank_extend_ = 0;
-
- if (h_sync_end - h_sync_start > 0x20)
- h_sync_extend_ = 1;
- else
- h_sync_extend_ = 0;
-
- DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x extend %d\n",
- h_blank_end, h_sync_end, h_sync_extend_));
-
- crtc_set_h_total(crtc, h_total);
- crtc_set_h_display_end (crtc, h_display_end);
- crtc_set_h_blank_start (crtc, h_blank_start);
- crtc_set_h_blank_end (crtc, h_blank_end);
- crtc_set_h_sync_start (crtc, h_sync_start);
- crtc_set_h_sync_end (crtc, h_sync_end);
- crtc_set_screen_off (crtc, h_screen_off);
- crtc_set_h_start_fifo_fetch (crtc, h_start_fifo_fetch);
- crtc->h_sync_extend = h_sync_extend_;
- crtc->h_blank_extend = h_blank_extend_;
-
-
- v_total = vactive + vblank - 2;
- v_retrace_start = vactive + vfp - 1;
- v_retrace_end = v_retrace_start + vblank - vbp - 1;
- v_display_end = vactive - 1;
- v_blank_start = vactive - 1;
- v_blank_end = v_blank_start + vblank - 1;
-
- crtc_set_v_total(crtc, v_total);
- crtc_set_v_retrace_start (crtc, v_retrace_start);
- crtc->v_retrace_end_0_3 = v_retrace_end;
- crtc_set_v_display_end (crtc, v_display_end);
- crtc_set_v_blank_start (crtc, v_blank_start);
- crtc->v_blank_end_0_7 = v_blank_end;
-
- /*
- * Set cursor
- */
- if (!screen->softCursor)
- {
- cursor_address = (s3s->cursor_base - screen->fb[0].frameBuffer) / 1024;
-
- crtc->cursor_address_0_7 = cursor_address;
- crtc->cursor_address_8_15 = cursor_address >> 8;
- crtc->hardware_cursor_ms_x11 = 0;
- crtc->hardware_cursor_enable = 1;
- }
- else
- crtc->hardware_cursor_enable = 0;
-
- /*
- * Set accelerator
- */
- switch (screen->width) {
- case 640: crtc_set_ge_screen_width(crtc,1); break;
- case 800: crtc_set_ge_screen_width(crtc,2); break;
- case 1024: crtc_set_ge_screen_width(crtc,0); break;
- case 1152: crtc_set_ge_screen_width(crtc,4); break;
- case 1280: crtc_set_ge_screen_width(crtc,3); break;
- case 1600: crtc_set_ge_screen_width(crtc,6); break;
- }
-
- /*
- * Set depth values
- */
- crtc->bits_per_pixel = screen->fb[0].bitsPerPixel;
- crtc->depth = screen->fb[0].depth;
-
- crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */
-
- crtc->disable_v_retrace_int = 1; /* don't let retrace interrupt */
-
- DRAW_DEBUG ((DEBUG_S3INIT, "new h total %d display_end %d",
- crtc_h_total(crtc),
- crtc_h_display_end(crtc)));
- DRAW_DEBUG ((DEBUG_S3INIT, " sync_start %d sync_end %d (%d)",
- crtc_h_sync_start(crtc),
- crtc_h_sync_end(crtc), h_sync_end));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d",
- crtc_h_blank_start(crtc),
- crtc_h_blank_end(crtc)));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " screen_off %d start_fifo %d",
- crtc_screen_off(crtc), crtc_h_start_fifo_fetch(crtc)));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d",
- hactive, hblank, hfp, hbp));
-
- DRAW_DEBUG ((DEBUG_S3INIT, "new v total %d display_end %d",
- crtc_v_total(crtc),
- crtc_v_display_end(crtc)));
- DRAW_DEBUG ((DEBUG_S3INIT, " retrace_start %d retrace_end %d (%d)",
- crtc_v_retrace_start(crtc),
- crtc->v_retrace_end,
- v_retrace_end));
- DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d",
- crtc_v_blank_start(crtc),
- crtc->v_blank_end_0_7));
-
- DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d",
- vactive, vblank, vfp, vbp));
-
- /*
- * Set DPMS to normal
- */
- crtc->hsync_control = 0;
- crtc->vsync_control = 0;
-
- LockS3 (s3c);
- _s3SetDepth (s3c->s3, crtc);
- UnlockS3 (s3c);
- return TRUE;
-}
-
-void
-s3Disable (ScreenPtr pScreen)
-{
-}
-
-void
-s3Restore (KdCardInfo *card)
-{
- S3CardInfo *s3c = card->driver;
-
- s3Reset (s3c);
-}
-
-void
-_s3SetSync (S3CardInfo *s3c, int hsync, int vsync)
-{
- /* this abuses the macros defined to access the crtc structure */
- union extended_sequencer_d_u _extended_sequencer_d_u;
- S3Ptr s3 = s3c->s3;
-
- extended_sequencer_d = s3c->save.crtc.extended_sequencer_d;
- hsync_control = hsync;
- vsync_control = vsync;
- PutSrtc (s3, 0x0d, extended_sequencer_d);
-}
-
-Bool
-s3DPMS (ScreenPtr pScreen, int mode)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
-
- switch (mode) {
- case KD_DPMS_NORMAL:
- _s3SetSync (s3c, 0, 0);
- _s3SetBlank (s3c->s3, FALSE);
- break;
- case KD_DPMS_STANDBY:
- _s3SetBlank (s3c->s3, TRUE);
- _s3SetSync (s3c, 1, 0);
- break;
- case KD_DPMS_SUSPEND:
- _s3SetBlank (s3c->s3, TRUE);
- _s3SetSync (s3c, 0, 1);
- break;
- case KD_DPMS_POWERDOWN:
- _s3SetBlank (s3c->s3, TRUE);
- _s3SetSync (s3c, 1, 1);
- break;
- }
- return TRUE;
-}
-
-void
-s3ScreenFini (KdScreenInfo *screen)
-{
- S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver;
-
- xfree (s3s);
- screen->driver = 0;
-}
-
-void
-s3CardFini (KdCardInfo *card)
-{
- S3CardInfo *s3c = (S3CardInfo *) card->driver;
-
- KdUnmapDevice (s3c->frameBuffer, s3c->memory);
- KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET);
-/* DeleteCriticalSection (&s3c->lock); */
- xfree (s3c);
- card->driver = 0;
-}
-
-KdCardFuncs s3Funcs = {
- s3CardInit,
- s3ScreenInit,
- 0,
- s3Preserve,
- s3Enable,
- s3DPMS,
- s3Disable,
- s3Restore,
- s3ScreenFini,
- s3CardFini,
- s3CursorInit,
- s3CursorEnable,
- s3CursorDisable,
- s3CursorFini,
- s3RecolorCursor,
- s3DrawInit,
- s3DrawEnable,
- s3DrawSync,
- s3DrawDisable,
- s3DrawFini,
- s3GetColors,
- s3PutColors,
-};
-
-void
-S3InitCard (KdCardAttr *attr)
-{
- KdCardInfoAdd (&s3Funcs, attr, 0);
-}
diff --git a/hw/kdrive/trio/s3.h b/hw/kdrive/trio/s3.h
deleted file mode 100644
index 6f443ea97..000000000
--- a/hw/kdrive/trio/s3.h
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*
- * Id: s3.h,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3.h,v 1.4 2000/05/06 22:17:53 keithp Exp $ */
-
-#ifndef _S3_H_
-#define _S3_H_
-
-#include "kdrive.h"
-
-#define PLATFORM 300
-
-#define DRAW_DEBUG(a)
-
-#define DEBUG_S3INIT (DEBUG_ACCEL)
-#define DEBUG_CRTC (DEBUG_ACCEL+1)
-#define DEBUG_PATTERN (DEBUG_ACCEL+2)
-#define DEBUG_RECT (DEBUG_ACCEL+3)
-#define DEBUG_PAINT_WINDOW (DEBUG_ACCEL+4)
-#define DEBUG_SET (DEBUG_ACCEL+5)
-#define DEBUG_RENDER (DEBUG_ACCEL+6)
-#define DEBUG_REGISTERS (DEBUG_ACCEL+7)
-#define DEBUG_ARCS (DEBUG_ACCEL+8)
-#define DEBUG_TEXT (DEBUG_ACCEL+9)
-#define DEBUG_POLYGON (DEBUG_ACCEL+10)
-#define DEBUG_CLIP (DEBUG_ACCEL+11)
-
-/* VESA Approved Register Definitions */
-
-/*
- * Linear Addressing 000 0000 - 0ff ffff (16m)
- * Image data transfer 100 0000 - 100 7fff (32k)
- * PCI config 100 8000 - 100 8043
- * Packed enhanced regs 100 8100 - 100 814a
- * Streams regs 100 8180 - 100 81ff
- * Current Y pos 100 82e8
- * CRT VGA 3b? regs 100 83b0 - 100 83bf
- * CRT VGA 3c? regs 100 83c0 - 100 83cf
- * CRT VGA 3d? regs 100 83d0 - 100 83df
- * Subsystem status (42e8h) 100 8504
- * Advanced function (42e8h) 100 850c
- * Enhanced regs 100 86e8 - 100 eeea
- * Local peripheral bus 100 ff00 - 100 ff5c
- *
- * We don't care about the image transfer or PCI regs, so
- * this structure starts at the packed enhanced regs
- */
-
-typedef volatile CARD32 VOL32;
-typedef volatile CARD16 VOL16;
-typedef volatile CARD8 VOL8;
-
-typedef volatile struct _s3 {
- VOL32 alt_curxy; /* 8100 */
- VOL32 _pad0; /* 8104 */
- VOL32 alt_step; /* 8108 */
- VOL32 _pad1; /* 810c */
- VOL32 err_term; /* 8110 */
- VOL32 _pad2; /* 8114 */
- VOL32 cmd_gp_stat; /* 8118 */
- VOL32 short_stroke; /* 811c */
- VOL32 bg; /* 8120 */
- VOL32 fg; /* 8124 */
- VOL32 write_mask; /* 8128 */
- VOL32 read_mask; /* 812c */
- VOL32 color_cmp; /* 8130 */
- VOL32 alt_mix; /* 8134 */
- VOL32 scissors_tl; /* 8138 */
- VOL32 scissors_br; /* 813c */
- VOL32 pix_cntl_mult_misc2; /* 8140 */
- VOL32 mult_misc_read_sel; /* 8144 */
- VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */
- VOL8 _pad3[0x19c]; /* 814c */
- VOL16 cur_y; /* 82e8 */
- VOL8 _pad4[0xc6]; /* 82ea */
-
- VOL8 crt_vga_3b0; /* 83b0 */
- VOL8 crt_vga_3b1; /* 83b1 */
- VOL8 crt_vga_3b2; /* 83b2 */
- VOL8 crt_vga_3b3; /* 83b3 */
- VOL8 crt_vga_3b4; /* 83b4 */
- VOL8 crt_vga_3b5; /* 83b5 */
- VOL8 crt_vga_3b6; /* 83b6 */
- VOL8 crt_vga_3b7; /* 83b7 */
- VOL8 crt_vga_3b8; /* 83b8 */
- VOL8 crt_vga_3b9; /* 83b9 */
- VOL8 crt_vga_3ba; /* 83ba */
- VOL8 crt_vga_3bb; /* 83bb */
- VOL8 crt_vga_3bc; /* 83bc */
- VOL8 crt_vga_3bd; /* 83bd */
- VOL8 crt_vga_3be; /* 83be */
- VOL8 crt_vga_3bf; /* 83bf */
-
- VOL8 crt_vga_3c0; /* 83c0 */
- VOL8 crt_vga_3c1; /* 83c1 */
- VOL8 crt_vga_3c2; /* 83c2 */
- VOL8 crt_vga_3c3; /* 83c3 */
- VOL8 crt_vga_3c4; /* 83c4 */
- VOL8 crt_vga_3c5; /* 83c5 */
- VOL8 crt_vga_dac_ad_mk; /* 83c6 */
- VOL8 crt_vga_dac_rd_ad; /* 83c7 */
- VOL8 crt_vga_dac_wt_ad; /* 83c8 */
- VOL8 crt_vga_dac_data; /* 83c9 */
- VOL8 crt_vga_3ca; /* 83ca */
- VOL8 crt_vga_3cb; /* 83cb */
- VOL8 crt_vga_3cc; /* 83cc */
- VOL8 crt_vga_3cd; /* 83cd */
- VOL8 crt_vga_3ce; /* 83ce */
- VOL8 crt_vga_3cf; /* 83cf */
-
- VOL8 crt_vga_3d0; /* 83d0 */
- VOL8 crt_vga_3d1; /* 83d1 */
- VOL8 crt_vga_3d2; /* 83d2 */
- VOL8 crt_vga_3d3; /* 83d3 */
- VOL8 crt_vga_3d4; /* 83d4 */
- VOL8 crt_vga_3d5; /* 83d5 */
- VOL8 crt_vga_3d6; /* 83d6 */
- VOL8 crt_vga_3d7; /* 83d7 */
- VOL8 crt_vga_3d8; /* 83d8 */
- VOL8 crt_vga_3d9; /* 83d9 */
- VOL8 crt_vga_status_1; /* 83da */
- VOL8 crt_vga_3db; /* 83db */
- VOL8 crt_vga_3dc; /* 83dc */
- VOL8 crt_vga_3dd; /* 83dd */
- VOL8 crt_vga_3de; /* 83de */
- VOL8 crt_vga_3df; /* 83df */
-
- VOL8 _pad5[0x124]; /* 83e0 */
- VOL16 subsys_status; /* 8504 */
- VOL8 _pad6[0x6]; /* 8506 */
- VOL16 adv_control; /* 850c */
- VOL8 _pad7[0x1da]; /* 850e */
- VOL16 cur_x; /* 86e8 */
- VOL8 _pad8[0x3fe]; /* 86ea */
- VOL16 desty_axstp; /* 8ae8 */
- VOL8 _pad9[0x3fe]; /* 8aea */
- VOL16 destx_diastp; /* 8ee8 */
- VOL8 _pad10[0x3fe]; /* 8eea */
- VOL16 enh_err_term; /* 92e8 */
- VOL8 _pad11[0x3fe]; /* 92ea */
- VOL16 maj_axis_pcnt; /* 96e8 */
- VOL8 _pad12[0x3fe]; /* 96ea */
- VOL16 enh_cmd_gp_stat; /* 9ae8 */
- VOL8 _pad13[0x3fe]; /* 9aea */
- VOL16 enh_short_stroke; /* 9ee8 */
- VOL8 _pad14[0x3fe]; /* 9eea */
- VOL16 enh_bg; /* a2e8 */
- VOL8 _pad15[0x3fe]; /* a2ea */
- VOL16 enh_fg; /* a6e8 */
- VOL8 _pad16[0x3fe]; /* a6ea */
- VOL16 enh_wrt_mask; /* aae8 */
- VOL8 _pad17[0x3fe]; /* aaea */
- VOL16 enh_rd_mask; /* aee8 */
- VOL8 _pad18[0x3fe]; /* aeea */
- VOL16 enh_color_cmp; /* b2e8 */
- VOL8 _pad19[0x3fe]; /* b2ea */
- VOL16 enh_bg_mix; /* b6e8 */
- VOL8 _pad20[0x3fe]; /* b6ea */
- VOL16 enh_fg_mix; /* bae8 */
- VOL8 _pad21[0x3fe]; /* baea */
- VOL16 enh_rd_reg_dt; /* bee8 */
- VOL8 _pad22[0x23fe]; /* beea */
- VOL32 pix_trans; /* e2e8 */
-} S3, *S3Ptr;
-
-#define VGA_STATUS_1_DTM 0x01
-#define VGA_STATUS_1_VSY 0x08
-
-#define DAC_MASK 0x03c6
-#define DAC_R_INDEX 0x03c7
-#define DAC_W_INDEX 0x03c8
-#define DAC_DATA 0x03c9
-#define DISP_STAT 0x02e8
-#define H_TOTAL 0x02e8
-#define H_DISP 0x06e8
-#define H_SYNC_STRT 0x0ae8
-#define H_SYNC_WID 0x0ee8
-#define V_TOTAL 0x12e8
-#define V_DISP 0x16e8
-#define V_SYNC_STRT 0x1ae8
-#define V_SYNC_WID 0x1ee8
-#define DISP_CNTL 0x22e8
-#define ADVFUNC_CNTL 0x4ae8
-#define SUBSYS_STAT 0x42e8
-#define SUBSYS_CNTL 0x42e8
-#define ROM_PAGE_SEL 0x46e8
-#define CUR_Y 0x82e8
-#define CUR_X 0x86e8
-#define DESTY_AXSTP 0x8ae8
-#define DESTX_DIASTP 0x8ee8
-#define ERR_TERM 0x92e8
-#define MAJ_AXIS_PCNT 0x96e8
-#define GP_STAT 0x9ae8
-#define CMD 0x9ae8
-#define SHORT_STROKE 0x9ee8
-#define BKGD_COLOR 0xa2e8
-#define FRGD_COLOR 0xa6e8
-#define WRT_MASK 0xaae8
-#define RD_MASK 0xaee8
-#define COLOR_CMP 0xb2e8
-#define BKGD_MIX 0xb6e8
-#define FRGD_MIX 0xbae8
-#define MULTIFUNC_CNTL 0xbee8
-#define MIN_AXIS_PCNT 0x0000
-#define SCISSORS_T 0x1000
-#define SCISSORS_L 0x2000
-#define SCISSORS_B 0x3000
-#define SCISSORS_R 0x4000
-#define MEM_CNTL 0x5000
-#define PATTERN_L 0x8000
-#define PATTERN_H 0x9000
-#define PIX_CNTL 0xa000
-#define CONTROL_MISC2 0xd000
-#define PIX_TRANS 0xe2e8
-
-/* Advanced Function Control Regsiter */
-#define CLKSEL 0x0004
-#define DISABPASSTHRU 0x0001
-
-/* Graphics Processor Status Register */
-
-#define GPNSLOT 13
-
-#define GPBUSY_1 0x0080
-#define GPBUSY_2 0x0040
-#define GPBUSY_3 0x0020
-#define GPBUSY_4 0x0010
-#define GPBUSY_5 0x0008
-#define GPBUSY_6 0x0004
-#define GPBUSY_7 0x0002
-#define GPBUSY_8 0x0001
-#define GPBUSY_9 0x8000
-#define GPBUSY_10 0x4000
-#define GPBUSY_11 0x2000
-#define GPBUSY_12 0x1000
-#define GPBUSY_13 0x0800
-
-#define GPEMPTY 0x0400
-#define GPBUSY 0x0200
-#define DATDRDY 0x0100
-
-/* Command Register */
-#define CMD_NOP 0x0000
-#define CMD_LINE 0x2000
-#define CMD_RECT 0x4000
-#define CMD_RECTV1 0x6000
-#define CMD_RECTV2 0x8000
-#define CMD_LINEAF 0xa000
-#define CMD_BITBLT 0xc000
-#define CMD_PATBLT 0xe000
-#define CMD_OP_MSK 0xe000
-#define BYTSEQ 0x1000
-#define _32BITNOPAD 0x0600
-#define _32BIT 0x0400
-#define _16BIT 0x0200
-#define _8BIT 0x0000
-#define PCDATA 0x0100
-#define INC_Y 0x0080
-#define YMAJAXIS 0x0040
-#define INC_X 0x0020
-#define DRAW 0x0010
-#define LINETYPE 0x0008
-#define LASTPIX 0x0004 /* Draw last pixel in line */
-#define PLANAR 0x0002
-#define WRTDATA 0x0001
-
-/* Background Mix Register */
-#define BSS_BKGDCOL 0x0000
-#define BSS_FRGDCOL 0x0020
-#define BSS_PCDATA 0x0040
-#define BSS_BITBLT 0x0060
-
-/* Foreground Mix Register */
-#define FSS_BKGDCOL 0x0000
-#define FSS_FRGDCOL 0x0020
-#define FSS_PCDATA 0x0040
-#define FSS_BITBLT 0x0060
-
-/* The Mixes */
-#define MIX_MASK 0x001f
-
-#define MIX_NOT_DST 0x0000
-#define MIX_0 0x0001
-#define MIX_1 0x0002
-#define MIX_DST 0x0003
-#define MIX_NOT_SRC 0x0004
-#define MIX_XOR 0x0005
-#define MIX_XNOR 0x0006
-#define MIX_SRC 0x0007
-#define MIX_NAND 0x0008
-#define MIX_NOT_SRC_OR_DST 0x0009
-#define MIX_SRC_OR_NOT_DST 0x000a
-#define MIX_OR 0x000b
-#define MIX_AND 0x000c
-#define MIX_SRC_AND_NOT_DST 0x000d
-#define MIX_NOT_SRC_AND_DST 0x000e
-#define MIX_NOR 0x000f
-
-#define MIX_MIN 0x0010
-#define MIX_DST_MINUS_SRC 0x0011
-#define MIX_SRC_MINUS_DST 0x0012
-#define MIX_PLUS 0x0013
-#define MIX_MAX 0x0014
-#define MIX_HALF__DST_MINUS_SRC 0x0015
-#define MIX_HALF__SRC_MINUS_DST 0x0016
-#define MIX_AVERAGE 0x0017
-#define MIX_DST_MINUS_SRC_SAT 0x0018
-#define MIX_SRC_MINUS_DST_SAT 0x001a
-#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c
-#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e
-#define MIX_AVERAGE_SAT 0x001f
-
-/* Pixel Control Register */
-#define MIXSEL_FRGDMIX 0x0000
-#define MIXSEL_PATT 0x0040
-#define MIXSEL_EXPPC 0x0080
-#define MIXSEL_EXPBLT 0x00c0
-#define COLCMPOP_F 0x0000
-#define COLCMPOP_T 0x0008
-#define COLCMPOP_GE 0x0010
-#define COLCMPOP_LT 0x0018
-#define COLCMPOP_NE 0x0020
-#define COLCMPOP_EQ 0x0028
-#define COLCMPOP_LE 0x0030
-#define COLCMPOP_GT 0x0038
-#define PLANEMODE 0x0004
-
-#define FIFO_SLOTS 13
-
-#define GPSLOT(n) (1 << ((n) > 8 ? (15 - ((n) - 9)) : (8 - (n))))
-
-/* Wait for n slots to become available */
-#if 0
-#define _s3WaitSlots(s3,n) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitSlots 0x%x %d", (s3)->cmd_gp_stat, n)); \
- while (((s3)->cmd_gp_stat & GPSLOT(n)) != 0); \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 0x%x %d slots ready", (s3)->cmd_gp_stat, n)); \
-}
-#else
-/* let PCI retries solve this problem */
-#define _s3WaitSlots(s3,n)
-#endif
-
-/* Wait until queue is empty */
-#define _s3WaitEmpty(s3) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitEmpty 0x%x", (s3)->cmd_gp_stat)); \
- while (!((s3)->cmd_gp_stat & GPEMPTY)) ; \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 empty")); \
-}
-
-/* Wait until GP is idle and queue is empty */
-#define _s3WaitIdleEmpty(s3) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdleEmpty 0x%x", (s3)->cmd_gp_stat)); \
- while (((s3)->cmd_gp_stat & (GPBUSY|GPEMPTY)) != GPEMPTY) ; \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 idle empty")); \
-}
-
-/* Wait until GP is idle */
-#define _s3WaitIdle(s3) { \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdle 0x%x", (s3)->cmd_gp_stat)); \
- while ((s3)->cmd_gp_stat & GPBUSY) ; \
- DRAW_DEBUG ((DEBUG_CRTC, " s3 idle")); \
-}
-
-typedef struct _s3Cursor {
- int width, height;
- int xhot, yhot;
- Bool has_cursor;
- CursorPtr pCursor;
- Pixel source, mask;
-} S3Cursor;
-
-typedef struct _s3PatternCache {
- int id;
- int x, y;
-} S3PatternCache;
-
-typedef struct _s3Patterns {
- S3PatternCache *cache;
- int ncache;
- int last_used;
- int last_id;
-} S3Patterns;
-
-typedef struct _crtc {
- CARD8 h_total_0_7; /* CR0 */
- CARD8 h_display_end_0_7; /* CR1 */
- CARD8 h_blank_start_0_7; /* CR2 */
- union {
- struct {
- CARD8 _h_blank_end_0_4 : 5;
- CARD8 _display_skew : 2;
- CARD8 : 1;
- } _h_blank_end_s;
- CARD8 __h_blank_end; /* CR3 */
- } _h_blank_end_u;
-#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4
-#define display_skew _h_blank_end_u._h_blank_end_s._display_skew
-#define _h_blank_end _h_blank_end_u.__h_blank_end
-
- CARD8 h_sync_start_0_7; /* CR4 */
-
- union {
- struct {
- CARD8 _h_sync_end_0_4 : 5;
- CARD8 _horizontal_skew : 2;
- CARD8 _h_blank_end_5 : 1;
- } _h_sync_end_s;
- CARD8 __h_sync_end; /* CR5 */
- } _h_sync_end_u;
-
-#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4
-#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew
-#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5
-#define _h_sync_end _h_sync_end_u.__h_sync_end
-
- CARD8 v_total_0_7; /* CR6 */
-
- union {
- struct {
- CARD8 _v_total_8 : 1;
- CARD8 _v_display_end_8 : 1;
- CARD8 _v_retrace_start_8 : 1;
- CARD8 _v_blank_start_8 : 1;
- CARD8 _line_compare_8 : 1;
- CARD8 _v_total_9 : 1;
- CARD8 _v_display_end_9 : 1;
- CARD8 _v_retrace_start_9 : 1;
- } _crtc_overflow_s;
- CARD8 _crtc_overflow; /* CR7 */
- } _crtc_overflow_u;
-
-#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8
-#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8
-#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8
-#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8
-#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8
-#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9
-#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9
-#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9
-#define crtc_overflow _crtc_overflow_u._crtc_overflow
-
- CARD8 preset_row_scan; /* CR8 (unused) */
-
- union {
- struct {
- CARD8 _max_scan_line : 5;
- CARD8 _v_blank_start_9 : 1;
- CARD8 _line_compare_9 : 1;
- CARD8 _double_scan : 1;
- } _max_scan_line_s;
- CARD8 __max_scan_line; /* CR9 */
- } _max_scan_line_u;
-
-#define max_scan_line _max_scan_line_u._max_scan_line_s._max_scan_line
-#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9
-#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9
-#define double_scan _max_scan_line_u._max_scan_line_s._double_scan
-#define _max_scan_line _max_scan_line_u.__max_scan_line
-
- CARD8 cursor_start;
- CARD8 cursor_end;
-
- CARD8 start_address_8_15; /* CRC */
- CARD8 start_address_0_7; /* CRD */
-
- CARD8 cursor_loc_high;
- CARD8 cursor_loc_low;
-
- CARD8 v_retrace_start_0_7; /* CR10 */
- union {
- struct {
- CARD8 _v_retrace_end_0_3 : 4;
- CARD8 _clear_v_retrace_int : 1;
- CARD8 _disable_v_retrace_int : 1;
- CARD8 _refresh_cycle_select : 1;
- CARD8 _lock_crtc : 1;
- } _v_retrace_end_s;
- CARD8 __v_retrace_end; /* CR11 */
- } _v_retrace_end_u;
-
-#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3
-#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int
-#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int
-#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select
-#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc
-#define _v_retrace_end _v_retrace_end_u.__v_retrace_end
-
- CARD8 v_display_end_0_7; /* CR12 */
-
- CARD8 screen_off_0_7; /* CR13 */
-
- union {
- struct {
- CARD8 _underline_location : 5;
- CARD8 _count_by_four : 1;
- CARD8 _doubleword_mode : 1;
- CARD8 : 1;
- } _underline_location_s;
- CARD8 __underline_location; /* CR14 (unused) */
- } _underline_location_u;
-
-#define underline_location _underline_location_u._underline_location_s._underline_location
-#define count_by_four _underline_location_u._underline_location_s._count_by_four
-#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode
-#define _underline_location _underline_location_u.__underline_location
-
- CARD8 v_blank_start_0_7; /* CR15 */
- CARD8 v_blank_end_0_7; /* CR16 */
-
- union {
- struct {
- CARD8 _two_bk_cga : 1;
- CARD8 _four_bk_cga : 1;
- CARD8 _v_total_double : 1;
- CARD8 _word_mode : 1;
- CARD8 : 1;
- CARD8 _address_wrap : 1;
- CARD8 _byte_mode : 1;
- CARD8 _hardware_reset : 1;
- } _crtc_mode_s;
- CARD8 _crtc_mode; /* CR17 (unused) */
- } _crtc_mode_u;
-
- CARD8 line_compare_0_7; /* CR18 (unused) */
-
- union {
- struct {
- CARD8 _enable_base_offset : 1;
- CARD8 _enable_two_page : 1;
- CARD8 _enable_vga_16_bit : 1;
- CARD8 _enhanced_mode_mapping : 1;
- CARD8 _old_display_start : 2;
- CARD8 _enable_high_speed_text : 1;
- CARD8 : 1;
- } _memory_configuration_s;
- CARD8 _memory_configuration; /* CR31 (unused) */
- } _memory_configuration_u;
-
-#define memory_configuration _memory_configuration_u._memory_configuration
-#define enable_base_offset _memory_configuration_u._memory_configuration_s._enable_base_offset
-#define enable_two_page _memory_configuration_u._memory_configuration_s._enable_two_page
-#define enable_vga_16_bit _memory_configuration_u._memory_configuration_s._enable_vga_16_bit
-#define enhanved_mode_mapping _memory_configuration_u._memory_configuration_s._enhanced_mode_mapping
-#define old_display_start _memory_configuration_u._memory_configuration_s._old_display_start
-#define enable_high_speed_text _memory_configuration_u._memory_configuration_s._enable_high_speed_text
-
- union {
- struct {
- CARD8 _alt_refresh_count : 2;
- CARD8 _enable_alt_refresh : 1;
- CARD8 _enable_top_memory : 1;
- CARD8 _enable_256_or_more : 1;
- CARD8 _high_speed_text : 1;
- CARD8 : 1;
- CARD8 _pci_burst_disabled : 1;
- } _misc_1_s;
- CARD8 _misc_1; /* CR3A */
- } _misc_1_u;
-#define misc_1 _misc_1_u._misc_1
-#define alt_refresh_count _misc_1_u._misc_1_s._alt_refresh_count
-#define enable_alt_refresh _misc_1_u._misc_1_s._enable_alt_refresh
-#define enable_top_memory _misc_1_u._misc_1_s._enable_top_memory
-#define enable_256_or_more _misc_1_u._misc_1_s._enable_256_or_more
-#define high_speed_text _misc_1_u._misc_1_s._high_speed_text
-#define pci_burst_disabled _misc_1_u._misc_1_s._pci_burst_disabled
-
- CARD8 h_start_fifo_fetch_0_7; /* CR3B */
-
- union {
- struct {
- CARD8 : 5;
- CARD8 interlace : 1;
- CARD8 : 2;
- } _mode_control_s;
- CARD8 _mode_control; /* CR42 */
- } _mode_control_u;
-
-#define mode_control _mode_control_u._mode_control
-
- union {
- struct {
- CARD8 : 2;
- CARD8 _old_screen_off_8 : 1;
- CARD8 : 4;
- CARD8 h_counter_double_mode : 1;
- } _extended_mode_s;
- CARD8 _extended_mode; /* CR43 (unused) */
- } _extended_mode_u;
-
-#define extended_mode _extended_mode_u._extended_mode
-#define old_screen_off_8 _extended_mode_u._extended_mode_s._old_screen_off_8
-
- union {
- struct {
- CARD8 _hardware_cursor_enable : 1;
- CARD8 : 3;
- CARD8 _hardware_cursor_right : 1;
- CARD8 : 3;
- } _hardware_cursor_mode_s;
- CARD8 _hardware_cursor_mode; /* CR45 */
- } _hardware_cursor_mode_u;
-
-#define hardware_cursor_mode _hardware_cursor_mode_u._hardware_cursor_mode
-#define hardware_cursor_enable _hardware_cursor_mode_u._hardware_cursor_mode_s._hardware_cursor_enable
-
- CARD8 cursor_address_8_15; /* CR4C */
- CARD8 cursor_address_0_7; /* CR4D */
-
- union {
- struct {
- CARD8 _ge_screen_width_2 : 1;
- CARD8 : 3;
- CARD8 _pixel_length : 2;
- CARD8 _ge_screen_width_0_1 : 2;
- } _extended_system_control_1_s;
- CARD8 _extended_system_control_1; /* CR50 */
- } _extended_system_control_1_u;
-#define ge_screen_width_2 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_2
-#define pixel_length _extended_system_control_1_u._extended_system_control_1_s._pixel_length
-#define ge_screen_width_0_1 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_0_1
-#define extended_system_control_1 _extended_system_control_1_u._extended_system_control_1
-
- union {
- struct {
- CARD8 : 4;
- CARD8 _screen_off_8_9 : 2;
- CARD8 : 2;
- } _extended_system_control_2_s;
- CARD8 _extended_system_control_2; /* CR51 */
- } _extended_system_control_2_u;
-#define extended_system_control_2 _extended_system_control_2_u._extended_system_control_2
-#define screen_off_8_9 _extended_system_control_2_u._extended_system_control_2_s._screen_off_8_9
-
- union {
- struct {
- CARD8 : 1;
- CARD8 big_endian_linear : 2;
- CARD8 mmio_select : 2;
- CARD8 mmio_window : 1;
- CARD8 swap_nibbles : 1;
- CARD8 : 1;
- } _extended_memory_control_s;
- CARD8 _extended_memory_control; /* CR53 */
- } _extended_memory_control_u;
-#define extended_memory_control _extended_memory_control_u._extended_memory_control
-
- union {
- struct {
- CARD8 : 2;
- CARD8 _enable_gir : 1;
- CARD8 : 1;
- CARD8 _hardware_cursor_ms_x11 : 1;
- CARD8 : 2;
- CARD8 _tri_state_off_vclk : 1;
- } _extended_ramdac_control_s;
- CARD8 _extended_ramdac_control; /* CR55 */
- } _extended_ramdac_control_u;
-#define extended_ramdac_control _extended_ramdac_control_u._extended_ramdac_control
-#define hardware_cursor_ms_x11 _extended_ramdac_control_u._extended_ramdac_control_s._hardware_cursor_ms_x11
-
-
- union {
- struct {
- CARD8 _h_total_8 : 1;
- CARD8 _h_display_end_8 : 1;
- CARD8 _h_blank_start_8 : 1;
- CARD8 _h_blank_extend : 1; /* extend h_blank by 64 */
- CARD8 _h_sync_start_8 : 1;
- CARD8 _h_sync_extend : 1; /* extend h_sync by 32 */
- CARD8 _h_start_fifo_fetch_8 : 1;
- CARD8 : 1;
- } _extended_horizontal_overflow_s;
- CARD8 _extended_horizontal_overflow; /* CR5D */
- } _extended_horizontal_overflow_u;
-#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow
-#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8
-#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8
-#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8
-#define h_blank_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_extend
-#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8
-#define h_sync_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_extend
-#define h_start_fifo_fetch_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_start_fifo_fetch_8
-
-
- union {
- struct {
- CARD8 _v_total_10 : 1;
- CARD8 _v_display_end_10 : 1;
- CARD8 _v_blank_start_10 : 1;
- CARD8 : 1;
- CARD8 _v_retrace_start_10 : 1;
- CARD8 : 1;
- CARD8 _line_compare_10 : 1;
- CARD8 : 1;
- } _extended_vertical_overflow_s;
- CARD8 _extended_vertical_overflow; /* CR5E */
- } _extended_vertical_overflow_u;
-#define extended_vertical_overflow _extended_vertical_overflow_u._extended_vertical_overflow
-#define v_total_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_total_10
-#define v_display_end_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_display_end_10
-#define v_blank_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_blank_start_10
-#define v_retrace_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_retrace_start_10
-#define line_compare_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._line_compare_10
-
-
- CARD8 l_parm_0_7; /* CR62 (undocumented) */
-
- union {
- struct {
- CARD8 : 3;
- CARD8 _delay_blank : 2;
- CARD8 : 3;
- } _extended_misc_control_s;
- CARD8 _extended_misc_control; /* CR65 */
- } _extended_misc_control_u;
-#define extended_misc_control _extended_misc_control_u._extended_misc_control
-#define delay_blank _extended_misc_control_u._extended_misc_control_s._delay_blank
-
- union {
- struct {
- CARD8 _v_clock_phase : 1;
- CARD8 : 3;
- CARD8 _color_mode : 4;
- } _extended_misc_control_2_s;
- CARD8 _extended_misc_control_2; /* CR67 */
- } _extended_misc_control_2_u;
-
-#define v_clock_phase _extended_misc_control_2_u._extended_misc_control_2_s._v_clock_phase
-#define color_mode _extended_misc_control_2_u._extended_misc_control_2_s._color_mode
-#define extended_misc_control_2 _extended_misc_control_2_u._extended_misc_control_2
-
-
- union {
- struct {
- CARD8 cas_oe_str : 2;
- CARD8 ras_low : 1;
- CARD8 ras_precharge : 1;
- CARD8 : 3;
- CARD8 _memory_bus_size : 1; /* 0 = 32, 1 = 32/64 */
- } _configuration_3_s;
- CARD8 _configuration_3; /* CR68 */
- } _configuration_3_u;
-#define configuration_3 _configuration_3_u._configuration_3
-#define memory_bus_size _configuration_3_u._configuration_3_s._memory_bus_size
-
- union {
- struct {
- CARD8 _start_address_16_19 : 4;
- CARD8 : 4;
- } _extended_system_control_3_s;
- CARD8 _extended_system_control_3; /* CR69 */
- } _extended_system_control_3_u;
-#define extended_system_control_3 _extended_system_control_3_u._extended_system_control_3
-#define start_address_16_19 _extended_system_control_3_u._extended_system_control_3_s._start_address_16_19
-
- CARD8 extended_bios_5; /* CR6D */
-
- union {
- struct {
- CARD8 dot_clock_vclki : 1; /* testing only */
- CARD8 vclki_with_vafc : 1; /* feature connector */
- CARD8 : 1;
- CARD8 bpp_24_mode : 1; /* 24 bpp mode */
- CARD8 alt_color_mode : 4; /* feature connector mode */
- } _extended_sequencer_b_s;
- CARD8 _extended_sequencer_b; /* SRB */
- } _extended_sequencer_b_u;
-
-#define extended_sequencer_b _extended_sequencer_b_u._extended_sequencer_b
-
- union extended_sequencer_d_u {
- struct {
- CARD8 enable_feature : 1;
- CARD8 lpb_feature : 1;
- CARD8 : 2;
- CARD8 _hsync_control : 2;
- CARD8 _vsync_control : 2;
- } _extended_sequencer_d_s;
- CARD8 _extended_sequencer_d;
- } _extended_sequencer_d_u;
-
-#define extended_sequencer_d _extended_sequencer_d_u._extended_sequencer_d
-#define hsync_control _extended_sequencer_d_u._extended_sequencer_d_s._hsync_control
-#define vsync_control _extended_sequencer_d_u._extended_sequencer_d_s._vsync_control
-
- union {
- struct {
- CARD8 _dclk_pll_n : 5;
- CARD8 _dclk_pll_r : 2;
- CARD8 : 1;
- } _dclk_value_low_s;
- CARD8 _dclk_value_low; /* SR12 */
- } _dclk_value_low_u;
-
-#define dclk_value_low _dclk_value_low_u._dclk_value_low
-#define dclk_pll_n_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_n
-#define dclk_pll_r_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_r
-
- union {
- struct {
- CARD8 _dclk_pll_m : 7;
- CARD8 : 1;
- } _dclk_value_high_s;
- CARD8 _dclk_value_high; /* SR13 */
- } _dclk_value_high_u;
-
-#define dclk_value_high _dclk_value_high_u._dclk_value_high
-#define dclk_pll_m_trio _dclk_value_high_u._dclk_value_high_s._dclk_pll_m
-
- union {
- struct {
- CARD8 _mfrq_en : 1;
- CARD8 _dfrq_en : 1;
- CARD8 _mclk_out : 1;
- CARD8 _vclk_out : 1;
- CARD8 _dclk_over_2 : 1;
- CARD8 _clk_load : 1;
- CARD8 _dclk_invert : 1;
- CARD8 _ena_2_cycle_write : 1;
- } _control_2_s;
- CARD8 _control_2; /* SR15 */
- } _control_2_u;
-
-#define control_2 _control_2_u._control_2
-#define mfrq_en _control_2_u._control_2_s._mfrq_en
-#define dfrq_en _control_2_u._control_2_s._dfrq_en
-#define mclk_out _control_2_u._control_2_s._mclk_out
-#define vclk_out _control_2_u._control_2_s._vclk_out
-#define dclk_over_2 _control_2_u._control_2_s._dclk_over_2
-#define clk_load _control_2_u._control_2_s._clk_load
-#define dclk_invert _control_2_u._control_2_s._dclk_invert
-#define ena_2_cycle_write _control_2_u._control_2_s._ena_2_cycle_write
-
- union {
- struct {
- CARD8 : 5;
- CARD8 _dac_power_down : 1;
- CARD8 _lut_write_control : 1;
- CARD8 _enable_clock_double : 1;
- } _ramdac_control_s;
- CARD8 _ramdac_control; /* SR18 */
- } _ramdac_control_u;
-
-#define ramdac_control _ramdac_control_u._ramdac_control
-#define enable_clock_double _ramdac_control_u._ramdac_control_s._enable_clock_double
-
- union {
- struct {
- CARD8 _dclk_pll_n : 6;
- CARD8 _dclk_pll_r : 2;
- } _dclk_value_low_s;
- CARD8 _dclk_value_low; /* SR36 */
- } _dclk_value_low_savage_u;
-
-#define dclk_value_low_savage _dclk_value_low_savage_u._dclk_value_low
-#define dclk_pll_n_savage_0_5 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_n
-#define dclk_pll_r_savage_0_1 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_r
-
- CARD8 dclk_pll_m0_savage_0_7; /* SR37 */
- CARD8 dclk_pll_m1_savage_0_7; /* SR38 */
-
- struct {
- CARD8 _dclk_pll_m : 8;
- } _dclk_value_high_s_savage;
-
- union {
- struct {
- CARD8 _dclk_select : 1;
- CARD8 : 1;
- CARD8 _dclk_pll_r_2 : 1;
- CARD8 _dclk_pll_m_8 : 1;
- CARD8 _dclk_pll_n_6 : 1;
- CARD8 _pce : 1;
- CARD8 _ccg : 1;
- CARD8 _csp : 1;
- } _extended_seq_39_s;
- CARD8 _extended_seq_39; /* SR39 */
- } _extended_seq_39_u;
-
-#define extended_seq_39 _extended_seq_39_u._extended_seq_39
-#define dclk_pll_select_savage _extended_seq_39_u._extended_seq_39_s._dclk_select
-#define dclk_pll_r_savage_2 _extended_seq_39_u._extended_seq_39_s._dclk_pll_r_2
-#define dclk_pll_m_savage_8 _extended_seq_39_u._extended_seq_39_s._dclk_pll_m_8
-#define dclk_pll_n_savage_6 _extended_seq_39_u._extended_seq_39_s._dclk_pll_n_6
-
- /* computed values */
- CARD16 ge_screen_pitch;
- CARD8 bits_per_pixel;
- CARD8 depth;
- CARD8 double_pixel_mode;
- CARD16 pixel_width;
-} S3Crtc;
-
-#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \
- ((crtc)->v_total_8 << 8) | \
- ((crtc)->v_total_9 << 9) | \
- ((crtc)->v_total_10 << 10))
-
-#define crtc_set_v_total(crtc,v) { \
- ((crtc))->v_total_0_7 = (v); \
- ((crtc))->v_total_8 = (v) >> 8; \
- ((crtc))->v_total_9 = (v) >> 9; \
- ((crtc))->v_total_10 = (v) >> 10; \
-}
-
-#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \
- ((crtc)->v_display_end_8 << 8) | \
- ((crtc)->v_display_end_9 << 9) | \
- ((crtc)->v_display_end_10 << 10))
-
-#define crtc_set_v_display_end(crtc,v) {\
- ((crtc))->v_display_end_0_7 = (v); \
- ((crtc))->v_display_end_8 = (v) >> 8; \
- ((crtc))->v_display_end_9 = (v) >> 9; \
- ((crtc))->v_display_end_10 = (v) >> 10; \
-}
-
-#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \
- ((crtc)->v_retrace_start_8 << 8) | \
- ((crtc)->v_retrace_start_9 << 9) | \
- ((crtc)->v_retrace_start_10 << 10))
-
-#define crtc_set_v_retrace_start(crtc,v) {\
- ((crtc))->v_retrace_start_0_7 = (v); \
- ((crtc))->v_retrace_start_8 = (v) >> 8; \
- ((crtc))->v_retrace_start_9 = (v) >> 9; \
- ((crtc))->v_retrace_start_10 = (v) >> 10; \
-}
-
-#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \
- ((crtc)->v_blank_start_8 << 8) | \
- ((crtc)->v_blank_start_9 << 9) | \
- ((crtc)->v_blank_start_10 << 10))
-
-#define crtc_set_v_blank_start(crtc,v) {\
- ((crtc))->v_blank_start_0_7 = (v); \
- ((crtc))->v_blank_start_8 = (v) >> 8; \
- ((crtc))->v_blank_start_9 = (v) >> 9; \
- ((crtc))->v_blank_start_10 = (v) >> 10; \
-}
-
-#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \
- ((crtc)->h_total_8 << 8))
-
-#define crtc_set_h_total(crtc,v) {\
- ((crtc))->h_total_0_7 = (v); \
- ((crtc))->h_total_8 = (v) >> 8; \
-}
-
-#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \
- ((crtc)->h_display_end_8 << 8))
-
-#define crtc_set_h_display_end(crtc,v) {\
- ((crtc))->h_display_end_0_7 = (v); \
- ((crtc))->h_display_end_8 = (v) >> 8; \
-}
-
-#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \
- ((crtc)->h_blank_start_8 << 8))
-
-#define crtc_set_h_blank_start(crtc,v) {\
- ((crtc))->h_blank_start_0_7 = (v); \
- ((crtc))->h_blank_start_8 = (v) >> 8; \
-}
-
-#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \
- ((crtc)->h_blank_end_5 << 5))
-
-#define crtc_set_h_blank_end(crtc,v) {\
- ((crtc))->h_blank_end_0_4 = (v); \
- ((crtc))->h_blank_end_5 = (v) >> 5; \
-}
-
-#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \
- ((crtc)->h_sync_start_8 << 8))
-
-#define crtc_set_h_sync_start(crtc,v) {\
- ((crtc))->h_sync_start_0_7 = (v); \
- ((crtc))->h_sync_start_8 = (v) >> 8; \
-}
-
-#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4)
-
-#define crtc_set_h_sync_end(crtc,v) {\
- ((crtc))->h_sync_end_0_4 = (v); \
-}
-
-#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \
- (((crtc)->screen_off_8_9 ? \
- ((crtc))->screen_off_8_9 : \
- ((crtc))->old_screen_off_8) << 8))
-
-#define crtc_set_screen_off(crtc,v) {\
- ((crtc))->screen_off_0_7 = (v); \
- ((crtc))->old_screen_off_8 = 0; \
- ((crtc))->screen_off_8_9 = (v) >> 8; \
-}
-
-#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \
- ((crtc)->ge_screen_width_2 << 2))
-
-#define crtc_set_ge_screen_width(crtc,v) { \
- (crtc)->ge_screen_width_0_1 = (v); \
- (crtc)->ge_screen_width_2 = (v) >> 2; \
-}
-
-#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \
- ((crtc)->h_start_fifo_fetch_8 << 8))
-
-#define crtc_set_h_start_fifo_fetch(crtc,v) {\
- (crtc)->h_start_fifo_fetch_0_7 = (v); \
- (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \
-}
-
-#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \
- ((crtc)->start_address_8_15 << 8) | \
- ((crtc)->start_address_16_19 << 16))
-
-#define crtc_set_start_address(crtc,v) {\
- (crtc)->start_address_0_7 = (v); \
- (crtc)->start_address_8_15 = (v) >> 8; \
- (crtc)->start_address_16_19 = (v) >> 16; \
-}
-
-#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \
- ((crtc)->line_compare_8 << 8) | \
- ((crtc)->line_compare_9 << 9) | \
- ((crtc)->line_compare_10 << 10))
-
-#define crtc_set_line_compare(crtc,v) { \
- ((crtc))->line_compare_0_7 = (v); \
- ((crtc))->line_compare_8 = (v) >> 8; \
- ((crtc))->line_compare_9 = (v) >> 9; \
- ((crtc))->line_compare_10 = (v) >> 10; \
-}
-
-
-#define GetCrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3d4, (i))
-#define PutCrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3d4, (i), (v))
-
-#define GetSrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3c4, (i))
-#define PutSrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3c4, (i), (v))
-
-#define S3_CLOCK_REF 14318 /* KHz */
-
-#define S3_CLOCK(m,n,r) (S3_CLOCK_REF * ((m) + 2) / (((n) + 2) * (1 << (r))))
-
-#if PLATFORM == 200
-#define S3_MAX_CLOCK 80000 /* KHz */
-#endif
-#if PLATFORM == 300
-#define S3_MAX_CLOCK 135000 /* KHz */
-#endif
-
-typedef struct _s3Save {
- CARD8 cursor_fg;
- CARD8 cursor_bg;
- CARD8 lock1;
- CARD8 lock2;
- CARD8 locksrtc;
- CARD8 clock_mode;
- CARD32 alt_mix;
- CARD32 write_mask;
- CARD32 fg;
- CARD32 bg;
- S3Crtc crtc;
-} S3Save;
-
-typedef struct _s3CardInfo {
- S3Ptr s3; /* pointer to register structure */
- int memory; /* amount of memory */
- CARD8 *frameBuffer; /* pointer to frame buffer */
- CARD8 *registers; /* pointer to register map */
- S3Save save;
- Bool savage;
- Bool need_sync;
-} S3CardInfo;
-
-typedef struct _s3FbInfo {
- CARD8 *offscreen; /* pointer to offscreen area */
- int offscreen_y; /* top y coordinate of offscreen area */
- int offscreen_x; /* top x coordinate of offscreen area */
- int offscreen_width; /* width of offscreen area */
- int offscreen_height; /* height of offscreen area */
- S3Patterns patterns;
- CARD32 bitmap_offset;
- int accel_stride;
- int accel_bpp;
-} S3FBInfo;
-
-typedef struct _s3ScreenInfo {
- CARD8 *cursor_base; /* pointer to cursor area */
- S3Cursor cursor;
- S3FBInfo fb[1];
-} S3ScreenInfo;
-
-#define LockS3(s3c)
-#define UnlockS3(s3c)
-
-#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver))
-#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd)
-
-#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver))
-#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd)
-
-Bool s3CardInit (KdCardInfo *);
-Bool s3ScreenInit (KdScreenInfo *);
-Bool s3Enable (ScreenPtr pScreen);
-void s3Disable (ScreenPtr pScreen);
-void s3Fini (ScreenPtr pScreen);
-
-Bool s3CursorInit (ScreenPtr pScreen);
-void s3CursorEnable (ScreenPtr pScreen);
-void s3CursorDisable (ScreenPtr pScreen);
-void s3CursorFini (ScreenPtr pScreen);
-void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
-
-Bool s3DrawInit (ScreenPtr pScreen);
-void s3DrawEnable (ScreenPtr pScreen);
-void s3DrawSync (ScreenPtr pScreen);
-void s3DrawDisable (ScreenPtr pScreen);
-void s3DrawFini (ScreenPtr pScreen);
-
-void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
-
-void S3InitCard (KdCardAttr *attr);
-
-void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR);
-
-CARD8 _s3ReadIndexRegister (VOL8 *base, CARD8 index);
-void _s3WriteIndexRegister (VOL8 *base, CARD8 index, CARD8 value);
-
-extern KdCardFuncs s3Funcs;
-
-/*
- * Wait for the begining of the retrace interval
- */
-
-#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\
- DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \
- __FILE__, __LINE__)); \
- break; \
-}
-
-#define _s3WaitVRetrace(s3) { \
- VOL8 *_status = &s3->crt_vga_status_1; \
- int _loop_count; \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetrace 0x%x", *_status)); \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \
-}
-/*
- * Wait for the begining of the retrace interval
- */
-#define _s3WaitVRetraceEnd(s3) { \
- VOL8 *_status = &s3->crt_vga_status_1; \
- int _loop_count; \
- DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetraceEnd 0x%x", *_status)); \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \
- _loop_count = 0; \
- while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \
-}
-
-/*
- * This extension register must contain a magic bit pattern to enable
- * the remaining extended registers
- */
-
-#define _s3UnlockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0xa0)
-#define _s3LockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0x00)
-
-#define S3_CURSOR_WIDTH 64
-#define S3_CURSOR_HEIGHT 64
-#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8)
-
-#define S3_TILE_SIZE 8
-
-#endif /* _S3_H_ */
diff --git a/hw/kdrive/trio/s3clock.c b/hw/kdrive/trio/s3clock.c
deleted file mode 100644
index f79dfa92d..000000000
--- a/hw/kdrive/trio/s3clock.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Id: s3clock.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3clock.c,v 1.2 1999/12/30 03:03:19 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-/*
- * Clock synthesis:
- *
- * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R)))
- *
- * Constraints:
- *
- * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz
- * 2. N >= 1
- *
- * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank))
- * Horizontal refresh rate = clock / (hsize + hblank)
- */
-
-/* all in kHz */
-#define MIN_VCO 180000.0
-#define MAX_VCO 360000.0
-
-void
-s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR)
-{
- int M, N, R, bestM, bestN;
- int f_vco, f_out;
- int err, abserr, besterr;
-
- /*
- * Compute correct R value to keep VCO in range
- */
- for (R = 0; R <= maxR; R++)
- {
- f_vco = target * (1 << R);
- if (MIN_VCO <= f_vco && f_vco < MAX_VCO)
- break;
- }
-
- /* M = f_out / f_ref * ((N + 2) * (1 << R)); */
- besterr = target;
- for (N = 0; N <= maxN; N++)
- {
- M = (target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) / S3_CLOCK_REF - 2;
- if (0 <= M && M <= maxM)
- {
- f_out = S3_CLOCK(M,N,R);
- err = target - f_out;
- if (err < 0)
- err = -err;
- if (err < besterr)
- {
- besterr = err;
- bestM = M;
- bestN = N;
- }
- }
- }
- *Mp = bestM;
- *Np = bestN;
- *Rp = R;
-}
diff --git a/hw/kdrive/trio/s3cmap.c b/hw/kdrive/trio/s3cmap.c
deleted file mode 100644
index 19e192ed0..000000000
--- a/hw/kdrive/trio/s3cmap.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Id: s3cmap.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3cmap.c,v 1.1 1999/11/19 13:54:05 hohndel Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-void
-s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- S3Ptr s3 = s3c->s3;
- VOL8 *dac_rd_ad = &s3->crt_vga_dac_rd_ad;
- VOL8 *dac_data = &s3->crt_vga_dac_data;
-
- LockS3 (s3c);
- while (ndef--)
- {
- *dac_rd_ad = pdefs->pixel;
- pdefs->red = *dac_data << 10;
- pdefs->green = *dac_data << 10;
- pdefs->blue = *dac_data << 10;
- pdefs++;
- }
- UnlockS3(s3c);
-}
-
-void
-s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
-{
- KdScreenPriv(pScreen);
- s3CardInfo(pScreenPriv);
- S3Ptr s3 = s3c->s3;
- VOL8 *dac_wt_ad = &s3->crt_vga_dac_wt_ad;
- VOL8 *dac_data = &s3->crt_vga_dac_data;
-
- LockS3(s3c);
- _s3WaitVRetrace (s3);
- while (ndef--)
- {
- *dac_wt_ad = pdefs->pixel;
- *dac_data = pdefs->red >> 10;
- *dac_data = pdefs->green >> 10;
- *dac_data = pdefs->blue >> 10;
- pdefs++;
- }
- UnlockS3(s3c);
-}
-
diff --git a/hw/kdrive/trio/s3curs.c b/hw/kdrive/trio/s3curs.c
deleted file mode 100644
index 9416b4398..000000000
--- a/hw/kdrive/trio/s3curs.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Id: s3curs.c,v 1.1 1999/11/02 08:17:24 keithp Exp $
- *
- * Copyright © 1999 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3curs.c,v 1.2 1999/12/30 03:03:19 robin Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-#include "s3draw.h"
-#include "cursorstr.h"
-
-#define SetupCursor(s) KdScreenPriv(s); \
- s3CardInfo(pScreenPriv); \
- s3ScreenInfo(pScreenPriv); \
- S3Ptr s3 = s3c->s3; \
- S3Cursor *pCurPriv = &s3s->cursor
-
-static void
-_s3MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CARD8 xlow, xhigh, ylow, yhigh;
- CARD8 xoff, yoff;
-
- x -= pCurPriv->xhot;
- xoff = 0;
- if (x < 0)
- {
- xoff = -x;
- x = 0;
- }
- y -= pCurPriv->yhot;
- yoff = 0;
- if (y < 0)
- {
- yoff = -y;
- y = 0;
- }
- xlow = (CARD8) x;
- xhigh = (CARD8) (x >> 8);
- ylow = (CARD8) y;
- yhigh = (CARD8) (y >> 8);
-
-
- /* This is the recommended order to move the cursor */
-
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x46, xhigh);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x47, xlow);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x49, ylow);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4e, xoff);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4f, yoff);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x48, yhigh);
-}
-
-static void
-s3MoveCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor (pScreen);
-
- if (!pCurPriv->has_cursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- LockS3(s3c);
- _s3UnlockExt(s3);
- _s3MoveCursor (pScreen, x, y);
- _s3LockExt(s3);
- UnlockS3(s3c);
-}
-
-static void
-s3AllocCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- KdAllocateCursorPixels (pScreen, 0, pCursor,
- &pCurPriv->source, &pCurPriv->mask);
- switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
- case 4:
- pCurPriv->source |= pCurPriv->source << 4;
- pCurPriv->mask |= pCurPriv->mask << 4;
- case 8:
- pCurPriv->source |= pCurPriv->source << 8;
- pCurPriv->mask |= pCurPriv->mask << 8;
- case 16:
- pCurPriv->source |= pCurPriv->source << 16;
- pCurPriv->mask |= pCurPriv->mask << 16;
- }
-}
-
-static void
-_s3SetCursorColors (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
- /* set foreground */
- /* Reset cursor color stack pointers */
- (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 8);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 16);
-
- /* set background */
- /* Reset cursor color stack pointers */
- (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 8);
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 16);
-}
-
-void
-s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
-{
- SetupCursor (pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- xColorItem sourceColor, maskColor;
-
- if (!pCurPriv->has_cursor || !pCursor)
- return;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pdef)
- {
- while (ndef)
- {
- if (pdef->pixel == pCurPriv->source ||
- pdef->pixel == pCurPriv->mask)
- break;
- ndef--;
- }
- if (!ndef)
- return;
- }
- s3AllocCursorColors (pScreen);
- LockS3 (s3c);
- _s3UnlockExt(s3);
- _s3SetCursorColors (pScreen);
- _s3LockExt (s3);
- UnlockS3 (s3c);
-}
-
-static void
-s3LoadCursor (ScreenPtr pScreen, int x, int y)
-{
- SetupCursor(pScreen);
- CursorPtr pCursor = pCurPriv->pCursor;
- CursorBitsPtr bits = pCursor->bits;
- int w, h;
- unsigned char r[2], g[2], b[2];
- unsigned long *ram;
- unsigned long *msk, *mskLine, *src, *srcLine;
- unsigned long and, xor;
- int i, j;
- int cursor_address;
- int wsrc;
- unsigned char ramdac_control_;
-
- /*
- * Allocate new colors
- */
- s3AllocCursorColors (pScreen);
-
- pCurPriv->pCursor = pCursor;
- pCurPriv->xhot = pCursor->bits->xhot;
- pCurPriv->yhot = pCursor->bits->yhot;
-
- /*
- * Stick new image into cursor memory
- */
- ram = (unsigned long *) s3s->cursor_base;
- mskLine = (unsigned long *) bits->mask;
- srcLine = (unsigned long *) bits->source;
-
- h = bits->height;
- if (h > S3_CURSOR_HEIGHT)
- h = S3_CURSOR_HEIGHT;
-
- wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */
-
- for (i = 0; i < S3_CURSOR_HEIGHT; i++)
- {
- msk = mskLine;
- src = srcLine;
- mskLine += wsrc;
- srcLine += wsrc;
- for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) {
-
- unsigned long m, s;
-
- if (i < h && j < wsrc)
- {
- m = *msk++;
- s = *src++;
- xor = m & s;
- and = ~m;
- }
- else
- {
- and = 0xffffffff;
- xor = 0x00000000;
- }
-
- S3AdjustBits32(and);
- S3AdjustBits32(xor);
- *ram++ = (and & 0xffff) | (xor << 16);
- *ram++ = (and >> 16) | (xor & 0xffff0000);
- }
- }
-
- _s3WaitIdle (s3);
- _s3UnlockExt (s3);
-
- /* Set new color */
- _s3SetCursorColors (pScreen);
-
- /* Enable the cursor */
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0x01);
-
- /* Wait for VRetrace to make sure the position is read */
- _s3WaitVRetrace (s3);
-
- /* Move to new position */
- _s3MoveCursor (pScreen, x, y);
-
- _s3LockExt (s3);
- UnlockS3(s3c);
-}
-
-static void
-s3UnloadCursor (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- LockS3 (s3c);
- _s3UnlockExt(s3);
-
- /* Disable cursor */
- _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0);
-
- _s3LockExt(s3);
- UnlockS3 (s3c);
-}
-
-static Bool
-s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- SetupCursor(pScreen);
-
- if (!pScreenPriv->enabled)
- return TRUE;
-
- /* miRecolorCursor does this */
- if (pCurPriv->pCursor == pCursor)
- {
- if (pCursor)
- {
-#ifdef FB_OLD_SCREEN
- short x, y;
-#else
- int x, y;
-#endif
-
- miPointerPosition (&x, &y);
- s3LoadCursor (pScreen, x, y);
- }
- }
- return TRUE;
-}
-
-static Bool
-s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- SetupCursor(pScreen);
-
- pCurPriv->pCursor = pCursor;
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCursor)
- s3LoadCursor (pScreen, x, y);
- else
- s3UnloadCursor (pScreen);
-}
-
-miPointerSpriteFuncRec s3PointerSpriteFuncs = {
- s3RealizeCursor,
- s3UnrealizeCursor,
- s3SetCursor,
- s3MoveCursor,
-};
-
-static void
-s3QueryBestSize (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
-s3CursorInit (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!s3s->cursor_base)
- {
- pCurPriv->has_cursor = FALSE;
- return FALSE;
- }
-
- pCurPriv->width = S3_CURSOR_WIDTH;
- pCurPriv->height= S3_CURSOR_HEIGHT;
- pScreen->QueryBestSize = s3QueryBestSize;
- miPointerInitialize (pScreen,
- &s3PointerSpriteFuncs,
- &kdPointerScreenFuncs,
- FALSE);
- pCurPriv->has_cursor = TRUE;
- pCurPriv->pCursor = NULL;
- return TRUE;
-}
-
-void
-s3CursorEnable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
-#ifdef FB_OLD_SCREEN
- short x, y;
-#else
- int x, y;
-#endif
-
- miPointerPosition (&x, &y);
- s3LoadCursor (pScreen, x, y);
- }
- else
- s3UnloadCursor (pScreen);
- }
-}
-
-void
-s3CursorDisable (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- if (!pScreenPriv->enabled)
- return;
-
- if (pCurPriv->has_cursor)
- {
- if (pCurPriv->pCursor)
- {
- s3UnloadCursor (pScreen);
- }
- }
-}
-
-void
-s3CursorFini (ScreenPtr pScreen)
-{
- SetupCursor (pScreen);
-
- pCurPriv->pCursor = NULL;
-}
diff --git a/hw/kdrive/trio/s3stub.c b/hw/kdrive/trio/s3stub.c
deleted file mode 100644
index fe76d4066..000000000
--- a/hw/kdrive/trio/s3stub.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Id: s3stub.c,v 1.1 1999/11/02 08:19:15 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.
- */
-/* $RCSId: xc/programs/Xserver/hw/kdrive/trio/s3stub.c,v 1.3 2000/02/23 20:30:13 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "s3.h"
-
-void
-InitCard (char *name)
-{
- KdCardAttr attr;
- CARD32 count;
-
- count = 0;
- while (LinuxFindPci (0x5333, 0x8904, count, &attr))
- {
- KdCardInfoAdd (&s3Funcs, &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);
-}