Currently the EGL surface buffer is released while the buffer is still being scanned out to the display. This is not the correct behavior, since it should be only released after the buffer is not scanned out anymore (i.e. the next buffer was page flipped).
I just realized the above isn't true, since we always ran into the first branch of pageFlippedBufferRemover, if the buffer uses a surface. Still imo the patched code makes more sense structurally and I'm wondering how the display removal has worked before.
The only caveat is, that in order to remove an output correctly, we need to release the buffer manually now before the EGL surface is destroyed.