From 8f951a6f82fafc09d133c89306c8402f38d6d576 Mon Sep 17 00:00:00 2001 From: WuZhen Date: Thu, 2 Jun 2016 16:21:51 +0800 Subject: android: add a fast path for swrast Observed increased antutu score on 1024x768, should see more with larger resolution NO_REF_TASK Tested: local run Change-Id: Ia05e0551a65ae7678561b167c1f5e75509ea4e84 --- src/egl/drivers/dri2/platform_android.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/egl/drivers') diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 3c14086..d248ed2 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -882,10 +882,14 @@ swrastPutImage2(__DRIdrawable * draw, int op, dstPtr += y * dstStride + xOffset; srcPtr = data; - for (; h>0; h--) { - memcpy(dstPtr, srcPtr, copyWidth); - srcPtr += stride; - dstPtr += dstStride; + if (xOffset == 0 && copyWidth == stride && copyWidth == dstStride) { + memcpy(dstPtr, srcPtr, copyWidth * h); + } else { + for (; h>0; h--) { + memcpy(dstPtr, srcPtr, copyWidth); + srcPtr += stride; + dstPtr += dstStride; + } } if (gr_module->unlock(gr_module, dri2_surf->buffer->handle)) { @@ -942,10 +946,14 @@ swrastGetImage(__DRIdrawable * read, srcPtr += y * srcStride + xOffset; dstPtr = data; - for (; h>0; h--) { - memcpy(dstPtr, srcPtr, copyWidth); - srcPtr += srcStride; - dstPtr += copyWidth; + if (xOffset == 0 && copyWidth == srcStride) { + memcpy(dstPtr, srcPtr, copyWidth * h); + } else { + for (; h>0; h--) { + memcpy(dstPtr, srcPtr, copyWidth); + srcPtr += srcStride; + dstPtr += copyWidth; + } } if (gr_module->unlock(gr_module, dri2_surf->buffer->handle)) { -- cgit v1.1