Change PrepareAccess to take access mode rather than index

This commit is contained in:
Keith Packard 2008-08-04 18:17:20 -07:00
parent c155bb3cb1
commit fc4d9c55a7
7 changed files with 116 additions and 142 deletions

View File

@ -553,19 +553,36 @@ i830_uxa_get_pixmap_bo (PixmapPtr pixmap)
}
static Bool
i830_uxa_prepare_access (PixmapPtr pixmap, int index)
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]);
if (dri_bo_map (bo, index == UXA_PREPARE_DEST) != 0)
if (dri_bo_map (bo, access == UXA_ACCESS_RW) != 0)
return FALSE;
pixmap->devPrivate.ptr = bo->virtual;
}
return TRUE;
}
static void
i830_uxa_finish_access (PixmapPtr pixmap)
{
dri_bo *bo = i830_uxa_get_pixmap_bo (pixmap);
if (bo) {
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
I830Ptr i830 = I830PTR(scrn);
dri_bo_unmap (bo);
pixmap->devPrivate.ptr = NULL;
if (bo == i830->front_buffer->bo)
i830->need_flush = TRUE;
}
}
void
i830_uxa_block_handler (ScreenPtr screen)
{
@ -578,22 +595,6 @@ i830_uxa_block_handler (ScreenPtr screen)
}
}
static void
i830_uxa_finish_access (PixmapPtr pixmap, int index)
{
dri_bo *bo = i830_uxa_get_pixmap_bo (pixmap);
if (bo) {
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
I830Ptr i830 = I830PTR(scrn);
dri_bo_unmap (bo);
if (bo == i830->front_buffer->bo)
i830->need_flush = TRUE;
}
}
static Bool
i830_uxa_pixmap_is_offscreen(PixmapPtr pixmap)
{
@ -626,16 +627,8 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
return NullPixmap;
}
if (dri_bo_map (bo, FALSE) != 0) {
fbDestroyPixmap (pixmap);
dri_bo_unreference (bo);
return NullPixmap;
}
screen->ModifyPixmapHeader (pixmap, w, h, 0, 0, stride,
(pointer) bo->virtual);
screen->ModifyPixmapHeader (pixmap, w, h, 0, 0, stride, NULL);
dri_bo_unmap (bo);
i830_uxa_set_pixmap_bo (pixmap, bo);
}
@ -648,10 +641,8 @@ i830_uxa_destroy_pixmap (PixmapPtr pixmap)
if (pixmap->refcnt == 1) {
dri_bo *bo = i830_uxa_get_pixmap_bo (pixmap);
if (bo) {
dri_bo_unmap (bo);
if (bo)
dri_bo_unreference (bo);
}
}
fbDestroyPixmap (pixmap);
return TRUE;
@ -705,6 +696,7 @@ i830_uxa_init (ScreenPtr pScreen)
i830->uxa_driver->Copy = I830EXACopy;
i830->uxa_driver->DoneCopy = I830EXADoneCopy;
#if 0
/* Composite */
if (!IS_I9XX(i830)) {
i830->uxa_driver->CheckComposite = i830_check_composite;
@ -724,6 +716,7 @@ i830_uxa_init (ScreenPtr pScreen)
i830->uxa_driver->Composite = i965_composite;
i830->uxa_driver->DoneComposite = i830_done_composite;
}
#endif
i830->uxa_driver->PrepareAccess = i830_uxa_prepare_access;
i830->uxa_driver->FinishAccess = i830_uxa_finish_access;

View File

