diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-04-27 23:23:11 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-06-18 21:21:22 +0300 |
commit | 6fd25ea0d22564eddb493d9734afcd11ceefd625 (patch) | |
tree | 4a76004ffb13cbf897b9c58313bc1e9b729264af | |
parent | f8b7b7f6c4e594cee426e75dd61f31ec2f64fb54 (diff) |
tests: Add a legacy mode set test
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 <laurent.pinchart@ideasonboard.com>
-rwxr-xr-x | tests/kms-test-legacy-modeset.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/kms-test-legacy-modeset.py b/tests/kms-test-legacy-modeset.py new file mode 100755 index 0000000..eac365f --- /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() |