Qualcomm camera system-usecase configuration

The Qualcomm camera system uses usecase to describe a camera usage scenario. The camera scene configuration is saved in g_sm8350_usecase.xml in serialized form. The configuration conversion script usecaseconverter.pl in the project construction phase parses these usecase configurations, organizes and manages them in the form of data structures, and finally provides a set of interfaces to access these usecase configurations in the form of so.

1.usecase configuration conversion

 2. Usecase configuration operation interface loading

 3. Load usecase configuration

After the ExtensionModule loads the usecase configuration operation interface implemented in the dynamic link library, it first needs to import the usecase configuration data, and then obtain the configuration through the usecase operation interface.

Through PopulatePipelineData(), ExtensionModule imports sm8350 usecase configuration data.

//chi-cdk/core/chiframework/chxextensionmodule.cpp
ExtensionModule::ExtensionModule()
    :...
{
    //1.加载usecase selector实现
    const CHAR* pChiusecaseSelector = "/vendor/lib/com.qti.chiusecaseselector.so";
    m_chiUsecaseHandle = ChxUtils::LibMap(pChiusecaseSelector);
    //2.获取usecase selector导出配置函数
    ChiPopulatePipelineData pFuncPopulatePipelineData = 
        reinterpret_cast<ChiPopulatePipelineData>(
        	ChxUtils::LibGetAddr(m_chiUsecaseHandle, "PopulatePipelineData"));
    //3.导出usecase配置
    pFuncPopulatePipelineData(m_platformID);
    ...
}

 4. Operation usecase configuration

After the usecase configuration data is imported, the usecase configuration can be operated through the operation interface provided by UsecaseSelector.

The usecase configuration operation interfaces are:

//chi-cdk/oem/qcom/chiusecase/common/chxusecaseselector.cpp
//1.导入配置
extern "C" CAMX_VISIBILITY_PUBLIC  VOID PopulatePipelineData(
    INT32 socId)extern "C" CAMX_VISIBILITY_PUBLIC  VOID PopulatePipelineData(
    INT32 socId)
//获取匹配的usecase选择器
extern "C" CAMX_VISIBILITY_PUBLIC ChiUsecase* UsecaseSelector::DefaultMatchingUsecaseSelection(
    camera3_stream_configuration_t* pStreamConfig,
    UINT32                          bpp)
//获取默认匹配的usecase
extern "C" CAMX_VISIBILITY_PUBLIC ChiUsecase* GetDefaultMatchingUsecase(
    camera3_stream_configuration_t* pStreamConfig,
    UINT32                          bpp)
//根据streamConfigure裁剪usecase
extern "C" CAMX_VISIBILITY_PUBLIC  CDKResult PruneUsecaseByStreamConfig(
    const camera3_stream_configuration* pStreamConfig,
    const ChiUsecase*                   pUsecaseInputDescriptor,
    ChiUsecase**                        ppUsecaseOutputDescriptor)

//获取配置中enumName-enumValue映射表
extern "C" CAMX_VISIBILITY_PUBLIC VOID* GetMapFromLibEnum()
//获取配置中usecaseName-usecaseInstance映射表
extern "C" CAMX_VISIBILITY_PUBLIC VOID* GetMapFromLibpChiUsecase()
//获取配置中usecaseCollectionName-usecaseCollection映射表
extern "C" CAMX_VISIBILITY_PUBLIC VOID* GetMapFromLibpChiTargetUsecases()
//
extern "C" CAMX_VISIBILITY_PUBLIC VOID*  GetMapFromLibStringArray()

The usecase configuration management module groups usecases according to the number of tagets. Usecases in a group have the same number of targets to form a collection (represented by the ChiTargetUsecase data structure). A usecase in the usecase group is an instance, represented by the ChiUsecase data structure.

5. Example of use 

Taking the post preview of light face as an example, the usecase configuration operation in the process of creating advancedCameraUsecase in the configure_streams stage is explained.

 The construction of an advanced usecase instance can be divided into two stages: clone the default usecase, and then tailor it according to the flow configuration.

Guess you like

Origin blog.csdn.net/hongyeying/article/details/128286901