gbm: lock and release buffer in swap buffers

Otherwise mesa prints "libEGL debug: EGL user error 0x300d
(EGL_BAD_SURFACE) in dri2_swap_buffers" when environment
variable EGL_LOG_LEVEL=debug.