diff --git a/modules/memory/chrome/Camera3Buffer.cpp b/modules/memory/chrome/Camera3Buffer.cpp index a221ab4..39648be 100644 --- a/modules/memory/chrome/Camera3Buffer.cpp +++ b/modules/memory/chrome/Camera3Buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2024 Intel Corporation + * Copyright (C) 2013-2025 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -415,7 +415,7 @@ void Camera3Buffer::dumpImage(const void* data, int frameNumber, const int size, static unsigned int count = 0; count++; - std::string fileName(gDumpPath); + std::string fileName(CameraDump::getDumpPath()); fileName += "dump_" + std::to_string(width) + "x" + std::to_string(height) + "_frame#" + std::to_string(count) + "_req#" + std::to_string(frameNumber); diff --git a/src/3a/SensorManager.cpp b/src/3a/SensorManager.cpp index 2eb27a5..a683658 100644 --- a/src/3a/SensorManager.cpp +++ b/src/3a/SensorManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2024 Intel Corporation. + * Copyright (C) 2015-2025 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -195,8 +195,14 @@ int SensorManager::getCurrentExposureAppliedDelay() { uint32_t SensorManager::updateSensorExposure(SensorExpGroup sensorExposures, int64_t applyingSeq) { AutoMutex l(mLock); - int64_t effectSeq = mLastSofSequence < 0 ? 0 - : mLastSofSequence + PlatformData::getExposureLag(mCameraId); + int64_t effectSeq = 0; + if (PlatformData::isWaitFirstStats(mCameraId)) { + effectSeq = mLastSofSequence < 0 ? 0 + : mLastSofSequence + PlatformData::getExposureLag(mCameraId); + } else { + effectSeq = mLastSofSequence < 0 ? PlatformData::getExposureLag(mCameraId) + : mLastSofSequence + PlatformData::getExposureLag(mCameraId); + } if (sensorExposures.empty()) { LOGW("%s: No exposure parameter", __func__); diff --git a/src/core/DeviceBase.cpp b/src/core/DeviceBase.cpp index 2869595..b41a0fc 100644 --- a/src/core/DeviceBase.cpp +++ b/src/core/DeviceBase.cpp @@ -305,8 +305,9 @@ MainDevice::MainDevice(int cameraId, VideoNodeType nodeType, DeviceCallback* dev MainDevice::~MainDevice() {} int MainDevice::createBufferPool(const stream_t& config) { - LOG1("%s, fmt:%s(%dx%d) field:%d", mCameraId, __func__, - CameraUtils::pixelCode2String(config.format), config.width, config.height, config.field); + LOG1("%s, fmt:%s(%dx%d) field:%d, mBufType:%d", mCameraId, __func__, + CameraUtils::pixelCode2String(config.format), config.width, config.height, config.field, + mBufType); // Pass down ISYS compression flag to driver, which is CSI-BE output compression bool isISYSCompression = PlatformData::getISYSCompression(mCameraId); @@ -322,10 +323,10 @@ int MainDevice::createBufferPool(const stream_t& config) { csiBEDeviceNodeName.c_str(), ret); } - struct v4l2_format v4l2fmt; + struct v4l2_format v4l2fmt = {}; v4l2fmt.fmt.pix_mp.field = config.field; - if (PlatformData::isCSIFrontEndCapture(mCameraId)) { + if (V4L2_TYPE_IS_MULTIPLANAR(mBufType)) { int planesNum = CameraUtils::getNumOfPlanes(config.format); LOG1("@%s Num of planes: %d, mCameraId:%d", __func__, planesNum, mCameraId); diff --git a/src/core/RequestThread.cpp b/src/core/RequestThread.cpp index 2de5834..08d275b 100644 --- a/src/core/RequestThread.cpp +++ b/src/core/RequestThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2024 Intel Corporation. + * Copyright (C) 2015-2025 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ RequestThread::RequestThread(int cameraId, AiqUnitBase* a3AControl, ParameterGen mLastEffectSeq(-1), mLastAppliedSeq(-1), mLastSofSeq(-1), - mBlockRequest(true), + mBlockRequest(PlatformData::isWaitFirstStats(cameraId)), mSofEnabled(false), mWaitFrameDurationOverride(0) { CLEAR(mFakeReqBuf); @@ -89,7 +89,7 @@ void RequestThread::clearRequests() { mLastAppliedSeq = -1; mLastSofSeq = -1; mFirstRequest = true; - mBlockRequest = true; + mBlockRequest = PlatformData::isWaitFirstStats(mCameraId); } int RequestThread::configure(const stream_config_t* streamList) { @@ -106,6 +106,12 @@ int RequestThread::configure(const stream_config_t* streamList) { // Don't block request handling if no 3A stats (from video pipe) mBlockRequest = PlatformData::isEnableAIQ(mCameraId) && (previewIndex >= 0 || videoIndex >= 0); + + if (!PlatformData::isWaitFirstStats(mCameraId)) { + // Don't block request processing on Android for CTS testSharedSurfaceSwitch + mBlockRequest = false; + } + LOG1("%s: user specified Configmode: %d, blockRequest: %d", __func__, static_cast(streamList->operation_mode), mBlockRequest); diff --git a/src/iutils/CameraDump.cpp b/src/iutils/CameraDump.cpp index 612890d..c7bba84 100644 --- a/src/iutils/CameraDump.cpp +++ b/src/iutils/CameraDump.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 Intel Corporation. + * Copyright (C) 2015-2025 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,9 @@ #include "iutils/CameraDump.h" +#ifdef HAVE_ANDROID_OS +#include +#endif #include #include #include @@ -45,14 +48,20 @@ using std::string; namespace icamera { Thread* gDumpThread = nullptr; - +#ifdef HAVE_ANDROID_OS +static const char* defaultDumpPath = "/data/camera"; +constexpr char DUMP_LEVEL_PROPERTY_NAME[] = "vendor.camera.intel.dump_level_mask"; +constexpr char DUMP_PATH_PROPERTY_NAME[] = "vendor.camera.intel.dump_path"; +bool gDumpPathSet = false; +bool gDumpLevelSet = false; +#endif int gDumpType = 0; int gDumpFormat = 0; uint32_t gDumpSkipNum = 0; uint32_t gDumpRangeMin = 0; uint32_t gDumpRangeMax = 0; int gDumpFrequency = 1; -char gDumpPath[50]; +char gDumpPath[100]; bool gDumpRangeEnabled = false; int gDumpPatternEnabled = 0; uint32_t gDumpPattern = 0xffffffff; @@ -198,6 +207,12 @@ void CameraDump::setDumpThread(void) { } bool CameraDump::isDumpTypeEnable(int dumpType) { +#ifdef HAVE_ANDROID_OS + if (!gDumpLevelSet) { + gDumpLevelSet = true; + gDumpType = property_get_int32(DUMP_LEVEL_PROPERTY_NAME, 0); + } +#endif return gDumpType & dumpType; } @@ -206,6 +221,12 @@ bool CameraDump::isDumpFormatEnable(int dumpFormat) { } const char* CameraDump::getDumpPath(void) { +#ifdef HAVE_ANDROID_OS + if (!gDumpPathSet) { + gDumpPathSet = true; + property_get(DUMP_PATH_PROPERTY_NAME, gDumpPath, defaultDumpPath); + } +#endif return gDumpPath; } @@ -250,6 +271,10 @@ static string getNamePrefix(int cameraId, ModuleType_t type, Port port, int sUsa static string getAiqSettingAppendix(int cameraId, int64_t sequence) { char settingAppendix[MAX_NAME_LEN] = {'\0'}; + if (!PlatformData::isEnableAIQ(cameraId)) { + return string(settingAppendix); + } + AiqResult* aiqResults = const_cast(AiqResultStorage::getInstance(cameraId)->getAiqResult(sequence)); if (aiqResults == nullptr) { diff --git a/src/iutils/CameraDump.h b/src/iutils/CameraDump.h index bf608c6..ebeccc0 100644 --- a/src/iutils/CameraDump.h +++ b/src/iutils/CameraDump.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 Intel Corporation. + * Copyright (C) 2015-2025 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,14 +28,6 @@ namespace icamera { -/** - * global dump level - * This global variable is set from system properties - * It is used to control the type of frame dump - */ -extern int gDumpType; -extern char gDumpPath[50]; - // Dump bit mask definition enum { // IPU Buffer dump (bit[0-3]), export cameraDump=0xf diff --git a/src/platformdata/CameraParser.cpp b/src/platformdata/CameraParser.cpp index 639fbb9..0c9395e 100644 --- a/src/platformdata/CameraParser.cpp +++ b/src/platformdata/CameraParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2024 Intel Corporation + * Copyright (C) 2015-2025 Intel Corporation * Copyright 2008-2017, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -599,6 +599,8 @@ void CameraParser::handleSensor(CameraParser* profiles, const char* name, const parseSupportedTuningConfig(atts[1], pCurrentCam->mSupportedTuningConfig); } else if (strcmp(name, "enableAiqd") == 0) { pCurrentCam->mEnableAiqd = strcmp(atts[1], "true") == 0; + } else if (strcmp(name, "isWaitFirstStats") == 0) { + pCurrentCam->mWaitFirstStats = strcmp(atts[1], "true") == 0; } else if (strcmp(name, "testPatternMap") == 0) { int size = strlen(atts[1]); char src[size + 1]; diff --git a/src/platformdata/PlatformData.cpp b/src/platformdata/PlatformData.cpp index 365cd14..06f786b 100644 --- a/src/platformdata/PlatformData.cpp +++ b/src/platformdata/PlatformData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2024 Intel Corporation. + * Copyright (C) 2015-2025 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1097,6 +1097,10 @@ bool PlatformData::isAiqdEnabled(int cameraId) { return getInstance()->mStaticCfg.mCameras[cameraId].mEnableAiqd; } +bool PlatformData::isWaitFirstStats(int cameraId) { + return getInstance()->mStaticCfg.mCameras[cameraId].mWaitFirstStats; +} + int PlatformData::getFormatByDevName(int cameraId, const string& devName, McFormat& format) { MediaCtlConf* mc = getMediaCtlConf(cameraId); CheckAndLogError(!mc, BAD_VALUE, "getMediaCtlConf returns nullptr, cameraId:%d", cameraId); diff --git a/src/platformdata/PlatformData.h b/src/platformdata/PlatformData.h index d5429b1..282198a 100644 --- a/src/platformdata/PlatformData.h +++ b/src/platformdata/PlatformData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2024 Intel Corporation. + * Copyright (C) 2015-2025 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -182,6 +182,7 @@ class PlatformData { mFrameSyncCheckEnabled(false), // FRAME_SYNC_E mEnableAiqd(false), + mWaitFirstStats(true), mCurrentMcConf(nullptr), mGraphSettingsType(COUPLED), mDVSType(MORPH_TABLE), @@ -301,6 +302,7 @@ class PlatformData { bool mFrameSyncCheckEnabled; // FRAME_SYNC_E bool mEnableAiqd; + bool mWaitFirstStats; MediaCtlConf* mCurrentMcConf; std::map mStreamToMcMap; Parameters mCapability; @@ -1434,6 +1436,14 @@ class PlatformData { */ static bool isAiqdEnabled(int cameraId); + /** + * if wait for the first stats + * + * \param cameraId: [0, MAX_CAMERA_NUMBER - 1] + * \return true if wait for the first stats + */ + static bool isWaitFirstStats(int cameraId); + /** * if image from tpg *