Rename uxa using _ instead of caps

This commit is contained in:
Keith Packard 2008-08-04 23:43:13 -07:00
parent fc4d9c55a7
commit b2d058d80c
10 changed files with 322 additions and 469 deletions

View File

@ -538,6 +538,7 @@ typedef struct _I830Rec {
#ifdef I830_USE_UXA
uxa_driver_t *uxa_driver;
Bool need_flush;
Bool need_sync;
#endif
#if defined(I830_USE_EXA) || defined(I830_USE_UXA)
PixmapPtr pSrcPixmap;

View File

@ -3887,9 +3887,9 @@ i830WaitSync(ScrnInfoPtr pScrn)
#endif
#ifdef I830_USE_UXA
case ACCEL_UXA:
if (pI830->uxa_driver) {
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
uxa_wait_sync(pScreen);
if (pI830->uxa_driver && pI830->need_sync) {
pI830->need_sync = FALSE;
I830Sync(pScrn);
}
break;
#endif
@ -3920,10 +3920,8 @@ i830MarkSync(ScrnInfoPtr pScrn)
#endif
#ifdef I830_USE_UXA
case ACCEL_UXA:
if (pI830->uxa_driver) {
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
exaMarkSync(pScreen);
}
if (pI830->uxa_driver)
pI830->need_sync = TRUE;
break;
#endif
default:

View File

@ -42,6 +42,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#define ALWAYS_SYNC 0
#define ALWAYS_FLUSH 0
#ifdef DEBUG_I830FALLBACK
#define I830FALLBACK(s, arg...) \
@ -247,11 +248,16 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
static void
I830EXADoneSolid(PixmapPtr pPixmap)
{
#if ALWAYS_SYNC
#if ALWAYS_SYNC || ALWAYS_FLUSH || 1
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
#if ALWAYS_FLUSH || 1
intel_batch_flush(pScrn);
#endif
#if ALWAYS_SYNC
I830Sync(pScrn);
#endif
#endif
}
/**
@ -343,11 +349,37 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1,
static void
I830EXADoneCopy(PixmapPtr pDstPixmap)
{
#if ALWAYS_SYNC
#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
#if ALWAYS_FLUSH
intel_batch_flush(pScrn);
#endif
#if ALWAYS_SYNC
I830Sync(pScrn);
#endif
#endif
}
/**
* Do any cleanup from the Composite operation.
*
* This is shared between i830 through i965.
*/
void
i830_done_composite(PixmapPtr pDst)
{
#if ALWAYS_SYNC || ALWAYS_FLUSH
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
#if ALWAYS_FLUSH
intel_batch_flush(pScrn);
#endif
#if ALWAYS_SYNC
I830Sync(pScrn);
#endif
#endif
}
#define xFixedToFloat(val) \
@ -558,7 +590,15 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
dri_bo *bo = i830_uxa_get_pixmap_bo (pixmap);
if (bo) {
intel_batch_flush(xf86Screens[pixmap->drawable.pScreen->myNum]);
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
I830Ptr i830 = I830PTR(scrn);
intel_batch_flush(scrn);
if (i830->need_sync) {
I830Sync(scrn);
i830->need_sync = FALSE;
}
if (dri_bo_map (bo, access == UXA_ACCESS_RW) != 0)
return FALSE;
pixmap->devPrivate.ptr = bo->virtual;
@ -680,47 +720,42 @@ i830_uxa_init (ScreenPtr pScreen)
i830->uxa_driver->uxa_major = 1;
i830->uxa_driver->uxa_minor = 0;
i830->uxa_driver->maxX = i830->accel_max_x;
i830->uxa_driver->maxY = i830->accel_max_y;
/* Sync */
i830->uxa_driver->WaitMarker = I830EXASync;
i830->uxa_driver->max_x = i830->accel_max_x;
i830->uxa_driver->max_y = i830->accel_max_y;
/* Solid fill */
i830->uxa_driver->PrepareSolid = I830EXAPrepareSolid;
i830->uxa_driver->Solid = I830EXASolid;
i830->uxa_driver->DoneSolid = I830EXADoneSolid;
i830->uxa_driver->prepare_solid = I830EXAPrepareSolid;
i830->uxa_driver->solid = I830EXASolid;
i830->uxa_driver->done_solid = I830EXADoneSolid;
/* Copy */
i830->uxa_driver->PrepareCopy = I830EXAPrepareCopy;
i830->uxa_driver->Copy = I830EXACopy;
i830->uxa_driver->DoneCopy = I830EXADoneCopy;
i830->uxa_driver->prepare_copy = I830EXAPrepareCopy;
i830->uxa_driver->copy = I830EXACopy;
i830->uxa_driver->done_copy = I830EXADoneCopy;
#if 0
/* Composite */
if (!IS_I9XX(i830)) {
i830->uxa_driver->CheckComposite = i830_check_composite;
i830->uxa_driver->PrepareComposite = i830_prepare_composite;
i830->uxa_driver->Composite = i830_composite;
i830->uxa_driver->DoneComposite = i830_done_composite;
i830->uxa_driver->check_composite = i830_check_composite;
i830->uxa_driver->prepare_composite = i830_prepare_composite;
i830->uxa_driver->composite = i830_composite;
i830->uxa_driver->done_composite = i830_done_composite;
} else if (IS_I915G(i830) || IS_I915GM(i830) ||
IS_I945G(i830) || IS_I945GM(i830) || IS_G33CLASS(i830))
{
i830->uxa_driver->CheckComposite = i915_check_composite;
i830->uxa_driver->PrepareComposite = i915_prepare_composite;
i830->uxa_driver->Composite = i830_composite;
i830->uxa_driver->DoneComposite = i830_done_composite;
i830->uxa_driver->check_composite = i915_check_composite;
i830->uxa_driver->prepare_composite = i915_prepare_composite;
i830->uxa_driver->composite = i830_composite;
i830->uxa_driver->done_composite = i830_done_composite;
} else {
i830->uxa_driver->CheckComposite = i965_check_composite;
i830->uxa_driver->PrepareComposite = i965_prepare_composite;
i830->uxa_driver->Composite = i965_composite;
i830->uxa_driver->DoneComposite = i830_done_composite;
i830->uxa_driver->check_composite = i965_check_composite;
i830->uxa_driver->prepare_composite = i965_prepare_composite;
i830->uxa_driver->composite = i965_composite;
i830->uxa_driver->done_composite = i830_done_composite;
}
#endif
i830->uxa_driver->PrepareAccess = i830_uxa_prepare_access;
i830->uxa_driver->FinishAccess = i830_uxa_finish_access;
i830->uxa_driver->PixmapIsOffscreen = i830_uxa_pixmap_is_offscreen;
i830->uxa_driver->prepare_access = i830_uxa_prepare_access;
i830->uxa_driver->finish_access = i830_uxa_finish_access;
i830->uxa_driver->pixmap_is_offscreen = i830_uxa_pixmap_is_offscreen;
if(!uxa_driver_init(pScreen, i830->uxa_driver)) {
xf86DrvMsg(scrn->scrnIndex, X_INFO,

View File

@ -733,14 +733,3 @@ i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
ADVANCE_BATCH();
}
/**
* Do any cleanup from the Composite operation.
*
* This is shared between i830 through i965.
*/
void
i830_done_composite(PixmapPtr pDst)
{
/* NO-OP */
}

View File

@ -37,7 +37,7 @@
static void
uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
DDXPointPtr ppt, int *pwidth, int fSorted)
DDXPointPtr ppt, int *pwidth, int fSorted)
{
ScreenPtr pScreen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
@ -52,10 +52,10 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
if (uxa_screen->swappedOut || pGC->fillStyle != FillSolid ||
!(pPixmap = uxa_get_offscreen_pixmap (pDrawable, &off_x, &off_y)) ||
!(*uxa_screen->info->PrepareSolid) (pPixmap,
pGC->alu,
pGC->planemask,
pGC->fgPixel))
!(*uxa_screen->info->prepare_solid) (pPixmap,
pGC->alu,
pGC->planemask,
pGC->fgPixel))
{
uxa_check_fill_spans (pDrawable, pGC, n, ppt, pwidth, fSorted);
return;
@ -89,9 +89,9 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
nbox = REGION_NUM_RECTS (pClip);
if (nbox == 1)
{
(*uxa_screen->info->Solid) (pPixmap,
fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y);
(*uxa_screen->info->solid) (pPixmap,
fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y);
}
else
{
@ -107,22 +107,21 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
if (partX2 > fullX2)
partX2 = fullX2;
if (partX2 > partX1) {
(*uxa_screen->info->Solid) (pPixmap,
partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y);
(*uxa_screen->info->solid) (pPixmap,
partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y);
}
}
pbox++;
}
}
}
(*uxa_screen->info->DoneSolid) (pPixmap);
uxa_mark_sync(pScreen);
(*uxa_screen->info->done_solid) (pPixmap);
}
static Bool
uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int format, char *bits, int src_stride)
int w, int h, int format, char *bits, int src_stride)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
PixmapPtr pPix = uxa_get_drawable_pixmap (pDrawable);
@ -146,7 +145,7 @@ uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
pPix = uxa_get_offscreen_pixmap (pDrawable, &xoff, &yoff);
if (!pPix || !uxa_screen->info->UploadToScreen)
if (!pPix || !uxa_screen->info->put_image)
return FALSE;
x += pDrawable->x;
@ -177,8 +176,8 @@ uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
continue;
src = bits + (y1 - y) * src_stride + (x1 - x) * (bpp / 8);
ok = uxa_screen->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
x2 - x1, y2 - y1, src, src_stride);
ok = uxa_screen->info->put_image(pPix, x1 + xoff, y1 + yoff,
x2 - x1, y2 - y1, src, src_stride);
/* If we fail to accelerate the upload, fall back to using unaccelerated
* fb calls.
*/
@ -210,8 +209,6 @@ uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
if (access_prepared)
uxa_finish_access(pDrawable);
else
uxa_mark_sync(pDrawable->pScreen);
return TRUE;
}
@ -226,8 +223,8 @@ uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
int src_stride = PixmapBytePad(w, depth);
if (uxa_do_put_image(pDrawable, pGC, depth, dx, dy, sw, sh, format, data +
sy * src_stride + sx * BitsPerPixel(depth) / 8,
src_stride))
sy * src_stride + sx * BitsPerPixel(depth) / 8,
src_stride))
return TRUE;
if (format == ZPixmap)
@ -235,12 +232,12 @@ uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
PixmapPtr pPixmap;
pPixmap = GetScratchPixmapHeader(pDrawable->pScreen, w, h, depth,
BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
BitsPerPixel(depth), PixmapBytePad(w, depth),
(pointer)data);
if (!pPixmap)
return FALSE;
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbCopyArea((DrawablePtr)pPixmap, pDrawable, pGC, sx, sy, sw, sh, dx, dy);
uxa_finish_access(pDrawable);
@ -260,11 +257,11 @@ uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
*/
void
uxa_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
char *data)
int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
char *data)
{
if (!uxa_do_shm_put_image(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh,
dx, dy, data)) {
dx, dy, data)) {
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
data);
@ -316,9 +313,9 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
/* Do a xdir = ydir = -1 blit instead. */
if (dirsetup != -1) {
if (dirsetup != 0)
uxa_screen->info->DoneCopy(pDstPixmap);
uxa_screen->info->done_copy(pDstPixmap);
dirsetup = -1;
if (!(*uxa_screen->info->PrepareCopy)(pSrcPixmap,
if (!(*uxa_screen->info->prepare_copy)(pSrcPixmap,
pDstPixmap,
-1, -1,
pGC ? pGC->alu : GXcopy,
@ -326,7 +323,7 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
FB_ALLONES))
return FALSE;
}
(*uxa_screen->info->Copy)(pDstPixmap,
(*uxa_screen->info->copy)(pDstPixmap,
src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy,
dst_off_x + pbox->x1,
@ -337,9 +334,9 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
/* Do a xdir = ydir = 1 blit instead. */
if (dirsetup != 1) {
if (dirsetup != 0)
uxa_screen->info->DoneCopy(pDstPixmap);
uxa_screen->info->done_copy(pDstPixmap);
dirsetup = 1;
if (!(*uxa_screen->info->PrepareCopy)(pSrcPixmap,
if (!(*uxa_screen->info->prepare_copy)(pSrcPixmap,
pDstPixmap,
1, 1,
pGC ? pGC->alu : GXcopy,
@ -347,7 +344,7 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
FB_ALLONES))
return FALSE;
}
(*uxa_screen->info->Copy)(pDstPixmap,
(*uxa_screen->info->copy)(pDstPixmap,
src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy,
dst_off_x + pbox->x1,
@ -362,9 +359,9 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
int i;
if (dirsetup != 1) {
if (dirsetup != 0)
uxa_screen->info->DoneCopy(pDstPixmap);
uxa_screen->info->done_copy(pDstPixmap);
dirsetup = 1;
if (!(*uxa_screen->info->PrepareCopy)(pSrcPixmap,
if (!(*uxa_screen->info->prepare_copy)(pSrcPixmap,
pDstPixmap,
1, 1,
pGC ? pGC->alu : GXcopy,
@ -373,7 +370,7 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
return FALSE;
}
for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
(*uxa_screen->info->Copy)(pDstPixmap,
(*uxa_screen->info->copy)(pDstPixmap,
src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy + i,
dst_off_x + pbox->x1,
@ -387,9 +384,9 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
int i;
if (dirsetup != -1) {
if (dirsetup != 0)
uxa_screen->info->DoneCopy(pDstPixmap);
uxa_screen->info->done_copy(pDstPixmap);
dirsetup = -1;
if (!(*uxa_screen->info->PrepareCopy)(pSrcPixmap,
if (!(*uxa_screen->info->prepare_copy)(pSrcPixmap,
pDstPixmap,
-1, -1,
pGC ? pGC->alu : GXcopy,
@ -398,7 +395,7 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
return FALSE;
}
for (i = 0; i < pbox->y2 - pbox->y1; i++)
(*uxa_screen->info->Copy)(pDstPixmap,
(*uxa_screen->info->copy)(pDstPixmap,
src_off_x + pbox->x1 + dx,
src_off_y + pbox->y1 + dy + i,
dst_off_x + pbox->x1,
@ -407,8 +404,7 @@ uxa_copy_n_to_n_two_dir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
}
}
if (dirsetup != 0)
uxa_screen->info->DoneCopy(pDstPixmap);
uxa_mark_sync(pDstDrawable->pScreen);
uxa_screen->info->done_copy(pDstPixmap);
return TRUE;
}
@ -447,7 +443,7 @@ uxa_copy_n_to_n (DrawablePtr pSrcDrawable,
if (!uxa_pixmap_is_offscreen(pSrcPixmap) ||
!uxa_pixmap_is_offscreen(pDstPixmap) ||
!(*uxa_screen->info->PrepareCopy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1,
!(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1,
upsidedown ? -1 : 1,
pGC ? pGC->alu : GXcopy,
pGC ? pGC->planemask : FB_ALLONES)) {
@ -456,7 +452,7 @@ uxa_copy_n_to_n (DrawablePtr pSrcDrawable,
while (nbox--)
{
(*uxa_screen->info->Copy) (pDstPixmap,
(*uxa_screen->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,
@ -464,8 +460,7 @@ uxa_copy_n_to_n (DrawablePtr pSrcDrawable,
pbox++;
}
(*uxa_screen->info->DoneCopy) (pDstPixmap);
uxa_mark_sync (pDstDrawable->pScreen);
(*uxa_screen->info->done_copy) (pDstPixmap);
return;
@ -704,7 +699,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
}
if (!uxa_pixmap_is_offscreen (pPixmap) ||
!(*uxa_screen->info->PrepareSolid) (pPixmap,
!(*uxa_screen->info->prepare_solid) (pPixmap,
pGC->alu,
pGC->planemask,
pGC->fgPixel))
@ -747,7 +742,7 @@ fallback:
n = REGION_NUM_RECTS (pClip);
if (n == 1)
{
(*uxa_screen->info->Solid) (pPixmap,
(*uxa_screen->info->solid) (pPixmap,
fullX1 + xoff, fullY1 + yoff,
fullX2 + xoff, fullY2 + yoff);
}
@ -777,15 +772,14 @@ fallback:
pbox++;
if (partX1 < partX2 && partY1 < partY2) {
(*uxa_screen->info->Solid) (pPixmap,
(*uxa_screen->info->solid) (pPixmap,
partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff);
}
}
}
}
(*uxa_screen->info->DoneSolid) (pPixmap);
uxa_mark_sync(pDrawable->pScreen);
(*uxa_screen->info->done_solid) (pPixmap);
out:
REGION_UNINIT(pScreen, pReg);
@ -858,7 +852,7 @@ uxa_fill_region_solid (DrawablePtr pDrawable,
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (uxa_pixmap_is_offscreen (pPixmap) &&
(*uxa_screen->info->PrepareSolid) (pPixmap, alu, planemask, pixel))
(*uxa_screen->info->prepare_solid) (pPixmap, alu, planemask, pixel))
{
int nbox;
BoxPtr pBox;
@ -868,12 +862,11 @@ uxa_fill_region_solid (DrawablePtr pDrawable,
while (nbox--)
{
(*uxa_screen->info->Solid) (pPixmap, pBox->x1, pBox->y1, pBox->x2,
(*uxa_screen->info->solid) (pPixmap, pBox->x1, pBox->y1, pBox->x2,
pBox->y2);
pBox++;
}
(*uxa_screen->info->DoneSolid) (pPixmap);
uxa_mark_sync(pDrawable->pScreen);
(*uxa_screen->info->done_solid) (pPixmap);
ret = TRUE;
}
@ -906,7 +899,7 @@ uxa_fill_region_tiled (DrawablePtr pDrawable,
tileHeight = pTile->drawable.height;
/* If we're filling with a solid color, grab it out and go to
* FillRegionSolid, saving numerous copies.
* FillRegionsolid, saving numerous copies.
*/
if (tileWidth == 1 && tileHeight == 1)
return uxa_fill_region_solid(pDrawable, pRegion,
@ -922,7 +915,7 @@ uxa_fill_region_tiled (DrawablePtr pDrawable,
if (!pPixmap || !uxa_pixmap_is_offscreen(pTile))
goto out;
if ((*uxa_screen->info->PrepareCopy) (pTile, pPixmap, 1, 1, alu, planemask))
if ((*uxa_screen->info->prepare_copy) (pTile, pPixmap, 1, 1, alu, planemask))
{
while (nbox--)
{
@ -951,7 +944,7 @@ uxa_fill_region_tiled (DrawablePtr pDrawable,
w = width;
width -= w;
(*uxa_screen->info->Copy) (pPixmap, tileX, tileY, dstX, dstY,
(*uxa_screen->info->copy) (pPixmap, tileX, tileY, dstX, dstY,
w, h);
dstX += w;
tileX = 0;
@ -961,8 +954,7 @@ uxa_fill_region_tiled (DrawablePtr pDrawable,
}
pBox++;
}
(*uxa_screen->info->DoneCopy) (pPixmap);
uxa_mark_sync(pDrawable->pScreen);
(*uxa_screen->info->done_copy) (pPixmap);
ret = TRUE;
}
@ -1003,7 +995,7 @@ uxa_get_image (DrawablePtr pDrawable, int x, int y, int w, int h,
pPix = uxa_get_offscreen_pixmap (pDrawable, &xoff, &yoff);
if (pPix == NULL || uxa_screen->info->DownloadFromScreen == NULL)
if (pPix == NULL || uxa_screen->info->get_image == NULL)
goto fallback;
/* Only cover the ZPixmap, solid copy case. */
@ -1016,13 +1008,11 @@ uxa_get_image (DrawablePtr pDrawable, int x, int y, int w, int h,
if (pDrawable->bitsPerPixel < 8)
goto fallback;
ok = uxa_screen->info->DownloadFromScreen(pPix, pDrawable->x + x + xoff,
ok = uxa_screen->info->get_image(pPix, pDrawable->x + x + xoff,
pDrawable->y + y + yoff, w, h, d,
PixmapBytePad(w, pDrawable->depth));
if (ok) {
uxa_wait_sync(pDrawable->pScreen);
goto out;
}
if (ok)
return;
fallback:
UXA_FALLBACK(("from %p (%c)\n", pDrawable,
@ -1032,6 +1022,5 @@ fallback:
fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
uxa_finish_access (pDrawable);
out:
return;
}

View File

@ -362,7 +362,7 @@ uxa_glyph_cache_upload_glyph(ScreenPtr pScreen,
PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
int cacheXoff, cacheYoff;
if (!uxa_screen->info->UploadToScreen || uxa_screen->swappedOut)
if (!uxa_screen->info->put_image || uxa_screen->swappedOut)
return FALSE;
/* If the glyph pixmap is already uploaded, no point in doing
@ -378,13 +378,13 @@ uxa_glyph_cache_upload_glyph(ScreenPtr pScreen,
if (!pCachePixmap)
return FALSE;
if (!uxa_screen->info->UploadToScreen(pCachePixmap,
CACHE_X(pos) + cacheXoff,
CACHE_Y(pos) + cacheYoff,
pGlyph->info.width,
pGlyph->info.height,
(char *)pGlyphPixmap->devPrivate.ptr,
pGlyphPixmap->devKind))
if (!uxa_screen->info->put_image(pCachePixmap,
CACHE_X(pos) + cacheXoff,
CACHE_Y(pos) + cacheYoff,
pGlyph->info.width,
pGlyph->info.height,
(char *)pGlyphPixmap->devPrivate.ptr,
pGlyphPixmap->devKind))
return FALSE;
return TRUE;

View File

@ -117,7 +117,6 @@ typedef struct {
#define UXA_NUM_GLYPH_CACHES 4
typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
typedef struct {
uxa_driver_t *info;
CreateGCProcPtr SavedCreateGC;

View File

@ -291,7 +291,7 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
return -1;
}
if (!(*uxa_screen->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
if (!(*uxa_screen->info->prepare_solid) (pDstPix, GXcopy, 0xffffffff, pixel))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
@ -302,60 +302,46 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
while (nbox--)
{
(*uxa_screen->info->Solid) (pDstPix, pbox->x1, pbox->y1, pbox->x2, pbox->y2);
(*uxa_screen->info->solid) (pDstPix, pbox->x1, pbox->y1, pbox->x2, pbox->y2);
pbox++;
}
(*uxa_screen->info->DoneSolid) (pDstPix);
uxa_mark_sync(pDst->pDrawable->pScreen);
(*uxa_screen->info->done_solid) (pDstPix);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1;
}
static int
uxa_try_driver_composite_rects(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
int nrect,
uxa_composite_rect_t *rects)
uxa_try_driver_composite_rects(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
int nrect,
uxa_composite_rect_t *rects)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pDst->pDrawable->pScreen);
int src_off_x, src_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pDstPix;
struct _Pixmap scratch;
if (!uxa_screen->info->PrepareComposite)
if (!uxa_screen->info->prepare_composite)
return -1;
pSrcPix = uxa_get_drawable_pixmap(pSrc->pDrawable);
pDstPix = uxa_get_drawable_pixmap(pDst->pDrawable);
if (uxa_screen->info->CheckComposite &&
!(*uxa_screen->info->CheckComposite) (op, pSrc, NULL, pDst))
if (uxa_screen->info->check_composite &&
!(*uxa_screen->info->check_composite) (op, pSrc, NULL, pDst))
{
return -1;
}
uxa_get_drawable_deltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
pSrcPix = uxa_get_offscreen_pixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
if (!uxa_pixmap_is_offscreen(pDstPix))
pDstPix = uxa_get_offscreen_pixmap(pDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix)
return 0;
if (!pSrcPix && uxa_screen->info->UploadToScratch)
{
pSrcPix = uxa_get_drawable_pixmap (pSrc->pDrawable);
if ((*uxa_screen->info->UploadToScratch) (pSrcPix, &scratch))
pSrcPix = &scratch;
}
pSrcPix = uxa_get_offscreen_pixmap(pSrc->pDrawable, &src_off_x, &src_off_y);
if (!pSrcPix)
return 0;
if (!(*uxa_screen->info->PrepareComposite) (op, pSrc, NULL, pDst, pSrcPix,
NULL, pDstPix))
if (!(*uxa_screen->info->prepare_composite) (op, pSrc, NULL, pDst, pSrcPix,
NULL, pDstPix))
return -1;
while (nrect--)
@ -384,14 +370,14 @@ uxa_try_driver_composite_rects(CARD8 op,
while (nbox--)
{
(*uxa_screen->info->Composite) (pDstPix,
pbox->x1 + xSrc,
pbox->y1 + ySrc,
0, 0,
pbox->x1,
pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
(*uxa_screen->info->composite) (pDstPix,
pbox->x1 + xSrc,
pbox->y1 + ySrc,
0, 0,
pbox->x1,
pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
@ -400,9 +386,7 @@ uxa_try_driver_composite_rects(CARD8 op,
rects++;
}
(*uxa_screen->info->DoneComposite) (pDstPix);
uxa_mark_sync(pDst->pDrawable->pScreen);
(*uxa_screen->info->done_composite) (pDstPix);
return 1;
}
@ -467,12 +451,6 @@ uxa_try_driver_composite(CARD8 op,
int nbox;
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
struct _Pixmap scratch;
pSrcPix = uxa_get_drawable_pixmap(pSrc->pDrawable);
pDstPix = uxa_get_drawable_pixmap(pDst->pDrawable);
if (pMask)
pMaskPix = uxa_get_drawable_pixmap(pMask->pDrawable);
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
@ -485,8 +463,8 @@ uxa_try_driver_composite(CARD8 op,
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (uxa_screen->info->CheckComposite &&
!(*uxa_screen->info->CheckComposite) (op, pSrc, pMask, pDst))
if (uxa_screen->info->check_composite &&
!(*uxa_screen->info->check_composite) (op, pSrc, pMask, pDst))
{
return -1;
}
@ -496,37 +474,23 @@ uxa_try_driver_composite(CARD8 op,
width, height))
return 1;
uxa_get_drawable_deltas (pDst->pDrawable, pDstPix, &dst_off_x, &dst_off_y);
pDstPix = uxa_get_offscreen_pixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
pSrcPix = uxa_get_offscreen_pixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
if (pMask)
pMaskPix = uxa_get_offscreen_pixmap (pMask->pDrawable, &mask_off_x,
&mask_off_y);
if (!pDstPix || !pSrcPix || (pMask && !pMaskPix)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
pSrcPix = uxa_get_offscreen_pixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
if (pMask)
pMaskPix = uxa_get_offscreen_pixmap (pMask->pDrawable, &mask_off_x,
&mask_off_y);
if (!uxa_pixmap_is_offscreen(pDstPix)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (!pSrcPix && (!pMask || pMaskPix) && uxa_screen->info->UploadToScratch) {
pSrcPix = uxa_get_drawable_pixmap (pSrc->pDrawable);
if ((*uxa_screen->info->UploadToScratch) (pSrcPix, &scratch))
pSrcPix = &scratch;
} else if (pSrcPix && pMask && !pMaskPix && uxa_screen->info->UploadToScratch) {
pMaskPix = uxa_get_drawable_pixmap (pMask->pDrawable);
if ((*uxa_screen->info->UploadToScratch) (pMaskPix, &scratch))
pMaskPix = &scratch;
}
if (!pSrcPix || (pMask && !pMaskPix)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (!(*uxa_screen->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
pMaskPix, pDstPix))
if (!(*uxa_screen->info->prepare_composite) (op, pSrc, pMask, pDst, pSrcPix,
pMaskPix, pDstPix))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
@ -543,19 +507,18 @@ uxa_try_driver_composite(CARD8 op,
while (nbox--)
{
(*uxa_screen->info->Composite) (pDstPix,
pbox->x1 + xSrc,
pbox->y1 + ySrc,
pbox->x1 + xMask,
pbox->y1 + yMask,
pbox->x1,
pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
(*uxa_screen->info->composite) (pDstPix,
pbox->x1 + xSrc,
pbox->y1 + ySrc,
pbox->x1 + xMask,
pbox->y1 + yMask,
pbox->x1,
pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
(*uxa_screen->info->DoneComposite) (pDstPix);
uxa_mark_sync(pDst->pDrawable->pScreen);
(*uxa_screen->info->done_composite) (pDstPix);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1;
@ -628,10 +591,10 @@ uxa_try_magic_two_pass_composite_helper(CARD8 op,
assert(op == PictOpOver);
if (uxa_screen->info->CheckComposite &&
(!(*uxa_screen->info->CheckComposite)(PictOpOutReverse, pSrc, pMask,
if (uxa_screen->info->check_composite &&
(!(*uxa_screen->info->check_composite)(PictOpOutReverse, pSrc, pMask,
pDst) ||
!(*uxa_screen->info->CheckComposite)(PictOpAdd, pSrc, pMask, pDst)))
!(*uxa_screen->info->check_composite)(PictOpAdd, pSrc, pMask, pDst)))
{
return -1;
}
@ -735,7 +698,7 @@ uxa_composite(CARD8 op,
DDXPointRec patOrg;
/* Let's see if the driver can do the repeat in one go */
if (uxa_screen->info->PrepareComposite && !pSrc->alphaMap &&
if (uxa_screen->info->prepare_composite && !pSrc->alphaMap &&
!pDst->alphaMap)
{
ret = uxa_try_driver_composite(op, pSrc, pMask, pDst, xSrc,
@ -779,7 +742,7 @@ uxa_composite(CARD8 op,
(yMask + height) <= pMask->pDrawable->height)
pMask->repeat = 0;
if (uxa_screen->info->PrepareComposite &&
if (uxa_screen->info->prepare_composite &&
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
{
Bool isSrcSolid;

View File

@ -100,8 +100,8 @@ uxa_pixmap_is_offscreen(PixmapPtr p)
ScreenPtr pScreen = p->drawable.pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
if (uxa_screen->info->PixmapIsOffscreen)
return uxa_screen->info->PixmapIsOffscreen(p);
if (uxa_screen->info->pixmap_is_offscreen)
return uxa_screen->info->pixmap_is_offscreen(p);
return FALSE;
}
@ -151,14 +151,14 @@ uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access)
if (!offscreen)
return;
if (uxa_screen->info->PrepareAccess)
(*uxa_screen->info->PrepareAccess) (pPixmap, access);
if (uxa_screen->info->prepare_access)
(*uxa_screen->info->prepare_access) (pPixmap, access);
}
/**
* uxa_finish_access() is UXA's wrapper for the driver's FinishAccess() handler.
* uxa_finish_access() is UXA's wrapper for the driver's finish_access() handler.
*
* It deals with calling the driver's FinishAccess() only if necessary.
* It deals with calling the driver's finish_access() only if necessary.
*/
void
uxa_finish_access(DrawablePtr pDrawable)
@ -167,13 +167,13 @@ uxa_finish_access(DrawablePtr pDrawable)
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
PixmapPtr pPixmap = uxa_get_drawable_pixmap (pDrawable);
if (uxa_screen->info->FinishAccess == NULL)
if (uxa_screen->info->finish_access == NULL)
return;
if (!uxa_pixmap_is_offscreen (pPixmap))
return;
(*uxa_screen->info->FinishAccess) (pPixmap);
(*uxa_screen->info->finish_access) (pPixmap);
}
/**
@ -185,7 +185,7 @@ uxa_validate_gc (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
/* fbValidateGC will do direct access to pixmaps if the tiling has changed.
* Preempt fbValidateGC by doing its work and masking the change out, so
* that we can do the Prepare/FinishAccess.
* that we can do the Prepare/finish_access.
*/
#ifdef FB_24_32BIT
if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) {
@ -396,20 +396,14 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
return FALSE;
}
if (!uxa_driver->PrepareSolid) {
LogMessage(X_ERROR, "UXA(%d): uxa_driver_t::PrepareSolid must be "
if (!uxa_driver->prepare_solid) {
LogMessage(X_ERROR, "UXA(%d): uxa_driver_t::prepare_solid must be "
"non-NULL\n", screen->myNum);
return FALSE;
}
if (!uxa_driver->PrepareCopy) {
LogMessage(X_ERROR, "UXA(%d): uxa_driver_t::PrepareCopy must be "
"non-NULL\n", screen->myNum);
return FALSE;
}
if (!uxa_driver->WaitMarker) {
LogMessage(X_ERROR, "UXA(%d): uxa_driver_t::WaitMarker must be "
if (!uxa_driver->prepare_copy) {
LogMessage(X_ERROR, "UXA(%d): uxa_driver_t::prepare_copy must be "
"non-NULL\n", screen->myNum);
return FALSE;
}
@ -418,14 +412,14 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
* that there's a limitation by pixels, and that it's the same as
* maxX.
*
* We want maxPitchPixels or maxPitchBytes to be set so we can check
* We want max_pitch_pixels or max_pitch_bytes to be set so we can check
* pixmaps against the max pitch in uxaCreatePixmap() -- it matters
* whether a pixmap is rejected because of its pitch or
* because of its width.
*/
if (!uxa_driver->maxPitchPixels && !uxa_driver->maxPitchBytes)
if (!uxa_driver->max_pitch_pixels && !uxa_driver->max_pitch_bytes)
{
uxa_driver->maxPitchPixels = uxa_driver->maxX;
uxa_driver->max_pitch_pixels = uxa_driver->max_x;
}
#ifdef RENDER
@ -501,18 +495,18 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver)
LogMessage(X_INFO, "UXA(%d): Driver registered support for the following"
" operations:\n", screen->myNum);
assert(uxa_driver->PrepareSolid != NULL);
LogMessage(X_INFO, " Solid\n");
assert(uxa_driver->PrepareCopy != NULL);
LogMessage(X_INFO, " Copy\n");
if (uxa_driver->PrepareComposite != NULL) {
LogMessage(X_INFO, " Composite (RENDER acceleration)\n");
assert(uxa_driver->prepare_solid != NULL);
LogMessage(X_INFO, " solid\n");
assert(uxa_driver->prepare_copy != NULL);
LogMessage(X_INFO, " copy\n");
if (uxa_driver->prepare_composite != NULL) {
LogMessage(X_INFO, " composite (RENDER acceleration)\n");
}
if (uxa_driver->UploadToScreen != NULL) {
LogMessage(X_INFO, " UploadToScreen\n");
if (uxa_driver->put_image != NULL) {
LogMessage(X_INFO, " put_image\n");
}
if (uxa_driver->DownloadFromScreen != NULL) {
LogMessage(X_INFO, " DownloadFromScreen\n");
if (uxa_driver->get_image != NULL) {
LogMessage(X_INFO, " get_image\n");
}
return TRUE;
@ -528,43 +522,3 @@ uxa_driver_fini (ScreenPtr pScreen)
{
/*right now does nothing*/
}
/**
* uxa_mark_sync() should be called after any asynchronous drawing by the hardware.
*
* @param pScreen screen which drawing occurred on
*
* uxa_mark_sync() sets a flag to indicate that some asynchronous drawing has
* happened and a WaitSync() will be necessary before relying on the contents of
* offscreen memory from the CPU's perspective. It also calls an optional
* driver MarkSync() callback, the return value of which may be used to do partial
* synchronization with the hardware in the future.
*/
void uxa_mark_sync(ScreenPtr pScreen)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
uxa_screen->info->needsSync = TRUE;
if (uxa_screen->info->MarkSync != NULL) {
uxa_screen->info->lastMarker = (*uxa_screen->info->MarkSync)(pScreen);
}
}
/**
* uxa_wait_sync() ensures that all drawing has been completed.
*
* @param pScreen screen being synchronized.
*
* Calls down into the driver to ensure that all previous drawing has completed.
* It should always be called before relying on the framebuffer contents
* reflecting previous drawing, from a CPU perspective.
*/
void uxa_wait_sync(ScreenPtr pScreen)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
if (uxa_screen->info->needsSync && !uxa_screen->swappedOut) {
(*uxa_screen->info->WaitMarker)(pScreen, uxa_screen->info->lastMarker);
uxa_screen->info->needsSync = FALSE;
}
}

287
uxa/uxa.h
View File

@ -70,36 +70,36 @@ typedef struct _UxaDriver {
/** @{ */
/**
* maxX controls the X coordinate limitation for rendering from the card.
* The driver should never receive a request for rendering beyond maxX
* max_x controls the X coordinate limitation for rendering from the card.
* The driver should never receive a request for rendering beyond max_x
* in the X direction from the origin of a pixmap.
*/
int maxX;
int max_x;
/**
* maxY controls the Y coordinate limitation for rendering from the card.
* The driver should never receive a request for rendering beyond maxY
* max_y controls the Y coordinate limitation for rendering from the card.
* The driver should never receive a request for rendering beyond max_y
* in the Y direction from the origin of a pixmap.
*/
int maxY;
int max_y;
/** @} */
/* private */
Bool needsSync;
int lastMarker;
/** @name Solid
/** @name solid
* @{
*/
/**
* PrepareSolid() sets up the driver for doing a solid fill.
* prepare_solid() sets up the driver for doing a solid fill.
* @param pPixmap Destination pixmap
* @param alu raster operation
* @param planemask write mask for the fill
* @param fg "foreground" color for the fill
*
* This call should set up the driver for doing a series of solid fills
* through the Solid() call. The alu raster op is one of the GX*
* through the solid() call. The alu raster op is one of the GX*
* graphics functions listed in X.h, and typically maps to a similar
* single-byte "ROP" setting in all hardware. The planemask controls
* which bits of the destination should be affected, and will only represent
@ -109,16 +109,16 @@ typedef struct _UxaDriver {
* Note that many drivers will need to store some of the data in the driver
* private record, for sending to the hardware with each drawing command.
*
* The PrepareSolid() call is required of all drivers, but it may fail for any
* The prepare_solid() call is required of all drivers, but it may fail for any
* reason. Failure results in a fallback to software rendering.
*/
Bool (*PrepareSolid) (PixmapPtr pPixmap,
Bool (*prepare_solid) (PixmapPtr pPixmap,
int alu,
Pixel planemask,
Pixel fg);
/**
* Solid() performs a solid fill set up in the last PrepareSolid() call.
* solid() performs a solid fill set up in the last prepare_solid() call.
*
* @param pPixmap destination pixmap
* @param x1 left coordinate
@ -126,37 +126,37 @@ typedef struct _UxaDriver {
* @param x2 right coordinate
* @param y2 bottom coordinate
*
* Performs the fill set up by the last PrepareSolid() call, covering the
* Performs the fill set up by the last prepare_solid() call, covering the
* area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
* in the coordinate space of the destination pixmap, so the driver will
* need to set up the hardware's offset and pitch for the destination
* coordinates according to the pixmap's offset and pitch within
* framebuffer.
*
* This call is required if PrepareSolid() ever succeeds.
* This call is required if prepare_solid() ever succeeds.
*/
void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
void (*solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
/**
* DoneSolid() finishes a set of solid fills.
* done_solid() finishes a set of solid fills.
*
* @param pPixmap destination pixmap.
*
* The DoneSolid() call is called at the end of a series of consecutive
* Solid() calls following a successful PrepareSolid(). This allows drivers
* The done_solid() call is called at the end of a series of consecutive
* solid() calls following a successful prepare_solid(). This allows drivers
* to finish up emitting drawing commands that were buffered, or clean up
* state from PrepareSolid().
* state from prepare_solid().
*
* This call is required if PrepareSolid() ever succeeds.
* This call is required if prepare_solid() ever succeeds.
*/
void (*DoneSolid) (PixmapPtr pPixmap);
void (*done_solid) (PixmapPtr pPixmap);
/** @} */
/** @name Copy
/** @name copy
* @{
*/
/**
* PrepareCopy() sets up the driver for doing a copy within video
* prepare_copy() sets up the driver for doing a copy within video
* memory.
*
* @param pSrcPixmap source pixmap
@ -173,7 +173,7 @@ typedef struct _UxaDriver {
* is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
* If your hardware can only support blits that are (left to right, top to
* bottom) or (right to left, bottom to top), then you should set
* #UXA_TWO_BITBLT_DIRECTIONS, and UXA will break down Copy operations to
* #UXA_TWO_BITBLT_DIRECTIONS, and UXA will break down copy operations to
* ones that meet those requirements. The alu raster op is one of the GX*
* graphics functions listed in X.h, and typically maps to a similar
* single-byte "ROP" setting in all hardware. The planemask controls which
@ -183,10 +183,10 @@ typedef struct _UxaDriver {
* Note that many drivers will need to store some of the data in the driver
* private record, for sending to the hardware with each drawing command.
*
* The PrepareCopy() call is required of all drivers, but it may fail for any
* The prepare_copy() call is required of all drivers, but it may fail for any
* reason. Failure results in a fallback to software rendering.
*/
Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
Bool (*prepare_copy) (PixmapPtr pSrcPixmap,
PixmapPtr pDstPixmap,
int dx,
int dy,
@ -194,7 +194,7 @@ typedef struct _UxaDriver {
Pixel planemask);
/**
* Copy() performs a copy set up in the last PrepareCopy call.
* copy() performs a copy set up in the last prepare_copy call.
*
* @param pDstPixmap destination pixmap
* @param srcX source X coordinate
@ -204,20 +204,20 @@ typedef struct _UxaDriver {
* @param width width of the rectangle to be copied
* @param height height of the rectangle to be copied.
*
* Performs the copy set up by the last PrepareCopy() call, copying the
* Performs the copy set up by the last prepare_copy() call, copying the
* rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
* pixmap to the same-sized rectangle at (dstX, dstY) in the destination
* pixmap. Those rectangles may overlap in memory, if
* pSrcPixmap == pDstPixmap. Note that this call does not receive the
* pSrcPixmap as an argument -- if it's needed in this function, it should
* be stored in the driver private during PrepareCopy(). As with Solid(),
* be stored in the driver private during prepare_copy(). As with solid(),
* the coordinates are in the coordinate space of each pixmap, so the driver
* will need to set up source and destination pitches and offsets from those
* pixmaps, probably using uxaGetPixmapOffset() and uxa_get_pixmap_pitch().
*
* This call is required if PrepareCopy ever succeeds.
* This call is required if prepare_copy ever succeeds.
*/
void (*Copy) (PixmapPtr pDstPixmap,
void (*copy) (PixmapPtr pDstPixmap,
int srcX,
int srcY,
int dstX,
@ -226,25 +226,25 @@ typedef struct _UxaDriver {
int height);
/**
* DoneCopy() finishes a set of copies.
* done_copy() finishes a set of copies.
*
* @param pPixmap destination pixmap.
*
* The DoneCopy() call is called at the end of a series of consecutive
* Copy() calls following a successful PrepareCopy(). This allows drivers
* The done_copy() call is called at the end of a series of consecutive
* copy() calls following a successful prepare_copy(). This allows drivers
* to finish up emitting drawing commands that were buffered, or clean up
* state from PrepareCopy().
* state from prepare_copy().
*
* This call is required if PrepareCopy() ever succeeds.
* This call is required if prepare_copy() ever succeeds.
*/
void (*DoneCopy) (PixmapPtr pDstPixmap);
void (*done_copy) (PixmapPtr pDstPixmap);
/** @} */
/** @name Composite
/** @name composite
* @{
*/
/**
* CheckComposite() checks to see if a composite operation could be
* check_composite() checks to see if a composite operation could be
* accelerated.
*
* @param op Render operation
@ -252,25 +252,25 @@ typedef struct _UxaDriver {
* @param pMaskPicture mask picture
* @param pDstPicture destination Picture
*
* The CheckComposite() call checks if the driver could handle acceleration
* The check_composite() call checks if the driver could handle acceleration
* of op with the given source, mask, and destination pictures. This allows
* drivers to check source and destination formats, supported operations,
* transformations, and component alpha state, and send operations it can't
* support to software rendering early on.
*
* See PrepareComposite() for more details on likely issues that drivers
* will have in accelerating Composite operations.
* See prepare_composite() for more details on likely issues that drivers
* will have in accelerating composite operations.
*
* The CheckComposite() call is recommended if PrepareComposite() is
* The check_composite() call is recommended if prepare_composite() is
* implemented, but is not required.
*/
Bool (*CheckComposite) (int op,
Bool (*check_composite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture);
/**
* PrepareComposite() sets up the driver for doing a Composite operation
* prepare_composite() sets up the driver for doing a composite operation
* described in the Render extension protocol spec.
*
* @param op Render operation
@ -281,7 +281,7 @@ typedef struct _UxaDriver {
* @param pMask mask pixmap
* @param pDst destination pixmap
*
* This call should set up the driver for doing a series of Composite
* This call should set up the driver for doing a series of composite
* operations, as described in the Render protocol spec, with the given
* pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
* pDst are the pixmaps containing the pixel data, and should be used for
@ -295,7 +295,7 @@ typedef struct _UxaDriver {
* operation is simply src OP dst instead of src IN mask OP dst, and
* mask coordinates should be ignored.
* - pMarkPicture may have componentAlpha set, which greatly changes
* the behavior of the Composite operation. componentAlpha has no effect
* the behavior of the composite operation. componentAlpha has no effect
* when set on pSrcPicture or pDstPicture.
* - The source and mask Pictures may have a transformation set
* (Picture->transform != NULL), which means that the source coordinates
@ -306,7 +306,7 @@ typedef struct _UxaDriver {
* - The source and mask pictures may have a filter set. PictFilterNearest
* and PictFilterBilinear are defined in the Render protocol, but others
* may be encountered, and must be handled correctly (usually by
* PrepareComposite failing, and falling back to software). Filters have
* prepare_composite failing, and falling back to software). Filters have
* no effect on Pictures when used as a destination.
* - The source and mask Pictures may have repeating set, which must be
* respected. Many chipsets will be unable to support repeating on
@ -318,12 +318,12 @@ typedef struct _UxaDriver {
* Note that many drivers will need to store some of the data in the driver
* private record, for sending to the hardware with each drawing command.
*
* The PrepareComposite() call is not required. However, it is highly
* The prepare_composite() call is not required. However, it is highly
* recommended for performance of antialiased font rendering and performance
* of cairo applications. Failure results in a fallback to software
* rendering.
*/
Bool (*PrepareComposite) (int op,
Bool (*prepare_composite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture,
@ -332,8 +332,8 @@ typedef struct _UxaDriver {
PixmapPtr pDst);
/**
* Composite() performs a Composite operation set up in the last
* PrepareComposite() call.
* composite() performs a composite operation set up in the last
* prepare_composite() call.
*
* @param pDstPixmap destination pixmap
* @param srcX source X coordinate
@ -345,7 +345,7 @@ typedef struct _UxaDriver {
* @param width destination rectangle width
* @param height destination rectangle height
*
* Performs the Composite operation set up by the last PrepareComposite()
* Performs the composite operation set up by the last prepare_composite()
* call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
* in the destination Pixmap. Note that if a transformation was set on
* the source or mask Pictures, the source rectangles may not be the same
@ -353,9 +353,9 @@ typedef struct _UxaDriver {
* transformation right at the subpixel level can be tricky, and rendercheck
* can test this for you.
*
* This call is required if PrepareComposite() ever succeeds.
* This call is required if prepare_composite() ever succeeds.
*/
void (*Composite) (PixmapPtr pDst,
void (*composite) (PixmapPtr pDst,
int srcX,
int srcY,
int maskX,
@ -366,22 +366,22 @@ typedef struct _UxaDriver {
int height);
/**
* DoneComposite() finishes a set of Composite operations.
* done_composite() finishes a set of composite operations.
*
* @param pPixmap destination pixmap.
*
* The DoneComposite() call is called at the end of a series of consecutive
* Composite() calls following a successful PrepareComposite(). This allows
* The done_composite() call is called at the end of a series of consecutive
* composite() calls following a successful prepare_composite(). This allows
* drivers to finish up emitting drawing commands that were buffered, or
* clean up state from PrepareComposite().
* clean up state from prepare_composite().
*
* This call is required if PrepareComposite() ever succeeds.
* This call is required if prepare_composite() ever succeeds.
*/
void (*DoneComposite) (PixmapPtr pDst);
void (*done_composite) (PixmapPtr pDst);
/** @} */
/**
* UploadToScreen() loads a rectangle of data from src into pDst.
* put_image() loads a rectangle of data from src into pDst.
*
* @param pDst destination pixmap
* @param x destination X coordinate.
@ -391,27 +391,23 @@ typedef struct _UxaDriver {
* @param src pointer to the beginning of the source data
* @param src_pitch pitch (in bytes) of the lines of source data.
*
* UploadToScreen() copies data in system memory beginning at src (with
* put_image() copies data in system memory beginning at src (with
* pitch src_pitch) into the destination pixmap from (x, y) to
* (x + width, y + height). This is typically done with hostdata uploads,
* where the CPU sets up a blit command on the hardware with instructions
* that the blit data will be fed through some sort of aperture on the card.
*
* If UploadToScreen() is performed asynchronously, it is up to the driver
* to call uxa_mark_sync(). This is in contrast to most other acceleration
* calls in UXA.
*
* UploadToScreen() can aid in pixmap migration, but is most important for
* the performance of uxa_glyphs() (antialiased font drawing) by allowing
* pipelining of data uploads, avoiding a sync of the card after each glyph.
* put_image() is most important for the performance of uxa_glyphs()
* (antialiased font drawing) by allowing pipelining of data uploads,
* avoiding a sync of the card after each glyph.
*
* @return TRUE if the driver successfully uploaded the data. FALSE
* indicates that UXA should fall back to doing the upload in software.
*
* UploadToScreen() is not required, but is recommended if Composite
* put_image() is not required, but is recommended if composite
* acceleration is supported.
*/
Bool (*UploadToScreen) (PixmapPtr pDst,
Bool (*put_image) (PixmapPtr pDst,
int x,
int y,
int w,
@ -420,33 +416,7 @@ typedef struct _UxaDriver {
int src_pitch);
/**
* UploadToScratch() is used to upload a pixmap to a scratch area for
* acceleration.
*
* @param pSrc source pixmap in host memory
* @param pDst fake, scratch pixmap to be set up in offscreen memory.
*
* The UploadToScratch() call was added to support Xati before Xati had
* support for hostdata uploads and before uxa_glyphs() was written. It
* behaves incorrectly (uses an invalid pixmap as pDst),
* and UploadToScreen() should be implemented instead.
*
* Drivers implementing UploadToScratch() had to set up space (likely in a
* statically allocated area) in offscreen memory, copy pSrc to that
* scratch area, and adust pDst->devKind for the pitch and
* pDst->devPrivate.ptr for the pointer to that scratch area. The driver
* was responsible for syncing (as it was implemented using memcpy() in
* Xati), and only the data from the last UploadToScratch() was guaranteed
* to be valid at any given time.
*
* UploadToScratch() should not be implemented by drivers, and will likely
* be removed in a future version of UXA.
*/
Bool (*UploadToScratch) (PixmapPtr pSrc,
PixmapPtr pDst);
/**
* DownloadFromScreen() loads a rectangle of data from pSrc into dst
* get_image() loads a rectangle of data from pSrc into dst
*
* @param pSrc source pixmap
* @param x source X coordinate.
@ -456,108 +426,72 @@ typedef struct _UxaDriver {
* @param dst pointer to the beginning of the destination data
* @param dst_pitch pitch (in bytes) of the lines of destination data.
*
* DownloadFromScreen() copies data from offscreen memory in pSrc from
* get_image() copies data from offscreen memory in pSrc from
* (x, y) to (x + width, y + height), to system memory starting at
* dst (with pitch dst_pitch). This would usually be done
* using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
* and then synchronously reading from AGP. Because the implementation
* might be synchronous, UXA leaves it up to the driver to call
* uxa_mark_sync() if DownloadFromScreen() was asynchronous. This is in
* uxa_mark_sync() if get_image() was asynchronous. This is in
* contrast to most other acceleration calls in UXA.
*
* DownloadFromScreen() can aid in the largest bottleneck in pixmap
* migration, which is the read from framebuffer when evicting pixmaps from
* framebuffer memory. Thus, it is highly recommended, even though
* implementations are typically complicated.
*
* @return TRUE if the driver successfully downloaded the data. FALSE
* indicates that UXA should fall back to doing the download in software.
*
* DownloadFromScreen() is not required, but is highly recommended.
* get_image() is not required, but is highly recommended.
*/
Bool (*DownloadFromScreen)(PixmapPtr pSrc,
Bool (*get_image)(PixmapPtr pSrc,
int x, int y,
int w, int h,
char *dst, int dst_pitch);
/**
* MarkSync() requests that the driver mark a synchronization point,
* returning an driver-defined integer marker which could be requested for
* synchronization to later in WaitMarker(). This might be used in the
* future to avoid waiting for full hardware stalls before accessing pixmap
* data with the CPU, but is not important in the current incarnation of
* UXA.
*
* Note that drivers should call uxa_mark_sync() when they have done some
* acceleration, rather than their own MarkSync() handler, as otherwise UXA
* will be unaware of the driver's acceleration and not sync to it during
* fallbacks.
*
* MarkSync() is optional.
*/
int (*MarkSync) (ScreenPtr pScreen);
/**
* WaitMarker() waits for all rendering before the given marker to have
* completed. If the driver does not implement MarkSync(), marker is
* meaningless, and all rendering by the hardware should be completed before
* WaitMarker() returns.
*
* Note that drivers should call uxa_wait_sync() to wait for all acceleration
* to finish, as otherwise UXA will be unaware of the driver having
* synchronized, resulting in excessive WaitMarker() calls.
*
* WaitMarker() is required of all drivers.
*/
void (*WaitMarker) (ScreenPtr pScreen, int marker);
/** @{ */
/**
* PrepareAccess() is called before CPU access to an offscreen pixmap.
* prepare_access() is called before CPU access to an offscreen pixmap.
*
* @param pPix the pixmap being accessed
* @param index the index of the pixmap being accessed.
*
* PrepareAccess() will be called before CPU access to an offscreen pixmap.
* prepare_access() will be called before CPU access to an offscreen pixmap.
* This can be used to set up hardware surfaces for byteswapping or
* untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
* making CPU access use a different aperture.
*
* The index is one of #UXA_PREPARE_DEST, #UXA_PREPARE_SRC, or
* #UXA_PREPARE_MASK, indicating which pixmap is in question. Since only up
* to three pixmaps will have PrepareAccess() called on them per operation,
* to three pixmaps will have prepare_access() called on them per operation,
* drivers can have a small, statically-allocated space to maintain state
* for PrepareAccess() and FinishAccess() in. Note that the same pixmap may
* have PrepareAccess() called on it more than once, for uxample when doing
* a copy within the same pixmap (so it gets PrepareAccess as()
* for prepare_access() and finish_access() in. Note that the same pixmap may
* have prepare_access() called on it more than once, for uxample when doing
* a copy within the same pixmap (so it gets prepare_access as()
* #UXA_PREPARE_DEST and then as #UXA_PREPARE_SRC).
*
* PrepareAccess() may fail. An uxample might be the case of hardware that
* can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
* prepare_access() may fail. An uxample might be the case of hardware that
* can set up 1 or 2 surfaces for CPU access, but not 3. If prepare_access()
* fails, UXA will migrate the pixmap to system memory.
* DownloadFromScreen() must be implemented and must not fail if a driver
* wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
* get_image() must be implemented and must not fail if a driver
* wishes to fail in prepare_access(). prepare_access() must not fail when
* pPix is the visible screen, because the visible screen can not be
* migrated.
*
* @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
* @return TRUE if prepare_access() successfully prepared the pixmap for CPU
* drawing.
* @return FALSE if PrepareAccess() is unsuccessful and UXA should use
* DownloadFromScreen() to migate the pixmap out.
* @return FALSE if prepare_access() is unsuccessful and UXA should use
* get_image() to migate the pixmap out.
*/
Bool (*PrepareAccess)(PixmapPtr pPix, uxa_access_t access);
Bool (*prepare_access)(PixmapPtr pPix, uxa_access_t access);
/**
* FinishAccess() is called after CPU access to an offscreen pixmap.
* finish_access() is called after CPU access to an offscreen pixmap.
*
* @param pPix the pixmap being accessed
* @param index the index of the pixmap being accessed.
*
* FinishAccess() will be called after finishing CPU access of an offscreen
* pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
* called if PrepareAccess() failed.
* finish_access() will be called after finishing CPU access of an offscreen
* pixmap set up by prepare_access(). Note that the finish_access() will not be
* called if prepare_access() failed.
*/
void (*FinishAccess)(PixmapPtr pPix);
void (*finish_access)(PixmapPtr pPix);
/**
* PixmapIsOffscreen() is an optional driver replacement to
@ -569,42 +503,42 @@ typedef struct _UxaDriver {
*
* uxa_pixmap_is_offscreen() is used to determine if a pixmap is in offscreen
* memory, meaning that acceleration could probably be done to it, and that it
* will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
* will need to be wrapped by prepare_access()/finish_access() when accessing it
* with the CPU.
*
*
*/
Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
Bool (*pixmap_is_offscreen)(PixmapPtr pPix);
/**
* maxPitchPixels controls the pitch limitation for rendering from
* max_pitch_pixels controls the pitch limitation for rendering from
* the card.
* The driver should never receive a request for rendering a pixmap
* that has a pitch (in pixels) beyond maxPitchPixels.
* that has a pitch (in pixels) beyond max_pitch_pixels.
*
* Setting this field is optional -- if your hardware doesn't have
* a pitch limitation in pixels, don't set this. If neither this value
* nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
* If set, it must not be smaller than maxX.
* nor max_pitch_bytes is set, then max_pitch_pixels is set to max_x.
* If set, it must not be smaller than max_x.
*
* @sa maxPitchBytes
* @sa max_pitch_bytes
*/
int maxPitchPixels;
int max_pitch_pixels;
/**
* maxPitchBytes controls the pitch limitation for rendering from
* max_pitch_bytes controls the pitch limitation for rendering from
* the card.
* The driver should never receive a request for rendering a pixmap
* that has a pitch (in bytes) beyond maxPitchBytes.
* that has a pitch (in bytes) beyond max_pitch_bytes.
*
* Setting this field is optional -- if your hardware doesn't have
* a pitch limitation in bytes, don't set this.
* If set, it must not be smaller than maxX * 4.
* There's no default value for maxPitchBytes.
* If set, it must not be smaller than max_x * 4.
* There's no default value for max_pitch_bytes.
*
* @sa maxPitchPixels
* @sa max_pitch_pixels
*/
int maxPitchBytes;
int max_pitch_bytes;
/** @} */
} uxa_driver_t;
@ -630,15 +564,6 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver);
void
uxa_driver_fini(ScreenPtr pScreen);
void
uxa_mark_sync(ScreenPtr pScreen);
void
uxa_wait_sync(ScreenPtr pScreen);
void
uxaEnableDisableFBAccess (int index, Bool enable);
CARD32
uxa_get_pixmap_first_pixel (PixmapPtr pPixmap);