Diagram has one semantic issue: the ivi-controller.xml removed and we have ivi-wm.xml instead the ivi-controller.so is still there [图片中的ivi-controller.xml已经被替换为ivi-wm.xml]
图有一个语义问题:去掉了ivi-controller.xml,我们用ivi-wm.xml代替了ivi-controller。所以仍然存在(图片中的ivi-controller.xml已经被替换为ivi-wm.xml]
完整的组件图
完整的组件图,其中蓝色部分是wayland-ivi-extension提供,其他颜色则为wayland以及wayland在linux上的其他组件。
Layer Manager APIs: three shared libraries to be compatible with IVI Layer Management: http://projects.genivi.org/ivi-layer-management. These internally use ivi-application/ivi-controller protocol. This means developer also directly uses ivi-application/ivi-controller protocol to manage wayland surfaces without Layer Manager APIs.
ivi-controller: A shared library to export ivi-layout interfaces via ivi-controller protocol.
ivi-layout inteface: compatible with IVI Layer Management APIs. These internal APIs allow developers to develop an window manager in weston process with IVI Layer Management like APIs.
HMI Controller: provided as a module which shall be loaded on ivi-shell. This is a reference implementation how to use ivi-layout library. This shall be exclusively used with ivi-controller. In other words, developer shall decide how to implement own window manager with either using ivi-controller.so or ivi-layout interface inside of weston.
ivi-shell: realize ivi-application protocol and framework to load ivi-controller.so (or hmi-controller) as ivi-module to use ivi-layout interfaces.
Definitions
Wayland IVI Extension is loaded as ivi-module in ivi-shell + Weston. These modules are configured to be loaded by using weston.ini.
Weston will load ivi-shell.so to enable ivi features. ivi-shell.so will load ivi-controller.so which implements server side of ivi-controller.xml protocol.
IVI Scene Logical container for multiple screens, layers and surfaces.
IVI Surface Represents graphical content of an application. One application can provide several surfaces.
IVI Layer Logical container for multiple surfaces usually attached to one ivi screen
IVI Screen Logical container for multiple layers usualy corresponds to concrete display
IVI In Vehicle Infotainment
RenderOrder Logical arrangements of surfaces or layers, first element of the list is on bottom, last element is on top
IVI Application client application for ivi. Predefined numeric ID shall be assigned to each ivi application to be identified by HMI Central Controller.
Applications basically use the wayland core protocol defined by Wayland (e.g connection to display, wl_display and so on) to draw their contents. Weston also supports implementing our own shell which defines management of surfaces. For example, the positioning of a surface can be implemented in the shell. Without a shell, there is no composition of surface in screen. By default, the shell in Weston is "desktop-shell" which supports wl_shell. Wayland IVI Extension uses the ivi-shell to manage surfaces, whose shell protocol is ivi-application.xml. Applications must support the ivi-application protocol to be managed by the HMI central controller with an unique numeric ID.
ivi controller[edit] ivi controller is a extension protocol defined in this project wayland-ivi-extension. It exports surface/layer/screen management protocol to make each product scene
ivi input ivi-input is enabled when ivi-input.so is added after ivi-controll.so in weston.ini. Without ivi-input, input handling is the same as normal desktop style; a top focused surface will be received when input event. Refer Wayland_IVI_Extension_Design_ivi_input
HMI Controller/Central Controller Window Manager which is responsible to controll the composition and input routing
HMI Human-Machine Interface
对应源代码
https://github.com/GENIVI/wayland-ivi-extension
Sections in this file describe:
- How to build
- Example applications
- How to test
How to build on different platforms
====================================
Pre-requisite:
- Weston
- CMake required (version 2.6 or higher)
- Open GLES and EGL for example applications
- Gtest for the test suite
Build up
1. Pull the current codebase form the git repo
E.g. git clone https://github.com/GENIVI/wayland-ivi-extension.git
2. Create a build directory
E.g mkdir build_ivi_extension
3. In <build-dir> Generate build system for your platform using CMake.
E.g. cd <build-dir>
cmake -DCMAKE_TOOLCHAIN_FILE=<your setting *.cmake> ../
4. Start the build and install
E.g. sudo make install
Example applications
====================================
Pre-requisite:
- Modify weston.ini to use ivi-shell.so
Example:
[core]
shell=ivi-shell.so
modules=ivi-controller.so
[ivi-shell]
ivi-input-module=ivi-input-controller.so
- Set Environmental values
Example:
export XDG_RUNTIME_DIR=/var/run/<your user name>/1000
export LD_LIBRARY_PATH=<your installation path>/lib
Start-up Weston:
Example: <your installation path>/bin/weston
Start-up HMI helper:
Example: <your installation path>/bin/layer-add-surfaces 1000 1
EGLWLMockNavigation:
Example: <your installation path>/bin/EGLWLMockNavigation
How to test
====================================
1. Build the testsuite by setting BUILD_ILM_API_TESTS option.
Example: cmake -DBUILD_ILM_API_TESTS
2. After starting up Weston run the testsuite.
Example: <your installation path>/bin/ivi-layermanagement-api-test
1.最上面本来是两张500*500的图片
2.将第一张图从(10.10)开始截取一个(480*480)大小的图。第二张图不设置,任然500*500. –》surface source region
3.将第一张图放在layer0(500,10)的位置,并且缩放成大小是900*480的大小【由于layer的总大小只有1000*500,所以只能放进去一部分,其余部分丢失】;第二张图未设置从(0,0)位置放置,大小任然是500*500;;;另外将第二张图放入layer1 --》surface destination region
4.放图后的layer内容;将layer1的大小改成从(10,10)开始的480*480大小。 --》layer source region
5.将layer0放入screen0,从screen0的(0,0)开始放置,,将layer0的大小缩放为500*500;screen的大小为500*500;;将layer1的内容放置到screen1,从screen的(10,10)放置,将layer1的内容缩放至480*480;--》layer destination region
需要的工具:
1.layer-add-surface
root@:~# layer-add-surfaces --help
-h, --help display this help and exit.
-d, --display-name name of the display which will be used,
e.g.: HDMI-A-1, LVDS1
If it is not set, display with highest resolution is used.
-l, --layer-id id of the used ILM layer. It has to be set
-s, --surface-count number of surfaces which will be added to
the layer. It has to be set
2.LayerManagerControl
LayerManagerControl
help: supported commands:
add surface <sid> to layer <lid>
analyze surface <surfaceid>
create layer <layerid> <width> <height>
destroy layer <id>
dump screen|surface <id> to <file>
export scene to <filename>
export xtext to <filename> <grammar> <url>
get input device <name> capabilities
get input devices with pointer|keyboard|touch|all
get input focus
get scene|screens|layers|surfaces
get screen|layer|surface <id>
get surface <surfaceid> input acceptance
help
remove surface <sid> from layer <lid>
set layer|surface <id> destination region <x> <y> <w> <h>
set layer|surface <id> opacity <opacity>
set layer|surface <id> source region <x> <y> <w> <h>
set layer|surface <id> visibility <visibility>
set screen|layer <id> render order [<idarray>]
set surface <surfaceid> input acceptance to [<namearray>]
set surface <surfaceid> type <type>
set|unset surfaces [<idarray>] input focus pointer|keyboard|touch|all
test notification layer <layerid>
tree //此命令可以告诉你所有的LayerManagerControl的命令
watch layer|surface <idarray>
root@:~# LayerManagerControl tree
help: supported commands:
[root]
|--add
| |--surface
| | |--<sid>
| | | |--to
| | | | |--layer
| | | | | |--<lid>*
|--analyze
| |--surface
| | |--<surfaceid>*
|--create
| |--layer
| | |--<layerid>
| | | |--<width>
| | | | |--<height>*
|--destroy
| |--layer
| | |--<id>*
|--dump
| |--screen|surface
| | |--<id>
| | | |--to
| | | | |--<file>*
|--export
| |--scene
| | |--to
| | | |--<filename>*
| |--xtext
| | |--to
| | | |--<filename>
| | | | |--<grammar>
| | | | | |--<url>*
|--get
| |--input
| | |--device
| | | |--<name>
| | | | |--capabilities*
| | |--devices
| | | |--with
| | | | |--pointer|keyboard|touch|all*
| | |--focus*
| |--scene|screens|layers|surfaces*
| |--screen|layer|surface
| | |--<id>*
| |--surface
| | |--<surfaceid>
| | | |--input
| | | | |--acceptance*
|--help*
|--remove
| |--surface
| | |--<sid>
| | | |--from
| | | | |--layer
| | | | | |--<lid>*
|--set
| |--layer|surface
| | |--<id>
| | | |--destination
| | | | |--region
| | | | | |--<x>
| | | | | | |--<y>
| | | | | | | |--<w>
| | | | | | | | |--<h>*
| | | |--opacity
| | | | |--<opacity>*
| | | |--source
| | | | |--region
| | | | | |--<x>
| | | | | | |--<y>
| | | | | | | |--<w>
| | | | | | | | |--<h>*
| | | |--visibility
| | | | |--<visibility>*
| |--screen|layer
| | |--<id>
| | | |--render
| | | | |--order
| | | | | |--[<idarray>]*
| |--surface
| | |--<surfaceid>
| | | |--input
| | | | |--acceptance
| | | | | |--to
| | | | | | |--[<namearray>]*
| | | |--type
| | | | |--<type>*
|--set|unset
| |--surfaces
| | |--[<idarray>]
| | | |--input
| | | | |--focus
| | | | | |--pointer|keyboard|touch|all*
|--test
| |--notification
| | |--layer
| | | |--<layerid>*
|--tree*
|--watch
| |--layer|surface
| | |--<idarray>*
使用实例
$ layer-add-surface 1 1000& 添加surface
$ export XDG_RUNTIME_DIR=/var/run/user/1000
$ weston & //打开weston
$ LayerManagerControl create layer 1000 600 400 //创建layer;id为1000. 宽600.长400
$ LayerManagerControl set layer 1000 render order 10 //为layer1000链接上id为10的surface
$ LayerManagerControl set surface 10 source region 0 0 600 400 //将surface10 的内容从(0,0)开始截取一个600*400的范围
$ LayerManagerControl set surface 10 destination region 0 0 600 400 //将surface截取后的内容放置到layer(0,0)的位置,缩放为600*400的大小
$ LayerManagerControl set screen 0 render order 1000 //将screen0与layer1000链接
$ LayerManagerControl set layer 1000 visibility 1 //将layer1000设置为可见
$ LayerManagerControl set surface 10 visibility 1 //将surface设置为可见