aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-10-22 19:29:18 +0200
committerScott Anderson <ascent12@hotmail.com>2019-10-22 21:50:31 +0000
commitfd25e2ca116f4c16f48aa62cabf46ce171f2bf41 (patch)
tree11620e521ab0e470378e218fc93f3aecde5c0b84 /backend
parent61a6f2b928bc585040a7eb02594562c2fb5d66a9 (diff)
backend/drm: track gbm_bo during direct scan-out
We need to destroy the gbm_bo we imported and drmModeRmFb. Closes: https://github.com/swaywm/sway/issues/4662
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 15311a18..b9a9d9ba 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -382,6 +382,11 @@ static bool drm_connector_commit(struct wlr_output *output) {
return false;
}
+ if (conn->pending_bo != NULL) {
+ gbm_bo_destroy(conn->pending_bo);
+ }
+ conn->pending_bo = bo;
+
fb_id = get_fb_for_bo(bo, gbm_bo_get_format(bo), drm->addfb2_modifiers);
if (fb_id == 0) {
wlr_log(WLR_ERROR, "get_fb_for_bo failed");
@@ -1404,6 +1409,12 @@ static void page_flip_handler(int fd, unsigned seq,
conn->current_buffer = conn->pending_buffer;
conn->pending_buffer = NULL;
+ if (conn->current_bo != NULL) {
+ gbm_bo_destroy(conn->current_bo);
+ }
+ conn->current_bo = conn->pending_bo;
+ conn->pending_bo = NULL;
+
uint32_t present_flags = WLR_OUTPUT_PRESENT_VSYNC |
WLR_OUTPUT_PRESENT_HW_CLOCK | WLR_OUTPUT_PRESENT_HW_COMPLETION;
if (conn->current_buffer != NULL) {