Lots of Tiny-X changes:

Add overlay support in the Tiny-X Savage4 driver (required changing lots of
    Tiny-X code). Savage4 now support 8/16, 8/32 overlays.
Add IGS Cyberpro 5050 driver. This chip has bus support for embeded
    systems.
This commit is contained in:
Keith Packard 2000-05-06 22:17:53 +00:00
parent 4b54f22b6a
commit 3731c184d6
34 changed files with 3963 additions and 683 deletions

View File

@ -88,40 +88,40 @@ fbdevScreenInit (KdScreenInfo *screen)
screen->width = priv->var.xres;
screen->height = priv->var.yres;
screen->depth = priv->var.bits_per_pixel;
screen->bitsPerPixel = priv->var.bits_per_pixel;
screen->byteStride = priv->fix.line_length;
screen->pixelStride = (priv->fix.line_length * 8 /
screen->fb[0].depth = priv->var.bits_per_pixel;
screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
screen->fb[0].byteStride = priv->fix.line_length;
screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
priv->var.bits_per_pixel);
switch (priv->fix.visual) {
case FB_VISUAL_PSEUDOCOLOR:
screen->visuals = ((1 << StaticGray) |
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
screen->blueMask = 0x00;
screen->greenMask = 0x00;
screen->redMask = 0x00;
screen->fb[0].blueMask = 0x00;
screen->fb[0].greenMask = 0x00;
screen->fb[0].redMask = 0x00;
break;
case FB_VISUAL_TRUECOLOR:
screen->visuals = (1 << TrueColor);
screen->redMask = FbStipMask (priv->var.red.offset, priv->var.red.length);
screen->greenMask = FbStipMask (priv->var.green.offset, priv->var.green.length);
screen->blueMask = FbStipMask (priv->var.blue.offset, priv->var.blue.length);
allbits = screen->redMask | screen->greenMask | screen->blueMask;
screen->fb[0].visuals = (1 << TrueColor);
screen->fb[0].redMask = FbStipMask (priv->var.red.offset, priv->var.red.length);
screen->fb[0].greenMask = FbStipMask (priv->var.green.offset, priv->var.green.length);
screen->fb[0].blueMask = FbStipMask (priv->var.blue.offset, priv->var.blue.length);
allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
depth = 32;
while (depth && !(allbits & (1 << (depth - 1))))
depth--;
screen->depth = depth;
screen->fb[0].depth = depth;
break;
default:
return FALSE;
break;
}
screen->rate = 72;
screen->frameBuffer = (CARD8 *) (priv->fb);
screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
return TRUE;
}
@ -191,7 +191,7 @@ fbdevCardFini (KdCardInfo *card)
}
void
fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
FbdevPriv *priv = pScreenPriv->card->driver;
@ -232,7 +232,7 @@ fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
}
void
fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
FbdevPriv *priv = pScreenPriv->card->driver;

View File

@ -75,10 +75,10 @@ void
fbdevCardFini (KdCardInfo *card);
void
fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
void
fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
#endif /* _FBDEV_H_ */

14
hw/kdrive/igs/Imakefile Normal file
View File

@ -0,0 +1,14 @@
XCOMM $XFree86$
#include <Server.tmpl>
SRCS = igs.c igsdraw.c igsstub.c
OBJS = igs.o igsdraw.o igsstub.o
INCLUDES = -I.. -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I../../../fb -I../../../mi -I../../../include -I../../../os \
-I$(EXTINCSRC) -I$(XINCLUDESRC)
NormalLibraryObjectRule()
NormalLibraryTarget(igs,$(OBJS))
DependTarget()

201
hw/kdrive/igs/igs.c Normal file
View File

@ -0,0 +1,201 @@
/*
* $XFree86$
*
* 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.
*/
#include "igs.h"
Bool
igsCardInit (KdCardInfo *card)
{
int k;
char *pixels;
IgsCardInfo *igsc;
igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo));
if (!igsc)
return FALSE;
memset (igsc, '\0', sizeof (IgsCardInfo));
igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0],
4096 * 1024);
igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] +
IGS_COP_OFFSET,
sizeof (Cop5xxx));
igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] +
IGS_COP_DATA,
IGS_COP_DATA_LEN);
card->driver = igsc;
return TRUE;
}
Bool
igsScreenInit (KdScreenInfo *screen)
{
IgsCardInfo *igsc = screen->card->driver;
int fb = 0;
if (screen->fb[fb].depth >= 24)
{
screen->fb[fb].depth = 24;
if (screen->fb[fb].bitsPerPixel != 24)
screen->fb[fb].bitsPerPixel = 32;
}
else if (screen->fb[fb].depth >= 16)
{
screen->fb[fb].depth = 16;
screen->fb[fb].bitsPerPixel = 16;
}
else if (screen->fb[fb].depth >= 15)
{
screen->fb[fb].depth = 15;
screen->fb[fb].bitsPerPixel = 16;
}
else
{
screen->fb[fb].depth = 8;
screen->fb[fb].bitsPerPixel = 8;
}
switch (screen->fb[fb].depth) {
case 8:
screen->fb[fb].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
screen->fb[fb].blueMask = 0x00;
screen->fb[fb].greenMask = 0x00;
screen->fb[fb].redMask = 0x00;
break;
case 15:
screen->fb[fb].visuals = (1 << TrueColor);
screen->fb[fb].blueMask = 0x001f;
screen->fb[fb].greenMask = 0x03e0;
screen->fb[fb].redMask = 0x7c00;
break;
case 16:
screen->fb[fb].visuals = (1 << TrueColor);
screen->fb[fb].blueMask = 0x001f;
screen->fb[fb].greenMask = 0x07e0;
screen->fb[fb].redMask = 0xf800;
break;
case 24:
screen->fb[fb].visuals = (1 << TrueColor);
screen->fb[fb].blueMask = 0x0000ff;
screen->fb[fb].greenMask = 0x00ff00;
screen->fb[fb].redMask = 0xff0000;
break;
}
screen->fb[fb].pixelStride = screen->width;
screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
screen->fb[fb].frameBuffer = igsc->frameBuffer;
if (!igsc->cop)
screen->dumb = TRUE;
return TRUE;
}
Bool
igsInitScreen(ScreenPtr pScreen)
{
return TRUE;
}
void
igsPreserve (KdCardInfo *card)
{
}
void
igsEnable (ScreenPtr pScreen)
{
}
Bool
igsDPMS (ScreenPtr pScreen, int mode)
{
return TRUE;
}
void
igsDisable (ScreenPtr pScreen)
{
}
void
igsRestore (KdCardInfo *card)
{
}
void
igsScreenFini (KdScreenInfo *screen)
{
}
void
igsCardFini (KdCardInfo *card)
{
IgsCardInfo *igsc = card->driver;
if (igsc->copData)
KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN);
if (igsc->cop)
KdUnmapDevice (igsc->cop, sizeof (Cop5xxx));
if (igsc->frameBuffer)
KdUnmapDevice (igsc->frameBuffer, 4096 * 1024);
xfree (igsc);
card->driver = 0;
}
KdCardFuncs igsFuncs = {
igsCardInit, /* cardinit */
igsScreenInit, /* scrinit */
igsInitScreen,
igsPreserve, /* preserve */
igsEnable, /* enable */
igsDPMS, /* dpms */
igsDisable, /* disable */
igsRestore, /* restore */
igsScreenFini, /* scrfini */
igsCardFini, /* cardfini */
0, /* initCursor */
0, /* enableCursor */
0, /* disableCursor */
0, /* finiCursor */
0, /* recolorCursor */
igsDrawInit, /* initAccel */
igsDrawEnable, /* enableAccel */
igsDrawSync, /* drawSync */
igsDrawDisable, /* disableAccel */
igsDrawFini, /* finiAccel */
0, /* getColors */
0, /* putColors */
};

244
hw/kdrive/igs/igs.h Normal file
View File

