mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Corrects color format requirements
EVS HAL implementations are expected to support any of following color formats: - RGBA 8888 - BGRA 8888 - NV21 - YV12 - Or, YUY2 Bug: 240685726 Test: atest VtsHalEvsV1_1TargetTest Change-Id: I9fbbf1d29e52b24d8a53854faa58ac578094b305
This commit is contained in:
@@ -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
|
||||
@@ -2017,12 +2029,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;
|
||||
@@ -2031,8 +2044,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
|
||||
@@ -2120,12 +2131,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;
|
||||
@@ -2134,8 +2146,6 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
targetCfg.format =
|
||||
static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
|
||||
|
||||
if (!foundCfg) {
|
||||
LOG(INFO) << "Device " << cam.v1.cameraId
|
||||
|
||||
Reference in New Issue
Block a user