• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python3
2
3import sys
4import pykms
5
6# draw test pattern via dmabuf?
7dmabuf = False
8
9# Use omap?
10omap = False
11
12if omap:
13	card = pykms.OmapCard()
14else:
15	card = pykms.Card()
16
17if len(sys.argv) > 1:
18    conn_name = sys.argv[1]
19else:
20    conn_name = ""
21
22res = pykms.ResourceManager(card)
23conn = res.reserve_connector(conn_name)
24crtc = res.reserve_crtc(conn)
25plane = res.reserve_generic_plane(crtc)
26mode = conn.get_default_mode()
27modeb = mode.to_blob(card)
28
29if omap:
30	origfb = pykms.OmapFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
31else:
32	origfb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
33
34if dmabuf:
35	fb = pykms.ExtFramebuffer(card, origfb.width, origfb.height, origfb.format,
36		[origfb.fd(0)], [origfb.stride(0)], [origfb.offset(0)])
37else:
38	fb = origfb
39
40pykms.draw_test_pattern(fb);
41
42card.disable_planes()
43
44req = pykms.AtomicReq(card)
45
46req.add(conn, "CRTC_ID", crtc.id)
47
48req.add(crtc, {"ACTIVE": 1,
49		"MODE_ID": modeb.id})
50
51req.add(plane, {"FB_ID": fb.id,
52		"CRTC_ID": crtc.id,
53		"SRC_X": 0 << 16,
54		"SRC_Y": 0 << 16,
55		"SRC_W": mode.hdisplay << 16,
56		"SRC_H": mode.vdisplay << 16,
57		"CRTC_X": 0,
58		"CRTC_Y": 0,
59		"CRTC_W": mode.hdisplay,
60		"CRTC_H": mode.vdisplay,
61		"zorder": 0})
62
63req.commit_sync(allow_modeset = True)
64
65input("press enter to exit\n")
66