@ -0,0 +1,244 @@
/*
* $XFree86$
*
* Copyright © 1999 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of SuSE not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. SuSE makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
*/
#ifndef _IGS_H_
#define _IGS_H_
#include "kdrive.h"
extern KdCardFuncs igsFuncs;
/*
* FB 0x00000000
* VGA 0x00800000
* Blt window 0x008a0000
* Coprocessor 0x008bf000
*/
#define IGS_COP_DATA 0x008a0000
#define IGS_COP_DATA_LEN 0x00010000
#define IGS_COP_OFFSET 0x008bf000
typedef volatile CARD8 VOL8;
typedef volatile CARD16 VOL16;
typedef volatile CARD32 VOL32;
typedef struct _Cop5xxx {
VOL8 pad000[0x11]; /* 0x000 */
VOL8 control; /* 0x011 */
#define IGS_CONTROL_HBLTW_RDYZ 0x01
#define IGS_CONTROL_MALLWBEPTZ 0x02
#define IGS_CONTROL_CMDFF 0x04
#define IGS_CONTROL_SOP 0x08
#define IGS_CONTROL_OPS 0x10
#define IGS_CONTROL_TER 0x20
#define IGS_CONTROL_HBACKZ 0x40
#define IGS_CONTROL_BUSY 0x80
VOL8 pad012[0x06]; /* 0x012 */
VOL32 src1_stride; /* 0x018 */
VOL32 format; /* 0x01c */
#define IGS_FORMAT_8BPP 0
#define IGS_FORMAT_16BPP 1
#define IGS_FORMAT_24BPP 2
#define IGS_FORMAT_32BPP 3
VOL32 bres_error; /* 0x020 */
VOL32 bres_k1; /* 0x024 */
VOL32 bres_k2; /* 0x028 */
VOL8 pad02c[0x1c]; /* 0x02c */
VOL32 mix; /* 0x048 */
#define IGS_MIX_FG 0x00ff
#define IGS_MIX_BG 0xff00
#define IGS_MAKE_MIX(fg,bg) ((fg) | ((bg) << 8))
#define IGS_MIX_ZERO 0x0
#define IGS_MIX_SRC_AND_DST 0x1
#define IGS_MIX_SRC_AND_NOT_DST 0x2
#define IGS_MIX_SRC 0x3
#define IGS_MIX_NOT_SRC_AND_DST 0x4
#define IGS_MIX_DST 0x5
#define IGS_MIX_SRC_XOR_DST 0x6
#define IGS_MIX_SRC_OR_DST 0x7
#define IGS_MIX_NOT_SRC_AND_NOT_DST 0x8
#define IGS_MIX_SRC_XOR_NOT_DST 0x9
#define IGS_MIX_NOT_DST 0xa
#define IGS_MIX_SRC_OR_NOT_DST 0xb
#define IGS_MIX_NOT_SRC 0xc
#define IGS_MIX_NOT_SRC_OR_DST 0xd
#define IGS_MIX_NOT_SRC_OR_NOT_DST 0xe
#define IGS_MIX_ONE 0xf
VOL32 colorComp; /* 0x04c */
VOL32 planemask; /* 0x050 */
VOL8 pad054[0x4]; /* 0x054 */
VOL32 fg; /* 0x058 */
VOL32 bg; /* 0x05c */
VOL32 dim; /* 0x060 */
#define IGS_MAKE_DIM(w,h) ((w) | ((h) << 16))
VOL8 pad5[0x0c]; /* 0x064 */
VOL32 src1_base_address; /* 0x070 */
VOL8 pad074[0x04]; /* 0x074 */
VOL16 dst_x_rotate; /* 0x078 */
VOL16 pat_y_rotate; /* 0x07a */
VOL32 operation; /* 0x07c */
/* OCT[2:0] */
#define IGS_DRAW_X_MAJOR 0x00000000
#define IGS_DRAW_Y_MAJOR 0x00000001
#define IGS_DRAW_T_B 0x00000000
#define IGS_DRAW_B_T 0x00000002
#define IGS_DRAW_L_R 0x00000000
#define IGS_DRAW_R_L 0x00000004
/* Draw_Mode[1:0] */
#define IGS_DRAW_ALL 0x00000000
#define IGS_DRAW_NOT_FIRST 0x00000010
#define IGS_DRAW_NOT_LAST 0x00000020
#define IGS_DRAW_NOT_FIRST_LAST 0x00000030
/* TRPS[1:0] */
#define IGS_TRANS_SRC1 0x00000000
#define IGS_TRANS_SRC2 0x00000100
#define IGS_TRANS_DST 0x00000200
/* TRPS2 Transparent Invert */
#define IGS_TRANS_INVERT 0x00000400
/* TRPS3, Transparent Enable */
#define IGS_TRANS_ENABLE 0x00000800
/* PPS[3:0], Pattern Pixel Select */
#define IGS_PIXEL_TEXT_OPAQUE 0x00001000
#define IGS_PIXEL_STIP_OPAQUE 0x00002000
#define IGS_PIXEL_LINE_OPAQUE 0x00003000
#define IGS_PIXEL_TEXT_TRANS 0x00005000
#define IGS_PIXEL_STIP_TRANS 0x00006000
#define IGS_PIXEL_LINE_TRANS 0x00007000
#define IGS_PIXEL_FG 0x00008000
#define IGS_PIXEL_TILE 0x00009000
/* HostBltEnable[1:0] */
#define IGS_HBLT_DISABLE 0x00000000
#define IGS_HBLT_READ 0x00010000
#define IGS_HBLT_WRITE_1 0x00020000
#define IGS_HBLT_WRITE_2 0x00030000
/* Src2MapSelect[2:0], Src2 map select mode */
#define IGS_SRC2_NORMAL 0x00000000
#define IGS_SRC2_MONO_OPAQUE 0x00100000
#define IGS_SRC2_FG 0x00200000
#define IGS_SRC2_MONO_TRANS 0x00500000
/* StepFunction[3:0], Step function select */
#define IGS_STEP_DRAW_AND_STEP 0x04000000
#define IGS_STEP_LINE_DRAW 0x05000000
#define IGS_STEP_PXBLT 0x08000000
#define IGS_STEP_INVERT_PXBLT 0x09000000
#define IGS_STEP_TERNARY_PXBLT 0x0b000000
/* FGS */
#define IGS_FGS_FG 0x00000000
#define IGS_FGS_SRC 0x20000000
/* BGS */
#define IGS_BGS_BG 0x00000000
#define IGS_BGS_SRC 0x80000000
VOL8 pad080[0x91]; /* 0x080 */
VOL8 debug_control_1; /* 0x111 */
VOL8 debug_control_2; /* 0x112 */
VOL8 pad113[0x05]; /* 0x113 */
VOL32 src2_stride; /* 0x118 */
VOL8 pad11c[0x14]; /* 0x11c */
VOL32 extension; /* 0x130 */
#define IGS_BURST_ENABLE 0x01
#define IGS_STYLE_LINE 0x02
#define IGS_ADDITIONAL_WAIT 0x04
#define IGS_BLOCK_COP_REG 0x08
#define IGS_TURBO_MONO 0x10
#define IGS_SELECT_SAMPLE 0x40
#define IGS_MDSBL_RD_B_WR 0x80
#define IGS_WRMRSTZ 0x100
#define IGS_TEST_MTST 0x200
VOL8 style_line_roll_over; /* 0x134 */
VOL8 style_line_inc; /* 0x135 */
VOL8 style_line_pattern; /* 0x136 */
VOL8 style_line_accumulator; /* 0x137 */
VOL8 style_line_pattern_index; /* 0x138 */
VOL8 pad139[0x3]; /* 0x139 */
VOL16 mono_burst_total; /* 0x13c */
VOL8 pad13e[0x12]; /* 0x13e */
VOL8 pat_x_rotate; /* 0x150 */
VOL8 pad151[0x1f]; /* 0x151 */
VOL32 src1_start; /* 0x170 */
VOL32 src2_start; /* 0x174 */
VOL32 dst_start; /* 0x178 */
VOL8 pad17c[0x9c]; /* 0x17c */
VOL16 dst_stride; /* 0x218 */
} Cop5xxx;
typedef struct _igsCardInfo {
Cop5xxx *cop;
VOL32 *copData;
Bool need_sync;
CARD8 *frameBuffer;
} IgsCardInfo;
#define getIgsCardInfo(kd) ((IgsCardInfo *) ((kd)->card->driver))
#define igsCardInfo(kd) IgsCardInfo *igsc = getIgsCardInfo(kd)
Bool
igsDrawInit (ScreenPtr pScreen);
void
igsDrawEnable (ScreenPtr pScreen);
void
igsDrawDisable (ScreenPtr pScreen);
void
igsDrawSync (ScreenPtr pScreen);
void
igsDrawFini (ScreenPtr pScreen);
#endif /* _IGS_H_ */

1114
hw/kdrive/igs/igsdraw.c Normal file

File diff suppressed because it is too large Load Diff

188
hw/kdrive/igs/igsdraw.h Normal file
View File

