Rearrange EXA driver structures so that there's a hope of maintaining ABI

when extending the driver interface. The card and accel structures are
    merged into the ExaDriverRec, which is to be allocated using
    exaDriverAlloc(). The driver structure also grows exa_major and
    exa_minor, which drivers fill in and have checked by EXA
    (double-checking that the driver really did check that the EXA version
    was correct). Removes exaInitCard(), which is replaced by the driver
    filling in the rec by hand, and the exaGetVersion() and related
    EXA_*VERSION which are replaced by always using the XFree86 loadable
    module versioning.
This commit is contained in:
Eric Anholt 2006-03-09 06:04:07 +00:00
parent 65aa33f917
commit 2822cbc1fb
10 changed files with 319 additions and 285 deletions

View File

@ -1,3 +1,33 @@
2006-03-08 Eric Anholt <anholt@FreeBSD.org>
* exa/exa.c: (exaGetPixmapOffset), (exaPixmapIsOffscreen),
(exaPrepareAccess), (exaFinishAccess), (exaDriverAlloc),
(exaDriverInit), (exaMarkSync), (exaWaitSync):
* exa/exa.h:
* exa/exa_accel.c: (exaFillSpans), (exaCopyNtoNTwoDir),
(exaCopyNtoN), (exaPolyFillRect), (exaSolidBoxClipped),
(exaFillRegionSolid), (exaFillRegionTiled):
* exa/exa_migration.c: (exaPixmapSave), (exaPixmapAllocArea),
(exaMoveInPixmap):
* exa/exa_offscreen.c: (ExaOffscreenValidate), (exaOffscreenAlloc),
(ExaOffscreenSwapOut), (exaOffscreenFree), (ExaOffscreenMarkUsed),
(exaOffscreenInit), (ExaOffscreenFini):
* exa/exa_render.c: (exaTryDriverSolidFill),
(exaTryDriverComposite), (exaComposite), (exaGlyphs):
* hw/kdrive/ephyr/ephyr.h:
* hw/kdrive/ephyr/ephyr_draw.c: (ephyrDrawInit):
* hw/xfree86/exa/examodule.c:
Rearrange EXA driver structures so that there's a hope of maintaining
ABI when extending the driver interface. The card and accel structures
are merged into the ExaDriverRec, which is to be allocated using
exaDriverAlloc(). The driver structure also grows exa_major and
exa_minor, which drivers fill in and have checked by EXA
(double-checking that the driver really did check that the EXA version
was correct). Removes exaInitCard(), which is replaced by the driver
filling in the rec by hand, and the exaGetVersion() and related
EXA_*VERSION which are replaced by always using the XFree86 loadable
module versioning.
2006-03-08 Lars Knoll <lars@trolltech.com> 2006-03-08 Lars Knoll <lars@trolltech.com>
* render/picture.c * render/picture.c

View File

