From f4f5e930412a007b9f862024cccede416da8b2d9 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 19 Jun 2019 03:09:09 +0300 Subject: kmstest.py: Add output_connectors() helper to skip writeback connectors Add a generator method to the KMSTest class to enumerate all non-writeback connectors, and use it through tests. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- tests/kms-test-allplanes.py | 2 +- tests/kms-test-brxalloc.py | 2 +- tests/kms-test-crc.py | 2 +- tests/kms-test-formats.py | 2 +- tests/kms-test-legacy-modeset.py | 2 +- tests/kms-test-modes.py | 2 +- tests/kms-test-modeset.py | 2 +- tests/kms-test-pageflip.py | 2 +- tests/kms-test-planeposition.py | 2 +- tests/kms-test-routing.py | 10 ++-------- tests/kmstest.py | 6 ++++++ 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/kms-test-allplanes.py b/tests/kms-test-allplanes.py index f416723..ca7baa0 100755 --- a/tests/kms-test-allplanes.py +++ b/tests/kms-test-allplanes.py @@ -12,7 +12,7 @@ class AllPlanesTest(kmstest.KMSTest): def main(self): # Create the connectors to CRTCs map connectors = {} - for connector in self.card.connectors: + for connector in self.output_connectors(): # Skip disconnected connectors if not connector.connected(): continue diff --git a/tests/kms-test-brxalloc.py b/tests/kms-test-brxalloc.py index e6d9f03..a0ae46a 100755 --- a/tests/kms-test-brxalloc.py +++ b/tests/kms-test-brxalloc.py @@ -44,7 +44,7 @@ class BRxAllocTest(kmstest.KMSTest): (len(planes), outputs[0].crtc.id, outputs[1].crtc.id)) # Get one connector for each CRTC - for connector in self.card.connectors: + for connector in self.output_connectors(): # Skip disconnected connectors if not connector.connected(): continue diff --git a/tests/kms-test-crc.py b/tests/kms-test-crc.py index 29147e5..e0e0eab 100755 --- a/tests/kms-test-crc.py +++ b/tests/kms-test-crc.py @@ -12,7 +12,7 @@ class CRCTest(kmstest.KMSTest): def main(self): # Create the connectors to CRTCs map connectors = {} - for connector in self.card.connectors: + for connector in self.output_connectors(): # Skip disconnected connectors if not connector.connected(): continue diff --git a/tests/kms-test-formats.py b/tests/kms-test-formats.py index ae89bb5..15e6f59 100755 --- a/tests/kms-test-formats.py +++ b/tests/kms-test-formats.py @@ -11,7 +11,7 @@ class FormatsTest(kmstest.KMSTest): self.start("plane formats") # Find a CRTC with a connected connector and at least one plane - for connector in self.card.connectors: + for connector in self.output_connectors(): if not connector.connected(): self.skip("unconnected connector") continue diff --git a/tests/kms-test-legacy-modeset.py b/tests/kms-test-legacy-modeset.py index eac365f..17a8179 100755 --- a/tests/kms-test-legacy-modeset.py +++ b/tests/kms-test-legacy-modeset.py @@ -10,7 +10,7 @@ class LegacyModeSetTest(kmstest.KMSTest): self.logger.log("Page flip complete") def main(self): - for connector in self.card.connectors: + for connector in self.output_connectors(): self.start("legacy mode set on connector %s" % connector.fullname) # Skip disconnected connectors diff --git a/tests/kms-test-modes.py b/tests/kms-test-modes.py index 2ca45c4..82a1a3b 100755 --- a/tests/kms-test-modes.py +++ b/tests/kms-test-modes.py @@ -30,7 +30,7 @@ class ModesTest(kmstest.KMSTest): raise RuntimeError("Page flip not registered") def main(self): - for connector in self.card.connectors: + for connector in self.output_connectors(): self.start("modes on connector %s" % connector.fullname) # Skip disconnected connectors diff --git a/tests/kms-test-modeset.py b/tests/kms-test-modeset.py index f8a78ad..224b391 100755 --- a/tests/kms-test-modeset.py +++ b/tests/kms-test-modeset.py @@ -10,7 +10,7 @@ class ModeSetTest(kmstest.KMSTest): self.logger.log("Page flip complete") def main(self): - for connector in self.card.connectors: + for connector in self.output_connectors(): self.start("atomic mode set on connector %s" % connector.fullname) # Skip disconnected connectors diff --git a/tests/kms-test-pageflip.py b/tests/kms-test-pageflip.py index 2aeaf34..bef1f49 100755 --- a/tests/kms-test-pageflip.py +++ b/tests/kms-test-pageflip.py @@ -40,7 +40,7 @@ class PageFlipTest(kmstest.KMSTest): self.stop_requested = True def main(self): - for connector in self.card.connectors: + for connector in self.output_connectors(): self.start("page flip on connector %s" % connector.fullname) # Skip disconnected connectors diff --git a/tests/kms-test-planeposition.py b/tests/kms-test-planeposition.py index 63f745b..ac4b4d0 100755 --- a/tests/kms-test-planeposition.py +++ b/tests/kms-test-planeposition.py @@ -11,7 +11,7 @@ class PlanePositionTest(kmstest.KMSTest): self.start("plane positioning boundaries") # Find a CRTC with a connected connector and at least two planes - for connector in self.card.connectors: + for connector in self.output_connectors(): if not connector.connected(): self.skip("unconnected connector") continue diff --git a/tests/kms-test-routing.py b/tests/kms-test-routing.py index 2cf02dd..a24dc1c 100755 --- a/tests/kms-test-routing.py +++ b/tests/kms-test-routing.py @@ -23,10 +23,7 @@ class RoutingTest(kmstest.KMSTest): max_hdisplay = 0 max_vdisplay = 0 - for connector in self.card.connectors: - if connector.fullname.startswith('writeback-'): - continue - + for connector in self.output_connectors(): mode = connector.get_default_mode() max_hdisplay = max(mode.hdisplay, max_hdisplay) max_vdisplay = max(mode.vdisplay, max_vdisplay) @@ -39,10 +36,7 @@ class RoutingTest(kmstest.KMSTest): # Find a connector that can be routed to at least two CRTCs that have # at least two output routes each. shared_connector = None - for connector in self.card.connectors: - if connector.fullname.startswith('writeback-'): - continue - + for connector in self.output_connectors(): pipes = [] for crtc in connector.get_possible_crtcs(): if len(self.crtc_to_connectors[crtc]) >= 2: diff --git a/tests/kmstest.py b/tests/kmstest.py index 336e31a..8a483d7 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -364,6 +364,12 @@ class KMSTest(object): else: return req.commit(0) + def output_connectors(self): + for connector in self.card.connectors: + if connector.fullname.startswith('writeback-'): + continue + yield connector + def __handle_page_flip(self, frame, time): self.flips += 1 try: -- cgit v1.2.3