|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <wlr/types/wlr_scene.h>
|
|
|
|
|
#include <wlr/types/wlr_presentation_time.h>
|
|
|
|
@ -55,6 +56,28 @@ static void scene_surface_handle_surface_destroy(
|
|
|
|
|
wlr_scene_node_destroy(&surface->buffer->node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This is used for wlr_scene where it unconditionally locks buffers preventing
|
|
|
|
|
// reuse of the existing texture for shm clients. With the usage pattern of
|
|
|
|
|
// wlr_scene surface handling, we can mark its locked buffer as safe
|
|
|
|
|
// for mutation.
|
|
|
|
|
static void client_buffer_mark_next_can_damage(struct wlr_client_buffer *buffer) {
|
|
|
|
|
buffer->n_ignore_locks++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_buffer_unmark_client_buffer(struct wlr_scene_buffer *scene_buffer) {
|
|
|
|
|
if (!scene_buffer->buffer) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct wlr_client_buffer *buffer = wlr_client_buffer_get(scene_buffer->buffer);
|
|
|
|
|
if (!buffer) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(buffer->n_ignore_locks > 0);
|
|
|
|
|
buffer->n_ignore_locks--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void set_buffer_with_surface_state(struct wlr_scene_buffer *scene_buffer,
|
|
|
|
|
struct wlr_surface *surface) {
|
|
|
|
|
struct wlr_surface_state *state = &surface->current;
|
|
|
|
@ -68,7 +91,11 @@ static void set_buffer_with_surface_state(struct wlr_scene_buffer *scene_buffer,
|
|
|
|
|
wlr_scene_buffer_set_dest_size(scene_buffer, state->width, state->height);
|
|
|
|
|
wlr_scene_buffer_set_transform(scene_buffer, state->transform);
|
|
|
|
|
|
|
|
|
|
scene_buffer_unmark_client_buffer(scene_buffer);
|
|
|
|
|
|
|
|
|
|
if (surface->buffer) {
|
|
|
|
|
client_buffer_mark_next_can_damage(surface->buffer);
|
|
|
|
|
|
|
|
|
|
wlr_scene_buffer_set_buffer_with_damage(scene_buffer,
|
|
|
|
|
&surface->buffer->base, &surface->buffer_damage);
|
|
|
|
|
} else {
|
|
|
|
@ -109,6 +136,8 @@ static bool scene_buffer_point_accepts_input(struct wlr_scene_buffer *scene_buff
|
|
|
|
|
static void surface_addon_destroy(struct wlr_addon *addon) {
|
|
|
|
|
struct wlr_scene_surface *surface = wl_container_of(addon, surface, addon);
|
|
|
|
|
|
|
|
|
|
scene_buffer_unmark_client_buffer(surface->buffer);
|
|
|
|
|
|
|
|
|
|
wlr_addon_finish(&surface->addon);
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&surface->output_enter.link);
|
|
|
|
|