1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Weston/Wayland入門⑧ IVI-shellとその周辺

Last updated at Posted at 2025-07-06

Weston/Wayland入門まとめ

第6回ではivi_applicationプロトコルを扱うシェルを自作したが、Westonにはivi_applicationを実装したシェルがすでに存在している。それがIVI-shellである。

IVI-shellについては公式のドキュメントが存在しており一読はしてもらいたいところではあるが、このドキュメントだけ読んでIVI-shellが理解できるのはWestonをかなり理解している人だけなのではと思う。

そこで今回はこのIVI-shellについていままでの学習をベースに解説していく。IVIや組み込みUI系の話に興味のない方は飛ばしてしまっても構わない。

IVI-shellを起動してみる

まずはIVI-shellを起動してみよう。

$ weston --shell=ivi-shell.so

ご覧のように真っ暗な画面が表示されるのみである。試しにクライアントアプリを起動してみても画面に表示されることはない。

image.png

これは第5回で空のシェルモジュールを起動したときと同じ状況である。もちろんivi-shell.soが何もしていないということはないのだが、ウインドウの表示に関しては空のシェルモジュール同様何もしていないのである。

ところでivi-shell.soを用いての起動時、ログに以下の表示があることに気がつく。

[17:43:32.575] Registered plugin API 'ivi_layout_api_v1' of size 440

ivi-shell.soは起動時に第7回で紹介したPlugin APIを登録している。

実はIVI-shellはivi_layout APIを用いて操作することを前提としたシェル である。つまりIVI-shellを利用する場合には別途モジュールを作り、ivi_layout APIを用いてウインドウの位置やサイズ、表示・非表示を制御して始めて画面にウインドウが表示されるのである。

IVI-shellのコンセプト

上記で見たようにIVI-shellはウインドウ制御のAPIを公開している存在である。

これは、一般的なデスクトップシェル(例: xdg-shell)はクライアント主導でウインドウの位置や状態を制御するが、IVI-shellではコンポジタ側が一貫してレイアウトや表示順を管理するというコンセプトになっているためである。

このような設計は、車載システム(IVI: In-Vehicle Infotainment)のように、事前に定められたレイアウト構成や制御可能なUI階層が求められる環境に適している。

クライアントアプリケーションは、ivi_applicationプロトコルを通じて自身のサーフェスに一意のID(ivi_id)を付与するだけでよく、その後のレイアウト・表示順・サイズなどの管理はすべてコンポジタ側の責任となる。

また、コンポジタ側はあらかじめivi_idとアプリケーションの対応関係を把握している想定であり、ivi_idに基づいて必要なウインドウを所定の位置・サイズで表示することが可能となる。

hmi-controller.soについて

さてivi-layout APIを使って制御することはわかったが具体的にどのように実装していけばよいのだろうか。
実装方法を学ぶための格好の教材が存在する、それがhmi-controller.soである。

hmi-controller.soivi-layout APIを用いて実際にウインドウを制御するリファレンス実装となっている。

実際に動きを見ることもできる。Appendix A.に収録したweston.iniを用いればhmi-controller.soによるシェルの制御が起動できる。1

$ weston -c $(pwd)/weston.ini

image.png

なお見ての通りhmi-controller.soはあくまでリファレンス実装であり、プロダクトに使用されることは無いと思って良い。

wayland-ivi-extensionとivi_controllerプロトコル

このivi-layout APIをクライアントから操作できるようにするプロトコルが存在している。
それがivi_wmプロトコル2であり、ivi_wmプロトコルを実装しているのがivi-controllerモジュール(ivi-controller.so)である。

なおivi-controllerモジュールはWestonのソースコード等でたびたび言及されているもののWeston本体には収録されておらず、COVESA(旧称GENIVI)という非営利の自動車業界団体が提供するwayland-ivi-extensionリポジトリに収録されている。

第5回でシェルを作ったときに利用したEGLWLMockNavigationクライアントもこのwayland-ivi-extensionリポジトリに収録されているものである。

IVI関連コンポーネントまとめ

ivi_application プロトコル

  • クライアントがコンポジタに対して「このwl_surfaceivi_id 123のウインドウですよ」と名付けるための手段
  • コンポジタ側はivi-shell.soが実装を提供

