aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'py/tests/big_fb.py')
-rwxr-xr-xpy/tests/big_fb.py33
1 files changed, 12 insertions, 21 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:
112 self.flips = 0 112 self.flips = 0
113 self.frames = 0 113 self.frames = 0
114 self.time = 0 114 self.time = 0
115 self.flip_count = 100
115 116
116 def new_color(self): 117 def new_color(self):
117 r = random.randrange(255) 118 r = random.randrange(255)
@@ -190,7 +191,7 @@ class bigFB_db:
190 191
191 screen_offset += mode.hdisplay 192 screen_offset += mode.hdisplay
192 193
193 req.commit(self) 194 req.commit(0)
194 195
195 def handle_page_flip_separate(self): 196 def handle_page_flip_separate(self):
196 self.draw_buf ^= 1 197 self.draw_buf ^= 1
@@ -222,9 +223,16 @@ class bigFB_db:
222 223
223 screen_offset += mode.hdisplay 224 screen_offset += mode.hdisplay
224 225
225 req.commit(self) 226 req.commit(0)
226 227
227 def handle_page_flip_main(self, frame, time): 228 def handle_page_flip_main(self, frame, time):
229 self.flip_count += 1
230
231 if self.flip_count < len(conn_list):
232 return
233
234 self.flip_count = 0
235
228 # statistics 236 # statistics
229 self.flips += 1 237 self.flips += 1
230 if self.time == 0: 238 if self.time == 0:
@@ -254,31 +262,14 @@ box_db.handle_page_flip_main(0, 0)
254def readdrm(fileobj, mask): 262def readdrm(fileobj, mask):
255 for ev in card.read_events(): 263 for ev in card.read_events():
256 if ev.type == pykms.DrmEventType.FLIP_COMPLETE: 264 if ev.type == pykms.DrmEventType.FLIP_COMPLETE:
257 ev.data.handle_page_flip_main(ev.seq, ev.time) 265 box_db.handle_page_flip_main(ev.seq, ev.time)
258
259event_counter = len(conn_list)
260def readdrm_counted(fileobj, mask):
261 global event_counter
262
263 for ev in card.read_events():
264 if ev.type == pykms.DrmEventType.FLIP_COMPLETE:
265 # we expect events for each display (crtc), but only execute the
266 # next drawing and flip when we have received the last event.
267 event_counter -= 1
268 if event_counter == 0:
269 event_counter = len(conn_list)
270 ev.data.handle_page_flip_main(ev.seq, ev.time)
271 266
272def readkey(fileobj, mask): 267def readkey(fileobj, mask):
273 sys.stdin.readline() 268 sys.stdin.readline()
274 exit(0) 269 exit(0)
275 270
276sel = selectors.DefaultSelector() 271sel = selectors.DefaultSelector()
277if args.flipmode == 'single': 272sel.register(card.fd, selectors.EVENT_READ, readdrm)
278 sel.register(card.fd, selectors.EVENT_READ, readdrm)
279else:
280 sel.register(card.fd, selectors.EVENT_READ, readdrm_counted)
281
282sel.register(sys.stdin, selectors.EVENT_READ, readkey) 273sel.register(sys.stdin, selectors.EVENT_READ, readkey)
283 274
284while True: 275while True: