Onatu 的实现(基于Wayland协议)(1)- 了解Wayland

wayland 官网:Waylandicon-default.png?t=N7T8https://wayland.freedesktop.org/

一.前言 

在前面,我们使用了 linux-6.1.92+busybox-1.36.1(arm64)编译了一个Linux镜像,很遗憾并不成功,后来又用 Linux5.8重新编译(x86-64),接下来将以该版本来开发

二.Wayland 介绍

什么是Wayland,以下是官网的介绍:

Wayland is a replacement for the X11 window system protocol and architecture with the aim to be easier to develop, extend, and maintain.

Wayland is the language (protocol) that applications can use to talk to a display server in order to make themselves visible and get input from the user (a person). A Wayland server is called a "compositor". Applications are Wayland clients.

Wayland also refers to a system architecture. It is not just a server-client relationship between a compositor and applications. There is no single common Wayland server like Xorg is for X11, but every graphical environment brings with it one of many compositor implementations. Window management and the end user experience are often tied to the compositor rather than swappable components.

A core part of Wayland architecture is libwayland: an inter-process communication library that translates a protocol definition in XML to a C language API. This library does not implement Wayland, it merely encodes and decodes Wayland messages. The actual implementations are in the various compositor and application toolkit projects.

Wayland does not restrict where and how it is used. A Wayland compositor could be a standalone display server running on Linux kernel modesetting and evdev input devices or on many other operating systems, or a nested compositor that itself is an X11 or Wayland application (client). Wayland can even be used in application-internal communication as is done in some web browsers.

Part of the Wayland project is also the Weston reference implementation of a Wayland compositor. Weston can run as an X client or under Linux KMS and ships with a few demo clients. The Weston compositor is a minimal and fast compositor and is suitable for many embedded and mobile use cases.

简单来说Wayland是一个简单的“显示服务器”,与X Window属于同一级的事物,而不是仅仅作为X Window下X Server的替代(注:X Window下分X Server和X Client)。也就是说,Wayland不仅仅是要完全取代X Window,而且它将颠覆Linux桌面上X Client/X Server的概念,以后将没有所谓的“X Client”了,而是“Wayland Client”。 

说起X Window,都应该很熟悉,我们来看一看他们的区别

不难发现:

  • X Window:基于客户端-服务器(Client/Server)架构,所有的应用程序都连接到X服务器上。窗口管理主要由窗口管理器负责,而渲染工作则由应用程序和X Server共同完成。
  • Wayland:它避免了不必要的复杂性和额外的处理,将显示和用户输入的处理都交给了客户端程序。使用Compositor/Client模式。渲染工作则完全由客户端程序自行完成,实现了直接渲染机制(Direct Render),提高了效率和灵活性。

从官方取得源码,然后根据教程进 行编译,就能跑起一个简单实现的“Wayland Compositor”。但我们并不这样做,我们将基于Qt 6.5(C++)的 QtWayland 来实现,合成器具体的实现下次再说

三.为什么使用QtWayland 

官网的介绍如下:

The Qt Wayland Compositor is a module that provides convenient and powerful QML and C++ APIs for developing custom display servers based on the Wayland protocol. The display server, often called a compositor, displays content from client applications that support the Wayland protocol.

Wayland's design philosophy is to keep the core protocol simple and minimal. Developers can then expand on this core protocol with use-case-specific extensions. Qt Wayland Compositor supports many common extensions by default, and also has APIs to enable the creation of new, custom extensions.

Typically, a compositor written with Qt Wayland Compositor becomes a subsystem inside a larger application manager process. Qt Wayland Compositor provides the APIs to communicate with clients and display their content on the screen. The QML APIs contain high-level APIs that easily integrate with the rest of Qt, enabling convenient animations, effects, and UI through Qt Quick. There are also C++ APIs available - if you need more low-level access.

An application manager would typically implement additional features such as application life cycle, virtual keyboard input, security, and Inter-Process Communication (IPC). Qt provides the APIs that can be used to develop the remaining parts of an application manager in other modules. The Qt Automotive Suite provides Qt Application Manager, which is a complete application manager that includes a compositor developed using Qt Wayland Compositor.

可见QtWayland功能强大,可扩展性强,且有官方文档支持,将便于我们来编写。

当然还有其他的,但这里我们选择QtWayland。 

哦对了,想要使用QtWayland,我们需要下载安装Qt,最好在Linux环境上,可以参考这篇文章:

http://t.csdnimg.cn/M10aIicon-default.png?t=N7T8http://t.csdnimg.cn/M10aIQtWayland的使用可以参考官方文档:

Qt Wayland Compositor示例 |Qt Wayland Compositor 6.5.6icon-default.png?t=N7T8https://doc.qt.io/qt-6.5/qtwaylandcompositor-examples.html

  • 9
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值