summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-05-12 10:44:21 +0300
committerJyri Sarha <jsarha@ti.com>2017-05-31 18:49:29 +0300
commit7450c364a57ec7d9e2abd61ac6e025c53e9e7a42 (patch)
tree5c298c6f9921194ed151cc17c7f1fb252bae3a44
parent5f7d6c85666af7429e45d206e518d50099016d41 (diff)
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 @@
+#!/usr/bin/python3
+
+import pykms
+
+card = pykms.Card()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector("HDMI")
+crtc = res.reserve_crtc(conn)
+mode = conn.get_default_mode()
+modeb = mode.to_blob(card)
+plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.UYVY)
+#plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.Undefined)
+
+print("Got plane %d %d" % (plane.idx, plane.id))
+
+fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "UYVY");
+pykms.draw_test_pattern(fb);
+
+req = pykms.AtomicReq(card)
+req.add(conn, "CRTC_ID", crtc.id)
+req.add(crtc, {"ACTIVE": 1,
+ "MODE_ID": modeb.id})
+
+input("Press enter to enable crtc idx %d at %s" % (crtc.idx, conn.fullname))
+r = req.commit_sync(allow_modeset = True)
+
+input("Press enter to enable plane idx %d at %s" % (plane.idx, conn.fullname))
+
+req = pykms.AtomicReq(card)
+req.add(plane, {"FB_ID": fb.id,
+ "CRTC_ID": crtc.id,
+ "SRC_X": 0 << 16,
+ "SRC_Y": 0 << 16,
+ "SRC_W": fb.width << 16,
+ "SRC_H": fb.height << 16,
+ "CRTC_X": 0,
+ "CRTC_Y": 0,
+ "CRTC_W": fb.width,
+ "CRTC_H": fb.height,
+ "zorder": 0})
+r = req.commit_sync()
+print("Plane enable request returned %d\n" % r)
+
+yuv_types = [pykms.YUVType.BT601_Lim,
+ pykms.YUVType.BT601_Full,
+ pykms.YUVType.BT709_Lim,
+ pykms.YUVType.BT709_Full]
+
+encoding_enums = plane.get_prop("COLOR_ENCODING").enums
+range_enums = plane.get_prop("COLOR_RANGE").enums
+
+for i in range(0, 2):
+ for j in range(0, 2):
+ input("press enter to for encoding: \"%s\" range: \"%s\"\n" %
+ (encoding_enums[i], range_enums[j]))
+
+ req = pykms.AtomicReq(card)
+ req.add(plane, {"COLOR_ENCODING": i,
+ "COLOR_RANGE": j})
+ req.commit_sync()
+
+ for t in yuv_types:
+ input("press enter to redraw with yuv_type %s\n" % t)
+ pykms.draw_test_pattern(fb, t);
+
+input("press enter to exit\n")