summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@gnome.org>2003-10-13 02:19:47 +0000
committerAnders Carlsson <andersca@gnome.org>2003-10-13 02:19:47 +0000
commit44f2e82f1b463e272f4e521561f74eb14bf24082 (patch)
treed8f20927538ab4f63b313905d3407c3513f57148
parent47a9fab5e286c5224047690482a2cb36a3c17b88 (diff)
Use pixmaps instead of drawables in the kaa functions. Have the mga server
support accelerated operations on offscreen pixmaps.
-rw-r--r--hw/kdrive/mga/mgadraw.c71
-rw-r--r--hw/kdrive/src/kaa.c61
-rw-r--r--hw/kdrive/src/kdrive.h6
3 files changed, 69 insertions, 69 deletions
diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c
index cb77334d7..1f77ccf2f 100644
--- a/hw/kdrive/mga/mgadraw.c
+++ b/hw/kdrive/mga/mgadraw.c
@@ -92,33 +92,22 @@ mgaSetup (ScreenPtr pScreen, int wait)
}
Bool
-mgaPrepareSolid (DrawablePtr pDrawable, int alu, Pixel pm, Pixel fg)
+mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
{
- KdScreenPriv(pDrawable->pScreen);
+ KdScreenPriv(pPixmap->drawable.pScreen);
mgaScreenInfo (pScreenPriv);
int cmd;
+ int dst_org;
cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO |
MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
- mgaSetup (pDrawable->pScreen, 5);
-
- if (pDrawable->type == DRAWABLE_WINDOW)
- {
- MGA_OUT32 (mmio, MGA_REG_DSTORG, 0);
- MGA_OUT32 (mmio, MGA_REG_PITCH, pitch);
- }
- else
- {
- PixmapPtr pPixmap = (PixmapPtr)pDrawable;
- int dst_org;
-
- dst_org = (int)pPixmap->devPrivate.ptr - (int)mgas->screen;
-
- MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org);
- MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3));
- }
+ dst_org = (int)pPixmap->devPrivate.ptr - (int)mgas->screen;
+
+ mgaSetup (pPixmap->drawable.pScreen, 5);
+ MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org);
+ MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3));
MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
MGA_OUT32 (mmio, MGA_REG_FCOL, fg);
MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
@@ -144,8 +133,12 @@ mgaDoneSolid (void)
#define BLIT_UP 4
Bool
-mgaPrepareCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int dx, int dy, int alu, Pixel pm)
+mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap,
+ int dx, int dy, int alu, Pixel pm)
{
+ KdScreenPriv(pSrcPixmap->drawable.pScreen);
+ mgaScreenInfo (pScreenPriv);
+
int cmd;
cmd = MGA_OPCOD_BITBLT | MGA_DWGCTL_BFCOL | MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
@@ -157,39 +150,13 @@ mgaPrepareCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int dx, int
if (dx < 0)
dir |= BLIT_LEFT;
- mgaSetup (pDstDrawable->pScreen, 6);
-
- if (pSrcDrawable->type == DRAWABLE_WINDOW)
- {
- MGA_OUT32 (mmio, MGA_REG_SRCORG, 0);
-
- src_pitch = pitch;
- }
- else
- {
- KdScreenPriv(pSrcDrawable->pScreen);
- mgaScreenInfo (pScreenPriv);
- PixmapPtr pPixmap = (PixmapPtr)pSrcDrawable;
-
- MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pPixmap->devPrivate.ptr - (int)mgas->screen));
- src_pitch = pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3);
- }
-
- if (pDstDrawable->type == DRAWABLE_WINDOW)
- {
- MGA_OUT32 (mmio, MGA_REG_DSTORG, 0);
- MGA_OUT32 (mmio, MGA_REG_PITCH, pitch);
- }
- else
- {
- KdScreenPriv(pDstDrawable->pScreen);
- mgaScreenInfo (pScreenPriv);
- PixmapPtr pPixmap = (PixmapPtr)pDstDrawable;
-
- MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pPixmap->devPrivate.ptr - (int)mgas->screen));
- MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3));
- }
+ mgaSetup (pSrcPixmap->drawable.pScreen, 7);
+ MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pSrcPixmap->devPrivate.ptr - (int)mgas->screen));
+ MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr - (int)mgas->screen));
+ MGA_OUT32 (mmio, MGA_REG_PITCH, pDstPixmap->devKind / (pDstPixmap->drawable.bitsPerPixel >> 3));
+ src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3);
+
MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
MGA_OUT32 (mmio, MGA_REG_SGN, dir);
MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c
index 7de52589d..514cd224c 100644
--- a/hw/kdrive/src/kaa.c
+++ b/hw/kdrive/src/kaa.c
@@ -64,6 +64,9 @@ typedef struct {
#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv (p)
#define KaaPixmapPitch(w) (((w) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1))
+#define KaaDrawableIsOffscreenPixmap(d) (d->type == DRAWABLE_PIXMAP && \
+ KaaGetPixmapPriv ((PixmapPtr)(d))->offscreenArea != NULL && \
+ !KaaGetPixmapPriv ((PixmapPtr)(d))->offscreenArea->swappedOut)
#define KAA_SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
((KaaScreenPrivPtr) (pScreen)->devPrivates[kaaScreenPrivateIndex].ptr)->field)
@@ -107,7 +110,7 @@ kaaMoveInPixmap (KdOffscreenArea *area)
PixmapPtr pPixmap = area->privData;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
KaaScreenPriv (pScreen);
- PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+ PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
int dst_pitch, src_pitch;
unsigned char *dst, *src;
int i;
@@ -249,6 +252,28 @@ kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
return pPixmap;
}
+PixmapPtr
+kaaGetDrawingPixmap (DrawablePtr pDrawable, int *x, int *y)
+{
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ if (x)
+ *x = pDrawable->x;
+ if (y)
+ *y = pDrawable->y;
+
+ return (*pDrawable->pScreen->GetScreenPixmap) (pDrawable->pScreen);
+ }
+ else if (KaaDrawableIsOffscreenPixmap (pDrawable))
+ {
+ if (x)
+ *x = 0;
+ if (y)
+ *y = 0;
+ return ((PixmapPtr)pDrawable);
+ }
+ else
+ return NULL;
+}
void
kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
@@ -258,15 +283,17 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
KdScreenPriv (pScreen);
KaaScreenPriv (pScreen);
RegionPtr pClip = fbGetCompositeClip(pGC);
+ PixmapPtr pPixmap;
BoxPtr pextent, pbox;
int nbox;
int extentX1, extentX2, extentY1, extentY2;
int fullX1, fullX2, fullY1;
int partX1, partX2;
-
+
if (!pScreenPriv->enabled ||
pGC->fillStyle != FillSolid ||
- !(*pKaaScr->info->PrepareSolid) (pDrawable,
+ !(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) ||
+ !(*pKaaScr->info->PrepareSolid) (pPixmap,
pGC->alu,
pGC->planemask,
pGC->fgPixel))
@@ -344,6 +371,7 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable,
{
KdScreenPriv (pDstDrawable->pScreen);
KaaScreenPriv (pDstDrawable->pScreen);
+ PixmapPtr pSrcPixmap, pDstPixmap;
int srcX, srcY, dstX, dstY;
int w, h;
CARD32 flags;
@@ -351,9 +379,10 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable,
CARD8 alu;
if (pScreenPriv->enabled &&
- pSrcDrawable->type == DRAWABLE_WINDOW &&
- (*pKaaScr->info->PrepareCopy) (pSrcDrawable,
- pDstDrawable,
+ (pSrcPixmap = kaaGetDrawingPixmap (pSrcDrawable, NULL, NULL)) &&
+ (pDstPixmap = kaaGetDrawingPixmap (pDstDrawable, NULL, NULL)) &&
+ (*pKaaScr->info->PrepareCopy) (pSrcPixmap,
+ pDstPixmap,
dx,
dy,
pGC ? pGC->alu : GXcopy,
@@ -399,6 +428,7 @@ kaaPolyFillRect(DrawablePtr pDrawable,
KdScreenPriv (pDrawable->pScreen);
KaaScreenPriv (pDrawable->pScreen);
RegionPtr pClip = fbGetCompositeClip(pGC);
+ PixmapPtr pPixmap;
register BoxPtr pbox;
BoxPtr pextent;
int extentX1, extentX2, extentY1, extentY2;
@@ -406,10 +436,11 @@ kaaPolyFillRect(DrawablePtr pDrawable,
int partX1, partX2, partY1, partY2;
int xorg, yorg;
int n;
-
+
if (!pScreenPriv->enabled ||
pGC->fillStyle != FillSolid ||
- !(*pKaaScr->info->PrepareSolid) (pDrawable,
+ !(pPixmap = kaaGetDrawingPixmap (pDrawable, &xorg, &yorg)) ||
+ !(*pKaaScr->info->PrepareSolid) (pPixmap,
pGC->alu,
pGC->planemask,
pGC->fgPixel))
@@ -418,9 +449,6 @@ kaaPolyFillRect(DrawablePtr pDrawable,
return;
}
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-
pextent = REGION_EXTENTS(pGC->pScreen, pClip);
extentX1 = pextent->x1;
extentY1 = pextent->y1;
@@ -499,13 +527,15 @@ kaaSolidBoxClipped (DrawablePtr pDrawable,
{
KdScreenPriv (pDrawable->pScreen);
KaaScreenPriv (pDrawable->pScreen);
+ PixmapPtr pPixmap;
BoxPtr pbox;
int nbox;
int partX1, partX2, partY1, partY2;
CARD32 cmd;
if (!pScreenPriv->enabled ||
- !(*pKaaScr->info->PrepareSolid) (pDrawable, GXcopy, pm, fg))
+ !(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) ||
+ !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
{
KdCheckSync (pDrawable->pScreen);
fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
@@ -711,7 +741,8 @@ kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
fbValidateGC (pGC, changes, pDrawable);
- if (pDrawable->type == DRAWABLE_WINDOW)
+ if (pDrawable->type == DRAWABLE_WINDOW ||
+ KaaDrawableIsOffscreenPixmap (pDrawable))
pGC->ops = (GCOps *) &kaaOps;
else
pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
@@ -772,9 +803,11 @@ kaaFillRegionSolid (DrawablePtr pDrawable,
{
KdScreenPriv(pDrawable->pScreen);
KaaScreenPriv(pDrawable->pScreen);
+ PixmapPtr pPixmap;
if (pScreenPriv->enabled &&
- (*pKaaScr->info->PrepareSolid) (pDrawable, GXcopy, FB_ALLONES, pixel))
+ (pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) &&
+ (*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
{
int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion);
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index db0851ae5..a5702803a 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -278,15 +278,15 @@ typedef struct _KdMouseMatrix {
} KdMouseMatrix;
typedef struct _KaaScreenInfo {
- Bool (*PrepareSolid) (DrawablePtr pDrawable,
+ Bool (*PrepareSolid) (PixmapPtr pPixmap,
int alu,
Pixel planemask,
Pixel fg);
void (*Solid) (int x1, int y1, int x2, int y2);
void (*DoneSolid) (void);
- Bool (*PrepareCopy) (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
+ Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
Bool upsidedown,
Bool reverse,
int alu,