diff options
author | Simon Ser <contact@emersion.fr> | 2021-11-30 18:07:39 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-11-30 18:32:48 +0000 |
commit | 456b971099b135512ce01383b486965290bf29db (patch) | |
tree | f115569acb74f718c5b54239575d0fe393bfebb0 | |
parent | 6bfb930aa70ceb41455b9da2719a10538493a65d (diff) |
output: destroy swapchain when disabled
This avoids consuming GPU memory when an output is disabled.
-rw-r--r-- | types/output/output.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/types/output/output.c b/types/output/output.c index 76c9ed9e..d6f8f97a 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -715,6 +715,15 @@ bool wlr_output_commit(struct wlr_output *output) { wlr_output_schedule_done(output); } + // Destroy the swapchains when an output is disabled + if ((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) && + !output->pending.enabled) { + wlr_swapchain_destroy(output->swapchain); + output->swapchain = NULL; + wlr_swapchain_destroy(output->cursor_swapchain); + output->cursor_swapchain = NULL; + } + // Unset the front-buffer when a new buffer will replace it or when the // output is getting disabled if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) || |