@ -0,0 +1,188 @@
/*
* $XFree86$
*
* Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _IGSDRAW_H_
#define _IGSDRAW_H_
extern CARD8 igsPatRop[];
#define SetupIgs(s) KdScreenPriv(s); \
igsCardInfo(pScreenPriv); \
Cop5xxx *cop = igsc->cop; \
int cop_stride = pScreenPriv->screen->fb[0].pixelStride
#define _igsWaitLoop(cop,mask,value) { \
int __loop = 1000000; \
while (((cop)->control & (mask)) != (value)) { \
if (--__loop <= 0) { \
FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \
} \
} \
}
#define _igsWaitDone(cop) _igsWaitLoop(cop, \
(IGS_CONTROL_BUSY| \
IGS_CONTROL_MALLWBEPTZ), \
0)
#define _igsWaitFull(cop) _igsWaitLoop(cop, \
IGS_CONTROL_CMDFF, \
0)
#define _igsWaitIdleEmpty(cop) _igsWaitDone(cop)
#define _igsWaitHostBltAck(cop) _igsWaitLoop(cop, \
(IGS_CONTROL_HBACKZ| \
IGS_CONTROL_CMDFF), \
0)
#define _igsReset(cop) ((cop)->control = 0)
#define IgsInvertBits32(v) { \
v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
}
#define IgsInvertBits16(v) { \
v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \
v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \
v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \
}
#define IgsInvertBits8(v) { \
v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \
v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \
v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \
}
#define IgsAdjustBits32(b) IgsInvertBits32(b)
#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\
_igsWaitFull(cop); \
(cop)->mix = IGS_MAKE_MIX(alu,alu); \
(cop)->fg = (pix); \
(cop)->planemask = (pm); \
(cmd) = (IGS_DRAW_T_B | \
IGS_DRAW_L_R | \
IGS_DRAW_ALL | \
IGS_PIXEL_FG | \
IGS_HBLT_DISABLE | \
IGS_SRC2_NORMAL | \
IGS_STEP_PXBLT | \
IGS_FGS_FG | \
IGS_BGS_BG); \
}
#define _igsRect(cop,x,y,w,h,cmd) { \
_igsWaitFull(cop); \
(cop)->dst_start = (x) + (y) * (cop_stride); \
(cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
(cop)->operation = (cmd); \
}
#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \
_igsWaitFull(cop); \
(cop)->mix = IGS_MAKE_MIX(alu,GXnoop); \
(cop)->planemask = (pm); \
(cop)->src1_stride = cop_stride - 1; \
(cmd) = (IGS_DRAW_ALL | \
IGS_PIXEL_FG | \
IGS_HBLT_DISABLE | \
IGS_SRC2_NORMAL | \
IGS_STEP_PXBLT | \
IGS_FGS_SRC | \
IGS_BGS_BG); \
if (backwards) (cmd) |= IGS_DRAW_R_L; \
if (upsidedown) (cmd) |= IGS_DRAW_B_T; \
}
#if 0
#define _igsPreparePlaneBlt(cop) { \
_igsReset(cop); \
(cop)->dst_stride = cop_stride - 1; \
(cop)->src1_stride = cop_stride - 1; \
(cop)->src2_stride = cop_stride - 1; \
(cop)->format = IGS_FORMAT_16BPP; \
(cop)->src1_start = 0; \
(cop)->src2_start = 0; \
}
#else
#define _igsPreparePlaneBlt(cop)
#endif
#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \
_igsWaitIdleEmpty(cop); \
_igsPreparePlaneBlt(cop); \
(cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[GXnoop]); \
(cop)->fg = (fg_pix); \
(cop)->planemask = (pm); \
(cmd) = (IGS_DRAW_T_B | \
IGS_DRAW_L_R | \
IGS_DRAW_ALL | \
IGS_PIXEL_FG | \
IGS_HBLT_WRITE_2 | \
IGS_SRC2_MONO_TRANS | \
IGS_STEP_TERNARY_PXBLT | \
IGS_FGS_FG | \
IGS_BGS_BG); \
}
#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \
_igsWaitIdleEmpty(cop); \
_igsPreparePlaneBlt(cop); \
(cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
(cop)->planemask = (pm); \
(cop)->fg = (fg_pix); \
(cop)->bg = (bg_pix); \
(cmd) = (IGS_DRAW_T_B | \
IGS_DRAW_L_R | \
IGS_DRAW_ALL | \
IGS_PIXEL_FG | \
IGS_HBLT_WRITE_2 | \
IGS_SRC2_MONO_OPAQUE | \
IGS_STEP_TERNARY_PXBLT | \
IGS_FGS_FG | \
IGS_BGS_BG); \
}
#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \
/* _igsWaitFull(cop); */ \
(cop)->dst_start = (x) + (y) * (cop_stride); \
(cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \
(cop)->operation = (cmd); \
/* _igsWaitHostBltAck(cop); */ \
}
#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \
_igsWaitFull(cop); \
(cop)->dst_start = (dx) + (dy) * cop_stride; \
(cop)->src1_start = (sx) + (sy) * cop_stride; \
(cop)->src1_stride = cop_stride - 1; \
(cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
(cop)->operation = (cmd); \
}
#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
#endif

57
hw/kdrive/igs/igsstub.c Normal file
View File

@ -0,0 +1,57 @@
/*
* $XFree86$
*
* Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "igs.h"
void
InitCard (char *name)
{
KdCardAttr attr;
CARD32 count;
count = 0;
while (LinuxFindPci (0x10ea, 0x5000, count, &attr))
{
KdCardInfoAdd (&igsFuncs, &attr, 0);
count++;
}
}
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)
{
return KdProcessArgument (argc, argv, i);
}

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.2 1999/12/30 03:03:10 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.3 2000/02/23 20:30:02 dawes Exp $ */
#ifndef _S3_H_
#define _S3_H_
@ -98,110 +98,37 @@ typedef volatile struct _s3 {
VOL32 blend_control; /* 81a0 */
VOL8 _pad3c[0x1c]; /* 81a4 */
VOL32 primary_stream_addr_0; /* 81c0 */
VOL8 _pad3d[0x124]; /* 81c4 */
#if 0
VOL16 cur_y; /* 82e8 */
VOL8 _pad4[0xc6]; /* 82ea */
#else
VOL32 primary_stream_addr_1; /* 81c4 */
VOL32 primary_stream_stride; /* 81c8 */
VOL32 secondary_stream_mbuf; /* 81cc */
VOL32 secondary_stream_addr_0;/* 81d0 */
VOL32 secondary_stream_addr_1;/* 81d4 */
VOL32 secondary_stream_stride;/* 81d8 */
VOL8 _pad81dc[4]; /* 81dc */
VOL32 secondary_stream_vscale;/* 81e0 */
VOL32 secondary_stream_vinit; /* 81e4 */
VOL32 secondary_stream_scount;/* 81e8 */
VOL32 streams_fifo; /* 81ec */
VOL32 primary_stream_xy; /* 81f0 */
VOL32 primary_stream_size; /* 81f4 */
VOL32 secondary_stream_xy; /* 81f8 */
VOL32 secondary_stream_size; /* 81fc */
VOL8 _pad8200[0xe8]; /* 8200 */
VOL32 cur_y; /* 82e8 */
VOL8 _pad4[0xc4]; /* 82ec */
#endif
#if 0
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 */
VOL32 subsys_status; /* 8504 */
VOL8 _pad6[0x4]; /* 8508 */
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 */
#else
VOL8 _pad_reg[0x5f38]; /* 83b0 */
#endif
VOL8 _pad4[0x14]; /* 82ec */
VOL32 primary_stream_mem; /* 8300 */
VOL32 secondary_stream_mem; /* 8304 */
VOL8 _pad8308[0xD2]; /* 8308 */
VOL8 input_status_1; /* 83da */
VOL8 _pad83db[0x131]; /* 83db */
VOL32 adv_func_cntl; /* 850c */
VOL8 _pad8510[0x5dd8]; /* 8510 */
VOL32 pix_trans; /* e2e8 */
VOL8 _pad23[0x3a974]; /* e2ec */
VOL8 _pade2ec[0x3a92c]; /* e2ec */
VOL32 cmd_overflow_buf_ptr; /* 48c18 */
VOL8 _pad48c1c[0x8]; /* 48c1c */
VOL32 bci_power_management; /* 48c24 */
VOL8 _pad48c28[0x38]; /* 48c28 */
VOL32 alt_status_0; /* 48c60 */
VOL32 alt_status_1; /* 48c64 */
} S3, *S3Ptr;
@ -368,6 +295,22 @@ typedef volatile struct _s3 {
#define COLCMPOP_GT 0x0038
#define PLANEMODE 0x0004
/* Multifunction Control Misc 8144 */
#define MISC_DST_BA_0 (0x0 << 0)
#define MISC_DST_BA_1 (0x1 << 0)
#define MISC_DST_BA_2 (0x2 << 0)
#define MISC_DST_BA_3 (0x3 << 0)
#define MISC_SRC_BA_0 (0x0 << 2)
#define MISC_SRC_BA_1 (0x1 << 2)
#define MISC_SRC_BA_2 (0x2 << 2)
#define MISC_SRC_BA_3 (0x3 << 2)
#define MISC_RSF (1 << 4)
#define MISC_EXT_CLIP (1 << 5)
#define MISC_SRC_NE (1 << 7)
#define MISC_ENB_CMP (1 << 8)
#define MISC_32B (1 << 9)
#define MISC_DC (1 << 11)
#define MISC_INDEX_E (0xe << 12)
#define S3_SAVAGE4_SLOTS 0x0001ffff
#define S3_SAVAGE4_2DI 0x00800000
@ -393,8 +336,7 @@ typedef volatile struct _s3 {
}
#define _s3WaitEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS, 0)
#define _s3WaitIdleEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS|S3_SAVAGE4_2DI, \
S3_SAVAGE4_2DI)
#define _s3WaitIdleEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS|S3_SAVAGE4_2DI, S3_SAVAGE4_2DI)
#define _s3WaitIdle(s3) _s3WaitLoop(s3,S3_SAVAGE4_2DI, S3_SAVAGE4_2DI)
typedef struct _s3Cursor {
@ -457,8 +399,22 @@ typedef struct _s3Save {
CARD32 bg;
CARD32 global_bitmap_1;
CARD32 global_bitmap_2;
CARD32 adv_func_cntl;
CARD32 primary_bitmap_1;
CARD32 primary_bitmap_2;
CARD32 secondary_bitmap_1;
CARD32 secondary_bitmap_2;
CARD32 primary_stream_control;
CARD32 blend_control;
CARD32 primary_stream_addr_0;
CARD32 primary_stream_addr_1;
CARD32 primary_stream_stride;
CARD32 primary_stream_xy;
CARD32 primary_stream_size;
CARD32 primary_stream_mem;
CARD32 secondary_stream_xy;
CARD32 secondary_stream_size;
CARD32 streams_fifo;
CARD8 text_save[S3_TEXT_SAVE];
} S3Save;
@ -473,18 +429,29 @@ typedef struct _s3CardInfo {
Bool bios_initialized; /* whether the bios has been run */
} S3CardInfo;
typedef struct _s3ScreenInfo {
CARD8 *cursor_base; /* pointer to cursor area */
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 */
S3Cursor cursor;
S3Patterns patterns;
CARD32 bitmap_offset;
int accel_stride;
int accel_bpp;
} S3FBInfo;
typedef struct _s3ScreenInfo {
CARD8 *cursor_base; /* pointer to cursor area */
S3Cursor cursor;
Bool manage_border;
Bool managing_border;
Bool use_streams;
int primary_depth;
int current_ma;
CARD32 border_pixel;
S3FBInfo fb[KD_MAX_FB];
int fbmap[KD_MAX_FB+1]; /* map from fb to stream */
} S3ScreenInfo;
#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver))
@ -505,18 +472,21 @@ void s3CursorDisable (ScreenPtr pScreen);
void s3CursorFini (ScreenPtr pScreen);
void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
void s3DumbPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
void s3DumbCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
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 ndef, xColorItem *pdefs);
void s3PutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
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);
void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco);
extern KdCardFuncs s3Funcs;
@ -539,6 +509,13 @@ extern KdCardFuncs s3Funcs;
_loop_count = 0; \
while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \
}
#define _s3WaitVRetraceFast(s3) { \
int _loop_count; \
_loop_count = 0; \
while (s3->input_status_1 & 8) S3_RETRACE_LOOP_CHECK; \
_loop_count = 0; \
while ((s3->input_status_1 & 8) == 0) S3_RETRACE_LOOP_CHECK; \
}
/*
* Wait for the begining of the retrace interval
*/

