From 2cdb646531d949e08b8a0538b05bd38af3157408 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Mon, 29 Jan 2018 11:29:54 +0100 Subject: 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. --- backend/drm/renderer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'backend/drm') diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 00182c59..d28164aa 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -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) { -- cgit v1.2.3