1#!/usr/bin/python3 2 3import pykms 4import time 5import random 6 7card = pykms.Card() 8res = pykms.ResourceManager(card) 9conn = res.reserve_connector("hdmi") 10crtc = res.reserve_crtc(conn) 11plane = res.reserve_overlay_plane(crtc) 12 13mode = conn.get_default_mode() 14#mode = conn.get_mode(1920, 1080, 60, False) 15 16# Blank framefuffer for primary plane 17fb0 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "AR24"); 18 19crtc.set_mode(conn, fb0, mode) 20 21# Initialize framebuffer for the scaled plane 22fbX = 1920 23fbY = 1080 24fb = pykms.DumbFramebuffer(card, fbX, fbY, "RG16"); 25pykms.draw_test_pattern(fb); 26 27# Plane's scaled size and size increments 28W = 72 29H = 54 30Winc = 1 31Hinc = 1 32 33# Plane's position and position increments 34X = 0 35Y = 0 36Xinc = 1 37Yinc = 1 38while True: 39 print("+%d+%d %dx%d" % (X, Y, W, H)) 40 crtc.set_plane(plane, fb, X, Y, W, H, 0, 0, fbX, fbY) 41 W = W + Winc 42 H = H + Hinc 43 if (Winc == 1 and W >= mode.hdisplay - X): 44 Winc = -1 45 if (Winc == -1 and W <= fbX/32): 46 Winc = 1 47 if (Hinc == 1 and H >= mode.vdisplay - Y): 48 Hinc = -1 49 if (Hinc == -1 and H <= fbY/32): 50 Hinc = 1 51 X = X + Xinc 52 Y = Y + Yinc 53 if (Xinc == 1 and X >= mode.hdisplay - W): 54 Xinc = -1 55 if (Xinc == -1 and X <= 0): 56 Xinc = 1 57 if (Yinc == 1 and Y >= mode.vdisplay - H): 58 Yinc = -1 59 if (Yinc == -1 and Y <= 0): 60 Yinc = 1 61