diff options
-rwxr-xr-x | py/tests/plane_csc.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/py/tests/plane_csc.py b/py/tests/plane_csc.py new file mode 100755 index 0000000..be92c00 --- /dev/null +++ b/py/tests/plane_csc.py | |||
@@ -0,0 +1,66 @@ | |||
1 | #!/usr/bin/python3 | ||
2 | |||
3 | import pykms | ||
4 | |||
5 | card = pykms.Card() | ||
6 | res = pykms.ResourceManager(card) | ||
7 | conn = res.reserve_connector("HDMI") | ||
8 | crtc = res.reserve_crtc(conn) | ||
9 | mode = conn.get_default_mode() | ||
10 | modeb = mode.to_blob(card) | ||
11 | plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.UYVY) | ||
12 | #plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.Undefined) | ||
13 | |||
14 | print("Got plane %d %d" % (plane.idx, plane.id)) | ||
15 | |||
16 | fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "UYVY"); | ||
17 | pykms.draw_test_pattern(fb); | ||
18 | |||
19 | req = pykms.AtomicReq(card) | ||
20 | req.add(conn, "CRTC_ID", crtc.id) | ||
21 | req.add(crtc, {"ACTIVE": 1, | ||
22 | "MODE_ID": modeb.id}) | ||
23 | |||
24 | input("Press enter to enable crtc idx %d at %s" % (crtc.idx, conn.fullname)) | ||
25 | r = req.commit_sync(allow_modeset = True) | ||
26 | |||
27 | input("Press enter to enable plane idx %d at %s" % (plane.idx, conn.fullname)) | ||
28 | |||
29 | req = pykms.AtomicReq(card) | ||
30 | req.add(plane, {"FB_ID": fb.id, | ||
31 | "CRTC_ID": crtc.id, | ||
32 | "SRC_X": 0 << 16, | ||
33 | "SRC_Y": 0 << 16, | ||
34 | "SRC_W": fb.width << 16, | ||
35 | "SRC_H": fb.height << 16, | ||
36 | "CRTC_X": 0, | ||
37 | "CRTC_Y": 0, | ||
38 | "CRTC_W": fb.width, | ||
39 | "CRTC_H": fb.height, | ||
40 | "zorder": 0}) | ||
41 | r = req.commit_sync() | ||
42 | print("Plane enable request returned %d\n" % r) | ||
43 | |||
44 | yuv_types = [pykms.YUVType.BT601_Lim, | ||
45 | pykms.YUVType.BT601_Full, | ||
46 | pykms.YUVType.BT709_Lim, | ||
47 | pykms.YUVType.BT709_Full] | ||
48 | |||
49 | encoding_enums = plane.get_prop("COLOR_ENCODING").enums | ||
50 | range_enums = plane.get_prop("COLOR_RANGE").enums | ||
51 | |||
52 | for i in range(0, 2): | ||
53 | for j in range(0, 2): | ||
54 | input("press enter to for encoding: \"%s\" range: \"%s\"\n" % | ||
55 | (encoding_enums[i], range_enums[j])) | ||
56 | |||
57 | req = pykms.AtomicReq(card) | ||
58 | req.add(plane, {"COLOR_ENCODING": i, | ||
59 | "COLOR_RANGE": j}) | ||
60 | req.commit_sync() | ||
61 | |||
62 | for t in yuv_types: | ||
63 | input("press enter to redraw with yuv_type %s\n" % t) | ||
64 | pykms.draw_test_pattern(fb, t); | ||
65 | |||
66 | input("press enter to exit\n") | ||