本讲是Camera KMD ISP子系统专题的第10讲,我们讲解Camera KMD ISP子系统DRQ与CAM SYNC第一部分。
更多资源:
资源 | 描述 |
---|---|
在线课程 | 极客笔记在线课程 |
知识星球 | 星球名称:深入浅出Android Camera 星球ID: 17296815 |
极客笔记圈 |
DRQ的作用
- DRQ负责调度管理pipeline里的node处理逻辑(通过node之间的dependency依赖机制)
-
利用多线程并行处理Pipeline中并行的node,加快处理速度
图解DRQ工作内容
线程池和DRQ实例
- session, pipeline, node, drq, metapool等用的是chicontext里的同一个线程池
ChiContext::Initialize()
{
ThreadManager::Create(&m_pThreadManager, "SoloThreadManager", numThreads);
//线程池handler会传递给session, pipeline, node, drq, metapool等进行共同使用
}
- 一个session里面所有的pipeline共用一个DRQ
Session::Initialize()
{
m_pDeferredRequestQueue = DeferredRequestQueue::Create(&pDeferredCreateData);
}
重要结构体介绍
DeferredRequestQueue
class DeferredRequestQueue : public IPropertyPoolObserver
{
Hashmap* m_pDependencyMap; ///< Hashmap to store pending dependencies
ThreadManager* m_pThreadManager; ///< 指向一个线程池
Session* m_pSession; ///< pointer to Session to which this DRQ belongs
JobHandle m_hDeferredWorker; ///< 通过这个worker handle执行异步操作
LightweightDoublyLinkedList m_deferredNodes; ///< List of deferred nodes
LightweightDoublyLinkedList m_readyNodes; ///< List of ready nodes
MetadataPool* m_pMainPools[MaxPipelinesPerSession]; ///< 保存了每个pipeline的result metadata pool
}
DependencyUnit
每个Node需要填写自己处理一个request需要的dependency(chifence, fence, metadata/property),只有所有的dependency都满足后,DRQ才会调度线程池去安排node处理request
struct DependencyUnit
{
PropertyDependency propertyDependency;
bufferDependency;// input buffer fence
chiFenceDependency;// non buffer fence
}
Dependency
DependencyKey
struct DependencyKey
{
UINT64 requestId; ///< Request ID
UINT64 pipelineId; ///< pipeline id for the data
UINT32 dataId; ///< Property/Metadata/Data identifier
VOID* pFence; ///< Fence pointer
VOID* pChiFence; ///< Chi Fence pointer
};
mapKey-property类型
DependencyKey mapKey = {request, pDependency->pipelineIds[i], pDependency->properties[i], NULL, NULL};
mapKey-buffer fence(csl)类型
DependencyKey mapKey = {0, 0, PropertyIDInvalid, pDependency->phFences[i], NULL};
mapKey-chi fence类型
DependencyKey mapKey = {0, 0, PropertyIDInvalid, NULL, pDependency->pChiFences[i]};
HashMap结构