@ -48,7 +48,7 @@ exaGetPixmapOffset(PixmapPtr pPix)
ExaScreenPriv (pPix->drawable.pScreen); ExaScreenPriv (pPix->drawable.pScreen);
return ((unsigned long)pPix->devPrivate.ptr - return ((unsigned long)pPix->devPrivate.ptr -
(unsigned long)pExaScr->info->card.memoryBase); (unsigned long)pExaScr->info->memoryBase);
} }
/* Returns the pitch in bytes of the given pixmap. */ /* Returns the pitch in bytes of the given pixmap. */
@ -149,8 +149,8 @@ exaPixmapIsOffscreen(PixmapPtr p)
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
return ((unsigned long) ((CARD8 *) p->devPrivate.ptr - return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
(CARD8 *) pExaScr->info->card.memoryBase) < (CARD8 *) pExaScr->info->memoryBase) <
pExaScr->info->card.memorySize); pExaScr->info->memorySize);
} }
Bool Bool
@ -205,10 +205,10 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
else else
return; return;
if (pExaScr->info->accel.PrepareAccess == NULL) if (pExaScr->info->PrepareAccess == NULL)
return; return;
if (!(*pExaScr->info->accel.PrepareAccess) (pPixmap, index)) { if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
if (pExaPixmap->score != EXA_PIXMAP_SCORE_PINNED) if (pExaPixmap->score != EXA_PIXMAP_SCORE_PINNED)
FatalError("Driver failed PrepareAccess on a pinned pixmap\n"); FatalError("Driver failed PrepareAccess on a pinned pixmap\n");
@ -223,14 +223,14 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
ExaScreenPriv (pScreen); ExaScreenPriv (pScreen);
PixmapPtr pPixmap; PixmapPtr pPixmap;
if (pExaScr->info->accel.FinishAccess == NULL) if (pExaScr->info->FinishAccess == NULL)
return; return;
pPixmap = exaGetDrawablePixmap (pDrawable); pPixmap = exaGetDrawablePixmap (pDrawable);
if (!exaPixmapIsOffscreen (pPixmap)) if (!exaPixmapIsOffscreen (pPixmap))
return; return;
(*pExaScr->info->accel.FinishAccess) (pPixmap, index); (*pExaScr->info->FinishAccess) (pPixmap, index);
} }
static void static void
@ -294,12 +294,42 @@ exaCloseScreen(int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (i, pScreen); return (*pScreen->CloseScreen) (i, pScreen);
} }
/**
* This function allocates a driver structure for EXA drivers to fill in. By
* having EXA allocate the structure, the driver structure can be extended
* without breaking ABI between EXA and the drivers. The driver's
* responsibility is to check beforehand that the EXA module has a matching
* major number and sufficient minor. Drivers are responsible for freeing the
* driver structure using xfree().
*/
ExaDriverPtr
exaDriverAlloc(void)
{
return xcalloc(1, sizeof(ExaDriverRec));
}
/**
* exaDriverInit sets up EXA given a driver record filled in by the driver.
* See the comments in ExaDriverRec for what must be filled in and what is
* optional.
*/
Bool Bool
exaDriverInit (ScreenPtr pScreen, exaDriverInit (ScreenPtr pScreen,
ExaDriverPtr pScreenInfo) ExaDriverPtr pScreenInfo)
{ {
ExaScreenPrivPtr pExaScr; ExaScreenPrivPtr pExaScr;
if (pScreenInfo->exa_major != EXA_VERSION_MAJOR ||
pScreenInfo->exa_minor > EXA_VERSION_MINOR)
{
LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements "
"(%d.%d) are incompatible with EXA version (%d.%d)\n",
pScreen->myNum,
pScreenInfo->exa_major, pScreenInfo->exa_minor,
EXA_VERSION_MAJOR, EXA_VERSION_MINOR);
return FALSE;
}
#ifdef RENDER #ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif #endif
@ -365,8 +395,8 @@ exaDriverInit (ScreenPtr pScreen,
/* /*
* Hookup offscreen pixmaps * Hookup offscreen pixmaps
*/ */
if ((pExaScr->info->card.flags & EXA_OFFSCREEN_PIXMAPS) && if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize) pExaScr->info->offScreenBase < pExaScr->info->memorySize)
{ {
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
sizeof (ExaPixmapPrivRec))) { sizeof (ExaPixmapPrivRec))) {
@ -388,9 +418,9 @@ exaDriverInit (ScreenPtr pScreen,
return FALSE; return FALSE;
} }
DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->card.offScreenBase, DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
pExaScr->info->card.memorySize)); pExaScr->info->memorySize));
if (pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize) { if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
if (!exaOffscreenInit (pScreen)) { if (!exaOffscreenInit (pScreen)) {
LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n", LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n",
pScreen->myNum); pScreen->myNum);
@ -410,42 +440,19 @@ exaDriverFini (ScreenPtr pScreen)
void exaMarkSync(ScreenPtr pScreen) void exaMarkSync(ScreenPtr pScreen)
{ {
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
ExaCardInfoPtr card = &(pExaScr->info->card);
card->needsSync = TRUE; pExaScr->info->needsSync = TRUE;
if (pExaScr->info->accel.MarkSync != NULL) { if (pExaScr->info->MarkSync != NULL) {
card->lastMarker = (*pExaScr->info->accel.MarkSync)(pScreen); pExaScr->info->lastMarker = (*pExaScr->info->MarkSync)(pScreen);
} }
} }
void exaWaitSync(ScreenPtr pScreen) void exaWaitSync(ScreenPtr pScreen)
{ {
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
ExaCardInfoPtr card = &(pExaScr->info->card);
if (card->needsSync && !pExaScr->swappedOut) { if (pExaScr->info->needsSync && !pExaScr->swappedOut) {
(*pExaScr->info->accel.WaitMarker)(pScreen, card->lastMarker); (*pExaScr->info->WaitMarker)(pScreen, pExaScr->info->lastMarker);
card->needsSync = FALSE; pExaScr->info->needsSync = FALSE;
} }
} }
unsigned int exaGetVersion(void)
{
return EXA_VERSION;
}
void exaInitCard(ExaDriverPtr exa, int needsSync, CARD8 *memory_base,
unsigned long off_screen_base, unsigned long memory_size,
int offscreen_byte_align, int offscreen_pitch, int flags,
int max_x, int max_y)
{
exa->card.needsSync = needsSync;
exa->card.memoryBase = memory_base;
exa->card.offScreenBase = off_screen_base;
exa->card.memorySize = memory_size;
exa->card.pixmapOffsetAlign = offscreen_byte_align;
exa->card.pixmapPitchAlign = offscreen_pitch;
exa->card.flags = flags;
exa->card.maxX = max_x;
exa->card.maxY = max_y;
}

View File

@ -32,8 +32,8 @@
#include "gcstruct.h" #include "gcstruct.h"
#include "picturestr.h" #include "picturestr.h"
#define EXA_VERSION_MAJOR 0 #define EXA_VERSION_MAJOR 2
#define EXA_VERSION_MINOR 2 #define EXA_VERSION_MINOR 0
#define EXA_VERSION_RELEASE 0 #define EXA_VERSION_RELEASE 0
typedef struct _ExaOffscreenArea ExaOffscreenArea; typedef struct _ExaOffscreenArea ExaOffscreenArea;
@ -60,7 +60,19 @@ struct _ExaOffscreenArea {
ExaOffscreenArea *next; ExaOffscreenArea *next;
}; };
typedef struct _ExaCardInfo { /**
* The ExaDriver structure is allocated through exaDriverAlloc(), and then
* fllled in by drivers.
*/
typedef struct _ExaDriver {
/**
* exa_major and exa_minor should be set by the driver to the version of
* EXA which the driver was compiled for (or configures itself at runtime to
* support). This allows EXA to extend the structure for new features
* without breaking ABI for drivers compiled against older versions.
*/
int exa_major, exa_minor;
/* These are here because I don't want to be adding more to /* These are here because I don't want to be adding more to
* ScrnInfoRec */ * ScrnInfoRec */
CARD8 *memoryBase; CARD8 *memoryBase;
@ -87,9 +99,7 @@ typedef struct _ExaCardInfo {
ExaOffscreenArea *offScreenAreas; ExaOffscreenArea *offScreenAreas;
Bool needsSync; Bool needsSync;
int lastMarker; int lastMarker;
} ExaCardInfoRec, *ExaCardInfoPtr;
typedef struct _ExaAccelInfo {
/* PrepareSolid may fail if the pixmaps can't be accelerated to/from. /* PrepareSolid may fail if the pixmaps can't be accelerated to/from.
* This is an important feature for handling strange corner cases * This is an important feature for handling strange corner cases
* in hardware that are poorly expressed through flags. * in hardware that are poorly expressed through flags.
@ -196,25 +206,14 @@ typedef struct _ExaAccelInfo {
#define EXA_PREPARE_DEST 0 #define EXA_PREPARE_DEST 0
#define EXA_PREPARE_SRC 1 #define EXA_PREPARE_SRC 1
#define EXA_PREPARE_MASK 2 #define EXA_PREPARE_MASK 2
} ExaAccelInfoRec, *ExaAccelInfoPtr;
typedef struct _ExaDriver {
ExaCardInfoRec card;
ExaAccelInfoRec accel;
} ExaDriverRec, *ExaDriverPtr; } ExaDriverRec, *ExaDriverPtr;
#define EXA_OFFSCREEN_PIXMAPS (1 << 0) #define EXA_OFFSCREEN_PIXMAPS (1 << 0)
#define EXA_OFFSCREEN_ALIGN_POT (1 << 1) #define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2) #define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
#define EXA_MAKE_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c)) ExaDriverPtr
#define EXA_VERSION \ exaDriverAlloc(void);
EXA_MAKE_VERSION(EXA_VERSION_MAJOR, EXA_VERSION_MINOR, EXA_VERSION_RELEASE)
#define EXA_IS_VERSION(a,b,c) (EXA_VERSION >= EXA_MAKE_VERSION(a,b,c))
unsigned int
exaGetVersion(void);
Bool Bool
exaDriverInit(ScreenPtr pScreen, exaDriverInit(ScreenPtr pScreen,
@ -252,10 +251,4 @@ exaGetPixmapSize(PixmapPtr pPix);
void void
exaEnableDisableFBAccess (int index, Bool enable); exaEnableDisableFBAccess (int index, Bool enable);
void
exaInitCard(ExaDriverPtr exa, int needsSync, CARD8 *memory_base,
unsigned long off_screen_base, unsigned long memory_size,
int offscreen_byte_align, int offscreen_pitch, int flags,
int max_x, int max_y);
#endif /* EXA_H */ #endif /* EXA_H */

View File

@ -53,13 +53,13 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
} }
if (pGC->fillStyle != FillSolid || if (pGC->fillStyle != FillSolid ||
pDrawable->width > pExaScr->info->card.maxX || pDrawable->width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->card.maxY || pDrawable->height > pExaScr->info->maxY ||
!(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) ||
!(*pExaScr->info->accel.PrepareSolid) (pPixmap, !(*pExaScr->info->PrepareSolid) (pPixmap,
pGC->alu, pGC->alu,
pGC->planemask, pGC->planemask,
pGC->fgPixel)) pGC->fgPixel))
{ {
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
return; return;
@ -93,9 +93,9 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
nbox = REGION_NUM_RECTS (pClip); nbox = REGION_NUM_RECTS (pClip);
if (nbox == 1) if (nbox == 1)
{ {
(*pExaScr->info->accel.Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
fullX1 + off_x, fullY1 + off_y, fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y); fullX2 + off_x, fullY1 + 1 + off_y);
} }
else else
{ {
@ -111,15 +111,15 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
if (partX2 > fullX2) if (partX2 > fullX2)
partX2 = fullX2; partX2 = fullX2;
if (partX2 > partX1) if (partX2 > partX1)
(*pExaScr->info->accel.Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + off_x, fullY1 + off_y, partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y); partX2 + off_x, fullY1 + 1 + off_y);
} }
pbox++; pbox++;
} }
} }
} }
(*pExaScr->info->accel.DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaDrawableDirty (pDrawable); exaDrawableDirty (pDrawable);
exaMarkSync(pScreen); exaMarkSync(pScreen);
} }
@ -149,42 +149,40 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
/* Do a xdir = ydir = -1 blit instead. */ /* Do a xdir = ydir = -1 blit instead. */
if (dirsetup != -1) { if (dirsetup != -1) {
dirsetup = -1; dirsetup = -1;
if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
pDstPixmap, pDstPixmap,
-1, -1, -1, -1,
pGC ? pGC->alu : pGC ? pGC->alu : GXcopy,
GXcopy, pGC ? pGC->planemask :
pGC ? pGC->planemask :
FB_ALLONES)) FB_ALLONES))
return FALSE; return FALSE;
} }
(*pExaScr->info->accel.Copy)(pDstPixmap, (*pExaScr->info->Copy)(pDstPixmap,
src_off_x + pbox->x1 + dx, src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy, src_off_y + pbox->y1 + dy,
dst_off_x + pbox->x1, dst_off_x + pbox->x1,
dst_off_y + pbox->y1, dst_off_y + pbox->y1,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
} else if (dx < 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) { } else if (dx < 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) {
/* Do a xdir = ydir = 1 blit instead. */ /* Do a xdir = ydir = 1 blit instead. */
if (dirsetup != 1) { if (dirsetup != 1) {
dirsetup = 1; dirsetup = 1;
if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
pDstPixmap, pDstPixmap,
1, 1, 1, 1,
pGC ? pGC->alu : pGC ? pGC->alu : GXcopy,
GXcopy, pGC ? pGC->planemask :
pGC ? pGC->planemask :
FB_ALLONES)) FB_ALLONES))
return FALSE; return FALSE;
} }
(*pExaScr->info->accel.Copy)(pDstPixmap, (*pExaScr->info->Copy)(pDstPixmap,
src_off_x + pbox->x1 + dx, src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy, src_off_y + pbox->y1 + dy,
dst_off_x + pbox->x1, dst_off_x + pbox->x1,
dst_off_y + pbox->y1, dst_off_y + pbox->y1,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
} else if (dx >= 0) { } else if (dx >= 0) {
/* /*
* xdir = 1, ydir = -1. * xdir = 1, ydir = -1.
@ -193,22 +191,21 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
int i; int i;
if (dirsetup != 1) { if (dirsetup != 1) {
dirsetup = 1; dirsetup = 1;
if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
pDstPixmap, pDstPixmap,
1, 1, 1, 1,
pGC ? pGC->alu : pGC ? pGC->alu : GXcopy,
GXcopy, pGC ? pGC->planemask :
pGC ? pGC->planemask :
FB_ALLONES)) FB_ALLONES))
return FALSE; return FALSE;
} }
for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--) for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
(*pExaScr->info->accel.Copy)(pDstPixmap, (*pExaScr->info->Copy)(pDstPixmap,
src_off_x + pbox->x1 + dx, src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy + i, src_off_y + pbox->y1 + dy + i,
dst_off_x + pbox->x1, dst_off_x + pbox->x1,
dst_off_y + pbox->y1 + i, dst_off_y + pbox->y1 + i,
pbox->x2 - pbox->x1, 1); pbox->x2 - pbox->x1, 1);
} else { } else {
/* /*
* xdir = -1, ydir = 1. * xdir = -1, ydir = 1.
@ -217,25 +214,24 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
int i; int i;
if (dirsetup != -1) { if (dirsetup != -1) {
dirsetup = -1; dirsetup = -1;
if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap,
pDstPixmap, pDstPixmap,
-1, -1, -1, -1,
pGC ? pGC->alu : pGC ? pGC->alu : GXcopy,
GXcopy, pGC ? pGC->planemask :
pGC ? pGC->planemask :
FB_ALLONES)) FB_ALLONES))
return FALSE; return FALSE;
} }
for (i = 0; i < pbox->y2 - pbox->y1; i++) for (i = 0; i < pbox->y2 - pbox->y1; i++)
(*pExaScr->info->accel.Copy)(pDstPixmap, (*pExaScr->info->Copy)(pDstPixmap,
src_off_x + pbox->x1 + dx, src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy + i, src_off_y + pbox->y1 + dy + i,
dst_off_x + pbox->x1, dst_off_x + pbox->x1,
dst_off_y + pbox->y1 + i, dst_off_y + pbox->y1 + i,
pbox->x2 - pbox->x1, 1); pbox->x2 - pbox->x1, 1);
} }
} }
(*pExaScr->info->accel.DoneCopy)(pDstPixmap); (*pExaScr->info->DoneCopy)(pDstPixmap);
exaMarkSync(pDstDrawable->pScreen); exaMarkSync(pDstDrawable->pScreen);
exaDrawableDirty(pDstDrawable); exaDrawableDirty(pDstDrawable);
return TRUE; return TRUE;
@ -263,10 +259,10 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
* violate the limits. The proper solution would be a temporary pixmap * violate the limits. The proper solution would be a temporary pixmap
* adjusted so that the drawing happened within limits. * adjusted so that the drawing happened within limits.
*/ */
if (pSrcDrawable->width > pExaScr->info->card.maxX || if (pSrcDrawable->width > pExaScr->info->maxX ||
pSrcDrawable->height > pExaScr->info->card.maxY || pSrcDrawable->height > pExaScr->info->maxY ||
pDstDrawable->width > pExaScr->info->card.maxX || pDstDrawable->width > pExaScr->info->maxX ||
pDstDrawable->height > pExaScr->info->card.maxY) pDstDrawable->height > pExaScr->info->maxY)
{ {
exaDrawableUseMemory (pSrcDrawable); exaDrawableUseMemory (pSrcDrawable);
exaDrawableUseMemory (pDstDrawable); exaDrawableUseMemory (pDstDrawable);
@ -287,7 +283,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
} }
/* Mixed directions must be handled specially if the card is lame */ /* Mixed directions must be handled specially if the card is lame */
if (pExaScr->info->card.flags & EXA_TWO_BITBLT_DIRECTIONS && (dx*dy) < 0) { if (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS && (dx*dy) < 0) {
if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
dx, dy)) dx, dy))
goto fallback; goto fallback;
@ -296,24 +292,22 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) && if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
(pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && (pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) &&
(*pExaScr->info->accel.PrepareCopy) (pSrcPixmap, (*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap,
pDstPixmap, dx, dy,
dx, pGC ? pGC->alu : GXcopy,
dy, pGC ? pGC->planemask : FB_ALLONES))
pGC ? pGC->alu : GXcopy,
pGC ? pGC->planemask : FB_ALLONES))
{ {
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->accel.Copy) (pDstPixmap, (*pExaScr->info->Copy) (pDstPixmap,
pbox->x1 + dx + src_off_x, pbox->x1 + dx + src_off_x,
pbox->y1 + dy + src_off_y, pbox->y1 + dy + src_off_y,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
pbox++; pbox++;
} }
(*pExaScr->info->accel.DoneCopy) (pDstPixmap); (*pExaScr->info->DoneCopy) (pDstPixmap);
exaMarkSync(pDstDrawable->pScreen); exaMarkSync(pDstDrawable->pScreen);
exaDrawableDirty (pDstDrawable); exaDrawableDirty (pDstDrawable);
return; return;
@ -367,13 +361,13 @@ exaPolyFillRect(DrawablePtr pDrawable,
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid || pGC->fillStyle != FillSolid ||
pDrawable->width > pExaScr->info->card.maxX || pDrawable->width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->card.maxY || pDrawable->height > pExaScr->info->maxY ||
!(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
!(*pExaScr->info->accel.PrepareSolid) (pPixmap, !(*pExaScr->info->PrepareSolid) (pPixmap,
pGC->alu, pGC->alu,
pGC->planemask, pGC->planemask,
pGC->fgPixel)) pGC->fgPixel))
{ {
ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect); ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
return; return;
@ -412,9 +406,9 @@ exaPolyFillRect(DrawablePtr pDrawable,
n = REGION_NUM_RECTS (pClip); n = REGION_NUM_RECTS (pClip);
if (n == 1) if (n == 1)
{ {
(*pExaScr->info->accel.Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
fullX1 + xoff, fullY1 + yoff, fullX1 + xoff, fullY1 + yoff,
fullX2 + xoff, fullY2 + yoff); fullX2 + xoff, fullY2 + yoff);
} }
else else
{ {
@ -441,13 +435,13 @@ exaPolyFillRect(DrawablePtr pDrawable,
pbox++; pbox++;
if (partX1 < partX2 && partY1 < partY2) if (partX1 < partX2 && partY1 < partY2)
(*pExaScr->info->accel.Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + xoff, partY1 + yoff, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff); partX2 + xoff, partY2 + yoff);
} }
} }
} }
(*pExaScr->info->accel.DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaDrawableDirty (pDrawable); exaDrawableDirty (pDrawable);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
} }
@ -470,10 +464,10 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
int partX1, partX2, partY1, partY2; int partX1, partX2, partY1, partY2;
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pDrawable->width > pExaScr->info->card.maxX || pDrawable->width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->card.maxY || pDrawable->height > pExaScr->info->maxY ||
!(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
!(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) !(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
{ {
EXA_FALLBACK(("to 0x%lx\n", (long)pDrawable)); EXA_FALLBACK(("to 0x%lx\n", (long)pDrawable));
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
@ -510,11 +504,11 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
if (partY2 <= partY1) if (partY2 <= partY1)
continue; continue;
(*pExaScr->info->accel.Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + xoff, partY1 + yoff, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff); partX2 + xoff, partY2 + yoff);
} }
(*pExaScr->info->accel.DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaDrawableDirty (pDrawable); exaDrawableDirty (pDrawable);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
} }
@ -722,22 +716,22 @@ exaFillRegionSolid (DrawablePtr pDrawable,
PixmapPtr pPixmap; PixmapPtr pPixmap;
int xoff, yoff; int xoff, yoff;
if (pDrawable->width <= pExaScr->info->card.maxX && if (pDrawable->width <= pExaScr->info->maxX &&
pDrawable->height <= pExaScr->info->card.maxY && pDrawable->height <= pExaScr->info->maxY &&
(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) (*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
{ {
int nbox = REGION_NUM_RECTS (pRegion); int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion); BoxPtr pBox = REGION_RECTS (pRegion);
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->accel.Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
pBox->x1 + xoff, pBox->y1 + yoff, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff); pBox->x2 + xoff, pBox->y2 + yoff);
pBox++; pBox++;
} }
(*pExaScr->info->accel.DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
exaDrawableDirty (pDrawable); exaDrawableDirty (pDrawable);
} }
@ -767,10 +761,10 @@ exaFillRegionTiled (DrawablePtr pDrawable,
tileWidth = pTile->drawable.width; tileWidth = pTile->drawable.width;
tileHeight = pTile->drawable.height; tileHeight = pTile->drawable.height;
if (pDrawable->width > pExaScr->info->card.maxX || if (pDrawable->width > pExaScr->info->maxX ||
pDrawable->height > pExaScr->info->card.maxY || pDrawable->height > pExaScr->info->maxY ||
tileWidth > pExaScr->info->card.maxX || tileWidth > pExaScr->info->maxX ||
tileHeight > pExaScr->info->card.maxY) tileHeight > pExaScr->info->maxY)
{ {
goto fallback; goto fallback;
} }
@ -810,8 +804,8 @@ exaFillRegionTiled (DrawablePtr pDrawable,
if (!exaPixmapIsOffscreen(pTile)) if (!exaPixmapIsOffscreen(pTile))
goto fallback; goto fallback;
if ((*pExaScr->info->accel.PrepareCopy) (pTile, pPixmap, 0, 0, GXcopy, if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 0, 0, GXcopy,
FB_ALLONES)) FB_ALLONES))
{ {
int nbox = REGION_NUM_RECTS (pRegion); int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion); BoxPtr pBox = REGION_RECTS (pRegion);
@ -840,10 +834,10 @@ exaFillRegionTiled (DrawablePtr pDrawable,
w = width; w = width;
width -= w; width -= w;
(*pExaScr->info->accel.Copy) (pPixmap, (*pExaScr->info->Copy) (pPixmap,
tileX, tileY, tileX, tileY,
dstX + xoff, dstY + yoff, dstX + xoff, dstY + yoff,
w, h); w, h);
dstX += w; dstX += w;
tileX = 0; tileX = 0;
} }
@ -852,7 +846,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
} }
pBox++; pBox++;
} }
(*pExaScr->info->accel.DoneCopy) (pPixmap); (*pExaScr->info->DoneCopy) (pPixmap);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
exaDrawableDirty (pDrawable); exaDrawableDirty (pDrawable);
return; return;

