summaryrefslogtreecommitdiff
path: root/hw/kdrive/savage
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kdrive/savage')
-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
6 files changed, 230 insertions, 350 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;
}
}