2005-07-01 10:56:12 +02:00
|
|
|
|
/*
|
|
|
|
|
* Copyright <EFBFBD> 2001 Keith Packard
|
|
|
|
|
*
|
|
|
|
|
* Partly based on code that is Copyright <EFBFBD> The XFree86 Project Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of Keith Packard not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2005-08-07 01:34:09 +02:00
|
|
|
|
#include <xorg-config.h>
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#endif
|
2006-02-02 21:09:14 +01:00
|
|
|
|
#include "exa_priv.h"
|
2005-07-03 09:02:09 +02:00
|
|
|
|
#include <X11/fonts/fontstruct.h>
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#include "dixfontstr.h"
|
|
|
|
|
#include "xf86str.h"
|
|
|
|
|
#include "xf86.h"
|
|
|
|
|
#include "exa.h"
|
2005-10-02 10:28:27 +02:00
|
|
|
|
#include "cw.h"
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2005-09-30 04:03:45 +02:00
|
|
|
|
static int exaGeneration;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
int exaScreenPrivateIndex;
|
|
|
|
|
int exaPixmapPrivateIndex;
|
|
|
|
|
|
2005-08-25 00:43:27 +02:00
|
|
|
|
/* Returns the offset (in bytes) within the framebuffer of the beginning of the
|
|
|
|
|
* given pixmap. May need to be extended in the future if we grow support for
|
|
|
|
|
* having multiple card-accessible areas at different offsets.
|
|
|
|
|
*/
|
|
|
|
|
unsigned long
|
|
|
|
|
exaGetPixmapOffset(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv (pPix->drawable.pScreen);
|
|
|
|
|
|
|
|
|
|
return ((unsigned long)pPix->devPrivate.ptr -
|
|
|
|
|
(unsigned long)pExaScr->info->card.memoryBase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns the pitch in bytes of the given pixmap. */
|
|
|
|
|
unsigned long
|
|
|
|
|
exaGetPixmapPitch(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
return pPix->devKind;
|
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2005-09-11 21:08:10 +02:00
|
|
|
|
/* Returns the size in bytes of the given pixmap in
|
|
|
|
|
* video memory. Only valid when the vram storage has been
|
|
|
|
|
* allocated
|
|
|
|
|
*/
|
|
|
|
|
unsigned long
|
|
|
|
|
exaGetPixmapSize(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPrivPtr pExaPixmap;
|
|
|
|
|
|
|
|
|
|
pExaPixmap = ExaGetPixmapPriv(pPix);
|
|
|
|
|
if (pExaPixmap != NULL)
|
|
|
|
|
return pExaPixmap->size;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-02 22:07:06 +01:00
|
|
|
|
PixmapPtr
|
|
|
|
|
exaGetDrawablePixmap(DrawablePtr pDrawable)
|
|
|
|
|
{
|
|
|
|
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
|
|
|
return pDrawable->pScreen->GetWindowPixmap ((WindowPtr) pDrawable);
|
|
|
|
|
else
|
|
|
|
|
return (PixmapPtr) pDrawable;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
void
|
|
|
|
|
exaDrawableDirty (DrawablePtr pDrawable)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPrivPtr pExaPixmap;
|
|
|
|
|
|
2006-02-02 22:07:06 +01:00
|
|
|
|
pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable));
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (pExaPixmap != NULL)
|
|
|
|
|
pExaPixmap->dirty = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
|
exaDestroyPixmap (PixmapPtr pPixmap)
|
|
|
|
|
{
|
|
|
|
|
if (pPixmap->refcnt == 1)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPriv (pPixmap);
|
|
|
|
|
if (pExaPixmap->area)
|
|
|
|
|
{
|
|
|
|
|
DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
|
|
|
|
|
(void*)pPixmap->drawable.id,
|
|
|
|
|
ExaGetPixmapPriv(pPixmap)->area->offset,
|
|
|
|
|
pPixmap->drawable.width,
|
|
|
|
|
pPixmap->drawable.height));
|
|
|
|
|
/* Free the offscreen area */
|
|
|
|
|
exaOffscreenFree (pPixmap->drawable.pScreen, pExaPixmap->area);
|
|
|
|
|
pPixmap->devPrivate = pExaPixmap->devPrivate;
|
|
|
|
|
pPixmap->devKind = pExaPixmap->devKind;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return fbDestroyPixmap (pPixmap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PixmapPtr
|
|
|
|
|
exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
|
|
|
|
|
{
|
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
|
ExaPixmapPrivPtr pExaPixmap;
|
|
|
|
|
int bpp;
|
2005-07-07 17:05:02 +02:00
|
|
|
|
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
|
2005-07-09 16:15:35 +02:00
|
|
|
|
ExaScreenPriv(pScreen);
|
2005-07-07 17:05:02 +02:00
|
|
|
|
|
2005-09-13 03:33:19 +02:00
|
|
|
|
if (w > 32767 || h > 32767)
|
|
|
|
|
return NullPixmap;
|
2005-10-20 23:45:40 +02:00
|
|
|
|
|
2005-07-09 16:15:35 +02:00
|
|
|
|
if (!pScrn->vtSema || pExaScr->swappedOut) {
|
2005-07-07 17:05:02 +02:00
|
|
|
|
pPixmap = pExaScr->SavedCreatePixmap(pScreen, w, h, depth);
|
2005-07-08 09:43:00 +02:00
|
|
|
|
} else {
|
|
|
|
|
bpp = BitsPerPixel (depth);
|
|
|
|
|
if (bpp == 32 && depth == 24)
|
|
|
|
|
{
|
|
|
|
|
int format;
|
|
|
|
|
for (format = 0; format < MAXFORMATS && pScrn->formats[format].depth; ++format)
|
|
|
|
|
if (pScrn->formats[format].depth == 24)
|
|
|
|
|
{
|
|
|
|
|
bpp = pScrn->formats[format].bitsPerPixel;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2005-07-08 09:43:00 +02:00
|
|
|
|
pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
if (!pPixmap)
|
|
|
|
|
return NULL;
|
|
|
|
|
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
- Don't try to upload 0 byte-per-pixel (PICT_a1) data using
RADEONHostDataBlit.
- Disable the shortcut for switching from 3d to 3d in radeon_exa.c. It
appears that we do need the cache flush here, thought it's not clear
why. Disable the 2d to 2d shortcut while here, since I'm unsure of what
we're doing. Exposed by the following bit:
- Bug #4485: Add a new routine, exaGlyphs, to handle font drawing. Glyphs
were being accumulated in from non-migratable scratch pixmaps, causing
the destination pixmap to move towards screen but the migration
necessary for source never to happen, leading to abysmal performance.
Instead, copy the scratch glyph data into a real pixmap first, then
composite from that into the destination, allowing for migration. time
ls -lR from programs/Xserver showed 26.9% (+/- 6.3%) decrease in wall
time (n=3).
- Create exaDrawableUse* wrapping exaPixmapUse*, but which are aware of
windows needing backing store. Makes migration code prettier, and
ensures that composited windows will be migrated as normal when we turn
off cw for EXA. (issue brought up by keithp)
2005-09-17 22:02:02 +02:00
|
|
|
|
|
|
|
|
|
/* Glyphs have w/h equal to zero, and may not be migrated. See exaGlyphs. */
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (!w || !h)
|
|
|
|
|
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
|
|
|
|
else
|
|
|
|
|
pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
|
|
|
|
|
|
|
|
|
|
pExaPixmap->area = NULL;
|
|
|
|
|
pExaPixmap->dirty = FALSE;
|
|
|
|
|
|
|
|
|
|
return pPixmap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bool
|
|
|
|
|
exaPixmapIsOffscreen(PixmapPtr p)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = p->drawable.pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
|
|
|
|
return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
|
|
|
|
|
(CARD8 *) pExaScr->info->card.memoryBase) <
|
|
|
|
|
pExaScr->info->card.memorySize);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-02 22:07:06 +01:00
|
|
|
|
Bool
|
|
|
|
|
exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
|
|
|
|
{
|
|
|
|
|
return exaPixmapIsOffscreen (exaGetDrawablePixmap (pDrawable));
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
PixmapPtr
|
|
|
|
|
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
|
|
|
|
{
|
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
if (pDrawable->type == DRAWABLE_WINDOW) {
|
|
|
|
|
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
|
|
|
#ifdef COMPOSITE
|
|
|
|
|
x = -pPixmap->screen_x;
|
|
|
|
|
y = -pPixmap->screen_y;
|
|
|
|
|
#else
|
|
|
|
|
x = 0;
|
|
|
|
|
y = 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pPixmap = (PixmapPtr) pDrawable;
|
|
|
|
|
x = 0;
|
|
|
|
|
y = 0;
|
|
|
|
|
}
|
|
|
|
|
*xp = x;
|
|
|
|
|
*yp = y;
|
|
|
|
|
if (exaPixmapIsOffscreen (pPixmap))
|
|
|
|
|
return pPixmap;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-11 21:08:10 +02:00
|
|
|
|
void
|
|
|
|
|
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = pDrawable->pScreen;
|
|
|
|
|
ExaScreenPriv (pScreen);
|
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
|
|
2006-02-02 22:07:06 +01:00
|
|
|
|
pPixmap = exaGetDrawablePixmap (pDrawable);
|
2005-09-11 21:08:10 +02:00
|
|
|
|
|
|
|
|
|
if (index == EXA_PREPARE_DEST)
|
|
|
|
|
exaDrawableDirty (pDrawable);
|
|
|
|
|
if (exaPixmapIsOffscreen (pPixmap))
|
|
|
|
|
exaWaitSync (pDrawable->pScreen);
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pExaScr->info->accel.PrepareAccess == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!(*pExaScr->info->accel.PrepareAccess) (pPixmap, index)) {
|
|
|
|
|
ExaPixmapPriv (pPixmap);
|
- Change migration-in rule slightly: previously, if your score was less
than the max, it was bumped, and then if you were above the threshhold
you got moved in. Instead, do the above-threshhold check separate from
score starting out less than max. While this will likely make thrashing
cases worse, I hope it will fix some issues with long term performance
(think of an xcompmgr with a backbuffer it's doing only accelerated
operations to. If some new pixmap comes in and bumps it out, even once,
it will never get a chance to re-migrate because its score will be
maxed). Change migration-out to be the same way for symmetry, though it
shouldn't ever affect anything.
- Fix a lot of debugging output, both in terms of printing quality, and
completeness. The fallback debugging covers a lot more now, pointing
out new areas for improvement. Debugging toggles are now centralized in
exaPriv.h.
2005-09-21 12:27:53 +02:00
|
|
|
|
if (pExaPixmap->score != EXA_PIXMAP_SCORE_PINNED)
|
|
|
|
|
FatalError("Driver failed PrepareAccess on a pinned pixmap\n");
|
2005-09-11 21:08:10 +02:00
|
|
|
|
exaMoveOutPixmap (pPixmap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
exaFinishAccess(DrawablePtr pDrawable, int index)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = pDrawable->pScreen;
|
|
|
|
|
ExaScreenPriv (pScreen);
|
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
|
|
|
|
|
|
if (pExaScr->info->accel.FinishAccess == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
2006-02-02 22:07:06 +01:00
|
|
|
|
pPixmap = exaGetDrawablePixmap (pDrawable);
|
2005-09-11 21:08:10 +02:00
|
|
|
|
if (!exaPixmapIsOffscreen (pPixmap))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
(*pExaScr->info->accel.FinishAccess) (pPixmap, index);
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
static void
|
|
|
|
|
exaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
|
|
|
|
|
{
|
|
|
|
|
fbValidateGC (pGC, changes, pDrawable);
|
|
|
|
|
|
|
|
|
|
if (exaDrawableIsOffscreen (pDrawable))
|
|
|
|
|
pGC->ops = (GCOps *) &exaOps;
|
|
|
|
|
else
|
|
|
|
|
pGC->ops = (GCOps *) &exaAsyncPixmapGCOps;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-30 04:03:45 +02:00
|
|
|
|
static GCFuncs exaGCFuncs = {
|
2005-07-01 10:56:12 +02:00
|
|
|
|
exaValidateGC,
|
|
|
|
|
miChangeGC,
|
|
|
|
|
miCopyGC,
|
|
|
|
|
miDestroyGC,
|
|
|
|
|
miChangeClip,
|
|
|
|
|
miDestroyClip,
|
|
|
|
|
miCopyClip
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
exaCreateGC (GCPtr pGC)
|
|
|
|
|
{
|
|
|
|
|
if (!fbCreateGC (pGC))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
pGC->funcs = &exaGCFuncs;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-04 16:15:57 +02:00
|
|
|
|
static Bool
|
|
|
|
|
exaCloseScreen(int i, ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
#ifdef RENDER
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
|
|
|
|
|
#endif
|
2005-07-09 16:15:35 +02:00
|
|
|
|
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
pScreen->CreateGC = pExaScr->SavedCreateGC;
|
|
|
|
|
pScreen->CloseScreen = pExaScr->SavedCloseScreen;
|
|
|
|
|
pScreen->GetImage = pExaScr->SavedGetImage;
|
|
|
|
|
pScreen->GetSpans = pExaScr->SavedGetSpans;
|
|
|
|
|
pScreen->PaintWindowBackground = pExaScr->SavedPaintWindowBackground;
|
|
|
|
|
pScreen->PaintWindowBorder = pExaScr->SavedPaintWindowBorder;
|
|
|
|
|
pScreen->CreatePixmap = pExaScr->SavedCreatePixmap;
|
|
|
|
|
pScreen->DestroyPixmap = pExaScr->SavedDestroyPixmap;
|
|
|
|
|
pScreen->CopyWindow = pExaScr->SavedCopyWindow;
|
|
|
|
|
#ifdef RENDER
|
|
|
|
|
if (ps) {
|
|
|
|
|
ps->Composite = pExaScr->SavedComposite;
|
2005-09-28 22:01:37 +02:00
|
|
|
|
ps->Glyphs = pExaScr->SavedGlyphs;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2005-07-09 16:15:35 +02:00
|
|
|
|
if (pExaScr->wrappedEnableDisableFB)
|
|
|
|
|
pScrn->EnableDisableFBAccess = pExaScr->SavedEnableDisableFBAccess;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
xfree (pExaScr);
|
|
|
|
|
|
|
|
|
|
return (*pScreen->CloseScreen) (i, pScreen);
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
Bool
|
|
|
|
|
exaDriverInit (ScreenPtr pScreen,
|
|
|
|
|
ExaDriverPtr pScreenInfo)
|
|
|
|
|
{
|
2005-07-09 16:15:35 +02:00
|
|
|
|
/* Do NOT use XF86SCRNINFO macro here!! */
|
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
2005-07-01 10:56:12 +02:00
|
|
|
|
ExaScreenPrivPtr pExaScr;
|
|
|
|
|
|
|
|
|
|
#ifdef RENDER
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
|
|
|
|
|
#endif
|
|
|
|
|
if (exaGeneration != serverGeneration)
|
|
|
|
|
{
|
|
|
|
|
exaScreenPrivateIndex = AllocateScreenPrivateIndex();
|
|
|
|
|
exaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
|
|
|
|
|
exaGeneration = serverGeneration;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-09 16:15:35 +02:00
|
|
|
|
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2005-08-26 22:21:57 +02:00
|
|
|
|
if (!pExaScr) {
|
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
|
|
|
|
"EXA: Failed to allocate screen private\n");
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return FALSE;
|
2005-08-26 22:21:57 +02:00
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->info = pScreenInfo;
|
|
|
|
|
|
|
|
|
|
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Replace various fb screen functions
|
|
|
|
|
*/
|
2005-07-04 16:15:57 +02:00
|
|
|
|
pExaScr->SavedCloseScreen = pScreen->CloseScreen;
|
|
|
|
|
pScreen->CloseScreen = exaCloseScreen;
|
|
|
|
|
|
|
|
|
|
pExaScr->SavedCreateGC = pScreen->CreateGC;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pScreen->CreateGC = exaCreateGC;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->SavedGetImage = pScreen->GetImage;
|
|
|
|
|
pScreen->GetImage = ExaCheckGetImage;
|
|
|
|
|
|
|
|
|
|
pExaScr->SavedGetSpans = pScreen->GetSpans;
|
|
|
|
|
pScreen->GetSpans = ExaCheckGetSpans;
|
|
|
|
|
|
|
|
|
|
pExaScr->SavedCopyWindow = pScreen->CopyWindow;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pScreen->CopyWindow = exaCopyWindow;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->SavedPaintWindowBackground = pScreen->PaintWindowBackground;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pScreen->PaintWindowBackground = exaPaintWindow;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->SavedPaintWindowBorder = pScreen->PaintWindowBorder;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pScreen->PaintWindowBorder = exaPaintWindow;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas;
|
|
|
|
|
pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#ifdef RENDER
|
|
|
|
|
if (ps) {
|
2005-07-04 16:15:57 +02:00
|
|
|
|
pExaScr->SavedComposite = ps->Composite;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
ps->Composite = exaComposite;
|
- Don't try to upload 0 byte-per-pixel (PICT_a1) data using
RADEONHostDataBlit.
- Disable the shortcut for switching from 3d to 3d in radeon_exa.c. It
appears that we do need the cache flush here, thought it's not clear
why. Disable the 2d to 2d shortcut while here, since I'm unsure of what
we're doing. Exposed by the following bit:
- Bug #4485: Add a new routine, exaGlyphs, to handle font drawing. Glyphs
were being accumulated in from non-migratable scratch pixmaps, causing
the destination pixmap to move towards screen but the migration
necessary for source never to happen, leading to abysmal performance.
Instead, copy the scratch glyph data into a real pixmap first, then
composite from that into the destination, allowing for migration. time
ls -lR from programs/Xserver showed 26.9% (+/- 6.3%) decrease in wall
time (n=3).
- Create exaDrawableUse* wrapping exaPixmapUse*, but which are aware of
windows needing backing store. Makes migration code prettier, and
ensures that composited windows will be migrated as normal when we turn
off cw for EXA. (issue brought up by keithp)
2005-09-17 22:02:02 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->SavedGlyphs = ps->Glyphs;
|
|
|
|
|
ps->Glyphs = exaGlyphs;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-10-02 10:28:27 +02:00
|
|
|
|
miDisableCompositeWrapper(pScreen);
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
/*
|
|
|
|
|
* Hookup offscreen pixmaps
|
|
|
|
|
*/
|
|
|
|
|
if ((pExaScr->info->card.flags & EXA_OFFSCREEN_PIXMAPS) &&
|
|
|
|
|
pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize)
|
|
|
|
|
{
|
|
|
|
|
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
|
2005-08-26 22:21:57 +02:00
|
|
|
|
sizeof (ExaPixmapPrivRec))) {
|
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
|
|
|
|
"EXA: Failed to allocate pixmap private\n");
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return FALSE;
|
2005-08-26 22:21:57 +02:00
|
|
|
|
}
|
2005-07-04 16:15:57 +02:00
|
|
|
|
pExaScr->SavedCreatePixmap = pScreen->CreatePixmap;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pScreen->CreatePixmap = exaCreatePixmap;
|
2005-07-04 16:15:57 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->SavedDestroyPixmap = pScreen->DestroyPixmap;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pScreen->DestroyPixmap = exaDestroyPixmap;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-08-26 22:21:57 +02:00
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_INFO, "EXA: No offscreen pixmaps\n");
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, 0))
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 15:30:29 +02:00
|
|
|
|
DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->card.offScreenBase,
|
|
|
|
|
pExaScr->info->card.memorySize));
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize) {
|
2005-08-26 22:21:57 +02:00
|
|
|
|
if (!exaOffscreenInit (pScreen)) {
|
|
|
|
|
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
|
|
|
|
"EXA: Offscreen pixmap setup failed\n");
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return FALSE;
|
2005-08-26 22:21:57 +02:00
|
|
|
|
}
|
2005-07-09 16:15:35 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
|
|
|
|
|
pScrn->EnableDisableFBAccess = exaEnableDisableFBAccess;
|
|
|
|
|
pExaScr->wrappedEnableDisableFB = TRUE;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
exaDriverFini (ScreenPtr pScreen)
|
|
|
|
|
{
|
2005-07-04 16:15:57 +02:00
|
|
|
|
/*right now does nothing*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void exaMarkSync(ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
ExaCardInfoPtr card = &(pExaScr->info->card);
|
|
|
|
|
|
|
|
|
|
card->needsSync = TRUE;
|
|
|
|
|
if (pExaScr->info->accel.MarkSync != NULL) {
|
|
|
|
|
card->lastMarker = (*pExaScr->info->accel.MarkSync)(pScreen);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void exaWaitSync(ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
ExaCardInfoPtr card = &(pExaScr->info->card);
|
2005-07-07 17:05:02 +02:00
|
|
|
|
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2005-07-07 17:05:02 +02:00
|
|
|
|
if (card->needsSync && pScrn->vtSema) {
|
2005-07-01 10:56:12 +02:00
|
|
|
|
(*pExaScr->info->accel.WaitMarker)(pScreen, card->lastMarker);
|
|
|
|
|
card->needsSync = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int exaGetVersion(void)
|
|
|
|
|
{
|
|
|
|
|
return EXA_VERSION;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef XFree86LOADER
|
|
|
|
|
static MODULESETUPPROTO(exaSetup);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const OptionInfoRec EXAOptions[] = {
|
|
|
|
|
{ -1, NULL,
|
|
|
|
|
OPTV_NONE, {0}, FALSE }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
|
|
|
|
static const OptionInfoRec *
|
|
|
|
|
EXAAvailableOptions(void *unused)
|
|
|
|
|
{
|
|
|
|
|
return (EXAOptions);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static XF86ModuleVersionInfo exaVersRec =
|
|
|
|
|
{
|
|
|
|
|
"exa",
|
|
|
|
|
MODULEVENDORSTRING,
|
|
|
|
|
MODINFOSTRING1,
|
|
|
|
|
MODINFOSTRING2,
|
|
|
|
|
XORG_VERSION_CURRENT,
|
|
|
|
|
1, 2, 0,
|
|
|
|
|
ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
|
|
|
|
|
ABI_VIDEODRV_VERSION,
|
|
|
|
|
MOD_CLASS_NONE,
|
|
|
|
|
{0,0,0,0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
XF86ModuleData exaModuleData = { &exaVersRec, exaSetup, NULL };
|
|
|
|
|
|
|
|
|
|
ModuleInfoRec EXA = {
|
|
|
|
|
1,
|
|
|
|
|
"EXA",
|
|
|
|
|
NULL,
|
|
|
|
|
0,
|
|
|
|
|
EXAAvailableOptions,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
|
|
|
|
static pointer
|
|
|
|
|
exaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
|
|
|
|
|
{
|
|
|
|
|
static Bool Initialised = FALSE;
|
|
|
|
|
|
|
|
|
|
if (!Initialised) {
|
|
|
|
|
Initialised = TRUE;
|
|
|
|
|
#ifndef REMOVE_LOADER_CHECK_MODULE_INFO
|
|
|
|
|
if (xf86LoaderCheckSymbol("xf86AddModuleInfo"))
|
|
|
|
|
#endif
|
|
|
|
|
xf86AddModuleInfo(&EXA, Module);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (pointer)TRUE;
|
|
|
|
|
}
|
|
|
|
|
#endif
|