Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 1 | /* |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 2 | * Copyright (C) 2013-2018 The Android Open Source Project |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "Camera3-IOStreamBase" |
| 18 | #define ATRACE_TAG ATRACE_TAG_CAMERA |
| 19 | //#define LOG_NDEBUG 0 |
| 20 | |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 21 | #include <sstream> |
| 22 | |
Colin Cross | e5729fa | 2014-03-21 15:04:25 -0700 | [diff] [blame] | 23 | #include <inttypes.h> |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 24 | |
| 25 | #include <utils/Log.h> |
| 26 | #include <utils/Trace.h> |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 27 | #include <camera/StringUtils.h> |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 28 | #include "device3/Camera3IOStreamBase.h" |
| 29 | #include "device3/StatusTracker.h" |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 30 | |
| 31 | namespace android { |
| 32 | |
| 33 | namespace camera3 { |
| 34 | |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 35 | Camera3IOStreamBase::Camera3IOStreamBase(int id, camera_stream_type_t type, |
Eino-Ville Talvala | 3d82c0d | 2015-02-23 15:19:19 -0800 | [diff] [blame] | 36 | uint32_t width, uint32_t height, size_t maxSize, int format, |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 37 | android_dataspace dataSpace, camera_stream_rotation_t rotation, |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 38 | const std::string& physicalCameraId, |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 39 | const std::unordered_set<int32_t> &sensorPixelModesUsed, |
Shuzhen Wang | 8ed1e87 | 2022-03-08 16:34:33 -0800 | [diff] [blame] | 40 | int setId, bool isMultiResolution, int64_t dynamicRangeProfile, int64_t streamUseCase, |
Austin Borger | 9e2b27c | 2022-07-15 11:27:24 -0700 | [diff] [blame] | 41 | bool deviceTimeBaseIsRealtime, int timestampBase, int32_t colorSpace) : |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 42 | Camera3Stream(id, type, |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 43 | width, height, maxSize, format, dataSpace, rotation, |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame] | 44 | physicalCameraId, sensorPixelModesUsed, setId, isMultiResolution, |
Austin Borger | 9e2b27c | 2022-07-15 11:27:24 -0700 | [diff] [blame] | 45 | dynamicRangeProfile, streamUseCase, deviceTimeBaseIsRealtime, timestampBase, |
| 46 | colorSpace), |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 47 | mTotalBufferCount(0), |
Shuzhen Wang | c235270 | 2022-09-06 18:36:31 -0700 | [diff] [blame] | 48 | mMaxCachedBufferCount(0), |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 49 | mHandoutTotalBufferCount(0), |
| 50 | mHandoutOutputBufferCount(0), |
Shuzhen Wang | c235270 | 2022-09-06 18:36:31 -0700 | [diff] [blame] | 51 | mCachedOutputBufferCount(0), |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 52 | mFrameCount(0), |
| 53 | mLastTimestamp(0) { |
| 54 | |
| 55 | mCombinedFence = new Fence(); |
| 56 | |
Yin-Chia Yeh | e9154ce | 2015-12-07 14:38:04 -0800 | [diff] [blame] | 57 | if (maxSize > 0 && |
| 58 | (format != HAL_PIXEL_FORMAT_BLOB && format != HAL_PIXEL_FORMAT_RAW_OPAQUE)) { |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 59 | ALOGE("%s: Bad format for size-only stream: %d", __FUNCTION__, |
| 60 | format); |
| 61 | mState = STATE_ERROR; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | Camera3IOStreamBase::~Camera3IOStreamBase() { |
| 66 | disconnectLocked(); |
| 67 | } |
| 68 | |
| 69 | bool Camera3IOStreamBase::hasOutstandingBuffersLocked() const { |
| 70 | nsecs_t signalTime = mCombinedFence->getSignalTime(); |
Colin Cross | e5729fa | 2014-03-21 15:04:25 -0700 | [diff] [blame] | 71 | ALOGV("%s: Stream %d: Has %zu outstanding buffers," |
| 72 | " buffer signal time is %" PRId64, |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 73 | __FUNCTION__, mId, mHandoutTotalBufferCount, signalTime); |
| 74 | if (mHandoutTotalBufferCount > 0 || signalTime == INT64_MAX) { |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 75 | return true; |
| 76 | } |
| 77 | return false; |
| 78 | } |
| 79 | |
Emilian Peev | 3b93acb | 2024-03-11 21:09:48 +0000 | [diff] [blame^] | 80 | void Camera3IOStreamBase::dump(int fd, [[maybe_unused]] const Vector<String16> &args) { |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 81 | std::ostringstream lines; |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 82 | |
Emilian Peev | 050f5dc | 2017-05-18 14:43:56 +0100 | [diff] [blame] | 83 | uint64_t consumerUsage = 0; |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 84 | status_t res = getEndpointUsage(&consumerUsage); |
| 85 | if (res != OK) consumerUsage = 0; |
| 86 | |
Henri Chataing | bcb9945 | 2023-11-01 17:40:30 +0000 | [diff] [blame] | 87 | lines << fmt::sprintf(" State: %d\n", static_cast<int>(mState)); |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 88 | lines << fmt::sprintf(" Dims: %d x %d, format 0x%x, dataspace 0x%x\n", |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 89 | camera_stream::width, camera_stream::height, |
Henri Chataing | bcb9945 | 2023-11-01 17:40:30 +0000 | [diff] [blame] | 90 | camera_stream::format, static_cast<int>(camera_stream::data_space)); |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 91 | lines << fmt::sprintf(" Max size: %zu\n", mMaxSize); |
| 92 | lines << fmt::sprintf(" Combined usage: 0x%" PRIx64 ", max HAL buffers: %d\n", |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 93 | mUsage | consumerUsage, camera_stream::max_buffers); |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 94 | if (!camera_stream::physical_camera_id.empty()) { |
| 95 | lines << " Physical camera id: " << camera_stream::physical_camera_id << "\n"; |
Shuzhen Wang | c2cba12 | 2018-05-17 18:10:24 -0700 | [diff] [blame] | 96 | } |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 97 | lines << fmt::sprintf(" Dynamic Range Profile: 0x%" PRIx64 "\n", |
Emilian Peev | c81a759 | 2022-02-14 17:38:18 -0800 | [diff] [blame] | 98 | camera_stream::dynamic_range_profile); |
Xin Li | 65d5308 | 2023-08-25 14:16:11 -0700 | [diff] [blame] | 99 | lines << fmt::sprintf(" Color Space: %d\n", camera_stream::color_space); |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 100 | lines << fmt::sprintf(" Stream use case: %" PRId64 "\n", camera_stream::use_case); |
| 101 | lines << fmt::sprintf(" Timestamp base: %d\n", getTimestampBase()); |
| 102 | lines << fmt::sprintf(" Frames produced: %d, last timestamp: %" PRId64 " ns\n", |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 103 | mFrameCount, mLastTimestamp); |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 104 | lines << fmt::sprintf(" Total buffers: %zu, currently dequeued: %zu, " |
| 105 | "currently cached: %zu\n", mTotalBufferCount, mHandoutTotalBufferCount, |
| 106 | mCachedOutputBufferCount); |
| 107 | std::string linesStr = std::move(lines.str()); |
| 108 | write(fd, linesStr.c_str(), linesStr.size()); |
Shuzhen Wang | 686f644 | 2017-06-20 16:16:04 -0700 | [diff] [blame] | 109 | |
| 110 | Camera3Stream::dump(fd, args); |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | status_t Camera3IOStreamBase::configureQueueLocked() { |
| 114 | status_t res; |
| 115 | |
| 116 | switch (mState) { |
| 117 | case STATE_IN_RECONFIG: |
| 118 | res = disconnectLocked(); |
| 119 | if (res != OK) { |
| 120 | return res; |
| 121 | } |
| 122 | break; |
| 123 | case STATE_IN_CONFIG: |
| 124 | // OK |
| 125 | break; |
| 126 | default: |
| 127 | ALOGE("%s: Bad state: %d", __FUNCTION__, mState); |
| 128 | return INVALID_OPERATION; |
| 129 | } |
| 130 | |
| 131 | return OK; |
| 132 | } |
| 133 | |
| 134 | size_t Camera3IOStreamBase::getBufferCountLocked() { |
| 135 | return mTotalBufferCount; |
| 136 | } |
| 137 | |
Yin-Chia Yeh | d5cd5ff | 2018-10-01 14:43:04 -0700 | [diff] [blame] | 138 | size_t Camera3IOStreamBase::getHandoutOutputBufferCountLocked() const { |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 139 | return mHandoutOutputBufferCount; |
| 140 | } |
| 141 | |
| 142 | size_t Camera3IOStreamBase::getHandoutInputBufferCountLocked() { |
| 143 | return (mHandoutTotalBufferCount - mHandoutOutputBufferCount); |
| 144 | } |
| 145 | |
Shuzhen Wang | c235270 | 2022-09-06 18:36:31 -0700 | [diff] [blame] | 146 | size_t Camera3IOStreamBase::getCachedOutputBufferCountLocked() const { |
| 147 | return mCachedOutputBufferCount; |
| 148 | } |
| 149 | |
| 150 | size_t Camera3IOStreamBase::getMaxCachedOutputBuffersLocked() const { |
| 151 | return mMaxCachedBufferCount; |
| 152 | } |
| 153 | |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 154 | status_t Camera3IOStreamBase::disconnectLocked() { |
| 155 | switch (mState) { |
| 156 | case STATE_IN_RECONFIG: |
| 157 | case STATE_CONFIGURED: |
Eino-Ville Talvala | ff51b47 | 2016-06-28 15:26:19 -0700 | [diff] [blame] | 158 | case STATE_ABANDONED: |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 159 | // OK |
| 160 | break; |
| 161 | default: |
| 162 | // No connection, nothing to do |
Igor Murashkin | e2172be | 2013-05-28 15:31:39 -0700 | [diff] [blame] | 163 | ALOGV("%s: Stream %d: Already disconnected", |
| 164 | __FUNCTION__, mId); |
| 165 | return -ENOTCONN; |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 168 | if (mHandoutTotalBufferCount > 0) { |
Colin Cross | e5729fa | 2014-03-21 15:04:25 -0700 | [diff] [blame] | 169 | ALOGE("%s: Can't disconnect with %zu buffers still dequeued!", |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 170 | __FUNCTION__, mHandoutTotalBufferCount); |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 171 | return INVALID_OPERATION; |
| 172 | } |
| 173 | |
| 174 | return OK; |
| 175 | } |
| 176 | |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 177 | void Camera3IOStreamBase::handoutBufferLocked(camera_stream_buffer &buffer, |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 178 | buffer_handle_t *handle, |
| 179 | int acquireFence, |
| 180 | int releaseFence, |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 181 | camera_buffer_status_t status, |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 182 | bool output) { |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 183 | /** |
| 184 | * Note that all fences are now owned by HAL. |
| 185 | */ |
| 186 | |
| 187 | // Handing out a raw pointer to this object. Increment internal refcount. |
| 188 | incStrong(this); |
| 189 | buffer.stream = this; |
| 190 | buffer.buffer = handle; |
| 191 | buffer.acquire_fence = acquireFence; |
| 192 | buffer.release_fence = releaseFence; |
| 193 | buffer.status = status; |
| 194 | |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 195 | // Inform tracker about becoming busy |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 196 | if (mHandoutTotalBufferCount == 0 && mState != STATE_IN_CONFIG && |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 197 | mState != STATE_IN_RECONFIG && mState != STATE_PREPARING) { |
Igor Murashkin | 13d315e | 2014-04-03 18:09:04 -0700 | [diff] [blame] | 198 | /** |
| 199 | * Avoid a spurious IDLE->ACTIVE->IDLE transition when using buffers |
| 200 | * before/after register_stream_buffers during initial configuration |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 201 | * or re-configuration, or during prepare pre-allocation |
Igor Murashkin | 13d315e | 2014-04-03 18:09:04 -0700 | [diff] [blame] | 202 | */ |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 203 | sp<StatusTracker> statusTracker = mStatusTracker.promote(); |
| 204 | if (statusTracker != 0) { |
| 205 | statusTracker->markComponentActive(mStatusId); |
| 206 | } |
| 207 | } |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 208 | mHandoutTotalBufferCount++; |
| 209 | |
| 210 | if (output) { |
| 211 | mHandoutOutputBufferCount++; |
| 212 | } |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | status_t Camera3IOStreamBase::getBufferPreconditionCheckLocked() const { |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 216 | // Allow dequeue during IN_[RE]CONFIG for registration, in |
| 217 | // PREPARING for pre-allocation |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 218 | if (mState != STATE_CONFIGURED && |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 219 | mState != STATE_IN_CONFIG && mState != STATE_IN_RECONFIG && |
| 220 | mState != STATE_PREPARING) { |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 221 | ALOGE("%s: Stream %d: Can't get buffers in unconfigured state %d", |
| 222 | __FUNCTION__, mId, mState); |
| 223 | return INVALID_OPERATION; |
| 224 | } |
| 225 | |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 226 | return OK; |
| 227 | } |
| 228 | |
| 229 | status_t Camera3IOStreamBase::returnBufferPreconditionCheckLocked() const { |
| 230 | // Allow buffers to be returned in the error state, to allow for disconnect |
| 231 | // and in the in-config states for registration |
| 232 | if (mState == STATE_CONSTRUCTED) { |
| 233 | ALOGE("%s: Stream %d: Can't return buffers in unconfigured state %d", |
| 234 | __FUNCTION__, mId, mState); |
| 235 | return INVALID_OPERATION; |
| 236 | } |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 237 | if (mHandoutTotalBufferCount == 0) { |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 238 | ALOGE("%s: Stream %d: No buffers outstanding to return", __FUNCTION__, |
| 239 | mId); |
| 240 | return INVALID_OPERATION; |
| 241 | } |
| 242 | |
| 243 | return OK; |
| 244 | } |
| 245 | |
| 246 | status_t Camera3IOStreamBase::returnAnyBufferLocked( |
Emilian Peev | f481670 | 2020-04-03 15:44:51 -0700 | [diff] [blame] | 247 | const camera_stream_buffer &buffer, |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 248 | nsecs_t timestamp, |
Shuzhen Wang | 90708ea | 2021-11-04 11:40:49 -0700 | [diff] [blame] | 249 | nsecs_t readoutTimestamp, |
Yin-Chia Yeh | 58b1b4e | 2018-10-15 12:18:36 -0700 | [diff] [blame] | 250 | bool output, |
Emilian Peev | 5104fe9 | 2021-10-21 14:27:09 -0700 | [diff] [blame] | 251 | int32_t transform, |
Yin-Chia Yeh | 58b1b4e | 2018-10-15 12:18:36 -0700 | [diff] [blame] | 252 | const std::vector<size_t>& surface_ids) { |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 253 | status_t res; |
| 254 | |
| 255 | // returnBuffer may be called from a raw pointer, not a sp<>, and we'll be |
| 256 | // decrementing the internal refcount next. In case this is the last ref, we |
| 257 | // might get destructed on the decStrong(), so keep an sp around until the |
| 258 | // end of the call - otherwise have to sprinkle the decStrong on all exit |
| 259 | // points. |
| 260 | sp<Camera3IOStreamBase> keepAlive(this); |
| 261 | decStrong(this); |
| 262 | |
| 263 | if ((res = returnBufferPreconditionCheckLocked()) != OK) { |
| 264 | return res; |
| 265 | } |
| 266 | |
| 267 | sp<Fence> releaseFence; |
Shuzhen Wang | 90708ea | 2021-11-04 11:40:49 -0700 | [diff] [blame] | 268 | res = returnBufferCheckedLocked(buffer, timestamp, readoutTimestamp, |
| 269 | output, transform, surface_ids, |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 270 | &releaseFence); |
Eino-Ville Talvala | 07d2169 | 2013-09-24 18:04:19 -0700 | [diff] [blame] | 271 | // Res may be an error, but we still want to decrement our owned count |
| 272 | // to enable clean shutdown. So we'll just return the error but otherwise |
| 273 | // carry on |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 274 | |
Eino-Ville Talvala | 07d2169 | 2013-09-24 18:04:19 -0700 | [diff] [blame] | 275 | if (releaseFence != 0) { |
Austin Borger | 0fb3ad9 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 276 | mCombinedFence = Fence::merge(toString8(mName), mCombinedFence, releaseFence); |
Eino-Ville Talvala | 07d2169 | 2013-09-24 18:04:19 -0700 | [diff] [blame] | 277 | } |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 278 | |
Zhijun He | 6adc9cc | 2014-04-15 14:09:55 -0700 | [diff] [blame] | 279 | if (output) { |
| 280 | mHandoutOutputBufferCount--; |
| 281 | } |
| 282 | |
| 283 | mHandoutTotalBufferCount--; |
| 284 | if (mHandoutTotalBufferCount == 0 && mState != STATE_IN_CONFIG && |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 285 | mState != STATE_IN_RECONFIG && mState != STATE_PREPARING) { |
Igor Murashkin | 13d315e | 2014-04-03 18:09:04 -0700 | [diff] [blame] | 286 | /** |
| 287 | * Avoid a spurious IDLE->ACTIVE->IDLE transition when using buffers |
| 288 | * before/after register_stream_buffers during initial configuration |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 289 | * or re-configuration, or during prepare pre-allocation |
Igor Murashkin | 13d315e | 2014-04-03 18:09:04 -0700 | [diff] [blame] | 290 | */ |
Eino-Ville Talvala | 07d2169 | 2013-09-24 18:04:19 -0700 | [diff] [blame] | 291 | ALOGV("%s: Stream %d: All buffers returned; now idle", __FUNCTION__, |
| 292 | mId); |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 293 | sp<StatusTracker> statusTracker = mStatusTracker.promote(); |
| 294 | if (statusTracker != 0) { |
| 295 | statusTracker->markComponentIdle(mStatusId, mCombinedFence); |
| 296 | } |
| 297 | } |
| 298 | |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 299 | if (output) { |
| 300 | mLastTimestamp = timestamp; |
| 301 | } |
| 302 | |
Eino-Ville Talvala | 07d2169 | 2013-09-24 18:04:19 -0700 | [diff] [blame] | 303 | return res; |
Igor Murashkin | e3a9f96 | 2013-05-08 18:03:15 -0700 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | |
| 307 | |
| 308 | }; // namespace camera3 |
| 309 | |
| 310 | }; // namespace android |