summaryrefslogtreecommitdiff
path: root/py/tests/alpha-test.py
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-01-02 16:42:08 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-01-03 10:46:42 +0200
commitb11baff09f78a4a383f817ec35208ae8966ab832 (patch)
tree610e89719c4a3d9714a472cdc6681e36df419a1b /py/tests/alpha-test.py
parentc6f964425cdec25e3d0ecd0054d398d3420fdfeb (diff)
py: Reorganize source directory
Separate the Python bindings sources from the test scripts. While at it, remove the unneeded run.sh script. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'py/tests/alpha-test.py')
-rwxr-xr-xpy/tests/alpha-test.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/py/tests/alpha-test.py b/py/tests/alpha-test.py
new file mode 100755
index 0000000..c6ec8ee
--- /dev/null
+++ b/py/tests/alpha-test.py
@@ -0,0 +1,67 @@
+#!/usr/bin/python3
+
+import pykms
+from helpers import *
+import time
+
+# This hack makes drm initialize the fbcon, setting up the default connector
+card = pykms.Card()
+card = 0
+
+card = pykms.Card()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector()
+crtc = res.reserve_crtc(conn)
+mode = conn.get_default_mode()
+
+planes = []
+for p in card.planes:
+ if p.supports_crtc(crtc) == False:
+ continue
+ planes.append(p)
+
+if len(planes) != 3:
+ print("Need 3 planes!")
+ exit(1)
+
+disable_planes(card)
+
+w = mode.hdisplay
+h = mode.vdisplay
+
+fbs=[]
+
+for i in range(len(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))
+
+
+set_props(crtc, {
+ "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))
+
+ set_props(plane, {
+ "FB_ID": fb.id,
+ "CRTC_ID": crtc.id,
+ "SRC_W": fb.width << 16,
+ "SRC_H": fb.height << 16,
+ "CRTC_W": fb.width,
+ "CRTC_H": fb.height,
+ "zorder": i,
+ })
+
+ time.sleep(1)
+
+input("press enter to exit\n")