OSDN Git Service

Support forcing all screenshots into a CPU consumer
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>
Sat, 26 Oct 2013 02:43:03 +0000 (03:43 +0100)
committerSteve Kondik <steve@cyngn.com>
Thu, 1 Sep 2016 06:33:36 +0000 (23:33 -0700)
Looks like a full GPU path is less efficient on some GPU
drivers that we're still using, and CPU is reliably faster...
(there's probably a locking condition going on somewhere, this
needs to be looked into)

Change-Id: I8878796a117d65bf2324507cf8755cadce49f6dc

libs/gui/Android.mk
libs/gui/SurfaceComposerClient.cpp

index 8c3c311..493523a 100644 (file)
@@ -97,6 +97,10 @@ ifeq ($(TARGET_NO_SENSOR_PERMISSION_CHECK),true)
 LOCAL_CPPFLAGS += -DNO_SENSOR_PERMISSION_CHECK
 endif
 
+ifeq ($(TARGET_FORCE_SCREENSHOT_CPU_PATH),true)
+LOCAL_CPPFLAGS += -DFORCE_SCREENSHOT_CPU_PATH
+endif
+
 include $(BUILD_SHARED_LIBRARY)
 
 ifeq (,$(ONE_SHOT_MAKEFILE))
index 294998c..96eea5e 100644 (file)
@@ -873,6 +873,12 @@ status_t SurfaceComposerClient::getHdrCapabilities(const sp<IBinder>& display,
 
 // ----------------------------------------------------------------------------
 
+#ifndef FORCE_SCREENSHOT_CPU_PATH
+#define SS_CPU_CONSUMER false
+#else
+#define SS_CPU_CONSUMER true
+#endif
+
 status_t ScreenshotClient::capture(
         const sp<IBinder>& display,
         const sp<IGraphicBufferProducer>& producer,
@@ -882,7 +888,7 @@ status_t ScreenshotClient::capture(
     if (s == NULL) return NO_INIT;
     return s->captureScreen(display, producer, sourceCrop,
             reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform,
-            ISurfaceComposer::eRotateNone, false);
+            ISurfaceComposer::eRotateNone, SS_CPU_CONSUMER);
 }
 
 ScreenshotClient::ScreenshotClient()