From 0fa2f20e7c79ce2ebe88b01847d875e37ff21e62 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Mon, 6 Mar 2017 15:18:12 +0200 Subject: Add a simple and hackish plane scaling test. Signed-off-by: Tomi Valkeinen --- py/tests/scale.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 py/tests/scale.py 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 -- cgit v1.2.3