当前位置:网站首页>[Wayland] Wayland introduction and customized guidance
[Wayland] Wayland introduction and customized guidance
2022-06-12 10:09:00 【Lindo】
Wayland And Weston brief introduction
- For some reason . Porting and customizing a set based on Wayland Of Compositor.
- Wayland And Weston, It's two complementary concepts . Here is a brief summary :
- wayland It's a set for “ Show ” Agreement for services , be based on C/S structure . It customizes a set of standard interfaces 、 Basic communication mode .
- wayland It provides the realization of communication mode (socket+epoll), And provides “ Interface ” Description language of , And tools to convert the language into code (scanner)
- Weston Is based on Wayland agreement , And implemented Compositor Functional , An official set of Wayland compositor Realization ( Can be understood as based on wayland Agreed compositor)
- Some concepts on the Internet are vague . In short ,wayland Customized a set of protocols , This protocol implements a set of “ Display server ”.Weston Namely wayland Official , This set of display server Reference implementation .
Architecture diagram

wayland
- Wayland Provides Protocol How to define .Wayland In the source code of protocol Under the folder , Defined Wayland The core agreement of .
- Such as wl_display: Used to get display Global object .
<interface name="wl_display" version="1">
<description summary="core global object">
The core global object. This is a special singleton object. It
is used for internal Wayland protocol features.
</description>
.....
</interface>
- be based on wayland Of Compositor Realization , At least to achieve wayland Stipulated core agreement . Specific core agreements , To participate in wayland Official website (https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Interfaces)
- wayland Source code , Except for the agreement . The remaining main contents , Is to achieve an efficient Server+Client Communication mode .
- Server End , Mainly used epoll+socket monitor Client End event , And deserialize the received message .
// epoll
int
wl_os_epoll_create_cloexec(void)
{
int fd;
#ifdef EPOLL_CLOEXEC
fd = epoll_create1(EPOLL_CLOEXEC);
if (fd >= 0)
return fd;
if (errno != EINVAL)
return -1;
#endif
fd = epoll_create(1);
return set_cloexec_or_close(fd);
}
// socket
int
wl_os_socket_cloexec(int domain, int type, int protocol)
{
int fd;
fd = socket(domain, type | SOCK_CLOEXEC, protocol);
if (fd >= 0)
return fd;
if (errno != EINVAL)
return -1;
fd = socket(domain, type, protocol);
return set_cloexec_or_close(fd);
}
- Client End :wayland-client Provides the implemented serialization interface . Specific communications 、 Serialization implementation is not described in detail here .
WL_EXPORT void
wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
{
union wl_argument args[WL_CLOSURE_MAX_ARGS];
va_list ap;
va_start(ap, opcode);
wl_argument_from_va_list(proxy->object.interface->methods[opcode].signature,
args, WL_CLOSURE_MAX_ARGS, ap);
va_end(ap);
wl_proxy_marshal_array_constructor(proxy, opcode, args, NULL);
}
- summary : Official Wayland Source code , It mainly includes the definition of the agreement 、 Protocol to code generation tool , And a set of well implemented communication model .
Weston
- Weston Is based on wayland agreement , Realized Compositor.
- Weston The entrance of is in ( Here we use 2.0.0 For example ): weston2.0.0./compositor/main.c
int main(int argc, char *argv[])
{
// Create a global Display, And finally call to wl_os_epoll_create_cloexec
display = wl_display_create();
// establish Compositor
ec = weston_compositor_create(display, &user_data);
// establish Shell
if (wet_load_shell(ec, shell, &argc, argv) < 0)
goto out;
// while loop
wl_display_run(display);
}
- Weston There are four main parts in :Shell、Compositor、Render、Input.
- Shell: Window manager , Picture level 、 Window information 、 Window life cycle 、Focus Windows, and so on, tend to be handled in the business layer . default shell by desktop-shell, Other shell Realization ( Such as ivi-shell)
- Compositor: Responsible for the composition of the picture , Use DRM Connect output, Output the screen to the actual display device .
- Render: Responsible for rendering , such as gl-render, Do some texture mapping .
- Input:libinput modular , And evdev、uvdev Module interaction , Receive... From the underlying device node touch、key Equal input .
Migration and customization
At present, many systems in China adopt Wayland As a display server , Transplantation and customization generally have the following aspects :
- Compile and migrate : Compile and migrate based on the compiler adopted by the project .
- System docking and native debugging : Mode native code , In fact, it is the original Sample Run .
- Shell customized 、 Protocol extension : According to business needs , Choose one Shell, And then customize on the basis of it Shell, Extend native protocols .
- Optimize : Display performance 、Input performance 、 Log optimization 、Debug Tool development, etc .
边栏推荐
- [cloud native | kubernetes] kubernetes networkpolicy
- Autojs learning notes 6:text (txt) Findone() will report an error when switching apps. Finally, solve the implementation effect and switch any app until the script finds the control with the specified
- Dazzle the "library" action - award solicitation from the golden warehouse of the National People's Congress - high availability failover and recovery of kingbasees cluster
- MySQL optimized slow log query
- Antique mfc/gdi+ Frame LCD display control
- [chromium] location information kernel debugging
- 行业分析怎么做
- Crazy temporary products: super low price, big scuffle and new hope
- Tap series article 3 | introduction to Tanzu application platform deployment reference architecture
- SAP Hana error message sys_ XSA authentication failed SQLSTATE - 28000
猜你喜欢

CEPH performance optimization and enhancement

链式哈希表

List of computer startup shortcut keys
![[cloud native | kubernetes] kubernetes networkpolicy](/img/8b/9260fc39d3f595cdc2689a3ab26bd7.png)
[cloud native | kubernetes] kubernetes networkpolicy

JVM (IV) Class file structure (complete parsing of bytecode attached)

001: what is a data lake?

Combat tactics based on CEPH object storage
![Data processing and visualization of machine learning [iris data classification | feature attribute comparison]](/img/a3/1d181b9dd5268e13cc276a78862d1f.png)
Data processing and visualization of machine learning [iris data classification | feature attribute comparison]

MySQL III Configuration file & log file

极速搭建元宇宙画廊 #oncyber.io
随机推荐
Detailed explanation and use of redis data types: key and string types
MySQL索引常见问题
True north reading notes
【云原生 | Kubernetes篇】Kubernetes 网络策略(NetworkPolicy)
2021-09-15
CEPH performance optimization and enhancement
Briefly introduce the difference between threads and processes
Overview of software definition storage (one article is enough)
tp6调试(trace)
MySQL优化之慢日志查询
High performance computing framework for image processing
C language recursive folder code
传输层协议 ——— TCP协议
string类对象的访问及遍历操作
日本经济泡沫与房价泡沫
Yarn scheduling
5 most common CEPH failure scenarios
In 2026, the capacity of China's software defined storage market will be close to US $4.51 billion
[DDS] dds-rpc implementation based on opendds
SAP Hana error message sys_ XSA authentication failed SQLSTATE - 28000