summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-12-08 15:23:38 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-04-16 19:12:43 +0300
commit66ba007edf69911e0d66b43cd8311dfcfbce8b0f (patch)
treeb113a6c9c2bf750de5c0c06907ae70e6bbf1988f
parentf3a478951ac576c69a5828d80ff23d02e0940b9e (diff)
py: db.py: Add support for cached buffers
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-xpy/tests/db.py42
1 files changed, 35 insertions, 7 deletions
diff --git a/py/tests/db.py b/py/tests/db.py
index 89fec30..88dbca2 100755
--- a/py/tests/db.py
+++ b/py/tests/db.py
@@ -6,14 +6,38 @@ import selectors
bar_width = 20
bar_speed = 8
+buffer_cached = False
+conn_name = ''
+
+def usage(argv):
+ print('Usage: %s <options> <connector name>' % argv[0])
+ print('Supported options:')
+ print(' --cached Mapped buffers cached')
+ print(' --help Display this help screen')
+
+def parse_arguments(argv):
+ global buffer_cached
+ global conn_name
+
+ for arg in argv[1:]:
+ if arg.startswith('--'):
+ if arg == '--cached':
+ buffer_cached = True
+ elif arg == '--help':
+ usage(argv)
+ exit(0)
+ else:
+ raise RuntimeError('Invalid argument %s' % arg)
+ else:
+ conn_name = arg
class FlipHandler():
def __init__(self):
super().__init__()
self.bar_xpos = 0
self.front_buf = 0
- self.fb1 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
- self.fb2 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
+ self.fb1 = pykms.OmapFramebuffer(card, mode.hdisplay, mode.vdisplay, pykms.PixelFormat.XRGB8888, buffer_cached);
+ self.fb2 = pykms.OmapFramebuffer(card, mode.hdisplay, mode.vdisplay, pykms.PixelFormat.XRGB8888, buffer_cached);
self.flips = 0
self.frames = 0
self.time = 0
@@ -57,12 +81,10 @@ class FlipHandler():
else:
crtc.page_flip(fb, self)
-if len(sys.argv) > 1:
- conn_name = sys.argv[1]
-else:
- conn_name = ''
-card = pykms.Card()
+parse_arguments(sys.argv)
+
+card = pykms.OmapCard()
res = pykms.ResourceManager(card)
conn = res.reserve_connector(conn_name)
crtc = res.reserve_crtc(conn)
@@ -84,6 +106,12 @@ def readdrm(fileobj, mask):
def readkey(fileobj, mask):
#print("KEY EVENT");
sys.stdin.readline()
+ ctx = pykms.AtomicReq(card)
+ ctx.add(crtc.primary_plane, "CRTC_ID", 0)
+ ctx.add(crtc.primary_plane, "FB_ID", 0)
+ ctx.add(crtc, "ACTIVE", False)
+# ctx.add(conn, "CRTC_ID", 0)
+ ctx.commit_sync(True)
exit(0)
sel = selectors.DefaultSelector()