Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | ** |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 3 | ** Copyright 2015-2018, The Android Open Source Project |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #define LOG_TAG "OutputConfiguration" |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 19 | //#define LOG_NDEBUG 0 |
| 20 | |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 21 | #include <utils/Log.h> |
| 22 | |
| 23 | #include <camera/camera2/OutputConfiguration.h> |
| 24 | #include <binder/Parcel.h> |
Mathias Agopian | 032845c | 2017-02-08 17:05:02 -0800 | [diff] [blame] | 25 | #include <gui/view/Surface.h> |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 26 | #include <system/camera_metadata.h> |
Brian Anderson | f675356 | 2016-10-11 14:51:05 -0700 | [diff] [blame] | 27 | #include <utils/String8.h> |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 28 | |
| 29 | namespace android { |
| 30 | |
| 31 | |
| 32 | const int OutputConfiguration::INVALID_ROTATION = -1; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 33 | const int OutputConfiguration::INVALID_SET_ID = -1; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 34 | |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 35 | const std::vector<sp<IGraphicBufferProducer>>& |
| 36 | OutputConfiguration::getGraphicBufferProducers() const { |
| 37 | return mGbps; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | int OutputConfiguration::getRotation() const { |
| 41 | return mRotation; |
| 42 | } |
| 43 | |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 44 | int OutputConfiguration::getSurfaceSetID() const { |
| 45 | return mSurfaceSetID; |
| 46 | } |
| 47 | |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 48 | int OutputConfiguration::getSurfaceType() const { |
| 49 | return mSurfaceType; |
| 50 | } |
| 51 | |
| 52 | int OutputConfiguration::getWidth() const { |
| 53 | return mWidth; |
| 54 | } |
| 55 | |
| 56 | int OutputConfiguration::getHeight() const { |
| 57 | return mHeight; |
| 58 | } |
| 59 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 60 | bool OutputConfiguration::isDeferred() const { |
| 61 | return mIsDeferred; |
| 62 | } |
| 63 | |
| 64 | bool OutputConfiguration::isShared() const { |
| 65 | return mIsShared; |
| 66 | } |
| 67 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 68 | String16 OutputConfiguration::getPhysicalCameraId() const { |
| 69 | return mPhysicalCameraId; |
| 70 | } |
| 71 | |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 72 | bool OutputConfiguration::isMultiResolution() const { |
| 73 | return mIsMultiResolution; |
| 74 | } |
| 75 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 76 | const std::vector<int32_t> &OutputConfiguration::getSensorPixelModesUsed() const { |
| 77 | return mSensorPixelModesUsed; |
| 78 | } |
| 79 | |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 80 | int OutputConfiguration::getDynamicRangeProfile() const { |
| 81 | return mDynamicRangeProfile; |
| 82 | } |
| 83 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 84 | OutputConfiguration::OutputConfiguration() : |
| 85 | mRotation(INVALID_ROTATION), |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 86 | mSurfaceSetID(INVALID_SET_ID), |
| 87 | mSurfaceType(SURFACE_TYPE_UNKNOWN), |
| 88 | mWidth(0), |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 89 | mHeight(0), |
| 90 | mIsDeferred(false), |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 91 | mIsShared(false), |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 92 | mIsMultiResolution(false), |
| 93 | mDynamicRangeProfile(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD) { |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 96 | OutputConfiguration::OutputConfiguration(const android::Parcel& parcel) : |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 97 | mRotation(INVALID_ROTATION), |
| 98 | mSurfaceSetID(INVALID_SET_ID) { |
| 99 | readFromParcel(&parcel); |
| 100 | } |
| 101 | |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 102 | status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) { |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 103 | status_t err = OK; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 104 | int rotation = 0; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 105 | |
| 106 | if (parcel == nullptr) return BAD_VALUE; |
| 107 | |
| 108 | if ((err = parcel->readInt32(&rotation)) != OK) { |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 109 | ALOGE("%s: Failed to read rotation from parcel", __FUNCTION__); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 110 | return err; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 111 | } |
| 112 | |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 113 | int setID = INVALID_SET_ID; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 114 | if ((err = parcel->readInt32(&setID)) != OK) { |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 115 | ALOGE("%s: Failed to read surface set ID from parcel", __FUNCTION__); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 116 | return err; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 117 | } |
| 118 | |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 119 | int surfaceType = SURFACE_TYPE_UNKNOWN; |
| 120 | if ((err = parcel->readInt32(&surfaceType)) != OK) { |
| 121 | ALOGE("%s: Failed to read surface type from parcel", __FUNCTION__); |
| 122 | return err; |
| 123 | } |
| 124 | |
| 125 | int width = 0; |
| 126 | if ((err = parcel->readInt32(&width)) != OK) { |
| 127 | ALOGE("%s: Failed to read surface width from parcel", __FUNCTION__); |
| 128 | return err; |
| 129 | } |
| 130 | |
| 131 | int height = 0; |
| 132 | if ((err = parcel->readInt32(&height)) != OK) { |
| 133 | ALOGE("%s: Failed to read surface height from parcel", __FUNCTION__); |
| 134 | return err; |
| 135 | } |
| 136 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 137 | int isDeferred = 0; |
| 138 | if ((err = parcel->readInt32(&isDeferred)) != OK) { |
| 139 | ALOGE("%s: Failed to read surface isDeferred flag from parcel", __FUNCTION__); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 140 | return err; |
| 141 | } |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 142 | |
| 143 | int isShared = 0; |
| 144 | if ((err = parcel->readInt32(&isShared)) != OK) { |
| 145 | ALOGE("%s: Failed to read surface isShared flag from parcel", __FUNCTION__); |
| 146 | return err; |
| 147 | } |
| 148 | |
| 149 | if (isDeferred && surfaceType != SURFACE_TYPE_SURFACE_VIEW && |
| 150 | surfaceType != SURFACE_TYPE_SURFACE_TEXTURE) { |
| 151 | ALOGE("%s: Invalid surface type for deferred configuration", __FUNCTION__); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 152 | return BAD_VALUE; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 153 | } |
| 154 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 155 | std::vector<view::Surface> surfaceShims; |
| 156 | if ((err = parcel->readParcelableVector(&surfaceShims)) != OK) { |
| 157 | ALOGE("%s: Failed to read surface(s) from parcel", __FUNCTION__); |
| 158 | return err; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 159 | } |
| 160 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 161 | parcel->readString16(&mPhysicalCameraId); |
| 162 | |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 163 | int isMultiResolution = 0; |
| 164 | if ((err = parcel->readInt32(&isMultiResolution)) != OK) { |
| 165 | ALOGE("%s: Failed to read surface isMultiResolution flag from parcel", __FUNCTION__); |
| 166 | return err; |
| 167 | } |
| 168 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 169 | std::vector<int32_t> sensorPixelModesUsed; |
Jayant Chowdhary | 84df28c | 2021-05-26 22:32:21 -0700 | [diff] [blame] | 170 | if ((err = parcel->readInt32Vector(&sensorPixelModesUsed)) != OK) { |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 171 | ALOGE("%s: Failed to read sensor pixel mode(s) from parcel", __FUNCTION__); |
| 172 | return err; |
| 173 | } |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 174 | int dynamicProfile; |
| 175 | if ((err = parcel->readInt32(&dynamicProfile)) != OK) { |
| 176 | ALOGE("%s: Failed to read surface dynamic range profile flag from parcel", __FUNCTION__); |
| 177 | return err; |
| 178 | } |
| 179 | |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 180 | mRotation = rotation; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 181 | mSurfaceSetID = setID; |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 182 | mSurfaceType = surfaceType; |
| 183 | mWidth = width; |
| 184 | mHeight = height; |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 185 | mIsDeferred = isDeferred != 0; |
| 186 | mIsShared = isShared != 0; |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 187 | mIsMultiResolution = isMultiResolution != 0; |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 188 | for (auto& surface : surfaceShims) { |
| 189 | ALOGV("%s: OutputConfiguration: %p, name %s", __FUNCTION__, |
| 190 | surface.graphicBufferProducer.get(), |
| 191 | String8(surface.name).string()); |
| 192 | mGbps.push_back(surface.graphicBufferProducer); |
| 193 | } |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 194 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 195 | mSensorPixelModesUsed = std::move(sensorPixelModesUsed); |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 196 | mDynamicRangeProfile = dynamicProfile; |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 197 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 198 | ALOGV("%s: OutputConfiguration: rotation = %d, setId = %d, surfaceType = %d," |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 199 | " physicalCameraId = %s, isMultiResolution = %d", __FUNCTION__, mRotation, |
| 200 | mSurfaceSetID, mSurfaceType, String8(mPhysicalCameraId).string(), mIsMultiResolution); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 201 | |
| 202 | return err; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 203 | } |
| 204 | |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 205 | OutputConfiguration::OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation, |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 206 | const String16& physicalId, |
Emilian Peev | 40ead60 | 2017-09-26 15:46:36 +0100 | [diff] [blame] | 207 | int surfaceSetID, bool isShared) { |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 208 | mGbps.push_back(gbp); |
Ruben Brunk | 3450ba7 | 2015-06-16 11:00:37 -0700 | [diff] [blame] | 209 | mRotation = rotation; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 210 | mSurfaceSetID = surfaceSetID; |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 211 | mIsDeferred = false; |
Emilian Peev | 40ead60 | 2017-09-26 15:46:36 +0100 | [diff] [blame] | 212 | mIsShared = isShared; |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 213 | mPhysicalCameraId = physicalId; |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 214 | mIsMultiResolution = false; |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 215 | mDynamicRangeProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD; |
Ruben Brunk | 3450ba7 | 2015-06-16 11:00:37 -0700 | [diff] [blame] | 216 | } |
| 217 | |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 218 | OutputConfiguration::OutputConfiguration( |
| 219 | const std::vector<sp<IGraphicBufferProducer>>& gbps, |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 220 | int rotation, const String16& physicalCameraId, int surfaceSetID, int surfaceType, |
| 221 | int width, int height, bool isShared) |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 222 | : mGbps(gbps), mRotation(rotation), mSurfaceSetID(surfaceSetID), mSurfaceType(surfaceType), |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 223 | mWidth(width), mHeight(height), mIsDeferred(false), mIsShared(isShared), |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 224 | mPhysicalCameraId(physicalCameraId), mIsMultiResolution(false), |
| 225 | mDynamicRangeProfile(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD) { } |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 226 | |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 227 | status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const { |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 228 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 229 | if (parcel == nullptr) return BAD_VALUE; |
| 230 | status_t err = OK; |
| 231 | |
| 232 | err = parcel->writeInt32(mRotation); |
| 233 | if (err != OK) return err; |
| 234 | |
| 235 | err = parcel->writeInt32(mSurfaceSetID); |
| 236 | if (err != OK) return err; |
| 237 | |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 238 | err = parcel->writeInt32(mSurfaceType); |
| 239 | if (err != OK) return err; |
| 240 | |
| 241 | err = parcel->writeInt32(mWidth); |
| 242 | if (err != OK) return err; |
| 243 | |
| 244 | err = parcel->writeInt32(mHeight); |
| 245 | if (err != OK) return err; |
| 246 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 247 | err = parcel->writeInt32(mIsDeferred ? 1 : 0); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 248 | if (err != OK) return err; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 249 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 250 | err = parcel->writeInt32(mIsShared ? 1 : 0); |
| 251 | if (err != OK) return err; |
| 252 | |
| 253 | std::vector<view::Surface> surfaceShims; |
| 254 | for (auto& gbp : mGbps) { |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 255 | view::Surface surfaceShim; |
| 256 | surfaceShim.name = String16("unknown_name"); // name of surface |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 257 | surfaceShim.graphicBufferProducer = gbp; |
| 258 | surfaceShims.push_back(surfaceShim); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 259 | } |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 260 | err = parcel->writeParcelableVector(surfaceShims); |
| 261 | if (err != OK) return err; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 262 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 263 | err = parcel->writeString16(mPhysicalCameraId); |
| 264 | if (err != OK) return err; |
| 265 | |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 266 | err = parcel->writeInt32(mIsMultiResolution ? 1 : 0); |
| 267 | if (err != OK) return err; |
| 268 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 269 | err = parcel->writeParcelableVector(mSensorPixelModesUsed); |
| 270 | if (err != OK) return err; |
| 271 | |
Emilian Peev | 2295df7 | 2021-11-12 18:14:10 -0800 | [diff] [blame^] | 272 | err = parcel->writeInt32(mDynamicRangeProfile ? 1 : 0); |
| 273 | if (err != OK) return err; |
| 274 | |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 275 | return OK; |
| 276 | } |
| 277 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 278 | template <typename T> |
| 279 | static bool simpleVectorsEqual(T first, T second) { |
| 280 | if (first.size() != second.size()) { |
| 281 | return false; |
| 282 | } |
| 283 | |
| 284 | for (size_t i = 0; i < first.size(); i++) { |
| 285 | if (first[i] != second[i]) { |
| 286 | return false; |
| 287 | } |
| 288 | } |
| 289 | return true; |
| 290 | } |
| 291 | |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 292 | bool OutputConfiguration::gbpsEqual(const OutputConfiguration& other) const { |
| 293 | const std::vector<sp<IGraphicBufferProducer> >& otherGbps = |
| 294 | other.getGraphicBufferProducers(); |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 295 | return simpleVectorsEqual(otherGbps, mGbps); |
| 296 | } |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 297 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 298 | bool OutputConfiguration::sensorPixelModesUsedEqual(const OutputConfiguration& other) const { |
| 299 | const std::vector<int32_t>& othersensorPixelModesUsed = other.getSensorPixelModesUsed(); |
| 300 | return simpleVectorsEqual(othersensorPixelModesUsed, mSensorPixelModesUsed); |
| 301 | } |
| 302 | |
| 303 | bool OutputConfiguration::sensorPixelModesUsedLessThan(const OutputConfiguration& other) const { |
| 304 | const std::vector<int32_t>& spms = other.getSensorPixelModesUsed(); |
| 305 | |
| 306 | if (mSensorPixelModesUsed.size() != spms.size()) { |
| 307 | return mSensorPixelModesUsed.size() < spms.size(); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 308 | } |
| 309 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 310 | for (size_t i = 0; i < spms.size(); i++) { |
| 311 | if (mSensorPixelModesUsed[i] != spms[i]) { |
| 312 | return mSensorPixelModesUsed[i] < spms[i]; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 313 | } |
| 314 | } |
| 315 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 316 | return false; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | bool OutputConfiguration::gbpsLessThan(const OutputConfiguration& other) const { |
| 320 | const std::vector<sp<IGraphicBufferProducer> >& otherGbps = |
| 321 | other.getGraphicBufferProducers(); |
| 322 | |
| 323 | if (mGbps.size() != otherGbps.size()) { |
| 324 | return mGbps.size() < otherGbps.size(); |
| 325 | } |
| 326 | |
| 327 | for (size_t i = 0; i < mGbps.size(); i++) { |
| 328 | if (mGbps[i] != otherGbps[i]) { |
| 329 | return mGbps[i] < otherGbps[i]; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | return false; |
| 334 | } |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 335 | }; // namespace android |