summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2019-02-26 14:44:33 +0200
committerJyri Sarha <jsarha@ti.com>2020-02-14 13:08:50 +0200
commitde66e7c3b6a9118c120212677e10e36aa76575d9 (patch)
tree2a9e63cd0e452f726d8f4d620d68617aac02cb53 /py
parentada382fa5153dce6e4b8449c9e46c827c170eb95 (diff)
ctm_test.py: Updates for tidss
Diffstat (limited to 'py')
-rwxr-xr-xpy/tests/ctm_test.py59
1 files changed, 41 insertions, 18 deletions
diff --git a/py/tests/ctm_test.py b/py/tests/ctm_test.py
index 7ceed6f..2273221 100755
--- a/py/tests/ctm_test.py
+++ b/py/tests/ctm_test.py
@@ -2,6 +2,7 @@
import sys
import pykms
+import argparse
def ctm_to_blob(ctm, card):
len=9
@@ -22,33 +23,38 @@ def ctm_to_blob(ctm, card):
return pykms.Blob(card, arr);
-if len(sys.argv) > 1:
- conn_name = sys.argv[1]
-else:
- conn_name = ""
+parser = argparse.ArgumentParser(description='Simple CRTC CTM-property test.')
+parser.add_argument('--connector', '-c', dest='connector',
+ required=False, help='connector to output')
+parser.add_argument('--mode', '-m', dest='modename',
+ required=False, help='Video mode name to use')
+parser.add_argument('--plane', '-p', dest='plane', type=int,
+ required=False, help='plane number to use')
+args = parser.parse_args()
card = pykms.Card()
res = pykms.ResourceManager(card)
-conn = res.reserve_connector(conn_name)
+conn = res.reserve_connector(args.connector)
crtc = res.reserve_crtc(conn)
-mode = conn.get_default_mode()
+format = pykms.PixelFormat.ARGB8888
+if args.modename == None:
+ mode = conn.get_default_mode()
+else:
+ mode = conn.get_mode(args.modename)
+modeb = mode.to_blob(card)
fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
pykms.draw_test_pattern(fb);
-crtc.set_mode(conn, fb, mode)
-
-input("press enter to set normal ctm\n")
-
-ctm = [ 1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0,
- 0.0, 0.0, 1.0 ]
-
-ctmb = ctm_to_blob(ctm, card)
+if args.plane == None:
+ plane = res.reserve_generic_plane(crtc, fb.format)
+else:
+ plane = card.planes[args.plane]
-crtc.set_prop("CTM", ctmb.id)
+card.disable_planes()
+crtc.disable_mode()
-input("press enter to set new ctm\n")
+input("press enter to set ctm at the same time with crtc mode\n")
ctm = [ 0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
@@ -56,10 +62,27 @@ ctm = [ 0.0, 1.0, 0.0,
ctmb = ctm_to_blob(ctm, card)
-crtc.set_prop("CTM", ctmb.id)
+req = pykms.AtomicReq(card)
+req.add(conn, "CRTC_ID", crtc.id)
+req.add(crtc, {"ACTIVE": 1,
+ "MODE_ID": modeb.id,
+ "CTM": ctmb.id})
+req.add_plane(plane, fb, crtc)
+r = req.commit_sync(allow_modeset = True)
+assert r == 0, "Initial commit failed: %d" % r
print("r->b g->r b->g ctm active\n")
+input("press enter to set normal ctm\n")
+
+ctm = [ 1.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0,
+ 0.0, 0.0, 1.0 ]
+
+ctmb = ctm_to_blob(ctm, card)
+
+crtc.set_prop("CTM", ctmb.id)
+
input("press enter to set new ctm\n")
ctm = [ 0.0, 0.0, 1.0,