summaryrefslogtreecommitdiffstats
path: root/docs/2-waltham-how-to-build.md
blob: 189bd2c7e4af3a71fc0b18bf221b8d4a1d6fd944 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
**Table of Content**

1. TOC
{:toc}

## Important notice

Do note that even though waltham-transmitter can be built, AGL will no longer
use weston as its default compositor, and although it relies on it (more
exactly it uses its underlying library -- libweston), the following
build instructions are most likely just a guide, and not a verified
walk-through that reflects the current status. They all assume that you'll use
weston and with it ivi-shell, which is not longer the case in AGL.

Integration with the newer compositor is at this point in a WIP state.

## Information
Please also refer [Readme](https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/weston-ivi-plugins.git;a=tree;h=refs/heads/master;hb=refs/heads/master) in source repository.

## How to build waltham-transmitter
1. Prerequisite before building
   AGL Image is already built. Please refer [here](https://docs.automotivelinux.org/docs/en/master/getting_started/reference/getting-started/image-workflow-build.html)

2. Go to AGL build folder and configure your environment.
```
       $ cd $AGL_TOP
       $ source meta-agl/scripts/aglsetup.sh
```
3. Build waltham-transmitter by using bitbake.

Since waltham-transmitter is not built by default, this step is mandatory.

```
       $ bitbake waltham-transmitter
```

4. You can find the built results under $AGL_TOP/build/tmp/work/<board type>/waltham-transmitter/git-r0/image/
   - usr/bin/waltham-receiver
   - usr/lib/transmitter.so
   - usr/lib/waltham-renderer.so

## How to configure weston.ini and GStreamer pipeline

### weston.ini

In order to load waltham-transmitter plugin to weston, add "transmitter.so" to
the "modules" key under "[core]" in weston.ini at transmitter side,
then make sure the "shell" is configured as "ivi-shell.so".

The destination of remoting also needs to be configured in weston.ini.
Add output name, receiver IP address, port number, output's width and height
key under "[transmitter-output]". You can speficy multiple [transmitter-output]
with different output-name.

```
/* Example_weston.ini - single transmitter-output */

	[core]
	shell=ivi-shell.so
	modules=systemd-notify.so,ivi-controller.so,transmitter.so

	[ivi-shell]
	ivi-module=ivi-controller.so
	ivi-input-module=ivi-input-controller.so

	[transmitter-output]
	output-name=transmitter_1
	server-address=192.168.2.52
	port=34400
	width=1920
	height=1080

```

### GStreamer pipeline

You can use GStreamer pipeline as you want. Please describe pipeline
configuration in "/etc/xdg/weston/pipeline.cfg".
Here are some examples.

```

/* General pipeline which does not use any HW encoder */
	appsrc name=src ! videoconvert ! video/x-raw,format=I420 ! jpegenc ! \
		rtpjpegpay ! udpsink name=sink host=YOUR_RECIEVER_IP \
		port=YOUR_RECIEVER_PORT sync=false async=false

/* pipeline to use Intel's HW encoder */
	appsrc name=src ! videoconvert ! video/x-raw,format=I420 ! \
			mfxh264enc bitrate=3000000 rate-control=1 ! rtph264pay config-interval=1 ! \
			udpsink name=sink host=YOUR_RECIEVER_IP port=YOUR_RECIEVER_PORT \
			sync=false async=false

/* pipeline to use Rcar's HW encoder */
	appsrc name=src ! videoconvert ! video/x-raw,format=I420 ! \
				omxh264enc bitrate=3000000 control-rate=2 ! rtph264pay ! \
				udpsink name=sink host=YOUR_RECIEVER_IP port=YOUR_RECIEVER_PORT \
				sync=false async=false

```

## Connection Establishment

1. Connect two boards over ethernet.
2. Assign IP to both boards.
```Example:
	transmitter IP: 192.168.2.51
	waltham-receiver IP: 192.168.2.52
```
3. Check if the simple ping works
```
        $ ping 192.168.2.52 (you can also ping vice versa)
```

## Example steps to start remoting

1. Start target boards.

transmitter side must have the above 2 files, the modified weston.ini and
GStreamer pipeline,cfg.  You can confirm that transmitter is loaded properly
from weston log as below.

```
/* Example(/run/platform/display/weston.log) */
	[12:28:09.127] Loading module '/usr/lib/weston/transmitter.so'
	[12:28:09.182] Registered plugin API 'transmitter_v1' of size 88
	[12:28:09.183] Registered plugin API 'transmitter_ivi_v1' of size 16
	[12:28:09.186] Loading module '/usr/lib/libweston-6/waltham-renderer.so'
	[12:28:09.255] Transmitter initialized.
	[12:28:09.255] transmitter_output_attach_head is called
	[12:28:09.255] Weston head attached successfully to output
	[12:28:09.255] Output 'transmitter-192.168.2.52:34400-1' enabled with head(s) transmitter-192.168.2.52:34400-1
	[12:28:09.255] Transmitter weston_seat 0xaaab2209c800
	[12:28:09.255] Transmitter created pointer=0xaaab220e6b50 for seat 0xaaab2209c800
	[12:28:09.255] Transmitter created keyboard=0xaaab22038e60 for seat 0xaaab2209c800
	[12:28:09.255] Transmitter created touch=0xaaab220c7930 for seat 0xaaab2209c800
```

2. [receiver side] Start receiver application.

The below example shows the case if you use waltham-receiver as receiver application.

1. Add surface to the display where you want to receive transmitted contents.
You can check which output name is required by using the command
`LayerManagerControl get scene`.

```
	$ layer-add-surfaces -s <surface count> -l <layer id> -d <output display name> &
/* Example */
	$ layer-add-surfaces -s 1 -l 1 -d HDMI-A-1 &
```
2. Start waltham-receiver. You can use debug option with "-v" if you want.
```
	$ waltham-receiver -p 34400 -v &
```

3. Now, receiver side is waiting for the contents coming from transmitter side.

**You must configure and start receiver side first.**

4. [transmitter side] Start an IVI application
5. Put the surface of IVI application onto transmitter-output by using
   LayerManagerControl command.

This surface will be transmitted.

```
	$ layer-add-surfaces -d <transmitter -output name> -s <surface count on receiver> -l <layer id on receiver>
/* Example */
	$ layer-add-surfaces -d transmitter-192.168.2.52:34400-1 -s 1 -l 1 &
```

5. [transmitter side] make sure that weston.log shows remoting has been started.

```
/* Example(/run/platform/display/weston.log) */
	[12:29:33.224] surface ID 1
	[12:29:40.622] gst-setting are :-->
	[12:29:40.622] ip = 192.168.2.52
	[12:29:40.622] port = 34400
	[12:29:40.622] bitrate = 3000000
	[12:29:40.622] width = 1080
	[12:29:40.622] height = 1920
	[12:29:42.177] Parsing GST pipeline:appsrc name=src ! videoconvert ! video/x-raw,format=I420 ! jpegenc ! rtpjjpegpay ! udpsink name=sink host=192.168.2.52 port=3440 sync=false async=false
```

## Typical issues & Tips

### help functions
You can find the help information of LayerManagerControl command by using

```
$ LayerManagerControl help
```

### waltham-transmitter and waltham-receiver doesn't not communicate

1. Please check ethernet connection. If you assign 192.168.2.51 and
   192.168.2.52 for waltham-transmitter and waltham-receiver, you shall ping
   vice versa.

```
/* At waltham-transmitter side */
	$ ping 192.168.2.52

/* At waltham-receiver side */
	$ ping 192.168.2.51
```

2. Make sure that IP address specified in the weston.ini under
   [transmitter-output] matches the waltham-receiver IP address.

3. Make sure that IP address in pipeline.cfg on the transmitter side match the
   waltham-receiver's IP address.

### surface,layer or output information is unknown.
You can check them by using the below command.

```
	$ LayerManagerControl get scene

/* Example */
	screen 0 (0x0)
	---------------------------------------
	- connector name:       HDMI-A-1
	- resolution:           x=1024, y=768
	- layer render order:   100(0x64),

	    layer 100 (0x64)
	    ---------------------------------------
	    - destination region:   x=296, y=0, w=432, h=768
	    - source region:        x=0, y=0, w=432, h=768
	    - opacity:              1
	    - visibility:           1
	    - surface render order: 1(0x1),
	    - on screen:            0(0x0)

	        surface 1 (0x1)
	        ---------------------------------------
			- created by pid:       3338
	        - original size:      x=432, y=768
	        - destination region: x=0, y=0, w=432, h=768
		- source region:      x=0, y=0, w=432, h=768
		- opacity:            1
		- visibility:         1
		- frame counter:      47
		- on layer:           100(0x64)

	screen 1 (0x1)
	---------------------------------------
	- connector name:       transmitter-192.168.2.52:34400-1
	- resolution:           x=1920, y=1080
	- layer render order:

	/* You can know the output name for remoting is "transmitter-192.168.2.52:34400-1" */
```