diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-01-29 11:29:54 +0100 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-01-29 11:29:54 +0100 |
commit | 2cdb646531d949e08b8a0538b05bd38af3157408 (patch) | |
tree | 38815c0a39ee068cbee26c8f9b9fcdc3e482f5b2 /backend/drm/renderer.c | |
parent | 60b2d969e07e24ed1b96ccc9d82bc2f9c1d540f2 (diff) |
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.
Diffstat (limited to 'backend/drm/renderer.c')
-rw-r--r-- | backend/drm/renderer.c | 11 |
1 files changed, 11 insertions, 0 deletions
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) { |