From patchwork Mon Jan 16 19:26:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lyude Paul X-Patchwork-Id: 9519353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B38266020B for ; Mon, 16 Jan 2017 19:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A501027FAD for ; Mon, 16 Jan 2017 19:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A236283F9; Mon, 16 Jan 2017 19:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D97527FAD for ; Mon, 16 Jan 2017 19:27:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 683776E4EA; Mon, 16 Jan 2017 19:27:12 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9ED926E4E3 for ; Mon, 16 Jan 2017 19:27:10 +0000 (UTC) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4802F8123D for ; Mon, 16 Jan 2017 19:27:11 +0000 (UTC) Received: from meerkat.lyude.net (dhcp-25-222.bos.redhat.com [10.18.25.222]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0GJR8nM006234; Mon, 16 Jan 2017 14:27:10 -0500 From: Lyude To: intel-gfx@lists.freedesktop.org Date: Mon, 16 Jan 2017 14:26:53 -0500 Message-Id: <20170116192653.4740-6-lyude@redhat.com> In-Reply-To: <20170116192653.4740-1-lyude@redhat.com> References: <20170116192653.4740-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 16 Jan 2017 19:27:11 +0000 (UTC) Subject: [Intel-gfx] [PATCH i-g-t v4 5/5] Add support for hotplug testing with the Chamelium X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Lyude 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 --- configure.ac | 4 ++++ docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml | 1 + lib/Makefile.am | 6 ++++++ lib/Makefile.sources | 2 ++ lib/igt.h | 1 + tests/Makefile.am | 5 ++++- tests/Makefile.sources | 1 + 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 411bfab..229185c 100644 --- a/configure.ac +++ b/configure.ac @@ -169,6 +169,10 @@ if test x"$udev" = xyes; then fi PKG_CHECK_MODULES(GLIB, glib-2.0) +# for chamelium +PKG_CHECK_MODULES(XMLRPC, xmlrpc_client) +PKG_CHECK_MODULES(PIXMAN, pixman-1) + # ----------------------------------------------------------------------------- # Configuration options # ----------------------------------------------------------------------------- diff --git a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml index 91b2499..990bbb8 100644 --- a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml +++ b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml @@ -34,6 +34,7 @@ + diff --git a/lib/Makefile.am b/lib/Makefile.am index 57d3dbb..7030ea2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -31,6 +31,9 @@ AM_CFLAGS = \ $(KMOD_CFLAGS) \ $(PROCPS_CFLAGS) \ $(DEBUG_CFLAGS) \ + $(XMLRPC_CFLAGS) \ + $(LIBUDEV_CFLAGS) \ + $(PIXMAN_CFLAGS) \ -DIGT_SRCDIR=\""$(abs_top_srcdir)/tests"\" \ -DIGT_DATADIR=\""$(pkgdatadir)"\" \ -DIGT_LOG_DOMAIN=\""$(subst _,-,$*)"\" \ @@ -47,5 +50,8 @@ libintel_tools_la_LIBADD = \ $(LIBUDEV_LIBS) \ $(LIBUNWIND_LIBS) \ $(TIMER_LIBS) \ + $(XMLRPC_LIBS) \ + $(LIBUDEV_LIBS) \ + $(PIXMAN_LIBS) \ -lm diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 53fdb54..8cb95d8 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -83,6 +83,8 @@ lib_source_list = \ uwildmat/uwildmat.c \ igt_kmod.c \ igt_kmod.h \ + igt_chamelium.h \ + igt_chamelium.c \ $(NULL) .PHONY: version.h.tmp diff --git a/lib/igt.h b/lib/igt.h index a0028d5..a97923e 100644 --- a/lib/igt.h +++ b/lib/igt.h @@ -38,6 +38,7 @@ #include "igt_kms.h" #include "igt_pm.h" #include "igt_stats.h" +#include "igt_chamelium.h" #include "instdone.h" #include "intel_batchbuffer.h" #include "intel_chipset.h" diff --git a/tests/Makefile.am b/tests/Makefile.am index 14a41ae..8930c24 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -62,7 +62,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\ $(LIBUNWIND_CFLAGS) $(WERROR_CFLAGS) \ $(NULL) -LDADD = ../lib/libintel_tools.la $(GLIB_LIBS) +LDADD = ../lib/libintel_tools.la $(GLIB_LIBS) $(XMLRPC_LIBS) AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS) AM_LDFLAGS = -Wl,--as-needed @@ -118,5 +118,8 @@ vc4_wait_bo_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS) vc4_wait_bo_LDADD = $(LDADD) $(DRM_VC4_LIBS) vc4_wait_seqno_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS) vc4_wait_seqno_LDADD = $(LDADD) $(DRM_VC4_LIBS) + +chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) +chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS) endif diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 38385aa..016cd86 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -142,6 +142,7 @@ TESTS_progs_M = \ template \ vgem_basic \ vgem_slow \ + chamelium \ $(NULL) TESTS_progs_XM = \