summaryrefslogtreecommitdiff
path: root/py/tests
diff options
context:
space:
mode:
Diffstat (limited to 'py/tests')
-rwxr-xr-xpy/tests/big_fb.py33
-rwxr-xr-xpy/tests/db.py6
-rwxr-xr-xpy/tests/modeset_event.py4
-rwxr-xr-xpy/tests/sync.py4
4 files changed, 19 insertions, 28 deletions
diff --git a/py/tests/big_fb.py b/py/tests/big_fb.py
index 1642376..54de685 100755
--- a/py/tests/big_fb.py
+++ b/py/tests/big_fb.py
@@ -112,6 +112,7 @@ class bigFB_db:
self.flips = 0
self.frames = 0
self.time = 0
+ self.flip_count = 100
def new_color(self):
r = random.randrange(255)
@@ -190,7 +191,7 @@ class bigFB_db:
screen_offset += mode.hdisplay
- req.commit(self)
+ req.commit(0)
def handle_page_flip_separate(self):
self.draw_buf ^= 1
@@ -222,9 +223,16 @@ class bigFB_db:
screen_offset += mode.hdisplay
- req.commit(self)
+ req.commit(0)
def handle_page_flip_main(self, frame, time):
+ self.flip_count += 1
+
+ if self.flip_count < len(conn_list):
+ return
+
+ self.flip_count = 0
+
# statistics
self.flips += 1
if self.time == 0:
@@ -254,31 +262,14 @@ box_db.handle_page_flip_main(0, 0)
def readdrm(fileobj, mask):
for ev in card.read_events():
if ev.type == pykms.DrmEventType.FLIP_COMPLETE:
- ev.data.handle_page_flip_main(ev.seq, ev.time)
-
-event_counter = len(conn_list)
-def readdrm_counted(fileobj, mask):
- global event_counter
-
- for ev in card.read_events():
- if ev.type == pykms.DrmEventType.FLIP_COMPLETE:
- # we expect events for each display (crtc), but only execute the
- # next drawing and flip when we have received the last event.
- event_counter -= 1
- if event_counter == 0:
- event_counter = len(conn_list)
- ev.data.handle_page_flip_main(ev.seq, ev.time)
+ box_db.handle_page_flip_main(ev.seq, ev.time)
def readkey(fileobj, mask):
sys.stdin.readline()
exit(0)
sel = selectors.DefaultSelector()
-if args.flipmode == 'single':
- sel.register(card.fd, selectors.EVENT_READ, readdrm)
-else:
- sel.register(card.fd, selectors.EVENT_READ, readdrm_counted)
-
+sel.register(card.fd, selectors.EVENT_READ, readdrm)
sel.register(sys.stdin, selectors.EVENT_READ, readkey)
while True:
diff --git a/py/tests/db.py b/py/tests/db.py
index 660364d..f7b13eb 100755
--- a/py/tests/db.py
+++ b/py/tests/db.py
@@ -52,9 +52,9 @@ class FlipHandler():
if card.has_atomic:
ctx = pykms.AtomicReq(card)
ctx.add(crtc.primary_plane, "FB_ID", fb.id)
- ctx.commit(self)
+ ctx.commit()
else:
- crtc.page_flip(fb, self)
+ crtc.page_flip(fb)
if len(sys.argv) > 1:
conn_name = sys.argv[1]
@@ -77,7 +77,7 @@ def readdrm(fileobj, mask):
#print("EVENT");
for ev in card.read_events():
if ev.type == pykms.DrmEventType.FLIP_COMPLETE:
- ev.data.handle_page_flip(ev.seq, ev.time)
+ fliphandler.handle_page_flip(ev.seq, ev.time)
def readkey(fileobj, mask):
diff --git a/py/tests/modeset_event.py b/py/tests/modeset_event.py
index 0957e51..11cfd58 100755
--- a/py/tests/modeset_event.py
+++ b/py/tests/modeset_event.py
@@ -6,7 +6,7 @@ import sys
def readdrm(fileobj, mask):
for ev in card.read_events():
- ev.data(ev)
+ eventhandler(ev)
def waitevent(sel):
events = sel.select(1)
@@ -67,7 +67,7 @@ if ret != 0:
print("Atomic test failed: %d" % ret)
sys.exit()
-req.commit(eventhandler, allow_modeset = True)
+req.commit(0, allow_modeset = True)
waitevent(sel)
input("press enter to exit\n")
diff --git a/py/tests/sync.py b/py/tests/sync.py
index 4616ee8..e394c8d 100755
--- a/py/tests/sync.py
+++ b/py/tests/sync.py
@@ -148,7 +148,7 @@ class FlipHandler():
fence = self.timeline.create_fence(2 * self.flips - 1)
req = pykms.AtomicReq(self.crtc.card)
req.add(self.crtc.primary_plane, { 'FB_ID': fb.id, 'IN_FENCE_FD': fence.fd })
- req.commit(self)
+ req.commit()
del fence
# Arm a timer to signal the fence in 0.5s.
@@ -207,7 +207,7 @@ def main(argv):
def readdrm(fileobj, mask):
for ev in card.read_events():
if ev.type == pykms.DrmEventType.FLIP_COMPLETE:
- ev.data.handle_page_flip(ev.seq, ev.time)
+ flip_handler.handle_page_flip(ev.seq, ev.time)
def readkey(fileobj, mask):
sys.stdin.readline()