summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2013-12-23 15:34:21 +0000
committerRussell King <rmk@arm.linux.org.uk>2013-12-23 15:34:21 +0000
commit80993e4b85286124b14aa3aa6e2ac6c0e072720f (patch)
tree2622134a579d083d15a3dcfd38e9d2a7162f13be
parent1b06d676d07e8d4ab26ed0f0603f12bb3e7f3f52 (diff)
downloadxf86-video-armada-80993e4b85286124b14aa3aa6e2ac6c0e072720f.tar.gz
Avoid bouncing pixmaps between GPU and CPU on ChangeWindowAttributes()
Avoid unnecessary bouncing of pixmaps between the GPU and CPU when ChangeWindowAttributes() is called. We don't need to map this to the CPU unless we're actually need to access the pixmap; merely checking for the flags is insufficient. Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r--src/vivante_unaccel.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/vivante_unaccel.c b/src/vivante_unaccel.c
index c7de2bd..da96f8a 100644
--- a/src/vivante_unaccel.c
+++ b/src/vivante_unaccel.c
@@ -33,22 +33,6 @@ static void vivante_finish_gc(GCPtr pGC)
vivante_finish_drawable(&pGC->stipple->drawable, ACCESS_RO);
}
-static void vivante_prepare_window(WindowPtr pWin)
-{
- if (pWin->backgroundState == BackgroundPixmap)
- vivante_prepare_drawable(&pWin->background.pixmap->drawable, ACCESS_RO);
- if (!pWin->borderIsPixel)
- vivante_prepare_drawable(&pWin->border.pixmap->drawable, ACCESS_RO);
-}
-
-static void vivante_finish_window(WindowPtr pWin)
-{
- if (!pWin->borderIsPixel)
- vivante_finish_drawable(&pWin->border.pixmap->drawable, ACCESS_RO);
- if (pWin->backgroundState == BackgroundPixmap)
- vivante_finish_drawable(&pWin->background.pixmap->drawable, ACCESS_RO);
-}
-
void vivante_unaccel_FillSpans(DrawablePtr pDrawable, GCPtr pGC, int nspans,
DDXPointPtr ppt, int *pwidth, int fSorted)
{
@@ -204,13 +188,37 @@ void vivante_unaccel_GetImage(DrawablePtr pDrawable, int x, int y,
vivante_finish_drawable(pDrawable, ACCESS_RO);
}
+static void vivante_unaccel_fixup_tile(DrawablePtr pDraw, PixmapPtr *ppPix)
+{
+ PixmapPtr pNew, pPixmap = *ppPix;
+
+ if (pPixmap->drawable.bitsPerPixel != pDraw->bitsPerPixel) {
+ vivante_prepare_drawable(&pPixmap->drawable, ACCESS_RO);
+ pNew = fb24_32ReformatTile(pPixmap, pDraw->bitsPerPixel);
+ vivante_finish_drawable(&pPixmap->drawable, ACCESS_RO);
+
+ pDraw->pScreen->DestroyPixmap(pPixmap);
+ *ppPix = pPixmap = pNew;
+ }
+
+ if (FbEvenTile(pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel)) {
+ vivante_prepare_drawable(&pPixmap->drawable, ACCESS_RW);
+ fbPadPixmap(pPixmap);
+ vivante_finish_drawable(&pPixmap->drawable, ACCESS_RW);
+ }
+}
+
Bool vivante_unaccel_ChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
- Bool ret;
- vivante_prepare_window(pWin);
- ret = fbChangeWindowAttributes(pWin, mask);
- vivante_finish_window(pWin);
- return ret;
+ if (mask & CWBackPixmap && pWin->backgroundState == BackgroundPixmap)
+ vivante_unaccel_fixup_tile(&pWin->drawable,
+ &pWin->background.pixmap);
+
+ if (mask & CWBorderPixmap && !pWin->borderIsPixel)
+ vivante_unaccel_fixup_tile(&pWin->drawable,
+ &pWin->border.pixmap);
+
+ return TRUE;
}
RegionPtr vivante_unaccel_BitmapToRegion(PixmapPtr pixmap)