implement wait for update ioctl
raisjn opened this issue · 3 comments
raisjn commented
in mxcfb on rM1, using ioctl there is ability to do:
send_upate { update_marker: X };
wait_for_update { update_marker: X};
in rm2fb, there is no longer the "wait for update" ability due to two things:
- there's only single way communication from client -> server
- the framebuffer API has a command, "waitForLastUpdate()" but it does not support supplying a marker ID (i think). translating "send_update; wait_for_update ID" into "send_update; waitForLastUpdate()" requires knowing when to call waitForLastUpate() after drawing an update, but the
wait_for_update
can come at any arbitrary time and we process the incoming events in order.
this task is to give the ability for rM2 apps to wait for a previous draw to finish.
raisjn commented
some possible solutions:
- hardcode some amount like 200ms (see #44)
- add a function that guesses the draw time based on region size and waveform
- implement event system from server that client can subscribe to
raisjn commented
another solution proposed (by bokluk) is to use semaphores and would work something like:
when WAIT ioctl is issued on the client:
- the client places a special messages into the IPC queue. the message contains the ID of the semaphore to signal.
- then the client waits on that semaphore (with a timeout just in case).
- when the server gets to processing this message, it opens the indicated semaphore and signals that its ready