presentation-time: add separate helper for zero-copy

The backend is not able to tell whether a surface is being
presented via direct scan-out or not. The backend will set
ZERO_COPY if the buffer submitted via the output commit was
presented in a zero-copy fashion, but will no know whether the
buffer comes from the compositor or the client.
This commit is contained in:
Simon Ser 2023-04-14 20:41:27 +02:00
parent fe84bfc8d9
commit 67447d6cb4
3 changed files with 48 additions and 14 deletions

View file

@ -42,15 +42,21 @@ static void handle_scene_buffer_output_sample(
wl_container_of(listener, surface, output_sample);
const struct wlr_scene_output_sample_event *event = data;
struct wlr_scene_output *scene_output = event->output;
if (surface->buffer->primary_output != scene_output) {
return;
}
if (surface->buffer->primary_output == scene_output) {
struct wlr_scene *root = scene_node_get_root(&surface->buffer->node);
struct wlr_presentation *presentation = root->presentation;
struct wlr_scene *root = scene_node_get_root(&surface->buffer->node);
if (!root->presentation) {
return;
}
if (presentation) {
wlr_presentation_surface_sampled_on_output(
presentation, surface->surface, scene_output->output);
}
if (event->direct_scanout) {
wlr_presentation_surface_scanned_out_on_output(
root->presentation, surface->surface, scene_output->output);
} else {
wlr_presentation_surface_textured_on_output(
root->presentation, surface->surface, scene_output->output);
}
}