1#!/usr/bin/python3 2 3import pykms 4import time 5 6card = pykms.Card() 7res = pykms.ResourceManager(card) 8conn = res.reserve_connector("") 9crtc = res.reserve_crtc(conn) 10mode = conn.get_default_mode() 11modeb = mode.to_blob(card) 12format = pykms.PixelFormat.ARGB8888 13plane1 = res.reserve_generic_plane(crtc, format) 14plane2 = res.reserve_generic_plane(crtc, format) 15 16print("Got plane1 %d %d plane2 %d %d" % 17 (plane1.idx, plane1.id, plane2.idx, plane2.id)) 18 19fb1 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, format); 20pykms.draw_test_pattern(fb1); 21 22fb2 = pykms.DumbFramebuffer(card, mode.hdisplay >> 1, mode.vdisplay >> 1, format); 23pykms.draw_test_pattern(fb2); 24 25alpha = 0 26 27req = pykms.AtomicReq(card) 28req.add(conn, "CRTC_ID", crtc.id) 29req.add(crtc, {"ACTIVE": 1, 30 "MODE_ID": modeb.id}) 31req.add_plane(plane1, fb1, crtc) 32req.add_plane(plane2, fb2, crtc) 33 34r = req.commit_sync(allow_modeset = True) 35assert r == 0, "Initial commit failed: %d" % r 36 37while alpha <= 0xFFFF: 38 print("alpha %d" % (alpha >> 8)) 39 req = pykms.AtomicReq(card) 40 req.add(plane2, {"alpha": alpha }) 41 r = req.commit_sync() 42 assert r == 0, "alpha change commit failed: %d" % r 43 alpha = alpha + 0xFF 44 time.sleep(0.1) 45 46input("press enter exit\n") 47