From patchwork Fri Apr 27 20:25:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10369819 X-Patchwork-Delegate: geert@linux-m68k.org 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 4EC026038F for ; Fri, 27 Apr 2018 20:25:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F44C2580E for ; Fri, 27 Apr 2018 20:25:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33AB12883F; Fri, 27 Apr 2018 20:25:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C674C27FAC for ; Fri, 27 Apr 2018 20:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759079AbeD0UZQ (ORCPT ); Fri, 27 Apr 2018 16:25:16 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:60296 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759077AbeD0UZP (ORCPT ); Fri, 27 Apr 2018 16:25:15 -0400 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2F0B660AD; Fri, 27 Apr 2018 22:25:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1524860714; bh=bY6dMD5MisD/ANkO7GB/SVwfAXNi6eRg1/oire9efrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nt0utEhA5DBACa/AEoch0GXERbyagOxgWkhvz/LXvKZrJ86i4IEr174dgnPtcg7Tc oqlgCc6kGZPw7UUreeiYcnwIpSoRZ2NPRzvhKwInNL1RR83MqCXnev0qYTebK8va7y mylLD6DwfBsXWh8rTaBieP2KR0E921YvprIvjiIc= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [PATCH 2/2] tests: Add a legacy mode set test Date: Fri, 27 Apr 2018 23:25:24 +0300 Message-Id: <20180427202524.14225-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180427202524.14225-1-laurent.pinchart@ideasonboard.com> References: <20180427202524.14225-1-laurent.pinchart@ideasonboard.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Perform mode sets through the legacy API to test the DRM core legacy code paths, as well as the rcar-du code paths that could be exercised differently by the atomic legacy mode set helpers. Signed-off-by: Laurent Pinchart --- tests/kms-test-legacy-modeset.py | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 tests/kms-test-legacy-modeset.py diff --git a/tests/kms-test-legacy-modeset.py b/tests/kms-test-legacy-modeset.py new file mode 100755 index 000000000000..eac365f44b64 --- /dev/null +++ b/tests/kms-test-legacy-modeset.py @@ -0,0 +1,60 @@ +#!/usr/bin/python3 + +import kmstest +import pykms + +class LegacyModeSetTest(kmstest.KMSTest): + """Test mode setting on all connectors in sequence with the default mode through the legacy mode set API.""" + + def handle_page_flip(self, frame, time): + self.logger.log("Page flip complete") + + def main(self): + for connector in self.card.connectors: + self.start("legacy mode set on connector %s" % connector.fullname) + + # Skip disconnected connectors + if not connector.connected(): + self.skip("unconnected connector") + continue + + # Find a CRTC suitable for the connector + crtc = connector.get_current_crtc() + if not crtc: + crtcs = connector.get_possible_crtcs() + if len(crtcs) == 0: + pass + + crtc = crtcs[0] + + # Get the default mode for the connector + try: + mode = connector.get_default_mode() + except ValueError: + self.skip("no mode available") + continue + + self.logger.log("Testing connector %s on CRTC %u with mode %s" % \ + (connector.fullname, crtc.id, mode.name)) + + # Create a frame buffer + fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, "XR24") + pykms.draw_test_pattern(fb) + + # Perform a mode set + ret = crtc.set_mode(connector, fb, mode) + if ret < 0: + self.fail("legacy mode set failed with %d" % ret) + continue + + self.logger.log("Legacy mode set complete") + self.run(5) + + ret = crtc.disable_mode() + if ret < 0: + self.fail("legacy mode set disable failed with %d" % ret) + continue + + self.success() + +LegacyModeSetTest().execute()