ddvk / remarkable2-framebuffer

remarkable2 framebuffer reversing
MIT License
276 stars 22 forks source link

implement wait for update ioctl #44

Closed raisjn closed 3 years ago

raisjn commented 3 years ago

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:

1) there's only single way communication from client -> server 2) 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 3 years ago

some possible solutions:

raisjn commented 3 years ago

another solution proposed (by bokluk) is to use semaphores and would work something like:

when WAIT ioctl is issued on the client:

raisjn commented 3 years ago

first attempt in https://github.com/ddvk/remarkable2-framebuffer/pull/45. this solves some weird behavior i was seeing in an app previously and i expect it should work in other places too