ompositor/executable.c/main()-->
compositor/main.c-->wet_main()
-->verify_xdg_runtime_dir()//XDG_RUNTIME_DIR环境变量检查
-->wl_display_create//创建wayland显示对象
-->wl_display_get_event_loop
-->wl_event_loop_add_signal
-->load_configuration //加载weston.ini
-->weston_config_get_section \ weston_config_section_get_bool\ weston_config_section_get_string
-->weston_choose_default_backend //d-backend.so
-->weston_compositor_create //创建 compositor 实例
--> (!wl_global_create(ec->wl_display, &wl_compositor_interface, 4,
ec, compositor_bind)) //创建compositer_interface
-->weston_plane_init
-->wl_data_device_manager_init
-->wl_display_init_shm
-->weston_layer_init(&ec->fade_layer, ec);
-->weston_layer_init(&ec->cursor_layer, ec);
-->wl_display_add_protocol_logger
-->weston_compositor_init_config
-->load_backend //根据启动参数-b,显式加载后端显示接口
-->load_drm_backend//use-pixman? cpu:gpu
-->weston_compositor_load_backend
-->weston_load_module //x11-backend.so
-->weston_backend_init
-->drm_backend_create
//use pixman?pixman_renderer_init:init_gl_renderer
-->init_gl_renderer //weston_load_module(gl-renderer.so)
-->udev_input_init //处理输入事
-->process_events(input);
while ((event = libinput_get_event(input->libinput))) {
process_event(event); // 循环遍历
libinput_event_destroy(event);
}
-->weston_compositor_log_capabilities
-->wl_client_create
-->weston_compositor_wake
-->execute_autolaunch
-->wl_display_run
1.backend 有多种类型
2. 渲染: 软件渲染&gpu 渲染
drm_backend_create
drm_backend_create
if (b->use_pixman) {
if (init_pixman(b) < 0) {
weston_log("failed to initialize pixman renderer\n");
goto err_sprite;
}
} else {
if (init_egl(b) < 0) {
weston_log("failed to initialize egl\n");
goto err_sprite;
}
}