首先要去掉厂家提供的gralloc,hwcopser HAL模块,在这之前先回顾一下:android系统如何加载一个硬件模块,在之前的小节中,详细的讲解了:
int hw_get_module(const char *id, const struct hw_module_t **module)
{
return hw_get_module_by_class(id, NULL, module);
}
在此我们简单的总结一下,如何获得HAL模块gralloc。hw_get_module函数时在哪里去查找呢?我们进入源代码:
hw_get_module(const char *id, const struct hw_module_t **module)
hw_get_module_by_class(id, NULL, module);
hw_module_exists(path, sizeof(path), name, "default")
snprintf(path, path_len, "%s/%s.%s.so",HAL_LIBRARY_PATH3, name, subname);
snprintf(path, path_len, "%s/%s.%s.so",HAL_LIBRARY_PATH2, name, subname);
snprintf(path, path_len, "%s/%s.%s.so",HAL_LIBRARY_PATH1, name, subname);
可以看到首先会在HAL_LIBRARY_PATH3,HAL_LIBRARY_PATH2,HAL_LIBRARY_PATH1三个目录进行查找,对于我们的RK3399(64位)定义如下:
#define HAL_LIBRARY_PATH1 "/system/lib64/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw"
#define HAL_LIBRARY_PATH3 "/odm/lib64/hw"
确定了目录以后,我们要知道,他查找的文件名是什么,
/*穿入一个模块的名字const char *id,尝试获得他对应的文件*/
hw_get_module(const char *id, const struct hw_module_t **module)
/*把id与inst组成name,其中inst=null,即该就为id原型*/
snprintf(name, PATH_MAX, "%s.%s", class_id, inst);
for (i=0 ; i
关注
打赏
热门博文
- 史上最全slam从零开始-总目录
- (01)ORB-SLAM2源码无死角解析-(00)目录_最新无死角讲解
- 目标检测00-00:mmdetection(Foveabox为例)-目录-史上最新无死角讲解
- 风格迁移1-00:Liquid Warping GAN(Impersonator)-目录-史上最新无死角讲解
- 姿态估计1-00:FSA-Net(头部姿态估算)-目录-史上最新无死角讲解
- 姿态估计0-00:DenseFusion(6D姿态估计)-目录-史上最新无死角讲解
- 3D点云重建0-00:MVSNet(R-MVSNet)-目录-史上最新无死角讲解
- 视觉工作项目-为后来的你,提供一份帮助!
- 行人检测0-00:LFFD-目录-史上最新无死角解读
- 行人重识别0-00:DG-Net(ReID)-目录-史上最新无死角讲解