@ -189,8 +189,7 @@ uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int dstXoff, dstYoff;
if (!access_prepared) {
uxa_prepare_access(pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access(pDrawable, UXA_ACCESS_RW);
access_prepared = TRUE;
}
@ -210,7 +209,7 @@ uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
}
if (access_prepared)
uxa_finish_access(pDrawable, UXA_PREPARE_DEST);
uxa_finish_access(pDrawable);
else
uxa_mark_sync(pDrawable->pScreen);
@ -240,10 +239,10 @@ uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
if (!pPixmap)
return FALSE;
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbCopyArea((DrawablePtr)pPixmap, pDrawable, pGC, sx, sy, sw, sh, dx, dy);
uxa_finish_access(pDrawable, UXA_PREPARE_DEST);
uxa_finish_access(pDrawable);
FreeScratchPixmapHeader(pPixmap);
@ -266,10 +265,10 @@ uxa_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int form
{
if (!uxa_do_shm_put_image(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh,
dx, dy, data)) {
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
data);
uxa_finish_access(pDrawable, UXA_PREPARE_DEST);
uxa_finish_access(pDrawable);
}
}
@ -474,12 +473,12 @@ fallback:
UXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
uxa_drawable_location(pSrcDrawable),
uxa_drawable_location(pDstDrawable)));
uxa_prepare_access (pDstDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pSrcDrawable, UXA_PREPARE_SRC);
uxa_prepare_access (pDstDrawable, UXA_ACCESS_RW);
uxa_prepare_access (pSrcDrawable, UXA_ACCESS_RO);
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse,
upsidedown, bitplane, closure);
uxa_finish_access (pSrcDrawable, UXA_PREPARE_SRC);
uxa_finish_access (pDstDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pSrcDrawable);
uxa_finish_access (pDstDrawable);
}
RegionPtr
@ -1029,9 +1028,9 @@ fallback:
UXA_FALLBACK(("from %p (%c)\n", pDrawable,
uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_SRC);
uxa_prepare_access (pDrawable, UXA_ACCESS_RO);
fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
uxa_finish_access (pDrawable, UXA_PREPARE_SRC);
uxa_finish_access (pDrawable);
out:
return;

View File

@ -350,10 +350,10 @@ uxa_check_composite (CARD8 op,
/* uxa.c */
void
uxa_prepare_access(DrawablePtr pDrawable, int index);
uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access);
void
uxa_finish_access(DrawablePtr pDrawable, int index);
uxa_finish_access(DrawablePtr pDrawable);
void
uxa_get_drawable_deltas (DrawablePtr pDrawable, PixmapPtr pPixmap,

View File

@ -926,12 +926,12 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
xoff += pDraw->x;
yoff += pDraw->y;
uxa_prepare_access(pDraw, UXA_PREPARE_DEST);
uxa_prepare_access(pDraw, UXA_ACCESS_RW);
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
uxa_finish_access(pDraw, UXA_PREPARE_DEST);
uxa_finish_access(pDraw);
}
else if (maskFormat)
{
@ -948,11 +948,11 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
if (!pPicture)
return;
uxa_prepare_access(pPicture->pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW);
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pPicture, traps,
-bounds.x1, -bounds.y1);
uxa_finish_access(pPicture->pDrawable, UXA_PREPARE_DEST);
uxa_finish_access(pPicture->pDrawable);
xRel = bounds.x1 + xSrc - xDst;
yRel = bounds.y1 + ySrc - yDst;
@ -1009,9 +1009,9 @@ uxa_triangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
if (direct)
{
DrawablePtr pDraw = pDst->pDrawable;
uxa_prepare_access(pDraw, UXA_PREPARE_DEST);
uxa_prepare_access(pDraw, UXA_ACCESS_RW);
(*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
uxa_finish_access(pDraw, UXA_PREPARE_DEST);
uxa_finish_access(pDraw);
}
else if (maskFormat)
{
@ -1028,9 +1028,9 @@ uxa_triangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
if (!pPicture)
return;
uxa_prepare_access(pPicture->pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW);
(*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
uxa_finish_access(pPicture->pDrawable, UXA_PREPARE_DEST);
uxa_finish_access(pPicture->pDrawable);
xRel = bounds.x1 + xSrc - xDst;
yRel = bounds.y1 + ySrc - yDst;

View File

@ -45,9 +45,9 @@ void
uxa_prepare_access_gc(GCPtr pGC)
{
if (pGC->stipple)
uxa_prepare_access(&pGC->stipple->drawable, UXA_PREPARE_MASK);
uxa_prepare_access(&pGC->stipple->drawable, UXA_ACCESS_RO);
if (pGC->fillStyle == FillTiled)
uxa_prepare_access(&pGC->tile.pixmap->drawable, UXA_PREPARE_SRC);
uxa_prepare_access(&pGC->tile.pixmap->drawable, UXA_ACCESS_RO);
}
/**
@ -57,9 +57,9 @@ void
uxa_finish_access_gc(GCPtr pGC)
{
if (pGC->fillStyle == FillTiled)
uxa_finish_access(&pGC->tile.pixmap->drawable, UXA_PREPARE_MASK);
uxa_finish_access(&pGC->tile.pixmap->drawable);
if (pGC->stipple)
uxa_finish_access(&pGC->stipple->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pGC->stipple->drawable);
}
#if DEBUG_TRACE_FALL
@ -75,11 +75,11 @@ uxa_check_fill_spans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
DDXPointPtr ppt, int *pwidth, int fSorted)
{
UXA_FALLBACK(("to %p (%c)\n", pDrawable, uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
void
@ -87,9 +87,9 @@ uxa_check_set_spans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
UXA_FALLBACK(("to %p (%c)\n", pDrawable, uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
void
@ -98,9 +98,9 @@ uxa_check_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth,
char *bits)
{
UXA_FALLBACK(("to %p (%c)\n", pDrawable, uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
RegionPtr
@ -111,11 +111,11 @@ uxa_check_copy_area (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
UXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
uxa_drawable_location(pSrc), uxa_drawable_location(pDst)));
uxa_prepare_access (pDst, UXA_PREPARE_DEST);
uxa_prepare_access (pSrc, UXA_PREPARE_SRC);
uxa_prepare_access (pDst, UXA_ACCESS_RW);
uxa_prepare_access (pSrc, UXA_ACCESS_RO);
ret = fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
uxa_finish_access (pSrc, UXA_PREPARE_SRC);
uxa_finish_access (pDst, UXA_PREPARE_DEST);
uxa_finish_access (pSrc);
uxa_finish_access (pDst);
return ret;
}
@ -129,12 +129,12 @@ uxa_check_copy_plane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
UXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
uxa_drawable_location(pSrc), uxa_drawable_location(pDst)));
uxa_prepare_access (pDst, UXA_PREPARE_DEST);
uxa_prepare_access (pSrc, UXA_PREPARE_SRC);
uxa_prepare_access (pDst, UXA_ACCESS_RW);
uxa_prepare_access (pSrc, UXA_ACCESS_RO);
ret = fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
bitPlane);
uxa_finish_access (pSrc, UXA_PREPARE_SRC);
uxa_finish_access (pDst, UXA_PREPARE_DEST);
uxa_finish_access (pSrc);
uxa_finish_access (pDst);
return ret;
}
@ -144,9 +144,9 @@ uxa_check_poly_point (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
DDXPointPtr pptInit)
{
UXA_FALLBACK(("to %p (%c)\n", pDrawable, uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
fbPolyPoint (pDrawable, pGC, mode, npt, pptInit);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
void
@ -158,11 +158,11 @@ uxa_check_poly_lines (DrawablePtr pDrawable, GCPtr pGC,
pGC->lineWidth, mode, npt));
if (pGC->lineWidth == 0) {
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbPolyLine (pDrawable, pGC, mode, npt, ppt);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
return;
}
/* fb calls mi functions in the lineWidth != 0 case. */
@ -176,11 +176,11 @@ uxa_check_poly_segment (DrawablePtr pDrawable, GCPtr pGC,
UXA_FALLBACK(("to %p (%c) width %d, count %d\n", pDrawable,
uxa_drawable_location(pDrawable), pGC->lineWidth, nsegInit));
if (pGC->lineWidth == 0) {
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbPolySegment (pDrawable, pGC, nsegInit, pSegInit);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
return;
}
/* fb calls mi functions in the lineWidth != 0 case. */
@ -200,11 +200,11 @@ uxa_check_poly_arc (DrawablePtr pDrawable, GCPtr pGC,
#if 0
if (pGC->lineWidth == 0)
{
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbPolyArc (pDrawable, pGC, narcs, pArcs);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
return;
}
#endif
@ -217,11 +217,11 @@ uxa_check_poly_fill_rect (DrawablePtr pDrawable, GCPtr pGC,
{
UXA_FALLBACK(("to %p (%c)\n", pDrawable, uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbPolyFillRect (pDrawable, pGC, nrect, prect);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
void
@ -231,11 +231,11 @@ uxa_check_image_glyph_blt (DrawablePtr pDrawable, GCPtr pGC,
{
UXA_FALLBACK(("to %p (%c)\n", pDrawable,
uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
void
@ -245,11 +245,11 @@ uxa_check_poly_glyph_blt (DrawablePtr pDrawable, GCPtr pGC,
{
UXA_FALLBACK(("to %p (%c), style %d alu %d\n", pDrawable,
uxa_drawable_location(pDrawable), pGC->fillStyle, pGC->alu));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access_gc (pGC);
fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
uxa_finish_access_gc (pGC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pDrawable);
}
void
@ -260,13 +260,13 @@ uxa_check_push_pixels (GCPtr pGC, PixmapPtr pBitmap,
UXA_FALLBACK(("from %p to %p (%c,%c)\n", pBitmap, pDrawable,
uxa_drawable_location(&pBitmap->drawable),
uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (&pBitmap->drawable, UXA_PREPARE_SRC);
uxa_prepare_access (pDrawable, UXA_ACCESS_RW);
uxa_prepare_access (&pBitmap->drawable, UXA_ACCESS_RO);
uxa_prepare_access_gc (pGC);
fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
uxa_finish_access_gc (pGC);
uxa_finish_access (&pBitmap->drawable, UXA_PREPARE_SRC);
uxa_finish_access (pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (&pBitmap->drawable);
uxa_finish_access (pDrawable);
}
void
@ -278,9 +278,9 @@ uxa_check_get_spans (DrawablePtr pDrawable,
char *pdstStart)
{
UXA_FALLBACK(("from %p (%c)\n", pDrawable, uxa_drawable_location(pDrawable)));
uxa_prepare_access (pDrawable, UXA_PREPARE_SRC);
uxa_prepare_access (pDrawable, UXA_ACCESS_RO);
fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
uxa_finish_access (pDrawable, UXA_PREPARE_SRC);
uxa_finish_access (pDrawable);
}
void
@ -300,11 +300,11 @@ uxa_check_composite (CARD8 op,
UXA_FALLBACK(("from picts %p/%p to pict %p\n",
pSrc, pMask, pDst));
uxa_prepare_access (pDst->pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access (pDst->pDrawable, UXA_ACCESS_RW);
if (pSrc->pDrawable != NULL)
uxa_prepare_access (pSrc->pDrawable, UXA_PREPARE_SRC);
uxa_prepare_access (pSrc->pDrawable, UXA_ACCESS_RO);
if (pMask && pMask->pDrawable != NULL)
uxa_prepare_access (pMask->pDrawable, UXA_PREPARE_MASK);
uxa_prepare_access (pMask->pDrawable, UXA_ACCESS_RO);
fbComposite (op,
pSrc,
pMask,
@ -318,10 +318,10 @@ uxa_check_composite (CARD8 op,
width,
height);
if (pMask && pMask->pDrawable != NULL)
uxa_finish_access (pMask->pDrawable, UXA_PREPARE_MASK);
uxa_finish_access (pMask->pDrawable);
if (pSrc->pDrawable != NULL)
uxa_finish_access (pSrc->pDrawable, UXA_PREPARE_SRC);
uxa_finish_access (pDst->pDrawable, UXA_PREPARE_DEST);
uxa_finish_access (pSrc->pDrawable);
uxa_finish_access (pDst->pDrawable);
}
void
@ -333,9 +333,9 @@ uxa_check_add_traps (PicturePtr pPicture,
{
UXA_FALLBACK(("to pict %p (%c)\n",
uxa_drawable_location(pPicture->pDrawable)));
uxa_prepare_access(pPicture->pDrawable, UXA_PREPARE_DEST);
uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW);
fbAddTraps (pPicture, x_off, y_off, ntrap, traps);
uxa_finish_access(pPicture->pDrawable, UXA_PREPARE_DEST);
uxa_finish_access(pPicture->pDrawable);
}
/**
@ -350,7 +350,7 @@ uxa_get_pixmap_first_pixel (PixmapPtr pPixmap)
CARD32 pixel;
void *fb;
uxa_prepare_access (&pPixmap->drawable, UXA_PREPARE_SRC);
uxa_prepare_access (&pPixmap->drawable, UXA_ACCESS_RO);
fb = pPixmap->devPrivate.ptr;
switch (pPixmap->drawable.bitsPerPixel) {
@ -364,7 +364,7 @@ uxa_get_pixmap_first_pixel (PixmapPtr pPixmap)
pixel = *(CARD8 *)fb;
break;
}
uxa_finish_access(&pPixmap->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pPixmap->drawable);
return pixel;
}

View File

@ -141,7 +141,7 @@ uxa_get_offscreen_pixmap (DrawablePtr drawable, int *xp, int *yp)
* PrepareAccess() is necessary, and working around PrepareAccess() failure.
*/
void
uxa_prepare_access(DrawablePtr pDrawable, int index)
uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access)
{
ScreenPtr pScreen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
@ -152,7 +152,7 @@ uxa_prepare_access(DrawablePtr pDrawable, int index)
return;
if (uxa_screen->info->PrepareAccess)
(*uxa_screen->info->PrepareAccess) (pPixmap, index);
(*uxa_screen->info->PrepareAccess) (pPixmap, access);
}
/**
@ -161,7 +161,7 @@ uxa_prepare_access(DrawablePtr pDrawable, int index)
* It deals with calling the driver's FinishAccess() only if necessary.
*/
void
uxa_finish_access(DrawablePtr pDrawable, int index)
uxa_finish_access(DrawablePtr pDrawable)
{
ScreenPtr pScreen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
@ -173,7 +173,7 @@ uxa_finish_access(DrawablePtr pDrawable, int index)
if (!uxa_pixmap_is_offscreen (pPixmap))
return;
(*uxa_screen->info->FinishAccess) (pPixmap, index);
(*uxa_screen->info->FinishAccess) (pPixmap);
}
/**
@ -209,10 +209,10 @@ uxa_validate_gc (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
* allocated pixmap. This isn't a problem yet, since we don't
* put pixmaps in FB until at least one accelerated UXA op.
*/
uxa_prepare_access(&pOldTile->drawable, UXA_PREPARE_SRC);
uxa_prepare_access(&pOldTile->drawable, UXA_ACCESS_RO);
pNewTile = fb24_32ReformatTile (pOldTile,
pDrawable->bitsPerPixel);
uxa_finish_access(&pOldTile->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pOldTile->drawable);
}
if (pNewTile)
{
@ -227,9 +227,9 @@ uxa_validate_gc (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
if (!pGC->tileIsPixel && FbEvenTile (pGC->tile.pixmap->drawable.width *
pDrawable->bitsPerPixel))
{
uxa_prepare_access(&pGC->tile.pixmap->drawable, UXA_PREPARE_SRC);
uxa_prepare_access(&pGC->tile.pixmap->drawable, UXA_ACCESS_RW);
fbPadPixmap (pGC->tile.pixmap);
uxa_finish_access(&pGC->tile.pixmap->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pGC->tile.pixmap->drawable);
}
/* Mask out the GCTile change notification, now that we've done FB's
* job for it.
@ -273,20 +273,20 @@ void
uxa_prepare_access_window(WindowPtr pWin)
{
if (pWin->backgroundState == BackgroundPixmap)
uxa_prepare_access(&pWin->background.pixmap->drawable, UXA_PREPARE_SRC);
uxa_prepare_access(&pWin->background.pixmap->drawable, UXA_ACCESS_RO);
if (pWin->borderIsPixel == FALSE)
uxa_prepare_access(&pWin->border.pixmap->drawable, UXA_PREPARE_SRC);
uxa_prepare_access(&pWin->border.pixmap->drawable, UXA_ACCESS_RO);
}
void
uxa_finish_access_window(WindowPtr pWin)
{
if (pWin->backgroundState == BackgroundPixmap)
uxa_finish_access(&pWin->background.pixmap->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pWin->background.pixmap->drawable);
if (pWin->borderIsPixel == FALSE)
uxa_finish_access(&pWin->border.pixmap->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pWin->border.pixmap->drawable);
}
static Bool
@ -304,9 +304,9 @@ static RegionPtr
uxa_bitmap_to_region(PixmapPtr pPix)
{
RegionPtr ret;
uxa_prepare_access(&pPix->drawable, UXA_PREPARE_SRC);
uxa_prepare_access(&pPix->drawable, UXA_ACCESS_RO);
ret = fbPixmapToRegion(pPix);
uxa_finish_access(&pPix->drawable, UXA_PREPARE_SRC);
uxa_finish_access(&pPix->drawable);
return ret;
}

View File

@ -43,6 +43,11 @@
#define UXA_VERSION_MINOR 0
#define UXA_VERSION_RELEASE 0
typedef enum {
UXA_ACCESS_RO,
UXA_ACCESS_RW
} uxa_access_t;
/**
* The UxaDriver structure is allocated through uxa_driver_alloc(), and then
* fllled in by drivers.
@ -251,11 +256,7 @@ typedef struct _UxaDriver {
* 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. This avoids costly pixmap
* migration to the wrong places when the driver can't accelerate
* operations. Note that because migration hasn't happened, the driver
* can't know during CheckComposite() what the offsets and pitches of the
* pixmaps are going to be.
* support to software rendering early on.
*
* See PrepareComposite() for more details on likely issues that drivers
* will have in accelerating Composite operations.
@ -544,7 +545,7 @@ typedef struct _UxaDriver {
* @return FALSE if PrepareAccess() is unsuccessful and UXA should use
* DownloadFromScreen() to migate the pixmap out.
*/
Bool (*PrepareAccess)(PixmapPtr pPix, int index);
Bool (*PrepareAccess)(PixmapPtr pPix, uxa_access_t access);
/**
* FinishAccess() is called after CPU access to an offscreen pixmap.
@ -554,9 +555,9 @@ typedef struct _UxaDriver {
*
* 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 and the pixmap was migrated out.
* called if PrepareAccess() failed.
*/
void (*FinishAccess)(PixmapPtr pPix, int index);
void (*FinishAccess)(PixmapPtr pPix);
/**
* PixmapIsOffscreen() is an optional driver replacement to
@ -575,25 +576,6 @@ typedef struct _UxaDriver {
*/
Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
/** @name PrepareAccess() and FinishAccess() indices
* @{
*/
/**
* UXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
* read from.
*/
#define UXA_PREPARE_DEST 0
/**
* UXA_PREPARE_SRC is the index for a pixmap that may be read from
*/
#define UXA_PREPARE_SRC 1
/**
* UXA_PREPARE_SRC is the index for a second pixmap that may be read
* from.
*/
#define UXA_PREPARE_MASK 2
/** @} */
/**
* maxPitchPixels controls the pitch limitation for rendering from
* the card.