首先要去掉厂家提供的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
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?