From f4bcd36a386116c450ea6893ab3d08e81cea663b Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 15 Oct 2003 05:34:54 +0000 Subject: Add a memory_base variable and use it. --- hw/kdrive/mach64/mach64.c | 2 +- hw/kdrive/mach64/mach64.h | 1 - hw/kdrive/mach64/mach64draw.c | 4 ++-- hw/kdrive/mga/mga.c | 4 ++-- hw/kdrive/mga/mga.h | 1 - hw/kdrive/mga/mgadraw.c | 6 +++--- hw/kdrive/src/kaa.c | 4 ++-- hw/kdrive/src/kdrive.h | 1 + 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c index 06818f8f2..a036f3e1d 100644 --- a/hw/kdrive/mach64/mach64.c +++ b/hw/kdrive/mach64/mach64.c @@ -70,7 +70,7 @@ mach64ScreenInit (KdScreenInfo *screen) screen->dumb = TRUE; if (mach64s->vesa.mapping != VESA_LINEAR) screen->dumb = TRUE; - mach64s->screen = mach64s->vesa.fb; + screen->memory_base = mach64s->vesa.fb; switch (screen->fb[0].depth) { case 8: mach64s->colorKey = 0xff; diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h index b28ac9b0d..38ddb9ae9 100644 --- a/hw/kdrive/mach64/mach64.h +++ b/hw/kdrive/mach64/mach64.h @@ -560,7 +560,6 @@ Bool mach64InitVideo(ScreenPtr pScreen); typedef struct _mach64ScreenInfo { VesaScreenPrivRec vesa; - CARD8 *screen; CARD32 DP_PIX_WIDTH; CARD32 DP_SET_GUI_ENGINE; Bool bpp24; diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c index 13c4a12ea..aa065c5a8 100644 --- a/hw/kdrive/mach64/mach64draw.c +++ b/hw/kdrive/mach64/mach64draw.c @@ -116,7 +116,7 @@ mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) if (triple) DST_PITCH *= 3; /* bytes / 8 */ - DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - mach64s->screen) >> 3; + DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3; mach64WaitAvail(reg, wait + (pSrc ? 5 : 4)); reg->DP_SET_GUI_ENGINE = mach64s->DP_SET_GUI_ENGINE | (combo << 20); @@ -131,7 +131,7 @@ mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) if (triple) SRC_PITCH *= 3; /* bytes / 8 */ - SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - mach64s->screen) >> 3; + SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3; reg->SRC_OFF_PITCH = ((SRC_OFFSET << 0) | (SRC_PITCH << 22) | diff --git a/hw/kdrive/mga/mga.c b/hw/kdrive/mga/mga.c index 05994dae8..2c3a4831d 100644 --- a/hw/kdrive/mga/mga.c +++ b/hw/kdrive/mga/mga.c @@ -74,8 +74,8 @@ mgaScreenInit (KdScreenInfo *screen) screen->dumb = TRUE; fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping); -#endif - mgas->screen = mgas->vesa.fb; +#endif + screen->memory_base = mgas->vesa.fb; memory = mgas->vesa.fb_size; screen_size = screen->fb[0].byteStride * screen->height; diff --git a/hw/kdrive/mga/mga.h b/hw/kdrive/mga/mga.h index 8a4eb9f08..ff9716d85 100644 --- a/hw/kdrive/mga/mga.h +++ b/hw/kdrive/mga/mga.h @@ -96,7 +96,6 @@ typedef struct _mgaCardInfo { typedef struct _mgaScreenInfo { VesaScreenPrivRec vesa; - CARD8 *screen; int pitch; int pw; diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c index 29678db6c..b41c5c16a 100644 --- a/hw/kdrive/mga/mgadraw.c +++ b/hw/kdrive/mga/mgadraw.c @@ -102,7 +102,7 @@ mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO | MGA_DWGCTL_SHIFTZERO | mgaRop[alu]; - dst_org = (int)pPixmap->devPrivate.ptr - (int)mgas->screen; + dst_org = (int)pPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base; mgaSetup (pPixmap->drawable.pScreen, 5); @@ -152,8 +152,8 @@ mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, 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_SRCORG, ((int)pSrcPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base)); + MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base)); MGA_OUT32 (mmio, MGA_REG_PITCH, pDstPixmap->devKind / (pDstPixmap->drawable.bitsPerPixel >> 3)); src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3); diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c index e85cfe65d..139c9fcf1 100644 --- a/hw/kdrive/src/kaa.c +++ b/hw/kdrive/src/kaa.c @@ -135,11 +135,11 @@ kaaPixmapAllocArea (PixmapPtr pPixmap) ScreenPtr pScreen = pPixmap->drawable.pScreen; KaaScreenPriv (pScreen); KaaPixmapPriv (pPixmap); + KdScreenPriv (pScreen); int bpp = pPixmap->drawable.bitsPerPixel; CARD16 h = pPixmap->drawable.height; CARD16 w = pPixmap->drawable.width; int pitch = KaaPixmapPitch (w); - PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap)(pScreen); pKaaPixmap->devKind = pPixmap->devKind; pKaaPixmap->devPrivate = pPixmap->devPrivate; @@ -157,7 +157,7 @@ kaaPixmapAllocArea (PixmapPtr pPixmap) pPixmap->drawable.width, pPixmap->drawable.height)); pPixmap->devKind = pitch * (bpp >> 3); - pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPixmap->devPrivate.ptr + pKaaPixmap->area->offset); + pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset); pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; return TRUE; } diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 71d58e009..df59bb972 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -118,6 +118,7 @@ typedef struct _KdScreenInfo { int mynum; DDXPointRec origin; KdFrameBuffer fb[KD_MAX_FB]; + CARD8 *memory_base; int off_screen_base; int off_screen_size; pointer off_screen_areas; -- cgit v1.2.3