Release buffer in wlr_surface_flush_damage

This commit is contained in:
emersion 2017-10-14 13:33:34 +02:00
parent 6dc0517bb1
commit 08720db01d
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
2 changed files with 6 additions and 11 deletions

View file

@ -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.commit, &output->cursor.surface_commit);
wl_signal_add(&surface->events.destroy, wl_signal_add(&surface->events.destroy,
&output->cursor.surface_destroy); &output->cursor.surface_destroy);
// TODO: doing it breaks GTK apps commit_cursor_surface(output, surface);
// TODO: not doing it breaks weston-subsurfaces
//commit_cursor_surface(output, surface);
} else { } else {
set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y); set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y);
} }

View file

@ -359,7 +359,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface,
if (wlr_renderer_buffer_is_drm(surface->renderer, if (wlr_renderer_buffer_is_drm(surface->renderer,
surface->current->buffer)) { surface->current->buffer)) {
wlr_texture_upload_drm(surface->texture, surface->current->buffer); wlr_texture_upload_drm(surface->texture, surface->current->buffer);
goto clear_damage; goto release;
} else { } else {
wlr_log(L_INFO, "Unknown buffer handle attached"); wlr_log(L_INFO, "Unknown buffer handle attached");
return; return;
@ -372,7 +372,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface,
} else { } else {
pixman_region32_t damage = surface->current->buffer_damage; pixman_region32_t damage = surface->current->buffer_damage;
if (!pixman_region32_not_empty(&damage)) { if (!pixman_region32_not_empty(&damage)) {
goto clear_damage; goto release;
} }
int n; int n;
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &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->surface_damage);
pixman_region32_clear(&surface->current->buffer_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) { 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 // TODO: add the invalid bitfield to this callback
wl_signal_emit(&surface->events.commit, surface); 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) { static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {