diff options
author | alk3pInjection <webmaster@raspii.tech> | 2023-07-04 20:04:45 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-07-04 20:04:45 +0800 |
commit | e1390d22fae12df2784992b3ba238af8e90eaecc (patch) | |
tree | 52dfbc4cd9931c722b210f063c144fe97a706af5 /camera/provider/aidl/vts/camera_aidl_test.cpp | |
parent | b3f20c2aa61e4a6e07e8c06cf3623f1666620e1f (diff) | |
parent | 7c8943fde12ec5fb0f9629746c65e8b1bc78d1b4 (diff) |
Merge tag 'LA.QSSI.13.0.r1-10700-qssi.0' into tachibana-mr1tachibana-mr1
"LA.QSSI.13.0.r1-10700-qssi.0"
Change-Id: I11f0f2cb764e800ff1fd298c5a6443b98cf9a8a3
Diffstat (limited to 'camera/provider/aidl/vts/camera_aidl_test.cpp')
-rw-r--r-- | camera/provider/aidl/vts/camera_aidl_test.cpp | 39 |
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); |