From 8558454a67219d3787e817f1c7e4513682c18338 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Wed, 3 Feb 2021 10:03:02 -0800 Subject: [PATCH] Camera: Set arbitrary dataspace for RAW streams Use 'arbitrary' dataspace when trying to configure RAW streams. Bug: 179158925 Test: run vts -m VtsHalCameraProviderV2_4TargetTest Change-Id: I1faa29bea3df91a34ba87ec2c7ecb9a17bd7a4e2 --- .../VtsHalCameraProviderV2_4TargetTest.cpp | 58 ++++++++----------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 19fb5807d1..9acef38ccb 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -888,6 +888,8 @@ public: static Status getSystemCameraKind(const camera_metadata_t* staticMeta, SystemCameraKind* systemCameraKind); + static V3_2::DataspaceFlags getDataspace(PixelFormat format); + void processCaptureRequestInternal(uint64_t bufferusage, RequestTemplate reqTemplate, bool useSecureOnlyCameras); @@ -3179,7 +3181,6 @@ TEST_P(CameraHidlTest, constructDefaultRequestSettings) { } } - // Verify that all supported stream formats and sizes can be configured // successfully. TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) { @@ -3222,17 +3223,7 @@ TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) { uint32_t streamConfigCounter = 0; for (auto& it : outputStreams) { V3_2::Stream stream3_2; - V3_2::DataspaceFlags dataspaceFlag = 0; - switch (static_cast(it.format)) { - case PixelFormat::BLOB: - dataspaceFlag = static_cast(Dataspace::V0_JFIF); - break; - case PixelFormat::Y16: - dataspaceFlag = static_cast(Dataspace::DEPTH); - break; - default: - dataspaceFlag = static_cast(Dataspace::UNKNOWN); - } + V3_2::DataspaceFlags dataspaceFlag = getDataspace(static_cast(it.format)); stream3_2 = {streamId, StreamType::OUTPUT, static_cast(it.width), @@ -3352,17 +3343,8 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) { size_t j = 0; for (const auto& it : outputStreams) { V3_2::Stream stream3_2; - V3_2::DataspaceFlags dataspaceFlag = 0; - switch (static_cast(it.format)) { - case PixelFormat::BLOB: - dataspaceFlag = static_cast(Dataspace::V0_JFIF); - break; - case PixelFormat::Y16: - dataspaceFlag = static_cast(Dataspace::DEPTH); - break; - default: - dataspaceFlag = static_cast(Dataspace::UNKNOWN); - } + V3_2::DataspaceFlags dataspaceFlag = getDataspace( + static_cast(it.format)); stream3_2 = {streamId++, StreamType::OUTPUT, static_cast(it.width), @@ -5907,6 +5889,23 @@ Status CameraHidlTest::getSystemCameraKind(const camera_metadata_t* staticMeta, return ret; } +// Select an appropriate dataspace given a specific pixel format. +V3_2::DataspaceFlags CameraHidlTest::getDataspace(PixelFormat format) { + switch (format) { + case PixelFormat::BLOB: + return static_cast(Dataspace::V0_JFIF); + case PixelFormat::Y16: + return static_cast(Dataspace::DEPTH); + case PixelFormat::RAW16: + case PixelFormat::RAW_OPAQUE: + case PixelFormat::RAW10: + case PixelFormat::RAW12: + return static_cast(Dataspace::ARBITRARY); + default: + return static_cast(Dataspace::UNKNOWN); + } +} + // Check whether this is a monochrome camera using the static camera characteristics. Status CameraHidlTest::isMonochromeCamera(const camera_metadata_t *staticMeta) { Status ret = Status::METHOD_NOT_SUPPORTED; @@ -6281,17 +6280,8 @@ void CameraHidlTest::configureOfflineStillStream(const std::string &name, ASSERT_EQ(Status::OK, rc); ASSERT_FALSE(outputStreams.empty()); - V3_2::DataspaceFlags dataspaceFlag = 0; - switch (static_cast(outputStreams[idx].format)) { - case PixelFormat::BLOB: - dataspaceFlag = static_cast(Dataspace::V0_JFIF); - break; - case PixelFormat::Y16: - dataspaceFlag = static_cast(Dataspace::DEPTH); - break; - default: - dataspaceFlag = static_cast(Dataspace::UNKNOWN); - } + V3_2::DataspaceFlags dataspaceFlag = getDataspace( + static_cast(outputStreams[idx].format)); ::android::hardware::hidl_vec streams3_4(/*size*/1); V3_4::Stream stream3_4 = {{ 0 /*streamId*/, StreamType::OUTPUT,