summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/savage/s3.c122
-rw-r--r--hw/kdrive/savage/s3.h5
-rw-r--r--hw/kdrive/savage/s3cmap.c80
-rw-r--r--hw/kdrive/savage/s3draw.c260
-rw-r--r--hw/kdrive/savage/s3draw.h6
-rw-r--r--hw/kdrive/savage/s3gc.c107
-rw-r--r--hw/kdrive/sis530/sis.c501
-rw-r--r--hw/kdrive/sis530/sis.h85
-rw-r--r--hw/kdrive/sis530/sisdraw.c53
-rw-r--r--hw/kdrive/sis530/sisstub.c11
-rw-r--r--hw/kdrive/trio/s3.c4
11 files changed, 602 insertions, 632 deletions
diff --git a/hw/kdrive/savage/s3.c b/hw/kdrive/savage/s3.c
index df62a27ce..ccf0bf22d 100644
--- a/hw/kdrive/savage/s3.c
+++ b/hw/kdrive/savage/s3.c
@@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.c,v 1.3 2000/02/23 20:30:01 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.c,v 1.4 2000/05/06 22:17:44 keithp Exp $ */
#include "s3.h"
@@ -226,11 +226,12 @@ s3ModeUsable (KdScreenInfo *screen)
screen->fb[fb].bitsPerPixel = 8;
}
- byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3);
- pixel_width = screen->width;
- screen->fb[fb].pixelStride = pixel_width;
- screen->fb[fb].byteStride = byte_width;
- screen_size += byte_width * screen->height;
+ /*
+ * SGRAM requires stride % 64 == 0
+ */
+ screen->fb[fb].pixelStride = (screen->width + 63) & ~63;
+ screen->fb[fb].byteStride = screen->fb[fb].pixelStride * (screen->fb[fb].bitsPerPixel >> 3);
+ screen_size += screen->fb[fb].byteStride * screen->height;
}
return screen_size <= s3c->memory;
@@ -340,6 +341,12 @@ s3ScreenInit (KdScreenInfo *screen)
screen->fb[fb].frameBuffer = s3c->frameBuffer + screen_size;
screen_size += screen->fb[fb].byteStride * screen->height;
+ REGION_INIT(pScreen, (&s3s->region[fb]), NullBox, 0);
+ if (screen->fb[fb].bitsPerPixel == 8)
+ s3s->fb[ma].chroma_key = 0xff;
+ else
+ s3s->fb[ma].chroma_key = 0;
+
/*
* Use remaining memory for off-screen storage, but only use
* one piece (either right or bottom).
@@ -1101,6 +1108,9 @@ s3Enable (ScreenPtr pScreen)
s3Set (s3vga, s3_sequential_addressing_mode, 1);
s3Set (s3vga, s3_select_chain_4_mode, 1);
s3Set (s3vga, s3_linear_addressing_control, 1);
+
+ s3Set (s3vga, s3_enable_gamma_correction, 0);
+
s3Set (s3vga, s3_enable_8_bit_luts, 1);
s3Set (s3vga, s3_dclk_invert, 0);
@@ -1150,7 +1160,6 @@ s3Enable (ScreenPtr pScreen)
s3Set (s3vga, s3_eclk_r, r);
#endif
- s3s->manage_border = FALSE;
/*
* Compute character lengths for horizontal timing values
*/
@@ -1189,10 +1198,6 @@ s3Enable (ScreenPtr pScreen)
h_blank_start_adjust = -3;
h_blank_end_adjust = -4;
s3Set (s3vga, s3_border_select, 0);
-#if 0
- s3s->manage_border = TRUE;
- /* s3Set (s3vga, s3_border_color, pScreen->blackPixel); */
-#endif
}
break;
case 16:
@@ -1522,6 +1527,8 @@ s3Enable (ScreenPtr pScreen)
VgaFlush(&s3vga->card);
VgaSetImm (&s3vga->card, s3_clock_load_imm, 1);
VgaSetImm(&s3vga->card, s3_clock_load_imm, 0);
+
+
if (s3s->use_streams)
{
fb = s3s->fbmap[0];
@@ -1537,7 +1544,7 @@ s3Enable (ScreenPtr pScreen)
fb = s3s->fbmap[1];
s3->blend_control = 5 << 24;
if (s3s->fb[0].accel_bpp == 8)
- s3->chroma_key_control = 0x330000ff;
+ s3->chroma_key_control = 0x33000000 | s3s->fb[0].chroma_key;
else
s3->chroma_key_control = 0x13010101;
s3->secondary_stream_control = control[1] | screen->width;
@@ -1758,97 +1765,26 @@ s3DPMS (ScreenPtr pScreen, int mode)
return TRUE;
}
-void
-s3DumbPaintChromaKey (WindowPtr pWin, RegionPtr pRegion)
+Bool
+s3InitScreen(ScreenPtr pScreen)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
KdScreenPriv(pScreen);
KdCardInfo *card = pScreenPriv->card;
KdScreenInfo *screen = pScreenPriv->screen;
s3CardInfo (pScreenPriv);
s3ScreenInfo (pScreenPriv);
-
- if (pWin->drawable.depth != s3s->primary_depth)
+ int ma, fb;
+
+ if (screen->fb[1].depth)
{
- int nBox = REGION_NUM_RECTS(pRegion);
- BoxPtr pBox = REGION_RECTS(pRegion);
- PixmapPtr pPixmap;
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
-
- if (pScrPriv->pLayer[0]->drawable.depth == pWin->drawable.depth)
- pPixmap = pScrPriv->pLayer[1];
- else
- pPixmap = pScrPriv->pLayer[0];
- fbGetDrawable (&pPixmap->drawable, dst, dstStride, dstBpp);
- while (nBox--)
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+
+ for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
{
- fbSolid (dst + pBox->y1 * dstStride,
- dstStride,
- pBox->x1 * dstBpp,
- dstBpp,
- (pBox->x2 - pBox->x1) * dstBpp,
- (pBox->y2 - pBox->y1),
- 0x0, FB_ALLONES);
- pBox++;
+ fb = s3s->fbmap[ma];
+ pScrPriv->layer[fb].key = s3s->fb[ma].chroma_key;
}
}
-}
-
-void
-s3DumbPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what)
-{
- s3DumbPaintChromaKey (pWin, pRegion);
- fbPaintWindow (pWin, pRegion, what);
-}
-
-void
-s3DumbCopyWindow (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RegionRec rgnDst;
- int dx, dy;
- PixmapPtr pPixmap;
- FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
- int fb;
-
- KdCheckSync (pScreen);
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
- REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-
- for (fb = 0; fb < pScrPriv->nlayers; fb++)
- {
- pPixmap = pScrPriv->pLayer[fb];
- fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
- 0,
- &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
- }
-
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
- fbValidateDrawable (&pWin->drawable);
-}
-
-Bool
-s3InitScreen(ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- KdScreenInfo *screen = pScreenPriv->screen;
- s3CardInfo (pScreenPriv);
- s3ScreenInfo (pScreenPriv);
-
- pScreen->PaintWindowBackground = s3DumbPaintWindow;
- pScreen->PaintWindowBorder = s3DumbPaintWindow;
- pScreen->CopyWindow = s3DumbCopyWindow;
return TRUE;
}
diff --git a/hw/kdrive/savage/s3.h b/hw/kdrive/savage/s3.h
index a19b9c3d3..1ae6237aa 100644
--- a/hw/kdrive/savage/s3.h
+++ b/hw/kdrive/savage/s3.h
@@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.3 2000/02/23 20:30:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3.h,v 1.4 2000/05/06 22:17:45 keithp Exp $ */
#ifndef _S3_H_
#define _S3_H_
@@ -439,18 +439,19 @@ typedef struct _s3FbInfo {
CARD32 bitmap_offset;
int accel_stride;
int accel_bpp;
+ CARD32 chroma_key;
} 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];
+ RegionRec region[KD_MAX_FB];
int fbmap[KD_MAX_FB+1]; /* map from fb to stream */
} S3ScreenInfo;
diff --git a/hw/kdrive/savage/s3cmap.c b/hw/kdrive/savage/s3cmap.c
index a3ede490f..c7061df7f 100644
--- a/hw/kdrive/savage/s3cmap.c
+++ b/hw/kdrive/savage/s3cmap.c
@@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.3 2000/02/23 20:30:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3cmap.c,v 1.4 2000/05/06 22:17:45 keithp Exp $ */
#include "s3.h"
@@ -43,15 +43,51 @@ s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
}
}
+#ifndef S3_TRIO
+#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
+
+void
+s3SetTrueChromaKey (ScreenPtr pScreen, int pfb, xColorItem *pdef)
+{
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ KdScreenPriv(pScreen);
+ s3ScreenInfo(pScreenPriv);
+ int fb, ma;
+ CARD32 key;
+ int r, g, b;
+
+ for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
+ {
+ fb = s3s->fbmap[ma];
+ if (fb != pfb && pScreenPriv->screen->fb[fb].redMask)
+ {
+ r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
+ g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
+ b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
+ key = ((Shift(pdef->red,r) & pScreenPriv->screen->fb[fb].redMask) |
+ (Shift(pdef->green,g) & pScreenPriv->screen->fb[fb].greenMask) |
+ (Shift(pdef->blue,b) & pScreenPriv->screen->fb[fb].blueMask));
+ if (pScrPriv->layer[fb].key != key)
+ {
+ pScrPriv->layer[fb].key = key;
+ (*pScrPriv->PaintKey) (&pScrPriv->layer[fb].u.run.pixmap->drawable,
+ &pScrPriv->layer[pfb].u.run.region,
+ pScrPriv->layer[fb].key, fb);
+ }
+ }
+ }
+}
+#endif
+
void
s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
s3CardInfo(pScreenPriv);
s3ScreenInfo(pScreenPriv);
- S3Vga *s3vga = &s3c->s3vga;
- Bool hit_border = FALSE;
- Bool check_border = FALSE;
+ S3Vga *s3vga = &s3c->s3vga;
+ xColorItem *chroma = 0;
+ CARD32 key;
#if 0
_s3WaitVRetrace (s3vga);
@@ -59,34 +95,28 @@ s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
S3Ptr s3 = s3c->s3;
_s3WaitVRetraceFast(s3);
#endif
- if (pScreenPriv->enabled && s3s->manage_border && !s3s->managing_border)
- check_border = TRUE;
+#ifndef S3_TRIO
+ if (pScreenPriv->screen->fb[1].depth)
+ {
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+ key = pScrPriv->layer[fb].key;
+ }
+#endif
+ else
+ key = ~0;
while (ndef--)
{
- if (check_border && pdefs->pixel == s3s->border_pixel)
- {
- if (pdefs->red || pdefs->green || pdefs->blue)
- hit_border = TRUE;
- }
+ if (pdefs->pixel == key)
+ chroma = pdefs;
s3SetImm (s3vga, s3_dac_write_index, pdefs->pixel);
s3SetImm (s3vga, s3_dac_data, pdefs->red >> 8);
s3SetImm (s3vga, s3_dac_data, pdefs->green >> 8);
s3SetImm (s3vga, s3_dac_data, pdefs->blue >> 8);
pdefs++;
}
- if (hit_border)
- {
- xColorItem black;
-
- black.red = 0;
- black.green = 0;
- black.blue = 0;
- s3s->managing_border = TRUE;
- FakeAllocColor (pScreenPriv->pInstalledmap[fb],
- &black);
- s3s->border_pixel = black.pixel;
- FakeFreeColor (pScreenPriv->pInstalledmap[fb], s3s->border_pixel);
-/* s3SetImm (&s3c->s3vga, s3_border_color, (VGA8) s3s->border_pixel); */
- }
+#ifndef S3_TRIO
+ if (chroma && !pScreenPriv->closed)
+ s3SetTrueChromaKey (pScreen, fb, chroma);
+#endif
}
diff --git a/hw/kdrive/savage/s3draw.c b/hw/kdrive/savage/s3draw.c
index c4c369c43..831db3be0 100644
--- a/hw/kdrive/savage/s3draw.c
+++ b/hw/kdrive/savage/s3draw.c
@@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.3 2000/02/23 20:30:03 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.c,v 1.4 2000/05/06 22:17:46 keithp Exp $ */
#include "s3.h"
#include "s3draw.h"
@@ -491,7 +491,6 @@ s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
BoxPtr pboxClippedBase;
BoxPtr pextent;
BoxRec stackRects[NUM_STACK_RECTS];
- FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC);
int numRects;
int n;
int xorg, yorg;
@@ -712,7 +711,6 @@ s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
int nTmp;
int *pwidthFree;/* copies of the pointers to free */
DDXPointPtr pptFree;
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
BoxPtr extents;
S3PatternCache *cache;
RegionPtr pClip = fbGetCompositeClip (pGC);
@@ -994,17 +992,19 @@ s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
}
void
-s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int countInit, DDXPointPtr ptsIn)
+s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int countInit, DDXPointPtr ptsIn)
{
SetupS3(pDrawable->pScreen);
- FbGCPrivPtr fbPriv;
int nwidth;
int maxy;
+ int origin;
int count;
register int vertex1, vertex2;
int c;
+ RegionPtr pClip = fbGetCompositeClip(pGC);
BoxPtr extents;
+ int clip;
int y, sy;
int *vertex1p, *vertex2p;
int *endp;
@@ -1018,17 +1018,21 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
int l, r;
int nmiddle;
- if (mode == CoordModePrevious)
+ if (mode == CoordModePrevious || REGION_NUM_RECTS(pClip) != 1)
{
KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
return;
}
s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC));
- fbPriv = fbGetGCPrivate(pGC);
sy = pDrawable->y;
sx = pDrawable->x;
- extents = &fbGetCompositeClip(pGC)->extents;
+ origin = *((int *) &pDrawable->x);
+ origin -= (origin & 0x8000) << 1;
+ extents = &pClip->extents;
+ vertex1 = *((int *) &extents->x1) - origin;
+ vertex2 = *((int *) &extents->x2) - origin - 0x00010001;
+ clip = 0;
y = 32767;
maxy = 0;
@@ -1040,14 +1044,7 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
while (count--)
{
c = *vertex2p;
- /*
- * Check for negative or over S3 limits
- */
- if (c & 0xe000e000)
- {
- KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
- return;
- }
+ clip |= (c - vertex1) | (vertex2 - c);
c = intToY(c);
DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c));
if (c < y)
@@ -1070,14 +1067,7 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
while (count--)
{
c = *vertex2p;
- /*
- * Check for negative or over S3 limits
- */
- if (c & 0xe000e000)
- {
- KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
- return;
- }
+ clip |= (c - vertex1) | (vertex2 - c);
c = intToY(c);
DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c));
if (c < y)
@@ -1111,16 +1101,17 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
if (x1 != dx2)
yFlip++;
if (yFlip != 2)
- {
- KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
- return;
- }
+ clip = 0x8000;
}
if (y == maxy)
return;
+ if (clip & 0x80008000)
+ {
+ KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn);
+ return;
+ }
_s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask);
- _s3SetClip(s3,extents);
vertex2p = vertex1p;
vertex2 = vertex1 = *vertex2p++;
@@ -1236,7 +1227,6 @@ s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
if (y == maxy)
break;
}
- _s3ResetClip (s3, pDrawable->pScreen);
MarkSyncS3 (pDrawable->pScreen);
}
@@ -2162,15 +2152,8 @@ s3CreateWindow (WindowPtr pWin)
KdScreenPriv(pWin->drawable.pScreen);
s3ScreenInfo(pScreenPriv);
- if (!KdCreateWindow (pWin))
- return FALSE;
pWin->devPrivates[s3WindowPrivateIndex].ptr = 0;
-#ifndef S3_TRIO
- if (pWin->drawable.depth != s3s->primary_depth)
- return fbOverlayCreateWindow (pWin);
- else
-#endif
- return fbCreateWindow (pWin);
+ return KdCreateWindow (pWin);
}
Bool
@@ -2217,27 +2200,34 @@ s3ChangeWindowAttributes (WindowPtr pWin, Mask mask)
return ret;
}
+
#ifndef S3_TRIO
void
-s3PaintChromaKey (WindowPtr pWin, RegionPtr pRegion)
+s3PaintKey (DrawablePtr pDrawable,
+ RegionPtr pRegion,
+ CARD32 pixel,
+ int fb)
{
- SetupS3 (pWin->drawable.pScreen);
+ SetupS3 (pDrawable->pScreen);
s3ScreenInfo (pScreenPriv);
+ int nBox = REGION_NUM_RECTS(pRegion);
+ BoxPtr pBox = REGION_RECTS(pRegion);
+ int ma;
- if (pWin->drawable.depth != s3s->primary_depth)
+ if (!nBox)
+ return;
+
+ for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
+ if (s3s->fbmap[ma] == fb)
+ break;
+ s3SetGlobalBitmap (pDrawable->pScreen, ma);
+ _s3SetSolidFill (s3, pixel, GXcopy, 0xffffffff);
+ while (nBox--)
{
- int nBox = REGION_NUM_RECTS(pRegion);
- BoxPtr pBox = REGION_RECTS(pRegion);
-
- s3SetGlobalBitmap (pWin->drawable.pScreen, 0);
- _s3SetSolidFill(s3,0xffffffff,GXcopy,0xffffffff);
- while (nBox--)
- {
- _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1);
- pBox++;
- }
- MarkSyncS3 (pWin->drawable.pScreen);
+ _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1);
+ pBox++;
}
+ MarkSyncS3 (pDrawable->pScreen);
}
#endif
@@ -2245,6 +2235,7 @@ void
s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
{
SetupS3(pWin->drawable.pScreen);
+ s3ScreenInfo(pScreenPriv);
s3PatternPtr pPattern;
DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "s3PaintWindow 0x%x extents %d %d %d %d n %d",
@@ -2254,9 +2245,6 @@ s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
REGION_NUM_RECTS(pRegion)));
if (!REGION_NUM_RECTS(pRegion))
return;
-#ifndef S3_TRIO
- s3PaintChromaKey (pWin, pRegion);
-#endif
switch (what) {
case PW_BACKGROUND:
switch (pWin->backgroundState) {
@@ -2289,6 +2277,12 @@ s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
}
break;
case PW_BORDER:
+#ifndef S3_TRIO
+ if (s3s->fbmap[1] >= 0)
+ fbOverlayUpdateLayerRegion (pWin->drawable.pScreen,
+ fbOverlayWindowLayer (pWin),
+ pRegion);
+#endif
if (pWin->borderIsPixel)
{
s3FillBoxSolid((DrawablePtr)pWin,
@@ -2303,19 +2297,6 @@ s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
}
void
-s3RestoreAreas(PixmapPtr pPixmap,
- RegionPtr prgnRestore,
- int xorg,
- int yorg,
- WindowPtr pWin)
-{
-#ifndef S3_TRIO
- s3PaintChromaKey (pWin, prgnRestore);
-#endif
- KdCheckRestoreAreas (pPixmap, prgnRestore, xorg, yorg, pWin);
-}
-
-void
s3CopyWindowProc (DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
GCPtr pGC,
@@ -2330,86 +2311,94 @@ s3CopyWindowProc (DrawablePtr pSrcDrawable,
{
SetupS3(pDstDrawable->pScreen);
s3ScreenInfo(pScreenPriv);
- int srcX, srcY, dstX, dstY;
- int x1, x2;
- int w, h;
- int flags;
- int ma;
- BoxPtr pbox;
- int nbox;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int srcX, srcY, dstX, dstY;
+ int x1, x2;
+ int w, h;
+ int flags;
+ int fb = (int) closure;
+ int ma;
+ BoxPtr pbox;
+ int nbox;
+ int bitsPerPixel;
- if (pSrcDrawable->bitsPerPixel == 24)
- dx *= 3;
#ifdef S3_TRIO
ma = 0;
#else
for (ma = 0; s3s->fbmap[ma] >= 0; ma++)
+ if (s3s->fbmap[ma] == fb)
+ break;
#endif
+ bitsPerPixel = screen->fb[fb].bitsPerPixel;
+ if (bitsPerPixel == 24)
+ dx *= 3;
+ nbox = nboxOrig;
+ pbox = pboxOrig;
+ s3SetGlobalBitmap (pDstDrawable->pScreen, ma);
+ _s3SetBlt(s3,GXcopy,~0);
+ while (nbox--)
{
- nbox = nboxOrig;
- pbox = pboxOrig;
- s3SetGlobalBitmap (pDstDrawable->pScreen, ma);
- _s3SetBlt(s3,GXcopy,~0);
- while (nbox--)
+ x1 = pbox->x1;
+ x2 = pbox->x2;
+ if (bitsPerPixel == 24)
{
- x1 = pbox->x1;
- x2 = pbox->x2;
- if (pSrcDrawable->bitsPerPixel == 24)
- {
- x1 *= 3;
- x2 *= 3;
- }
-
- w = x2 - x1;
- h = pbox->y2 - pbox->y1;
- flags = 0;
- if (reverse)
- {
- dstX = x2 - 1;
- }
- else
- {
- dstX = x1;
- flags |= INC_X;
- }
- srcX = dstX + dx;
-
- if (upsidedown)
- {
- dstY = pbox->y2 - 1;
- }
- else
- {
- dstY = pbox->y1;
- flags |= INC_Y;
- }
- srcY = dstY + dy;
-
- _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags);
- pbox++;
+ x1 *= 3;
+ x2 *= 3;
+ }
+
+ w = x2 - x1;
+ h = pbox->y2 - pbox->y1;
+ flags = 0;
+ if (reverse)
+ {
+ dstX = x2 - 1;
+ }
+ else
+ {
+ dstX = x1;
+ flags |= INC_X;
+ }
+ srcX = dstX + dx;
+
+ if (upsidedown)
+ {
+ dstY = pbox->y2 - 1;
+ }
+ else
+ {
+ dstY = pbox->y1;
+ flags |= INC_Y;
}
- MarkSyncS3 (pDstDrawable->pScreen);
+ srcY = dstY + dy;
+
+ _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags);
+ pbox++;
}
+ MarkSyncS3 (pDstDrawable->pScreen);
}
void
s3CopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KdScreenPriv(pScreen);
- RegionRec rgnDst;
- int dx, dy;
- WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdScreenPriv (pScreen);
+ s3ScreenInfo (pScreenPriv);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ RegionRec rgnDst;
+ int dx, dy;
+ WindowPtr pwinRoot;
pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
+
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+
+ REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst,
+ &pWin->borderClip, prgnSrc);
fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
0,
@@ -2451,7 +2440,6 @@ s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
int nTmp;
int *pwidthFree;/* copies of the pointers to free */
DDXPointPtr pptFree;
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
BoxPtr extents;
RegionPtr pClip = fbGetCompositeClip (pGC);
@@ -2625,7 +2613,6 @@ s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
BoxPtr pboxClippedBase;
BoxPtr pextent;
BoxRec stackRects[NUM_STACK_RECTS];
- FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC);
int numRects;
int n;
int xorg, yorg;
@@ -3096,13 +3083,18 @@ s3DrawInit (ScreenPtr pScreen)
pScreen->DestroyWindow = s3DestroyWindow;
pScreen->PaintWindowBackground = s3PaintWindow;
pScreen->PaintWindowBorder = s3PaintWindow;
- pScreen->CopyWindow = s3CopyWindow;
- pScreen->BackingStoreFuncs.RestoreAreas = s3RestoreAreas;
-#if 0
- pScreen->PaintWindowBackground = s3DumbPaintWindow;
- pScreen->PaintWindowBorder = s3DumbPaintWindow;
- pScreen->CopyWindow = s3DumbCopyWindow;
+#ifndef S3_TRIO
+ if (pScreenPriv->screen->fb[1].depth)
+ {
+ FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
+
+ pScrPriv->PaintKey = s3PaintKey;
+ pScrPriv->CopyWindow = s3CopyWindowProc;
+ pScreen->CopyWindow = fbOverlayCopyWindow;
+ }
+ else
#endif
+ pScreen->CopyWindow = s3CopyWindow;
/*
* Initialize patterns
diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h
index 81bbad413..269dfe6b3 100644
--- a/hw/kdrive/savage/s3draw.h
+++ b/hw/kdrive/savage/s3draw.h
@@ -22,7 +22,7 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.3 2000/02/23 20:30:04 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.4 2000/05/06 22:17:47 keithp Exp $ */
#ifndef _S3DRAW_H_
#define _S3DRAW_H_
@@ -413,8 +413,8 @@ void
s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
void
-s3FillPoly1Rect (DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
+s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
void
s3PolyGlyphBlt (DrawablePtr pDrawable,
diff --git a/hw/kdrive/savage/s3gc.c b/hw/kdrive/savage/s3gc.c
index 87980d371..7c7148123 100644
--- a/hw/kdrive/savage/s3gc.c
+++ b/hw/kdrive/savage/s3gc.c
@@ -47,63 +47,7 @@
* font <= 32 pixels wide
*/
-/* TE font, >= 4 pixels wide, one clip rectangle */
-static const GCOps s3TEOps1Rect = {
- s3FillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- s3CopyArea,
- s3CopyPlane,
- KdCheckPolyPoint,
- s3Polylines,
- s3PolySegment,
- KdCheckPolyRectangle,
- KdCheckPolyArc,
- s3FillPoly1Rect,
- s3PolyFillRect,
- s3PolyFillArcSolid,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- s3ImageTEGlyphBlt,
- s3PolyTEGlyphBlt,
- s3PushPixels,
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-extern GCOps fbGCOps;
-
-/* Non TE font, one clip rectangle */
-static const GCOps s3NonTEOps1Rect = {
- s3FillSpans,
- KdCheckSetSpans,
- KdCheckPutImage,
- s3CopyArea,
- s3CopyPlane,
- KdCheckPolyPoint,
- s3Polylines,
- s3PolySegment,
- KdCheckPolyRectangle,
- KdCheckPolyArc,
- s3FillPoly1Rect,
- s3PolyFillRect,
- s3PolyFillArcSolid,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- s3ImageGlyphBlt,
- s3PolyGlyphBlt,
- s3PushPixels
-#ifdef NEED_LINEHELPER
- ,NULL
-#endif
-};
-
-/* TE font, != 1 clip rect (including 0) */
+/* TE font */
static const GCOps s3TEOps = {
s3FillSpans,
KdCheckSetSpans,
@@ -115,7 +59,7 @@ static const GCOps s3TEOps = {
s3PolySegment,
KdCheckPolyRectangle,
KdCheckPolyArc,
- KdCheckFillPolygon,
+ s3FillPoly,
s3PolyFillRect,
s3PolyFillArcSolid,
miPolyText8,
@@ -130,7 +74,7 @@ static const GCOps s3TEOps = {
#endif
};
-/* Non TE font, != 1 clip rect (including 0) */
+/* Non TE font */
static const GCOps s3NonTEOps = {
s3FillSpans,
KdCheckSetSpans,
@@ -142,7 +86,7 @@ static const GCOps s3NonTEOps = {
s3PolySegment,
KdCheckPolyRectangle,
KdCheckPolyArc,
- KdCheckFillPolygon,
+ s3FillPoly,
s3PolyFillRect,
s3PolyFillArcSolid,
miPolyText8,
@@ -182,19 +126,9 @@ s3MatchCommon (DrawablePtr pDraw, GCPtr pGC, FbGCPrivPtr fbPriv)
if (pGC->font)
{
if (TERMINALFONT(pGC->font))
- {
- if (fbPriv->oneRect)
- return (GCOps *) &s3TEOps1Rect;
- else
- return (GCOps *) &s3TEOps;
- }
+ return (GCOps *) &s3TEOps;
else
- {
- if (fbPriv->oneRect)
- return (GCOps *) &s3NonTEOps1Rect;
- else
- return (GCOps *) &s3NonTEOps;
- }
+ return (GCOps *) &s3NonTEOps;
}
return 0;
}
@@ -203,19 +137,18 @@ void
s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
{
int new_type; /* drawable type has changed */
- int new_onerect; /* onerect value has changed */
int new_origin;
/* flags for changing the proc vector */
FbGCPrivPtr fbPriv;
s3PrivGCPtr s3Priv;
int oneRect;
+ GCOps *newops;
fbPriv = fbGetGCPrivate(pGC);
s3Priv = s3GetGCPrivate(pGC);
new_type = FALSE;
- new_onerect = FALSE;
new_origin = FALSE;
/*
@@ -236,13 +169,9 @@ s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
/*
* Call down to FB to set clip list and rrop values
*/
- oneRect = fbPriv->oneRect;
fbValidateGC (pGC, changes, pDrawable);
- if (oneRect != fbPriv->oneRect)
- new_onerect = TRUE;
-
/*
* Check accelerated pattern if necessary
*/
@@ -256,19 +185,12 @@ s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
* Try to match common vector
*/
- if (new_type || new_onerect ||
- (changes & (GCLineWidth|GCLineStyle|GCFillStyle|
- GCFont|GCForeground|GCFunction|GCPlaneMask)))
+ if (newops = s3MatchCommon (pDrawable, pGC, fbPriv))
{
- GCOps *newops;
-
- if (newops = s3MatchCommon (pDrawable, pGC, fbPriv))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- return;
- }
+ if (pGC->ops->devPrivate.val)
+ miDestroyGCOps (pGC->ops);
+ pGC->ops = newops;
+ return;
}
/*
@@ -335,14 +257,13 @@ s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
/*
* Polygons
*/
- if (new_type || new_onerect || (changes & (GCFillStyle)))
+ if (new_type || (changes & (GCFillStyle)))
{
pGC->ops->FillPolygon = KdCheckFillPolygon;
if (s3Priv->type == DRAWABLE_WINDOW &&
- fbPriv->oneRect &&
pGC->fillStyle == FillSolid)
{
- pGC->ops->FillPolygon = s3FillPoly1Rect;
+ pGC->ops->FillPolygon = s3FillPoly;
}
}
diff --git a/hw/kdrive/sis530/sis.c b/hw/kdrive/sis530/sis.c
index d0aa0a0bd..dca811eac 100644
--- a/hw/kdrive/sis530/sis.c
+++ b/hw/kdrive/sis530/sis.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/sis530/sis.c,v 1.2 1999/12/30 03:03:14 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sis.c,v 1.4 2000/05/06 22:17:49 keithp Exp $ */
#include "sis.h"
@@ -29,130 +29,10 @@
#define MMIO_SIZE (64 * 1024)
-#define SIS_TIMING_BAIL 2
-
-SisTiming sisTimings[] = {
- /* FP BP BLANK */
- { 640, 480, 85,
- 56, 80, 192, /* horizontal 43.265 KHz */
- 1, 25, 29, /* vertical 85.000 Hz */
- /* pixel 35.996 MHz */
- },
-
- { 640, 480, 75,
- 16, 120, 200, /* horizontal 37.500 KHz */
- 1, 16, 20, /* vertical 75.000 Hz */
- /* pixel 31.500 MHz */
- },
-
- { 640, 480, 60,
- 16, 48, 160, /* horizontal 31.321 KHz */
- 10, 33, 45, /* vertical 59.568 Hz */
- /* pixel 25.057 MHz */
- },
-
- { 800, 600, 85,
- 32, 152, 248, /* horizontal 53.673 KHz */
- 1, 27, 31, /* vertical 85.060 Hz */
- /* pixel 56.249 MHz */
- },
- { 800, 600, 75,
- 16, 160, 256, /* horizontal 46.891 KHz */
- 1, 21, 25, /* vertical 75.025 Hz */
- /* pixel 49.516 MHz */
- },
- { 800, 600, 72,
- 56, 64, 240, /* horizontal 48.186 KHz */
- 37, 23, 66, /* vertical 72.351 Hz */
- /* pixel 50.113 MHz */
- },
-
- { 1024, 768, 85,
- 48, 208, 352, /* horizontal 68.676 KHz */
- 1, 36, 40, /* vertical 84.996 Hz */
- /* pixel 94.499 MHz */
- },
- { 1024, 768, 75,
- 16, 176, 288, /* horizontal 60.022 KHz */
- 1, 28, 32, /* vertical 75.028 Hz */
- /* pixel 78.749 MHz */
- },
- { 1024, 768, 70,
- 24, 144, 304, /* horizontal 56.604 KHz */
- 3, 29, 38, /* vertical 70.227 Hz */
- /* pixel 75.170 MHz */
- },
- { 1024, 768, 66,
- 24, 144, 304, /* horizontal 53.234 KHz */
- 3, 29, 38, /* vertical 66.047 Hz */
- /* pixel 70.695 MHz */
- },
-
- { 1152, 900, 85,
- 48, 208, 384, /* horizontal 79.900 KHz */
- 1, 32, 38, /* vertical 85.181 Hz */
- /* pixel 122.726 MHz */
- },
- { 1152, 900, 75,
- 32, 208, 384, /* horizontal 70.495 Khz */
- 1, 32, 38, /* vertical 75.154 Hz */
- /* pixel 108.280 MHz */
- },
- { 1152, 900, 70,
- 32, 208, 384, /* horizontal 65.251 KHz */
- 2, 32, 38, /* vertical 69.564 Hz */
- /* pixel 100.226 MHz */
- },
- { 1152, 900, 66,
- 32, 208, 384, /* horizontal 61.817 KHz */
- 1, 32, 38, /* vertical 65.903 Hz */
- /* pixel 94.951 MHz */
- },
- { 1280, 1024, 85,
- 16, 248, 416, /* horizontal 90.561 KHz */
- 1, 40, 45, /* vertical 84.717 Hz */
- /* pixel 153.593 MHz */
- },
- { 1280, 1024, 75,
- 16, 248, 408, /* horizontal 80.255 KHz */
- 1, 38, 42, /* vertical 75.285 Hz */
- /* pixel 134.828 MHz */
- },
- { 1280, 1024, 70,
- 32, 248, 400, /* horizontal 74.573 KHz */
- 0, 36, 39, /* vertical 70.153 Hz */
- /* pixel 125.283 MHz */
- },
- { 1280, 1024, 66,
- 32, 248, 400, /* horizontal 70.007 KHz */
- 0, 36, 39, /* vertical 65.858 Hz */
- /* pixel 117.612 MHz */
- },
-
- { 1600, 1200, 85,
- 64, 304, 560, /* horizontal 106.059 KHz */
- 1, 46, 50, /* vertical 84.847 Hz */
- /* pixel 229.088 MHz */
- },
- { 1600, 1200, 75,
- 64, 304, 560, /* horizontal 93.748 KHz */
- 1, 46, 50, /* vertical 74.999 Hz */
- /* pixel 202.497 MHz */
- },
- { 1600, 1200, 70,
- 56, 304, 588, /* horizontal 87.524 KHz */
- 1, 46, 50, /* vertical 70.019 Hz */
- /* pixel 191.503 MHz */
- },
- { 1600, 1200, 65,
- 56, 308, 524, /* horizontal 80.050 KHz */
- 1, 38, 42, /* vertical 64.453 Hz */
- /* pixel 170.026 MHz */
- },
+int sisMemoryTable[8] = {
+ 1, 2, 4, 0, 0, 2, 4, 8
};
-#define NUM_SIS_TIMINGS (sizeof (sisTimings) / sizeof (sisTimings[0]))
-
Bool
sisCardInit (KdCardInfo *card)
{
@@ -161,19 +41,33 @@ sisCardInit (KdCardInfo *card)
int size;
CARD8 *registers;
CARD8 *temp_buffer;
+ CARD8 save_sr5;
sisc = (SisCardInfo *) xalloc (sizeof (SisCardInfo));
if (!sisc)
goto bail0;
- temp_buffer = KdMapDevice (card->attr.address[0], MAX_FB_SIZE);
- if (!temp_buffer)
- goto bail1;
-
- sisc->memory = KdFrameBufferSize (temp_buffer, MAX_FB_SIZE);
+ sisc->io_base = card->attr.io;
+ /*
+ * enable access to SiS ports (no MMIO available)
+ */
+ iopl(3);
+ save_sr5 = GetSrtc(sisc,0x5);
+ if (save_sr5 != 0x21)
+ save_sr5 = 0x86;
+ PutSrtc(sisc,0x5,0x86);
+#if 0
+ {
+ int i;
- KdUnmapDevice (temp_buffer, MAX_FB_SIZE);
+ for (i = 0; i <= 0x3f; i++)
+ fprintf (stderr, "SR%02x = %02x\n", i, GetSrtc(sisc,i));
+ }
+#endif
+ sisc->memory = sisMemoryTable[GetSrtc(sisc,0xc)&0x7] * 1024 * 1024;
+ PutSrtc(sisc,0x5,save_sr5);
+
if (!sisc->memory)
{
ErrorF ("Can't detect SiS530 frame buffer\n");
@@ -196,12 +90,7 @@ sisCardInit (KdCardInfo *card)
*/
sisc->sis = (SisPtr) (sisc->registers + SIS_MMIO_OFFSET);
sisc->cpu_bitblt = (VOL32 *) sisc->registers;
- sisc->io_base = card->attr.io;
- /*
- * enable access to SiS ports (no MMIO available)
- */
- ioperm (sisc->io_base, 0x80, 1);
card->driver = sisc;
return TRUE;
@@ -212,22 +101,60 @@ bail1:
bail0:
return FALSE;
}
-
-SisTiming *
-sisGetTiming (int width, int height, int rate)
+
+Bool
+sisModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t)
+{
+ if (t->horizontal != 1600 &&
+ t->horizontal != 1280 &&
+ t->horizontal != 1152 &&
+ t->horizontal != 1024 &&
+ t->horizontal != 800 &&
+ t->horizontal != 640)
+ return FALSE;
+ return TRUE;
+}
+
+Bool
+sisModeUsable (KdScreenInfo *screen)
{
- int i;
- SisTiming *t;
+ KdCardInfo *card = screen->card;
+ SisCardInfo *sisc = (SisCardInfo *) card->driver;
+ SisScreenInfo *siss;
+ int i;
+ KdMonitorTiming *t;
+ CARD32 memory;
+ int byte_width, pixel_width, screen_size;
- for (i = 0; i < NUM_SIS_TIMINGS; i++)
+ if (screen->fb[0].depth >= 24)
+ {
+ screen->fb[0].depth = 24;
+ screen->fb[0].bitsPerPixel = 24;
+ screen->dumb = TRUE;
+ }
+ else if (screen->fb[0].depth >= 16)
+ {
+ screen->fb[0].depth = 16;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else if (screen->fb[0].depth >= 15)
+ {
+ screen->fb[0].depth = 15;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else
{
- t = &sisTimings[i];
- if (t->horizontal >= width &&
- t->vertical >= height &&
- (!rate || t->rate <= rate))
- return t;
+ screen->fb[0].depth = 8;
+ screen->fb[0].bitsPerPixel = 8;
}
- return &sisTimings[SIS_TIMING_BAIL];
+ byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
+ pixel_width = screen->width;
+ screen->fb[0].pixelStride = pixel_width;
+ screen->fb[0].byteStride = byte_width;
+
+ screen_size = byte_width * screen->height;
+
+ return screen_size <= sisc->memory;
}
Bool
@@ -237,7 +164,7 @@ sisScreenInit (KdScreenInfo *screen)
SisCardInfo *sisc = (SisCardInfo *) card->driver;
SisScreenInfo *siss;
int i;
- SisTiming *t;
+ const KdMonitorTiming *t;
CARD32 memory;
int byte_width, pixel_width, screen_size;
@@ -256,117 +183,18 @@ sisScreenInit (KdScreenInfo *screen)
if (!screen->fb[0].depth)
screen->fb[0].depth = 8;
- for (;;)
- {
- if (screen->fb[0].depth >= 24)
- {
- screen->fb[0].depth = 24;
- screen->fb[0].bitsPerPixel = 24;
- }
- else if (screen->fb[0].depth >= 16)
- {
- screen->fb[0].depth = 16;
- screen->fb[0].bitsPerPixel = 16;
- }
- else if (screen->fb[0].depth >= 15)
- {
- screen->fb[0].depth = 15;
- screen->fb[0].bitsPerPixel = 16;
- }
- else
- {
- screen->fb[0].depth = 8;
- screen->fb[0].bitsPerPixel = 8;
- }
-
- /* Normalize width to supported values */
-
- if (screen->width >= 1600)
- screen->width = 1600;
- else if (screen->width >= 1280)
- screen->width = 1280;
- else if (screen->width >= 1152)
- screen->width = 1152;
- else if (screen->width >= 1024)
- screen->width = 1024;
- else if (screen->width >= 800)
- screen->width = 800;
- else
- screen->width = 640;
-
- byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
- pixel_width = screen->width;
- screen->fb[0].pixelStride = pixel_width;
- screen->fb[0].byteStride = byte_width;
-
- screen_size = byte_width * screen->height;
-
- if (screen_size <= sisc->memory)
- break;
-
- /*
- * Fix requested depth and geometry until it works
- */
- 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;
- screen->height = 900;
- }
- else if (screen->width > 1024)
- {
- screen->width = 1024;
- screen->height = 768;
- }
- else if (screen->width > 800)
- {
- screen->width = 800;
- screen->height = 600;
- }
- else if (screen->width > 640)
- {
- screen->width = 640;
- screen->height = 480;
- }
- else
- {
- xfree (siss);
- return FALSE;
- }
- }
+ t = KdFindMode (screen, sisModeSupported);
- t = sisGetTiming (screen->width, screen->height, screen->rate);
screen->rate = t->rate;
screen->width = t->horizontal;
screen->height = t->vertical;
- /*
- * Take requested geometry and adjust to fit possible geometries
- */
- switch (screen->fb[0].depth) {
- case 4:
- screen->fb[0].bitsPerPixel = 4;
- break;
- case 8:
- screen->fb[0].bitsPerPixel = 8;
- break;
- case 15:
- case 16:
- screen->fb[0].bitsPerPixel = 16;
- break;
- case 24:
- case 32:
- screen->fb[0].bitsPerPixel = 24;
- screen->dumb = TRUE;
- break;
+ if (!KdTuneMode (screen, sisModeUsable, sisModeSupported))
+ {
+ xfree (sisc);
+ return FALSE;
}
- screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >> 3);
- screen->fb[0].pixelStride = screen->width;
-
memory = sisc->memory - screen_size;
screen->fb[0].frameBuffer = sisc->frameBuffer;
@@ -451,10 +279,12 @@ _sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
crtc->crtc_overflow = GetCrtc (sisc, 0x07);
crtc->preset_row_scan = GetCrtc (sisc, 0x08);
crtc->_max_scan_line = GetCrtc (sisc, 0x09);
-
+ crtc->cursor_start = GetCrtc (sisc, 0x0a);
+ crtc->cursor_end = GetCrtc (sisc, 0x0a);
crtc->start_address_8_15 = GetCrtc (sisc, 0x0c);
crtc->start_address_0_7 = GetCrtc (sisc, 0x0d);
-
+ crtc->text_cursor_15_8 = GetCrtc (sisc, 0x0e);
+ crtc->text_cursor_7_0 = GetCrtc (sisc, 0x0f);
crtc->v_retrace_start_0_7 = GetCrtc (sisc, 0x10);
crtc->_v_retrace_end = GetCrtc (sisc, 0x11);
crtc->v_display_end_0_7 = GetCrtc (sisc, 0x12);
@@ -472,8 +302,12 @@ _sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
crtc->horizontal_pixel_pan = GetArtc (sisc, 0x13);
crtc->mode_register = GetGrtc (sisc, 0x5);
+ crtc->misc_register = GetGrtc (sisc, 0x6);
+ crtc->color_dont_care = GetGrtc (sisc, 0x7);
crtc->clock_mode = GetSrtc (sisc, 0x1);
+ crtc->color_plane_w_enable = GetSrtc (sisc, 0x2);
+ crtc->memory_mode = GetSrtc (sisc, 0x4);
crtc->graphics_mode = GetSrtc (sisc, 0x6);
crtc->misc_control_0 = GetSrtc (sisc, 0x7);
@@ -530,7 +364,6 @@ _sisSetBlank (SisCardInfo *sisc, Bool blank)
static void
_sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
{
- _sisOutb(crtc->misc_output, sisc->io_base+0x4c);
_sisSetBlank (sisc, TRUE);
PutCrtc (sisc, 0x00, crtc->h_total_0_7);
PutCrtc (sisc, 0x01, crtc->h_display_end_0_7);
@@ -542,10 +375,12 @@ _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
PutCrtc (sisc, 0x07, crtc->crtc_overflow);
PutCrtc (sisc, 0x08, crtc->preset_row_scan);
PutCrtc (sisc, 0x09, crtc->_max_scan_line);
-
+ PutCrtc (sisc, 0x0a, crtc->cursor_start);
+ PutCrtc (sisc, 0x0b, crtc->cursor_end);
PutCrtc (sisc, 0x0c, crtc->start_address_8_15);
PutCrtc (sisc, 0x0d, crtc->start_address_0_7);
-
+ PutCrtc (sisc, 0x0e, crtc->text_cursor_15_8);
+ PutCrtc (sisc, 0x0f, crtc->text_cursor_7_0);
PutCrtc (sisc, 0x10, crtc->v_retrace_start_0_7);
PutCrtc (sisc, 0x11, crtc->_v_retrace_end);
PutCrtc (sisc, 0x12, crtc->v_display_end_0_7);
@@ -562,8 +397,12 @@ _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
PutArtc (sisc, 0x13, crtc->horizontal_pixel_pan);
PutGrtc (sisc, 0x5, crtc->mode_register);
+ PutGrtc (sisc, 0x6, crtc->misc_register);
+ PutGrtc (sisc, 0x7, crtc->color_dont_care);
PutSrtc (sisc, 0x1, crtc->clock_mode | 0x20);
+ PutSrtc (sisc, 0x2, crtc->color_plane_w_enable);
+ PutSrtc (sisc, 0x4, crtc->memory_mode);
PutSrtc (sisc, 0x6, crtc->graphics_mode);
PutSrtc (sisc, 0x7, crtc->misc_control_0);
@@ -603,6 +442,24 @@ _sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc)
PutSrtc (sisc, 0x3E, crtc->misc_control_11);
PutSrtc (sisc, 0x3F, crtc->misc_control_12);
+#if 0
+ PutCrtc (sisc, 0x5b, 0x27);
+ PutCrtc (sisc, 0x5c, 0xe1);
+ PutCrtc (sisc, 0x5d, 0x00);
+
+ PutSrtc (sisc, 0x5a, 0xe6);
+ PutSrtc (sisc, 0x5d, 0xa1);
+ PutSrtc (sisc, 0x9a, 0xe6);
+ PutSrtc (sisc, 0x9d, 0xa1);
+ PutSrtc (sisc, 0xda, 0xe6);
+ PutSrtc (sisc, 0xdd, 0x6c);
+#endif
+
+ _sisOutb(crtc->misc_output, sisc->io_base+0x42);
+
+ outw (0x3c4, 0x0100);
+ outw (0x3c4, 0x0300);
+
_sisSetBlank (sisc, FALSE);
}
@@ -623,6 +480,29 @@ _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value)
_sisOutb (value, base+1);
}
+CARD8
+_sisReadArtc (CARD32 base, CARD8 index)
+{
+ CARD8 ret;
+
+ _sisInb (base+0x1a);
+ _sisOutb (index,base);
+ ret = _sisInb (base+1);
+ _sisInb (base+0x1a);
+ _sisOutb (0x20,base);
+ return ret;
+}
+
+void
+_sisWriteArtc (CARD32 base, CARD8 index, CARD8 value)
+{
+ _sisInb (base+0x1a);
+ _sisOutb (index|0x20,base);
+ _sisOutb (value,base);
+ _sisInb (base+0x1a);
+ _sisOutb (0x20,base);
+}
+
void
sisPreserve (KdCardInfo *card)
{
@@ -638,11 +518,16 @@ sisPreserve (KdCardInfo *card)
sisc->save.sr5 = 0x86;
/* unlock extension registers */
PutSrtc(sisc,0x5,0x86);
+ /* unlock CRTC registers */
+ PutCrtc(sisc,0x11,GetCrtc(sisc,0x11)&~0x80);
+ /* enable vga */
+ _sisOutb(0x1,sisc->io_base+0x43);
/* enable MMIO access to registers */
sisc->save.srb = GetSrtc(sisc,0xb);
PutSrtc(sisc, 0xb, sisc->save.srb | 0x60);
_sisGetCrtc (sisc, &sisc->save.crtc);
+ memcpy (sisc->save.text_save, sisc->frameBuffer, SIS_TEXT_SAVE);
}
void
@@ -653,7 +538,7 @@ sisEnable (ScreenPtr pScreen)
KdCardInfo *card = pScreenPriv->card;
SisCardInfo *sisc = card->driver;
SisScreenInfo *siss = screen->driver;
- SisTiming *t;
+ const KdMonitorTiming *t;
SisCrtc crtc;
unsigned long pixel;
@@ -686,28 +571,64 @@ sisEnable (ScreenPtr pScreen)
crtc = sisc->save.crtc;
- t = sisGetTiming (screen->width, screen->height, screen->rate);
+ t = KdFindMode (screen, sisModeSupported);
+
+ /* CR9 */
+ crtc.max_scan_line = 0;
+
+ /* CRA */
+ crtc.cursor_start = 0;
+
+ /* CRB */
+ crtc.cursor_end = 0;
+
+ /* CRE */
+ crtc.text_cursor_15_8 = 0;
+
+ /* CRF */
+ crtc.text_cursor_7_0 = 0;
/* CR11 */
crtc.disable_v_retrace_int = 1;
+ /* CR14 */
+ crtc.underline_location = 0;
+ crtc.count_by_four = 0;
+ crtc.doubleword_mode = 1;
+
/* 3CC/3C2 */
crtc.io_address_select = 1;
crtc.display_ram_enable = 1;
crtc.clock_select = 3;
+ /* SR1 */
+ crtc.clock_mode = 0;
+ crtc.dot_clock_8_9 = 1;
+
+ /* SR2 */
+ crtc.color_plane_w_enable = 0xf;
+
+ /* SR4 */
+ crtc.memory_mode = 0;
+ crtc.chain_4_enable = 1;
+ crtc.odd_even_disable = 1;
+ crtc.extended_memory_sz = 1;
+
/* SR6 */
- crtc.graphics_mode = 0;
crtc.graphics_mode_linear = 1;
crtc.enhanced_graphics_mode = 1;
+ /* SR9 */
+ crtc.crt_cpu_threshold_control_1 = 0;
+
/* SRB */
+#if 0
crtc.cpu_bitblt_enable = 1;
+#endif
crtc.memory_mapped_mode = 3;
/* SRC */
crtc.graphics_mode_32bit_enable = 1;
- crtc.text_mode_16bit_enable = 0;
crtc.read_ahead_enable = 1;
/* SR11 */
@@ -717,6 +638,24 @@ sisEnable (ScreenPtr pScreen)
crtc.vga_standby = 0;
crtc.vga_suspend = 0;
+ crtc.cursor_0_red = 0x3f;
+ crtc.cursor_0_green = 0x3f;
+ crtc.cursor_0_blue = 0x3f;
+
+ /* SR20 */
+ crtc.linear_base_19_26 = (card->attr.address[0] & 0x07f80000) >> 19;
+
+ /* SR21 */
+ crtc.linear_base_27_31 = (card->attr.address[0] & 0xf8000000) >> 27;
+ crtc.linear_aperture = SIS_LINEAR_APERTURE_4M;
+
+ /* SR27 */
+ crtc.logical_screen_width = 3;
+ crtc.graphics_prog_enable = 1;
+
+ /* SR38 */
+ crtc.extended_clock_select = 0;
+
/* AR10 */
crtc.mode_control = 0;
crtc.graphics_mode_enable = 1;
@@ -727,13 +666,16 @@ sisEnable (ScreenPtr pScreen)
/* AR13 */
crtc.horizontal_pixel_pan = 0;
- /* SR27 */
- crtc.logical_screen_width = 3;
- crtc.graphics_prog_enable = 1;
-
- /* SR38 */
- crtc.extended_clock_select = 0;
-
+ /* GR5 */
+ crtc.mode_register = 0;
+
+ /* GR6 */
+ crtc.graphics_enable = 1;
+ crtc.chain_odd_even = 0;
+ crtc.memory_address_select = 1;
+
+ /* GR7 */
+ crtc.color_dont_care = 0xf;
if (siss->cursor_base)
{
crtc_set_cursor_start_addr (&crtc, siss->cursor_off);
@@ -861,6 +803,29 @@ sisEnable (ScreenPtr pScreen)
crtc_set_v_blank_start (&crtc, v_blank_start);
crtc.v_blank_end_0_7 = v_blank_end;
+#if 0
+ crtc.h_blank_start_0_7 = 0x6a;
+ crtc._h_blank_end = 0x9a;
+ crtc.h_sync_start_0_7 = 0x6b;
+ crtc._h_sync_end = 0x9a;
+
+ crtc.v_retrace_start_0_7 = 0x7d;
+ crtc._v_retrace_end = 0x23;
+ crtc.v_blank_start_0_7 = 0x7d;
+ crtc.v_blank_end_0_7 = 0x84;
+
+ crtc.crt_cpu_threshold_control_0 = 0xdf; /* SR8 */
+ crtc.crt_cpu_threshold_control_1 = 0x00; /* SR9 */
+ crtc.extended_clock_generator = 0x40; /* SR13 */
+
+ crtc.cursor_h_start_0_7 = 0x83;
+ crtc.cursor_v_start_0_7 = 0x6c;
+
+ crtc.internal_vclk_0 = 0x68;
+ crtc.internal_vclk_1 = 0xc4;
+ crtc.misc_control_7 = 0x70;
+#endif
+
_sisSetCrtc (sisc, &crtc);
}
@@ -905,6 +870,7 @@ sisRestore (KdCardInfo *card)
{
SisCardInfo *sisc = (SisCardInfo *) card->driver;
+ memcpy (sisc->frameBuffer, sisc->save.text_save, SIS_TEXT_SAVE);
_sisSetCrtc (sisc, &sisc->save.crtc);
PutSrtc (sisc, 0xb, sisc->save.srb);
PutSrtc (sisc, 0x5, sisc->save.sr5);
@@ -926,7 +892,6 @@ sisCardFini (KdCardInfo *card)
KdUnmapDevice (sisc->frameBuffer, sisc->memory);
KdUnmapDevice (sisc->registers, sizeof (SisRec));
- ioperm (sisc->io_base, 0x80, 0);
}
KdCardFuncs sisFuncs = {
diff --git a/hw/kdrive/sis530/sis.h b/hw/kdrive/sis530/sis.h
index f4d7e750c..3c9a68806 100644
--- a/hw/kdrive/sis530/sis.h
+++ b/hw/kdrive/sis530/sis.h
@@ -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/sis530/sis.h,v 1.2 1999/12/30 03:03:14 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sis.h,v 1.4 2000/05/06 22:17:49 keithp Exp $ */
#ifndef _SIS_H_
#define _SIS_H_
@@ -194,6 +194,25 @@ typedef struct _sis530Trapezoid {
/* 8254 */
} SisTrapezoid;
+typedef struct _sisAccel {
+ VOL8 pad[0x80]; /* 8200 */
+ VOL32 src_addr; /* 8280 */
+ VOL32 dst_addr; /* 8284 */
+ VOL32 pitch; /* 8288 */
+ VOL32 dimension; /* 828c */
+ VOL32 fg; /* 8290 */
+ VOL32 bg; /* 8294 */
+
+
+ VOL32 clip_ul; /* 82a0 */
+ VOL32 clip_br; /* 82a4 */
+
+ VOL16 cmd; /* 82aa */
+
+ VOL8 pattern[256]; /* 82ac */
+
+} SisAccel;
+
typedef struct _sis530 {
union {
SisGeneral general;
@@ -201,6 +220,7 @@ typedef struct _sis530 {
SisTransparent transparent;
SisMultiple multiple;
SisTrapezoid trapezoid;
+ SisAccel accel;
} u;
} SisRec, *SisPtr;
@@ -307,26 +327,29 @@ typedef struct _crtc {
union {
struct {
- CARD8 _max_scan_line : 5;
+ CARD8 ___max_scan_line : 5;
CARD8 _v_blank_start_9 : 1;
CARD8 _line_compare_9 : 1;
- CARD8 _double_scan : 1;
+ CARD8 _double_scan : 1;
} _max_scan_line_s;
CARD8 __max_scan_line; /* CR9 */
} _max_scan_line_u;
-#define max_scan_line _max_scan_line_u._max_scan_line_s._max_scan_line
+#define max_scan_line _max_scan_line_u._max_scan_line_s.___max_scan_line
#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9
#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9
#define double_scan _max_scan_line_u._max_scan_line_s._double_scan
#define _max_scan_line _max_scan_line_u.__max_scan_line
- CARD8 cursor_start;
- CARD8 cursor_end;
+ CARD8 cursor_start; /* CRA */
+ CARD8 cursor_end; /* CRB */
CARD8 start_address_8_15; /* CRC */
CARD8 start_address_0_7; /* CRD */
+ CARD8 text_cursor_15_8; /* CRE */
+ CARD8 text_cursor_7_0; /* CRF */
+
CARD8 cursor_loc_high;
CARD8 cursor_loc_low;
@@ -355,7 +378,7 @@ typedef struct _crtc {
union {
struct {
- CARD8 _underline_location : 5;
+ CARD8 ___underline_location : 5;
CARD8 _count_by_four : 1;
CARD8 _doubleword_mode : 1;
CARD8 : 1;
@@ -363,7 +386,7 @@ typedef struct _crtc {
CARD8 __underline_location; /* CR14 */
} _underline_location_u;
-#define underline_location _underline_location_u._underline_location_s._underline_location
+#define underline_location _underline_location_u._underline_location_s.___underline_location
#define count_by_four _underline_location_u._underline_location_s._count_by_four
#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode
#define _underline_location _underline_location_u.__underline_location
@@ -433,6 +456,24 @@ typedef struct _crtc {
#define mode_register _mode_register_u._mode_register
#define color_mode_256 _mode_register_u._mode_register_s._color_mode_256
+#define odd_even_addressing _mode_register_u._mode_register_s._odd_even_addressing
+
+ union {
+ struct {
+ CARD8 _graphics_enable : 1;
+ CARD8 _chain_odd_even : 1;
+ CARD8 _memory_address_select : 2;
+ CARD8 : 4;
+ } _misc_register_s;
+ CARD8 _misc_register;
+ } _misc_register_u; /* GR6 */
+
+#define misc_register _misc_register_u._misc_register
+#define graphics_enable _misc_register_u._misc_register_s._graphics_enable
+#define chain_odd_even _misc_register_u._misc_register_s._chain_odd_even
+#define memory_address_select _misc_register_u._misc_register_s._memory_address_select
+
+ CARD8 color_dont_care; /* GR7 */
union {
struct {
@@ -454,6 +495,24 @@ typedef struct _crtc {
#define shifter_load_32 _clock_mode_u._clock_mode_s._shifter_load_32
#define display_off _clock_mode_u._clock_mode_s._display_off
+ CARD8 color_plane_w_enable; /* SR2 */
+
+ union {
+ struct {
+ CARD8 : 1;
+ CARD8 _extended_memory_size : 1;
+ CARD8 _odd_even_disable : 1;
+ CARD8 _chain_4_enable : 1;
+ CARD8 : 4;
+ } _memory_mode_s;
+ CARD8 _memory_mode;
+ } _memory_mode_u; /* SR4 */
+
+#define memory_mode _memory_mode_u._memory_mode
+#define extended_memory_sz _memory_mode_u._memory_mode_s._extended_memory_size
+#define odd_even_disable _memory_mode_u._memory_mode_s._odd_even_disable
+#define chain_4_enable _memory_mode_u._memory_mode_s._chain_4_enable
+
union {
struct {
CARD8 _enhanced_text_mode : 1;
@@ -700,6 +759,7 @@ typedef struct _crtc {
#define linear_base_1 _linear_base_1_u._linear_base_1
#define linear_base_27_31 _linear_base_1_u._linear_base_1_s._linear_base_27_31
+#define linear_aperture _linear_base_1_u._linear_base_1_s._linear_aperture
union {
struct {
@@ -1027,8 +1087,8 @@ typedef struct _crtc {
#define GetSrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x44,i)
#define PutSrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x44,i,v)
-#define GetArtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x40,i)
-#define PutArtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x40,i,v)
+#define GetArtc(sisc,i) _sisReadArtc ((sisc)->io_base+0x40,i)
+#define PutArtc(sisc,i,v) _sisWriteArtc ((sisc)->io_base+0x40,i,v)
#define GetGrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x4e,i)
#define PutGrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x4e,i,v)
@@ -1053,10 +1113,13 @@ typedef struct _sisTiming {
int vblank; /* blanking */
} SisTiming;
+#define SIS_TEXT_SAVE (64*1024)
+
typedef struct _sisSave {
CARD8 srb;
CARD8 sr5;
SisCrtc crtc;
+ CARD8 text_save[SIS_TEXT_SAVE];
} SisSave;
typedef struct _sisCardInfo {
@@ -1109,6 +1172,8 @@ void SISInitCard (KdCardAttr *attr);
CARD8 _sisReadIndexRegister (CARD32 base, CARD8 index);
void _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value);
+CARD8 _sisReadArtc (CARD32 base, CARD8 index);
+void _sisWriteArtc (CARD32 base, CARD8 index, CARD8 value);
extern KdCardFuncs sisFuncs;
diff --git a/hw/kdrive/sis530/sisdraw.c b/hw/kdrive/sis530/sisdraw.c
index 2461d3c4b..0cc14ba6d 100644
--- a/hw/kdrive/sis530/sisdraw.c
+++ b/hw/kdrive/sis530/sisdraw.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/sis530/sisdraw.c,v 1.2 1999/12/30 03:03:14 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/sis530/sisdraw.c,v 1.4 2000/05/06 22:17:50 keithp Exp $ */
#include "sis.h"
#include "sisdraw.h"
@@ -1635,11 +1635,15 @@ sisDrawEnable (ScreenPtr pScreen)
CARD32 cmd;
CARD32 base;
CARD16 stride;
+ CARD16 op;
base = pScreenPriv->screen->fb[0].frameBuffer - sisc->frameBuffer;
stride = pScreenPriv->screen->fb[0].byteStride;
+#if 0
sis->u.general.dst_base = base;
sis->u.general.dst_pitch = stride;
+ sis->u.general.src_pitch = stride;
+ sis->u.general._pad0 = stride;
sis->u.general.dst_height = pScreenPriv->screen->height;
_sisClip (sis, 0, 0,
pScreenPriv->screen->width, pScreenPriv->screen->height);
@@ -1647,6 +1651,53 @@ sisDrawEnable (ScreenPtr pScreen)
_sisRect (sis, 0, 0,
pScreenPriv->screen->width, pScreenPriv->screen->height,
cmd);
+#endif
+ base = (CARD32) (pScreenPriv->screen->fb[0].frameBuffer);
+ fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr);
+ sis->u.accel.src_addr = (base & 0x3fffff);
+ fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr);
+ sis->u.accel.dst_addr = (base & 0x3fffff);
+ sis->u.accel.pitch = (stride << 16) | stride;
+ sis->u.accel.dimension = ((pScreenPriv->screen->height-1) << 16 |
+ (pScreenPriv->screen->width - 1));
+ sis->u.accel.fg = (sisBltRop[GXcopy] << 24) | 0xf800;
+ sis->u.accel.bg = (sisBltRop[GXcopy] << 24) | 0x00;
+
+#define sisLEFT2RIGHT 0x10
+#define sisRIGHT2LEFT 0x00
+#define sisTOP2BOTTOM 0x20
+#define sisBOTTOM2TOP 0x00
+
+#define sisSRCSYSTEM 0x03
+#define sisSRCVIDEO 0x02
+#define sisSRCFG 0x01
+#define sisSRCBG 0x00
+
+#define sisCMDBLT 0x0000
+#define sisCMDBLTMSK 0x0100
+#define sisCMDCOLEXP 0x0200
+#define sisCMDLINE 0x0300
+
+#define sisCMDENHCOLEXP 0x2000
+
+#define sisXINCREASE 0x10
+#define sisYINCREASE 0x20
+#define sisCLIPENABL 0x40
+#define sisCLIPINTRN 0x80
+#define sisCLIPEXTRN 0x00
+
+
+#define sisPATREG 0x08
+#define sisPATFG 0x04
+#define sisPATBG 0x00
+
+#define sisLASTPIX 0x0800
+#define sisXMAJOR 0x0400
+
+ op = sisCMDBLT | sisLEFT2RIGHT | sisTOP2BOTTOM | sisSRCFG | sisPATFG;
+
+ sis->u.accel.cmd = op;
+
KdMarkSync (pScreen);
}
diff --git a/hw/kdrive/sis530/sisstub.c b/hw/kdrive/sis530/sisstub.c
index 2d014aef4..a0d28821e 100644
--- a/hw/kdrive/sis530/sisstub.c
+++ b/hw/kdrive/sis530/sisstub.c
@@ -26,12 +26,19 @@
#include "sis.h"
+static const int sisCards[] = { 0x6306, 0x0200 };
+
+#define numSisCards (sizeof (sisCards) / sizeof (sisCards[0]))
+
void
InitCard (char *name)
{
KdCardAttr attr;
- if (LinuxFindPci (0x1039, 0x6306, 0, &attr))
- KdCardInfoAdd (&sisFuncs, &attr, 0);
+ int i;
+
+ for (i = 0; i < numSisCards; i++)
+ if (LinuxFindPci (0x1039, sisCards[i], 0, &attr))
+ KdCardInfoAdd (&sisFuncs, &attr, (void *) sisCards[i]);
}
void
diff --git a/hw/kdrive/trio/s3.c b/hw/kdrive/trio/s3.c
index 07e6852b9..0076ea1ee 100644
--- a/hw/kdrive/trio/s3.c
+++ b/hw/kdrive/trio/s3.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/trio/s3.c,v 1.2 1999/12/30 03:03:19 robin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/trio/s3.c,v 1.4 2000/05/06 22:17:52 keithp Exp $ */
#include "s3.h"
@@ -429,11 +429,13 @@ s3ModeSupported (KdScreenInfo *screen,
if (t->horizontal != 1600 &&
t->horizontal != 1280 &&
t->horizontal != 1152 &&
+ t->horizontal != 1024 &&
t->horizontal != 800 &&
t->horizontal != 640)
return FALSE;
if (t->clock > S3_MAX_CLOCK * 2)
return FALSE;
+ return TRUE;
}
Bool