weston 10.0.90启动过程
compositor/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 //x11-backend.so
-->weston_compositor_create //创建 compositor 实例
-->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_x11_backend //use-pixman? cpu:gpu
-->weston_compositor_load_backend
-->weston_load_module //x11-backend.so
-->weston_backend_init
-->x11_backend_create //use pixman?pixman_renderer_init:init_gl_renderer
-->init_gl_renderer //weston_load_module(gl-renderer.so)
-->weston_compositor_log_capabilities
-->wl_client_create
-->weston_compositor_wake
-->execute_autolaunch
-->wl_display_run
weston的backend
weston的显示后端有好几种,从源码里也可以看出,通过load_backend函数根据参数选择加载不同的backend。
比如DRM backend的加载
load_backend
-->load_drm_backend
-->weston_compositor_load_backend(c, WESTON_BACKEND_DRM,&config.base);
-->weston_load_module(backend_map[backend], "weston_backend_init");
weston/libweston/backend-drm$ tree -L 1
.
├── drm.c
├── drm-gbm.c
├── drm-internal.h
├── drm-virtual.c
├── fb.c
├── kms.c
├── libbacklight.c
├── libbacklight.h
├── meson.build
├── modes.c
├── state-helpers.c
├── state-propose.c
├── vaapi-recorder.c
└── vaapi-recorder.h
0 directories, 14 files
?weston的render选择
使用CPU渲染的话选择pixman,GPU渲染选择OpenGL
drm_output_render
-->drm_backend *b = to_drm_backend(c);
-->drm_output_state_get_plane
-->if (b->use_pixman) {
fb = drm_output_render_pixman(state, damage);
} else {
fb = drm_output_render_gl(state, damage);
}
|