summaryrefslogtreecommitdiff
path: root/tests/kms-test-modeset.py
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-08-12 02:23:14 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-08-16 01:00:27 +0300
commit5493e9c64964f8273453d539b89c742f36d5f279 (patch)
tree95b4b967ae6c770ec9382a853344b1ec0eb27898 /tests/kms-test-modeset.py
Initial import
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'tests/kms-test-modeset.py')
-rwxr-xr-xtests/kms-test-modeset.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/kms-test-modeset.py b/tests/kms-test-modeset.py
new file mode 100755
index 0000000..e3551f1
--- /dev/null
+++ b/tests/kms-test-modeset.py
@@ -0,0 +1,58 @@
+#!/usr/bin/python3
+
+import kmstest
+import pykms
+
+class ModeSetTest(kmstest.KMSTest):
+ """Test mode setting on all connectors in sequence with the default mode."""
+
+ def handle_page_flip(self, frame, time):
+ self.logger.log("Page flip complete")
+
+ def main(self):
+ for connector in self.card.connectors:
+ self.start("atomic 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 = self.atomic_crtc_mode_set(crtc, connector, mode, fb)
+ if ret < 0:
+ self.fail("atomic mode set failed with %d" % ret)
+ continue
+
+ self.logger.log("Atomic mode set complete")
+ self.run(5)
+
+ if self.flips == 0:
+ self.fail("Page flip not registered")
+ else:
+ self.success()
+
+ModeSetTest().execute()