-
Notifications
You must be signed in to change notification settings - Fork 102
/
vulkan.txt
67 lines (44 loc) · 2.34 KB
/
vulkan.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
The LunarG SDK includes the official Khronos loader (libvulkan.so), which was
developed by LunarG.
On Linux, the loader detects the drivers via a JSON file that’s installed in
some system paths. The JSON file indicates where the actual driver library is.
There are also some environment variable overrides that you can use to point to
a different location rather than a system location.
目前看大致的框架是:
app -> vulkan loader -> icd -> kernel/devhost driver
vulkan loader里实现了各种vulkan api,会跳转到icd对应的接口去。
vulkan loader是lunarg提供的
icd是mesa的,应该被修改调用magma
gpu驱动在garnet/drivers/gpu里面,叫做magma driver. 入口在driver_entry.cc里。
(现在好像在弃用magma, 改用新的display controller接口)
zircon里还有vim display驱动,是管hdmi的。
intel icd 部分
入口函数都是自动生成的:
gn会生成
$target_gen_dir/vulkan/icd.d/libvulkan_intel.json
system_image.manifest文件里:
data/vulkan/icd.d/下面是icd json文件。目前只有intel
vulkan loader应该是根据这个json文件加载libvulkan_intel.so
loader是怎样知道要去这个路径下找json呢,在gn里:
"-DSYSCONFDIR=\"/system/data\"",
out/x64/x64-shared/gen/third_party/mesa/src/intel/vulkan/anv_entrypoints.c
anv_lookup_entrypoint()用来查找api的入口。
anv_device.c里面有icd的各种入口
anv_gem.c是mesa原来的实现。fuchsia替换成了anv_magma.cc
vulkan loader在创建实例的时候完成icd的扫描。
trampoline.c: vkCreateInstance()
loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list) // loader.c
loader_scanned_icd_add(inst, icd_tramp_list, fullpath, vers)
fp_get_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr");
return dlsym(library, name);
new_scanned_icd->CreateInstance = fp_create_inst;
loader_create_instance_chain(&ici, pAllocator, ptr_instance, &created_instance)
loader_gpa_instance_internal
terminator_CreateInstance
for ()
icd_result = ptr_instance->
icd_tramp_list.scanned_list[i].CreateInstance(&icd_create_info,
pAllocator, &(icd_term->instance));
\subsection{notes}
一个physical device会有多个display, 以及多个plane.
一个plane可能对应一个display,也可能对应多个display.