blob: d50566d4234e8663c1263b3e1005e57ee93e3ed0 [file] [log] [blame]
Yin-Chia Yehb97babb2015-03-12 13:42:44 -07001/*
2**
Shuzhen Wangc28189a2017-11-27 23:05:10 -08003** Copyright 2015-2018, The Android Open Source Project
Yin-Chia Yehb97babb2015-03-12 13:42:44 -07004**
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 Talvalad56db1d2015-12-17 16:50:35 -080019//#define LOG_NDEBUG 0
20
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070021#include <utils/Log.h>
22
23#include <camera/camera2/OutputConfiguration.h>
24#include <binder/Parcel.h>
Mathias Agopian032845c2017-02-08 17:05:02 -080025#include <gui/view/Surface.h>
Emilian Peev2295df72021-11-12 18:14:10 -080026#include <system/camera_metadata.h>
Brian Andersonf6753562016-10-11 14:51:05 -070027#include <utils/String8.h>
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070028
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070029
Austin Borger9e2b27c2022-07-15 11:27:24 -070030namespace android {
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070031
32const int OutputConfiguration::INVALID_ROTATION = -1;
Zhijun He018107a2016-01-18 15:32:50 -080033const int OutputConfiguration::INVALID_SET_ID = -1;
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070034
Shuzhen Wang0129d522016-10-30 22:43:41 -070035const std::vector<sp<IGraphicBufferProducer>>&
36 OutputConfiguration::getGraphicBufferProducers() const {
37 return mGbps;
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070038}
39
40int OutputConfiguration::getRotation() const {
41 return mRotation;
42}
43
Zhijun He018107a2016-01-18 15:32:50 -080044int OutputConfiguration::getSurfaceSetID() const {
45 return mSurfaceSetID;
46}
47
Zhijun He5d677d12016-05-29 16:52:39 -070048int OutputConfiguration::getSurfaceType() const {
49 return mSurfaceType;
50}
51
52int OutputConfiguration::getWidth() const {
53 return mWidth;
54}
55
56int OutputConfiguration::getHeight() const {
57 return mHeight;
58}
59
Shuzhen Wang758c2152017-01-10 18:26:18 -080060bool OutputConfiguration::isDeferred() const {
61 return mIsDeferred;
62}
63
64bool OutputConfiguration::isShared() const {
65 return mIsShared;
66}
67
Shuzhen Wangc28189a2017-11-27 23:05:10 -080068String16 OutputConfiguration::getPhysicalCameraId() const {
69 return mPhysicalCameraId;
70}
71
Shuzhen Wang83bff122020-11-20 15:51:39 -080072bool OutputConfiguration::isMultiResolution() const {
73 return mIsMultiResolution;
74}
75
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -080076const std::vector<int32_t> &OutputConfiguration::getSensorPixelModesUsed() const {
77 return mSensorPixelModesUsed;
78}
79
Emilian Peevc81a7592022-02-14 17:38:18 -080080int64_t OutputConfiguration::getDynamicRangeProfile() const {
Emilian Peev2295df72021-11-12 18:14:10 -080081 return mDynamicRangeProfile;
82}
83
Austin Borger9e2b27c2022-07-15 11:27:24 -070084int32_t OutputConfiguration::getColorSpace() const {
85 return mColorSpace;
86}
87
Shuzhen Wang8ed1e872022-03-08 16:34:33 -080088int64_t OutputConfiguration::getStreamUseCase() const {
Shuzhen Wangc8ab4522021-12-14 20:12:42 -080089 return mStreamUseCase;
90}
91
Shuzhen Wange4208922022-02-01 16:52:48 -080092int OutputConfiguration::getTimestampBase() const {
93 return mTimestampBase;
94}
95
Shuzhen Wang610d7b82022-02-08 14:37:22 -080096int OutputConfiguration::getMirrorMode() const {
97 return mMirrorMode;
98}
99
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800100OutputConfiguration::OutputConfiguration() :
101 mRotation(INVALID_ROTATION),
Zhijun He5d677d12016-05-29 16:52:39 -0700102 mSurfaceSetID(INVALID_SET_ID),
103 mSurfaceType(SURFACE_TYPE_UNKNOWN),
104 mWidth(0),
Shuzhen Wang758c2152017-01-10 18:26:18 -0800105 mHeight(0),
106 mIsDeferred(false),
Shuzhen Wang83bff122020-11-20 15:51:39 -0800107 mIsShared(false),
Emilian Peev2295df72021-11-12 18:14:10 -0800108 mIsMultiResolution(false),
Shuzhen Wangc8ab4522021-12-14 20:12:42 -0800109 mDynamicRangeProfile(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD),
Austin Borger9e2b27c2022-07-15 11:27:24 -0700110 mColorSpace(ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED),
Shuzhen Wange4208922022-02-01 16:52:48 -0800111 mStreamUseCase(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT),
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800112 mTimestampBase(TIMESTAMP_BASE_DEFAULT),
113 mMirrorMode(MIRROR_MODE_AUTO) {
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800114}
115
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800116OutputConfiguration::OutputConfiguration(const android::Parcel& parcel) :
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800117 mRotation(INVALID_ROTATION),
118 mSurfaceSetID(INVALID_SET_ID) {
119 readFromParcel(&parcel);
120}
121
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800122status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) {
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800123 status_t err = OK;
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700124 int rotation = 0;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800125
126 if (parcel == nullptr) return BAD_VALUE;
127
128 if ((err = parcel->readInt32(&rotation)) != OK) {
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700129 ALOGE("%s: Failed to read rotation from parcel", __FUNCTION__);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800130 return err;
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700131 }
132
Zhijun He018107a2016-01-18 15:32:50 -0800133 int setID = INVALID_SET_ID;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800134 if ((err = parcel->readInt32(&setID)) != OK) {
Zhijun He018107a2016-01-18 15:32:50 -0800135 ALOGE("%s: Failed to read surface set ID from parcel", __FUNCTION__);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800136 return err;
Zhijun He018107a2016-01-18 15:32:50 -0800137 }
138
Zhijun He5d677d12016-05-29 16:52:39 -0700139 int surfaceType = SURFACE_TYPE_UNKNOWN;
140 if ((err = parcel->readInt32(&surfaceType)) != OK) {
141 ALOGE("%s: Failed to read surface type from parcel", __FUNCTION__);
142 return err;
143 }
144
145 int width = 0;
146 if ((err = parcel->readInt32(&width)) != OK) {
147 ALOGE("%s: Failed to read surface width from parcel", __FUNCTION__);
148 return err;
149 }
150
151 int height = 0;
152 if ((err = parcel->readInt32(&height)) != OK) {
153 ALOGE("%s: Failed to read surface height from parcel", __FUNCTION__);
154 return err;
155 }
156
Shuzhen Wang758c2152017-01-10 18:26:18 -0800157 int isDeferred = 0;
158 if ((err = parcel->readInt32(&isDeferred)) != OK) {
159 ALOGE("%s: Failed to read surface isDeferred flag from parcel", __FUNCTION__);
Shuzhen Wang0129d522016-10-30 22:43:41 -0700160 return err;
161 }
Shuzhen Wang758c2152017-01-10 18:26:18 -0800162
163 int isShared = 0;
164 if ((err = parcel->readInt32(&isShared)) != OK) {
165 ALOGE("%s: Failed to read surface isShared flag from parcel", __FUNCTION__);
166 return err;
167 }
168
169 if (isDeferred && surfaceType != SURFACE_TYPE_SURFACE_VIEW &&
170 surfaceType != SURFACE_TYPE_SURFACE_TEXTURE) {
171 ALOGE("%s: Invalid surface type for deferred configuration", __FUNCTION__);
Shuzhen Wang0129d522016-10-30 22:43:41 -0700172 return BAD_VALUE;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800173 }
174
Shuzhen Wang758c2152017-01-10 18:26:18 -0800175 std::vector<view::Surface> surfaceShims;
176 if ((err = parcel->readParcelableVector(&surfaceShims)) != OK) {
177 ALOGE("%s: Failed to read surface(s) from parcel", __FUNCTION__);
178 return err;
Shuzhen Wang0129d522016-10-30 22:43:41 -0700179 }
180
Shuzhen Wangc28189a2017-11-27 23:05:10 -0800181 parcel->readString16(&mPhysicalCameraId);
182
Shuzhen Wang83bff122020-11-20 15:51:39 -0800183 int isMultiResolution = 0;
184 if ((err = parcel->readInt32(&isMultiResolution)) != OK) {
185 ALOGE("%s: Failed to read surface isMultiResolution flag from parcel", __FUNCTION__);
186 return err;
187 }
188
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800189 std::vector<int32_t> sensorPixelModesUsed;
Jayant Chowdhary84df28c2021-05-26 22:32:21 -0700190 if ((err = parcel->readInt32Vector(&sensorPixelModesUsed)) != OK) {
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800191 ALOGE("%s: Failed to read sensor pixel mode(s) from parcel", __FUNCTION__);
192 return err;
193 }
Emilian Peevc81a7592022-02-14 17:38:18 -0800194 int64_t dynamicProfile;
195 if ((err = parcel->readInt64(&dynamicProfile)) != OK) {
Emilian Peev2295df72021-11-12 18:14:10 -0800196 ALOGE("%s: Failed to read surface dynamic range profile flag from parcel", __FUNCTION__);
197 return err;
198 }
Austin Borger9e2b27c2022-07-15 11:27:24 -0700199 int32_t colorSpace;
200 if ((err = parcel->readInt32(&colorSpace)) != OK) {
201 ALOGE("%s: Failed to read surface color space flag from parcel", __FUNCTION__);
202 return err;
203 }
Emilian Peev2295df72021-11-12 18:14:10 -0800204
Shuzhen Wang8ed1e872022-03-08 16:34:33 -0800205 int64_t streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT;
206 if ((err = parcel->readInt64(&streamUseCase)) != OK) {
Shuzhen Wangc8ab4522021-12-14 20:12:42 -0800207 ALOGE("%s: Failed to read stream use case from parcel", __FUNCTION__);
208 return err;
209 }
210
Shuzhen Wange4208922022-02-01 16:52:48 -0800211 int timestampBase = TIMESTAMP_BASE_DEFAULT;
212 if ((err = parcel->readInt32(&timestampBase)) != OK) {
213 ALOGE("%s: Failed to read timestamp base from parcel", __FUNCTION__);
214 return err;
215 }
216
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800217 int mirrorMode = MIRROR_MODE_AUTO;
218 if ((err = parcel->readInt32(&mirrorMode)) != OK) {
219 ALOGE("%s: Failed to read mirroring mode from parcel", __FUNCTION__);
220 return err;
221 }
222
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700223 mRotation = rotation;
Zhijun He018107a2016-01-18 15:32:50 -0800224 mSurfaceSetID = setID;
Zhijun He5d677d12016-05-29 16:52:39 -0700225 mSurfaceType = surfaceType;
226 mWidth = width;
227 mHeight = height;
Shuzhen Wang758c2152017-01-10 18:26:18 -0800228 mIsDeferred = isDeferred != 0;
229 mIsShared = isShared != 0;
Shuzhen Wang83bff122020-11-20 15:51:39 -0800230 mIsMultiResolution = isMultiResolution != 0;
Shuzhen Wangc8ab4522021-12-14 20:12:42 -0800231 mStreamUseCase = streamUseCase;
Shuzhen Wange4208922022-02-01 16:52:48 -0800232 mTimestampBase = timestampBase;
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800233 mMirrorMode = mirrorMode;
Shuzhen Wang758c2152017-01-10 18:26:18 -0800234 for (auto& surface : surfaceShims) {
235 ALOGV("%s: OutputConfiguration: %p, name %s", __FUNCTION__,
236 surface.graphicBufferProducer.get(),
237 String8(surface.name).string());
238 mGbps.push_back(surface.graphicBufferProducer);
239 }
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700240
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800241 mSensorPixelModesUsed = std::move(sensorPixelModesUsed);
Emilian Peev2295df72021-11-12 18:14:10 -0800242 mDynamicRangeProfile = dynamicProfile;
Austin Borger9e2b27c2022-07-15 11:27:24 -0700243 mColorSpace = colorSpace;
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800244
Shuzhen Wangc28189a2017-11-27 23:05:10 -0800245 ALOGV("%s: OutputConfiguration: rotation = %d, setId = %d, surfaceType = %d,"
Shuzhen Wang8ed1e872022-03-08 16:34:33 -0800246 " physicalCameraId = %s, isMultiResolution = %d, streamUseCase = %" PRId64
247 ", timestampBase = %d, mirrorMode = %d",
Shuzhen Wange4208922022-02-01 16:52:48 -0800248 __FUNCTION__, mRotation, mSurfaceSetID, mSurfaceType,
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800249 String8(mPhysicalCameraId).string(), mIsMultiResolution, mStreamUseCase, timestampBase,
250 mMirrorMode);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800251
252 return err;
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700253}
254
Zhijun He018107a2016-01-18 15:32:50 -0800255OutputConfiguration::OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation,
Shuzhen Wang0ff9ae32018-12-05 18:06:12 -0800256 const String16& physicalId,
Emilian Peev40ead602017-09-26 15:46:36 +0100257 int surfaceSetID, bool isShared) {
Shuzhen Wang0129d522016-10-30 22:43:41 -0700258 mGbps.push_back(gbp);
Ruben Brunk3450ba72015-06-16 11:00:37 -0700259 mRotation = rotation;
Zhijun He018107a2016-01-18 15:32:50 -0800260 mSurfaceSetID = surfaceSetID;
Shuzhen Wang758c2152017-01-10 18:26:18 -0800261 mIsDeferred = false;
Emilian Peev40ead602017-09-26 15:46:36 +0100262 mIsShared = isShared;
Shuzhen Wang0ff9ae32018-12-05 18:06:12 -0800263 mPhysicalCameraId = physicalId;
Shuzhen Wang83bff122020-11-20 15:51:39 -0800264 mIsMultiResolution = false;
Emilian Peev2295df72021-11-12 18:14:10 -0800265 mDynamicRangeProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
Austin Borger9e2b27c2022-07-15 11:27:24 -0700266 mColorSpace = ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED;
Shuzhen Wangc8ab4522021-12-14 20:12:42 -0800267 mStreamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT;
Shuzhen Wange4208922022-02-01 16:52:48 -0800268 mTimestampBase = TIMESTAMP_BASE_DEFAULT;
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800269 mMirrorMode = MIRROR_MODE_AUTO;
Ruben Brunk3450ba72015-06-16 11:00:37 -0700270}
271
Jayant Chowdharybe543d42018-08-15 13:16:14 -0700272OutputConfiguration::OutputConfiguration(
273 const std::vector<sp<IGraphicBufferProducer>>& gbps,
Shuzhen Wang0ff9ae32018-12-05 18:06:12 -0800274 int rotation, const String16& physicalCameraId, int surfaceSetID, int surfaceType,
275 int width, int height, bool isShared)
Jayant Chowdharybe543d42018-08-15 13:16:14 -0700276 : mGbps(gbps), mRotation(rotation), mSurfaceSetID(surfaceSetID), mSurfaceType(surfaceType),
Shuzhen Wang0ff9ae32018-12-05 18:06:12 -0800277 mWidth(width), mHeight(height), mIsDeferred(false), mIsShared(isShared),
Emilian Peev2295df72021-11-12 18:14:10 -0800278 mPhysicalCameraId(physicalCameraId), mIsMultiResolution(false),
Shuzhen Wangc8ab4522021-12-14 20:12:42 -0800279 mDynamicRangeProfile(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD),
Austin Borger9e2b27c2022-07-15 11:27:24 -0700280 mColorSpace(ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED),
Shuzhen Wange4208922022-02-01 16:52:48 -0800281 mStreamUseCase(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT),
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800282 mTimestampBase(TIMESTAMP_BASE_DEFAULT),
283 mMirrorMode(MIRROR_MODE_AUTO) { }
Jayant Chowdharybe543d42018-08-15 13:16:14 -0700284
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800285status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const {
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700286
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800287 if (parcel == nullptr) return BAD_VALUE;
288 status_t err = OK;
289
290 err = parcel->writeInt32(mRotation);
291 if (err != OK) return err;
292
293 err = parcel->writeInt32(mSurfaceSetID);
294 if (err != OK) return err;
295
Zhijun He5d677d12016-05-29 16:52:39 -0700296 err = parcel->writeInt32(mSurfaceType);
297 if (err != OK) return err;
298
299 err = parcel->writeInt32(mWidth);
300 if (err != OK) return err;
301
302 err = parcel->writeInt32(mHeight);
303 if (err != OK) return err;
304
Shuzhen Wang758c2152017-01-10 18:26:18 -0800305 err = parcel->writeInt32(mIsDeferred ? 1 : 0);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800306 if (err != OK) return err;
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700307
Shuzhen Wang758c2152017-01-10 18:26:18 -0800308 err = parcel->writeInt32(mIsShared ? 1 : 0);
309 if (err != OK) return err;
310
311 std::vector<view::Surface> surfaceShims;
312 for (auto& gbp : mGbps) {
Shuzhen Wang0129d522016-10-30 22:43:41 -0700313 view::Surface surfaceShim;
314 surfaceShim.name = String16("unknown_name"); // name of surface
Shuzhen Wang758c2152017-01-10 18:26:18 -0800315 surfaceShim.graphicBufferProducer = gbp;
316 surfaceShims.push_back(surfaceShim);
Shuzhen Wang0129d522016-10-30 22:43:41 -0700317 }
Shuzhen Wang758c2152017-01-10 18:26:18 -0800318 err = parcel->writeParcelableVector(surfaceShims);
319 if (err != OK) return err;
Shuzhen Wang0129d522016-10-30 22:43:41 -0700320
Shuzhen Wangc28189a2017-11-27 23:05:10 -0800321 err = parcel->writeString16(mPhysicalCameraId);
322 if (err != OK) return err;
323
Shuzhen Wang83bff122020-11-20 15:51:39 -0800324 err = parcel->writeInt32(mIsMultiResolution ? 1 : 0);
325 if (err != OK) return err;
326
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800327 err = parcel->writeParcelableVector(mSensorPixelModesUsed);
328 if (err != OK) return err;
329
Emilian Peevc81a7592022-02-14 17:38:18 -0800330 err = parcel->writeInt64(mDynamicRangeProfile);
Emilian Peev2295df72021-11-12 18:14:10 -0800331 if (err != OK) return err;
332
Austin Borger9e2b27c2022-07-15 11:27:24 -0700333 err = parcel->writeInt32(mColorSpace);
334 if (err != OK) return err;
335
Shuzhen Wang8ed1e872022-03-08 16:34:33 -0800336 err = parcel->writeInt64(mStreamUseCase);
Shuzhen Wangc8ab4522021-12-14 20:12:42 -0800337 if (err != OK) return err;
338
Shuzhen Wange4208922022-02-01 16:52:48 -0800339 err = parcel->writeInt32(mTimestampBase);
340 if (err != OK) return err;
341
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800342 err = parcel->writeInt32(mMirrorMode);
343 if (err != OK) return err;
344
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700345 return OK;
346}
347
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800348template <typename T>
349static bool simpleVectorsEqual(T first, T second) {
350 if (first.size() != second.size()) {
351 return false;
352 }
353
354 for (size_t i = 0; i < first.size(); i++) {
355 if (first[i] != second[i]) {
356 return false;
357 }
358 }
359 return true;
360}
361
Shuzhen Wang0129d522016-10-30 22:43:41 -0700362bool OutputConfiguration::gbpsEqual(const OutputConfiguration& other) const {
363 const std::vector<sp<IGraphicBufferProducer> >& otherGbps =
364 other.getGraphicBufferProducers();
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800365 return simpleVectorsEqual(otherGbps, mGbps);
366}
Shuzhen Wang0129d522016-10-30 22:43:41 -0700367
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800368bool OutputConfiguration::sensorPixelModesUsedEqual(const OutputConfiguration& other) const {
369 const std::vector<int32_t>& othersensorPixelModesUsed = other.getSensorPixelModesUsed();
370 return simpleVectorsEqual(othersensorPixelModesUsed, mSensorPixelModesUsed);
371}
372
373bool OutputConfiguration::sensorPixelModesUsedLessThan(const OutputConfiguration& other) const {
374 const std::vector<int32_t>& spms = other.getSensorPixelModesUsed();
375
376 if (mSensorPixelModesUsed.size() != spms.size()) {
377 return mSensorPixelModesUsed.size() < spms.size();
Shuzhen Wang0129d522016-10-30 22:43:41 -0700378 }
379
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800380 for (size_t i = 0; i < spms.size(); i++) {
381 if (mSensorPixelModesUsed[i] != spms[i]) {
382 return mSensorPixelModesUsed[i] < spms[i];
Shuzhen Wang0129d522016-10-30 22:43:41 -0700383 }
384 }
385
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800386 return false;
Shuzhen Wang0129d522016-10-30 22:43:41 -0700387}
388
389bool OutputConfiguration::gbpsLessThan(const OutputConfiguration& other) const {
390 const std::vector<sp<IGraphicBufferProducer> >& otherGbps =
391 other.getGraphicBufferProducers();
392
393 if (mGbps.size() != otherGbps.size()) {
394 return mGbps.size() < otherGbps.size();
395 }
396
397 for (size_t i = 0; i < mGbps.size(); i++) {
398 if (mGbps[i] != otherGbps[i]) {
399 return mGbps[i] < otherGbps[i];
400 }
401 }
402
403 return false;
404}
Yin-Chia Yehb97babb2015-03-12 13:42:44 -0700405}; // namespace android