Corrects color format requirements am: bfbbba6300 am: 217a6ff310 am: 5f7a17c115 am: 2518cc9623

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2182380

Change-Id: I375d7cfd31c86ca9854590e9b57645f46c41886e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Changyeon Jo 2022-08-16 13:27:38 +00:00 committed by Automerger Merge Worker
commit 54c5c20d34

View file

@ -96,6 +96,14 @@ typedef struct {
} RawStreamConfig;
constexpr const size_t kStreamCfgSz = sizeof(RawStreamConfig) / sizeof(int32_t);
const std::unordered_set<int32_t> gSupportedColorFormats ({
HAL_PIXEL_FORMAT_RGBA_8888,
HAL_PIXEL_FORMAT_BGRA_8888,
HAL_PIXEL_FORMAT_YCRCB_420_SP, // NV21
HAL_PIXEL_FORMAT_YV12, // YV12
HAL_PIXEL_FORMAT_YCBCR_422_I // YUY2
});
} // anonymous namespace
@ -251,7 +259,7 @@ protected:
RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
isSupportedColorFormat(ptr->format)) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
@ -264,6 +272,10 @@ protected:
return targetCfg;
}
bool isSupportedColorFormat(int32_t format) {
return gSupportedColorFormats.find(format) != gSupportedColorFormats.end();
}
sp<IEvsEnumerator> pEnumerator; // Every test needs access to the service
std::vector<CameraDesc> cameraInfo; // Empty unless/until loadCameraList() is called
bool mIsHwModule; // boolean to tell current module under testing
@ -2018,12 +2030,13 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
isSupportedColorFormat(ptr->format)) {
if (ptr->width * ptr->height > maxArea &&
ptr->framerate >= minReqFps) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
maxArea = ptr->width * ptr->height;
foundCfg = true;
@ -2032,8 +2045,6 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
++ptr;
}
}
targetCfg.format =
static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
// Current EVS camera does not provide stream configurations in the
@ -2121,12 +2132,13 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
isSupportedColorFormat(ptr->format)) {
if (ptr->width * ptr->height > maxArea &&
ptr->framerate >= minReqFps) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
maxArea = ptr->width * ptr->height;
foundCfg = true;
@ -2135,8 +2147,6 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
++ptr;
}
}
targetCfg.format =
static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
LOG(INFO) << "Device " << cam.v1.cameraId