aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-07-14 15:16:12 +0200
committerSimon Ser <contact@emersion.fr>2023-07-14 15:16:12 +0200
commitfe84bfc8d92c07c5c58c2b90e9884d74caa7bdb8 (patch)
tree82dfeb9d3e482822c95fc17e1c73246235c0dc7c
parent88942d43fd874292a7a56a90a0452314d99ddff9 (diff)
scene: add wlr_scene_output_sample_event
This contains the output and a bool indicating direct scan-out.
-rw-r--r--include/wlr/types/wlr_scene.h7
-rw-r--r--types/scene/surface.c3
-rw-r--r--types/scene/wlr_scene.c12
3 files changed, 18 insertions, 4 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index b00f33b4..2dd9401f 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -140,6 +140,11 @@ struct wlr_scene_outputs_update_event {
size_t size;
};
+struct wlr_scene_output_sample_event {
+ struct wlr_scene_output *output;
+ bool direct_scanout;
+};
+
/** A scene-graph node displaying a buffer */
struct wlr_scene_buffer {
struct wlr_scene_node node;
@@ -151,7 +156,7 @@ struct wlr_scene_buffer {
struct wl_signal outputs_update; // struct wlr_scene_outputs_update_event
struct wl_signal output_enter; // struct wlr_scene_output
struct wl_signal output_leave; // struct wlr_scene_output
- struct wl_signal output_sample; // struct wlr_scene_output
+ struct wl_signal output_sample; // struct wlr_scene_output_sample_event
struct wl_signal frame_done; // struct timespec
} events;
diff --git a/types/scene/surface.c b/types/scene/surface.c
index c4b9c39b..afefb917 100644
--- a/types/scene/surface.c
+++ b/types/scene/surface.c
@@ -40,7 +40,8 @@ static void handle_scene_buffer_output_sample(
struct wl_listener *listener, void *data) {
struct wlr_scene_surface *surface =
wl_container_of(listener, surface, output_sample);
- struct wlr_scene_output *scene_output = data;
+ const struct wlr_scene_output_sample_event *event = data;
+ struct wlr_scene_output *scene_output = event->output;
if (surface->buffer->primary_output == scene_output) {
struct wlr_scene *root = scene_node_get_root(&surface->buffer->node);
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c
index cc67bc3e..90d76c16 100644
--- a/types/scene/wlr_scene.c
+++ b/types/scene/wlr_scene.c
@@ -1171,7 +1171,11 @@ static void scene_entry_render(struct render_list_entry *entry, const struct ren
WLR_RENDER_BLEND_MODE_PREMULTIPLIED : WLR_RENDER_BLEND_MODE_NONE,
});
- wl_signal_emit_mutable(&scene_buffer->events.output_sample, data->output);
+ struct wlr_scene_output_sample_event sample_event = {
+ .output = data->output,
+ .direct_scanout = false,
+ };
+ wl_signal_emit_mutable(&scene_buffer->events.output_sample, &sample_event);
break;
}
@@ -1572,7 +1576,11 @@ static bool scene_entry_try_direct_scanout(struct render_list_entry *entry,
wlr_output_state_copy(state, &pending);
wlr_output_state_finish(&pending);
- wl_signal_emit_mutable(&buffer->events.output_sample, scene_output);
+ struct wlr_scene_output_sample_event sample_event = {
+ .output = scene_output,
+ .direct_scanout = true,
+ };
+ wl_signal_emit_mutable(&buffer->events.output_sample, &sample_event);
return true;
}