xref: /aosp_15_r20/external/igt-gpu-tools/docs/chamelium.txt (revision d83cc019efdc2edc6c4b16e9034a3ceb8d35d77c)
1*d83cc019SAndroid Build Coastguard WorkerChamelium Support in IGT
2*d83cc019SAndroid Build Coastguard Worker========================
3*d83cc019SAndroid Build Coastguard Worker
4*d83cc019SAndroid Build Coastguard WorkerThis document provides information, instructions and a tasks list for Chamelium
5*d83cc019SAndroid Build Coastguard Workersupport in IGT.
6*d83cc019SAndroid Build Coastguard Worker
7*d83cc019SAndroid Build Coastguard WorkerIntroduction
8*d83cc019SAndroid Build Coastguard Worker------------
9*d83cc019SAndroid Build Coastguard Worker
10*d83cc019SAndroid Build Coastguard WorkerThe Chamelium is a platform that acts as a display monitor emulator. It provides
11*d83cc019SAndroid Build Coastguard Workeradvanced access and control over the various signals a display receives.
12*d83cc019SAndroid Build Coastguard Worker
13*d83cc019SAndroid Build Coastguard WorkerAs such, it allows testing display features that can otherwise not be tested in
14*d83cc019SAndroid Build Coastguard WorkerIGT without external hardware.
15*d83cc019SAndroid Build Coastguard Worker
16*d83cc019SAndroid Build Coastguard WorkerThe platform was developed by Google in order to test display and audio-related
17*d83cc019SAndroid Build Coastguard Workerfeatures of ChromeOS devices. It was initially developed internally by Google as
18*d83cc019SAndroid Build Coastguard Workerpart of the ChromeOS effort under the name Chameleon and was later made external
19*d83cc019SAndroid Build Coastguard Workeras part of the ChromiumOS effort, under the name Chamelium.
20*d83cc019SAndroid Build Coastguard Worker
21*d83cc019SAndroid Build Coastguard WorkerIt consists of a custom-made display emulator board connected to an Arrow SoCKit
22*d83cc019SAndroid Build Coastguard Workervia a flexible cable, with two DisplayPort connectors, one HDMI and one VGA.
23*d83cc019SAndroid Build Coastguard Worker
24*d83cc019SAndroid Build Coastguard WorkerThe SoCKit uses a Cyclone V SoC, with both a FPGA and an ARM CPU. While the FPGA
25*d83cc019SAndroid Build Coastguard Workeris used for logic control, the CPU runs daemons that allow the board to be
26*d83cc019SAndroid Build Coastguard Workercontrolled over the network via a XMLRPC interface.
27*d83cc019SAndroid Build Coastguard Worker
28*d83cc019SAndroid Build Coastguard WorkerDocumentation
29*d83cc019SAndroid Build Coastguard Worker-------------
30*d83cc019SAndroid Build Coastguard Worker
31*d83cc019SAndroid Build Coastguard WorkerDocumentation about the Chamelium is made available by Google through the
32*d83cc019SAndroid Build Coastguard WorkerChromiumOS projet wiki: https://www.chromium.org/chromium-os/testing/chamelium
33*d83cc019SAndroid Build Coastguard Worker
34*d83cc019SAndroid Build Coastguard WorkerDeploying the Chamelium With IGT
35*d83cc019SAndroid Build Coastguard Worker--------------------------------
36*d83cc019SAndroid Build Coastguard Worker
37*d83cc019SAndroid Build Coastguard WorkerInstructions from the ChromiumOS wiki detail how to setup the Chamelium:
38*d83cc019SAndroid Build Coastguard Workerhttps://www.chromium.org/chromium-os/testing/chamelium#TOC-Setting-up-Chamelium
39*d83cc019SAndroid Build Coastguard Worker
40*d83cc019SAndroid Build Coastguard WorkerThe should be followed up until the "Setup your Linux host, DUT and the FPGA"
41*d83cc019SAndroid Build Coastguard Workersection. At this point, IGT has to be configured to connect to the Chamelium.
42*d83cc019SAndroid Build Coastguard Worker
43*d83cc019SAndroid Build Coastguard WorkerIt may be necessary to give the Chamelium a static IP address, depending on
44*d83cc019SAndroid Build Coastguard Workerthe network setup. This can be configured (via the serial console) by editing
45*d83cc019SAndroid Build Coastguard Workerthe Debian-styled /etc/network/interfaces configuration file. Example setup:
46*d83cc019SAndroid Build Coastguard Worker
47*d83cc019SAndroid Build Coastguard Worker    sudo screen /dev/ttyUSB0 115200
48*d83cc019SAndroid Build Coastguard Worker    sudo vi /etc/network/interfaces
49*d83cc019SAndroid Build Coastguard Worker
50*d83cc019SAndroid Build Coastguard Workerand then configure eth0 like so:
51*d83cc019SAndroid Build Coastguard Worker
52*d83cc019SAndroid Build Coastguard Worker    iface eth0 inet static
53*d83cc019SAndroid Build Coastguard Worker        address 192.168.1.2
54*d83cc019SAndroid Build Coastguard Worker        netmask 255.255.255.0
55*d83cc019SAndroid Build Coastguard Worker        gateway 192.168.1.1
56*d83cc019SAndroid Build Coastguard Worker
57*d83cc019SAndroid Build Coastguard WorkerThis document supposes that target PC's network IP has "192.168.1.1/24" and
58*d83cc019SAndroid Build Coastguard Workerthe Chamelium's network IP has "192.168.1.2/24".
59*d83cc019SAndroid Build Coastguard Worker
60*d83cc019SAndroid Build Coastguard WorkerChamelium support requires setting up dedicated IGT configuration, as explained
61*d83cc019SAndroid Build Coastguard Workerin the Core and Chamelium parts of the IGT API Reference in the documentation.
62*d83cc019SAndroid Build Coastguard Worker
63*d83cc019SAndroid Build Coastguard WorkerNote that running the chamelium tests with the Chamelium configuration deployed
64*d83cc019SAndroid Build Coastguard Workerand the Chamelium disconnected or unreachable will result in network timeouts
65*d83cc019SAndroid Build Coastguard Workerthat take seconds. It is thus preferable (especially in the case of an automated
66*d83cc019SAndroid Build Coastguard WorkerCI system with a shared testlist) to remove the Chamelium configuration from the
67*d83cc019SAndroid Build Coastguard Workerhosts that shouldn't connect to the Chamelium so that they can be skipped, which
68*d83cc019SAndroid Build Coastguard Workeris faster than a network timeout.
69*d83cc019SAndroid Build Coastguard Worker
70*d83cc019SAndroid Build Coastguard WorkerIt should also be noted that each Chamelium platform should only be used for
71*d83cc019SAndroid Build Coastguard Workertesting a single target device at a time. This is because the reset call issued
72*d83cc019SAndroid Build Coastguard Workerby the IGT tests is common to all connectors and thus one machine running a test
73*d83cc019SAndroid Build Coastguard Workeron a given connector may reset the Chamelium while another machine is running
74*d83cc019SAndroid Build Coastguard Workera test on another connector.
75*d83cc019SAndroid Build Coastguard Worker
76*d83cc019SAndroid Build Coastguard WorkerIGT's behavior can be configured through a configuration file.
77*d83cc019SAndroid Build Coastguard WorkerBy default, this file is expected to exist in ~/.igtrc
78*d83cc019SAndroid Build Coastguard WorkerIn order to run tests using the Chamelium, a valid configuration file must be
79*d83cc019SAndroid Build Coastguard Workerpresent. It must contain Chamelium-specific keys as shown with the following
80*d83cc019SAndroid Build Coastguard Workerexample (only Chamelium.URL is mandatory):
81*d83cc019SAndroid Build Coastguard Worker
82*d83cc019SAndroid Build Coastguard Worker    # The common configuration section follows.
83*d83cc019SAndroid Build Coastguard Worker    [Common]
84*d83cc019SAndroid Build Coastguard Worker    # The path to dump frames that fail comparison checks
85*d83cc019SAndroid Build Coastguard Worker    FrameDumpPath=/root/
86*d83cc019SAndroid Build Coastguard Worker
87*d83cc019SAndroid Build Coastguard Worker    # The following section is used for configuring the Device Under Test.
88*d83cc019SAndroid Build Coastguard Worker    # It is not mandatory and allows overriding default values.
89*d83cc019SAndroid Build Coastguard Worker    [DUT]
90*d83cc019SAndroid Build Coastguard Worker    SuspendResumeDelay=15
91*d83cc019SAndroid Build Coastguard Worker
92*d83cc019SAndroid Build Coastguard Worker    [Chamelium]
93*d83cc019SAndroid Build Coastguard Worker    # The URL used for connecting to the Chamelium's RPC server
94*d83cc019SAndroid Build Coastguard Worker    URL=http://192.168.1.2:9992
95*d83cc019SAndroid Build Coastguard Worker
96*d83cc019SAndroid Build Coastguard Worker    # The rest of the sections are used for defining connector mappings. This
97*d83cc019SAndroid Build Coastguard Worker    # is optional, the mappings will be discovered automatically.
98*d83cc019SAndroid Build Coastguard Worker
99*d83cc019SAndroid Build Coastguard Worker    # The name of the DRM connector
100*d83cc019SAndroid Build Coastguard Worker    # The DP-1 of [Chamelium:DP-1] and the HDMI-A-1 of [Chamelium:HDMI-A-1] indicate
101*d83cc019SAndroid Build Coastguard Worker    # "connector info type" of /sys/kernel/debug/dri/0/i915_display_info.
102*d83cc019SAndroid Build Coastguard Worker    [Chamelium:DP-1]
103*d83cc019SAndroid Build Coastguard Worker    # The ChameliumPortID indicates physical port (device) id of a Chamelium Board.
104*d83cc019SAndroid Build Coastguard Worker    # A Chamelium daemon program defines these port ids as
105*d83cc019SAndroid Build Coastguard Worker    # DP1 (located next to the HDMI port) = 1
106*d83cc019SAndroid Build Coastguard Worker    # DP2 (located next to the VGA connector) = 2
107*d83cc019SAndroid Build Coastguard Worker    # HDMI = 3 and VGA = 4
108*d83cc019SAndroid Build Coastguard Worker    # The port ids are defined at:
109*d83cc019SAndroid Build Coastguard Worker    # https://chromium.googlesource.com/chromiumos/platform/chameleon/+/master/chameleond/utils/ids.py
110*d83cc019SAndroid Build Coastguard Worker    ChameliumPortID=1
111*d83cc019SAndroid Build Coastguard Worker
112*d83cc019SAndroid Build Coastguard Worker    [Chamelium:HDMI-A-2]
113*d83cc019SAndroid Build Coastguard Worker    ChameliumPortID=3
114*d83cc019SAndroid Build Coastguard Worker
115*d83cc019SAndroid Build Coastguard Worker    [Chamelium:VGA-1]
116*d83cc019SAndroid Build Coastguard Worker    ChameliumPortID=4
117*d83cc019SAndroid Build Coastguard Worker
118*d83cc019SAndroid Build Coastguard WorkerRunning the Chamelium With IGT
119*d83cc019SAndroid Build Coastguard Worker------------------------------
120*d83cc019SAndroid Build Coastguard Worker
121*d83cc019SAndroid Build Coastguard Worker$ ./scripts/run-tests.sh -t chamelium
122*d83cc019SAndroid Build Coastguard Worker
123*d83cc019SAndroid Build Coastguard WorkerDebugging the Chamelium
124*d83cc019SAndroid Build Coastguard Worker-----------------------
125*d83cc019SAndroid Build Coastguard Worker
126*d83cc019SAndroid Build Coastguard WorkerIt is possible to manually send Chamelium RPC calls with the xmlrpc utility
127*d83cc019SAndroid Build Coastguard Worker(from xmlrpc-c). For instance, to plug the DisplayPort port:
128*d83cc019SAndroid Build Coastguard Worker$ xmlrpc http://192.168.1.2:9992 Plug i/1
129*d83cc019SAndroid Build Coastguard Worker
130*d83cc019SAndroid Build Coastguard WorkerThe xmlrpc utility documentation is available at:
131*d83cc019SAndroid Build Coastguard Workerhttp://xmlrpc-c.sourceforge.net/doc/xmlrpc.html
132*d83cc019SAndroid Build Coastguard Worker
133*d83cc019SAndroid Build Coastguard WorkerThe XML-RPC Chamelium interface is described here:
134*d83cc019SAndroid Build Coastguard Workerhttps://chromium.googlesource.com/chromiumos/platform/chameleon/+/refs/heads/master/chameleond/interface.py
135*d83cc019SAndroid Build Coastguard Worker
136*d83cc019SAndroid Build Coastguard WorkerLogs that may be useful for debugging can be obtained either by connecting to
137*d83cc019SAndroid Build Coastguard Workerthe board via SSH or serial console and looking at the daemon logs from
138*d83cc019SAndroid Build Coastguard Worker/var/log, such as:
139*d83cc019SAndroid Build Coastguard Worker$ tail -f /var/log/chameleon*
140*d83cc019SAndroid Build Coastguard Worker
141*d83cc019SAndroid Build Coastguard WorkerDaemon Source, Build and Deploy
142*d83cc019SAndroid Build Coastguard Worker-------------------------------
143*d83cc019SAndroid Build Coastguard Worker
144*d83cc019SAndroid Build Coastguard WorkerSource code for the daemon running on the Chamelium is available at:
145*d83cc019SAndroid Build Coastguard Workerhttps://chromium.googlesource.com/chromiumos/platform/chameleon/
146*d83cc019SAndroid Build Coastguard Worker
147*d83cc019SAndroid Build Coastguard WorkerBuilding the daemon requires a GNU EABI ARMv7 GCC toolchain, that must be
148*d83cc019SAndroid Build Coastguard Workerspecified via the CC variable, such as:
149*d83cc019SAndroid Build Coastguard Worker$ make CC=arm-linux-gnueabihf-gcc
150*d83cc019SAndroid Build Coastguard Worker
151*d83cc019SAndroid Build Coastguard WorkerThe result can be deployed to the chamelium with the remote-install target and
152*d83cc019SAndroid Build Coastguard Workerspecifying the network address for the chamelium via the CHAMELEON_HOST
153*d83cc019SAndroid Build Coastguard Workervariable, such as:
154*d83cc019SAndroid Build Coastguard Worker$ make remote-install CHAMELEON_HOST=192.168.72.1
155*d83cc019SAndroid Build Coastguard Worker
156*d83cc019SAndroid Build Coastguard WorkerThe process requires the Chamelium to be connected to the Internet to succeed.
157*d83cc019SAndroid Build Coastguard Worker
158*d83cc019SAndroid Build Coastguard WorkerAudio Capture
159*d83cc019SAndroid Build Coastguard Worker-------------
160*d83cc019SAndroid Build Coastguard Worker
161*d83cc019SAndroid Build Coastguard WorkerThe Chamelium supports audio capture. IGT tests take advantage of the
162*d83cc019SAndroid Build Coastguard WorkerChamelium streaming server to download audio samples from the Chamelium.
163*d83cc019SAndroid Build Coastguard Worker
164*d83cc019SAndroid Build Coastguard WorkerIGT needs direct access to audio devices through ALSA, so PulseAudio needs to
165*d83cc019SAndroid Build Coastguard Workerbe stopped (otherwise audio tests will automatically get skipped). To make sure
166*d83cc019SAndroid Build Coastguard WorkerPulseAudio isn't running:
167*d83cc019SAndroid Build Coastguard Worker
168*d83cc019SAndroid Build Coastguard Worker- Edit /etc/pulse/client.conf and add autospawn=no
169*d83cc019SAndroid Build Coastguard Worker- Run `pulseaudio --kill` (if it succeeds, it means PulseAudio was running)
170*d83cc019SAndroid Build Coastguard Worker- Make sure a DE that automatically spawns PulseAudio isn't running
171*d83cc019SAndroid Build Coastguard Worker
172*d83cc019SAndroid Build Coastguard WorkerIn case a test fails, the raw captured audio files will be dumped in a WAV
173*d83cc019SAndroid Build Coastguard Workerfile.
174*d83cc019SAndroid Build Coastguard Worker
175*d83cc019SAndroid Build Coastguard WorkerContributing Changes to the Daemon
176*d83cc019SAndroid Build Coastguard Worker----------------------------------
177*d83cc019SAndroid Build Coastguard Worker
178*d83cc019SAndroid Build Coastguard WorkerContributions to the Chamelium daemon, just like any contribution to ChromiumOS,
179*d83cc019SAndroid Build Coastguard Workerare submitted and reviewed at: https://chromium-review.googlesource.com/
180*d83cc019SAndroid Build Coastguard Worker
181*d83cc019SAndroid Build Coastguard WorkerThe ChromiumOS project provides an extensive developer guide:
182*d83cc019SAndroid Build Coastguard Workerhttps://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md
183*d83cc019SAndroid Build Coastguard WorkerIt assumes running within the ChromiumOS build system. Since this is likely not
184*d83cc019SAndroid Build Coastguard Workerthe case for contributing to the Chamelium daemon, only the part about
185*d83cc019SAndroid Build Coastguard Workeruploading changes is relevant:
186*d83cc019SAndroid Build Coastguard Workerhttps://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md#Upload-your-changes-and-get-a-code-review
187*d83cc019SAndroid Build Coastguard Worker
188*d83cc019SAndroid Build Coastguard WorkerMost of the process is about using the Gerrit web interface for submitting and
189*d83cc019SAndroid Build Coastguard Workerhaving the change reviewed and not forgetting the Change-Id, TEST= and BUG=
190*d83cc019SAndroid Build Coastguard Workerfields in the commit.
191*d83cc019SAndroid Build Coastguard Worker
192*d83cc019SAndroid Build Coastguard WorkerCurrent Support in IGT
193*d83cc019SAndroid Build Coastguard Worker----------------------
194*d83cc019SAndroid Build Coastguard Worker
195*d83cc019SAndroid Build Coastguard WorkerSupport for the Chamelium platform in IGT is found in the following places:
196*d83cc019SAndroid Build Coastguard Worker* lib/igt_chamelium.c: library with Chamelium-related helpers
197*d83cc019SAndroid Build Coastguard Worker* tests/kms_chamelium.c: sub-tests using the Chamelium
198*d83cc019SAndroid Build Coastguard Worker
199*d83cc019SAndroid Build Coastguard WorkerAs of early April 2019, the following features are tested by IGT:
200*d83cc019SAndroid Build Coastguard Worker* Pixel-by-pixel frame integrity tests for DP and HDMI
201*d83cc019SAndroid Build Coastguard Worker* Error-trend-based frame integrity tests for VGA
202*d83cc019SAndroid Build Coastguard Worker* CRC-based frame integrity tests for DP and HDMI
203*d83cc019SAndroid Build Coastguard Worker* Hotplug event simple tests for all interfaces
204*d83cc019SAndroid Build Coastguard Worker* Hotplug event stressing tests, emulating a flaky cable for DisplayPort and
205*d83cc019SAndroid Build Coastguard Worker  HDMI
206*d83cc019SAndroid Build Coastguard Worker* Hotplug event during suspend test for all interfaces, either separately for
207*d83cc019SAndroid Build Coastguard Worker  each interface or combined
208*d83cc019SAndroid Build Coastguard Worker* EDID display identifier integrity check for all interfaces
209*d83cc019SAndroid Build Coastguard Worker* EDID display identifier change during suspend for all interfaces
210*d83cc019SAndroid Build Coastguard Worker* Audio Fourier-based tests for DP at 48KHz
211*d83cc019SAndroid Build Coastguard Worker
212*d83cc019SAndroid Build Coastguard WorkerFuture Developments
213*d83cc019SAndroid Build Coastguard Worker-------------------
214*d83cc019SAndroid Build Coastguard Worker
215*d83cc019SAndroid Build Coastguard WorkerWith the current generation of the hardware platform, support for testing a
216*d83cc019SAndroid Build Coastguard Workernumber of additional display features could be included as future developments,
217*d83cc019SAndroid Build Coastguard Workerincluding:
218*d83cc019SAndroid Build Coastguard Worker* Audio capture from HDMI
219*d83cc019SAndroid Build Coastguard Worker* Check all channels are independent from each other
220*d83cc019SAndroid Build Coastguard Worker* Playback using more than 2 channels, different sampling rates and different
221*d83cc019SAndroid Build Coastguard Worker  sample sizes
222*d83cc019SAndroid Build Coastguard Worker* High-bandwidth Digital Content Protection (HDCP) streaming to the display
223*d83cc019SAndroid Build Coastguard Worker* Remote control forwarding (CEC) sent from the display
224*d83cc019SAndroid Build Coastguard Worker* YUV colorspace for HDMI, instead of RGB
225*d83cc019SAndroid Build Coastguard Worker* Partial testing of DP Multi-Stream Transport (MST) using an external MST hub
226*d83cc019SAndroid Build Coastguard Worker  and the two available DP connectors of the platform
227*d83cc019SAndroid Build Coastguard Worker
228*d83cc019SAndroid Build Coastguard WorkerWhile HDCP is already supported by the Chamelium daemon, features such as CEC
229*d83cc019SAndroid Build Coastguard Workerand YUV are not and must be implemented there before any support for them can
230*d83cc019SAndroid Build Coastguard Workerbe added to IGT. Audio is supported by the Chamelium daemon for HDMI only and
231*d83cc019SAndroid Build Coastguard Workera way to retrieve the captured data via the XMLRPC interface needs to be added
232*d83cc019SAndroid Build Coastguard Workerto the daemon.
233