summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2018-09-25 10:02:02 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2018-10-03 14:12:08 +0300
commit89dd52981ecd4a132c7dbdc3bb8fbca1f9709ce9 (patch)
treee1b7e1d4b8eb6c8ada74332b7681b6d3b6cca6d1
parent0bff4aa4d7ff3a506495e98dc3c889db61250f52 (diff)
test.py: cleanup
-rwxr-xr-xpy/tests/test.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/py/tests/test.py b/py/tests/test.py
index 61750dc..83cf16a 100755
--- a/py/tests/test.py
+++ b/py/tests/test.py
@@ -2,36 +2,32 @@
import sys
import pykms
+import argparse
-# draw test pattern via dmabuf?
-dmabuf = False
+parser = argparse.ArgumentParser()
+parser.add_argument("-c", "--connector", default="")
+parser.add_argument("--dmabuf", action="store_true", help="use dmabuf")
+parser.add_argument("--omap", action="store_true", help="use omapcard")
+args = parser.parse_args()
-# Use omap?
-omap = False
-
-if omap:
+if args.omap:
card = pykms.OmapCard()
else:
card = pykms.Card()
-if len(sys.argv) > 1:
- conn_name = sys.argv[1]
-else:
- conn_name = ""
-
res = pykms.ResourceManager(card)
-conn = res.reserve_connector(conn_name)
+conn = res.reserve_connector(args.connector)
crtc = res.reserve_crtc(conn)
plane = res.reserve_generic_plane(crtc)
mode = conn.get_default_mode()
modeb = mode.to_blob(card)
-if omap:
+if args.omap:
origfb = pykms.OmapFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
else:
origfb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
-if dmabuf:
+if args.dmabuf:
fb = pykms.ExtFramebuffer(card, origfb.width, origfb.height, origfb.format,
[origfb.fd(0)], [origfb.stride(0)], [origfb.offset(0)])
else: