summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-03-06 15:18:12 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-03-17 15:07:00 +0200
commit0fa2f20e7c79ce2ebe88b01847d875e37ff21e62 (patch)
treec77df229fe7a2f218cc172054f11afb19e5a2282
parentdb0b061c5a6e2a0d03f6060472ecd13391fd313f (diff)
Add a simple and hackish plane scaling test.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rwxr-xr-xpy/tests/scale.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/py/tests/scale.py b/py/tests/scale.py
new file mode 100755
index 0000000..0b97051
--- /dev/null
+++ b/py/tests/scale.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python3
+
+import pykms
+import time
+import random
+
+card = pykms.Card()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector("hdmi")
+crtc = res.reserve_crtc(conn)
+plane = res.reserve_overlay_plane(crtc)
+
+mode = conn.get_default_mode()
+#mode = conn.get_mode(1920, 1080, 60, False)
+
+# Blank framefuffer for primary plane
+fb0 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "AR24");
+
+crtc.set_mode(conn, fb0, mode)
+
+# Initialize framebuffer for the scaled plane
+fbX = 1920
+fbY = 1080
+fb = pykms.DumbFramebuffer(card, fbX, fbY, "RG16");
+pykms.draw_test_pattern(fb);
+
+# Plane's scaled size and size increments
+W = 72
+H = 54
+Winc = 1
+Hinc = 1
+
+# Plane's position and position increments
+X = 0
+Y = 0
+Xinc = 1
+Yinc = 1
+while True:
+ print("+%d+%d %dx%d" % (X, Y, W, H))
+ crtc.set_plane(plane, fb, X, Y, W, H, 0, 0, fbX, fbY)
+ W = W + Winc
+ H = H + Hinc
+ if (Winc == 1 and W >= mode.hdisplay - X):
+ Winc = -1
+ if (Winc == -1 and W <= fbX/32):
+ Winc = 1
+ if (Hinc == 1 and H >= mode.vdisplay - Y):
+ Hinc = -1
+ if (Hinc == -1 and H <= fbY/32):
+ Hinc = 1
+ X = X + Xinc
+ Y = Y + Yinc
+ if (Xinc == 1 and X >= mode.hdisplay - W):
+ Xinc = -1
+ if (Xinc == -1 and X <= 0):
+ Xinc = 1
+ if (Yinc == 1 and Y >= mode.vdisplay - H):
+ Yinc = -1
+ if (Yinc == -1 and Y <= 0):
+ Yinc = 1