diff options
author | Eric Anholt <anholt@freebsd.org> | 2006-03-09 06:04:07 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2006-03-09 06:04:07 +0000 |
commit | 2822cbc1fb2271844e7ae10c3629aaa940ae4042 (patch) | |
tree | 5ea4d9af188cf9a79e64ce3354574cdd717cea69 /exa | |
parent | 65aa33f9173b1554924437685698f7c5f645a3c4 (diff) |
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.
Diffstat (limited to 'exa')
-rw-r--r-- | exa/exa.c | 89 | ||||
-rw-r--r-- | exa/exa.h | 41 | ||||
-rw-r--r-- | exa/exa_accel.c | 234 | ||||
-rw-r--r-- | exa/exa_migration.c | 38 | ||||
-rw-r--r-- | exa/exa_offscreen.c | 36 | ||||
-rw-r--r-- | exa/exa_render.c | 68 |
6 files changed, 249 insertions, 257 deletions
@@ -48,7 +48,7 @@ exaGetPixmapOffset(PixmapPtr pPix) ExaScreenPriv (pPix->drawable.pScreen); 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. */ @@ -149,8 +149,8 @@ exaPixmapIsOffscreen(PixmapPtr p) ExaScreenPriv(pScreen); return ((unsigned long) ((CARD8 *) p->devPrivate.ptr - - (CARD8 *) pExaScr->info->card.memoryBase) < - pExaScr->info->card.memorySize); + (CARD8 *) pExaScr->info->memoryBase) < + pExaScr->info->memorySize); } Bool @@ -205,10 +205,10 @@ exaPrepareAccess(DrawablePtr pDrawable, int index) else return; - if (pExaScr->info->accel.PrepareAccess == NULL) + if (pExaScr->info->PrepareAccess == NULL) return; - if (!(*pExaScr->info->accel.PrepareAccess) (pPixmap, index)) { + if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) { ExaPixmapPriv (pPixmap); if (pExaPixmap->score != EXA_PIXMAP_SCORE_PINNED) FatalError("Driver failed PrepareAccess on a pinned pixmap\n"); @@ -223,14 +223,14 @@ exaFinishAccess(DrawablePtr pDrawable, int index) ExaScreenPriv (pScreen); PixmapPtr pPixmap; - if (pExaScr->info->accel.FinishAccess == NULL) + if (pExaScr->info->FinishAccess == NULL) return; pPixmap = exaGetDrawablePixmap (pDrawable); if (!exaPixmapIsOffscreen (pPixmap)) return; - (*pExaScr->info->accel.FinishAccess) (pPixmap, index); + (*pExaScr->info->FinishAccess) (pPixmap, index); } static void @@ -294,12 +294,42 @@ exaCloseScreen(int i, ScreenPtr 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 exaDriverInit (ScreenPtr pScreen, ExaDriverPtr pScreenInfo) { 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 PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif @@ -365,8 +395,8 @@ exaDriverInit (ScreenPtr pScreen, /* * Hookup offscreen pixmaps */ - if ((pExaScr->info->card.flags & EXA_OFFSCREEN_PIXMAPS) && - pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize) + if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) && + pExaScr->info->offScreenBase < pExaScr->info->memorySize) { if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, sizeof (ExaPixmapPrivRec))) { @@ -388,9 +418,9 @@ exaDriverInit (ScreenPtr pScreen, return FALSE; } - DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->card.offScreenBase, - pExaScr->info->card.memorySize)); - if (pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize) { + DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase, + pExaScr->info->memorySize)); + if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) { if (!exaOffscreenInit (pScreen)) { LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n", pScreen->myNum); @@ -410,42 +440,19 @@ exaDriverFini (ScreenPtr pScreen) 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); + pExaScr->info->needsSync = TRUE; + if (pExaScr->info->MarkSync != NULL) { + pExaScr->info->lastMarker = (*pExaScr->info->MarkSync)(pScreen); } } void exaWaitSync(ScreenPtr pScreen) { ExaScreenPriv(pScreen); - ExaCardInfoPtr card = &(pExaScr->info->card); - if (card->needsSync && !pExaScr->swappedOut) { - (*pExaScr->info->accel.WaitMarker)(pScreen, card->lastMarker); - card->needsSync = FALSE; + if (pExaScr->info->needsSync && !pExaScr->swappedOut) { + (*pExaScr->info->WaitMarker)(pScreen, pExaScr->info->lastMarker); + 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; -} @@ -32,8 +32,8 @@ #include "gcstruct.h" #include "picturestr.h" -#define EXA_VERSION_MAJOR 0 -#define EXA_VERSION_MINOR 2 +#define EXA_VERSION_MAJOR 2 +#define EXA_VERSION_MINOR 0 #define EXA_VERSION_RELEASE 0 typedef struct _ExaOffscreenArea ExaOffscreenArea; @@ -60,7 +60,19 @@ struct _ExaOffscreenArea { 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 * ScrnInfoRec */ CARD8 *memoryBase; @@ -87,9 +99,7 @@ typedef struct _ExaCardInfo { ExaOffscreenArea *offScreenAreas; Bool needsSync; int lastMarker; -} ExaCardInfoRec, *ExaCardInfoPtr; -typedef struct _ExaAccelInfo { /* PrepareSolid may fail if the pixmaps can't be accelerated to/from. * This is an important feature for handling strange corner cases * in hardware that are poorly expressed through flags. @@ -196,25 +206,14 @@ typedef struct _ExaAccelInfo { #define EXA_PREPARE_DEST 0 #define EXA_PREPARE_SRC 1 #define EXA_PREPARE_MASK 2 - -} ExaAccelInfoRec, *ExaAccelInfoPtr; - -typedef struct _ExaDriver { - ExaCardInfoRec card; - ExaAccelInfoRec accel; } ExaDriverRec, *ExaDriverPtr; #define EXA_OFFSCREEN_PIXMAPS (1 << 0) #define EXA_OFFSCREEN_ALIGN_POT (1 << 1) #define EXA_TWO_BITBLT_DIRECTIONS (1 << 2) -#define EXA_MAKE_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c)) -#define EXA_VERSION \ - 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); +ExaDriverPtr +exaDriverAlloc(void); Bool exaDriverInit(ScreenPtr pScreen, @@ -252,10 +251,4 @@ exaGetPixmapSize(PixmapPtr pPix); void 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 */ diff --git a/exa/exa_accel.c b/exa/exa_accel.c index 365e6313c..34d30bc0d 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -53,13 +53,13 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, } if (pGC->fillStyle != FillSolid || - pDrawable->width > pExaScr->info->card.maxX || - pDrawable->height > pExaScr->info->card.maxY || + pDrawable->width > pExaScr->info->maxX || + pDrawable->height > pExaScr->info->maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || - !(*pExaScr->info->accel.PrepareSolid) (pPixmap, - pGC->alu, - pGC->planemask, - pGC->fgPixel)) + !(*pExaScr->info->PrepareSolid) (pPixmap, + pGC->alu, + pGC->planemask, + pGC->fgPixel)) { ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); return; @@ -93,9 +93,9 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, nbox = REGION_NUM_RECTS (pClip); if (nbox == 1) { - (*pExaScr->info->accel.Solid) (pPixmap, - fullX1 + off_x, fullY1 + off_y, - fullX2 + off_x, fullY1 + 1 + off_y); + (*pExaScr->info->Solid) (pPixmap, + fullX1 + off_x, fullY1 + off_y, + fullX2 + off_x, fullY1 + 1 + off_y); } else { @@ -111,15 +111,15 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, if (partX2 > fullX2) partX2 = fullX2; if (partX2 > partX1) - (*pExaScr->info->accel.Solid) (pPixmap, - partX1 + off_x, fullY1 + off_y, - partX2 + off_x, fullY1 + 1 + off_y); + (*pExaScr->info->Solid) (pPixmap, + partX1 + off_x, fullY1 + off_y, + partX2 + off_x, fullY1 + 1 + off_y); } pbox++; } } } - (*pExaScr->info->accel.DoneSolid) (pPixmap); + (*pExaScr->info->DoneSolid) (pPixmap); exaDrawableDirty (pDrawable); exaMarkSync(pScreen); } @@ -149,42 +149,40 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, /* Do a xdir = ydir = -1 blit instead. */ if (dirsetup != -1) { dirsetup = -1; - if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, - pDstPixmap, - -1, -1, - pGC ? pGC->alu : - GXcopy, - pGC ? pGC->planemask : + if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap, + pDstPixmap, + -1, -1, + pGC ? pGC->alu : GXcopy, + pGC ? pGC->planemask : FB_ALLONES)) return FALSE; } - (*pExaScr->info->accel.Copy)(pDstPixmap, - src_off_x + pbox->x1 + dx, - src_off_y + pbox->y1 + dy, - dst_off_x + pbox->x1, - dst_off_y + pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); + (*pExaScr->info->Copy)(pDstPixmap, + src_off_x + pbox->x1 + dx, + src_off_y + pbox->y1 + dy, + dst_off_x + pbox->x1, + dst_off_y + pbox->y1, + pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); } else if (dx < 0 && (src_off_y + pbox->y1 + dy) != pbox->y1) { /* Do a xdir = ydir = 1 blit instead. */ if (dirsetup != 1) { dirsetup = 1; - if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, - pDstPixmap, - 1, 1, - pGC ? pGC->alu : - GXcopy, - pGC ? pGC->planemask : + if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap, + pDstPixmap, + 1, 1, + pGC ? pGC->alu : GXcopy, + pGC ? pGC->planemask : FB_ALLONES)) return FALSE; } - (*pExaScr->info->accel.Copy)(pDstPixmap, - src_off_x + pbox->x1 + dx, - src_off_y + pbox->y1 + dy, - dst_off_x + pbox->x1, - dst_off_y + pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); + (*pExaScr->info->Copy)(pDstPixmap, + src_off_x + pbox->x1 + dx, + src_off_y + pbox->y1 + dy, + dst_off_x + pbox->x1, + dst_off_y + pbox->y1, + pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); } else if (dx >= 0) { /* * xdir = 1, ydir = -1. @@ -193,22 +191,21 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int i; if (dirsetup != 1) { dirsetup = 1; - if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, - pDstPixmap, - 1, 1, - pGC ? pGC->alu : - GXcopy, - pGC ? pGC->planemask : + if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap, + pDstPixmap, + 1, 1, + pGC ? pGC->alu : GXcopy, + pGC ? pGC->planemask : FB_ALLONES)) return FALSE; } for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--) - (*pExaScr->info->accel.Copy)(pDstPixmap, - src_off_x + pbox->x1 + dx, - src_off_y + pbox->y1 + dy + i, - dst_off_x + pbox->x1, - dst_off_y + pbox->y1 + i, - pbox->x2 - pbox->x1, 1); + (*pExaScr->info->Copy)(pDstPixmap, + src_off_x + pbox->x1 + dx, + src_off_y + pbox->y1 + dy + i, + dst_off_x + pbox->x1, + dst_off_y + pbox->y1 + i, + pbox->x2 - pbox->x1, 1); } else { /* * xdir = -1, ydir = 1. @@ -217,25 +214,24 @@ exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int i; if (dirsetup != -1) { dirsetup = -1; - if (!(*pExaScr->info->accel.PrepareCopy)(pSrcPixmap, - pDstPixmap, - -1, -1, - pGC ? pGC->alu : - GXcopy, - pGC ? pGC->planemask : + if (!(*pExaScr->info->PrepareCopy)(pSrcPixmap, + pDstPixmap, + -1, -1, + pGC ? pGC->alu : GXcopy, + pGC ? pGC->planemask : FB_ALLONES)) return FALSE; } for (i = 0; i < pbox->y2 - pbox->y1; i++) - (*pExaScr->info->accel.Copy)(pDstPixmap, - src_off_x + pbox->x1 + dx, - src_off_y + pbox->y1 + dy + i, - dst_off_x + pbox->x1, - dst_off_y + pbox->y1 + i, - pbox->x2 - pbox->x1, 1); + (*pExaScr->info->Copy)(pDstPixmap, + src_off_x + pbox->x1 + dx, + src_off_y + pbox->y1 + dy + i, + dst_off_x + pbox->x1, + dst_off_y + pbox->y1 + i, + pbox->x2 - pbox->x1, 1); } } - (*pExaScr->info->accel.DoneCopy)(pDstPixmap); + (*pExaScr->info->DoneCopy)(pDstPixmap); exaMarkSync(pDstDrawable->pScreen); exaDrawableDirty(pDstDrawable); return TRUE; @@ -263,10 +259,10 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, * violate the limits. The proper solution would be a temporary pixmap * adjusted so that the drawing happened within limits. */ - if (pSrcDrawable->width > pExaScr->info->card.maxX || - pSrcDrawable->height > pExaScr->info->card.maxY || - pDstDrawable->width > pExaScr->info->card.maxX || - pDstDrawable->height > pExaScr->info->card.maxY) + if (pSrcDrawable->width > pExaScr->info->maxX || + pSrcDrawable->height > pExaScr->info->maxY || + pDstDrawable->width > pExaScr->info->maxX || + pDstDrawable->height > pExaScr->info->maxY) { exaDrawableUseMemory (pSrcDrawable); exaDrawableUseMemory (pDstDrawable); @@ -287,7 +283,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, } /* 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, dx, dy)) goto fallback; @@ -296,24 +292,22 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) && (pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && - (*pExaScr->info->accel.PrepareCopy) (pSrcPixmap, - pDstPixmap, - dx, - dy, - pGC ? pGC->alu : GXcopy, - pGC ? pGC->planemask : FB_ALLONES)) + (*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, + dx, dy, + pGC ? pGC->alu : GXcopy, + pGC ? pGC->planemask : FB_ALLONES)) { while (nbox--) { - (*pExaScr->info->accel.Copy) (pDstPixmap, - pbox->x1 + dx + src_off_x, - pbox->y1 + dy + src_off_y, - pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); + (*pExaScr->info->Copy) (pDstPixmap, + pbox->x1 + dx + src_off_x, + pbox->y1 + dy + src_off_y, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); pbox++; } - (*pExaScr->info->accel.DoneCopy) (pDstPixmap); + (*pExaScr->info->DoneCopy) (pDstPixmap); exaMarkSync(pDstDrawable->pScreen); exaDrawableDirty (pDstDrawable); return; @@ -367,13 +361,13 @@ exaPolyFillRect(DrawablePtr pDrawable, if (pExaScr->swappedOut || pGC->fillStyle != FillSolid || - pDrawable->width > pExaScr->info->card.maxX || - pDrawable->height > pExaScr->info->card.maxY || + pDrawable->width > pExaScr->info->maxX || + pDrawable->height > pExaScr->info->maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || - !(*pExaScr->info->accel.PrepareSolid) (pPixmap, - pGC->alu, - pGC->planemask, - pGC->fgPixel)) + !(*pExaScr->info->PrepareSolid) (pPixmap, + pGC->alu, + pGC->planemask, + pGC->fgPixel)) { ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect); return; @@ -412,9 +406,9 @@ exaPolyFillRect(DrawablePtr pDrawable, n = REGION_NUM_RECTS (pClip); if (n == 1) { - (*pExaScr->info->accel.Solid) (pPixmap, - fullX1 + xoff, fullY1 + yoff, - fullX2 + xoff, fullY2 + yoff); + (*pExaScr->info->Solid) (pPixmap, + fullX1 + xoff, fullY1 + yoff, + fullX2 + xoff, fullY2 + yoff); } else { @@ -441,13 +435,13 @@ exaPolyFillRect(DrawablePtr pDrawable, pbox++; if (partX1 < partX2 && partY1 < partY2) - (*pExaScr->info->accel.Solid) (pPixmap, - partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); + (*pExaScr->info->Solid) (pPixmap, + partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); } } } - (*pExaScr->info->accel.DoneSolid) (pPixmap); + (*pExaScr->info->DoneSolid) (pPixmap); exaDrawableDirty (pDrawable); exaMarkSync(pDrawable->pScreen); } @@ -470,10 +464,10 @@ exaSolidBoxClipped (DrawablePtr pDrawable, int partX1, partX2, partY1, partY2; if (pExaScr->swappedOut || - pDrawable->width > pExaScr->info->card.maxX || - pDrawable->height > pExaScr->info->card.maxY || + pDrawable->width > pExaScr->info->maxX || + pDrawable->height > pExaScr->info->maxY || !(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)); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); @@ -510,11 +504,11 @@ exaSolidBoxClipped (DrawablePtr pDrawable, if (partY2 <= partY1) continue; - (*pExaScr->info->accel.Solid) (pPixmap, - partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); + (*pExaScr->info->Solid) (pPixmap, + partX1 + xoff, partY1 + yoff, + partX2 + xoff, partY2 + yoff); } - (*pExaScr->info->accel.DoneSolid) (pPixmap); + (*pExaScr->info->DoneSolid) (pPixmap); exaDrawableDirty (pDrawable); exaMarkSync(pDrawable->pScreen); } @@ -722,22 +716,22 @@ exaFillRegionSolid (DrawablePtr pDrawable, PixmapPtr pPixmap; int xoff, yoff; - if (pDrawable->width <= pExaScr->info->card.maxX && - pDrawable->height <= pExaScr->info->card.maxY && + if (pDrawable->width <= pExaScr->info->maxX && + pDrawable->height <= pExaScr->info->maxY && (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); BoxPtr pBox = REGION_RECTS (pRegion); while (nbox--) { - (*pExaScr->info->accel.Solid) (pPixmap, - pBox->x1 + xoff, pBox->y1 + yoff, - pBox->x2 + xoff, pBox->y2 + yoff); + (*pExaScr->info->Solid) (pPixmap, + pBox->x1 + xoff, pBox->y1 + yoff, + pBox->x2 + xoff, pBox->y2 + yoff); pBox++; } - (*pExaScr->info->accel.DoneSolid) (pPixmap); + (*pExaScr->info->DoneSolid) (pPixmap); exaMarkSync(pDrawable->pScreen); exaDrawableDirty (pDrawable); } @@ -767,10 +761,10 @@ exaFillRegionTiled (DrawablePtr pDrawable, tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; - if (pDrawable->width > pExaScr->info->card.maxX || - pDrawable->height > pExaScr->info->card.maxY || - tileWidth > pExaScr->info->card.maxX || - tileHeight > pExaScr->info->card.maxY) + if (pDrawable->width > pExaScr->info->maxX || + pDrawable->height > pExaScr->info->maxY || + tileWidth > pExaScr->info->maxX || + tileHeight > pExaScr->info->maxY) { goto fallback; } @@ -810,8 +804,8 @@ exaFillRegionTiled (DrawablePtr pDrawable, if (!exaPixmapIsOffscreen(pTile)) goto fallback; - if ((*pExaScr->info->accel.PrepareCopy) (pTile, pPixmap, 0, 0, GXcopy, - FB_ALLONES)) + if ((*pExaScr->info->PrepareCopy) (pTile, pPixmap, 0, 0, GXcopy, + FB_ALLONES)) { int nbox = REGION_NUM_RECTS (pRegion); BoxPtr pBox = REGION_RECTS (pRegion); @@ -840,10 +834,10 @@ exaFillRegionTiled (DrawablePtr pDrawable, w = width; width -= w; - (*pExaScr->info->accel.Copy) (pPixmap, - tileX, tileY, - dstX + xoff, dstY + yoff, - w, h); + (*pExaScr->info->Copy) (pPixmap, + tileX, tileY, + dstX + xoff, dstY + yoff, + w, h); dstX += w; tileX = 0; } @@ -852,7 +846,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, } pBox++; } - (*pExaScr->info->accel.DoneCopy) (pPixmap); + (*pExaScr->info->DoneCopy) (pPixmap); exaMarkSync(pDrawable->pScreen); exaDrawableDirty (pDrawable); return; diff --git a/exa/exa_migration.c b/exa/exa_migration.c index 50acad95f..720271cb7 100644 --- a/exa/exa_migration.c +++ b/exa/exa_migration.c @@ -64,14 +64,13 @@ exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area) dst = pExaPixmap->devPrivate.ptr; if (pExaPixmap->dirty) { - if (pExaScr->info->accel.DownloadFromScreen && - (*pExaScr->info->accel.DownloadFromScreen) (pPixmap, - pPixmap->drawable.x, - pPixmap->drawable.y, - pPixmap->drawable.width, - pPixmap->drawable.height, - dst, - dst_pitch)) { + if (pExaScr->info->DownloadFromScreen && + (*pExaScr->info->DownloadFromScreen) (pPixmap, + pPixmap->drawable.x, + pPixmap->drawable.y, + pPixmap->drawable.width, + pPixmap->drawable.height, + dst, dst_pitch)) { } else { exaWaitSync (pPixmap->drawable.pScreen); @@ -120,16 +119,16 @@ exaPixmapAllocArea (PixmapPtr pPixmap) CARD16 w = pPixmap->drawable.width; 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); - pitch = (w * bpp / 8) + (pExaScr->info->card.pixmapPitchAlign - 1); - pitch -= pitch % pExaScr->info->card.pixmapPitchAlign; + pitch = (w * bpp / 8) + (pExaScr->info->pixmapPitchAlign - 1); + pitch -= pitch % pExaScr->info->pixmapPitchAlign; pExaPixmap->size = pitch * h; pExaPixmap->devKind = pPixmap->devKind; pExaPixmap->devPrivate = pPixmap->devPrivate; pExaPixmap->area = exaOffscreenAlloc (pScreen, pitch * h, - pExaScr->info->card.pixmapOffsetAlign, + pExaScr->info->pixmapOffsetAlign, FALSE, exaPixmapSave, (pointer) pPixmap); if (!pExaPixmap->area) @@ -142,7 +141,8 @@ exaPixmapAllocArea (PixmapPtr pPixmap) pPixmap->drawable.height)); 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; return TRUE; } @@ -186,12 +186,12 @@ exaMoveInPixmap (PixmapPtr pPixmap) pExaPixmap->dirty = FALSE; - if (pExaScr->info->accel.UploadToScreen) + if (pExaScr->info->UploadToScreen) { - if (pExaScr->info->accel.UploadToScreen(pPixmap, 0, 0, - pPixmap->drawable.width, - pPixmap->drawable.height, - src, src_pitch)) + if (pExaScr->info->UploadToScreen(pPixmap, 0, 0, + pPixmap->drawable.width, + pPixmap->drawable.height, + src, src_pitch)) return; } @@ -205,7 +205,7 @@ exaMoveInPixmap (PixmapPtr pPixmap) i = pPixmap->drawable.height; DBG_PIXMAP(("dst = %p, src = %p,(%d, %d) height = %d, mem_base = %p, offset = %d\n", dst, src, dst_pitch, src_pitch, - i, pExaScr->info->card.memoryBase, ExaGetPixmapPriv(pPixmap)->area->offset)); + i, pExaScr->info->memoryBase, pExaPixmap->area->offset)); while (i--) { memcpy (dst, src, bytes); diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index a8ab37913..f3d9c7d6e 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -39,9 +39,9 @@ ExaOffscreenValidate (ScreenPtr pScreen) ExaScreenPriv (pScreen); ExaOffscreenArea *prev = 0, *area; - assert (pExaScr->info->card.offScreenAreas->base_offset == - pExaScr->info->card.offScreenBase); - for (area = pExaScr->info->card.offScreenAreas; area; area = area->next) + assert (pExaScr->info->offScreenAreas->base_offset == + pExaScr->info->offScreenBase); + for (area = pExaScr->info->offScreenAreas; area; area = area->next) { assert (area->offset >= area->base_offset && area->offset < (area->base_offset -> area->size)); @@ -49,7 +49,7 @@ ExaOffscreenValidate (ScreenPtr pScreen) assert (prev->base_offset + prev->area.size == area->base_offset); prev = area; } - assert (prev->base_offset + prev->size == pExaScr->info->card.memorySize); + assert (prev->base_offset + prev->size == pExaScr->info->memorySize); } #else #define ExaOffscreenValidate(s) @@ -88,16 +88,16 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, } /* 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, - pExaScr->info->card.memorySize - - pExaScr->info->card.offScreenBase)); + pExaScr->info->memorySize - + pExaScr->info->offScreenBase)); return NULL; } /* 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 */ if (area->state != ExaOffscreenAvail) @@ -125,7 +125,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, /* prev points at the first object to boot */ best = NULL; best_score = INT_MAX; - for (begin = pExaScr->info->card.offScreenAreas; begin != NULL; + for (begin = pExaScr->info->offScreenAreas; begin != NULL; begin = begin->next) { int avail, score; @@ -237,7 +237,7 @@ ExaOffscreenSwapOut (ScreenPtr pScreen) /* loop until a single free area spans the space */ for (;;) { - ExaOffscreenArea *area = pExaScr->info->card.offScreenAreas; + ExaOffscreenArea *area = pExaScr->info->offScreenAreas; if (!area) break; @@ -306,10 +306,10 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area) /* * Find previous area */ - if (area == pExaScr->info->card.offScreenAreas) + if (area == pExaScr->info->offScreenAreas) prev = NULL; else - for (prev = pExaScr->info->card.offScreenAreas; prev; prev = prev->next) + for (prev = pExaScr->info->offScreenAreas; prev; prev = prev->next) if (prev->next == area) break; @@ -343,7 +343,7 @@ ExaOffscreenMarkUsed (PixmapPtr pPixmap) pExaPixmap->area->score += 100; if (++iter == 10) { ExaOffscreenArea *area; - for (area = pExaScr->info->card.offScreenAreas; area != NULL; + for (area = pExaScr->info->offScreenAreas; area != NULL; area = area->next) { if (area->state == ExaOffscreenRemovable) @@ -366,9 +366,9 @@ exaOffscreenInit (ScreenPtr pScreen) area->state = ExaOffscreenAvail; - area->base_offset = pExaScr->info->card.offScreenBase; + area->base_offset = pExaScr->info->offScreenBase; 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->next = NULL; area->score = 0; @@ -378,7 +378,7 @@ exaOffscreenInit (ScreenPtr pScreen) #endif /* Add it to the free areas */ - pExaScr->info->card.offScreenAreas = area; + pExaScr->info->offScreenAreas = area; ExaOffscreenValidate (pScreen); @@ -392,9 +392,9 @@ ExaOffscreenFini (ScreenPtr pScreen) ExaOffscreenArea *area; /* 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); } } diff --git a/exa/exa_render.c b/exa/exa_render.c index cb76b15aa..f45f08916 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -277,7 +277,7 @@ exaTryDriverSolidFill(PicturePtr pSrc, exaGetPixelFromRGBA(&pixel, red, green, blue, alpha, pDst->format); - if (!(*pExaScr->info->accel.PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel)) + if (!(*pExaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel)) { REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return -1; @@ -287,15 +287,13 @@ exaTryDriverSolidFill(PicturePtr pSrc, pbox = REGION_RECTS(®ion); while (nbox--) { - (*pExaScr->info->accel.Solid) (pDstPix, - pbox->x1 + dst_off_x, - pbox->y1 + dst_off_y, - pbox->x2 + dst_off_x, - pbox->y2 + dst_off_y); + (*pExaScr->info->Solid) (pDstPix, + pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, + pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox++; } - (*pExaScr->info->accel.DoneSolid) (pDstPix); + (*pExaScr->info->DoneSolid) (pDstPix); exaMarkSync(pDst->pDrawable->pScreen); exaDrawableDirty (pDst->pDrawable); @@ -329,12 +327,12 @@ exaTryDriverComposite(CARD8 op, * should really be making some scratch pixmaps with offsets and coords * adjusted to deal with this, but it hasn't been done yet. */ - if (pSrc->pDrawable->width > pExaScr->info->card.maxX || - pSrc->pDrawable->height > pExaScr->info->card.maxY || - pDst->pDrawable->width > pExaScr->info->card.maxX || - pDst->pDrawable->height > pExaScr->info->card.maxY || - (pMask && (pMask->pDrawable->width > pExaScr->info->card.maxX || - pMask->pDrawable->height > pExaScr->info->card.maxY))) + if (pSrc->pDrawable->width > pExaScr->info->maxX || + pSrc->pDrawable->height > pExaScr->info->maxY || + pDst->pDrawable->width > pExaScr->info->maxX || + pDst->pDrawable->height > pExaScr->info->maxY || + (pMask && (pMask->pDrawable->width > pExaScr->info->maxX || + pMask->pDrawable->height > pExaScr->info->maxY))) { return -1; } @@ -355,8 +353,8 @@ exaTryDriverComposite(CARD8 op, width, height)) return 1; - if (pExaScr->info->accel.CheckComposite && - !(*pExaScr->info->accel.CheckComposite) (op, pSrc, pMask, pDst)) + if (pExaScr->info->CheckComposite && + !(*pExaScr->info->CheckComposite) (op, pSrc, pMask, pDst)) { REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return -1; @@ -378,13 +376,13 @@ exaTryDriverComposite(CARD8 op, return 0; } - if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) { + if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->UploadToScratch) { pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); - if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch)) + if ((*pExaScr->info->UploadToScratch) (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); - if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch)) + if ((*pExaScr->info->UploadToScratch) (pMaskPix, &scratch)) pMaskPix = &scratch; } @@ -393,8 +391,8 @@ exaTryDriverComposite(CARD8 op, return 0; } - if (!(*pExaScr->info->accel.PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix, - pMaskPix, pDstPix)) + if (!(*pExaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix, + pMaskPix, pDstPix)) { REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return -1; @@ -411,19 +409,19 @@ exaTryDriverComposite(CARD8 op, while (nbox--) { - (*pExaScr->info->accel.Composite) (pDstPix, - pbox->x1 + xSrc + src_off_x, - pbox->y1 + ySrc + src_off_y, - pbox->x1 + xMask + mask_off_x, - pbox->y1 + yMask + mask_off_y, - pbox->x1 + dst_off_x, - pbox->y1 + dst_off_y, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); + (*pExaScr->info->Composite) (pDstPix, + pbox->x1 + xSrc + src_off_x, + pbox->y1 + ySrc + src_off_y, + pbox->x1 + xMask + mask_off_x, + pbox->y1 + yMask + mask_off_y, + pbox->x1 + dst_off_x, + pbox->y1 + dst_off_y, + pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); pbox++; } - (*pExaScr->info->accel.DoneComposite) (pDstPix); + (*pExaScr->info->DoneComposite) (pDstPix); exaMarkSync(pDst->pDrawable->pScreen); exaDrawableDirty (pDst->pDrawable); @@ -510,7 +508,7 @@ exaComposite(CARD8 op, if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && - pExaScr->info->accel.PrepareComposite && + pExaScr->info->PrepareComposite && !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) { 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 * helper). */ - if (!pExaScr->info->accel.PrepareComposite || + if (!pExaScr->info->PrepareComposite || (maskFormat && NeedsComponent(maskFormat->format))) { miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); return; @@ -709,9 +707,9 @@ exaGlyphs (CARD8 op, * First we try to use UploadToScreen, if we can, then we fall back * to a plain exaCopyArea in case of failure. */ - if (!pExaScr->info->accel.UploadToScreen || + if (!pExaScr->info->UploadToScreen || !exaPixmapIsOffscreen(pPixmap) || - !(*pExaScr->info->accel.UploadToScreen) (pPixmap, 0, 0, + !(*pExaScr->info->UploadToScreen) (pPixmap, 0, 0, glyph->info.width, glyph->info.height, pScratchPixmap->devPrivate.ptr, |