View File

@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3clock.c,v 1.2 1999/12/30 03:03:11 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3clock.c,v 1.3 2000/02/23 20:30:02 dawes Exp $ */
#include "s3.h"
@ -41,11 +41,9 @@
*/
/* all in kHz */
#define MIN_VCO 135000.0
#define MAX_VCO 270000.0
void
s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR)
s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco)
{
int M, N, R, bestM, bestN;
int f_vco, f_out;
@ -57,15 +55,15 @@ s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR)
for (R = 0; R <= maxR; R++)
{
f_vco = target * (1 << R);
if (f_vco >= MIN_VCO)
if (f_vco >= minVco)
break;
}
/* M = f_out / f_ref * ((N + 2) * (1 << R)); */
besterr = target;
for (N = 0; N <= maxN; N++)
for (N = 1; N <= maxN; N++)
{
M = (target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) / S3_CLOCK_REF - 2;
M = ((target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) + S3_CLOCK_REF/2) / S3_CLOCK_REF - 2;
if (0 <= M && M <= maxM)
{
f_out = S3_CLOCK(M,N,R);

View File

@ -22,12 +22,12 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.2 1999/12/30 03:03:11 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.3 2000/02/23 20:30:02 dawes Exp $ */
#include "s3.h"
void
s3GetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
s3CardInfo(pScreenPriv);
@ -44,7 +44,7 @@ s3GetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
}
void
s3PutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
s3CardInfo(pScreenPriv);
@ -53,7 +53,12 @@ s3PutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
Bool hit_border = FALSE;
Bool check_border = FALSE;
#if 0
_s3WaitVRetrace (s3vga);
#else
S3Ptr s3 = s3c->s3;
_s3WaitVRetraceFast(s3);
#endif
if (pScreenPriv->enabled && s3s->manage_border && !s3s->managing_border)
check_border = TRUE;
while (ndef--)
@ -77,10 +82,10 @@ s3PutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
black.green = 0;
black.blue = 0;
s3s->managing_border = TRUE;
FakeAllocColor (pScreenPriv->pInstalledmap,
FakeAllocColor (pScreenPriv->pInstalledmap[fb],
&black);
s3s->border_pixel = black.pixel;
FakeFreeColor (pScreenPriv->pInstalledmap, s3s->border_pixel);
FakeFreeColor (pScreenPriv->pInstalledmap[fb], s3s->border_pixel);
/* s3SetImm (&s3c->s3vga, s3_border_color, (VGA8) s3s->border_pixel); */
}
}

View File