View File

@ -64,14 +64,13 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
dst = pExaPixmap->devPrivate.ptr; dst = pExaPixmap->devPrivate.ptr;
if (pExaPixmap->dirty) { if (pExaPixmap->dirty) {
if (pExaScr->info->accel.DownloadFromScreen && if (pExaScr->info->DownloadFromScreen &&
(*pExaScr->info->accel.DownloadFromScreen) (pPixmap, (*pExaScr->info->DownloadFromScreen) (pPixmap,
pPixmap->drawable.x, pPixmap->drawable.x,
pPixmap->drawable.y, pPixmap->drawable.y,
pPixmap->drawable.width, pPixmap->drawable.width,
pPixmap->drawable.height, pPixmap->drawable.height,
dst, dst, dst_pitch)) {
dst_pitch)) {
} else { } else {
exaWaitSync (pPixmap->drawable.pScreen); exaWaitSync (pPixmap->drawable.pScreen);
@ -120,16 +119,16 @@ exaPixmapAllocArea (PixmapPtr pPixmap)
CARD16 w = pPixmap->drawable.width; CARD16 w = pPixmap->drawable.width;
int pitch; int pitch;
if (pExaScr->info->card.flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
w = 1 << (exaLog2(w - 1) + 1); w = 1 << (exaLog2(w - 1) + 1);
pitch = (w * bpp / 8) + (pExaScr->info->card.pixmapPitchAlign - 1); pitch = (w * bpp / 8) + (pExaScr->info->pixmapPitchAlign - 1);
pitch -= pitch % pExaScr->info->card.pixmapPitchAlign; pitch -= pitch % pExaScr->info->pixmapPitchAlign;
pExaPixmap->size = pitch * h; pExaPixmap->size = pitch * h;
pExaPixmap->devKind = pPixmap->devKind; pExaPixmap->devKind = pPixmap->devKind;
pExaPixmap->devPrivate = pPixmap->devPrivate; pExaPixmap->devPrivate = pPixmap->devPrivate;
pExaPixmap->area = exaOffscreenAlloc (pScreen, pitch * h, pExaPixmap->area = exaOffscreenAlloc (pScreen, pitch * h,
pExaScr->info->card.pixmapOffsetAlign, pExaScr->info->pixmapOffsetAlign,
FALSE, FALSE,
exaPixmapSave, (pointer) pPixmap); exaPixmapSave, (pointer) pPixmap);
if (!pExaPixmap->area) if (!pExaPixmap->area)
@ -142,7 +141,8 @@ exaPixmapAllocArea (PixmapPtr pPixmap)
pPixmap->drawable.height)); pPixmap->drawable.height));
pPixmap->devKind = pitch; pPixmap->devKind = pitch;
pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pExaScr->info->card.memoryBase + pExaPixmap->area->offset); pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pExaScr->info->memoryBase +
pExaPixmap->area->offset);
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
return TRUE; return TRUE;
} }
@ -186,12 +186,12 @@ exaMoveInPixmap (PixmapPtr pPixmap)
pExaPixmap->dirty = FALSE; pExaPixmap->dirty = FALSE;
if (pExaScr->info->accel.UploadToScreen) if (pExaScr->info->UploadToScreen)
{ {
if (pExaScr->info->accel.UploadToScreen(pPixmap, 0, 0, if (pExaScr->info->UploadToScreen(pPixmap, 0, 0,
pPixmap->drawable.width, pPixmap->drawable.width,
pPixmap->drawable.height, pPixmap->drawable.height,
src, src_pitch)) src, src_pitch))
return; return;
} }
@ -205,7 +205,7 @@ exaMoveInPixmap (PixmapPtr pPixmap)
i = pPixmap->drawable.height; i = pPixmap->drawable.height;
DBG_PIXMAP(("dst = %p, src = %p,(%d, %d) height = %d, mem_base = %p, offset = %d\n", DBG_PIXMAP(("dst = %p, src = %p,(%d, %d) height = %d, mem_base = %p, offset = %d\n",
dst, src, dst_pitch, src_pitch, dst, src, dst_pitch, src_pitch,
i, pExaScr->info->card.memoryBase, ExaGetPixmapPriv(pPixmap)->area->offset)); i, pExaScr->info->memoryBase, pExaPixmap->area->offset));
while (i--) { while (i--) {
memcpy (dst, src, bytes); memcpy (dst, src, bytes);

View File

@ -39,9 +39,9 @@ ExaOffscreenValidate (ScreenPtr pScreen)
ExaScreenPriv (pScreen); ExaScreenPriv (pScreen);
ExaOffscreenArea *prev = 0, *area; ExaOffscreenArea *prev = 0, *area;
assert (pExaScr->info->card.offScreenAreas->base_offset == assert (pExaScr->info->offScreenAreas->base_offset ==
pExaScr->info->card.offScreenBase); pExaScr->info->offScreenBase);
for (area = pExaScr->info->card.offScreenAreas; area; area = area->next) for (area = pExaScr->info->offScreenAreas; area; area = area->next)
{ {
assert (area->offset >= area->base_offset && assert (area->offset >= area->base_offset &&
area->offset < (area->base_offset -> area->size)); area->offset < (area->base_offset -> area->size));
@ -49,7 +49,7 @@ ExaOffscreenValidate (ScreenPtr pScreen)
assert (prev->base_offset + prev->area.size == area->base_offset); assert (prev->base_offset + prev->area.size == area->base_offset);
prev = area; prev = area;
} }
assert (prev->base_offset + prev->size == pExaScr->info->card.memorySize); assert (prev->base_offset + prev->size == pExaScr->info->memorySize);
} }
#else #else
#define ExaOffscreenValidate(s) #define ExaOffscreenValidate(s)
@ -88,16 +88,16 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
} }
/* throw out requests that cannot fit */ /* throw out requests that cannot fit */
if (size > (pExaScr->info->card.memorySize - pExaScr->info->card.offScreenBase)) if (size > (pExaScr->info->memorySize - pExaScr->info->offScreenBase))
{ {
DBG_OFFSCREEN (("Alloc 0x%x vs (0x%lx) -> TOBIG\n", size, DBG_OFFSCREEN (("Alloc 0x%x vs (0x%lx) -> TOBIG\n", size,
pExaScr->info->card.memorySize - pExaScr->info->memorySize -
pExaScr->info->card.offScreenBase)); pExaScr->info->offScreenBase));
return NULL; return NULL;
} }
/* Try to find a free space that'll fit. */ /* Try to find a free space that'll fit. */
for (area = pExaScr->info->card.offScreenAreas; area; area = area->next) for (area = pExaScr->info->offScreenAreas; area; area = area->next)
{ {
/* skip allocated areas */ /* skip allocated areas */
if (area->state != ExaOffscreenAvail) if (area->state != ExaOffscreenAvail)
@ -125,7 +125,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
/* prev points at the first object to boot */ /* prev points at the first object to boot */
best = NULL; best = NULL;
best_score = INT_MAX; best_score = INT_MAX;
for (begin = pExaScr->info->card.offScreenAreas; begin != NULL; for (begin = pExaScr->info->offScreenAreas; begin != NULL;
begin = begin->next) begin = begin->next)
{ {
int avail, score; int avail, score;
@ -237,7 +237,7 @@ ExaOffscreenSwapOut (ScreenPtr pScreen)
/* loop until a single free area spans the space */ /* loop until a single free area spans the space */
for (;;) for (;;)
{ {
ExaOffscreenArea *area = pExaScr->info->card.offScreenAreas; ExaOffscreenArea *area = pExaScr->info->offScreenAreas;
if (!area) if (!area)
break; break;
@ -306,10 +306,10 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
/* /*
* Find previous area * Find previous area
*/ */
if (area == pExaScr->info->card.offScreenAreas) if (area == pExaScr->info->offScreenAreas)
prev = NULL; prev = NULL;
else else
for (prev = pExaScr->info->card.offScreenAreas; prev; prev = prev->next) for (prev = pExaScr->info->offScreenAreas; prev; prev = prev->next)
if (prev->next == area) if (prev->next == area)
break; break;
@ -343,7 +343,7 @@ ExaOffscreenMarkUsed (PixmapPtr pPixmap)
pExaPixmap->area->score += 100; pExaPixmap->area->score += 100;
if (++iter == 10) { if (++iter == 10) {
ExaOffscreenArea *area; ExaOffscreenArea *area;
for (area = pExaScr->info->card.offScreenAreas; area != NULL; for (area = pExaScr->info->offScreenAreas; area != NULL;
area = area->next) area = area->next)
{ {
if (area->state == ExaOffscreenRemovable) if (area->state == ExaOffscreenRemovable)
@ -366,9 +366,9 @@ exaOffscreenInit (ScreenPtr pScreen)
area->state = ExaOffscreenAvail; area->state = ExaOffscreenAvail;
area->base_offset = pExaScr->info->card.offScreenBase; area->base_offset = pExaScr->info->offScreenBase;
area->offset = area->base_offset; area->offset = area->base_offset;
area->size = pExaScr->info->card.memorySize - area->base_offset; area->size = pExaScr->info->memorySize - area->base_offset;
area->save = NULL; area->save = NULL;
area->next = NULL; area->next = NULL;
area->score = 0; area->score = 0;
@ -378,7 +378,7 @@ exaOffscreenInit (ScreenPtr pScreen)
#endif #endif
/* Add it to the free areas */ /* Add it to the free areas */
pExaScr->info->card.offScreenAreas = area; pExaScr->info->offScreenAreas = area;
ExaOffscreenValidate (pScreen); ExaOffscreenValidate (pScreen);
@ -392,9 +392,9 @@ ExaOffscreenFini (ScreenPtr pScreen)
ExaOffscreenArea *area; ExaOffscreenArea *area;
/* just free all of the area records */ /* just free all of the area records */
while ((area = pExaScr->info->card.offScreenAreas)) while ((area = pExaScr->info->offScreenAreas))
{ {
pExaScr->info->card.offScreenAreas = area->next; pExaScr->info->offScreenAreas = area->next;
xfree (area); xfree (area);
} }
} }

View File

@ -277,7 +277,7 @@ exaTryDriverSolidFill(PicturePtr pSrc,
exaGetPixelFromRGBA(&pixel, red, green, blue, alpha, exaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
pDst->format); pDst->format);
if (!(*pExaScr->info->accel.PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel)) if (!(*pExaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
{ {
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1; return -1;
@ -287,15 +287,13 @@ exaTryDriverSolidFill(PicturePtr pSrc,
pbox = REGION_RECTS(&region); pbox = REGION_RECTS(&region);
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->accel.Solid) (pDstPix, (*pExaScr->info->Solid) (pDstPix,
pbox->x1 + dst_off_x, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->y1 + dst_off_y, pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox->x2 + dst_off_x,
pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
(*pExaScr->info->accel.DoneSolid) (pDstPix); (*pExaScr->info->DoneSolid) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen); exaMarkSync(pDst->pDrawable->pScreen);
exaDrawableDirty (pDst->pDrawable); exaDrawableDirty (pDst->pDrawable);
@ -329,12 +327,12 @@ exaTryDriverComposite(CARD8 op,
* should really be making some scratch pixmaps with offsets and coords * should really be making some scratch pixmaps with offsets and coords
* adjusted to deal with this, but it hasn't been done yet. * adjusted to deal with this, but it hasn't been done yet.
*/ */
if (pSrc->pDrawable->width > pExaScr->info->card.maxX || if (pSrc->pDrawable->width > pExaScr->info->maxX ||
pSrc->pDrawable->height > pExaScr->info->card.maxY || pSrc->pDrawable->height > pExaScr->info->maxY ||
pDst->pDrawable->width > pExaScr->info->card.maxX || pDst->pDrawable->width > pExaScr->info->maxX ||
pDst->pDrawable->height > pExaScr->info->card.maxY || pDst->pDrawable->height > pExaScr->info->maxY ||
(pMask && (pMask->pDrawable->width > pExaScr->info->card.maxX || (pMask && (pMask->pDrawable->width > pExaScr->info->maxX ||
pMask->pDrawable->height > pExaScr->info->card.maxY))) pMask->pDrawable->height > pExaScr->info->maxY)))
{ {
return -1; return -1;
} }
@ -355,8 +353,8 @@ exaTryDriverComposite(CARD8 op,
width, height)) width, height))
return 1; return 1;
if (pExaScr->info->accel.CheckComposite && if (pExaScr->info->CheckComposite &&
!(*pExaScr->info->accel.CheckComposite) (op, pSrc, pMask, pDst)) !(*pExaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
{ {
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1; return -1;
@ -378,13 +376,13 @@ exaTryDriverComposite(CARD8 op,
return 0; return 0;
} }
if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) { if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->UploadToScratch) {
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch)) if ((*pExaScr->info->UploadToScratch) (pSrcPix, &scratch))
pSrcPix = &scratch; pSrcPix = &scratch;
} else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->accel.UploadToScratch) { } else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->UploadToScratch) {
pMaskPix = exaGetDrawablePixmap (pMask->pDrawable); pMaskPix = exaGetDrawablePixmap (pMask->pDrawable);
if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch)) if ((*pExaScr->info->UploadToScratch) (pMaskPix, &scratch))
pMaskPix = &scratch; pMaskPix = &scratch;
} }
@ -393,8 +391,8 @@ exaTryDriverComposite(CARD8 op,
return 0; return 0;
} }
if (!(*pExaScr->info->accel.PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix, if (!(*pExaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
pMaskPix, pDstPix)) pMaskPix, pDstPix))
{ {
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1; return -1;
@ -411,19 +409,19 @@ exaTryDriverComposite(CARD8 op,
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->accel.Composite) (pDstPix, (*pExaScr->info->Composite) (pDstPix,
pbox->x1 + xSrc + src_off_x, pbox->x1 + xSrc + src_off_x,
pbox->y1 + ySrc + src_off_y, pbox->y1 + ySrc + src_off_y,
pbox->x1 + xMask + mask_off_x, pbox->x1 + xMask + mask_off_x,
pbox->y1 + yMask + mask_off_y, pbox->y1 + yMask + mask_off_y,
pbox->x1 + dst_off_x, pbox->x1 + dst_off_x,
pbox->y1 + dst_off_y, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
pbox++; pbox++;
} }
(*pExaScr->info->accel.DoneComposite) (pDstPix); (*pExaScr->info->DoneComposite) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen); exaMarkSync(pDst->pDrawable->pScreen);
exaDrawableDirty (pDst->pDrawable); exaDrawableDirty (pDst->pDrawable);
@ -510,7 +508,7 @@ exaComposite(CARD8 op,
if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && if (pSrc->pDrawable && (!pMask || pMask->pDrawable) &&
pExaScr->info->accel.PrepareComposite && pExaScr->info->PrepareComposite &&
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
{ {
ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
@ -581,7 +579,7 @@ exaGlyphs (CARD8 op,
* component-alpha, which is likely accurate (at least until we make a CA * component-alpha, which is likely accurate (at least until we make a CA
* helper). * helper).
*/ */
if (!pExaScr->info->accel.PrepareComposite || if (!pExaScr->info->PrepareComposite ||
(maskFormat && NeedsComponent(maskFormat->format))) { (maskFormat && NeedsComponent(maskFormat->format))) {
miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
return; return;
@ -709,9 +707,9 @@ exaGlyphs (CARD8 op,
* First we try to use UploadToScreen, if we can, then we fall back * First we try to use UploadToScreen, if we can, then we fall back
* to a plain exaCopyArea in case of failure. * to a plain exaCopyArea in case of failure.
*/ */
if (!pExaScr->info->accel.UploadToScreen || if (!pExaScr->info->UploadToScreen ||
!exaPixmapIsOffscreen(pPixmap) || !exaPixmapIsOffscreen(pPixmap) ||
!(*pExaScr->info->accel.UploadToScreen) (pPixmap, 0, 0, !(*pExaScr->info->UploadToScreen) (pPixmap, 0, 0,
glyph->info.width, glyph->info.width,
glyph->info.height, glyph->info.height,
pScratchPixmap->devPrivate.ptr, pScratchPixmap->devPrivate.ptr,

View File

@ -47,7 +47,7 @@ typedef struct _ephyrPriv {
} EphyrPriv; } EphyrPriv;
typedef struct _ephyrFakexaPriv { typedef struct _ephyrFakexaPriv {
ExaDriverRec exa; ExaDriverPtr exa;
Bool is_synced; Bool is_synced;
/* The following are arguments and other information from Prepare* calls /* The following are arguments and other information from Prepare* calls

View File

@ -281,6 +281,11 @@ ephyrDrawInit(ScreenPtr pScreen)
if (fakexa == NULL) if (fakexa == NULL)
return FALSE; return FALSE;
fakexa->exa = exaDriverAlloc();
if (fakexa->exa == NULL) {
xfree(fakexa);
return FALSE;
}
#if 0 #if 0
/* Currently, EXA isn't ready for what we want to do here. We want one /* Currently, EXA isn't ready for what we want to do here. We want one
* pointer to the framebuffer (which is set in exaMapFramebuffer) to be * pointer to the framebuffer (which is set in exaMapFramebuffer) to be
@ -289,53 +294,60 @@ ephyrDrawInit(ScreenPtr pScreen)
* to extend the XImage data area set up in hostx.c from exaMapFramebuffer, * to extend the XImage data area set up in hostx.c from exaMapFramebuffer,
* but that may be complicated. * but that may be complicated.
*/ */
fakexa->exa.card.memoryBase = xalloc(EPHYR_OFFSCREEN_SIZE); fakexa->exa->memoryBase = xalloc(EPHYR_OFFSCREEN_SIZE);
if (fakexa->exa.card.memoryBase == NULL) { if (fakexa->exa->memoryBase == NULL) {
xfree(fakexa->exa);
xfree(fakexa); xfree(fakexa);
return FALSE; return FALSE;
} }
fakexa->exa.card.memorySize = EPHYR_OFFSCREEN_SIZE; fakexa->exa->memorySize = EPHYR_OFFSCREEN_SIZE;
fakexa->exa.card.offScreenBase = EPHYR_OFFSCREEN_BASE; fakexa->exa->offScreenBase = EPHYR_OFFSCREEN_BASE;
#else #else
/* Tell EXA that there's a single framebuffer area, which happens to cover /* Tell EXA that there's a single framebuffer area, which happens to cover
* exactly what the front buffer is. * exactly what the front buffer is.
*/ */
fakexa->exa.card.memoryBase = screen->memory_base; fakexa->exa->memoryBase = screen->memory_base;
fakexa->exa.card.memorySize = screen->off_screen_base; fakexa->exa->memorySize = screen->off_screen_base;
fakexa->exa.card.offScreenBase = screen->off_screen_base; fakexa->exa->offScreenBase = screen->off_screen_base;
#endif #endif
fakexa->exa.accel.PrepareSolid = ephyrPrepareSolid; /* Since we statically link against EXA, we shouldn't have to be smart about
fakexa->exa.accel.Solid = ephyrSolid; * versioning.
fakexa->exa.accel.DoneSolid = ephyrDoneSolid; */
fakexa->exa->exa_major = 2;
fakexa->exa->exa_minor = 0;
fakexa->exa.accel.PrepareCopy = ephyrPrepareCopy; fakexa->exa->PrepareSolid = ephyrPrepareSolid;
fakexa->exa.accel.Copy = ephyrCopy; fakexa->exa->Solid = ephyrSolid;
fakexa->exa.accel.DoneCopy = ephyrDoneCopy; fakexa->exa->DoneSolid = ephyrDoneSolid;
fakexa->exa.accel.CheckComposite = ephyrCheckComposite; fakexa->exa->PrepareCopy = ephyrPrepareCopy;
fakexa->exa.accel.PrepareComposite = ephyrPrepareComposite; fakexa->exa->Copy = ephyrCopy;
fakexa->exa.accel.Composite = ephyrComposite; fakexa->exa->DoneCopy = ephyrDoneCopy;
fakexa->exa.accel.DoneComposite = ephyrDoneComposite;
fakexa->exa.accel.MarkSync = ephyrMarkSync; fakexa->exa->CheckComposite = ephyrCheckComposite;
fakexa->exa.accel.WaitMarker = ephyrWaitMarker; fakexa->exa->PrepareComposite = ephyrPrepareComposite;
fakexa->exa->Composite = ephyrComposite;
fakexa->exa->DoneComposite = ephyrDoneComposite;
fakexa->exa.card.pixmapOffsetAlign = EPHYR_OFFSET_ALIGN; fakexa->exa->MarkSync = ephyrMarkSync;
fakexa->exa.card.pixmapPitchAlign = EPHYR_PITCH_ALIGN; fakexa->exa->WaitMarker = ephyrWaitMarker;
fakexa->exa.card.maxX = 1023; fakexa->exa->pixmapOffsetAlign = EPHYR_OFFSET_ALIGN;
fakexa->exa.card.maxY = 1023; fakexa->exa->pixmapPitchAlign = EPHYR_PITCH_ALIGN;
fakexa->exa.card.flags = EXA_OFFSCREEN_PIXMAPS; fakexa->exa->maxX = 1023;
fakexa->exa->maxY = 1023;
success = exaDriverInit(pScreen, &fakexa->exa); fakexa->exa->flags = EXA_OFFSCREEN_PIXMAPS;
success = exaDriverInit(pScreen, fakexa->exa);
if (success) { if (success) {
ErrorF("Initialized fake EXA acceleration\n"); ErrorF("Initialized fake EXA acceleration\n");
scrpriv->fakexa = fakexa; scrpriv->fakexa = fakexa;
} else { } else {
ErrorF("Failed to initialize EXA\n"); ErrorF("Failed to initialize EXA\n");
xfree(fakexa->exa.card.memoryBase); xfree(fakexa->exa);
xfree(fakexa); xfree(fakexa);
} }

View File

@ -126,7 +126,7 @@ static XF86ModuleVersionInfo exaVersRec =
MODINFOSTRING1, MODINFOSTRING1,
MODINFOSTRING2, MODINFOSTRING2,
XORG_VERSION_CURRENT, XORG_VERSION_CURRENT,
1, 2, 0, EXA_VERSION_MAJOR, EXA_VERSION_MINOR, EXA_VERSION_RELEASE,
ABI_CLASS_VIDEODRV, /* requires the video driver ABI */ ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
ABI_VIDEODRV_VERSION, ABI_VIDEODRV_VERSION,
MOD_CLASS_NONE, MOD_CLASS_NONE,