diff options
author | Yin-Chia Yeh | 2018-05-24 12:31:56 -0500 |
---|---|---|
committer | Yin-Chia Yeh | 2018-05-24 12:53:57 -0500 |
commit | 9d32c13f0b0fea73648b218422cf881fd38df35b (patch) | |
tree | 0beeab16f9e81ead8e29fadcfccfc80807ea93ef | |
parent | 1f74538cdb297a0a2ecd4ac1cc40214e83edb11f (diff) | |
download | platform-hardware-interfaces-9d32c13f0b0fea73648b218422cf881fd38df35b.tar.gz platform-hardware-interfaces-9d32c13f0b0fea73648b218422cf881fd38df35b.tar.xz platform-hardware-interfaces-9d32c13f0b0fea73648b218422cf881fd38df35b.zip |
Camera: add FMQ size override logic
Test: modify FMQ size in device.mk
Bug: 80242493
Change-Id: Ie1fb12118ad53c5bbe0cf264bffaafcd3728f8db
-rw-r--r-- | camera/device/3.2/default/CameraDeviceSession.cpp | 25 |
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 { | |||
31 | namespace implementation { | 32 | namespace 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. |
34 | static constexpr size_t CAMERA_REQUEST_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */; | 35 | static 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. |
36 | static constexpr size_t CAMERA_RESULT_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */; | 37 | static 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; |