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
This commit is contained in:
Emilian Peev 2021-02-03 10:03:02 -08:00
parent 6f19ba03b3
commit 8558454a67

View file

@ -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<PixelFormat>(it.format)) {
case PixelFormat::BLOB:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
break;
case PixelFormat::Y16:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
break;
default:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
}
V3_2::DataspaceFlags dataspaceFlag = getDataspace(static_cast<PixelFormat>(it.format));
stream3_2 = {streamId,
StreamType::OUTPUT,
static_cast<uint32_t>(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<PixelFormat>(it.format)) {
case PixelFormat::BLOB:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
break;
case PixelFormat::Y16:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
break;
default:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
}
V3_2::DataspaceFlags dataspaceFlag = getDataspace(
static_cast<PixelFormat>(it.format));
stream3_2 = {streamId++,
StreamType::OUTPUT,
static_cast<uint32_t>(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<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
case PixelFormat::Y16:
return static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
case PixelFormat::RAW16:
case PixelFormat::RAW_OPAQUE:
case PixelFormat::RAW10:
case PixelFormat::RAW12:
return static_cast<V3_2::DataspaceFlags>(Dataspace::ARBITRARY);
default:
return static_cast<V3_2::DataspaceFlags>(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<PixelFormat>(outputStreams[idx].format)) {
case PixelFormat::BLOB:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
break;
case PixelFormat::Y16:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
break;
default:
dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
}
V3_2::DataspaceFlags dataspaceFlag = getDataspace(
static_cast<PixelFormat>(outputStreams[idx].format));
::android::hardware::hidl_vec<V3_4::Stream> streams3_4(/*size*/1);
V3_4::Stream stream3_4 = {{ 0 /*streamId*/, StreamType::OUTPUT,