Camera VTS: Properly initialize Stream in various places

useCase and colorSpace are not explicitly initialized. colorSpace must
be explicitly initialized to UNSPECIFIED, as its default value is not
zero. Without initialization, the HAL will receive incorrect Stream
data.

Bug: 287305593
Test: Ran full VTS test on Cuttlefish / OEM testing.
Change-Id: I6a29600b5dc06ebdc61b38e0585204fe52d590c2
This commit is contained in:
Austin Borger 2023-06-15 11:32:04 -07:00
parent 8b39328dcc
commit 263e362091
3 changed files with 82 additions and 65 deletions

View file

@ -551,6 +551,11 @@ TEST_P(CameraAidlTest, configureStreamsAvailableOutputs) {
stream.rotation = StreamRotation::ROTATION_0;
stream.dynamicRangeProfile = RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
stream.useCase = ScalerAvailableStreamUseCases::
ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT;
stream.colorSpace = static_cast<int>(
RequestAvailableColorSpaceProfilesMap::
ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED);
std::vector<Stream> streams = {stream};
StreamConfiguration config;

View file

@ -45,8 +45,6 @@ using ::aidl::android::hardware::camera::common::TorchModeStatus;
using ::aidl::android::hardware::camera::device::CameraMetadata;
using ::aidl::android::hardware::camera::device::ICameraDevice;
using ::aidl::android::hardware::camera::metadata::CameraMetadataTag;
using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap;
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
using ::aidl::android::hardware::camera::metadata::SensorInfoColorFilterArrangement;
using ::aidl::android::hardware::camera::metadata::SensorPixelMode;
using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback;
@ -2237,21 +2235,26 @@ void CameraAidlTest::configureStreamUseCaseInternal(const AvailableStream &thres
}
std::vector<Stream> streams(1);
streams[0] = {0,
StreamType::OUTPUT,
outputPreviewStreams[0].width,
outputPreviewStreams[0].height,
static_cast<PixelFormat>(outputPreviewStreams[0].format),
static_cast<::aidl::android::hardware::graphics::common::BufferUsage>(
GRALLOC1_CONSUMER_USAGE_CPU_READ),
Dataspace::UNKNOWN,
StreamRotation::ROTATION_0,
std::string(),
0,
-1,
{SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
streams[0] = {
0,
StreamType::OUTPUT,
outputPreviewStreams[0].width,
outputPreviewStreams[0].height,
static_cast<PixelFormat>(outputPreviewStreams[0].format),
static_cast<::aidl::android::hardware::graphics::common::BufferUsage>(
GRALLOC1_CONSUMER_USAGE_CPU_READ),
Dataspace::UNKNOWN,
StreamRotation::ROTATION_0,
std::string(),
0,
-1,
{SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
static_cast<int>(
RequestAvailableColorSpaceProfilesMap::
ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};
int32_t streamConfigCounter = 0;
CameraMetadata req;
@ -2395,7 +2398,11 @@ void CameraAidlTest::configureSingleStream(
/*groupId*/ -1,
{SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
static_cast<int>(
RequestAvailableColorSpaceProfilesMap::
ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};
StreamConfiguration config;
config.streams = streams;
@ -2726,21 +2733,26 @@ void CameraAidlTest::configurePreviewStreams(
std::vector<Stream> streams(physicalIds.size());
int32_t streamId = 0;
for (auto const& physicalId : physicalIds) {
streams[streamId] = {streamId,
StreamType::OUTPUT,
outputPreviewStreams[0].width,
outputPreviewStreams[0].height,
static_cast<PixelFormat>(outputPreviewStreams[0].format),
static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER),
Dataspace::UNKNOWN,
StreamRotation::ROTATION_0,
physicalId,
0,
-1,
{SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
streams[streamId] = {
streamId,
StreamType::OUTPUT,
outputPreviewStreams[0].width,
outputPreviewStreams[0].height,
static_cast<PixelFormat>(outputPreviewStreams[0].format),
static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER),
Dataspace::UNKNOWN,
StreamRotation::ROTATION_0,
physicalId,
0,
-1,
{SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
static_cast<int>(
RequestAvailableColorSpaceProfilesMap::
ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};
streamId++;
}
@ -2799,7 +2811,8 @@ void CameraAidlTest::configureStreams(const std::string& name,
bool* supportsPartialResults, int32_t* partialResultCount,
bool* useHalBufManager, std::shared_ptr<DeviceCb>* outCb,
uint32_t streamConfigCounter, bool maxResolution,
RequestAvailableDynamicRangeProfilesMap prof) {
RequestAvailableDynamicRangeProfilesMap dynamicRangeProf,
RequestAvailableColorSpaceProfilesMap colorSpaceProf) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, halStreams);
ASSERT_NE(nullptr, previewStream);
@ -2881,7 +2894,9 @@ void CameraAidlTest::configureStreams(const std::string& name,
-1,
{maxResolution ? SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION
: SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
prof};
dynamicRangeProf,
ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
static_cast<int>(colorSpaceProf)};
StreamConfiguration config;
config.streams = streams;
@ -3332,7 +3347,11 @@ void CameraAidlTest::configureOfflineStillStream(
/*groupId*/ 0,
{SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
ScalerAvailableStreamUseCases::ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
static_cast<int>(
RequestAvailableColorSpaceProfilesMap::
ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED)};
StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE, CameraMetadata()};
@ -3447,15 +3466,12 @@ void CameraAidlTest::processColorSpaceRequest(
Stream previewStream;
std::shared_ptr<DeviceCb> cb;
previewStream.usage =
static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER);
previewStream.dataSpace = getDataspace(PixelFormat::IMPLEMENTATION_DEFINED);
previewStream.colorSpace = static_cast<int32_t>(colorSpace);
previewStream.usage = static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER);
configureStreams(name, mProvider, PixelFormat::IMPLEMENTATION_DEFINED, &mSession,
&previewStream, &halStreams, &supportsPartialResults,
&partialResultCount, &useHalBufManager, &cb, 0,
/*maxResolution*/ false, dynamicRangeProfile);
&previewStream, &halStreams, &supportsPartialResults, &partialResultCount,
&useHalBufManager, &cb, 0,
/*maxResolution*/ false, dynamicRangeProfile, colorSpace);
ASSERT_NE(mSession, nullptr);
::aidl::android::hardware::common::fmq::MQDescriptor<

View file

@ -77,6 +77,9 @@ using ::aidl::android::hardware::camera::device::StreamBuffer;
using ::aidl::android::hardware::camera::device::StreamBufferRet;
using ::aidl::android::hardware::camera::device::StreamConfiguration;
using ::aidl::android::hardware::camera::device::StreamConfigurationMode;
using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap;
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
using ::aidl::android::hardware::camera::metadata::ScalerAvailableStreamUseCases;
using ::aidl::android::hardware::camera::provider::ConcurrentCameraIdCombination;
using ::aidl::android::hardware::camera::provider::ICameraProvider;
@ -205,10 +208,12 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
bool* supportsPartialResults /*out*/, int32_t* partialResultCount /*out*/,
bool* useHalBufManager /*out*/, std::shared_ptr<DeviceCb>* outCb /*out*/,
uint32_t streamConfigCounter, bool maxResolution,
aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap
prof = ::aidl::android::hardware::camera::metadata::
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD);
RequestAvailableDynamicRangeProfilesMap dynamicRangeProf =
RequestAvailableDynamicRangeProfilesMap::
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
RequestAvailableColorSpaceProfilesMap colorSpaceProf =
RequestAvailableColorSpaceProfilesMap::
ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED);
void configurePreviewStreams(
const std::string& name, const std::shared_ptr<ICameraProvider>& provider,
@ -376,8 +381,7 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
static void get10BitDynamicRangeProfiles(
const camera_metadata_t* staticMeta,
std::vector<aidl::android::hardware::camera::metadata::
RequestAvailableDynamicRangeProfilesMap>* profiles);
std::vector<RequestAvailableDynamicRangeProfilesMap>* profiles);
static bool reportsColorSpaces(const camera_metadata_t* staticMeta);
@ -387,17 +391,13 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
RequestAvailableColorSpaceProfilesMap>* profiles);
static bool isColorSpaceCompatibleWithDynamicRangeAndPixelFormat(
const camera_metadata_t* staticMeta,
aidl::android::hardware::camera::metadata::
RequestAvailableColorSpaceProfilesMap colorSpace,
aidl::android::hardware::camera::metadata::
const camera_metadata_t* staticMeta, RequestAvailableColorSpaceProfilesMap colorSpace,
RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile,
aidl::android::hardware::graphics::common::PixelFormat pixelFormat);
static const char* getColorSpaceProfileString(aidl::android::hardware::camera::metadata::
RequestAvailableColorSpaceProfilesMap colorSpace);
static const char* getColorSpaceProfileString(RequestAvailableColorSpaceProfilesMap colorSpace);
static const char* getDynamicRangeProfileString(aidl::android::hardware::camera::metadata::
static const char* getDynamicRangeProfileString(
RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile);
static int32_t halFormatToPublicFormat(
@ -408,10 +408,8 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
static Size getMinSize(Size a, Size b);
void processColorSpaceRequest(aidl::android::hardware::camera::metadata::
RequestAvailableColorSpaceProfilesMap colorSpace,
aidl::android::hardware::camera::metadata::
RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile);
void processColorSpaceRequest(RequestAvailableColorSpaceProfilesMap colorSpace,
RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile);
void processZoomSettingsOverrideRequests(
int32_t frameCount, const bool *overrideSequence, const bool *expectedResults);
@ -571,10 +569,8 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
static bool matchDeviceName(const std::string& deviceName, const std::string& providerType,
std::string* deviceVersion, std::string* cameraId);
static void verify10BitMetadata(
HandleImporter& importer, const InFlightRequest& request,
aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap
profile);
static void verify10BitMetadata(HandleImporter& importer, const InFlightRequest& request,
RequestAvailableDynamicRangeProfilesMap profile);
static void waitForReleaseFence(
std::vector<InFlightRequest::StreamBufferAndTimestamp>& resultOutputBuffers);