您当前的位置: 首页 >  android
  • 2浏览

    0关注

    417博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

07.显示系统:第002课_修改源码禁用hwc和GPU:第02节_修改tiny4412_android源码禁用hwc和GPU_去除厂家gralloc_hwc模块_P

江南才尽,年少无知! 发布时间:2019-03-25 15:58:15 ,浏览量:2

首先要去掉厂家提供的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            
关注
打赏
1592542134
查看更多评论
0.0396s