aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJyri Sarha2017-05-12 02:44:21 -0500
committerJyri Sarha2017-05-31 10:49:29 -0500
commit7450c364a57ec7d9e2abd61ac6e025c53e9e7a42 (patch)
tree5c298c6f9921194ed151cc17c7f1fb252bae3a44
parent5f7d6c85666af7429e45d206e518d50099016d41 (diff)
downloadexternal-kmsxx-7450c364a57ec7d9e2abd61ac6e025c53e9e7a42.tar.gz
external-kmsxx-7450c364a57ec7d9e2abd61ac6e025c53e9e7a42.tar.xz
external-kmsxx-7450c364a57ec7d9e2abd61ac6e025c53e9e7a42.zip
plane_csc.py: Test for different YCbCr encodings
-rwxr-xr-xpy/tests/plane_csc.py66
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
3import pykms
4
5card = pykms.Card()
6res = pykms.ResourceManager(card)
7conn = res.reserve_connector("HDMI")
8crtc = res.reserve_crtc(conn)
9mode = conn.get_default_mode()
10modeb = mode.to_blob(card)
11plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.UYVY)
12#plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.Undefined)
13
14print("Got plane %d %d" % (plane.idx, plane.id))
15
16fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "UYVY");
17pykms.draw_test_pattern(fb);
18
19req = pykms.AtomicReq(card)
20req.add(conn, "CRTC_ID", crtc.id)
21req.add(crtc, {"ACTIVE": 1,
22 "MODE_ID": modeb.id})
23
24input("Press enter to enable crtc idx %d at %s" % (crtc.idx, conn.fullname))
25r = req.commit_sync(allow_modeset = True)
26
27input("Press enter to enable plane idx %d at %s" % (plane.idx, conn.fullname))
28
29req = pykms.AtomicReq(card)
30req.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})
41r = req.commit_sync()
42print("Plane enable request returned %d\n" % r)
43
44yuv_types = [pykms.YUVType.BT601_Lim,
45 pykms.YUVType.BT601_Full,
46 pykms.YUVType.BT709_Lim,
47 pykms.YUVType.BT709_Full]
48
49encoding_enums = plane.get_prop("COLOR_ENCODING").enums
50range_enums = plane.get_prop("COLOR_RANGE").enums
51
52for 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
66input("press enter to exit\n")