summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunny <sunny.sun@arm.com>2014-07-21 15:02:35 +0800
committerSunny <sunny.sun@arm.com>2014-07-21 15:02:35 +0800
commit9702414f69428913f25bac78051f310b9ecb483d (patch)
tree9c4af77a6a1cc1b5ae4455198fe3aedc116b81f2
parentd5df209d6ca1a11fabc22a0c5b1d12628198c946 (diff)
Fix performance issue when enlightenment started.
Change some logic in ARMSOCDRI2ScheduleSwap(). If src and dst has same size and they are both no-framebuffer with compositor enabled, we only need to exchange buffers between src and dst pixmap. Change-Id: Iba0b3e248589bc8d05f5b52cfb12865790d812a3
-rw-r--r--src/armsoc_dri2.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/armsoc_dri2.c b/src/armsoc_dri2.c
index 013cb82..7d74734 100644
--- a/src/armsoc_dri2.c
+++ b/src/armsoc_dri2.c
@@ -147,6 +147,34 @@ createpix(DrawablePtr pDraw)
pDraw->width, pDraw->height, pDraw->depth, flags);
}
+static inline Bool
+canexchange(DrawablePtr pDraw, struct armsoc_bo *src_bo, struct armsoc_bo *dst_bo)
+{
+ Bool ret = FALSE;
+ ScreenPtr pScreen = pDraw->pScreen;
+ PixmapPtr pRootPixmap, pWindowPixmap;
+ int src_fb_id, dst_fb_id;
+
+ pRootPixmap = pScreen->GetWindowPixmap(pScreen->root);
+ pWindowPixmap = pDraw->type == DRAWABLE_PIXMAP ? (PixmapPtr)pDraw : pScreen->GetWindowPixmap((WindowPtr)pDraw);
+
+ src_fb_id = armsoc_bo_get_fb(src_bo);
+ dst_fb_id = armsoc_bo_get_fb(dst_bo);
+
+ if (pRootPixmap != pWindowPixmap &&
+ armsoc_bo_width(src_bo) == armsoc_bo_width(dst_bo) &&
+ armsoc_bo_height(src_bo) == armsoc_bo_height(dst_bo) &&
+ armsoc_bo_bpp(src_bo) == armsoc_bo_bpp(dst_bo) &&
+ armsoc_bo_width(src_bo) == pDraw->width &&
+ armsoc_bo_height(src_bo) == pDraw->height &&
+ armsoc_bo_bpp(src_bo) == pDraw->bitsPerPixel &&
+ src_fb_id == 0 && dst_fb_id == 0) {
+ ret = TRUE;
+ }
+
+ return ret;
+}
+
/**
* Create Buffer.
*
@@ -634,6 +662,7 @@ ARMSOCDRI2SwapComplete(struct ARMSOCDRISwapCmd *cmd)
cmd->func, cmd->data);
if (cmd->type != DRI2_BLIT_COMPLETE &&
+ cmd->type != DRI2_EXCHANGE_COMPLETE &&
(cmd->flags & ARMSOC_SWAP_FAKE_FLIP) == 0) {
assert(cmd->type == DRI2_FLIP_COMPLETE);
set_scanout_bo(pScrn, cmd->new_scanout);
@@ -845,6 +874,13 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
if (cmd->swapCount == 0)
ARMSOCDRI2SwapComplete(cmd);
}
+ } else if (canexchange(pDraw, src_bo, dst_bo)) {
+ exchangebufs(pDraw, pSrcBuffer, pDstBuffer);
+ if (pSrcBuffer->attachment == DRI2BufferBackLeft)
+ nextBuffer(pDraw, ARMSOCBUF(pSrcBuffer));
+
+ cmd->type = DRI2_EXCHANGE_COMPLETE;
+ ARMSOCDRI2SwapComplete(cmd);
} else {
/* fallback to blit: */
BoxRec box = {