From 8a861a4ca54b0d10fffe5656417a64df3410bbb1 Mon Sep 17 00:00:00 2001 From: liaosirui Date: Mon, 7 Sep 2020 15:20:38 +0800 Subject: [PATCH] Surface: Avoid graphic buffer readback by removing GRALLOC_USAGE_SW_READ_OFTEN when backBuffer->lockAsync is called. Expect performance improving in video playing through IJKplayer. --- libs/gui/Surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index 08382908b..9115425cc 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -1240,7 +1240,7 @@ status_t Surface::lock( return err; } // we're intending to do software rendering from this point - setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN); + setUsage(GRALLOC_USAGE_SW_WRITE_OFTEN); } ANativeWindowBuffer* out; @@ -1300,7 +1300,7 @@ status_t Surface::lock( void* vaddr; status_t res = backBuffer->lockAsync( - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, + GRALLOC_USAGE_SW_WRITE_OFTEN, newDirtyRegion.bounds(), &vaddr, fenceFd); ALOGW_IF(res, "failed locking buffer (handle = %p)", -- Gitee