summaryrefslogtreecommitdiff
path: root/camera/provider/aidl/vts/camera_aidl_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'camera/provider/aidl/vts/camera_aidl_test.cpp')
-rw-r--r--camera/provider/aidl/vts/camera_aidl_test.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 20f32bfe21..137c521c2b 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -34,6 +34,7 @@
#include <grallocusage/GrallocUsageConversion.h>
#include <hardware/gralloc1.h>
#include <simple_device_cb.h>
+#include <ui/Fence.h>
#include <ui/GraphicBufferAllocator.h>
#include <regex>
#include <typeinfo>
@@ -139,6 +140,25 @@ void CameraAidlTest::TearDown() {
}
}
+void CameraAidlTest::waitForReleaseFence(
+ std::vector<InFlightRequest::StreamBufferAndTimestamp>& resultOutputBuffers) {
+ for (auto& bufferAndTimestamp : resultOutputBuffers) {
+ // wait for the fence timestamp and store it along with the buffer
+ android::sp<android::Fence> releaseFence = nullptr;
+ const native_handle_t* releaseFenceHandle = bufferAndTimestamp.buffer.releaseFence;
+ if (releaseFenceHandle != nullptr && releaseFenceHandle->numFds == 1 &&
+ releaseFenceHandle->data[0] >= 0) {
+ releaseFence = new android::Fence(releaseFenceHandle->data[0]);
+ }
+ if (releaseFence && releaseFence->isValid()) {
+ releaseFence->wait(/*ms*/ 300);
+ nsecs_t releaseTime = releaseFence->getSignalTime();
+ if (bufferAndTimestamp.timeStamp < releaseTime)
+ bufferAndTimestamp.timeStamp = releaseTime;
+ }
+ }
+}
+
std::vector<std::string> CameraAidlTest::getCameraDeviceNames(
std::shared_ptr<ICameraProvider>& provider, bool addSecureOnly) {
std::vector<std::string> cameraDeviceNames;
@@ -167,7 +187,7 @@ std::vector<std::string> CameraAidlTest::getCameraDeviceNames(
ScopedAStatus physicalCameraDeviceStatusChange(
const std::string&, const std::string&,
::aidl::android::hardware::camera::common::CameraDeviceStatus) override {
- return ndk::ScopedAStatus();
+ return ScopedAStatus::ok();
}
std::vector<std::string> externalCameraDeviceNames;
@@ -751,8 +771,6 @@ Status CameraAidlTest::getAvailableOutputStreams(const camera_metadata_t* static
std::vector<AvailableStream>& outputStreams,
const AvailableStream* threshold,
bool maxResolution) {
- AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::Y16)};
if (nullptr == staticMeta) {
return Status::ILLEGAL_ARGUMENT;
}
@@ -778,7 +796,11 @@ Status CameraAidlTest::getAvailableOutputStreams(const camera_metadata_t* static
}
if (foundDepth == 0 && (0 == (depthEntry.count % 4))) {
- fillOutputStreams(&depthEntry, outputStreams, &depthPreviewThreshold,
+ AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::Y16)};
+ const AvailableStream* depthThreshold =
+ isDepthOnly(staticMeta) ? &depthPreviewThreshold : threshold;
+ fillOutputStreams(&depthEntry, outputStreams, depthThreshold,
ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT);
}
@@ -1181,6 +1203,7 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata(
camera_metadata_ro_entry physicalMultiResStreamConfigs;
camera_metadata_ro_entry physicalStreamConfigs;
camera_metadata_ro_entry physicalMaxResolutionStreamConfigs;
+ CameraMetadata physChars;
bool isUltraHighRes = false;
std::unordered_set<int32_t> subCameraPrivacyTestPatterns;
if (isPublicId) {
@@ -1189,12 +1212,11 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata(
ASSERT_TRUE(ret.isOk());
ASSERT_NE(subDevice, nullptr);
- CameraMetadata subDeviceChars;
- ret = subDevice->getCameraCharacteristics(&subDeviceChars);
+ ret = subDevice->getCameraCharacteristics(&physChars);
ASSERT_TRUE(ret.isOk());
const camera_metadata_t* staticMetadata =
- reinterpret_cast<const camera_metadata_t*>(subDeviceChars.metadata.data());
+ reinterpret_cast<const camera_metadata_t*>(physChars.metadata.data());
retStatus = getSystemCameraKind(staticMetadata, &physSystemCameraKind);
ASSERT_EQ(retStatus, Status::OK);
@@ -1215,7 +1237,6 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata(
getPrivacyTestPatternModes(staticMetadata, &subCameraPrivacyTestPatterns);
} else {
// Check camera characteristics for hidden camera id
- CameraMetadata physChars;
ndk::ScopedAStatus ret =
device->getPhysicalCameraCharacteristics(physicalId, &physChars);
ASSERT_TRUE(ret.isOk());
@@ -2333,6 +2354,7 @@ void CameraAidlTest::processPreviewStabilizationCaptureRequestInternal(
request.fmqSettingsSize = 0;
request.settings.metadata =
std::vector(rawMetadata, rawMetadata + get_camera_metadata_size(releasedMetadata));
+ overrideRotateAndCrop(&request.settings);
request.outputBuffers = std::vector<StreamBuffer>(1);
StreamBuffer& outputBuffer = request.outputBuffers[0];
if (useHalBufManager) {
@@ -2374,6 +2396,7 @@ void CameraAidlTest::processPreviewStabilizationCaptureRequestInternal(
std::chrono::seconds(kStreamBufferTimeoutSec);
ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
}
+ waitForReleaseFence(inflightReq->resultOutputBuffers);
ASSERT_FALSE(inflightReq->errorCodeValid);
ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u);