summaryrefslogtreecommitdiff
path: root/uxa
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2011-11-16 15:04:37 +0800
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-16 23:57:57 +0000
commitc4c2eb1fae2518578a56a278afeaec66d544439d (patch)
treeb3118085c66789139858286d98e522b7ffb1252e /uxa
parentac7df2919b92c9fe47c6745975e1848932f989e8 (diff)
uxa/glamor: Introduce additional access modes to wrap glamor acceleration
Integrate glamor acceleration into UXA framework. Add necessary flushing at the following points: 1. Flush UXA batch buffer before call into glamor. 2. Flush GL operations after return from a glamor function. 3. The point we need to flush UXA batch buffer, we also need to flush GL operations, for example, in intel_flush_callback and couple of places in intel_display.c. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'uxa')
-rw-r--r--uxa/uxa-accel.c8
-rw-r--r--uxa/uxa-priv.h4
-rw-r--r--uxa/uxa-render.c16
-rw-r--r--uxa/uxa-unaccel.c58
-rw-r--r--uxa/uxa.c18
-rw-r--r--uxa/uxa.h13
6 files changed, 63 insertions, 54 deletions
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 516834f6..f471ff46 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -187,7 +187,7 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
(x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp,
y2 - y1, GXcopy, FB_ALLONES, dstBpp);
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -481,9 +481,9 @@ fallback:
dx, dy, reverse, upsidedown, bitplane,
closure);
if (pSrcDrawable != pDstDrawable)
- uxa_finish_access(pSrcDrawable);
+ uxa_finish_access(pSrcDrawable, UXA_ACCESS_RO);
}
- uxa_finish_access(pDstDrawable);
+ uxa_finish_access(pDstDrawable, UXA_ACCESS_RW);
}
}
@@ -1013,7 +1013,7 @@ fallback:
if (uxa_prepare_access(pDrawable, UXA_ACCESS_RO)) {
fbGetImage(pDrawable, x, y, w, h, format, planeMask, d);
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RO);
}
return;
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 6b9a9c11..a455f25d 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -325,10 +325,10 @@ uxa_check_composite(CARD8 op,
/* uxa.c */
Bool uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access);
-void uxa_finish_access(DrawablePtr pDrawable);
+void uxa_finish_access(DrawablePtr pDrawable, uxa_access_t access);
Bool uxa_picture_prepare_access(PicturePtr picture, int mode);
-void uxa_picture_finish_access(PicturePtr picture);
+void uxa_picture_finish_access(PicturePtr picture, int mode);
void
uxa_get_drawable_deltas(DrawablePtr pDrawable, PixmapPtr pPixmap,
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 34257c6e..51c12f17 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -571,7 +571,7 @@ uxa_picture_from_pixman_image(ScreenPtr screen,
if (uxa_picture_prepare_access(picture, UXA_ACCESS_RW)) {
fbComposite(PictOpSrc, src, NULL, picture,
0, 0, 0, 0, 0, 0, width, height);
- uxa_picture_finish_access(picture);
+ uxa_picture_finish_access(picture, UXA_ACCESS_RW);
}
FreePicture(src, 0);
@@ -599,7 +599,7 @@ uxa_create_solid(ScreenPtr screen, uint32_t color)
return 0;
}
*((uint32_t *)pixmap->devPrivate.ptr) = color;
- uxa_finish_access((DrawablePtr)pixmap);
+ uxa_finish_access((DrawablePtr)pixmap, UXA_ACCESS_RW);
picture = CreatePicture(0, &pixmap->drawable,
PictureMatchFormat(screen, 32, PICT_a8r8g8b8),
@@ -702,7 +702,7 @@ uxa_acquire_pattern(ScreenPtr pScreen,
if (uxa_picture_prepare_access(pDst, UXA_ACCESS_RW)) {
fbComposite(PictOpSrc, pSrc, NULL, pDst,
x, y, 0, 0, 0, 0, width, height);
- uxa_picture_finish_access(pDst);
+ uxa_picture_finish_access(pDst, UXA_ACCESS_RW);
return pDst;
} else {
FreePicture(pDst, 0);
@@ -761,9 +761,9 @@ uxa_render_picture(ScreenPtr screen,
ret = 1;
fbComposite(PictOpSrc, src, NULL, picture,
x, y, 0, 0, 0, 0, width, height);
- uxa_picture_finish_access(src);
+ uxa_picture_finish_access(src, UXA_ACCESS_RO);
}
- uxa_picture_finish_access(picture);
+ uxa_picture_finish_access(picture, UXA_ACCESS_RW);
}
if (!ret) {
@@ -1902,7 +1902,7 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (dst, traps, 0, 0);
- uxa_finish_access(pDraw);
+ uxa_finish_access(pDraw, UXA_ACCESS_RW);
}
} else if (maskFormat) {
PixmapPtr scratch = NULL;
@@ -2013,7 +2013,7 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
DrawablePtr pDraw = pDst->pDrawable;
if (uxa_prepare_access(pDraw, UXA_ACCESS_RW)) {
(*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
- uxa_finish_access(pDraw);
+ uxa_finish_access(pDraw, UXA_ACCESS_RW);
}
} else if (maskFormat) {
PicturePtr pPicture;
@@ -2049,7 +2049,7 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) {
(*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1,
ntri, tris);
- uxa_finish_access(pPicture->pDrawable);
+ uxa_finish_access(pPicture->pDrawable, UXA_ACCESS_RW);
}
xRel = bounds.x1 + xSrc - xDst;
diff --git a/uxa/uxa-unaccel.c b/uxa/uxa-unaccel.c
index 1d4b2c02..f4310494 100644
--- a/uxa/uxa-unaccel.c
+++ b/uxa/uxa-unaccel.c
@@ -50,7 +50,7 @@ Bool uxa_prepare_access_gc(GCPtr pGC)
if (!uxa_prepare_access
(&pGC->tile.pixmap->drawable, UXA_ACCESS_RO)) {
if (pGC->stipple)
- uxa_finish_access(&pGC->stipple->drawable);
+ uxa_finish_access(&pGC->stipple->drawable, UXA_ACCESS_RO);
return FALSE;
}
return TRUE;
@@ -62,9 +62,9 @@ Bool uxa_prepare_access_gc(GCPtr pGC)
void uxa_finish_access_gc(GCPtr pGC)
{
if (pGC->fillStyle == FillTiled)
- uxa_finish_access(&pGC->tile.pixmap->drawable);
+ uxa_finish_access(&pGC->tile.pixmap->drawable, UXA_ACCESS_RO);
if (pGC->stipple)
- uxa_finish_access(&pGC->stipple->drawable);
+ uxa_finish_access(&pGC->stipple->drawable, UXA_ACCESS_RO);
}
Bool uxa_picture_prepare_access(PicturePtr picture, int mode)
@@ -77,21 +77,21 @@ Bool uxa_picture_prepare_access(PicturePtr picture, int mode)
if (picture->alphaMap &&
!uxa_prepare_access(picture->alphaMap->pDrawable, mode)) {
- uxa_finish_access(picture->pDrawable);
+ uxa_finish_access(picture->pDrawable, mode);
return FALSE;
}
return TRUE;
}
-void uxa_picture_finish_access(PicturePtr picture)
+void uxa_picture_finish_access(PicturePtr picture, int mode)
{
if (picture->pDrawable == NULL)
return;
- uxa_finish_access(picture->pDrawable);
+ uxa_finish_access(picture->pDrawable, mode);
if (picture->alphaMap)
- uxa_finish_access(picture->alphaMap->pDrawable);
+ uxa_finish_access(picture->alphaMap->pDrawable, mode);
}
@@ -114,7 +114,7 @@ uxa_check_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int nspans,
fSorted);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -128,7 +128,7 @@ uxa_check_set_spans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
uxa_drawable_location(pDrawable)));
if (uxa_prepare_access(pDrawable, UXA_ACCESS_RW)) {
fbSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -144,7 +144,7 @@ uxa_check_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
if (uxa_prepare_access(pDrawable, UXA_ACCESS_RW)) {
fbPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
bits);
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -163,9 +163,9 @@ uxa_check_copy_area(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
ret =
fbCopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx,
dsty);
- uxa_finish_access(pSrc);
+ uxa_finish_access(pSrc, UXA_ACCESS_RO);
}
- uxa_finish_access(pDst);
+ uxa_finish_access(pDst, UXA_ACCESS_RW);
}
return ret;
}
@@ -186,9 +186,9 @@ uxa_check_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
ret =
fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h, dstx,
dsty, bitPlane);
- uxa_finish_access(pSrc);
+ uxa_finish_access(pSrc, UXA_ACCESS_RO);
}
- uxa_finish_access(pDst);
+ uxa_finish_access(pDst, UXA_ACCESS_RW);
}
return ret;
}
@@ -203,7 +203,7 @@ uxa_check_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
uxa_drawable_location(pDrawable)));
if (uxa_prepare_access(pDrawable, UXA_ACCESS_RW)) {
fbPolyPoint(pDrawable, pGC, mode, npt, pptInit);
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -223,7 +223,7 @@ uxa_check_poly_lines(DrawablePtr pDrawable, GCPtr pGC,
fbPolyLine(pDrawable, pGC, mode, npt, ppt);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
return;
}
@@ -247,7 +247,7 @@ uxa_check_poly_segment(DrawablePtr pDrawable, GCPtr pGC,
pSegInit);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
return;
}
@@ -274,7 +274,7 @@ uxa_check_poly_arc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * pArcs)
fbPolyArc(pDrawable, pGC, narcs, pArcs);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
return;
}
@@ -296,7 +296,7 @@ uxa_check_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC,
fbPolyFillRect(pDrawable, pGC, nrect, prect);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -315,7 +315,7 @@ uxa_check_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
pglyphBase);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -335,7 +335,7 @@ uxa_check_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
pglyphBase);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -355,9 +355,9 @@ uxa_check_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
y);
uxa_finish_access_gc(pGC);
}
- uxa_finish_access(&pBitmap->drawable);
+ uxa_finish_access(&pBitmap->drawable, UXA_ACCESS_RO);
}
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RW);
}
}
@@ -372,7 +372,7 @@ uxa_check_get_spans(DrawablePtr pDrawable,
uxa_drawable_location(pDrawable)));
if (uxa_prepare_access(pDrawable, UXA_ACCESS_RO)) {
fbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
- uxa_finish_access(pDrawable);
+ uxa_finish_access(pDrawable, UXA_ACCESS_RO);
}
}
@@ -399,11 +399,11 @@ uxa_check_composite(CARD8 op,
xDst, yDst,
width, height);
if (pMask)
- uxa_picture_finish_access(pMask);
+ uxa_picture_finish_access(pMask, UXA_ACCESS_RO);
}
- uxa_picture_finish_access(pSrc);
+ uxa_picture_finish_access(pSrc, UXA_ACCESS_RO);
}
- uxa_picture_finish_access(pDst);
+ uxa_picture_finish_access(pDst, UXA_ACCESS_RW);
}
}
@@ -417,7 +417,7 @@ uxa_check_add_traps(PicturePtr pPicture,
uxa_drawable_location(pPicture->pDrawable)));
if (uxa_picture_prepare_access(pPicture, UXA_ACCESS_RW)) {
fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
- uxa_picture_finish_access(pPicture);
+ uxa_picture_finish_access(pPicture, UXA_ACCESS_RW);
}
}
@@ -448,7 +448,7 @@ CARD32 uxa_get_pixmap_first_pixel(PixmapPtr pPixmap)
pixel = *(CARD8 *) fb;
break;
}
- uxa_finish_access(&pPixmap->drawable);
+ uxa_finish_access(&pPixmap->drawable, UXA_ACCESS_RO);
return pixel;
}
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 856a0ce5..5a3c0bef 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -160,7 +160,7 @@ Bool uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access)
*
* It deals with calling the driver's finish_access() only if necessary.
*/
-void uxa_finish_access(DrawablePtr pDrawable)
+void uxa_finish_access(DrawablePtr pDrawable, uxa_access_t access)
{
ScreenPtr pScreen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
@@ -173,7 +173,7 @@ void uxa_finish_access(DrawablePtr pDrawable)
if (!uxa_pixmap_is_offscreen(pPixmap))
return;
- (*uxa_screen->info->finish_access) (pPixmap);
+ (*uxa_screen->info->finish_access) (pPixmap, access);
}
/**
@@ -217,7 +217,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
fb24_32ReformatTile(pOldTile,
pDrawable->
bitsPerPixel);
- uxa_finish_access(&pOldTile->drawable);
+ uxa_finish_access(&pOldTile->drawable, UXA_ACCESS_RO);
}
}
if (pNewTile) {
@@ -235,7 +235,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
if (uxa_prepare_access
(&pGC->tile.pixmap->drawable, UXA_ACCESS_RW)) {
fbPadPixmap(pGC->tile.pixmap);
- uxa_finish_access(&pGC->tile.pixmap->drawable);
+ uxa_finish_access(&pGC->tile.pixmap->drawable, UXA_ACCESS_RW);
}
}
/* Mask out the GCTile change notification, now that we've
@@ -250,7 +250,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
*/
if (uxa_prepare_access(&pGC->stipple->drawable, UXA_ACCESS_RW)) {
fbValidateGC(pGC, changes, pDrawable);
- uxa_finish_access(&pGC->stipple->drawable);
+ uxa_finish_access(&pGC->stipple->drawable, UXA_ACCESS_RW);
}
} else {
fbValidateGC(pGC, changes, pDrawable);
@@ -296,7 +296,7 @@ Bool uxa_prepare_access_window(WindowPtr pWin)
(&pWin->border.pixmap->drawable, UXA_ACCESS_RO)) {
if (pWin->backgroundState == BackgroundPixmap)
uxa_finish_access(&pWin->background.pixmap->
- drawable);
+ drawable, UXA_ACCESS_RO);
return FALSE;
}
}
@@ -306,10 +306,10 @@ Bool uxa_prepare_access_window(WindowPtr pWin)
void uxa_finish_access_window(WindowPtr pWin)
{
if (pWin->backgroundState == BackgroundPixmap)
- uxa_finish_access(&pWin->background.pixmap->drawable);
+ uxa_finish_access(&pWin->background.pixmap->drawable, UXA_ACCESS_RO);
if (pWin->borderIsPixel == FALSE)
- uxa_finish_access(&pWin->border.pixmap->drawable);
+ uxa_finish_access(&pWin->border.pixmap->drawable, UXA_ACCESS_RO);
}
static Bool uxa_change_window_attributes(WindowPtr pWin, unsigned long mask)
@@ -329,7 +329,7 @@ static RegionPtr uxa_bitmap_to_region(PixmapPtr pPix)
if (!uxa_prepare_access(&pPix->drawable, UXA_ACCESS_RO))
return NULL;
ret = fbPixmapToRegion(pPix);
- uxa_finish_access(&pPix->drawable);
+ uxa_finish_access(&pPix->drawable, UXA_ACCESS_RO);
return ret;
}
diff --git a/uxa/uxa.h b/uxa/uxa.h
index e001c53d..66b5f1eb 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -45,7 +45,9 @@
typedef enum {
UXA_ACCESS_RO,
- UXA_ACCESS_RW
+ UXA_ACCESS_RW,
+ UXA_GLAMOR_ACCESS_RO,
+ UXA_GLAMOR_ACCESS_RW
} uxa_access_t;
/**
@@ -513,7 +515,7 @@ typedef struct _UxaDriver {
* offscreen pixmap set up by prepare_access(). Note that the
* finish_access() will not be called if prepare_access() failed.
*/
- void (*finish_access) (PixmapPtr pPix);
+ void (*finish_access) (PixmapPtr pPix, uxa_access_t access);
/**
* PixmapIsOffscreen() is an optional driver replacement to
@@ -543,6 +545,13 @@ typedef struct _UxaDriver {
*/
#define UXA_TWO_BITBLT_DIRECTIONS (1 << 2)
+/**
+ * UXA_USE_GLAMOR indicates to use glamor acceleration to perform rendering.
+ * And if glamor fail to accelerate the rendering, then goto fallback to
+ * use CPU to do the rendering.
+ */
+#define UXA_USE_GLAMOR (1 << 3)
+
/** @} */
/** @name UXA CreatePixmap hint flags