From a0d34dcdb87ad0582bd455b8bd942db123125122 Mon Sep 17 00:00:00 2001 From: zouxiaoh Date: Mon, 17 Apr 2023 15:32:12 +0800 Subject: [PATCH] iotg rpl mr1 release Signed-off-by: zouxiaoh --- include/api/ICamera.h | 8 +- modules/algowrapper/IntelTNR7US.cpp | 3 +- src/3a/AiqUnit.cpp | 4 +- src/3a/Dvs.cpp | 122 ++++++------- src/core/CameraDevice.cpp | 9 +- src/core/IspParamAdaptor.cpp | 11 +- src/core/LensHw.cpp | 21 ++- src/core/LensHw.h | 5 +- src/core/RequestThread.cpp | 8 +- src/core/psysprocessor/PolicyManager.cpp | 5 +- src/hal/CameraHal.cpp | 42 +---- src/hal/CameraHal.h | 6 +- src/hal/ICamera.cpp | 16 +- src/hal/MockCameraHal.cpp | 4 - src/hal/MockCameraHal.h | 4 - src/image_process/PostProcessorBase.cpp | 5 +- src/iutils/ModuleTags.cpp | 3 + src/iutils/ModuleTags.h | 217 ++++++++++++----------- src/metadata/ParameterGenerator.cpp | 2 + src/v4l2/V4l2DeviceFactory.cpp | 25 ++- src/v4l2/V4l2DeviceFactory.h | 3 +- 21 files changed, 251 insertions(+), 272 deletions(-) diff --git a/include/api/ICamera.h b/include/api/ICamera.h index 105b585b..c95b0955 100644 --- a/include/api/ICamera.h +++ b/include/api/ICamera.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2020 Intel Corporation. + * Copyright (C) 2015-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,6 +68,8 @@ * Version 0.61 Add API camera_callback_register() to notify event to AAL ******************************************************************************* * Version 0.62 Add sequence in camera_get_parameters to fetch settings + ******************************************************************************* + * Version 0.63 Merge camera_device_open API with/without vc_num together * ------------------------------------------------------------------------------ * */ @@ -231,11 +233,7 @@ void camera_callback_register(int camera_id, const camera_callback_ops_t* callba * int ret = camera_device_open(camera_id); * \endcode **/ -#ifdef NO_VIRTUAL_CHANNEL -int camera_device_open(int camera_id); -#else int camera_device_open(int camera_id, int vc_num = 0); -#endif /** * \brief diff --git a/modules/algowrapper/IntelTNR7US.cpp b/modules/algowrapper/IntelTNR7US.cpp index 79a2c583..7dc331fb 100644 --- a/modules/algowrapper/IntelTNR7US.cpp +++ b/modules/algowrapper/IntelTNR7US.cpp @@ -145,7 +145,8 @@ int IntelTNR7US::asyncParamUpdate(int gain, bool forceUpdate) { if (mThread->task_runner()) { mThread->task_runner()->PostTask( FROM_HERE, - base::Bind(&IntelTNR7US::handleParamUpdate, base::Unretained(this), gain, forceUpdate)); + base::BindOnce(&IntelTNR7US::handleParamUpdate, + base::Unretained(this), gain, forceUpdate)); } return OK; } diff --git a/src/3a/AiqUnit.cpp b/src/3a/AiqUnit.cpp index 6192f0a1..175add6f 100644 --- a/src/3a/AiqUnit.cpp +++ b/src/3a/AiqUnit.cpp @@ -256,9 +256,9 @@ int AiqUnit::initIntelCcaHandle(const std::vector& configModes) { if (graphConfig != nullptr) { graphConfig->graphGetStreamIds(streamIds); } - params.dvs_ids.count = streamIds.size(); + params.gdcConfigs.count = streamIds.size(); for (size_t i = 0; i < streamIds.size(); ++i) { - params.dvs_ids.ids[i] = streamIds[i]; + params.gdcConfigs.ids[i] = streamIds[i]; } ret = mDvs->configure(cfg, ¶ms); CheckAndLogError(ret != OK, UNKNOWN_ERROR, "%s, configure DVS error", __func__); diff --git a/src/3a/Dvs.cpp b/src/3a/Dvs.cpp index 5ba75db6..82b119d1 100644 --- a/src/3a/Dvs.cpp +++ b/src/3a/Dvs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2022 Intel Corporation. + * Copyright (C) 2017-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,8 +47,8 @@ int Dvs::configure(const ConfigMode configMode, cca::cca_init_params* params) { CheckAndLogError(!params, BAD_VALUE, "params is nullptr"); LOG2("@%s", __func__); - for (uint8_t i = 0; i < params->dvs_ids.count; i++) { - int ret = configCcaDvsData(params->dvs_ids.ids[i], configMode, params); + for (uint8_t i = 0; i < params->gdcConfigs.count; i++) { + auto ret = configCcaDvsData(params->gdcConfigs.ids[i], configMode, params); CheckAndLogError(ret != OK, UNKNOWN_ERROR, "%s, configure DVS data error", __func__); } @@ -58,6 +58,7 @@ int Dvs::configure(const ConfigMode configMode, cca::cca_init_params* params) { } mTuningMode = tuningMode; + dumpDvsConfiguration(*params); return OK; } @@ -82,7 +83,16 @@ int Dvs::configCcaDvsData(int32_t streamId, const ConfigMode configMode, resolution.input_width, resolution.input_height, resolution.output_width, resolution.output_height); - cca::cca_gdc_configuration* gdcConfig = ¶ms->gdcConfig; + cca::cca_gdc_configuration* gdcConfig = nullptr; + for (size_t i = 0; i < params->gdcConfigs.count; ++i) { + if (params->gdcConfigs.ids[i] == static_cast(streamId)) { + gdcConfig = ¶ms->gdcConfigs.configs[i]; + } + } + + CheckAndLogError(gdcConfig == nullptr, UNKNOWN_ERROR, + "%s, Cannot find correspond DVS GDC Config!", __func__); + CLEAR(*gdcConfig); gdcConfig->gdc_filter_width = DVS_MIN_ENVELOPE / 2; gdcConfig->gdc_filter_height = DVS_MIN_ENVELOPE / 2; @@ -151,7 +161,6 @@ int Dvs::configCcaDvsData(int32_t streamId, const ConfigMode configMode, mZoomParamMap[streamId] = zoomParam; } - dumpDvsConfiguration(*params); return OK; } @@ -215,36 +224,7 @@ void Dvs::handleEvent(EventData eventData) { if (!ptzRegion.left && !ptzRegion.top && !ptzRegion.right && !ptzRegion.bottom) { zp.zoom_region = {gdcRegion.left, gdcRegion.top, gdcRegion.right, gdcRegion.bottom}; } else { - /* - SCALER_CROP_REGION can adjust to a small crop region if the aspect of active - pixel array is not same as the crop region aspect. Crop can only on either - horizontally or veritacl but never both. - If active pixel array's aspect ratio is wider than the crop region, the region - should be further cropped vertically. - */ - auto coord = PlatformData::getActivePixelArray(mCameraId); - int wpa = coord.right - coord.left; - int hpa = coord.bottom - coord.top; - - int width = ptzRegion.right - ptzRegion.left; - int height = ptzRegion.bottom - ptzRegion.top; - - float aspect0 = static_cast(wpa) / hpa; - float aspect1 = static_cast(width) / height; - - if (std::fabs(aspect0 - aspect1) < 0.00001) { - zp.zoom_region = {ptzRegion.left, ptzRegion.top, ptzRegion.right, ptzRegion.bottom}; - } else if (aspect0 > aspect1) { - auto croppedHeight = width / aspect0; - int diff = std::abs(height - croppedHeight) / 2; - zp.zoom_region = {ptzRegion.left, ptzRegion.top + diff, ptzRegion.right, - ptzRegion.bottom - diff}; - } else { - auto croppedWidth = height * aspect0; - int diff = std::abs(width - croppedWidth) / 2; - zp.zoom_region = {ptzRegion.left + diff, ptzRegion.top, ptzRegion.right - diff, - ptzRegion.bottom}; - } + zp.zoom_region = {ptzRegion.left, ptzRegion.top, ptzRegion.right, ptzRegion.bottom}; } intelCcaHandle->updateZoom(streamId, zp); @@ -257,39 +237,45 @@ void Dvs::handleEvent(EventData eventData) { void Dvs::dumpDvsConfiguration(const cca::cca_init_params& config) { if (!Log::isLogTagEnabled(GET_FILE_SHIFT(Dvs), CAMERA_DEBUG_LOG_LEVEL3)) return; - LOG3("config.dvsOutputType %d", config.dvsOutputType); - LOG3("config.enableVideoStablization %d", config.enableVideoStablization); - LOG3("config.dvsZoomRatio %f", config.dvsZoomRatio); - LOG3("config.gdcConfig.pre_gdc_top_padding %d", config.gdcConfig.pre_gdc_top_padding); - LOG3("config.gdcConfig.pre_gdc_bottom_padding %d", config.gdcConfig.pre_gdc_bottom_padding); - LOG3("config.gdcConfig.gdc_filter_width %d", config.gdcConfig.gdc_filter_width); - LOG3("config.gdcConfig.gdc_filter_height %d", config.gdcConfig.gdc_filter_height); - LOG3("config.gdcConfig.splitMetadata[0](oydim_uv) %d", config.gdcConfig.splitMetadata[0]); - LOG3("config.gdcConfig.splitMetadata[1](oxdim_uv) %d", config.gdcConfig.splitMetadata[1]); - LOG3("config.gdcConfig.splitMetadata[2](oydim_y) %d", config.gdcConfig.splitMetadata[2]); - LOG3("config.gdcConfig.splitMetadata[3](oxdim_y) %d", config.gdcConfig.splitMetadata[3]); - LOG3("config.gdcConfig.gdc_resolution_info.input_width %d, input_height %d", - config.gdcConfig.gdc_resolution_info.input_width, - config.gdcConfig.gdc_resolution_info.input_height); - LOG3("config.gdcConfig.gdc_resolution_info.output_width %d, output_height %d", - config.gdcConfig.gdc_resolution_info.output_width, - config.gdcConfig.gdc_resolution_info.output_height); - LOG3("config.gdcConfig.gdc_resolution_info.input_crop.left %d, top %d, right %d, bottom %d", - config.gdcConfig.gdc_resolution_info.input_crop.left, - config.gdcConfig.gdc_resolution_info.input_crop.top, - config.gdcConfig.gdc_resolution_info.input_crop.right, - config.gdcConfig.gdc_resolution_info.input_crop.bottom); - LOG3("config.gdcConfig.gdc_resolution_history.input_width %d, input_height %d", - config.gdcConfig.gdc_resolution_history.input_width, - config.gdcConfig.gdc_resolution_history.input_height); - LOG3("config.gdcConfig.gdc_resolution_history.output_width %d, output_height %d", - config.gdcConfig.gdc_resolution_history.output_width, - config.gdcConfig.gdc_resolution_history.output_height); - LOG3("config.gdcConfig.gdc_resolution_history.input_crop.left %d, top %d, right %d, bottom %d", - config.gdcConfig.gdc_resolution_history.input_crop.left, - config.gdcConfig.gdc_resolution_history.input_crop.top, - config.gdcConfig.gdc_resolution_history.input_crop.right, - config.gdcConfig.gdc_resolution_history.input_crop.bottom); + LOG3("config: config.dvsOutputType %d", config.dvsOutputType); + LOG3("config: config.enableVideoStablization %d", config.enableVideoStablization); + LOG3("config: config.dvsZoomRatio %f", config.dvsZoomRatio); + + for (size_t i = 0; i < config.gdcConfigs.count; ++i) { + LOG3("GDC Config for steeam: %d", config.gdcConfigs.ids[i]); + + auto gdcConfig = config.gdcConfigs.configs[i]; + LOG3("gdcConfig.pre_gdc_top_padding %d", gdcConfig.pre_gdc_top_padding); + LOG3("gdcConfig.pre_gdc_bottom_padding %d", gdcConfig.pre_gdc_bottom_padding); + LOG3("gdcConfig.gdc_filter_width %d", gdcConfig.gdc_filter_width); + LOG3("gdcConfig.gdc_filter_height %d", gdcConfig.gdc_filter_height); + LOG3("gdcConfig.splitMetadata[0](oydim_uv) %d", gdcConfig.splitMetadata[0]); + LOG3("gdcConfig.splitMetadata[1](oxdim_uv) %d", gdcConfig.splitMetadata[1]); + LOG3("gdcConfig.splitMetadata[2](oydim_y) %d", gdcConfig.splitMetadata[2]); + LOG3("gdcConfig.splitMetadata[3](oxdim_y) %d", gdcConfig.splitMetadata[3]); + LOG3("gdcConfig.gdc_resolution_info.input_width %d, input_height %d", + gdcConfig.gdc_resolution_info.input_width, + gdcConfig.gdc_resolution_info.input_height); + LOG3("gdcConfig.gdc_resolution_info.output_width %d, output_height %d", + gdcConfig.gdc_resolution_info.output_width, + gdcConfig.gdc_resolution_info.output_height); + LOG3("gdcConfig.gdc_resolution_info.input_crop.left %d, top %d, right %d, bottom %d", + gdcConfig.gdc_resolution_info.input_crop.left, + gdcConfig.gdc_resolution_info.input_crop.top, + gdcConfig.gdc_resolution_info.input_crop.right, + gdcConfig.gdc_resolution_info.input_crop.bottom); + LOG3("gdcConfig.gdc_resolution_history.input_width %d, input_height %d", + gdcConfig.gdc_resolution_history.input_width, + gdcConfig.gdc_resolution_history.input_height); + LOG3("gdcConfig.gdc_resolution_history.output_width %d, output_height %d", + gdcConfig.gdc_resolution_history.output_width, + gdcConfig.gdc_resolution_history.output_height); + LOG3("gdcConfig.gdc_resolution_history.input_crop.left %d, top %d, right %d, bottom %d", + gdcConfig.gdc_resolution_history.input_crop.left, + gdcConfig.gdc_resolution_history.input_crop.top, + gdcConfig.gdc_resolution_history.input_crop.right, + gdcConfig.gdc_resolution_history.input_crop.bottom); + } } } // namespace icamera diff --git a/src/core/CameraDevice.cpp b/src/core/CameraDevice.cpp index d0532ac8..96cc31db 100644 --- a/src/core/CameraDevice.cpp +++ b/src/core/CameraDevice.cpp @@ -135,9 +135,6 @@ int CameraDevice::init() { ret = m3AControl->init(); CheckAndLogError((ret != OK), ret, "%s: Init 3A Unit falied", __func__); - ret = mLensCtrl->init(); - CheckAndLogError((ret != OK), ret, "%s: Init Lens falied", __func__); - mRequestThread->run("RequestThread", PRIORITY_NORMAL); mState = DEVICE_INIT; @@ -753,6 +750,7 @@ int CameraDevice::stop() { mRequestThread->clearRequests(); m3AControl->stop(); + mLensCtrl->stop(); if (mState == DEVICE_START) stopLocked(); @@ -873,7 +871,10 @@ int CameraDevice::qbuf(camera_buffer_t** ubuffer, int bufferNum, const Parameter AutoMutex m(mDeviceLock); if (mState == DEVICE_CONFIGURE || mState == DEVICE_STOP) { // Start 3A here then the HAL can run 3A for request - int ret = m3AControl->start(); + int ret = mLensCtrl->start(); + CheckAndLogError((ret != OK), ret, "%s: Start Lens falied", __func__); + + ret = m3AControl->start(); CheckAndLogError((ret != OK), BAD_VALUE, "Start 3a unit failed with ret:%d.", ret); mState = DEVICE_BUFFER_READY; diff --git a/src/core/IspParamAdaptor.cpp b/src/core/IspParamAdaptor.cpp index 2d4fea2b..e68b8254 100644 --- a/src/core/IspParamAdaptor.cpp +++ b/src/core/IspParamAdaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2022 Intel Corporation. + * Copyright (C) 2015-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -250,8 +250,12 @@ int IspParamAdaptor::configure(const stream_t& stream, ConfigMode configMode, Tu // Use the tuning mode in graph to update the isp tuning data if (ispTuningIndex != -1) { uint8_t lardTag = cca::CCA_LARD_ISP; - ia_lard_input_params lardParam = {}; - lardParam.isp_mode_index = ispTuningIndex; + ia_lard_input_params lardParam = { + IA_MKN_CHTOUL('D', 'F', 'L', 'T'), + IA_MKN_CHTOUL('D', 'F', 'L', 'T'), + static_cast(ispTuningIndex), + IA_MKN_CHTOUL('D', 'F', 'L', 'T') + }; cca::cca_nvm tmpNvm = {}; ia_err iaErr = @@ -274,6 +278,7 @@ int IspParamAdaptor::configure(const stream_t& stream, ConfigMode configMode, Tu inputParams->seq_id = -1; initInputParams(inputParams); inputParams->stream_id = ispParamIt.first; + inputParams->dvs_id = inputParams->stream_id; ia_isp_bxt_program_group* pgPtr = mGraphConfig->getProgramGroup(ispParamIt.first); CheckAndLogError(!pgPtr, UNKNOWN_ERROR, diff --git a/src/core/LensHw.cpp b/src/core/LensHw.cpp index 7d21bedc..8943f96b 100644 --- a/src/core/LensHw.cpp +++ b/src/core/LensHw.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2021 Intel Corporation + * Copyright (C) 2016-2023 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,10 @@ #define LOG_TAG LensHw -#include "LensHw.h" +#include "src/core/LensHw.h" + +#include + #include "iutils/CameraLog.h" #include "V4l2DeviceFactory.h" #include "PlatformData.h" @@ -31,7 +34,7 @@ LensHw::LensHw(int cameraId) LensHw::~LensHw() {} -int LensHw::init() { +int LensHw::start() { std::string lensName = PlatformData::getLensName(mCameraId); if (lensName.empty()) { LOG1("@%s No HW Lens", mCameraId, __func__); @@ -51,6 +54,18 @@ int LensHw::init() { return OK; } +void LensHw::stop() { + if (!mLensSubdev) return; + + // close the lens sub device + std::string subDevName; + CameraUtils::getSubDeviceName(mLensName.c_str(), subDevName); + if (!subDevName.empty()) { + V4l2DeviceFactory::releaseSubDev(mCameraId, subDevName); + mLensSubdev = nullptr; + } +} + /** * focus with absolute value */ diff --git a/src/core/LensHw.h b/src/core/LensHw.h index eab0c166..b289b253 100644 --- a/src/core/LensHw.h +++ b/src/core/LensHw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2021 Intel Corporation + * Copyright (C) 2016-2023 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,8 @@ class LensHw { LensHw(int cameraId); ~LensHw(); - int init(); + int start(); + void stop(); const char* getLensName(void); diff --git a/src/core/RequestThread.cpp b/src/core/RequestThread.cpp index 5ffd4fde..0a52ac49 100644 --- a/src/core/RequestThread.cpp +++ b/src/core/RequestThread.cpp @@ -320,9 +320,11 @@ bool RequestThread::threadLoop() { if (blockRequest()) { int ret = mRequestSignal.waitRelative(lock, kWaitDuration * SLOWLY_MULTIPLIER); - CheckWarning(ret == TIMED_OUT, true, - "wait event time out, %d requests processing, %zu requests in HAL", - mRequestsInProcessing, mPendingRequests.size()); + if (ret == TIMED_OUT) { + LOG2("wait event time out, %d requests processing, %zu requests in HAL", + mRequestsInProcessing, mPendingRequests.size()); + return true; + } if (blockRequest()) { LOG2("Pending request processing, mBlockRequest %d, Req in processing %d", diff --git a/src/core/psysprocessor/PolicyManager.cpp b/src/core/psysprocessor/PolicyManager.cpp index 0b3f89b2..b87098a7 100644 --- a/src/core/psysprocessor/PolicyManager.cpp +++ b/src/core/psysprocessor/PolicyManager.cpp @@ -149,7 +149,10 @@ int PolicyManager::wait(std::string executorName, int64_t sequence) { LOG2("%s: need wait for other executors.", executorName.c_str()); const int64_t kWaitDuration = 66000000; // 66ms int ret = bundle->mCondition.waitRelative(lock, kWaitDuration * SLOWLY_MULTIPLIER); - CheckWarning(ret == TIMED_OUT, ret, "%s: wait executors timeout", executorName.c_str()); + if (ret == TIMED_OUT) { + LOG2("%s: wait executors timeout", executorName.c_str()); + return ret; + } } else { bundle->mWaitingCount = 0; bundle->mCondition.broadcast(); diff --git a/src/hal/CameraHal.cpp b/src/hal/CameraHal.cpp index a0d51e8d..c3f80c3f 100644 --- a/src/hal/CameraHal.cpp +++ b/src/hal/CameraHal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,44 +116,6 @@ int CameraHal::deinit() { return OK; } -#ifdef NO_VIRTUAL_CHANNEL -int CameraHal::deviceOpen(int cameraId) { - LOG1(" @%s", cameraId, __func__); - AutoMutex l(mLock); - CheckAndLogError(mState == HAL_UNINIT, NO_INIT, "HAL is not initialized"); - - // Create the camera device that will be freed in close - if (mCameraDevices[cameraId]) { - LOGI(" has already opened", cameraId); - return INVALID_OPERATION; - } - -#ifdef SUPPORT_MULTI_PROCESS - if (mCameraShm.CameraDeviceOpen(cameraId) != OK) return INVALID_OPERATION; -#endif - - mCameraDevices[cameraId] = new CameraDevice(cameraId); - -#ifdef SUPPORT_MULTI_PROCESS - // The if check is to handle dual camera cases - mCameraOpenNum = mCameraShm.cameraDeviceOpenNum(); - CheckAndLogError(mCameraOpenNum == 0, INVALID_OPERATION, "camera open num couldn't be 0"); -#else - mCameraOpenNum++; -#endif - - if (mCameraOpenNum == 1) { - MediaControl* mc = MediaControl::getInstance(); - CheckAndLogError(!mc, UNKNOWN_ERROR, "MediaControl init failed"); - if (PlatformData::isResetLinkRoute(cameraId)) { - int ret = mc->resetAllLinks(); - CheckAndLogError(ret != OK, DEV_BUSY, "resetAllLinks failed"); - } - } - - return mCameraDevices[cameraId]->init(); -} -#else int CameraHal::deviceOpen(int cameraId, int vcNum) { LOG1(" @%s SENSORCTRLINFO: vcNum %d", cameraId, __func__, vcNum); AutoMutex l(mLock); @@ -195,7 +157,6 @@ int CameraHal::deviceOpen(int cameraId, int vcNum) { int ret = mc->resetAllLinks(); CheckAndLogError(ret != OK, DEV_BUSY, "resetAllLinks failed"); } - // VIRTUAL_CHANNEL_S if (info.vc.total_num) { // when the sensor belongs to virtual channel, reset the routes @@ -206,7 +167,6 @@ int CameraHal::deviceOpen(int cameraId, int vcNum) { return mCameraDevices[cameraId]->init(); } -#endif void CameraHal::deviceClose(int cameraId) { LOG1(" @%s", cameraId, __func__); diff --git a/src/hal/CameraHal.h b/src/hal/CameraHal.h index 2bd43117..ee3fa403 100644 --- a/src/hal/CameraHal.h +++ b/src/hal/CameraHal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,11 +51,7 @@ class CameraHal { virtual int deinit(); // Device API -#ifdef NO_VIRTUAL_CHANNEL - virtual int deviceOpen(int cameraId); -#else virtual int deviceOpen(int cameraId, int vcNum = 0); -#endif virtual void deviceClose(int cameraId); virtual void deviceCallbackRegister(int cameraId, const camera_callback_ops_t* callback); diff --git a/src/hal/ICamera.cpp b/src/hal/ICamera.cpp index 700599bc..f4e2c0b0 100644 --- a/src/hal/ICamera.cpp +++ b/src/hal/ICamera.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -132,24 +132,11 @@ void camera_callback_register(int camera_id, const camera_callback_ops_t* callba * Open one camera device * * \param camera_id camera index - // VIRTUAL_CHANNEL_S * \param vc_num total virtual channel camera number - // VIRTUAL_CHANNEL_E * * \return error code **/ -#ifdef NO_VIRTUAL_CHANNEL -int camera_device_open(int camera_id) { - HAL_TRACE_CALL(1); - - CheckAndLogError(!gCameraHal, INVALID_OPERATION, "camera hal is NULL."); - CheckCameraId(camera_id, BAD_VALUE); - - return gCameraHal->deviceOpen(camera_id); -} -#else int camera_device_open(int camera_id, int vc_num) { - PERF_CAMERA_ATRACE(); HAL_TRACE_CALL(1); CheckAndLogError(!gCameraHal, INVALID_OPERATION, "camera hal is NULL."); @@ -157,7 +144,6 @@ int camera_device_open(int camera_id, int vc_num) { return gCameraHal->deviceOpen(camera_id, vc_num); } -#endif /** * Close camera device diff --git a/src/hal/MockCameraHal.cpp b/src/hal/MockCameraHal.cpp index c1baaa4f..1f4f44f3 100644 --- a/src/hal/MockCameraHal.cpp +++ b/src/hal/MockCameraHal.cpp @@ -82,11 +82,7 @@ int MockCameraHal::deinit() { return OK; } -#ifdef NO_VIRTUAL_CHANNEL -int MockCameraHal::deviceOpen(int cameraId) -#else int MockCameraHal::deviceOpen(int cameraId, int vcNum) -#endif { LOG1("@%s", cameraId, __func__); diff --git a/src/hal/MockCameraHal.h b/src/hal/MockCameraHal.h index af57adc6..93772089 100644 --- a/src/hal/MockCameraHal.h +++ b/src/hal/MockCameraHal.h @@ -53,11 +53,7 @@ class MockCameraHal : public CameraHal, public Thread { // Device API public: -#ifdef NO_VIRTUAL_CHANNEL - virtual int deviceOpen(int cameraId); -#else virtual int deviceOpen(int cameraId, int vcNum = 0); -#endif virtual void deviceClose(int cameraId); virtual void deviceCallbackRegister(int cameraId, const camera_callback_ops_t* callback); diff --git a/src/image_process/PostProcessorBase.cpp b/src/image_process/PostProcessorBase.cpp index 70a289d9..eb6b136f 100644 --- a/src/image_process/PostProcessorBase.cpp +++ b/src/image_process/PostProcessorBase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation. + * Copyright (C) 2019-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,7 +147,8 @@ std::shared_ptr JpegProcess::cropAndDownscaleThumbnail( int format = camera3::HalV3Utils::V4l2FormatToHALFormat(inBuf->v4l2Fmt()); int usage = inBuf->usage(); - LOG2("%s, inputbuffer format:%d, usage:%d", __func__, format, usage); + LOG2("%s, inputbuffer format:%s(%d), usage:%d", __func__, + CameraUtils::format2string(inBuf->v4l2Fmt()).c_str(), format, usage); // Do crop first if needed if (IImageProcessor::isProcessingTypeSupported(POST_PROCESS_CROP) && diff --git a/src/iutils/ModuleTags.cpp b/src/iutils/ModuleTags.cpp index 9747231e..5e68d370 100644 --- a/src/iutils/ModuleTags.cpp +++ b/src/iutils/ModuleTags.cpp @@ -109,6 +109,7 @@ const char* tagNames[] = { "HalV3Utils", "I3AControlFactory", "IA_CIPR_UTILS", + "ICBMThread", "ICamera", "IFaceDetection", "IPCIntelPGParam", @@ -160,6 +161,7 @@ const char* tagNames[] = { "MockCameraHal", "MockSysCall", "MsgHandler", + "OnePunchIC2", "OpenSourceGFX", "PGCommon", "PGUtils", @@ -179,6 +181,7 @@ const char* tagNames[] = { "PostProcessor", "PostProcessorBase", "PostProcessorCore", + "PrivacyControl", "PrivateStream", "ProcessorManager", "RequestManager", diff --git a/src/iutils/ModuleTags.h b/src/iutils/ModuleTags.h index a1d363e7..03f22512 100644 --- a/src/iutils/ModuleTags.h +++ b/src/iutils/ModuleTags.h @@ -117,115 +117,118 @@ enum ModuleTags { GENERATED_TAGS_HalV3Utils = 87, GENERATED_TAGS_I3AControlFactory = 88, GENERATED_TAGS_IA_CIPR_UTILS = 89, - GENERATED_TAGS_ICamera = 90, - GENERATED_TAGS_IFaceDetection = 91, - GENERATED_TAGS_IPCIntelPGParam = 92, - GENERATED_TAGS_IPC_FACE_DETECTION = 93, - GENERATED_TAGS_IPC_GRAPH_CONFIG = 94, - GENERATED_TAGS_ImageProcessorCore = 95, - GENERATED_TAGS_ImageScalerCore = 96, - GENERATED_TAGS_Intel3AParameter = 97, - GENERATED_TAGS_IntelAEStateMachine = 98, - GENERATED_TAGS_IntelAFStateMachine = 99, - GENERATED_TAGS_IntelAWBStateMachine = 100, - GENERATED_TAGS_IntelAlgoClient = 101, - GENERATED_TAGS_IntelAlgoCommonClient = 102, - GENERATED_TAGS_IntelAlgoServer = 103, - GENERATED_TAGS_IntelCPUAlgoServer = 104, - GENERATED_TAGS_IntelCca = 105, - GENERATED_TAGS_IntelCcaClient = 106, - GENERATED_TAGS_IntelCcaServer = 107, - GENERATED_TAGS_IntelEVCPClient = 108, - GENERATED_TAGS_IntelEVCPServer = 109, - GENERATED_TAGS_IntelEvcp = 110, - GENERATED_TAGS_IntelFDServer = 111, - GENERATED_TAGS_IntelFaceDetection = 112, - GENERATED_TAGS_IntelFaceDetectionClient = 113, - GENERATED_TAGS_IntelGPUAlgoServer = 114, - GENERATED_TAGS_IntelIC2 = 115, - GENERATED_TAGS_IntelICBM = 116, - GENERATED_TAGS_IntelICBMClient = 117, - GENERATED_TAGS_IntelICBMServer = 118, - GENERATED_TAGS_IntelPGParam = 119, - GENERATED_TAGS_IntelPGParamClient = 120, - GENERATED_TAGS_IntelPGParamS = 121, - GENERATED_TAGS_IntelTNR7US = 122, - GENERATED_TAGS_IntelTNR7USClient = 123, - GENERATED_TAGS_IntelTNRServer = 124, - GENERATED_TAGS_IspControlUtils = 125, - GENERATED_TAGS_IspParamAdaptor = 126, - GENERATED_TAGS_JpegEncoderCore = 127, - GENERATED_TAGS_JpegMaker = 128, - GENERATED_TAGS_LensHw = 129, - GENERATED_TAGS_LensManager = 130, - GENERATED_TAGS_LiveTuning = 131, - GENERATED_TAGS_Ltm = 132, - GENERATED_TAGS_MANUAL_POST_PROCESSING = 133, - GENERATED_TAGS_MakerNote = 134, - GENERATED_TAGS_MediaControl = 135, - GENERATED_TAGS_MetadataConvert = 136, - GENERATED_TAGS_MockCamera3HAL = 137, - GENERATED_TAGS_MockCameraHal = 138, - GENERATED_TAGS_MockSysCall = 139, - GENERATED_TAGS_MsgHandler = 140, - GENERATED_TAGS_OpenSourceGFX = 141, - GENERATED_TAGS_PGCommon = 142, - GENERATED_TAGS_PGUtils = 143, - GENERATED_TAGS_PSysDAG = 144, - GENERATED_TAGS_PSysPipe = 145, - GENERATED_TAGS_PSysProcessor = 146, - GENERATED_TAGS_ParameterGenerator = 147, - GENERATED_TAGS_ParameterHelper = 148, - GENERATED_TAGS_ParameterResult = 149, - GENERATED_TAGS_Parameters = 150, - GENERATED_TAGS_ParserBase = 151, - GENERATED_TAGS_PipeExecutor = 152, - GENERATED_TAGS_PipeLiteExecutor = 153, - GENERATED_TAGS_PlatformData = 154, - GENERATED_TAGS_PnpDebugControl = 155, - GENERATED_TAGS_PolicyParser = 156, - GENERATED_TAGS_PostProcessor = 157, - GENERATED_TAGS_PostProcessorBase = 158, - GENERATED_TAGS_PostProcessorCore = 159, - GENERATED_TAGS_PrivateStream = 160, - GENERATED_TAGS_ProcessorManager = 161, - GENERATED_TAGS_RequestManager = 162, - GENERATED_TAGS_RequestThread = 163, - GENERATED_TAGS_ResultProcessor = 164, - GENERATED_TAGS_SWJpegEncoder = 165, - GENERATED_TAGS_SWPostProcessor = 166, - GENERATED_TAGS_SchedPolicy = 167, - GENERATED_TAGS_Scheduler = 168, - GENERATED_TAGS_SensorHwCtrl = 169, - GENERATED_TAGS_SensorManager = 170, - GENERATED_TAGS_SensorOB = 171, - GENERATED_TAGS_ShareRefer = 172, - GENERATED_TAGS_SofSource = 173, - GENERATED_TAGS_StreamBuffer = 174, - GENERATED_TAGS_SwImageConverter = 175, - GENERATED_TAGS_SwImageProcessor = 176, - GENERATED_TAGS_SyncManager = 177, - GENERATED_TAGS_SysCall = 178, - GENERATED_TAGS_TCPServer = 179, - GENERATED_TAGS_Thread = 180, - GENERATED_TAGS_Trace = 181, - GENERATED_TAGS_TunningParser = 182, - GENERATED_TAGS_UltraManEvcp = 183, - GENERATED_TAGS_Utils = 184, - GENERATED_TAGS_V4l2DeviceFactory = 185, - GENERATED_TAGS_V4l2_device_cc = 186, - GENERATED_TAGS_V4l2_subdevice_cc = 187, - GENERATED_TAGS_V4l2_video_node_cc = 188, - GENERATED_TAGS_VendorTags = 189, - GENERATED_TAGS_camera_metadata_tests = 190, - GENERATED_TAGS_icamera_metadata_base = 191, - GENERATED_TAGS_metadata_test = 192, - ST_FPS = 193, - ST_GPU_TNR = 194, - ST_STATS = 195, + GENERATED_TAGS_ICBMThread = 90, + GENERATED_TAGS_ICamera = 91, + GENERATED_TAGS_IFaceDetection = 92, + GENERATED_TAGS_IPCIntelPGParam = 93, + GENERATED_TAGS_IPC_FACE_DETECTION = 94, + GENERATED_TAGS_IPC_GRAPH_CONFIG = 95, + GENERATED_TAGS_ImageProcessorCore = 96, + GENERATED_TAGS_ImageScalerCore = 97, + GENERATED_TAGS_Intel3AParameter = 98, + GENERATED_TAGS_IntelAEStateMachine = 99, + GENERATED_TAGS_IntelAFStateMachine = 100, + GENERATED_TAGS_IntelAWBStateMachine = 101, + GENERATED_TAGS_IntelAlgoClient = 102, + GENERATED_TAGS_IntelAlgoCommonClient = 103, + GENERATED_TAGS_IntelAlgoServer = 104, + GENERATED_TAGS_IntelCPUAlgoServer = 105, + GENERATED_TAGS_IntelCca = 106, + GENERATED_TAGS_IntelCcaClient = 107, + GENERATED_TAGS_IntelCcaServer = 108, + GENERATED_TAGS_IntelEVCPClient = 109, + GENERATED_TAGS_IntelEVCPServer = 110, + GENERATED_TAGS_IntelEvcp = 111, + GENERATED_TAGS_IntelFDServer = 112, + GENERATED_TAGS_IntelFaceDetection = 113, + GENERATED_TAGS_IntelFaceDetectionClient = 114, + GENERATED_TAGS_IntelGPUAlgoServer = 115, + GENERATED_TAGS_IntelIC2 = 116, + GENERATED_TAGS_IntelICBM = 117, + GENERATED_TAGS_IntelICBMClient = 118, + GENERATED_TAGS_IntelICBMServer = 119, + GENERATED_TAGS_IntelPGParam = 120, + GENERATED_TAGS_IntelPGParamClient = 121, + GENERATED_TAGS_IntelPGParamS = 122, + GENERATED_TAGS_IntelTNR7US = 123, + GENERATED_TAGS_IntelTNR7USClient = 124, + GENERATED_TAGS_IntelTNRServer = 125, + GENERATED_TAGS_IspControlUtils = 126, + GENERATED_TAGS_IspParamAdaptor = 127, + GENERATED_TAGS_JpegEncoderCore = 128, + GENERATED_TAGS_JpegMaker = 129, + GENERATED_TAGS_LensHw = 130, + GENERATED_TAGS_LensManager = 131, + GENERATED_TAGS_LiveTuning = 132, + GENERATED_TAGS_Ltm = 133, + GENERATED_TAGS_MANUAL_POST_PROCESSING = 134, + GENERATED_TAGS_MakerNote = 135, + GENERATED_TAGS_MediaControl = 136, + GENERATED_TAGS_MetadataConvert = 137, + GENERATED_TAGS_MockCamera3HAL = 138, + GENERATED_TAGS_MockCameraHal = 139, + GENERATED_TAGS_MockSysCall = 140, + GENERATED_TAGS_MsgHandler = 141, + GENERATED_TAGS_OnePunchIC2 = 142, + GENERATED_TAGS_OpenSourceGFX = 143, + GENERATED_TAGS_PGCommon = 144, + GENERATED_TAGS_PGUtils = 145, + GENERATED_TAGS_PSysDAG = 146, + GENERATED_TAGS_PSysPipe = 147, + GENERATED_TAGS_PSysProcessor = 148, + GENERATED_TAGS_ParameterGenerator = 149, + GENERATED_TAGS_ParameterHelper = 150, + GENERATED_TAGS_ParameterResult = 151, + GENERATED_TAGS_Parameters = 152, + GENERATED_TAGS_ParserBase = 153, + GENERATED_TAGS_PipeExecutor = 154, + GENERATED_TAGS_PipeLiteExecutor = 155, + GENERATED_TAGS_PlatformData = 156, + GENERATED_TAGS_PnpDebugControl = 157, + GENERATED_TAGS_PolicyParser = 158, + GENERATED_TAGS_PostProcessor = 159, + GENERATED_TAGS_PostProcessorBase = 160, + GENERATED_TAGS_PostProcessorCore = 161, + GENERATED_TAGS_PrivacyControl = 162, + GENERATED_TAGS_PrivateStream = 163, + GENERATED_TAGS_ProcessorManager = 164, + GENERATED_TAGS_RequestManager = 165, + GENERATED_TAGS_RequestThread = 166, + GENERATED_TAGS_ResultProcessor = 167, + GENERATED_TAGS_SWJpegEncoder = 168, + GENERATED_TAGS_SWPostProcessor = 169, + GENERATED_TAGS_SchedPolicy = 170, + GENERATED_TAGS_Scheduler = 171, + GENERATED_TAGS_SensorHwCtrl = 172, + GENERATED_TAGS_SensorManager = 173, + GENERATED_TAGS_SensorOB = 174, + GENERATED_TAGS_ShareRefer = 175, + GENERATED_TAGS_SofSource = 176, + GENERATED_TAGS_StreamBuffer = 177, + GENERATED_TAGS_SwImageConverter = 178, + GENERATED_TAGS_SwImageProcessor = 179, + GENERATED_TAGS_SyncManager = 180, + GENERATED_TAGS_SysCall = 181, + GENERATED_TAGS_TCPServer = 182, + GENERATED_TAGS_Thread = 183, + GENERATED_TAGS_Trace = 184, + GENERATED_TAGS_TunningParser = 185, + GENERATED_TAGS_UltraManEvcp = 186, + GENERATED_TAGS_Utils = 187, + GENERATED_TAGS_V4l2DeviceFactory = 188, + GENERATED_TAGS_V4l2_device_cc = 189, + GENERATED_TAGS_V4l2_subdevice_cc = 190, + GENERATED_TAGS_V4l2_video_node_cc = 191, + GENERATED_TAGS_VendorTags = 192, + GENERATED_TAGS_camera_metadata_tests = 193, + GENERATED_TAGS_icamera_metadata_base = 194, + GENERATED_TAGS_metadata_test = 195, + ST_FPS = 196, + ST_GPU_TNR = 197, + ST_STATS = 198, }; -#define TAGS_MAX_NUM 196 +#define TAGS_MAX_NUM 199 #endif // !!! DO NOT EDIT THIS FILE !!! diff --git a/src/metadata/ParameterGenerator.cpp b/src/metadata/ParameterGenerator.cpp index 42e4f0bb..5ee4e5d6 100644 --- a/src/metadata/ParameterGenerator.cpp +++ b/src/metadata/ParameterGenerator.cpp @@ -251,6 +251,8 @@ int ParameterGenerator::getIspParameters(int64_t sequence, Parameters* param) { param->setEnabledIspControls(enabledControls); } // ISP_CONTROL_E + + return OK; } return UNKNOWN_ERROR; diff --git a/src/v4l2/V4l2DeviceFactory.cpp b/src/v4l2/V4l2DeviceFactory.cpp index b07de752..47b74388 100644 --- a/src/v4l2/V4l2DeviceFactory.cpp +++ b/src/v4l2/V4l2DeviceFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Corporation. + * Copyright (C) 2015-2023 Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include +#include #include "iutils/CameraLog.h" namespace icamera { @@ -67,6 +68,7 @@ void V4l2DeviceFactory::releaseDeviceFactory(int cameraId) { * Return a not nullptr sub device pointer */ V4L2Subdevice* V4l2DeviceFactory::getSubDev(int cameraId, const std::string& devName) { + LOG2(" @%s, sub device name: %s", cameraId, __func__, devName.c_str()); AutoMutex lock(sLock); V4l2DeviceFactory* factory = getInstance(cameraId); // If an existing sub device found, then just return it. @@ -84,6 +86,27 @@ V4L2Subdevice* V4l2DeviceFactory::getSubDev(int cameraId, const std::string& dev return subdev; } +/** + * Close the sub device and release it in the device map + * + * It MUST be called after this sub device is not used anymore + */ +void V4l2DeviceFactory::releaseSubDev(int cameraId, const std::string& devName) { + LOG2(" @%s, sub device name: %s", cameraId, __func__, devName.c_str()); + AutoMutex lock(sLock); + V4l2DeviceFactory* factory = getInstance(cameraId); + + if (factory->mDevices.find(devName) != factory->mDevices.end()) { + V4L2Subdevice* subdev = factory->mDevices[devName]; + if (subdev) { + subdev->Close(); + delete subdev; + } + + factory->mDevices.erase(devName); + } +} + /** * Release all sub devices in device map * diff --git a/src/v4l2/V4l2DeviceFactory.h b/src/v4l2/V4l2DeviceFactory.h index 2b928efc..70571c81 100644 --- a/src/v4l2/V4l2DeviceFactory.h +++ b/src/v4l2/V4l2DeviceFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021 Intel Corporation. + * Copyright (C) 2015-2023 Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ class V4l2DeviceFactory { static void releaseDeviceFactory(int cameraId); static V4L2Subdevice* getSubDev(int cameraId, const std::string& devName); + static void releaseSubDev(int cameraId, const std::string& devName); private: V4l2DeviceFactory(int cameraId);