ivi-shell.so

  • コンポジタ側のシェル実装(IVI-shell)
  • ivi_applicationプロトコルを実装
  • ivi_layout APIでの制御が前提

ivi_layout API (プロトコルではない)

  • 誰が使う?

    hmi-controller.soivi-controller.soなどWeston内の別モジュール
  • IVI-shellに登録されたウインドウ(サーフェス)/レイヤーを操作(表示位置・サイズ・可視性など)
  • ivi-shell.soがこのAPIを登録

hmi-controller.so

  • Westonモジュール
  • ivi_layout APIを使ってアプリウインドウの配置・表示制御をおこなう
  • プロダクト向けではなく、学習・デモ用途

ivi_wmプロトコル(旧名: ivi_controllerプロトコル)

  • クライアントがウインドウ(サーフェス)/レイヤーを制御するためのプロトコル
  • コンポジタ側はivi-shell.soivi-controller.soがロードされている必要がある

ivi-controller.so

  • Westonモジュール
  • ivi_wmプロトコルを処理し、ivi_layout APIを呼び出しウインドウ(サーフェス)/レイヤーの制御をおこなう
  • Weston本体には含まれず、wayland-ivi-extensionに収録されている

Appendix

Appendix A. hmi-controller.so用 weston.ini

weston.ini
[core]
shell=ivi-shell.so
modules=hmi-controller.so

[ivi-shell]
ivi-shell-user-interface=weston-ivi-shell-user-interface

#developermode=true

cursor-theme=default
cursor-size=32

base-layer-id=1000
base-layer-id-offset=10000

workspace-background-layer-id=2000
workspace-layer-id=3000
application-layer-id=4000

transition-duration=300

background-image=/usr/share/weston/background.png
background-id=1001
panel-image=/usr/share/weston/panel.png
panel-id=1002
surface-id-offset=10
tiling-image=/usr/share/weston/tiling.png
tiling-id=1003
sidebyside-image=/usr/share/weston/sidebyside.png
sidebyside-id=1004
fullscreen-image=/usr/share/weston/fullscreen.png
fullscreen-id=1005
random-image=/usr/share/weston/random.png
random-id=1006
home-image=/usr/share/weston/home.png
home-id=1007
workspace-background-color=0x99000000
workspace-background-id=2001

[ivi-launcher]
workspace-id=0
icon-id=4001
icon=/usr/share/weston/icon_ivi_flower.png
path=/usr/bin/weston-flower

[ivi-launcher]
workspace-id=0
icon-id=4002
icon=/usr/share/weston/icon_ivi_clickdot.png
path=/usr/bin/weston-clickdot

[ivi-launcher]
workspace-id=1
icon-id=4003
icon=/usr/share/weston/icon_ivi_simple-egl.png
path=/usr/bin/weston-simple-egl

[ivi-launcher]
workspace-id=1
icon-id=4004
icon=/usr/share/weston/icon_ivi_simple-shm.png
path=/usr/bin/weston-simple-shm

[ivi-launcher]
workspace-id=2
icon-id=4005
icon=/usr/share/weston/icon_ivi_smoke.png
path=/usr/bin/weston-smoke

[ivi-launcher]
workspace-id=3
icon-id=4006
icon=/usr/share/weston/icon_ivi_flower.png
path=/usr/bin/weston-flower

[ivi-launcher]
workspace-id=3
icon-id=4007
icon=/usr/share/weston/icon_ivi_clickdot.png
path=/usr/bin/weston-clickdot

[ivi-launcher]
workspace-id=3
icon-id=4008
icon=/usr/share/weston/icon_ivi_simple-egl.png
path=/usr/bin/weston-simple-egl

[ivi-launcher]
workspace-id=3
icon-id=4009
icon=/usr/share/weston/icon_ivi_simple-shm.png
path=/usr/bin/weston-simple-shm

[ivi-launcher]
workspace-id=3
icon-id=4010
icon=/usr/share/weston/icon_ivi_smoke.png
path=/usr/bin/weston-smoke
  1. なぜか現状Debian/Ubuntuではwestonパッケージにhmi-controller.soを起動するための適切なweston.iniが用意されていないため、やむをえず付録に収録した。

  2. 以前(10年ほど前)はivi_controllerプロトコルという名前だった。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?