Skip to content
  • Lyude Paul's avatar
    Add support for hotplug testing with the Chamelium · c99f8b7a
    Lyude Paul authored
    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 Paul's avatarLyude <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
    c99f8b7a