summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot2018-05-25 12:32:31 -0500
committerAndroid (Google) Code Review2018-05-25 12:32:31 -0500
commitde680c0d0ca84ce0e9b089f333414d36c958dade (patch)
tree2fa94f09b3a410ba190f13061a52488999019f7d
parentd5a5888c60c9fc829faf2fd9e3c89f0d5190f2c7 (diff)
parent9d32c13f0b0fea73648b218422cf881fd38df35b (diff)
downloadplatform-hardware-interfaces-de680c0d0ca84ce0e9b089f333414d36c958dade.tar.gz
platform-hardware-interfaces-de680c0d0ca84ce0e9b089f333414d36c958dade.tar.xz
platform-hardware-interfaces-de680c0d0ca84ce0e9b089f333414d36c958dade.zip
Merge "Camera: add FMQ size override logic" into pi-dev
-rw-r--r--camera/device/3.2/default/CameraDeviceSession.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index f33da134..8d002646 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -18,6 +18,7 @@
18#include <android/log.h> 18#include <android/log.h>
19 19
20#include <set> 20#include <set>
21#include <cutils/properties.h>
21#include <utils/Trace.h> 22#include <utils/Trace.h>
22#include <hardware/gralloc.h> 23#include <hardware/gralloc.h>
23#include <hardware/gralloc1.h> 24#include <hardware/gralloc1.h>
@@ -31,9 +32,9 @@ namespace V3_2 {
31namespace implementation { 32namespace implementation {
32 33
33// Size of request metadata fast message queue. Change to 0 to always use hwbinder buffer. 34// Size of request metadata fast message queue. Change to 0 to always use hwbinder buffer.
34static constexpr size_t CAMERA_REQUEST_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */; 35static constexpr int32_t CAMERA_REQUEST_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */;
35// Size of result metadata fast message queue. Change to 0 to always use hwbinder buffer. 36// Size of result metadata fast message queue. Change to 0 to always use hwbinder buffer.
36static constexpr size_t CAMERA_RESULT_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */; 37static constexpr int32_t CAMERA_RESULT_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */;
37 38
38// Metadata sent by HAL will be replaced by a compact copy 39// Metadata sent by HAL will be replaced by a compact copy
39// if their (total size >= compact size + METADATA_SHRINK_ABS_THRESHOLD && 40// if their (total size >= compact size + METADATA_SHRINK_ABS_THRESHOLD &&
@@ -95,14 +96,30 @@ bool CameraDeviceSession::initialize() {
95 return true; 96 return true;
96 } 97 }
97 98
99 int32_t reqFMQSize = property_get_int32("ro.camera.req.fmq.size", /*default*/-1);
100 if (reqFMQSize < 0) {
101 reqFMQSize = CAMERA_REQUEST_METADATA_QUEUE_SIZE;
102 } else {
103 ALOGV("%s: request FMQ size overridden to %d", __FUNCTION__, reqFMQSize);
104 }
105
98 mRequestMetadataQueue = std::make_unique<RequestMetadataQueue>( 106 mRequestMetadataQueue = std::make_unique<RequestMetadataQueue>(
99 CAMERA_REQUEST_METADATA_QUEUE_SIZE, false /* non blocking */); 107 static_cast<size_t>(reqFMQSize),
108 false /* non blocking */);
100 if (!mRequestMetadataQueue->isValid()) { 109 if (!mRequestMetadataQueue->isValid()) {
101 ALOGE("%s: invalid request fmq", __FUNCTION__); 110 ALOGE("%s: invalid request fmq", __FUNCTION__);
102 return true; 111 return true;
103 } 112 }
113
114 int32_t resFMQSize = property_get_int32("ro.camera.res.fmq.size", /*default*/-1);
115 if (resFMQSize < 0) {
116 resFMQSize = CAMERA_RESULT_METADATA_QUEUE_SIZE;
117 } else {
118 ALOGV("%s: result FMQ size overridden to %d", __FUNCTION__, resFMQSize);
119 }
104 mResultMetadataQueue = std::make_shared<RequestMetadataQueue>( 120 mResultMetadataQueue = std::make_shared<RequestMetadataQueue>(
105 CAMERA_RESULT_METADATA_QUEUE_SIZE, false /* non blocking */); 121 static_cast<size_t>(resFMQSize),
122 false /* non blocking */);
106 if (!mResultMetadataQueue->isValid()) { 123 if (!mResultMetadataQueue->isValid()) {
107 ALOGE("%s: invalid result fmq", __FUNCTION__); 124 ALOGE("%s: invalid result fmq", __FUNCTION__);
108 return true; 125 return true;