scene: add wlr_scene_output_sample_event

This contains the output and a bool indicating direct scan-out.
This commit is contained in:
Simon Ser 2023-07-14 15:16:12 +02:00
parent 88942d43fd
commit fe84bfc8d9
3 changed files with 18 additions and 4 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
}