diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-08-12 02:23:14 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-08-16 01:00:27 +0300 |
commit | 5493e9c64964f8273453d539b89c742f36d5f279 (patch) | |
tree | 95b4b967ae6c770ec9382a853344b1ec0eb27898 /tests/kms-test-modes.py |
Initial import
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'tests/kms-test-modes.py')
-rwxr-xr-x | tests/kms-test-modes.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/kms-test-modes.py b/tests/kms-test-modes.py new file mode 100755 index 0000000..31128a7 --- /dev/null +++ b/tests/kms-test-modes.py @@ -0,0 +1,65 @@ +#!/usr/bin/python3 + +import kmstest +import pykms + +class ModesTest(kmstest.KMSTest): + """Test all available modes on all available connectors.""" + + def handle_page_flip(self, frame, time): + self.logger.log("Page flip complete") + + def test_mode(self, connector, crtc, mode): + 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 the mode set + ret = self.atomic_crtc_mode_set(crtc, connector, mode, fb) + if ret < 0: + raise RuntimeError("atomic mode set failed with %d" % ret) + + self.logger.log("Atomic mode set complete") + self.run(4) + + if self.flips == 0: + raise RuntimeError("Page flip not registered") + + def main(self): + for connector in self.card.connectors: + self.start("modes 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] + + # Test all available modes + modes = connector.get_modes() + if len(modes) == 0: + self.skip("no mode available") + continue + + for i in range(len(modes)): + try: + self.progress(i+1, len(modes)) + self.test_mode(connector, crtc, modes[i]) + except RuntimeError as e: + self.fail(e.message) + break + else: + self.success() + +ModesTest().execute() |