From 88ae32841d766c7d0df79ee25e1db62996d4ecb3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 3 Jun 2001 18:48:19 +0000 Subject: Add mach64 driver to Tiny-X --- hw/kdrive/mach64/Imakefile | 15 ++ hw/kdrive/mach64/mach64.c | 331 +++++++++++++++++++++++++ hw/kdrive/mach64/mach64.h | 522 ++++++++++++++++++++++++++++++++++++++++ hw/kdrive/mach64/mach64curs.c | 389 ++++++++++++++++++++++++++++++ hw/kdrive/mach64/mach64draw.c | 410 +++++++++++++++++++++++++++++++ hw/kdrive/mach64/mach64draw.h | 72 ++++++ hw/kdrive/mach64/mach64stub.c | 58 +++++ hw/kdrive/src/kaa.c | 73 +++--- hw/kdrive/trident/trident.c | 6 +- hw/kdrive/trident/tridentdraw.c | 8 +- 10 files changed, 1839 insertions(+), 45 deletions(-) create mode 100644 hw/kdrive/mach64/Imakefile create mode 100644 hw/kdrive/mach64/mach64.c create mode 100644 hw/kdrive/mach64/mach64.h create mode 100644 hw/kdrive/mach64/mach64curs.c create mode 100644 hw/kdrive/mach64/mach64draw.c create mode 100644 hw/kdrive/mach64/mach64draw.h create mode 100644 hw/kdrive/mach64/mach64stub.c diff --git a/hw/kdrive/mach64/Imakefile b/hw/kdrive/mach64/Imakefile new file mode 100644 index 000000000..067db5110 --- /dev/null +++ b/hw/kdrive/mach64/Imakefile @@ -0,0 +1,15 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/mach64/Imakefile,v 1.6 2000/10/20 00:19:51 keithp Exp $ +KDRIVE=.. +#include "../Kdrive.tmpl" + +SRCS = mach64.c mach64draw.c mach64stub.c + +OBJS = mach64.o mach64draw.o mach64stub.o + +DEFINES = -DVESA /* -DUSE_PCI*/ + +INCLUDES = -I. $(KDINCS) -I$(KDRIVE)/vesa + +NormalLibraryObjectRule() +NormalLibraryTarget(mach64,$(OBJS)) +DependTarget() diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c new file mode 100644 index 000000000..7abbf7bf5 --- /dev/null +++ b/hw/kdrive/mach64/mach64.c @@ -0,0 +1,331 @@ +/* + * Copyright © 2001 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.16 2001/03/21 16:43:16 dawes Exp $ */ + +#include "mach64.h" +#include + +Bool +mach64CardInit (KdCardInfo *card) +{ + Mach64CardInfo *mach64c; + + mach64c = (Mach64CardInfo *) xalloc (sizeof (Mach64CardInfo)); + if (!mach64c) + return FALSE; + + mach64c->reg_base = (CARD8 *) KdMapDevice (MACH64_REG_BASE(card), + MACH64_REG_SIZE(card)); + + if (mach64c->reg_base) + { + KdSetMappedMode (MACH64_REG_BASE(card), + MACH64_REG_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + } + mach64c->reg = (Reg *) (mach64c->reg_base + MACH64_REG_OFF(card)); + mach64c->media_reg = (MediaReg *) (mach64c->reg_base + MACH64_MEDIA_REG_OFF(card)); + + if (!vesaInitialize (card, &mach64c->vesa)) + { + xfree (mach64c); + return FALSE; + } + + card->driver = mach64c; + + return TRUE; +} + +Bool +mach64ScreenInit (KdScreenInfo *screen) +{ + Mach64CardInfo *mach64c = screen->card->driver; + Mach64ScreenInfo *mach64s; + int screen_size, memory; + + mach64s = (Mach64ScreenInfo *) xalloc (sizeof (Mach64ScreenInfo)); + if (!mach64s) + return FALSE; + memset (mach64s, '\0', sizeof (Mach64ScreenInfo)); + if (!vesaScreenInitialize (screen, &mach64s->vesa)) + { + xfree (mach64s); + return FALSE; + } + if (!mach64c->reg) + screen->dumb = TRUE; + if (mach64s->vesa.mapping != VESA_LINEAR) + screen->dumb = TRUE; + mach64s->screen = mach64s->vesa.fb; + memory = mach64s->vesa.fb_size; + screen_size = screen->fb[0].byteStride * screen->height; + if (mach64s->screen && memory >= screen_size + 2048) + { + memory -= 2048; + mach64s->cursor_base = mach64s->screen + memory - 2048; + } + else + mach64s->cursor_base = 0; + screen->softCursor = TRUE; /* XXX for now */ + memory -= screen_size; + if (memory > screen->fb[0].byteStride) + { + mach64s->off_screen = mach64s->screen + screen_size; + mach64s->off_screen_size = memory; + } + else + { + mach64s->off_screen = 0; + mach64s->off_screen_size = 0; + } + screen->driver = mach64s; + return TRUE; +} + +Bool +mach64InitScreen (ScreenPtr pScreen) +{ + return vesaInitScreen (pScreen); +} + +CARD32 +mach64ReadLCD (Reg *reg, int id) +{ + CARD32 LCD_INDEX; + + LCD_INDEX = reg->LCD_INDEX & ~(0x3f); + reg->LCD_INDEX = (LCD_INDEX | id); + return reg->LCD_DATA; +} + +void +mach64WriteLCD (Reg *reg, int id, CARD32 data) +{ + CARD32 LCD_INDEX; + + LCD_INDEX = reg->LCD_INDEX & ~(0x3f); + reg->LCD_INDEX = (LCD_INDEX | id); + reg->LCD_DATA = data; +} + +void +mach64Preserve (KdCardInfo *card) +{ + Mach64CardInfo *mach64c = card->driver; + Reg *reg = mach64c->reg; + + vesaPreserve(card); + if (reg) + mach64c->save.POWER_MANAGEMENT = mach64ReadLCD (reg, 0x8); +} + +void +mach64SetMMIO (Mach64CardInfo *mach64c) +{ + if (mach64c->reg->GUI_STAT == 0xffffffff) + FatalError ("Mach64 REG not visible\n"); +} + +void +mach64ResetMMIO (Mach64CardInfo *mach64c) +{ +} + +Bool +mach64Enable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + Mach64CardInfo *mach64c = pScreenPriv->card->driver; + + if (!vesaEnable (pScreen)) + return FALSE; + + mach64SetMMIO (mach64c); + mach64DPMS (pScreen, KD_DPMS_NORMAL); + return TRUE; +} + +void +mach64Disable (ScreenPtr pScreen) +{ + vesaDisable (pScreen); +} + +const CARD8 mach64DPMSModes[4] = { + 0x80, /* KD_DPMS_NORMAL */ + 0x8c, /* KD_DPMS_STANDBY */ + 0x8c, /* KD_DPMS_STANDBY */ + 0x8c, /* KD_DPMS_STANDBY */ +/* 0xb0, /* KD_DPMS_SUSPEND */ +/* 0xbc, /* KD_DPMS_POWERDOWN */ +}; + +Bool +mach64DPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + Mach64CardInfo *mach64c = pScreenPriv->card->driver; + int hsync_off, vsync_off, blank; + CARD32 CRTC_GEN_CNTL; + CARD32 POWER_MANAGEMENT; + Reg *reg = mach64c->reg; + + if (!reg) + return FALSE; + + CRTC_GEN_CNTL = reg->CRTC_GEN_CNTL; + POWER_MANAGEMENT = mach64ReadLCD (reg, 8); + + /* + * Select register mode + */ + POWER_MANAGEMENT = (POWER_MANAGEMENT & ~(3 << 1)) | (1 << 1); + /* + * Switch back to ON mode + */ + POWER_MANAGEMENT &= ~(1 << 28); + POWER_MANAGEMENT &= ~(1 << 29); + + switch (mode) { + case KD_DPMS_NORMAL: + hsync_off = 0; + vsync_off = 0; + blank = 0; + break; + case KD_DPMS_STANDBY: + hsync_off = 1; + vsync_off = 0; + /* + * Standby + */ + POWER_MANAGEMENT |= (1 << 28); + blank = 1; + break; + case KD_DPMS_SUSPEND: + hsync_off = 0; + vsync_off = 1; + blank = 1; + /* + * Suspend + */ + POWER_MANAGEMENT |= (1 << 28); + break; + case KD_DPMS_POWERDOWN: + hsync_off = 1; + vsync_off = 1; + /* + * Suspend + */ + POWER_MANAGEMENT |= (1 << 28); + blank = 1; + } + + + if (hsync_off) + CRTC_GEN_CNTL |= (1 << 2); + else + CRTC_GEN_CNTL &= ~(1 << 2); + if (vsync_off) + CRTC_GEN_CNTL |= (1 << 3); + else + CRTC_GEN_CNTL &= ~(1 << 3); + if (blank) + CRTC_GEN_CNTL |= (1 << 6); + else + CRTC_GEN_CNTL &= ~(1 << 6); + mach64WriteLCD (reg, 8, POWER_MANAGEMENT); + + reg->CRTC_GEN_CNTL = CRTC_GEN_CNTL; + return TRUE; +} + +void +mach64Restore (KdCardInfo *card) +{ + Mach64CardInfo *mach64c = card->driver; + Reg *reg = mach64c->reg; + + if (reg) + mach64WriteLCD (reg, 8, mach64c->save.POWER_MANAGEMENT); + mach64ResetMMIO (mach64c); + vesaRestore (card); +} + +void +mach64ScreenFini (KdScreenInfo *screen) +{ + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + + vesaScreenFini (screen); + xfree (mach64s); + screen->driver = 0; +} + +void +mach64CardFini (KdCardInfo *card) +{ + Mach64CardInfo *mach64c = card->driver; + + if (mach64c->reg_base) + { + KdUnmapDevice ((void *) mach64c->reg_base, MACH64_REG_SIZE(card)); + KdResetMappedMode (MACH64_REG_BASE(card), + MACH64_REG_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + } + vesaCardFini (card); +} + +#define mach64CursorInit 0 /* initCursor */ +#define mach64CursorEnable 0 /* enableCursor */ +#define mach64CursorDisable 0 /* disableCursor */ +#define mach64CursorFini 0 /* finiCursor */ +#define mach64RecolorCursor 0 /* recolorCursor */ + +KdCardFuncs mach64Funcs = { + mach64CardInit, /* cardinit */ + mach64ScreenInit, /* scrinit */ + mach64InitScreen, /* initScreen */ + mach64Preserve, /* preserve */ + mach64Enable, /* enable */ + mach64DPMS, /* dpms */ + mach64Disable, /* disable */ + mach64Restore, /* restore */ + mach64ScreenFini, /* scrfini */ + mach64CardFini, /* cardfini */ + + mach64CursorInit, /* initCursor */ + mach64CursorEnable, /* enableCursor */ + mach64CursorDisable, /* disableCursor */ + mach64CursorFini, /* finiCursor */ + mach64RecolorCursor, /* recolorCursor */ + + mach64DrawInit, /* initAccel */ + mach64DrawEnable, /* enableAccel */ + mach64DrawSync, /* syncAccel */ + mach64DrawDisable, /* disableAccel */ + mach64DrawFini, /* finiAccel */ + + vesaGetColors, /* getColors */ + vesaPutColors, /* putColors */ +}; diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h new file mode 100644 index 000000000..2f0c376e3 --- /dev/null +++ b/hw/kdrive/mach64/mach64.h @@ -0,0 +1,522 @@ +/* + * Id: mach64.h,v 1.2 1999/11/02 08:17:24 keithp Exp $ + * + * Copyright © 2001 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.h,v 1.9 2000/11/29 08:42:25 keithp Exp $ */ + +#ifndef _MACH64_H_ +#define _MACH64_H_ +#include + +/* + * offset from ioport beginning + */ + +#define MACH64_REG_BASE(c) ((c)->attr.address[1]) +#define MACH64_REG_SIZE(c) (4096) + +#define MACH64_REG_OFF(c) (1024) +#define MACH64_MEDIA_REG_OFF(c) (0) + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _Reg { + VOL32 CRTC_H_TOTAL_DISP; /* 0x00 */ + VOL32 CRTC_H_SYNC_STRT_WID; /* 0x01 */ + VOL32 CRTC_V_TOTAL_DISP; /* 0x02 */ + VOL32 CRTC_V_SYNC_STRT_WID; /* 0x03 */ + VOL32 CRTC_VLINE_CRNT_VLINE; /* 0x04 */ + VOL32 CRTC_OFF_PITCH; /* 0x05 */ + VOL32 CRTC_INT_CNTL; /* 0x06 */ + VOL32 CRTC_GEN_CNTL; /* 0x07 */ + VOL32 DSP_CONFIG; /* 0x08 */ + VOL32 DSP_ON_OFF; /* 0x09 */ + VOL32 TIMER_CONFIG; /* 0x0a */ + VOL32 MEM_BUF_CNTL; /* 0x0b */ + VOL32 unused0; /* 0x0c */ + VOL32 MEM_ADDR_CONFIG; /* 0x0d */ + VOL32 CRT_TRAP; /* 0x0e */ + VOL32 I2C_CNTL_0; /* 0x0f */ + VOL32 OVR_CLR; /* 0x10 */ + VOL32 OVR_WID_LEFT_RIGHT; /* 0x11 */ + VOL32 OVR_WID_TOP_BOTTOM; /* 0x12 */ + VOL32 VGA_DSP_CONFIG; /* 0x13 */ + VOL32 VGA_DSP_ON_OFF; /* 0x14 */ + VOL32 DSP2_CONFIG; /* 0x15 */ + VOL32 DSP2_ON_OFF; /* 0x16 */ + VOL32 CRTC2_OFF_PITCH; /* 0x17 */ + VOL32 CUR_CLR0; /* 0x18 */ + VOL32 CUR_CLR1; /* 0x19 */ + VOL32 CUR_OFFSET; /* 0x1a */ + VOL32 CUR_HORZ_VERT_POSN; /* 0x1b */ + VOL32 CUR_HORZ_VERT_OFF; /* 0x1c */ + VOL32 TV_OUT_INDEX; /* 0x1d */ + VOL32 GP_IO; /* 0x1e */ + VOL32 HW_DEBUG; /* 0x1f */ + VOL32 SCRATCH_REG0; /* 0x20 */ + VOL32 SCRATCH_REG1; + VOL32 SCRATCH_REG2; + VOL32 SCRATCH_REG3; + VOL32 CLOCK_CNTL; + VOL32 CONFIG_STAT1; + VOL32 CONFIG_STAT2; + VOL32 TV_OUT_DATA; + VOL32 BUS_CNTL; /* 0x28 */ + VOL32 LCD_INDEX; /* 0x29 */ + VOL32 LCD_DATA; /* 0x2a */ + VOL32 EXT_MEM_CNTL; + VOL32 MEM_CNTL; + VOL32 MEM_VGA_WP_SEL; + VOL32 MEM_VGA_RP_SEL; + VOL32 I2C_CNTL_1; + VOL32 DAC_REGS; /* 0x30 */ + VOL32 DAC_CNTL; /* 0x31 */ + VOL32 unused_32; + VOL32 unused_33; + VOL32 GEN_TEST_CNTL; /* 0x34 */ + VOL32 CUSTOM_MACRO_CNTL; + VOL32 unused36; + VOL32 CONFIG_CNTL; + VOL32 CONFIG_CHIP_ID; + VOL32 CONFIG_STAT0; + VOL32 CRC_SIG; + VOL32 unused_3b; + VOL32 unused_3c; + VOL32 unused_3d; + VOL32 unused_3e; + VOL32 unused_3f; + VOL32 DST_OFF_PITCH; /* 0x40 */ + VOL32 DST_X; + VOL32 DST_Y; + VOL32 DST_Y_X; + VOL32 DST_WIDTH; + VOL32 DST_HEIGHT; + VOL32 DST_HEIGHT_WIDTH; + VOL32 DST_X_WIDTH; + VOL32 DST_BRES_LNTH; + VOL32 DST_BRES_ERR; + VOL32 DST_BRES_INC; + VOL32 DST_BRES_DEC; + VOL32 DST_CNTL; + VOL32 DST_Y_X_ALIAS; + VOL32 TRAIL_BRES_ERR; + VOL32 TRAIL_BRES_INC; + VOL32 TRAIL_BRES_DEC; + VOL32 LEAD_BRES_LNTH; + VOL32 Z_OFF_PITCH; + VOL32 Z_CNTL; + VOL32 ALPHA_TST_CNTL; + VOL32 unused55; + VOL32 SECONDARY_STW_EXP; + VOL32 SECONDARY_S_X_INC; + VOL32 SECONDARY_S_Y_INC; + VOL32 SECONDARY_S_START; + VOL32 SECONDARY_W_X_INC; + VOL32 SECONDARY_W_Y_INC; + VOL32 SECONDARY_W_START; + VOL32 SECONDARY_T_X_INC; + VOL32 SECONDARY_T_Y_INC; + VOL32 SECONDARY_T_START; + VOL32 SRC_OFF_PITCH; + VOL32 SRC_X; + VOL32 SRC_Y; + VOL32 SRC_Y_X; + VOL32 SRC_WIDTH1; + VOL32 SRC_HEIGHT1; + VOL32 SRC_HEIGHT1_WIDTH1; + VOL32 SRC_X_START; + VOL32 SRC_Y_START; + VOL32 SRC_Y_X_START; + VOL32 SRC_WIDTH2; + VOL32 SRC_HEIGHT2; + VOL32 SRC_HEIGHT2_WIDTH2; + VOL32 SRC_CNTL; + VOL32 unused6e; + VOL32 unused6f; + union { + struct { + VOL32 SCALE_OFF; /* 0x70 */ + VOL32 unused71; + VOL32 unused72; + VOL32 unused73; + VOL32 unused74; + VOL32 unused75; + VOL32 unused76; + VOL32 SCALE_WIDTH; + VOL32 SCALE_HEIGHT; + VOL32 unused79; + VOL32 unused7a; + VOL32 SCALE_PITCH; + VOL32 SCALE_X_INC; + VOL32 SCALE_Y_INC; + VOL32 SCALE_VACC; + VOL32 SCALE_3D_CNTL; /* 0x7f */ + } scaler; + struct { + VOL32 TEX_0_OFF; /* 0x70 */ + VOL32 TEX_1_OFF; + VOL32 TEX_2_OFF; + VOL32 TEX_3_OFF; + VOL32 TEX_4_OFF; + VOL32 TEX_5_OFF; + VOL32 TEX_6_OFF; + VOL32 TEX_7_OFF; + VOL32 TEX_8_OFF; + VOL32 TEX_9_OFF; + VOL32 TEX_10_OFF; + VOL32 S_Y_INC; + VOL32 RED_X_INC; + VOL32 GREEN_X_INC; /* 0x7d */ + VOL32 unused7e; + VOL32 unused7f; + } texture; + } u; + VOL32 HOST_DATA[16]; /* 0x80 */ + VOL32 HOST_CNTL; /* 0x90 */ + VOL32 BM_HOSTDATA; /* 0x91 */ + VOL32 BM_ADDR; /* 0x92 */ + VOL32 BM_GUI_TABLE_CMD; /* 0x93 */ + VOL32 unused94; /* 0x94 */ + VOL32 unused95; /* 0x95 */ + VOL32 unused96; /* 0x96 */ + VOL32 FOG_TABLE_INDEX; /* 0x97 */ + VOL32 FOG_TABLE_DATA[8]; /* 0x98 */ + VOL32 PAT_REG0; /* 0xa0 */ + VOL32 PAT_REG1; + VOL32 PAT_CNTL; + VOL32 unused_0a3; + VOL32 unused_0a4; + VOL32 unused_0a5; + VOL32 unused_0a6; + VOL32 unused_0a7; + VOL32 SC_LEFT; + VOL32 SC_RIGHT; + VOL32 SC_LEFT_RIGHT; + VOL32 SC_TOP; + VOL32 SC_BOTTOM; + VOL32 SC_TOP_BOTTOM; + VOL32 USR1_DST_OFF_PITCH; + VOL32 USR2_DST_OFF_PITCH; + VOL32 DP_BKGD_CLR; /* 0xb0 */ + VOL32 DP_FRGD_CLR; + VOL32 DP_WRITE_MSK; + VOL32 unused_0b3; + VOL32 DP_PIX_WIDTH; + VOL32 DP_MIX; + VOL32 DP_SRC; + VOL32 DP_FRGD_CLR_MIX; + VOL32 DP_FRGD_BKGD_CLR; + VOL32 unused_0b9; + VOL32 DST_X_Y; + VOL32 DST_WIDTH_HEIGHT; + VOL32 USR_DST_PITCH; + VOL32 unused_0bd; + VOL32 DP_SET_GUI_ENGINE2; + VOL32 DP_SET_GUI_ENGINE; + VOL32 CLR_CMP_CLR; /* 0xc0 */ + VOL32 CLR_CMP_MSK; + VOL32 CLR_CMP_CNTL; + VOL32 unused_0c3; + VOL32 FIFO_STAT; + VOL32 unused_0c5; + VOL32 unused_0c6; + VOL32 unused_0c7; + VOL32 unused_0c8; + VOL32 unused_0c9; + VOL32 unused_0ca; + VOL32 unused_0cb; + VOL32 GUI_TRAJ_CNTL; + VOL32 unused_0cd; + VOL32 GUI_STAT; + VOL32 unused_0cf; + VOL32 TEX_PALETTE_INDEX; + VOL32 STW_EXP; + VOL32 LOG_MAX_INC; + VOL32 S_X_INC; + VOL32 S_Y_INC_2_SCALE_PITCH; + VOL32 S_START; + VOL32 W_X_INC; + VOL32 W_Y_INC; + VOL32 W_START; + VOL32 T_X_INC; + VOL32 T_Y_INC_SECONDARY_SCALE_PITCH; + VOL32 T_START; + VOL32 TEX_SIZE_PITCH; + VOL32 TEX_CNTL; + VOL32 SECONDARY_TEX_OFFSET_SECONDARY_SCALE_OFF; + VOL32 TEX_PALETTE; + VOL32 SCALE_PITCH_BOTH; /* 0xe0 */ + VOL32 SECONDARY_SCALE_OFF_ACC; + VOL32 SCALE_OFF_ACC; + VOL32 SCALE_DST_Y_X; + VOL32 unused_0e4; + VOL32 unused_0e5; + VOL32 COMPOSITE_SHADOW_ID; + VOL32 SECONDARY_SCALE_X_INC_SPECULAR_RED_X_INC; + VOL32 SPECULAR_RED_Y_INC; + VOL32 SPECULAR_RED_START_SECONDARY_SCALE_HACC;; + VOL32 SPECULAR_GREEN_X_INC; + VOL32 SPECULAR_GREEN_Y_INC; + VOL32 SPECULAR_GREEN_START; + VOL32 SPECULAR_BLUE_X_INC; + VOL32 SPECULAR_BLUE_Y_INC; + VOL32 SPECULAR_BLUE_START; + VOL32 RED_X_INC_SCALE_X_INC; + VOL32 RED_Y_INC; + VOL32 RED_START_SCALE_HACC; + VOL32 GREEN_X_INC_SCALE_Y_INC; + VOL32 GREEN_Y_INC_SECONDARY_SCALE_Y_INC; + VOL32 GREEN_START_SECONDARY_SCALE_VACC; + VOL32 BLUE_X_INC; + VOL32 BLUE_Y_INC; + VOL32 BLUE_START; + VOL32 Z_X_INC; + VOL32 Z_Y_INC; + VOL32 Z_START; + VOL32 ALPHA_X_INC; + VOL32 FOG_X_INC; + VOL32 ALPHA_Y_INC; + VOL32 FOG_Y_INC; + VOL32 ALPHA_START; + VOL32 FOG_START; + VOL32 unused_0ff; +} Reg; /* 0x100 */ + +#define DST_X_DIR (1 << 0) +#define DST_Y_DIR (1 << 1) +#define DST_Y_MAJOR (1 << 2) +#define DST_X_TILE (1 << 3) +#define DST_Y_TILE (1 << 4) +#define DST_LAST_PEL (1 << 5) +#define DST_POLYGON_EN (1 << 6) +#define DST_24_ROT_EN (1 << 7) +#define DST_24_ROT(n) ((n) << 8) +#define DST_BRES_ZERO (1 << 11) +#define DST_POLYGON_RTEDGE_DIS (1 << 12) +#define TRAIL_X_DIR (1 << 13) +#define TRAP_FILL_DIR (1 << 14) +#define TRAIL_BRES_SIGN (1 << 15) +#define SRC_PATT_EN (1 << 16) +#define SRC_PATT_ROT_EN (1 << 17) +#define SRC_LINEAR_EN (1 << 18) +#define SRC_BYTE_ALIGN (1 << 19) +#define SRC_LINE_X_DIR (1 << 20) +#define SRC_8x8x8_BRUSH (1 << 21) +#define FAST_FILL_EN (1 << 22) +#define SRC_TRACK_DST (1 << 23) +#define PAT_MONO_EN (1 << 24) +#define PAT_CLR_4x2_EN (1 << 25) +#define PAT_CLR_8x1_EN (1 << 26) +#define HOST_BYTE_ALIGN (1 << 28) +#define HOST_BIG_ENDIAN_EN (1 << 29) + +typedef struct _MediaReg { + VOL32 OVERLAY_Y_X_START; /* 0x100 */ + VOL32 OVERLAY_Y_X_END; + VOL32 OVERLAY_VIDEO_KEY_CLR; + VOL32 OVERLAY_VIDEO_KEY_MSK; + VOL32 OVERLAY_GRAPHICS_KEY_CLR; + VOL32 OVERLAY_GRAPHICS_KEY_MSK; + VOL32 OVERLAY_KEY_CNTL; + VOL32 unused_107; + VOL32 OVERLAY_SCALE_INC; + VOL32 OVERLAY_SCALE_CNTL; + VOL32 SCALER_HEIGHT_WIDTH; + VOL32 SCALER_TEST; + VOL32 unused_10c; + VOL32 SCALER_BUF0_OFFSET; + VOL32 SCALER_BUF1_OFFSET; + VOL32 SCALER_BUF_PITCH; + VOL32 CAPTURE_START_END; /* 0x110 */ + VOL32 CAPTURE_X_WIDTH; + VOL32 VIDEO_FORMAT; + VOL32 VBI_START_END; + VOL32 CAPTURE_CONFIG; + VOL32 TRIG_CNTL; + VOL32 OVERLAY_EXCLUSIVE_HORZ; + VOL32 OVERLAY_EXCLUSIVE_VERT; + VOL32 VBI_WIDTH; + VOL32 CAPTURE_DEBUG; + VOL32 VIDEO_SYNC_TEST; + VOL32 unused_11b; + VOL32 SNAPSHOT_VH_COUNTS; + VOL32 SNAPSHOT_F_COUNT; + VOL32 N_VIF_COUNT; + VOL32 SNAPSHOT_VIF_COUNT; + VOL32 CAPTURE_BUF0_OFFSET; /* 0x120 */ + VOL32 CAPTURE_BUF1_OFFSET; + VOL32 ONESHOT_BUF_OFFSET; + VOL32 unused_123; + VOL32 unused_124; + VOL32 unused_125; + VOL32 unused_126; + VOL32 unused_127; + VOL32 unused_128; + VOL32 unused_129; + VOL32 unused_12a; + VOL32 unused_12b; + VOL32 SNAPSHOT2_VH_COUNTS; + VOL32 SNAPSHOT2_F_COUNT; + VOL32 N_VIF2_COUNT; + VOL32 SNAPSHOT2_VIF_COUNT; + VOL32 MPP_CONFIG; /* 0x130 */ + VOL32 MPP_STROBE_SEQ; + VOL32 MPP_ADDR; + VOL32 MPP_DATA; + VOL32 unused_134; + VOL32 unused_135; + VOL32 unused_136; + VOL32 unused_137; + VOL32 unused_138; + VOL32 unused_139; + VOL32 unused_13a; + VOL32 unused_13b; + VOL32 unused_13c; + VOL32 unused_13d; + VOL32 unused_13e; + VOL32 unused_13f; + VOL32 TVO_CNTL; /* 0x140 */ + VOL32 unused_141[15]; + VOL32 unused_150; /* 0x150 */ + VOL32 CRT_HORZ_VERT_LOAD; + VOL32 AGP_BASE_AGP_CNTL; + VOL32 SCALER_COLOUR_CNTL; + VOL32 SCALER_H_COEFF0; + VOL32 SCALER_H_COEFF1; + VOL32 SCALER_H_COEFF2; + VOL32 SCALER_H_COEFF3; + VOL32 SCALER_H_COEFF4; + VOL32 unused_15a; + VOL32 unused_15b; + VOL32 GUI_CMDFIFO_DEBUG; + VOL32 GUI_CMDFIFO_DATA; + VOL32 GUI_CNTL; + VOL32 unused_15f; + VOL32 BM_FRAME_BUF_OFFSET; /* 0x160 */ + VOL32 BM_SYSTEM_MEM_ADDR; + VOL32 BM_COMMAND; + VOL32 BM_STATUS; + VOL32 unused_164[10]; + VOL32 BM_GUI_TABLE; + VOL32 BM_SYSTEM_TABLE; + VOL32 unused_170[5]; /* 0x170 */ + VOL32 SCALER_BUF0_OFFSET_U; + VOL32 SCALER_BUF0_OFFSET_V; + VOL32 SCALER_BUF1_OFFSET_U; + VOL32 SCALER_BUF1_OFFSET_V; + VOL32 unused_179[7]; + VOL32 unused_180[16]; /* 0x180 */ + VOL32 setup_engine[0x40]; /* 0x190 */ + VOL32 dvd_subpicture[0x30]; /* 0x1d0 */ +} MediaReg; + +#define TRI_XY(x,y) ((y) << 16 | (x)) + +typedef struct _mach64Save { + CARD32 POWER_MANAGEMENT; +} Mach64Save; + +typedef struct _mach64CardInfo { + VesaCardPrivRec vesa; + CARD8 *reg_base; + Reg *reg; + MediaReg *media_reg; + Mach64Save save; +} Mach64CardInfo; + +#define getMach64CardInfo(kd) ((Mach64CardInfo *) ((kd)->card->driver)) +#define mach64CardInfo(kd) Mach64CardInfo *mach64c = getMach64CardInfo(kd) + +typedef struct _mach64Cursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} Mach64Cursor; + +#define MACH64_CURSOR_WIDTH 64 +#define MACH64_CURSOR_HEIGHT 64 + +typedef struct _mach64ScreenInfo { + VesaScreenPrivRec vesa; + CARD8 *cursor_base; + CARD8 *screen; + CARD8 *off_screen; + int off_screen_size; + CARD32 DP_PIX_WIDTH; + CARD32 DP_SET_GUI_ENGINE; + CARD32 USR1_DST_OFF_PITCH; + Bool bpp24; + Mach64Cursor cursor; +} Mach64ScreenInfo; + +#define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver)) +#define mach64ScreenInfo(kd) Mach64ScreenInfo *mach64s = getMach64ScreenInfo(kd) + +CARD32 +mach64ReadLCD (Reg *reg, int id); + +void +mach64WriteLCD (Reg *reg, int id, CARD32 data); + +Bool +mach64DrawInit (ScreenPtr pScreen); + +void +mach64DrawEnable (ScreenPtr pScreen); + +void +mach64DrawSync (ScreenPtr pScreen); + +void +mach64DrawDisable (ScreenPtr pScreen); + +void +mach64DrawFini (ScreenPtr pScreen); + +CARD8 +mach64ReadIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index); + +void +mach64WriteIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index, CARD8 value); + +Bool +mach64CursorInit (ScreenPtr pScreen); + +void +mach64CursorEnable (ScreenPtr pScreen); + +void +mach64CursorDisable (ScreenPtr pScreen); + +void +mach64CursorFini (ScreenPtr pScreen); + +void +mach64RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); + +extern KdCardFuncs mach64Funcs; + +#endif /* _MACH64_H_ */ diff --git a/hw/kdrive/mach64/mach64curs.c b/hw/kdrive/mach64/mach64curs.c new file mode 100644 index 000000000..d34b38bf6 --- /dev/null +++ b/hw/kdrive/mach64/mach64curs.c @@ -0,0 +1,389 @@ +/* + * Id: tridentcurs.c,v 1.1 1999/11/02 03:54:47 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. + */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/tridentcurs.c,v 1.6 2000/09/03 05:11:20 keithp Exp $ */ + +#include "trident.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + tridentScreenInfo(pScreenPriv); \ + TridentCursor *pCurPriv = &tridents->cursor + +static void +_tridentMoveCursor (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 */ + + tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); + tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); + tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); + tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); + tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); + tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); +} + +static void +tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _tridentMoveCursor (pScreen, x, y); +} + +static void +tridentAllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } +} + +static void +tridentSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CARD32 fg, bg; + + fg = pCurPriv->source; + bg = pCurPriv->mask; + tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); + tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); + + tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); + tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); +} + +void +tridentRecolorCursor (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; + } + tridentAllocCursorColors (pScreen); + tridentSetCursorColors (pScreen); +} + +#define InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +static void +tridentLoadCursor (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; + + /* + * Allocate new colors + */ + tridentAllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (CARD32 *) tridents->cursor_base; + mskLine = (CARD32 *) bits->mask; + srcLine = (CARD32 *) bits->source; + + h = bits->height; + if (h > TRIDENT_CURSOR_HEIGHT) + h = TRIDENT_CURSOR_HEIGHT; + + lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ + + for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += lwsrc; + srcLine += lwsrc; + for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { + + CARD32 m, s; + +#if 1 + if (i < h && j < lwsrc) + { + m = *msk++; + s = *src++; + InvertBits32(m); + InvertBits32(s); + } + else + { + m = 0; + s = 0; + } +#endif + *ram++ = m; + *ram++ = s; + } + } + + /* Set address for cursor bits */ + offset = tridents->cursor_base - (CARD8 *) tridents->screen; + offset >>= 10; + tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); + tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); + + /* Set new color */ + tridentSetCursorColors (pScreen); + + /* Enable the cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); + + /* Move to new position */ + tridentMoveCursor (pScreen, x, y); +} + +static void +tridentUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); +} + +static Bool +tridentRealizeCursor (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); + tridentLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + tridentLoadCursor (pScreen, x, y); + else + tridentUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec tridentPointerSpriteFuncs = { + tridentRealizeCursor, + tridentUnrealizeCursor, + tridentSetCursor, + tridentMoveCursor, +}; + +static void +tridentQueryBestSize (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 +tridentCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!tridents->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = TRIDENT_CURSOR_WIDTH; + pCurPriv->height= TRIDENT_CURSOR_HEIGHT; + pScreen->QueryBestSize = tridentQueryBestSize; + miPointerInitialize (pScreen, + &tridentPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +tridentCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + else + tridentUnloadCursor (pScreen); + } +} + +void +tridentCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + tridentUnloadCursor (pScreen); + } + } +} + +void +tridentCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c new file mode 100644 index 000000000..e248dabdd --- /dev/null +++ b/hw/kdrive/mach64/mach64draw.c @@ -0,0 +1,410 @@ +/* + * Id: mach64draw.c,v 1.1 1999/11/02 03:54:47 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. + */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64draw.c,v 1.9 2001/05/30 15:36:25 keithp Exp $ */ + +#include "mach64.h" +#include "mach64draw.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" +#include "picturestr.h" + +CARD8 mach64Rop[16] = { + /* GXclear */ 0x01, /* 0 */ + /* GXand */ 0x0c, /* src AND dst */ + /* GXandReverse */ 0x0d, /* src AND NOT dst */ + /* GXcopy */ 0x07, /* src */ + /* GXandInverted*/ 0x0e, /* NOT src AND dst */ + /* GXnoop */ 0x03, /* dst */ + /* GXxor */ 0x05, /* src XOR dst */ + /* GXor */ 0x0b, /* src OR dst */ + /* GXnor */ 0x0f, /* NOT src AND NOT dst */ + /* GXequiv */ 0x06, /* NOT src XOR dst */ + /* GXinvert */ 0x00, /* NOT dst */ + /* GXorReverse */ 0x0a, /* src OR NOT dst */ + /* GXcopyInverted*/ 0x04, /* NOT src */ + /* GXorInverted */ 0x09, /* NOT src OR dst */ + /* GXnand */ 0x08, /* NOT src OR NOT dst */ + /* GXset */ 0x02, /* 1 */ +}; + +#define MACH64_DRAW_COMBO_SOLID 0x1 +#define MACH64_DRAW_COMBO_COPY 0x8 + +static Reg *reg; +static CARD32 cmd; +static CARD32 avail; +static CARD32 triple; +static CARD32 combo; + +#define IDX(reg,n) (&(reg)->n - &(reg)->CRTC_H_TOTAL_DISP) + +static void +WAIT_AVAIL(Reg *reg, int n) +{ + if (avail < n) + { + while ((avail = ((reg->GUI_STAT) >> 16) & 0x3ff) < n) + ; + } + avail -= n; +} + +static void +WAIT_IDLE (Reg *reg) +{ + while (reg->GUI_STAT & 1) + ; +} + +#define MACH64_XY(x,y) (((x) & 0x7fff) | (((y) & 0x7fff) << 16)) +#define MACH64_YX(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16)) + +static void +mach64Setup (ScreenPtr pScreen, CARD32 combo, int wait) +{ + KdScreenPriv(pScreen); + mach64ScreenInfo(pScreenPriv); + mach64CardInfo(pScreenPriv); + reg = mach64c->reg; + triple = mach64s->bpp24; + + avail = 0; + WAIT_AVAIL(reg, wait + 3); + reg->DP_PIX_WIDTH = mach64s->DP_PIX_WIDTH; + reg->USR1_DST_OFF_PITCH = mach64s->USR1_DST_OFF_PITCH; + reg->DP_SET_GUI_ENGINE = mach64s->DP_SET_GUI_ENGINE | (combo << 20); +} + +Bool +mach64PrepareSolid (DrawablePtr pDrawable, + int alu, + Pixel pm, + Pixel fg) +{ + mach64Setup (pDrawable->pScreen, 1, 3); + reg->DP_MIX = (mach64Rop[alu] << 16) | 0; + reg->DP_WRITE_MSK = pm; + reg->DP_FRGD_CLR = fg; + return TRUE; +} + +void +mach64Solid (int x1, int y1, int x2, int y2) +{ + if (triple) + { + CARD32 traj; + + x1 *= 3; + x2 *= 3; + + traj = (DST_X_DIR | + DST_Y_DIR | + DST_24_ROT_EN | + DST_24_ROT((x1 / 4) % 6)); + WAIT_AVAIL (reg, 1); + reg->GUI_TRAJ_CNTL = traj; + } + WAIT_AVAIL(reg,2); + reg->DST_X_Y = MACH64_XY(x1,y1); + reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1); +} + +void +mach64DoneSolid (void) +{ +} + +static int copyDx; +static int copyDy; + +Bool +mach64PrepareCopy (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + int dx, + int dy, + int alu, + Pixel pm) +{ + CARD32 combo = 8; + + if ((copyDx = dx) > 0) + combo |= 1; + if ((copyDy = dy) > 0) + combo |= 2; + mach64Setup (pDstDrawable->pScreen, combo, 2); + reg->DP_MIX = (mach64Rop[alu] << 16) | 0; + reg->DP_WRITE_MSK = pm; + return TRUE; +} + +void +mach64Copy (int srcX, + int srcY, + int dstX, + int dstY, + int w, + int h) +{ + if (triple) + { + CARD32 traj; + + srcX *= 3; + dstX *= 3; + w *= 3; + + traj = DST_24_ROT_EN | DST_24_ROT((dstX / 4) % 6); + + if (copyDx > 0) + traj |= 1; + if (copyDy > 0) + traj |= 2; + + WAIT_AVAIL (reg, 1); + reg->GUI_TRAJ_CNTL = traj; + } + if (copyDx <= 0) + { + srcX += w - 1; + dstX += w - 1; + } + if (copyDy <= 0) + { + srcY += h - 1; + dstY += h - 1; + } + WAIT_AVAIL (reg, 4); + reg->SRC_Y_X = MACH64_YX(srcX, srcY); + reg->SRC_WIDTH1 = w; + reg->DST_Y_X = MACH64_YX(dstX, dstY); + reg->DST_HEIGHT_WIDTH = MACH64_YX(w,h); +} + +void +mach64DoneCopy (void) +{ +} + +KaaScreenPrivRec mach64Kaa = { + mach64PrepareSolid, + mach64Solid, + mach64DoneSolid, + + mach64PrepareCopy, + mach64Copy, + mach64DoneCopy, +}; + +#define PIX_FORMAT_MONO 0 +#define PIX_FORMAT_PSEUDO_8 2 +#define PIX_FORMAT_TRUE_1555 3 +#define PIX_FORMAT_TRUE_565 4 +#define PIX_FORMAT_TRUE_8888 6 +#define PIX_FORMAT_TRUE_332 7 +#define PIX_FORMAT_GRAY_8 8 +#define PIX_FORMAT_YUV_422 0xb +#define PIX_FORMAT_YUV_444 0xe +#define PIX_FORMAT_TRUE_4444 0xf + +mach64DrawInit (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64ScreenInfo(pScreenPriv); + CARD32 DP_PIX_WIDTH; + CARD32 DP_SET_GUI_ENGINE; + CARD32 SET_DP_DST_PIX_WIDTH; + CARD32 DST1_PITCH; + + mach64s->bpp24 = FALSE; + switch (pScreenPriv->screen->fb[0].depth) { + case 1: + DP_PIX_WIDTH = ((PIX_FORMAT_MONO << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_MONO << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_MONO << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0); + SET_DP_DST_PIX_WIDTH = PIX_FORMAT_MONO; + break; + case 4: + return FALSE; + break; + case 8: + DP_PIX_WIDTH = ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0); + SET_DP_DST_PIX_WIDTH = PIX_FORMAT_PSEUDO_8; + break; + case 15: + DP_PIX_WIDTH = ((PIX_FORMAT_TRUE_1555 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_1555 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_1555 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0); + SET_DP_DST_PIX_WIDTH = PIX_FORMAT_TRUE_1555; + break; + case 16: + DP_PIX_WIDTH = ((PIX_FORMAT_TRUE_565 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_565 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_565 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0); + SET_DP_DST_PIX_WIDTH = PIX_FORMAT_TRUE_565; + break; + case 24: + if (pScreenPriv->screen->fb[0].bitsPerPixel == 24) + { + mach64s->bpp24 = TRUE; + DP_PIX_WIDTH = ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0); + SET_DP_DST_PIX_WIDTH = PIX_FORMAT_PSEUDO_8; + } + else + { + DP_PIX_WIDTH = ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0); + SET_DP_DST_PIX_WIDTH = PIX_FORMAT_TRUE_8888; + } + break; + } + + if (!kaaDrawInit (pScreen, &mach64Kaa)) + return FALSE; + + mach64s->DP_PIX_WIDTH = DP_PIX_WIDTH; + DST1_PITCH = (pScreenPriv->screen->fb[0].pixelStride) >> 3; + if (mach64s->bpp24) + DST1_PITCH *= 3; + mach64s->USR1_DST_OFF_PITCH = ((0 << 0) | /* USR1_DST_OFFSET */ + (DST1_PITCH << 22) | /* USR1_DST_PITCH */ + 0); + mach64s->DP_SET_GUI_ENGINE = ((SET_DP_DST_PIX_WIDTH << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (0 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (1 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0); + return TRUE; +} + +void +mach64DrawEnable (ScreenPtr pScreen) +{ + KdMarkSync (pScreen); +} + +void +mach64DrawDisable (ScreenPtr pScreen) +{ +} + +void +mach64DrawFini (ScreenPtr pScreen) +{ +} + +void +mach64DrawSync (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64CardInfo(pScreenPriv); + reg = mach64c->reg; + + WAIT_IDLE (reg); +} diff --git a/hw/kdrive/mach64/mach64draw.h b/hw/kdrive/mach64/mach64draw.h new file mode 100644 index 000000000..185d6b86c --- /dev/null +++ b/hw/kdrive/mach64/mach64draw.h @@ -0,0 +1,72 @@ +/* + * Id: tridentdraw.h,v 1.1 1999/11/02 03:54:47 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. + */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.h,v 1.4 2000/10/11 06:04:40 keithp Exp $ */ + +#ifndef _TRIDENTDRAW_H_ +#define _TRIDENTDRAW_H_ + +#define SetupTrident(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + Cop *cop = tridentc->cop + +#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) + +#define _tridentInit(cop,tridentc) { \ + if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \ + (cop)->multi = (tridentc)->cop_depth; \ + (cop)->multi = (tridentc)->cop_stride; \ + (cop)->multi = TridentAlpha; \ +} \ + +#define _tridentSetSolidRect(cop,pix,alu,cmd) {\ + cop->multi = COP_MULTI_PATTERN; \ + cop->multi = COP_MULTI_ROP | tridentRop[alu]; \ + cop->fg = (pix); \ + cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ +} + +#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \ + (cop)->dst_start_xy = TRI_XY (x1,y1); \ + (cop)->dst_end_xy = TRI_XY(x2,y2); \ + _tridentWaitDone(cop); \ + (cop)->command = (cmd); \ +} + +#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ + COP_STATUS_DPE_BUSY | \ + COP_STATUS_MI_BUSY) + +#define _tridentWaitDone(cop) { \ + int __q__ = 500000; \ + while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ + ; \ + if (!__q__) \ + (cop)->status = 0; \ +} + +#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop) + +#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) + +#endif diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c new file mode 100644 index 000000000..fac8d46ac --- /dev/null +++ b/hw/kdrive/mach64/mach64stub.c @@ -0,0 +1,58 @@ +/* + * Id: mach64stub.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. + */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64stub.c,v 1.5 2000/11/29 08:42:25 keithp Exp $ */ + +#include "mach64.h" + +void +InitCard (char *name) +{ + KdCardAttr attr; + + if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdInitInput (&Ps2MouseFuncs, &LinuxKeyboardFuncs); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + int ret; + + if (!(ret = vesaProcessArgument (argc, argv, i))) + ret = KdProcessArgument(argc, argv, i); + return ret; +} diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c index da9d89284..28164abf3 100644 --- a/hw/kdrive/src/kaa.c +++ b/hw/kdrive/src/kaa.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/kdrive/kaa.c,v 1.1 2001/05/29 04:54:10 keithp Exp $ + * $XFree86: xc/programs/Xserver/hw/kdrive/kaa.c,v 1.2 2001/05/30 15:36:25 keithp Exp $ * * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * @@ -130,8 +130,8 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable, if (pSrcDrawable->type == DRAWABLE_WINDOW && (*pKaaScr->PrepareCopy) (pSrcDrawable, pDstDrawable, - upsidedown, - reverse, + dx, + dy, pGC ? pGC->alu : GXcopy, pGC ? pGC->planemask : FB_ALLONES)) { @@ -275,46 +275,45 @@ kaaSolidBoxClipped (DrawablePtr pDrawable, int partX1, partX2, partY1, partY2; CARD32 cmd; - if ((*pKaaScr->PrepareSolid) (pDrawable, GXcopy, pm, fg)) - { - for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); - nbox--; - pbox++) - { - partX1 = pbox->x1; - if (partX1 < x1) - partX1 = x1; - - partX2 = pbox->x2; - if (partX2 > x2) - partX2 = x2; - - if (partX2 <= partX1) - continue; - - partY1 = pbox->y1; - if (partY1 < y1) - partY1 = y1; - - partY2 = pbox->y2; - if (partY2 > y2) - partY2 = y2; - - if (partY2 <= partY1) - continue; - - (*pKaaScr->Solid) (partX1, partY1, partX2, partY2); - } - (*pKaaScr->DoneSolid) (); - KdMarkSync(pDrawable->pScreen); - } - else + if (!(*pKaaScr->PrepareSolid) (pDrawable, GXcopy, pm, fg)) { + KdCheckSync (pDrawable->pScreen); fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, fbAnd (GXcopy, fg, pm), fbXor (GXcopy, fg, pm)); + return; + } + for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); + nbox--; + pbox++) + { + partX1 = pbox->x1; + if (partX1 < x1) + partX1 = x1; + + partX2 = pbox->x2; + if (partX2 > x2) + partX2 = x2; + + if (partX2 <= partX1) + continue; + + partY1 = pbox->y1; + if (partY1 < y1) + partY1 = y1; + + partY2 = pbox->y2; + if (partY2 > y2) + partY2 = y2; + + if (partY2 <= partY1) + continue; + + (*pKaaScr->Solid) (partX1, partY1, partX2, partY2); } + (*pKaaScr->DoneSolid) (); + KdMarkSync(pDrawable->pScreen); } void diff --git a/hw/kdrive/trident/trident.c b/hw/kdrive/trident/trident.c index 88f797b7f..065548bdd 100644 --- a/hw/kdrive/trident/trident.c +++ b/hw/kdrive/trident/trident.c @@ -19,12 +19,10 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.15 2000/11/29 08:42:25 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.16 2001/03/21 16:43:16 dawes Exp $ */ #include "trident.h" -#define extern -#include -#undef extern +#include #undef TRI_DEBUG diff --git a/hw/kdrive/trident/tridentdraw.c b/hw/kdrive/trident/tridentdraw.c index 486bad693..78835ea93 100644 --- a/hw/kdrive/trident/tridentdraw.c +++ b/hw/kdrive/trident/tridentdraw.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.c,v 1.8 2001/05/29 04:54:12 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/tridentdraw.c,v 1.9 2001/05/30 15:36:25 keithp Exp $ */ #include "trident.h" #include "tridentdraw.h" @@ -112,8 +112,8 @@ tridentDoneSolid (void) Bool tridentPrepareCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - Bool upsidedown, - Bool reverse, + int dx, + int dy, int alu, Pixel pm) { @@ -128,7 +128,7 @@ tridentPrepareCopy (DrawablePtr pSrcDrawable, cop->multi = COP_MULTI_PATTERN; cop->multi = COP_MULTI_ROP | tridentRop[alu]; cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FB; - if (upsidedown || reverse) + if (dx < 0 || dy < 0) cmd |= COP_X_REVERSE; return TRUE; } -- cgit v1.2.3