summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraylinhsu <raylinhsu@google.com>2019-02-26 13:24:26 +0800
committerRaylin Hsu <raylinhsu@google.com>2019-03-06 11:52:20 +0000
commitc5b662efc4e0acafa6fc6d52d5ebaa0613e7392a (patch)
treea1bb1bca5492826680e3439d12104a36f9436565
parentc67af46944a34bcdd8f5f4f39a4fb95c84b2d4f6 (diff)
downloadandroid_hardware_qcom_sdm845_display-c5b662efc4e0acafa6fc6d52d5ebaa0613e7392a.tar.gz
android_hardware_qcom_sdm845_display-c5b662efc4e0acafa6fc6d52d5ebaa0613e7392a.tar.bz2
android_hardware_qcom_sdm845_display-c5b662efc4e0acafa6fc6d52d5ebaa0613e7392a.zip
Gralloc: Switch camera output from NV12 to NV21
The performance of camera preview on GCA HDR+ off modes is bad when the single IPE core handles multiple IPE instances. SDM670 hits preview lag issue on off mode due to IPE limitation. Therefore, we provided a mechanism to switch preview stream format from NV12 to NV21 based on TARGET_USES_NV21_PREVIEW at compile time. We could get better performance by avoiding extra effort at color conversion. Bug: 123483411 Bug: 123477980 Test: Camera preview Change-Id: Ieac025d0bccf27f385f2b29276c6381c9f807795
-rw-r--r--common.mk4
-rw-r--r--gralloc/gr_allocator.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/common.mk b/common.mk
index e241a408..fdfd1fff 100644
--- a/common.mk
+++ b/common.mk
@@ -51,6 +51,10 @@ ifeq ($(TARGET_USES_HWC2), true)
common_flags += -DVIDEO_MODE_DEFER_RETIRE_FENCE
endif
+ifeq ($(TARGET_USES_NV21_CAMERA_PREVIEW),true)
+ common_flags += -DUSE_NV21_CAMERA_PREVIEW
+endif
+
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
common_flags += -DUSER_DEBUG
endif
diff --git a/gralloc/gr_allocator.cpp b/gralloc/gr_allocator.cpp
index 912ada03..4eb76203 100644
--- a/gralloc/gr_allocator.cpp
+++ b/gralloc/gr_allocator.cpp
@@ -212,7 +212,11 @@ int Allocator::GetImplDefinedFormat(uint64_t usage, int format) {
if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL; // NV21
} else {
+#ifdef USE_NV21_CAMERA_PREVIEW
+ gr_format = HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS; // NV21 preview
+#else
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS; // NV12 preview
+#endif
}
} else if (usage & BufferUsage::COMPOSER_OVERLAY) {
// XXX: If we still haven't set a format, default to RGBA8888