kmstest.py: Add output_connectors() helper to skip writeback connectors
PATCH 1/1 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 <[email protected]>
--- 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(-)
tests/kms-test-allplanes.py +1 -1
@@ -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
tests/kms-test-brxalloc.py +1 -1
@@ -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
tests/kms-test-crc.py +1 -1
@@ -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
tests/kms-test-formats.py +1 -1
@@ -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
tests/kms-test-legacy-modeset.py +1 -1
@@ -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
tests/kms-test-modes.py +1 -1
@@ -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
tests/kms-test-modeset.py +1 -1
@@ -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
tests/kms-test-pageflip.py +1 -1
@@ -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
tests/kms-test-planeposition.py +1 -1
@@ -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
tests/kms-test-routing.py +2 -8
@@ -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:
tests/kmstest.py +6 -0
@@ -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:
Signature · 3 lines
Regards, Laurent Pinchart
Hi Laurent,
Quoted 3 lines · Laurent Pinchart
Add a generator method to the KMSTest class to enumerate all non-writeback connectors, and use it through tests.
Excellent, yes that's exactly what I had in mind.
Reviewed-by Kieran Bingham <[email protected]>
Quoted 178 lines
Signed-off-by Laurent Pinchart <[email protected]>--- 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(-)tests/kms-test-allplanes.py +1
-1@@ -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(): continuetests/kms-test-brxalloc.py +1
-1@@ -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(): continuetests/kms-test-crc.py +1
-1@@ -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(): continuetests/kms-test-formats.py +1
-1@@ -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") continuetests/kms-test-legacy-modeset.py +1
-1@@ -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 connectorstests/kms-test-modes.py +1
-1@@ -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 connectorstests/kms-test-modeset.py +1
-1@@ -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 connectorstests/kms-test-pageflip.py +1
-1@@ -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 connectorstests/kms-test-planeposition.py +1
-1@@ -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") continuetests/kms-test-routing.py +2
-8@@ -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:tests/kmstest.py +6
-0@@ -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:
Signature · 3 lines
Regards -- Kieran