diff mbox series

[kms-tests] kmstest.py: Add output_connectors() helper to skip writeback connectors

Message ID 20190619002231.8239-1-laurent.pinchart@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [kms-tests] kmstest.py: Add output_connectors() helper to skip writeback connectors | expand

Commit Message

Laurent Pinchart June 19, 2019, 12:22 a.m. UTC
Add a generator method to the KMSTest class to enumerate all
non-writeback connectors, and use it through tests.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 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(-)

Comments

Kieran Bingham June 19, 2019, 8:50 a.m. UTC | #1
Hi Laurent,

On 19/06/2019 01:22, Laurent Pinchart wrote:
> 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 <kieran.bingham+renesas@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  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 f416723bc7fc..ca7baa07af42 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 e6d9f03fc211..a0ae46a8b53e 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 29147e5bd0a3..e0e0eabd9950 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 ae89bb542485..15e6f591aea9 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 eac365f44b64..17a81792a2b8 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 2ca45c46b50d..82a1a3b21e93 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 f8a78ad2926b..224b39143a8e 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 2aeaf3478dc3..bef1f4990a10 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 63f745b5dbed..ac4b4d0eb407 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 2cf02ddcc6b5..a24dc1c0fb1e 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 336e31a55d47..8a483d7b5259 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:
>
diff mbox series

Patch

diff --git a/tests/kms-test-allplanes.py b/tests/kms-test-allplanes.py
index f416723bc7fc..ca7baa07af42 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 e6d9f03fc211..a0ae46a8b53e 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 29147e5bd0a3..e0e0eabd9950 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 ae89bb542485..15e6f591aea9 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 eac365f44b64..17a81792a2b8 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 2ca45c46b50d..82a1a3b21e93 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 f8a78ad2926b..224b39143a8e 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 2aeaf3478dc3..bef1f4990a10 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 63f745b5dbed..ac4b4d0eb407 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 2cf02ddcc6b5..a24dc1c0fb1e 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 336e31a55d47..8a483d7b5259 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: