egl_gbm: fix dma-buf file descriptor leak
Gbm states the following:
Each call to gbm_bo_get_fd_for_plane() returns a new file descriptor and the caller is responsible for closing the file descriptor.
This is currently not satisfied. Because of that, the application quickly runs out of the file descriptors that the system can give when resizing the video window.
At the same time, the dma-buf protocol states:
The dmabuf file descriptors relayed to the server will stay valid for the whole lifetime of the wl_buffer.
Because of that I tried to release the descriptors after the wayland buffer is released, instead of immediately after the wayland buffer is created.
This fixes the crash for me when I resize the window on wayland. In my case it takes a few seconds of accumulated resize before running out of file descriptors.
Request review @chub.