linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kms-tests] [PATCH] tests: Add a plane formats test
@ 2019-06-16 23:41 Laurent Pinchart
  2019-06-18 21:41 ` Kieran Bingham
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2019-06-16 23:41 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Kieran Bingham

Add a new test script that tests all formats supported by planes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 tests/kms-test-formats.py | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100755 tests/kms-test-formats.py

diff --git a/tests/kms-test-formats.py b/tests/kms-test-formats.py
new file mode 100755
index 000000000000..ae89bb542485
--- /dev/null
+++ b/tests/kms-test-formats.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python3
+
+import kmstest
+import pykms
+import time
+
+class FormatsTest(kmstest.KMSTest):
+    """Test all available plane formats."""
+
+    def main(self):
+        self.start("plane formats")
+
+        # Find a CRTC with a connected connector and at least one plane
+        for connector in self.card.connectors:
+            if not connector.connected():
+                self.skip("unconnected connector")
+                continue
+
+            try:
+                mode = connector.get_default_mode()
+            except ValueError:
+                continue
+
+            crtcs = connector.get_possible_crtcs()
+            for crtc in crtcs:
+                if crtc.primary_plane:
+                    break
+            else:
+                crtc = None
+
+            if crtc:
+                break
+
+        else:
+            self.skip("no CRTC available with connector")
+            return
+
+        self.logger.log("Testing connector %s, CRTC %u, mode %s" % \
+              (connector.fullname, crtc.id, mode.name))
+
+        for format in crtc.primary_plane.formats:
+            self.logger.log("Testing format %s" % format)
+
+            # Create a frame buffer
+            try:
+                fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, format)
+            except ValueError:
+                continue
+
+            pykms.draw_test_pattern(fb)
+
+            # Set the mode with a primary plane
+            ret = self.atomic_crtc_mode_set(crtc, connector, mode, fb)
+            if ret < 0:
+                self.fail("atomic mode set failed with %d" % ret)
+                continue
+
+            self.run(3)
+
+        self.atomic_crtc_disable(crtc)
+        self.success()
+
+FormatsTest().execute()
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [kms-tests] [PATCH] tests: Add a plane formats test
  2019-06-16 23:41 [kms-tests] [PATCH] tests: Add a plane formats test Laurent Pinchart
@ 2019-06-18 21:41 ` Kieran Bingham
  0 siblings, 0 replies; 2+ messages in thread
From: Kieran Bingham @ 2019-06-18 21:41 UTC (permalink / raw)
  To: Laurent Pinchart, linux-renesas-soc

Hi Laurent,

On 17/06/2019 00:41, Laurent Pinchart wrote:
> Add a new test script that tests all formats supported by planes.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Seems reasonable to me.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
>  tests/kms-test-formats.py | 63 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100755 tests/kms-test-formats.py
> 
> diff --git a/tests/kms-test-formats.py b/tests/kms-test-formats.py
> new file mode 100755
> index 000000000000..ae89bb542485
> --- /dev/null
> +++ b/tests/kms-test-formats.py
> @@ -0,0 +1,63 @@
> +#!/usr/bin/python3
> +
> +import kmstest
> +import pykms
> +import time
> +
> +class FormatsTest(kmstest.KMSTest):
> +    """Test all available plane formats."""
> +
> +    def main(self):
> +        self.start("plane formats")
> +
> +        # Find a CRTC with a connected connector and at least one plane
> +        for connector in self.card.connectors:
> +            if not connector.connected():
> +                self.skip("unconnected connector")
> +                continue
> +
> +            try:
> +                mode = connector.get_default_mode()
> +            except ValueError:
> +                continue
> +
> +            crtcs = connector.get_possible_crtcs()
> +            for crtc in crtcs:
> +                if crtc.primary_plane:
> +                    break
> +            else:
> +                crtc = None
> +
> +            if crtc:
> +                break
> +
> +        else:
> +            self.skip("no CRTC available with connector")
> +            return
> +
> +        self.logger.log("Testing connector %s, CRTC %u, mode %s" % \
> +              (connector.fullname, crtc.id, mode.name))
> +
> +        for format in crtc.primary_plane.formats:
> +            self.logger.log("Testing format %s" % format)
> +
> +            # Create a frame buffer
> +            try:
> +                fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, format)
> +            except ValueError:
> +                continue
> +
> +            pykms.draw_test_pattern(fb)
> +
> +            # Set the mode with a primary plane
> +            ret = self.atomic_crtc_mode_set(crtc, connector, mode, fb)
> +            if ret < 0:
> +                self.fail("atomic mode set failed with %d" % ret)
> +                continue
> +
> +            self.run(3)
> +
> +        self.atomic_crtc_disable(crtc)
> +        self.success()
> +
> +FormatsTest().execute()
> 

-- 
Regards
--
Kieran

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-18 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16 23:41 [kms-tests] [PATCH] tests: Add a plane formats test Laurent Pinchart
2019-06-18 21:41 ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).