Wayland

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書
Wayland
Wayland參考實現Weston
原作者Kristian Høgsberg
首次釋出2008年9月30日,​15年前​(2008-09-30[1]
目前版本
  • 1.22.0 (2023年4月4日;穩定版本)[2]
  • 1.22.91 (2024年4月25日;預覽版本)[3]
編輯維基數據連結
原始碼庫 編輯維基數據連結
程式語言C
作業系統類Unix系統
類型顯示服務
特許條款MIT特許條款
網站wayland.freedesktop.org
Linux:X Server與Wayland Compositor
Wayland compositors, libwayland-client and toolkits

Wayland是一個通訊協定,規定了顯示伺服器與其客戶機之間的通訊方式,而使用這個協定的顯示伺服器稱為Wayland Compositor。它由Kristian Høgsberg於2008年發起,目標是用更簡單的現代化視窗系統取代X Window System。Wayland協定的參考實現稱為Weston,由Wayland專案組使用C語言開發。[5]

Wayland與X Window System的最大不同在於,它規定由客戶機自身負責窗口邊框和裝飾的繪製,並且客戶機能夠通過EGL以及一些Wayland特定的EGL擴充元件直接在顯示記憶體中算繪自己的緩衝區。視窗管理員簡化成顯示管理服務,專門負責算繪那些熒幕上的程式。這比X Window System中的視窗管理員要更簡單、高效。[6][7]

Wayland專案的原始碼使用MIT特許條款釋出。現有的Compositor例如CompizKWinMutter對Wayland都有着不同程度的支援。

歷史[編輯]

Wayland的創始人Kristian Høgsberg是X.Org Server開發者,曾參與過AIGLX英語AIGLXDRI2英語DRI2的開發。他在2008年供職於紅帽時發起了Wayland作為業餘專案,目標是讓「每一個幀都完美無瑕,也就是說應用程式要能充分地控制圖形的彩現,使我們完全無法察覺任何的撕裂、延遲、重畫及閃爍」[8][9][10][11]。這一靈感浮現時他正開車經過馬薩諸塞州的韋蘭,也就由此決定了專案的名字[10][12]

2010年10月,Wayland加入了Freedesktop.org專案[13][14]。在遷移過程中,郵寄清單wayland-devel代替了原先的Google group郵件組,用於討論專案的開發。

Wayland是自由軟件,它的庫(libwayland-server和libwayland-client)以MIT License授權,範例程式和Compositor一開始以GPLv2授權。現在整個專案都是以MIT License授權。直到2010年11月份,Wayland還僅僅只能在IntelNvidiaAMD的開源驅動上執行。

設計[編輯]

The Wayland display server protocol relys on EGL

Wayland運用既有的Linux核心技術,像是Direct Rendering Manager(DRM),Kernel Mode-Setting(KMS)以及Graphics Execution Manager(GEM)以提供一個最小化的顯示管理服務。Wayland混合器(compositor)在2010年6月已從桌面常用的OpenGL改為OpenGL ES[15]。這個專案也開發支援Wayland顯示的Qt,而不需要X。大部分應用程式都有望獲得透過函式庫,無需修改程式即可支援Wayland。

近些年來,GNU/Linux桌面圖形開發者將許多與彩現有關的介面從X server移動到內核中。現在,已經有許多功能被移入內核(內存管理任務排程模式設置(KMS)等等)或是程式庫(cairo、pixman、freetype、fontconfig、pango等等),所以窗口系統需要做的事情大大減少了。但是X11協定十分巨大、龐雜,並且它包括了許多已經過時的模組。雖然開發者們為了使X server適應現代化的電腦架構而開發出了XRandR、XRender、Composite等一些額外擴充,但這終究是治標不治本,同時這也會增加維護的難度。

Wayland是一款協定,但與X server不同的是,Wayland只做它必須要做的事情。下面以「滑鼠點擊按鈕引發按鈕更新動作」為例來說明一下Wayland和X server的區別:

X架構

在X中

  1. 內核擷取滑鼠點擊事件並行送給X server。
  2. X server會計算該把這一事件傳送給哪個窗口(事實上,窗口位置是由Compositor控制的,X server並不能夠正確的計算Compositor做過特效變化之後的按鈕的正確位置)。
  3. 應用程式對此事件進行處理(將引發按鈕更新動作)。但是,在此之前它得向X server傳送繪製請求。
  4. X server接收到這條繪製請求,然後把它發給影片驅動來彩現。X還計算了更新區域,並且這條「垃圾資訊」傳送給了Compositor。
  5. 這時,Compositor知道它必須要重新合成熒幕上的一塊區域。當然,這還是要向X server傳送繪製請求的。
  6. 開始繪製。但是X server還會去做一些不必要的本職工作(窗口重疊計算、窗口剪裁計算等)。
Wayland架構

在Wayland中

  1. 內核擷取滑鼠點擊事件並行送給Wayland Compositor。
  2. 由於是直接發給Wayland Compositor的,所以Wayland Compositor會正確地計算出按鈕的位置。同時它會把這一事件傳送給按鈕所在的應用程式來處理。
  3. 應用程式直接彩現,無需向Wayland Compositor請求。只需在繪製完成之後向Wayland Compositor傳送一條資訊表明這塊區域被更新了。
  4. Wayland Compositor收到這條資訊後,立即重新合成整個桌面。

目前,Wayland使用OpenGL ES而不是傳統的OpenGL。「從長遠來看,我們需要完整的OpenGL支援,但問題是libGL會帶來X的依賴性......」[16]另一方面,使用OpenGL ES會使得Wayland更容易支援流動裝置[17]。Wayland目前並不支援網絡透明性,但未來可能會支援[18]

媒體關注[編輯]

Phoronix於2008年11月發表了一篇標題為「Wayland: A New X Server For Linux」的文章[6],披露Wayland這項新的專案。Kristian透過他的網誌對此關注作出回應,他告示大眾Wayland並非一個新的X server而是一個顯示伺服器,並聲明這個新興的專案尚處於未成熟的階段[8]

使用[編輯]

Arch Linux[編輯]

Arch Linux本身不具有Wayland。但實際上,安裝 Enlightenment 或 KDE 等桌面環境時,可以選用Wayland安裝作為顯示伺服器。

Ubuntu[編輯]

馬克·沙特爾沃思於2010年11月4日宣佈Wayland將作為Ubuntu未來某一未定版本Unity介面的顯示伺服器[19]。但是2013年3月份,Canonical確認他們將開發一個新的顯示服務Mir而不是使用Wayland來替代X[20]。2017年4月份,Canonical宣佈放棄Unity與Mir[21],並於Ubuntu 17.10開始使用Wayland[22]。但在18.04LTS版本中因為Wayland無法支援熒幕共用,遠程桌面服務以及GNOME Shell崩潰的可恢復性更換為X.Org Server。[23][24]

Fedora[編輯]

Fedora 25整合了GNOME桌面最新版本 3.22,並將GNOME桌面的版本的顯示後端切換至預設為Wayland。

RHEL[編輯]

RHEL 8整合了Wayland。

Qt[編輯]

Qt 5.x提供了QtWayland模組以支援Wayland協定[25],藉由-platform命令列選項,Qt應用程式可以在運行時切換圖形後端,如X與Wayland[26]。2011年1月,Wayland支援進入上游Qt版本庫的Lighthouse分支[27]

KDE[編輯]

KWinKDE的視窗管理器加入支援OpenGL ES輸出[28],已在KDE SC 4.7發佈[29]。目前,KWin已經完成Wayland的初步移植[30]。在2012年1月發佈的KDE SC 4.8,KDE將支援X下執行Wayland。在2012年夏天發佈的KDE SC 4.9,將可以直接執行Wayland,主要用於支援流動裝置,也就是Plasma Active[31]

GNOME[編輯]

GNOME從3.10開始支援Wayland[32]

Compiz[編輯]

Compiz開發者們已經把它對X的依賴部分變成了一個可選外掛程式。同時,Canonical正在為Compiz添加OpenGL ES的支援。眾所周知,目前Wayland正是使用OpenGL ES,這使將得Compiz能夠更容易遷移到Wayland。 註:compiz此項目的主要作者已經離開Canonical,使得此項目進入停止開發的狀態,當然遷移到wayland的計劃也就更遙遙無期。

Sailfish OS[編輯]

Jolla的第一款裝置搭載的Sailfish OS使用Wayland[33]

工具包[編輯]

  • Clutter 對 Wayland 已經有完整的支援。
  • EFL 對 Wayland 通常情況下有完整支援。
  • Enlightenment Foundation Libraries 對Wayland已經有完整的支援。
  • QT 5 除了對 client 有一些改動之外,對Wayland已經有完整的支援。
  • GTK+3.4.0,釋出於2012年3月26日,對 Wayland 的支援有一些缺陷。不過過隨着3.4.1更新版本的釋出,這個問題得到了緩解。
  • SDL自 2.0.2 釋出以來開始支援 Wayland,自 2.0.4 開始預設啟用。
  • GLFW 自 3.2 開始支援。
  • FreeGLUT 已開始支援。

參見[編輯]

參考資料[編輯]

  1. ^ 存档副本. [2023-01-28]. (原始內容存檔於2020-04-01). 
  2. ^ ANNOUNCE wayland 1.22.0. 2023年4月4日 [2023年4月14日]. 
  3. ^ https://lists.freedesktop.org/archives/wayland-devel/2024-April/043580.html; 出版日期: 2024年4月25日.
  4. ^ Simon Ser. [ANNOUNCE] wayland 1.21.0. 2022-06-30 [2022-06-30]. (原始內容存檔於2022-07-02) (英語). 
  5. ^ Wayland. [2013-09-18]. (原始內容存檔於2010-11-22) (英語). Wayland is a protocol for a compositor to talk to its clients as well as a C library implementation of that protocol. 
  6. ^ 6.0 6.1 Michael Larabel. Wayland: A New X Server For Linux. Phoronix Media. 2008-11-03 [2013-11-09]. (原始內容存檔於2010-11-15) (英語). 
  7. ^ D. J. Walker-Morgan. New Wayland X server looks to how a modern desktop works. Heise Media UK Ltd. 2008-11-06 [2013-11-09]. (原始內容存檔於2013-10-29) (英語). 
  8. ^ 8.0 8.1 Høgsberg, Kristian. Premature publicity is better than no publicity. 2008-11-03 [2016-04-06]. (原始內容存檔於2022-10-06). 
  9. ^ Interview: Kristian Høgsberg. FOSDEM Archive. 2012-01-29 [2016-03-08]. 
  10. ^ 10.0 10.1 Hillesley, Richard. Wayland - Beyond X. The H Open. Heise Media UK. 2012-02-13 [2016-03-08]. (原始內容存檔於2013-12-06). 
  11. ^ Høgsberg, Kristian. Wayland – A New Display Server for Linux. Linux Plumbers Conference, 2009. [2010-11-23]. (原始內容存檔於2011-07-27). 
  12. ^ Jenkins, Evan. The Linux graphics stack from X to Wayland. Ars Technica. 2011-03-22 [2016-04-17]. (原始內容存檔於2016-04-10). 
  13. ^ Larabel, Michael. Wayland Becomes A FreeDesktop.org Project. Phoronix.com. 2010-10-29 [2016-04-17]. (原始內容存檔於2016-04-14). 
  14. ^ Høgsberg, Kristian. Moving to freedesktop.org. 2010-10-29 [2013-07-31]. (原始內容存檔於2019-12-07). 
  15. ^ Michael Larabel. Wayland Meets Some Summer Love w/ New Changes. Phoronix Media. 2010-06-06 [2013-11-09]. (原始內容存檔於2018-12-25) (英語). 
  16. ^ Kristian Høgsberg. Blender3D & cursor clamping.. 2010-12-09 [2013-11-09]. (原始內容存檔於2021-03-08) (英語). 
  17. ^ Michael Larabel. Wayland's Weston Running On Android. Phoronix Media. 2012-05-24 [2013-11-09]. (原始內容存檔於2021-03-07) (英語). 
  18. ^ Kristian Høgsberg. Network transparency argument. 2010-11-09 [2013-11-09]. (原始內容存檔於2021-03-08) (英語). Wayland isn't a remote rendering API like X, but that doesn't exclude network transparency. Clients render into a shared buffer and then have to tell the compositor the what they changed. The compositor can then send the new pixels in that region out over the network. The Wayland protocol is already violently asynchronous, so it should be able to handle a bit of network lag gracefully. Remote fullscreen video viewing or gaming isn't going to work well, but I don't know any other display system that handles that well and transparently. 
  19. ^ Mark Shuttleworth. Unity on Wayland. 2010-11-04 [2010-11-04]. (原始內容存檔於2013-06-28) (英語). 
  20. ^ Michael Larabel. Ubuntu Announces Mir, A X.Org/Wayland Replacement. Phoronix Media. 2013-03-04 [2013-11-09]. (原始內容存檔於2021-05-07) (英語). 
  21. ^ Ubuntu宣布放弃Unity界面:明年将回归GNOME. 新浪科技. 2017-04-06 [2017-11-11]. (原始內容存檔於2020-08-26). 
  22. ^ Ubuntu 17.10调整:Dock始终可见 默认使用Wayland. 搜狐. 2017-08-07 [2017-11-11]. (原始內容存檔於2018-06-12). 
  23. ^ Ubuntu 18.04 LTS每日構建版使用Xorg而不是Wayland. 掃文資訊. [2018-04-15]. (原始內容存檔於2018-04-15). 
  24. ^ Bionic Beaver 18.04 LTS to use Xorg by default. insights.ubuntu.com. [2018-04-15]. (原始內容存檔於2018-04-17) (英語). 
  25. ^ What is QtWayland?. Qt Project Hosting. 2013-05-08 [2013-11-09]. (原始內容存檔於2015-02-20) (英語). 
  26. ^ Getting started with Lighthouse. Qt Project Hosting. 2011-06-29 [2010-12-17]. (原始內容存檔於2014-10-21) (英語). 
  27. ^ Kristian Høgsberg. Add wayland lighthouse plugin. 2011-01-25 [2013-11-09]. (原始內容存檔於2013-05-14) (英語). 
  28. ^ Martin Gräßlin. KWin runs on OpenGL ES. 2010-11-28 [2013-11-09]. (原始內容存檔於2020-11-09) (英語). It does not only help, it is a must have to start working for Wayland. So to say it’s the first part of the KWin port to Wayland 
  29. ^ Martin Gräßlin. On the Road to Modern OpenGL (ES). 2011-01-18 [2013-11-09]. (原始內容存檔於2021-12-06) (英語). 
  30. ^ Martin Gräßlin. KWin goes Wayland. 2011-06-11 [2013-11-09]. (原始內容存檔於2011-08-25) (英語). Initial Implementation of a Wayland Server in KWin. 
  31. ^ Michael Larabel. KDE Draws Up Plans For Wayland In 2012. Phoronix Media. 2011-08-07 [2013-11-09]. (原始內容存檔於2021-03-07) (英語). but the first phase (Wayland under X) should be achieved for the winter release of KDE (Software Compilation 4.8, due out next January). Martin hopes that the second phase of the Wayland upbringing, where KDE is working directly atop Wayland, will be ready for the summer 2012 release (KDE SC 4.9). 
  32. ^ GNOME 3.10 Released!. The GNOME Project. 2013-09-25 [2013-11-13]. (原始內容存檔於2021-02-05) (英語). 
  33. ^ Michael Larabel. Jolla's First Smartphone Powered By Wayland. Phoronix Media. 2013-07-13 [2013-11-09]. (原始內容存檔於2021-06-25) (英語). 

外部連結[編輯]