diff options
Diffstat (limited to 'camera/provider/aidl/vts/camera_aidl_test.cpp')
-rw-r--r-- | camera/provider/aidl/vts/camera_aidl_test.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index dc106a173f..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; @@ -2376,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); |