summaryrefslogtreecommitdiff
path: root/py/tests
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2020-02-10 12:15:09 +0200
committerJyri Sarha <jsarha@ti.com>2020-02-14 13:08:53 +0200
commit72c59c98feac6c081646da8d763c88ed8087c60b (patch)
treecc8e72d9d149cc43df25b8f3cc0257afca843fcd /py/tests
parentde66e7c3b6a9118c120212677e10e36aa76575d9 (diff)
alpha-test.py: Updates for tidss
Diffstat (limited to 'py/tests')
-rwxr-xr-xpy/tests/alpha-test.py48
1 files changed, 33 insertions, 15 deletions
diff --git a/py/tests/alpha-test.py b/py/tests/alpha-test.py
index e329ce4..94d3836 100755
--- a/py/tests/alpha-test.py
+++ b/py/tests/alpha-test.py
@@ -2,24 +2,38 @@
import pykms
import time
+import argparse
+
+parser = argparse.ArgumentParser(description='Simple alpha blending test.')
+parser.add_argument('--resetcrtc', action="store_true",
+ help='Reset legacy CRTC color properties')
+parser.add_argument('--connector', '-c', dest='connector', default="",
+ required=False, help='connector to output')
+parser.add_argument('--mode', '-m', dest='modename',
+ required=False, help='Video mode name to use')
+args = parser.parse_args()
+
+max_planes = 4
card = pykms.Card()
res = pykms.ResourceManager(card)
-conn = res.reserve_connector()
+conn = res.reserve_connector(args.connector)
crtc = res.reserve_crtc(conn)
-mode = conn.get_default_mode()
+if args.modename == None:
+ mode = conn.get_default_mode()
+else:
+ mode = conn.get_mode(args.modename)
planes = []
-for i in range(3):
+for i in range(max_planes):
p = res.reserve_generic_plane(crtc)
-
if p == None:
- print("Need 3 planes!")
- exit(1)
-
+ break
planes.append(p)
+print("Got {} planes. Test supports up to 4 planes.".format(len(planes)))
+
card.disable_planes()
w = mode.hdisplay
@@ -27,25 +41,29 @@ h = mode.vdisplay
fbs=[]
-for i in range(len(planes)):
+for i in range(max_planes):
fbs.append(pykms.DumbFramebuffer(card, w, h, "AR24"))
pykms.draw_rect(fbs[0], 50, 50, 200, 200, pykms.RGB(128, 255, 0, 0))
pykms.draw_rect(fbs[1], 150, 50, 200, 200, pykms.RGB(128, 0, 255, 0))
pykms.draw_rect(fbs[2], 50, 150, 200, 200, pykms.RGB(128, 0, 0, 255))
+pykms.draw_rect(fbs[3], 150, 150, 200, 200, pykms.RGB(128, 128, 128, 128))
+
+card.disable_planes()
-crtc.set_props({
- "trans-key-mode": 0,
- "trans-key": 0,
- "background": 0,
- "alpha_blender": 1,
-})
+if args.resetcrtc:
+ crtc.set_props({
+ "trans-key-mode": 0,
+ "trans-key": 0,
+ "background": 0,
+ "alpha_blender": 1,
+ })
for i in range(len(planes)):
plane = planes[i]
fb = fbs[i]
- print("set crtc {}, plane {}, fb {}".format(crtc.id, p.id, fbs[i].id))
+ print("set crtc {}, plane {}, z {}, fb {}".format(crtc.id, plane.id, i, fb.id))
plane.set_props({
"FB_ID": fb.id,