From 08720db01db302246c9e0a15c0cde7120af3e1d8 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 14 Oct 2017 13:33:34 +0200 Subject: [PATCH] Release buffer in wlr_surface_flush_damage --- types/wlr_output.c | 4 +--- types/wlr_surface.c | 13 +++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index 0026678e..5f3820bc 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -264,9 +264,7 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, wl_signal_add(&surface->events.commit, &output->cursor.surface_commit); wl_signal_add(&surface->events.destroy, &output->cursor.surface_destroy); - // TODO: doing it breaks GTK apps - // TODO: not doing it breaks weston-subsurfaces - //commit_cursor_surface(output, surface); + commit_cursor_surface(output, surface); } else { set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y); } diff --git a/types/wlr_surface.c b/types/wlr_surface.c index b3cdb809..9e38d701 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -359,7 +359,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, if (wlr_renderer_buffer_is_drm(surface->renderer, surface->current->buffer)) { wlr_texture_upload_drm(surface->texture, surface->current->buffer); - goto clear_damage; + goto release; } else { wlr_log(L_INFO, "Unknown buffer handle attached"); return; @@ -372,7 +372,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, } else { pixman_region32_t damage = surface->current->buffer_damage; if (!pixman_region32_not_empty(&damage)) { - goto clear_damage; + goto release; } int n; pixman_box32_t *rects = pixman_region32_rectangles(&damage, &n); @@ -388,9 +388,11 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, } } -clear_damage: +release: pixman_region32_clear(&surface->current->surface_damage); pixman_region32_clear(&surface->current->buffer_damage); + + wlr_surface_state_release_buffer(surface->current); } static void wlr_surface_commit_pending(struct wlr_surface *surface) { @@ -426,11 +428,6 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) { // TODO: add the invalid bitfield to this callback wl_signal_emit(&surface->events.commit, surface); - - // Release the buffer after calling commit, because some listeners - // might need it (e.g. for cursor surfaces) - // TODO: breaks weston-subsurfaces - //wlr_surface_state_release_buffer(surface->current); } static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {