1#!/usr/bin/python3 2 3import sys 4import pykms 5import argparse 6 7parser = argparse.ArgumentParser() 8parser.add_argument("-c", "--connector", default="") 9parser.add_argument("--dmabuf", action="store_true", help="use dmabuf") 10parser.add_argument("--omap", action="store_true", help="use omapcard") 11args = parser.parse_args() 12 13if args.omap: 14 card = pykms.OmapCard() 15else: 16 card = pykms.Card() 17 18res = pykms.ResourceManager(card) 19conn = res.reserve_connector(args.connector) 20crtc = res.reserve_crtc(conn) 21plane = res.reserve_generic_plane(crtc) 22mode = conn.get_default_mode() 23modeb = mode.to_blob(card) 24 25if args.omap: 26 origfb = pykms.OmapFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); 27else: 28 origfb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); 29 30if args.dmabuf: 31 fb = pykms.DmabufFramebuffer(card, origfb.width, origfb.height, origfb.format, 32 [origfb.fd(0)], [origfb.stride(0)], [origfb.offset(0)]) 33else: 34 fb = origfb 35 36pykms.draw_test_pattern(fb); 37 38card.disable_planes() 39 40req = pykms.AtomicReq(card) 41 42req.add_connector(conn, crtc) 43req.add_crtc(crtc, modeb) 44req.add_plane(plane, fb, crtc, dst=(0, 0, mode.hdisplay, mode.vdisplay)) 45 46req.commit_sync(allow_modeset = True) 47 48input("press enter to exit\n") 49