[xserver-commit] xserver/hw/kdrive/src Makefile.am,1.5,1.5.2.1 kaa.c,1.14.2.1,1.14.2.2 kasync.c,1.13,1.13.2.1 kdrive.c,1.35,1.35.2.1 kdrive.h,1.40,1.40.2.1 koffscreen.c,1.8.2.1,1.8.2.2
Keith Packard
xserver-commit@pdx.freedesktop.org
Tue, 21 Oct 2003 23:00:52 -0700
Committed by: keithp
Update of /cvs/xserver/xserver/hw/kdrive/src
In directory pdx:/tmp/cvs-serv16351/hw/kdrive/src
Modified Files:
Tag: xfixes_2_branch
Makefile.am kaa.c kasync.c kdrive.c kdrive.h koffscreen.c
Log Message:
* configure.ac:
Build damage infrastructure. Don't build layer
* fb/fbcopy.c: (fbCopyNtoN), (fbCopyArea):
Move check for 24/32 copy to fbCopyNtoN so that other users will hit
it
* hw/kdrive/fbdev/Makefile.am:
* hw/kdrive/fbdev/fbdev.c: (fbdevScreenInitialize),
(fbdevGetPixmap), (fbdevPixmapSet), (fbdevRandRSetConfig),
(fbdevInitScreen), (fbdevFinishInitScreen):
* hw/kdrive/fbdev/fbdev.h:
Eliminate miext/layer
* hw/kdrive/linux/Makefile.am:
Build damage infrastructure. Don't build layer
* hw/kdrive/mach64/Makefile.am:
Build damage infrastructure. Don't build layer
* hw/kdrive/mach64/mach64.c: (mach64ScreenInit),
(mach64InitScreen), (mach64ScreenFini), (mach64CardFini):
* hw/kdrive/mach64/mach64.h:
* hw/kdrive/mach64/mach64draw.c: (mach64DrawFini):
* hw/kdrive/mach64/mach64video.c: (mach64InitVideo),
(mach64FiniVideo):
Memory leak fix of mach64c on server reset
Memory leak fix for video on server reset.
Eliminate layer
* hw/kdrive/mga/Makefile.am:
* hw/kdrive/mga/mga.c: (mgaScreenInit):
Build damage infrastructure. Don't build layer
* hw/kdrive/nvidia/Makefile.am:
* hw/kdrive/nvidia/nvidia.c: (nvidiaRandRSetConfig),
(nvidiaPreserve), (nvidiaEnable):
Build damage infrastructure. Don't build layer
* hw/kdrive/r128/Makefile.am:
* hw/kdrive/smi/Makefile.am:
Build damage infrastructure. Don't build layer
* hw/kdrive/src/Makefile.am:
Build damage infrastructure. Don't build layer
* hw/kdrive/src/kaa.c: (kaaDestroyPixmap), (kaaCreatePixmap),
(kaaPixmapIsOffscreen), (kaaGetOffscreenPixmap),
(kaaDrawableIsOffscreen), (kaaFillSpans), (kaaCopyNtoN),
(kaaPolyFillRect), (kaaSolidBoxClipped), (kaaValidateGC),
(kaaFillRegionSolid), (kaaDrawInit), (kaaDrawFini):
Don't assume windows are onscreen, use GetWindowPixmap
and test devPrivate.ptr. Make sure depth 24 pixmaps are 24bpp
when hardware format is 24bpp.
* hw/kdrive/src/kasync.c:
Get rid of debug KdAssertSync function
* hw/kdrive/src/kdrive.c: (KdCloseScreen), (KdScreenInit):
* hw/kdrive/src/kdrive.h:
* hw/kdrive/src/koffscreen.c: (KdOffscreenValidate),
(KdOffscreenAlloc), (KdOffscreenInit):
add memory_size to KdScreenInfo, eliminate off_screen_size,
fix tests to suit.
* hw/kdrive/vesa/Makefile.am:
* hw/kdrive/vesa/vesa.c: (vesaScreenInitialize), (vesaUpdateMono),
(vesaGetPixmap), (vesaMapFramebuffer), (vesaPixmapSet),
(vesaRandRSetConfig), (vesaInitScreen), (vesaFinishInitScreen),
(vesaScreenFini):
* hw/kdrive/vesa/vesa.h:
Build damage infrastructure. Don't build layer
* hw/xnest/Makefile.am:
Use damage (for software cursor, I guess)
* mi/Makefile.am:
* mi/misprite.c: (miSpriteReportDamage), (miSpriteCopyWindow):
* mi/mispritest.h:
Damage is used for software cursor
* miext/Makefile.am:
* miext/layer/Makefile.am:
* miext/layer/layerinit.c: (layerCloseScreen):
Build damage infrastructure. Don't build layer
* miext/shadow/Makefile.am:
* miext/shadow/shadow.c: (shadowRedisplay), (shadowGetImage),
(shadowCloseScreen), (shadowSetup), (shadowSet), (shadowUnset),
(shadowInit):
* miext/shadow/shadow.h:
* miext/shadow/shpacked.c: (shadowUpdatePacked):
* miext/shadow/shplanar.c: (shadowUpdatePlanar4):
* miext/shadow/shplanar8.c: (shadowUpdatePlanar4x8):
* miext/shadow/shrotate.c: (shadowUpdateRotatePacked):
* miext/shadow/shrotpack.h:
Use damage to track changes
* xfixes/xfixes.c: (XFixesResetProc):
Fix memory leak
Index: Makefile.am
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- Makefile.am 13 Oct 2003 00:19:58 -0000 1.5
+++ Makefile.am 22 Oct 2003 06:00:49 -0000 1.5.2.1
@@ -2,6 +2,7 @@
-I$(top_srcdir)/fb \
-I$(top_srcdir)/mi \
-I$(top_srcdir)/miext/shadow \
+ -I$(top_srcdir)/miext/damage \
-I$(top_srcdir)/randr \
-I$(top_srcdir)/render \
$(XSERVER_CFLAGS)
Index: kaa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.c,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -u -d -r1.14.2.1 -r1.14.2.2
--- kaa.c 19 Oct 2003 20:48:16 -0000 1.14.2.1
+++ kaa.c 22 Oct 2003 06:00:49 -0000 1.14.2.2
@@ -50,10 +50,6 @@
typedef struct {
KaaScreenInfoPtr info;
-
- CreatePixmapProcPtr CreatePixmap;
- DestroyPixmapProcPtr DestroyPixmap;
- int pixelOffset; /* offset from pPixmap to pixels */
} KaaScreenPrivRec, *KaaScreenPrivPtr;
typedef struct {
@@ -71,22 +67,10 @@
#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr)
#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
-#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
-#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
-#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)) && \
- KaaGetPixmapPriv((PixmapPtr)(d))->area)
-#define KaaDrawableIsScreen(d) (((d)->type == DRAWABLE_WINDOW) || \
- KaaDrawableIsOffscreenPixmap(d))
-
-#define KAA_SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
- ((KaaScreenPrivPtr) (pScreen)->devPrivates[kaaScreenPrivateIndex].ptr)->field)
-
-#define KAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\
- ((pScreen)->field = wrapper)
+#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
+#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
+#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
+#define KaaPixmapPitch(w) (((w) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1))
#define MIN_OFFPIX_SIZE (4096)
@@ -268,9 +252,7 @@
}
}
- KAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- ret = (*pScreen->DestroyPixmap) (pPixmap);
- KAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, kaaDestroyPixmap);
+ ret = fbDestroyPixmap (pPixmap);
return ret;
}
@@ -278,12 +260,24 @@
static PixmapPtr
kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
{
- PixmapPtr pPixmap = NULL;
+ PixmapPtr pPixmap;
KaaPixmapPrivPtr pKaaPixmap;
+ int bpp;
- KAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPixmap = (* pScreen->CreatePixmap) (pScreen, w, h, depth);
- KAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, kaaCreatePixmap);
+ bpp = BitsPerPixel (depth);
+ if (bpp == 32 && depth == 24)
+ {
+ int fb;
+ KdScreenPriv (pScreen);
+
+ for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+ if (pScreenPriv->screen->fb[fb].depth == 24)
+ {
+ bpp = pScreenPriv->screen->fb[fb].bitsPerPixel;
+ break;
+ }
+ }
+ pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
if (!pPixmap)
return NULL;
pKaaPixmap = KaaGetPixmapPriv(pPixmap);
@@ -295,27 +289,52 @@
return pPixmap;
}
-PixmapPtr
-kaaGetDrawingPixmap (DrawablePtr pDrawable, int *x, int *y)
+static Bool
+kaaPixmapIsOffscreen(PixmapPtr p)
{
+ ScreenPtr pScreen = p->drawable.pScreen;
+ KdScreenPriv(pScreen);
+
+ return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
+ (CARD8 *) pScreenPriv->screen->memory_base) <
+ pScreenPriv->screen->memory_size);
+}
+
+static PixmapPtr
+kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
+{
+ PixmapPtr pPixmap;
+ int x = 0, y = 0;
+
if (pDrawable->type == DRAWABLE_WINDOW) {
+ pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
if (x)
- *x = pDrawable->x;
+ x += pDrawable->x;
if (y)
- *y = pDrawable->y;
-
- return (*pDrawable->pScreen->GetScreenPixmap) (pDrawable->pScreen);
+ y += pDrawable->y;
}
- else if (KaaDrawableIsOffscreenPixmap (pDrawable))
+ else
+ pPixmap = (PixmapPtr) pDrawable;
+ if (kaaPixmapIsOffscreen (pPixmap))
{
- if (x)
- *x = 0;
- if (y)
- *y = 0;
- return ((PixmapPtr)pDrawable);
+ x += pPixmap->drawable.x;
+ y += pPixmap->drawable.y;
+ if (xp) *xp = x;
+ if (yp) *yp = y;
+ return pPixmap;
}
+ return NULL;
+}
+
+static Bool
+kaaDrawableIsOffscreen (DrawablePtr pDrawable)
+{
+ PixmapPtr pPixmap;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
else
- return NULL;
+ pPixmap = (PixmapPtr) pDrawable;
+ return kaaPixmapIsOffscreen (pPixmap);
}
void
@@ -335,7 +354,7 @@
if (!pScreenPriv->enabled ||
pGC->fillStyle != FillSolid ||
- !(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) ||
+ !(pPixmap = kaaGetOffscreenPixmap (pDrawable, NULL, NULL)) ||
!(*pKaaScr->info->PrepareSolid) (pPixmap,
pGC->alu,
pGC->planemask,
@@ -389,7 +408,8 @@
if (partX2 > fullX2)
partX2 = fullX2;
if (partX2 > partX1)
- (*pKaaScr->info->Solid) (partX1, fullY1, partX2, fullY1 + 1);
+ (*pKaaScr->info->Solid) (partX1, fullY1,
+ partX2, fullY1 + 1);
}
pbox++;
}
@@ -418,15 +438,15 @@
/* Migrate pixmaps to same place as destination */
if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if (KaaDrawableIsScreen (pDstDrawable))
+ if (kaaDrawableIsOffscreen (pDstDrawable))
kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable);
else
kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable);
}
if (pScreenPriv->enabled &&
- (pSrcPixmap = kaaGetDrawingPixmap (pSrcDrawable, NULL, NULL)) &&
- (pDstPixmap = kaaGetDrawingPixmap (pDstDrawable, NULL, NULL)) &&
+ (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, NULL, NULL)) &&
+ (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, NULL, NULL)) &&
(*pKaaScr->info->PrepareCopy) (pSrcPixmap,
pDstPixmap,
dx,
@@ -483,7 +503,7 @@
if (!pScreenPriv->enabled ||
pGC->fillStyle != FillSolid ||
- !(pPixmap = kaaGetDrawingPixmap (pDrawable, &xorg, &yorg)) ||
+ !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xorg, &yorg)) ||
!(*pKaaScr->info->PrepareSolid) (pPixmap,
pGC->alu,
pGC->planemask,
@@ -577,7 +597,7 @@
int partX1, partX2, partY1, partY2;
if (!pScreenPriv->enabled ||
- !(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) ||
+ !(pPixmap = kaaGetOffscreenPixmap (pDrawable, NULL, NULL)) ||
!(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
{
KdCheckSync (pDrawable->pScreen);
@@ -781,7 +801,7 @@
{
fbValidateGC (pGC, changes, pDrawable);
- if (KaaDrawableIsScreen (pDrawable))
+ if (kaaDrawableIsOffscreen (pDrawable))
pGC->ops = (GCOps *) &kaaOps;
else
pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
@@ -843,7 +863,7 @@
PixmapPtr pPixmap;
if (pScreenPriv->enabled &&
- (pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) &&
+ (pPixmap = kaaGetOffscreenPixmap (pDrawable, NULL, NULL)) &&
(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
{
int nbox = REGION_NUM_RECTS (pRegion);
@@ -933,7 +953,8 @@
KaaScreenInfoPtr pScreenInfo)
{
KaaScreenPrivPtr pKaaScr;
- KdScreenInfo *screen = KdGetScreenPriv (pScreen)->screen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
@@ -974,15 +995,13 @@
* Hookup offscreen pixmaps
*/
if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
- screen->off_screen_size > 0)
+ screen->off_screen_base < screen->memory_size)
{
- pKaaScr->CreatePixmap = pScreen->CreatePixmap;
- pScreen->CreatePixmap = kaaCreatePixmap;
- pKaaScr->DestroyPixmap = pScreen->DestroyPixmap;
- pScreen->DestroyPixmap = kaaDestroyPixmap;
if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex,
sizeof (KaaPixmapPrivRec)))
return FALSE;
+ pScreen->CreatePixmap = kaaCreatePixmap;
+ pScreen->DestroyPixmap = kaaDestroyPixmap;
}
else
{
@@ -993,3 +1012,10 @@
return TRUE;
}
+void
+kaaDrawFini (ScreenPtr pScreen)
+{
+ KaaScreenPriv(pScreen);
+
+ xfree (pKaaScr);
+}
Index: kasync.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kasync.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- kasync.c 14 Oct 2003 21:10:53 -0000 1.13
+++ kasync.c 22 Oct 2003 06:00:49 -0000 1.13.2.1
@@ -305,11 +305,3 @@
,NULL
#endif
};
-
-void
-KdAssertSync (ScreenPtr pScreen)
-{
- KdScreenPriv(pScreen);
- KdCardInfo *card = pScreenPriv->card;
- assert (!card->needSync);
-}
Index: kdrive.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kdrive.c,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -d -r1.35 -r1.35.2.1
--- kdrive.c 14 Oct 2003 21:10:53 -0000 1.35
+++ kdrive.c 22 Oct 2003 06:00:49 -0000 1.35.2.1
@@ -844,7 +844,7 @@
pScreen->CloseScreen = pScreenPriv->CloseScreen;
ret = (*pScreen->CloseScreen) (index, pScreen);
- if (screen->off_screen_size > 0)
+ if (screen->off_screen_base < screen->memory_size)
KdOffscreenFini (pScreen);
if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
@@ -1130,7 +1130,7 @@
if (!(*card->cfuncs->initAccel) (pScreen))
screen->dumb = TRUE;
- if (screen->off_screen_size > 0)
+ if (screen->off_screen_base < screen->memory_size)
KdOffscreenInit (pScreen);
#ifdef PSEUDO8
Index: kdrive.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kdrive.h,v
retrieving revision 1.40
retrieving revision 1.40.2.1
diff -u -d -r1.40 -r1.40.2.1
--- kdrive.h 16 Oct 2003 08:03:25 -0000 1.40
+++ kdrive.h 22 Oct 2003 06:00:49 -0000 1.40.2.1
@@ -119,8 +119,8 @@
DDXPointRec origin;
KdFrameBuffer fb[KD_MAX_FB];
CARD8 *memory_base;
- int off_screen_base;
- int off_screen_size;
+ unsigned long memory_size;
+ unsigned long off_screen_base;
struct _RealOffscreenArea *off_screen_areas;
} KdScreenInfo;
@@ -352,6 +352,9 @@
KaaScreenInfoPtr pScreenInfo);
void
+kaaDrawFini (ScreenPtr pScreen);
+
+void
kaaWrapGC (GCPtr pGC);
void
Index: koffscreen.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/koffscreen.c,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -d -r1.8.2.1 -r1.8.2.2
--- koffscreen.c 19 Oct 2003 20:48:16 -0000 1.8.2.1
+++ koffscreen.c 22 Oct 2003 06:00:49 -0000 1.8.2.2
@@ -61,7 +61,7 @@
prev = area;
}
- assert (prev->area.offset + prev->area.size == pScreenPriv->screen->off_screen_size);
+ assert (prev->area.offset + prev->area.size == pScreenPriv->screen->memory_size);
}
#else
#define KdOffscreenValidate(s)
@@ -97,7 +97,7 @@
}
/* throw out requests that cannot fit */
- if (size > pScreenPriv->screen->off_screen_size)
+ if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base))
{
DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size));
return NULL;
@@ -280,7 +280,7 @@
area->area.screen = NULL;
area->area.offset = pScreenPriv->screen->off_screen_base;
- area->area.size = pScreenPriv->screen->off_screen_size;
+ area->area.size = pScreenPriv->screen->memory_size - area->area.offset;
area->save = 0;
area->locked = FALSE;
area->next = NULL;