summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2013-10-23 15:20:43 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-23 15:20:43 -0700
commit6fdaaf5c7cf7c511a5e3cea8aaafdad7ff12e596 (patch)
tree6a9ef3ae100938200fa7094d47c017e2ea6a5c4a /services/surfaceflinger
parent014dd9f0f28c3992f9fae62a62fa7e8bfe750a06 (diff)
parenta54a8b63d191d2c1c4669f89b32c4b8a9c04cd31 (diff)
downloadframeworks_native-6fdaaf5c7cf7c511a5e3cea8aaafdad7ff12e596.zip
frameworks_native-6fdaaf5c7cf7c511a5e3cea8aaafdad7ff12e596.tar.gz
frameworks_native-6fdaaf5c7cf7c511a5e3cea8aaafdad7ff12e596.tar.bz2
am a54a8b63: am 93fcb823: Merge "Add a boardconfig to force HWC composition of virtual displays" into klp-dev
* commit 'a54a8b63d191d2c1c4669f89b32c4b8a9c04cd31': Add a boardconfig to force HWC composition of virtual displays
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/Android.mk6
-rw-r--r--services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp14
2 files changed, 20 insertions, 0 deletions
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index c3daa64..1a8f243 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -51,6 +51,12 @@ ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
endif
+ifneq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),)
+ LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS=false
+else
+ LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS=true
+endif
+
ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
index 29e9d40..0d6cbb4 100644
--- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
@@ -22,6 +22,8 @@
namespace android {
// ---------------------------------------------------------------------------
+static bool sForceHwcCopy = FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS;
+
#define VDS_LOGE(msg, ...) ALOGE("[%s] "msg, \
mDisplayName.string(), ##__VA_ARGS__)
#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] "msg, \
@@ -96,6 +98,18 @@ status_t VirtualDisplaySurface::prepareFrame(CompositionType compositionType) {
mDbgState = DBG_STATE_PREPARED;
mCompositionType = compositionType;
+ if (sForceHwcCopy && mCompositionType == COMPOSITION_GLES) {
+ // Some hardware can do RGB->YUV conversion more efficiently in hardware
+ // controlled by HWC than in hardware controlled by the video encoder.
+ // Forcing GLES-composed frames to go through an extra copy by the HWC
+ // allows the format conversion to happen there, rather than passing RGB
+ // directly to the consumer.
+ //
+ // On the other hand, when the consumer prefers RGB or can consume RGB
+ // inexpensively, this forces an unnecessary copy.
+ mCompositionType = COMPOSITION_MIXED;
+ }
+
if (mCompositionType != mDbgLastCompositionType) {
VDS_LOGV("prepareFrame: composition type changed to %s",
dbgCompositionTypeStr(mCompositionType));