fpv-wtf / msp-osd

MSP DisplayPort OSD
GNU General Public License v3.0
226 stars 32 forks source link

Change framebuffer handling to avoid the reboot #131

Closed benlumley closed 1 year ago

benlumley commented 1 year ago

Pending some final test runs to confirm/validate existing test results.

Long run tests are suggesting that the change here to singlebuffering with memcpy from a backbuffer, instead of swapping the buffers avoids the occasional reboot. (single buffer works too - but it's hard to avoid flickers)

We believe this brings some hypothetical risk of tearing type glitches, though we've yet to see it.

j005u commented 1 year ago

In case anyone ever comes spelunking here: further, we are relatively confident the actual issue is multithreaded usage of dji's push_frame function. Tests have shown that submitting frames from two different threads will cause (very rare) crashes, while single threaded operation will run for 24h+.

This approach allows us to avoid re-writing things to do our rendering on the main GUI thread by avoiding submitting frames and always memcpy-ing into the currently active framebuffer. Like ben mentioned, this may introduce sub-frame tearing during the scanout. Ideally we'll still pursue a single threaded solution with proper double buffering in future if time allows.