relases gbm buffers on init

The wlr_drm_surface_init function is called (upon others) when the drm
mode is changed.
When the surface was used previously this replaced the gbm_surface, but
did not replace the gbm buffers (front/back).
With this, wlr_drm_surface_get_from never set up the new buffers with
the new glViewport because surf->front existed.

This frees the buffers to get new buffers on the new surface with the
new viewport.
This commit is contained in:
Markus Ongyerth 2018-01-29 11:29:54 +01:00
parent 60b2d969e0
commit 2cdb646531
1 changed files with 11 additions and 0 deletions

View File

@ -66,6 +66,17 @@ bool wlr_drm_surface_init(struct wlr_drm_surface *surf,
surf->width = width;
surf->height = height;
if (surf->gbm) {
if (surf->front) {
gbm_surface_release_buffer(surf->gbm, surf->front);
surf->front = NULL;
}
if (surf->back) {
gbm_surface_release_buffer(surf->gbm, surf->back);
surf->back = NULL;
}
}
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
format, GBM_BO_USE_RENDERING | flags);
if (!surf->gbm) {