@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3curs.c,v 1.2 1999/12/30 03:03:11 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3curs.c,v 1.3 2000/02/23 20:30:03 dawes Exp $ */
#include "s3.h"
#include "s3draw.h"
@ -90,24 +90,42 @@ s3MoveCursor (ScreenPtr pScreen, int x, int y)
_s3MoveCursor (pScreen, x, y);
}
#define S3Trunc(c) (((c) >> 8) & 0xff)
#define S3CursColor(r,g,b) ((S3Trunc(r) << 16) | \
(S3Trunc(g) << 8) | \
(S3Trunc(b)))
static void
s3AllocCursorColors (ScreenPtr pScreen)
{
SetupCursor (pScreen);
CursorPtr pCursor = pCurPriv->pCursor;
KdAllocateCursorPixels (pScreen, pCursor,
&pCurPriv->source, &pCurPriv->mask);
switch (pScreenPriv->screen->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;
if (s3s->use_streams)
{
pCurPriv->source = S3CursColor(pCursor->foreRed,
pCursor->foreGreen,
pCursor->foreBlue);
pCurPriv->mask = S3CursColor(pCursor->backRed,
pCursor->backGreen,
pCursor->backBlue);
}
else
{
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;
}
}
}
@ -221,6 +239,13 @@ s3LoadCursor (ScreenPtr pScreen, int x, int y)
S3AdjustBits32(and);
S3AdjustBits32(xor);
#define S3SwapNibbles(x) ((x) = (((x) & 0x0f0f0f0f) << 4 | \
((x) >> 4) & 0x0f0f0f0f))
if (s3s->use_streams)
{
S3SwapNibbles(and);
S3SwapNibbles(xor);
}
*ram++ = (and & 0xffff) | (xor << 16);
*ram++ = (and >> 16) | (xor & 0xffff0000);
}

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.2 1999/12/30 03:03:12 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.3 2000/02/23 20:30:04 dawes Exp $ */
#ifndef _S3DRAW_H_
#define _S3DRAW_H_
@ -41,6 +41,7 @@ typedef struct _s3Pattern {
typedef struct _s3PrivGC {
int type; /* type of drawable validated against */
int ma; /* stream descriptor */
s3PatternPtr pPattern; /* pattern */
} s3PrivGCRec, *s3PrivGCPtr;
@ -55,8 +56,7 @@ typedef struct _s3PrivGC {
#define s3SetWindowPrivate(w,p) (\
(w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p)
void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern);
void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern);
#define SetupS3(s) KdScreenPriv(s); \
s3CardInfo(pScreenPriv); \
@ -82,6 +82,18 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern);
#define WIDEN(x) ((unsigned long) (x))
#define MERGE(a,b) ((WIDEN(a) << 16) | WIDEN(b))
#define s3BitmapDescriptor(_stream) ((_stream) + 1)
#ifdef S3_TRIO
#define s3DrawMap(pDraw) 0
#define s3SetGlobalBitmap(s,d)
#else
#define s3DrawMap(pDraw) ((pDraw)->depth == \
getS3ScreenInfo(pScreenPriv)->primary_depth ? 0 : 1)
#endif
#define s3GCMap(pGC) (s3GetGCPrivate(pGC)->ma)
/*
* Ok, so the S3 is broken -- it expects bitmaps to come MSB bit order,
* but it's willing to take them in LSB byte order. These macros

View File

@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3reg.c,v 1.2 1999/12/30 03:03:12 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3reg.c,v 1.3 2000/02/23 20:30:04 dawes Exp $ */
#include "s3reg.h"
@ -403,6 +403,11 @@ VgaReg s3_line_compare[] = {
VGA_REG_END
};
VgaReg s3_delay_primary_load[] = {
CR21, 1, 1,
VGA_REG_END
};
VgaReg s3_device_id[] = {
CR2E, 0, 8,
CR2D, 0, 8,
@ -654,16 +659,36 @@ VgaReg s3_pci_disconnect_enable[] = {
VGA_REG_END
};
VgaReg s3_primary_load_control[] = {
CR66, 4, 1,
VGA_REG_END
};
VgaReg s3_secondary_load_control[] = {
CR66, 5, 1,
VGA_REG_END
};
VgaReg s3_pci_retry_enable[] = {
CR66, 7, 1,
VGA_REG_END
};
VgaReg s3_streams_mode[] = {
CR67, 2, 2,
VGA_REG_END
};
VgaReg s3_color_mode[] = {
CR67, 4, 4,
VGA_REG_END
};
VgaReg s3_primary_stream_definition[] = {
CR69, 7, 1,
VGA_REG_END
};
VgaReg s3_primary_stream_timeout[] = {
CR71, 0, 8,
VGA_REG_END
@ -714,6 +739,26 @@ VgaReg s3_dac_power_saving_disable[] = {
VGA_REG_END
};
VgaReg s3_flat_panel_output_control_1[] = {
CR90, 3, 1,
VGA_REG_END
};
VgaReg s3_streams_fifo_delay[] = {
CR90, 4, 2,
VGA_REG_END
};
VgaReg s3_flat_panel_output_control_2[] = {
CR90, 6, 1,
VGA_REG_END
};
VgaReg s3_enable_l1_parameter[] = {
CR90, 7, 1,
VGA_REG_END
};
VgaReg s3_primary_stream_l1[] = {
CR91, 0, 8,
CR90, 0, 3,
@ -975,6 +1020,21 @@ VgaReg s3_dclk_control[] = {
VGA_REG_END
};
VgaReg s3_eclk_n[] = {
SR32, 0, 5,
VGA_REG_END
};
VgaReg s3_eclk_r[] = {
SR32, 5, 2,
VGA_REG_END
};
VgaReg s3_eclk_m[] = {
SR32, 0, 5,
VGA_REG_END
};
VgaReg s3_vga_dclk_n[] = {
SR36, 0, 6,
SR39, 4, 1,

View File

@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3reg.h,v 1.2 1999/12/30 03:03:12 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3reg.h,v 1.3 2000/02/23 20:30:05 dawes Exp $ */
#ifndef _S3REG_H_
#define _S3REG_H_
@ -74,6 +74,7 @@ extern VgaReg s3_word_mode[];
extern VgaReg s3_byte_mode[];
extern VgaReg s3_hardware_reset[];
extern VgaReg s3_line_compare[];
extern VgaReg s3_delay_primary_load[];
extern VgaReg s3_device_id[];
extern VgaReg s3_revision[];
extern VgaReg s3_enable_vga_16bit[];
@ -123,8 +124,12 @@ extern VgaReg s3_delay_blank[];
extern VgaReg s3_delay_h_enable[];
extern VgaReg s3_enable_2d_3d[];
extern VgaReg s3_pci_disconnect_enable[];
extern VgaReg s3_primary_load_control[];
extern VgaReg s3_secondary_load_control[];
extern VgaReg s3_pci_retry_enable[];
extern VgaReg s3_streams_mode[];
extern VgaReg s3_color_mode[];
extern VgaReg s3_primary_stream_definition[];
extern VgaReg s3_primary_stream_timeout[];
extern VgaReg s3_master_control_unit_timeout[];
extern VgaReg s3_command_buffer_timeout[];
@ -135,6 +140,10 @@ extern VgaReg s3_fifo_drain_delay[];
extern VgaReg s3_fifo_fetch_timing[];
extern VgaReg s3_dac_power_up_time[];
extern VgaReg s3_dac_power_saving_disable[];
extern VgaReg s3_flat_panel_output_control_1[];
extern VgaReg s3_streams_fifo_delay[];
extern VgaReg s3_flat_panel_output_control_2[];
extern VgaReg s3_enable_l1_parameter[];
extern VgaReg s3_primary_stream_l1[];
extern VgaReg s3_dot_clock_8[];
@ -165,6 +174,9 @@ extern VgaReg s3_dclk_double_15_16_invert[];
extern VgaReg s3_enable_gamma_correction[];
extern VgaReg s3_enable_8_bit_luts[];
extern VgaReg s3_dclk_control[];
extern VgaReg s3_eclk_n[];
extern VgaReg s3_eclk_r[];
extern VgaReg s3_eclk_m[];
extern VgaReg s3_vga_dclk_n[];
extern VgaReg s3_vga_dclk_r[];
extern VgaReg s3_vga_dclk_m1[];

View File

@ -253,30 +253,30 @@ sisScreenInit (KdScreenInfo *screen)
screen->height = 600;
screen->rate = 72;
}
if (!screen->depth)
screen->depth = 8;
if (!screen->fb[0].depth)
screen->fb[0].depth = 8;
for (;;)
{
if (screen->depth >= 24)
if (screen->fb[0].depth >= 24)
{
screen->depth = 24;
screen->bitsPerPixel = 24;
screen->fb[0].depth = 24;
screen->fb[0].bitsPerPixel = 24;
}
else if (screen->depth >= 16)
else if (screen->fb[0].depth >= 16)
{
screen->depth = 16;
screen->bitsPerPixel = 16;
screen->fb[0].depth = 16;
screen->fb[0].bitsPerPixel = 16;
}
else if (screen->depth >= 15)
else if (screen->fb[0].depth >= 15)
{
screen->depth = 15;
screen->bitsPerPixel = 16;
screen->fb[0].depth = 15;
screen->fb[0].bitsPerPixel = 16;
}
else
{
screen->depth = 8;
screen->bitsPerPixel = 8;
screen->fb[0].depth = 8;
screen->fb[0].bitsPerPixel = 8;
}
/* Normalize width to supported values */
@ -294,10 +294,10 @@ sisScreenInit (KdScreenInfo *screen)
else
screen->width = 640;
byte_width = screen->width * (screen->bitsPerPixel >> 3);
byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
pixel_width = screen->width;
screen->pixelStride = pixel_width;
screen->byteStride = byte_width;
screen->fb[0].pixelStride = pixel_width;
screen->fb[0].byteStride = byte_width;
screen_size = byte_width * screen->height;
@ -307,10 +307,10 @@ sisScreenInit (KdScreenInfo *screen)
/*
* Fix requested depth and geometry until it works
*/
if (screen->depth > 16)
screen->depth = 16;
else if (screen->depth > 8)
screen->depth = 8;
if (screen->fb[0].depth > 16)
screen->fb[0].depth = 16;
else if (screen->fb[0].depth > 8)
screen->fb[0].depth = 8;
else if (screen->width > 1152)
{
screen->width = 1152;
@ -346,30 +346,30 @@ sisScreenInit (KdScreenInfo *screen)
/*
* Take requested geometry and adjust to fit possible geometries
*/
switch (screen->depth) {
switch (screen->fb[0].depth) {
case 4:
screen->bitsPerPixel = 4;
screen->fb[0].bitsPerPixel = 4;
break;
case 8:
screen->bitsPerPixel = 8;
screen->fb[0].bitsPerPixel = 8;
break;
case 15:
case 16:
screen->bitsPerPixel = 16;
screen->fb[0].bitsPerPixel = 16;
break;
case 24:
case 32:
screen->bitsPerPixel = 24;
screen->fb[0].bitsPerPixel = 24;
screen->dumb = TRUE;
break;
}
screen->byteStride = screen->width * (screen->bitsPerPixel >> 3);
screen->pixelStride = screen->width;
screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >> 3);
screen->fb[0].pixelStride = screen->width;
memory = sisc->memory - screen_size;
screen->frameBuffer = sisc->frameBuffer;
screen->fb[0].frameBuffer = sisc->frameBuffer;
/*
* Cursor lives in the last 16k of memory
@ -389,7 +389,7 @@ sisScreenInit (KdScreenInfo *screen)
if (memory > 8192)
{
siss->expand = screen->frameBuffer + screen_size;
siss->expand = screen->fb[0].frameBuffer + screen_size;
siss->expand_off = siss->expand - sisc->frameBuffer;
siss->expand_len = memory;
memory = 0;
@ -400,35 +400,35 @@ sisScreenInit (KdScreenInfo *screen)
siss->expand_len = 0;
}
switch (screen->depth) {
switch (screen->fb[0].depth) {
case 8:
screen->visuals = ((1 << StaticGray) |
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
screen->blueMask = 0x00;
screen->greenMask = 0x00;
screen->redMask = 0x00;
screen->fb[0].blueMask = 0x00;
screen->fb[0].greenMask = 0x00;
screen->fb[0].redMask = 0x00;
break;
case 15:
screen->visuals = (1 << TrueColor);
screen->blueMask = 0x001f;
screen->greenMask = 0x03e0;
screen->redMask = 0x7c00;
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->visuals = (1 << TrueColor);
screen->blueMask = 0x001f;
screen->greenMask = 0x07e0;
screen->redMask = 0xf800;
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->visuals = (1 << TrueColor);
screen->blueMask = 0x0000ff;
screen->greenMask = 0x00ff00;
screen->redMask = 0xff0000;
screen->fb[0].visuals = (1 << TrueColor);
screen->fb[0].blueMask = 0x0000ff;
screen->fb[0].greenMask = 0x00ff00;
screen->fb[0].redMask = 0xff0000;
break;
}
@ -752,7 +752,7 @@ sisEnable (ScreenPtr pScreen)
pixel = (hactive + hblank) * (vactive + vblank) * t->rate;
switch (screen->bitsPerPixel) {
switch (screen->fb[0].bitsPerPixel) {
case 8:
hactive /= 8;
hblank /= 8;
@ -775,7 +775,7 @@ sisEnable (ScreenPtr pScreen)
crtc.color_mode_256 = 0;
if (screen->depth == 15)
if (screen->fb[0].depth == 15)
crtc.graphics_mode_32k = 1;
else
crtc.graphics_mode_64k = 1;
@ -826,7 +826,7 @@ sisEnable (ScreenPtr pScreen)
crtc.high_speed_dac_0 = crtc.high_speed_dac_1 = pixel > 135000000;
sisEngThresh (&crtc, pixel, screen->bitsPerPixel);
sisEngThresh (&crtc, pixel, screen->fb[0].bitsPerPixel);
/*
* Compute horizontal register values from timings

View File

@ -1102,8 +1102,8 @@ void sisDrawSync (ScreenPtr pScreen);
void sisDrawDisable (ScreenPtr pScreen);
void sisDrawFini (ScreenPtr pScreen);
void sisGetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
void sisPutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
void sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
void sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
void SISInitCard (KdCardAttr *attr);

View File

@ -26,7 +26,7 @@
#include "sis.h"
void
sisGetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
sisCardInfo(pScreenPriv);
@ -44,7 +44,7 @@ sisGetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
}
void
sisPutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
sisCardInfo(pScreenPriv);

View File

@ -1636,8 +1636,8 @@ sisDrawEnable (ScreenPtr pScreen)
CARD32 base;
CARD16 stride;
base = pScreenPriv->screen->frameBuffer - sisc->frameBuffer;
stride = pScreenPriv->screen->byteStride;
base = pScreenPriv->screen->fb[0].frameBuffer - sisc->frameBuffer;
stride = pScreenPriv->screen->fb[0].byteStride;
sis->u.general.dst_base = base;
sis->u.general.dst_pitch = stride;
sis->u.general.dst_height = pScreenPriv->screen->height;

View File

@ -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/kcmap.c,v 1.1 1999/11/19 13:53:48 hohndel Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/kcmap.c,v 1.2 2000/02/23 20:29:52 dawes Exp $ */
#include "kdrive.h"
@ -30,10 +30,10 @@
*/
void
KdSetColormap (ScreenPtr pScreen)
KdSetColormap (ScreenPtr pScreen, int fb)
{
KdScreenPriv(pScreen);
ColormapPtr pCmap = pScreenPriv->pInstalledmap;
ColormapPtr pCmap = pScreenPriv->pInstalledmap[fb];
Pixel pixels[KD_MAX_PSEUDO_SIZE];
xrgb colors[KD_MAX_PSEUDO_SIZE];
xColorItem defs[KD_MAX_PSEUDO_SIZE];
@ -41,7 +41,7 @@ KdSetColormap (ScreenPtr pScreen)
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->depth > KD_MAX_PSEUDO_DEPTH)
if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
return;
if (!pScreenPriv->enabled)
@ -55,12 +55,12 @@ KdSetColormap (ScreenPtr pScreen)
* true/direct as well as pseudo/static visuals
*/
for (i = 0; i < (1 << pScreenPriv->screen->depth); i++)
for (i = 0; i < (1 << pScreenPriv->screen->fb[i].depth); i++)
pixels[i] = i;
QueryColors (pCmap, (1 << pScreenPriv->screen->depth), pixels, colors);
QueryColors (pCmap, (1 << pScreenPriv->screen->fb[i].depth), pixels, colors);
for (i = 0; i < (1 << pScreenPriv->screen->depth); i++)
for (i = 0; i < (1 << pScreenPriv->screen->fb[i].depth); i++)
{
defs[i].pixel = i;
defs[i].red = colors[i].red;
@ -69,9 +69,9 @@ KdSetColormap (ScreenPtr pScreen)
defs[i].flags = DoRed|DoGreen|DoBlue;
}
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
(1 << pScreenPriv->screen->depth),
defs);
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
(1 << pScreenPriv->screen->fb[i].depth),
defs);
/* recolor hardware cursor */
if (pScreenPriv->card->cfuncs->recolorCursor)
@ -87,33 +87,78 @@ KdEnableColormap (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
int i;
int fb;
Bool done = FALSE;
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->depth <= KD_MAX_PSEUDO_DEPTH)
for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
{
for (i = 0; i < (1 << pScreenPriv->screen->depth); i++)
pScreenPriv->systemPalette[i].pixel = i;
(*pScreenPriv->card->cfuncs->getColors) (pScreen,
(1 << pScreenPriv->screen->depth),
pScreenPriv->systemPalette);
if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
{
for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
pScreenPriv->systemPalette[i].pixel = i;
(*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
(1 << pScreenPriv->screen->fb[fb].depth),
pScreenPriv->systemPalette);
done = TRUE;
}
KdSetColormap (pScreen, fb);
}
KdSetColormap (pScreen);
}
void
KdDisableColormap (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
int fb;
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->depth > KD_MAX_PSEUDO_DEPTH)
return;
(*pScreenPriv->card->cfuncs->putColors) (pScreen,
(1 << pScreenPriv->screen->depth),
pScreenPriv->systemPalette);
for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
{
if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
{
(*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
(1 << pScreenPriv->screen->fb[fb].depth),
pScreenPriv->systemPalette);
break;
}
}
}
int
KdColormapFb (ColormapPtr pCmap)
{
ScreenPtr pScreen = pCmap->pScreen;
KdScreenPriv (pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
int d;
DepthPtr depth;
int v, vi;
VisualPtr visual;
VisualID vid = pCmap->pVisual->vid;
int fb;
if (screen->fb[1].depth)
{
for (d = 0; d < pScreen->numDepths; d++)
{
depth = &pScreen->allowedDepths[d];
for (v = 0; v < depth->numVids; v++)
{
if (depth->vids[v] == vid)
{
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
{
if (depth->depth == screen->fb[fb].depth)
return fb;
}
}
}
}
}
return 0;
}
/*
@ -129,19 +174,20 @@ void
KdInstallColormap (ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
int fb = KdColormapFb (pCmap);
if (pCmap == pScreenPriv->pInstalledmap)
if (pCmap == pScreenPriv->pInstalledmap[fb])
return;
/* Tell X clients that the installed colormap is going away. */
if (pScreenPriv->pInstalledmap)
WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
(pointer) &(pScreenPriv->pInstalledmap->mid));
if (pScreenPriv->pInstalledmap[fb])
WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
(pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
/* Take note of the new installed colorscreen-> */
pScreenPriv->pInstalledmap = pCmap;
pScreenPriv->pInstalledmap[fb] = pCmap;
KdSetColormap (pCmap->pScreen);
KdSetColormap (pCmap->pScreen, fb);
/* Tell X clients of the new colorscreen-> */
WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
@ -157,8 +203,9 @@ void
KdUninstallColormap (ColormapPtr pCmap)
{
KdScreenPriv(pCmap->pScreen);
int fb = KdColormapFb (pCmap);
if (pCmap == pScreenPriv->pInstalledmap)
if (pCmap == pScreenPriv->pInstalledmap[0])
{
Colormap defMapID = pCmap->pScreen->defColormap;
@ -176,13 +223,18 @@ int
KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
{
KdScreenPriv(pScreen);
int fb;
int n = 0;
if (pScreenPriv->pInstalledmap)
for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
{
*pCmaps = pScreenPriv->pInstalledmap->mid;
return 1;
if (pScreenPriv->pInstalledmap[fb])
{
*pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
n++;
}
}
return 0;
return n;
}
/*
@ -198,14 +250,15 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
KdScreenPriv(pCmap->pScreen);
VisualPtr pVisual;
xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
int fb = KdColormapFb (pCmap);
if (pCmap != pScreenPriv->pInstalledmap)
if (pCmap != pScreenPriv->pInstalledmap[fb])
return;
if (!pScreenPriv->card->cfuncs->putColors)
return;
if (pScreenPriv->screen->depth > KD_MAX_PSEUDO_DEPTH)
if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
return;
if (!pScreenPriv->enabled)
@ -223,7 +276,7 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
pdefs = expanddefs;
}
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
/* recolor hardware cursor */
if (pScreenPriv->card->cfuncs->recolorCursor)

View File

@ -45,6 +45,7 @@ KdComputeCmapShift (unsigned long mask)
void
KdAllocateCursorPixels (ScreenPtr pScreen,
int fb,
CursorPtr pCursor,
Pixel *source,
Pixel *mask)
@ -53,18 +54,18 @@ KdAllocateCursorPixels (ScreenPtr pScreen,
int r, g, b;
KdScreenPriv(pScreen);
if (pScreenPriv->screen->redMask)
if (pScreenPriv->screen->fb[fb].redMask)
{
r = KdComputeCmapShift (pScreenPriv->screen->redMask);
g = KdComputeCmapShift (pScreenPriv->screen->greenMask);
b = KdComputeCmapShift (pScreenPriv->screen->blueMask);
*source = ((Shift(pCursor->foreRed,r) & pScreenPriv->screen->redMask) |
(Shift(pCursor->foreGreen,g) & pScreenPriv->screen->greenMask) |
(Shift(pCursor->foreBlue,b) & pScreenPriv->screen->blueMask));
*mask = ((Shift(pCursor->backRed,r) & pScreenPriv->screen->redMask) |
(Shift(pCursor->backGreen,g) & pScreenPriv->screen->greenMask) |
(Shift(pCursor->backBlue,b) & pScreenPriv->screen->blueMask));
r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
*source = ((Shift(pCursor->foreRed,r) & pScreenPriv->screen->fb[fb].redMask) |
(Shift(pCursor->foreGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
(Shift(pCursor->foreBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
*mask = ((Shift(pCursor->backRed,r) & pScreenPriv->screen->fb[fb].redMask) |
(Shift(pCursor->backGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
(Shift(pCursor->backBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
}
else
{
@ -79,13 +80,13 @@ KdAllocateCursorPixels (ScreenPtr pScreen,
sourceColor.red = pCursor->foreRed;
sourceColor.green = pCursor->foreGreen;
sourceColor.blue = pCursor->foreBlue;
FakeAllocColor(pScreenPriv->pInstalledmap, &sourceColor);
FakeAllocColor(pScreenPriv->pInstalledmap[fb], &sourceColor);
maskColor.red = pCursor->backRed;
maskColor.green = pCursor->backGreen;
maskColor.blue = pCursor->backBlue;
FakeAllocColor(pScreenPriv->pInstalledmap, &maskColor);
FakeFreeColor(pScreenPriv->pInstalledmap, sourceColor.pixel);
FakeFreeColor(pScreenPriv->pInstalledmap, maskColor.pixel);
FakeAllocColor(pScreenPriv->pInstalledmap[fb], &maskColor);
FakeFreeColor(pScreenPriv->pInstalledmap[fb], sourceColor.pixel);
FakeFreeColor(pScreenPriv->pInstalledmap[fb], maskColor.pixel);
*source = sourceColor.pixel;
*mask = maskColor.pixel;
}

View File

@ -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/kdrive.c,v 1.2 1999/12/30 03:03:05 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.3 2000/02/23 20:29:53 dawes Exp $ */
#include "kdrive.h"
#ifdef PSEUDO8
@ -301,10 +301,14 @@ void
KdParseScreen (KdScreenInfo *screen,
char *arg)
{
char *bpp;
int fb;
screen->width = 0;
screen->height = 0;
screen->depth = 0;
screen->rate = 0;
for (fb = 0; fb < KD_MAX_FB; fb++)
screen->fb[fb].depth = 0;
if (!arg)
return;
@ -320,7 +324,27 @@ KdParseScreen (KdScreenInfo *screen,
return;
arg++;
screen->depth = atoi(arg);
fb = 0;
while (fb < KD_MAX_FB)
{
screen->fb[fb].depth = atoi(arg);
bpp = strchr (arg, '/');
if (bpp)
{
bpp++;
screen->fb[fb].bitsPerPixel = atoi(bpp);
arg = bpp;
}
else
screen->fb[fb].bitsPerPixel = 0;
bpp = strchr (arg, ',');
if (!bpp)
break;
arg = bpp+1;
fb++;
}
arg = strchr (arg, 'x');
if (!arg)
return;
@ -551,7 +575,7 @@ KdCreateWindow (WindowPtr pWin)
}
}
#endif
return TRUE;
return fbCreateWindow (pWin);
}
/* Pass through AddScreen, which doesn't take any closure */
@ -563,6 +587,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
KdScreenInfo *screen = kdCurrentScreen;
KdCardInfo *card = screen->card;
KdPrivScreenPtr pScreenPriv;
int fb;
KdAllocatePrivates (pScreen);
@ -571,7 +596,8 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
screen->pScreen = pScreen;
pScreenPriv->screen = screen;
pScreenPriv->card = card;
pScreenPriv->bytesPerPixel = screen->bitsPerPixel >> 3;
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
/*
@ -580,11 +606,11 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
* backing store
*/
if (!fbSetupScreen (pScreen,
screen->frameBuffer,
screen->fb[0].frameBuffer,
screen->width, screen->height,
screen->dpix, screen->dpiy,
screen->pixelStride,
screen->bitsPerPixel))
screen->fb[0].pixelStride,
screen->fb[0].bitsPerPixel))
{
return FALSE;
}
@ -608,14 +634,34 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreenPriv->BackingStoreFuncs.GetSpansPixmap = 0;
#endif
if (!fbFinishScreenInit (pScreen,
screen->frameBuffer,
screen->width, screen->height,
screen->dpix, screen->dpiy,
screen->pixelStride,
screen->bitsPerPixel))
if (screen->fb[1].depth)
{
return FALSE;
if (!fbOverlayFinishScreenInit (pScreen,
screen->fb[0].frameBuffer,
screen->fb[1].frameBuffer,
screen->width, screen->height,
screen->dpix, screen->dpiy,
screen->fb[0].pixelStride,
screen->fb[1].pixelStride,
screen->fb[0].bitsPerPixel,
screen->fb[1].bitsPerPixel,
screen->fb[0].depth,
screen->fb[1].depth))
{
return FALSE;
}
}
else
{
if (!fbFinishScreenInit (pScreen,
screen->fb[0].frameBuffer,
screen->width, screen->height,
screen->dpix, screen->dpiy,
screen->fb[0].pixelStride,
screen->fb[0].bitsPerPixel))
{
return FALSE;
}
}
/*
@ -720,6 +766,8 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo)
KdCardInfo *card;
KdScreenInfo *screen;
int i;
int bpp;
int fb;
PixmapFormatRec *format;
for (i = 1; i <= 32; i++)
@ -735,10 +783,16 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo)
{
for (screen = card->screenList; screen; screen = screen->next)
{
if (!depthToBpp[screen->depth])
depthToBpp[screen->depth] = screen->bitsPerPixel;
else if (depthToBpp[screen->depth] != screen->bitsPerPixel)
return FALSE;
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
{
bpp = screen->fb[fb].bitsPerPixel;
if (bpp == 24)
bpp = 32;
if (!depthToBpp[screen->fb[fb].depth])
depthToBpp[screen->fb[fb].depth] = bpp;
else if (depthToBpp[screen->fb[fb].depth] != bpp)
return FALSE;
}
}
}
@ -784,18 +838,20 @@ KdAddScreen (ScreenInfo *pScreenInfo,
{
unsigned long visuals;
Pixel rm, gm, bm;
int fb;
if (pScreenInfo->formats[i].depth == screen->depth)
visuals = 0;
rm = gm = bm = 0;
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
{
visuals = screen->visuals;
rm = screen->redMask;
gm = screen->greenMask;
bm = screen->blueMask;
}
else
{
visuals = 0;
rm = gm = bm = 0;
if (pScreenInfo->formats[i].depth == screen->fb[fb].depth)
{
visuals = screen->fb[fb].visuals;
rm = screen->fb[fb].redMask;
gm = screen->fb[fb].greenMask;
bm = screen->fb[fb].blueMask;
break;
}
}
fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
visuals,
@ -808,6 +864,17 @@ KdAddScreen (ScreenInfo *pScreenInfo,
AddScreen (KdScreenInit, argc, argv);
}
int
KdDepthToFb (ScreenPtr pScreen, int depth)
{
KdScreenPriv(pScreen);
int fb;
for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb[fb].frameBuffer; fb++)
if (pScreenPriv->screen->fb[fb].depth == depth)
return fb;
}
void
KdInitOutput (ScreenInfo *pScreenInfo,
int argc,

View File

@ -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/kdrive.h,v 1.3 2000/01/21 01:12:01 dawes Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.4 2000/02/23 20:29:53 dawes Exp $ */
#include <stdio.h>
#include "X.h"
@ -40,6 +40,7 @@
#include "mi.h"
#include "dix.h"
#include "fb.h"
#include "fboverlay.h"
extern WindowPtr *WindowTable;
@ -49,10 +50,18 @@ extern WindowPtr *WindowTable;
#define KD_DPMS_POWERDOWN 3
#define KD_DPMS_MAX KD_DPMS_POWERDOWN
#ifndef KD_MAX_FB
#define KD_MAX_FB 2
#endif
#ifndef KD_MAX_CARD_ADDRESS
#define KD_MAX_CARD_ADDRESS 8
#endif
/*
* Configuration information per video card
*/
#define KD_MAX_CARD_ADDRESS 8
typedef struct _KdCardAttr {
CARD32 io;
CARD32 address[KD_MAX_CARD_ADDRESS];
@ -75,25 +84,30 @@ extern KdCardInfo *kdCardInfo;
/*
* Configuration information per X screen
*/
typedef struct _KdFrameBuffer {
CARD8 *frameBuffer;
int depth;
int bitsPerPixel;
int pixelStride;
int byteStride;
unsigned long visuals;
Pixel redMask, greenMask, blueMask;
void *closure;
} KdFrameBuffer;
typedef struct _KdScreenInfo {
struct _KdScreenInfo *next;
KdCardInfo *card;
ScreenPtr pScreen;
void *driver;
CARD8 *frameBuffer;
int width;
int height;
int depth;
int rate;
int bitsPerPixel;
int pixelStride;
int byteStride;
int dpix, dpiy;
unsigned long visuals;
Pixel redMask, greenMask, blueMask;
Bool dumb;
Bool softCursor;
int mynum;
KdFrameBuffer fb[KD_MAX_FB];
} KdScreenInfo;
typedef struct _KdCardFuncs {
@ -120,8 +134,8 @@ typedef struct _KdCardFuncs {
void (*disableAccel) (ScreenPtr);
void (*finiAccel) (ScreenPtr);
void (*getColors) (ScreenPtr, int, xColorItem *);
void (*putColors) (ScreenPtr, int, xColorItem *);
void (*getColors) (ScreenPtr, int, int, xColorItem *);
void (*putColors) (ScreenPtr, int, int, xColorItem *);
} KdCardFuncs;
#define KD_MAX_PSEUDO_DEPTH 8
@ -133,11 +147,11 @@ typedef struct {
Bool enabled;
Bool closed;
int bytesPerPixel;
int bytesPerPixel[KD_MAX_FB];
int dpmsState;
ColormapPtr pInstalledmap; /* current colormap */
ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
CloseScreenProcPtr CloseScreen;
@ -341,7 +355,7 @@ extern GCOps kdNoopOps;
/* kcmap.c */
void
KdSetColormap (ScreenPtr pScreen);
KdSetColormap (ScreenPtr pScreen, int fb);
void
KdEnableColormap (ScreenPtr pScreen);
@ -364,6 +378,7 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
/* kcurscol.c */
void
KdAllocateCursorPixels (ScreenPtr pScreen,
int fb,
CursorPtr pCursor,
Pixel *source,
Pixel *mask);

View File

@ -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/kinput.c,v 1.2 1999/12/30 03:03:06 robin Exp $ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.3 2000/02/23 20:29:54 dawes Exp $ */
#include "kdrive.h"
#include "inputstr.h"
@ -137,6 +137,9 @@ KdAddFd (int fd)
memset (&act, '\0', sizeof act);
act.sa_handler = KdSigio;
sigemptyset (&act.sa_mask);
sigaddset (&act.sa_mask, SIGIO);
sigaddset (&act.sa_mask, SIGALRM);
sigaddset (&act.sa_mask, SIGVTALRM);
sigaction (SIGIO, &act, 0);
sigemptyset (&set);
sigprocmask (SIG_SETMASK, &set, 0);

View File

@ -295,10 +295,12 @@ KdTuneMode (KdScreenInfo *screen,
/*
* Fix requested depth and geometry until it works
*/
if (screen->depth > 16)
screen->depth = 16;
else if (screen->depth > 8)
screen->depth = 8;
if (screen->fb[1].depth)
screen->fb[1].depth = 0;
else if (screen->fb[0].depth > 16)
screen->fb[0].depth = 16;
else if (screen->fb[0].depth > 8)
screen->fb[0].depth = 8;
else
{
t = kdFindPrevSize (KdFindMode (screen, supported));

View File

@ -74,7 +74,7 @@ tridentScreenInit (KdScreenInfo *screen)
}
if (!tridentc->cop)
screen->dumb = TRUE;
screen_size = screen->byteStride * screen->height;
screen_size = screen->fb[0].byteStride * screen->height;
memory = (2048 + 512) * 1024;
if (memory >= screen_size + 2048)
{

View File

@ -88,9 +88,9 @@ tridentAllocCursorColors (ScreenPtr pScreen)
SetupCursor (pScreen);
CursorPtr pCursor = pCurPriv->pCursor;
KdAllocateCursorPixels (pScreen, pCursor,
KdAllocateCursorPixels (pScreen, 0, pCursor,
&pCurPriv->source, &pCurPriv->mask);
switch (pScreenPriv->screen->bitsPerPixel) {
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
case 4:
pCurPriv->source |= pCurPriv->source << 4;
pCurPriv->mask |= pCurPriv->mask << 4;

View File

@ -812,8 +812,8 @@ tridentDrawEnable (ScreenPtr pScreen)
CARD32 alpha;
int tries;
stride = pScreenPriv->screen->pixelStride;
switch (pScreenPriv->screen->bitsPerPixel) {
stride = pScreenPriv->screen->fb[0].pixelStride;
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
case 8:
format = COP_DEPTH_8;
break;

View File

@ -445,31 +445,31 @@ s3ModeUsable (KdScreenInfo *screen)
int pixel_width;
int byte_width;
if (screen->depth >= 24)
if (screen->fb[0].depth >= 24)
{
screen->depth = 24;
screen->bitsPerPixel = 32;
screen->fb[0].depth = 24;
screen->fb[0].bitsPerPixel = 32;
}
else if (screen->depth >= 16)
else if (screen->fb[0].depth >= 16)
{
screen->depth = 16;
screen->bitsPerPixel = 16;
screen->fb[0].depth = 16;
screen->fb[0].bitsPerPixel = 16;
}
else if (screen->depth >= 15)
else if (screen->fb[0].depth >= 15)
{
screen->depth = 15;
screen->bitsPerPixel = 16;
screen->fb[0].depth = 15;
screen->fb[0].bitsPerPixel = 16;
}
else
{
screen->depth = 8;
screen->bitsPerPixel = 8;
screen->fb[0].depth = 8;
screen->fb[0].bitsPerPixel = 8;
}
byte_width = screen->width * (screen->bitsPerPixel >> 3);
byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
pixel_width = screen->width;
screen->pixelStride = pixel_width;
screen->byteStride = byte_width;
screen->fb[0].pixelStride = pixel_width;
screen->fb[0].byteStride = byte_width;
screen_size = byte_width * screen->height;
@ -505,8 +505,8 @@ s3ScreenInit (KdScreenInfo *screen)
screen->height = 600;
screen->rate = 72;
}
if (!screen->depth)
screen->depth = 8;
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));
@ -524,8 +524,8 @@ s3ScreenInit (KdScreenInfo *screen)
/*
* Can only operate in pixel-doubled mode at 8 bits per pixel
*/
if (screen->depth > 8 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK)
screen->depth = 8;
if (screen->fb[0].depth > 8 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK)
screen->fb[0].depth = 8;
if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported))
{
@ -538,7 +538,7 @@ s3ScreenInit (KdScreenInfo *screen)
/*
* Stick frame buffer at start of memory
*/
screen->frameBuffer = s3c->frameBuffer;
screen->fb[0].frameBuffer = s3c->frameBuffer;
/*
* Stick cursor at end of memory
@ -557,25 +557,25 @@ s3ScreenInit (KdScreenInfo *screen)
*/
if (memory >= byte_width * S3_TILE_SIZE)
{
s3s->offscreen = s3c->frameBuffer + screen_size;
s3s->offscreen_x = 0;
s3s->offscreen_y = screen_size / byte_width;
s3s->offscreen_width = pixel_width;
s3s->offscreen_height = memory / byte_width;
memory -= s3s->offscreen_height * byte_width;
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->offscreen = s3c->frameBuffer + screen->width;
s3s->offscreen_x = screen->width;
s3s->offscreen_y = 0;
s3s->offscreen_width = pixel_width - screen->width;
s3s->offscreen_height = screen->height;
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->offscreen = 0;
s3s->fb[0].offscreen = 0;
DRAW_DEBUG ((DEBUG_S3INIT, "depth %d bits %d", screen->depth, screen->bitsPerPixel));
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));
@ -585,35 +585,35 @@ s3ScreenInit (KdScreenInfo *screen)
s3s->offscreen_width, s3s->offscreen_height,
s3s->offscreen_x, s3s->offscreen_y));
switch (screen->depth) {
switch (screen->fb[0].depth) {
case 8:
screen->visuals = ((1 << StaticGray) |
screen->fb[0].visuals = ((1 << StaticGray) |
(1 << GrayScale) |
(1 << StaticColor) |
(1 << PseudoColor) |
(1 << TrueColor) |
(1 << DirectColor));
screen->blueMask = 0x00;
screen->greenMask = 0x00;
screen->redMask = 0x00;
screen->fb[0].blueMask = 0x00;
screen->fb[0].greenMask = 0x00;
screen->fb[0].redMask = 0x00;
break;
case 15:
screen->visuals = (1 << TrueColor);
screen->blueMask = 0x001f;
screen->greenMask = 0x03e0;
screen->redMask = 0x7c00;
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->visuals = (1 << TrueColor);
screen->blueMask = 0x001f;
screen->greenMask = 0x07e0;
screen->redMask = 0xf800;
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->visuals = (1 << TrueColor);
screen->blueMask = 0x0000ff;
screen->greenMask = 0x00ff00;
screen->redMask = 0xff0000;
screen->fb[0].visuals = (1 << TrueColor);
screen->fb[0].blueMask = 0x0000ff;
screen->fb[0].greenMask = 0x00ff00;
screen->fb[0].redMask = 0xff0000;
break;
}
@ -712,7 +712,7 @@ s3Enable (ScreenPtr pScreen)
/*
* Compute character lengths for horizontal timing values
*/
switch (screen->bitsPerPixel) {
switch (screen->fb[0].bitsPerPixel) {
case 8:
hactive = screen->width / 8;
hblank /= 8;
@ -830,7 +830,7 @@ s3Enable (ScreenPtr pScreen)
*/
if (!screen->softCursor)
{
cursor_address = (s3s->cursor_base - screen->frameBuffer) / 1024;
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;
@ -855,8 +855,8 @@ s3Enable (ScreenPtr pScreen)
/*
* Set depth values
*/
crtc->bits_per_pixel = screen->bitsPerPixel;
crtc->depth = screen->depth;
crtc->bits_per_pixel = screen->fb[0].bitsPerPixel;
crtc->depth = screen->fb[0].depth;
crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */

View File

@ -1097,15 +1097,22 @@ typedef struct _s3CardInfo {
Bool need_sync;
} S3CardInfo;
typedef struct _s3ScreenInfo {
CARD8 *cursor_base; /* pointer to cursor area */
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 */
S3Cursor cursor;
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)
@ -1135,8 +1142,8 @@ void s3DrawSync (ScreenPtr pScreen);
void s3DrawDisable (ScreenPtr pScreen);
void s3DrawFini (ScreenPtr pScreen);
void s3GetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
void s3PutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs);
void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs);
void S3InitCard (KdCardAttr *attr);

View File

@ -26,7 +26,7 @@
#include "s3.h"
void
s3GetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
s3CardInfo(pScreenPriv);
@ -47,7 +47,7 @@ s3GetColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
}
void
s3PutColors (ScreenPtr pScreen, int ndef, xColorItem *pdefs)
s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
s3CardInfo(pScreenPriv);

View File

@ -95,9 +95,9 @@ s3AllocCursorColors (ScreenPtr pScreen)
CursorPtr pCursor = pCurPriv->pCursor;
xColorItem sourceColor, maskColor;
KdAllocateCursorPixels (pScreen, pCursor,
KdAllocateCursorPixels (pScreen, 0, pCursor,
&pCurPriv->source, &pCurPriv->mask);
switch (pScreenPriv->screen->bitsPerPixel) {
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
case 4:
pCurPriv->source |= pCurPriv->source << 4;
pCurPriv->mask |= pCurPriv->mask << 4;