summaryrefslogtreecommitdiff
path: root/lib/igt_chamelium.h
AgeCommit message (Collapse)Author
2021-04-27lib: Put edid_ar_svds where it's usedPetri Latvala
edid_ar_svds was hiding in igt_chamelium instead of igt_kms where it's used, breaking IGT building when chamelium support was disabled. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Kunal Joshi <kunal1.joshi@intel.com> Reviewed-by: Kunal Joshi <kunal1.joshi@intel.com>
2021-04-26Added structures and functions to generate tiled edidsKunal Joshi
Generating the tiled edid which can be flashed on chamelium and added some functions to support the same. v2: No change. v3: No change. v4: No change. v5: No change. Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com> Signed-off-by: Karthik B S <karthik.b.s@intel.com> Reviewed-by: Navare Manasi D <manasi.d.navare@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2021-04-26Make basic chamelium function accessible to other testsKunal Joshi
There are many use case where we can integrate chamelium with other tests, Migrating some of basic chamelium functions to igt_chamelium lib to avoid Code rewriting. v2: Moved one more function reset_state from tests/kms_chamelium to lib/igt_chamelium. v3: - Shifted disabling of modeset to igt_kms - Replace connection_str with kmstest_connector_status_str (Petri) - Generalized require__connector_present (Petri) - Avoided using data_chamelium_t struct (Petri) v4: - Moved function to library (Petri) - Renamed some functions and added documentation (Petri) v6: - Documentation of functions(Petri) - Shifted function to igt_kms and renamed (Petri) Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com> Signed-off-by: Karthik B S <karthik.b.s@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2021-02-21lib/igt_chamelium: Added toggle for fsm_handlingKunal Joshi
Added igt_chamelium_allow_fsm_handling. v2: changes for resolving gcc warnings (Petri) Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-05-11lib/igt_kms: Make igt_display_require() + chamelium more robustArkadiusz Hiler
1. We don't reset Chamelium, as this generates extra unplug events if any of the ports is already connected which is often the case 2. We try to plug all the chamelium ports, it's a noop if they are already plugged 2. We wait for all the ports being connected: - if the port mapping is provided: wait for the ports to be connected - if there is no mapping: sleep(10) and hope for the best Cc: Petri Latvala <petri.latvala@intel.com> Cc: Imre Deak <imre.deak@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2020-03-23lib/kms: Try to plug all Chamelium ports, abort if it failsArkadiusz Hiler
Using chamelium as a display for non-chamelium-aware test is challenging. The board can be left in multiple different states after kms_chamelium tests even though we have atexit() handlers and other measures which try to assure that all ports are plugged in. Sadly this is not 100% reliable. We also had a few boards hard hanging (happens very seldom) and requiring manual intervention. This leads to changes in the testing configuration - we may end up with any number of connectors plugged in which makes a lot of kms_ tests to flip between skip and pass depending on a run. In an attempt to make connectors state less random this patch makes igt_display_require() chamelium-aware. If chamelium is configured for given machine we try to reach it and make sure everything is plugged in. If we fail to do so we abort the execution because the testing configuration is an unknown. For machines without a configured chamelium this boils down to a nop. I have run a bunch of tests and measured how much time we spend in the Chamelium section of igt_display_require() (n = 1000) with chamelium configured: Min: 0.0030s Max: 0.0113s Avg: 0.0089s Median: 0.0089s With ~1000 of KMS subtests in a run it's only a mere 9s. This will however add a bit of extra execution time to test skips because of doing kmstest_set_vt_graphics_mode() and igt_display_require() before even checking whether Chamelium is configured. v2: do kmstest_set_vt_graphics_mode() before requiring display (Petri) Fixes: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/20 Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-23lib/chamelium: Add functions to initialize XMLRPC onlyArkadiusz Hiler
Let's extract the bit that reads the config and initializes xmlrpc so we can do some basic things with chamelium without the need to do port auto-discovery and connector mapping. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-23lib/chamelium: Make it clear that function assertsArkadiusz Hiler
chamelium_wait_reachable() is asserting internally if the chamelium not reachable. Let's make it return bool instead and create void chamelium_assert_reachable() that fails the run. v2: Add docs (Petri) Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-16tests/kms_chamelium: Get rid of dp-link-status subtestArkadiusz Hiler
The test is making Chamelium's receiver signal a need for retraining to the upstream, which i915 handles correctly. Then it asserts a number of conditions that are neither a part of the DisplayPort spec, conformance test suite or the current driver's behavior. The test needs a complete rethinking. Let's remove it instead of letting it bitrot further. Fixes: https://gitlab.freedesktop.org/drm/intel/issues/1059 Cc: Martin Peres <martin.peres@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-01-27lib/chamelium: Add a non-asserting frame match functionKunal Joshi
Added chamelium_frame_match_or_dump which returns bool that the captured frame matches with reference framebuffer. (v2) Removed previously added function chamelium_assert_frame_dump_eq. (v3) No change. (v4) Removed duplicate function code chamelium_assert_frame_dump_match Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com> Signed-off-by: Swati Sharma <swati2.sharma@intel.com> Suggested-by: Uma Shankar <uma.shankar@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-08-20tests/kms_chamelium: Wait for chamelium being reachable after a suspendArkadiusz Hiler
Getting network back after waking up from suspend takes some time. If it's not quick enough, it may cause any following chamelium_rpc to fail. This includes the chamelium port reset in exit handler: igt_chamelium-CRITICAL: Test assertion failure function chamelium_rpc, file ../lib/igt_chamelium.c:349: igt_chamelium-CRITICAL: Failed assertion: !chamelium->env.fault_occurred igt_chamelium-CRITICAL: Last errno: 113, No route to host igt_chamelium-CRITICAL: Chamelium RPC call failed: libcurl failed to execute the HTTP POST transaction, explaining: Failed to connect to 192.168.1.224 port 9992: No route to host Stack trace: #0 ../lib/igt_core.c:1674 __igt_fail_assert() #1 [chamelium_rpc+0x1ea] #2 ../lib/igt_chamelium.c:2274 chamelium_reset() #3 ../lib/igt_chamelium.c:2361 chamelium_deinit() #4 ../lib/igt_core.c:2124 call_exit_handlers() So let's wait for Chamelium to be reachable after each suspend_autoresume. v2: Bump the network timeout to 20s, the slowest observed bring-up was 17s. (Petri) Do not DECREF if we get NULL from __chmelium_rpc(). (Simon & CI) Cc: Simon Ser <simon.ser@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109380 Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Simon Ser <simon.ser@intel.com>
2019-08-15lib/igt_chamelium: add chamelium_trigger_link_failureSimon Ser
This new function triggers a link failure on the provided port. Another function called chamelium_supports_trigger_link_failure has been added to check whether the Chamelium board supports the new method. Support for TriggerLinkFailure in Chamelium has been added in [1]. [1]: https://chromium.googlesource.com/chromiumos/platform/chameleon/+/44866c7bc2af44da1f7bac4e782d0ed6d7c1400a Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-08-15lib/igt_kms: use struct edid instead of unsigned charSimon Ser
This has several advantages: * No more need to convert back and forth between these two (everybody should use struct edid, the exception being lib/tests/igt_edid which performs sanity checks) * Makes it clearer that users can call edid_get_size on a returned EDID blob * Improves type safety (it's more obvious is a random blob is used as an EDID) Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-08-14lib/igt_chamelium: add support for GetLastInfoFrameSimon Ser
This new call retrieves the last InfoFrame received by the Chamelium board. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-07-19lib/igt_chamelium: add CHAMELIUM_MAX_PORTSSimon Ser
We will always be able to find an upper bound for the number of connectors supported by a Chamelium board. Instead of using dynamic arrays, simplify the code by using static ones. More code will need to have arrays of ports in the future. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-07-19lib/igt_chamelium: allow EDIDs to be mutated for each portSimon Ser
This adds the infrastructure necessary to change EDIDs provided to chamelium_new_edid, without actually doing it yet. This commit just updates the API to make it possible, documents expectations and updates callers accordingly. Mutating EDIDs is necessary to add an identifier to them (e.g. by adding a serial number) and to be able to map Chamelium ports to DRM connectors. A new function chamelium_edid_get_raw allows callers to retrieve the exact EDID used for a particular port. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-07-17lib/igt_chamelium: add chamelium_supports_get_video_paramsSimon Ser
This allows to skip video params tests on Chamelium boards which aren't recent enough. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-07-17lib/igt_chamelium: add chamelium_port_get_video_paramsSimon Ser
This new XML-RPC call allows to retrieve mode information from the Chamelium. We can use it to check the mode we've chosen has been applied correctly. The method has been added to the Chameleon API in commit [1]. [1]: https://chromium.googlesource.com/chromiumos/platform/chameleon/+/1df012d6ac9429a58a5e0f9362a1ff98f1bff8a7 Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-17lib/igt_chamelium: replace EDID IDs with opaque structsSimon Ser
There are two reasons for this: * An opaque struct is more type-safe than an int * In the future we'll want to tag EDIDs with the Chamelium port ID, to be able to automagically infer the DRM connector <-> Chamelium port mapping. This is necessary for DP MST (connector names are not stable). Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-27lib/igt_chamelium: introduce CHAMELIUM_MAX_AUDIO_CHANNELSSimon Ser
This allows us not to hardcode 8 everywhere. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-16lib/igt_chamelium: add CHAMELIUM_DEFAULT_EDIDSimon Ser
This ID can be provided to chamelium_port_set_edid to use the default EDID for the port. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-05-14tests/kms_chamelium: check ports have audio supportSimon Ser
Before starting an audio test, make sure the Chamelium supports audio capture on the port we want to use. Old Chamelium devices don't support audio capture on DisplayPort ports. This patch will make the tests skip DisplayPort ports. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-04-25tests/kms_chamelium: run audio test with multiple sampling ratesSimon Ser
The audio test is now run multiple times with a variety of playback sampling rates. We now query the capture audio format from the Chamelium XML-RPC API instead of hardcoding it. One limitation is that we need to start sending an audio signal before being able to query the capture audio format. However we need the capture sample rate to decide which frequencies we generate. For now we use the playback rate and check that it's the same as the capture rate. Another limitation is that the DP receiver reports an unknown sampling rate during the 44.1KHz test. In this case we assume the capture rate is the same as the playback rate. We'll fail later anyway if this assumption is incorrect since we check the signal we receive. Chameleon bug: https://crbug.com/950913 Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-04-25tests/kms_chamelium: test audio channels are not mixed upSimon Ser
Send a different signal to each channel and make sure captured audio channels are not swapped or mixed up. The Chamelium device has a bug and already swaps the left and right channels. For this reason, clients need to retrieve the Chamelium channel mapping and accomodate for this. See https://crbug.com/950922 for a discussion about this. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-04-25tests/kms_chamelium: add dp-audio testSimon Ser
This new test ensures DisplayPort audio works by using the Chamelium. It enables the DisplayPort output and sends an audio signal containing a set of frequencies we choose to all HDMI/DisplayPort audio devices. It starts recording audio on the Chamelium device and uses the stream server to retrieve captured audio pages. It then checks that the capture audio signal contains the frequencies we sent, and only those, by computing a FFT. A new library has been added to libigt to communicate with the stream server. It implements a simple custom TCP protocol. In case the test fails, a WAV file with the captured data is saved on disk. Right now the test has a few limitations: - Only the first channel is checked - IGT only generates audio with a single sampling rate (48 KHz) - Audio data is not captured in real-time These limitations will be lifted in future patches. PulseAudio must not run during the tests since ALSA is used directly. To ensure this, edit /etc/pulse/client.conf and add `autospawn=no`. Then run `pulseaudio --kill`. This commit deletes the existing audio tests. They weren't run and required an exotic configuration (HDMI audio splitter, dummy HDMI sink and a line-in port on the DUT). This patch also changes lib/igt_audio to use uint16_t instead of short. The rationale is: - The standard says a short is at least 16 bit wide, but a short can be larger (in practice it won't happen, but better use types correctly) - It makes it clearer that the audio format is S16_LE, since "16" is in the type name. This patch depends on the following Chameleon bugs: - https://crbug.com/948060 - https://crbug.com/950857 Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-02-26lib/igt_chamelium: Hook-in checkerboard comparison method in helpersPaul Kocialkowski
This introduces the checkerboard chamelium checking type and hooks the call to the associated igt_frame matching helper in the frame match chamelium helper. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
2019-02-26lib/igt_chamelium: Generalize the frame match helper with check typePaul Kocialkowski
In prevision of adding support for another type of frame matching, rename chamelium_assert_analog_frame_match_or_dump to drop the analog part and feed it the check type. This way, the bulk of the helper can apply to other frame matching types. This requires moving the chamelium_check enum from the test to the common chamelium header. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
2017-09-08lib: clean up header includesDaniel Vetter
Just a bit of OCD, I like it when connections within library modules are a bit more obvious. igt.h is ok for tests, but let's use individual include lines for libraries consistently. Also order standard includes before igt ones. v2: Rebase. Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-08build: Nuke #ifdef HAVE_CONFIG_H cargo-cultDaniel Vetter
We have it. Daniel Stone said the #ifdef HAVE_CONFIG_H comes from the X11 transition to the modular build, where in the imake -> modular build transition config.h wasn't universally available. Now we just make this a requirement (so yeah Android better generate one too). v2: Improve commit message a bit. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-07-20chamelium: Add support for VGA frame comparison testingPaul Kocialkowski
This adds support for VGA frame comparison testing with the reference generated from cairo. The retrieved frame from the chamelium is first cropped, as it contains the blanking intervals, through a dedicated helper. Another helper function asserts that the analog frame matches or dump it to png if not. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-07-19chamelium: Dump captured and reference frames to png on crc errorPaul Kocialkowski
This adds support for dumping both the frame capture from the chamelium and the reference frame generated by cairo when the captured crc does not match the crc calculated from the reference, using common helpers. Getting a dump of the frames is quite useful in order to compare them. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-07-19chamelium: Calculate CRC from framebuffer instead of hardcoding itPaul Kocialkowski
This introduces CRC calculation for reference frames, instead of using hardcoded values for them. The rendering of reference frames may differ from machine to machine, especially due to font rendering, and the frame itself may change with subsequent IGT changes. These differences would cause the CRC checks to fail on different setups. This allows them to pass regardless of the setup. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-06-27chamelium: Add support for HPD toggle scheduling instead of async pulsesPaul Kocialkowki
This adds support for the newly-introduced ScheduleHpdToggle XMLRPC method of the Chamelium's interface and makes use of it instead of starting pulses with an asynchronous call, suspending and dealing with the result at resume. The XMLRPC library does not guarantee that the call will be made before caring for its outcome and this is in fact what was happening: the call was being delayed until resume time, as can be seen from the Chamelium's logs. The quite generous timeout for HPD event detection would then catch the toggle, that was sent after resume. This is especially useful for testing HPD during suspend/resume. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
2017-06-07chamelium: Fix build issues on AndroidArkadiusz Hiler
Makefile.sources are included 1:1 in Android.mk files, and are not parsed by automake. And yet those had some automake conditional logic. Moving it to .am file is enough for now. Also igt_chamelium.h included config.h without proper "HAVE_CONFIG_H" guard, and the file itself was included unconditionally. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
2017-01-26Add support for hotplug testing with the ChameliumLyude
For the purpose of testing things such as hotplugging and bad monitors, the ChromeOS team ended up designing a neat little device known as the Chamelium. More information on this can be found here: https://www.chromium.org/chromium-os/testing/chamelium This adds support for a couple of things to intel-gpu-tools: - igt library functions for connecting to udev and monitoring it for hotplug events, loosely based off of the unfinished hotplugging implementation in testdisplay - Library functions for controlling the chamelium in tests using xmlrpc. A couple of RPC calls were ommitted here, mainly because they didn't seem very useful for our needs (yet) - A set of functions for doing CRC checks and frame comparisons in tests - A set of basic tests using the Chamelium library. Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net> Signed-off-by: Lyude <lyude@redhat.com> Changes since v1: - Don't try to guess connector mappings, have the user specify them manually using a configuration file - Open DRM fd using DRIVER_ANY, not DRIVER_INTEL - Lower the hotplug timeout a little bit, since 30 seconds was leftover from debugging these tests anyway - Don't try to keep track of the original state of the chamelium ports, and just leave them plugged in after each run. This makes more sense to me, since I'd imagine in automated testing setups using chameliums that all of the extra monitors will probably be provided by the Chamelium to begin with, so keeping them plugged in would make sure tests running afterwards that require >1 monitor don't get skipped. - Add wait_for_connector() to the chamelium tests. After some more testing, I found that depending on the system some tests would throw false negatives due to us not waiting long enough for the system to detect that we connected something to it. This mainly happened with VGA connectors, since their lack of HPD makes them take significantly longer for the hardware to notice. wait_for_connector() fixes this by continually reprobing the status of the desired connector (without relying on a hpd event happening, since that might never come) until we get what we want, or we time out and fail. - Use kmstest_get_property() for retrieving EDIDs instead of doing it by hand - Don't hardcode PIPE_A for bringing up the display, use kmstest to find an appropriate CRTC to use. Changes since v2: - Fix incorrect usage of the list helpers when recording new EDIDs - Add missing documentation - Make sure documentation actually appears - Since we finally got video capture working, add CRC functions and fix the ones we couldn't actually test before - In the exit handler, reset the xmlrpc env so we can properly reset the Chamelium even after an RPC error - Make sure compiling without Chamelium support still works Changes since v3: - Change the config file name from .igt_chamelium_rc to .igtrc - Remove chamelium global context - Get rid of define_common_connector_tests() - Get rid of connector list, expose connectors as opaque objects and provide helpers for accessing their attributes - Get rid of configure.ac option for Chamelium - Add tests for CRC functions - Add frame dumping functions + tests - Add FSM handling to chamelium_rpc() - Use LIBUDEV_LIBS in automake, not UDEV_LIBS - Documentation fixes - Improve debugging output some more - Remove skip_without_suspend_support, we no longer need to check for suspend support before calling things - Remove unnessecary malloc() checks with igt_assert() - Don't use igt_require in chamelium_init, leave it up to the caller whether or not to abort when failing to initialize the chamelium - Use igt_assert_eq for making assertions about connector's statuses - Define suspend/resume delay for tests as constant