diff options
-rw-r--r-- | include/wlr/types/wlr_presentation_time.h | 8 | ||||
-rw-r--r-- | types/scene/surface.c | 6 | ||||
-rw-r--r-- | types/wlr_presentation_time.c | 47 |
3 files changed, 19 insertions, 42 deletions
diff --git a/include/wlr/types/wlr_presentation_time.h b/include/wlr/types/wlr_presentation_time.h index 9543cff6..b772295e 100644 --- a/include/wlr/types/wlr_presentation_time.h +++ b/include/wlr/types/wlr_presentation_time.h @@ -71,7 +71,7 @@ struct wlr_presentation *wlr_presentation_create(struct wl_display *display, * this surface. */ struct wlr_presentation_feedback *wlr_presentation_surface_sampled( - struct wlr_presentation *presentation, struct wlr_surface *surface); + struct wlr_surface *surface); void wlr_presentation_feedback_send_presented( struct wlr_presentation_feedback *feedback, const struct wlr_presentation_event *event); @@ -92,8 +92,7 @@ void wlr_presentation_event_from_output(struct wlr_presentation_event *event, * before a wlr_output_commit() call to indicate that the surface's current * contents have been copied to a buffer which will be displayed on the output. */ -void wlr_presentation_surface_textured_on_output( - struct wlr_presentation *presentation, struct wlr_surface *surface, +void wlr_presentation_surface_textured_on_output(struct wlr_surface *surface, struct wlr_output *output); /** * Mark the current surface's buffer as scanned out on the given output. @@ -101,8 +100,7 @@ void wlr_presentation_surface_textured_on_output( * Same as wlr_presentation_surface_textured_on_output(), but indicates direct * scan-out. */ -void wlr_presentation_surface_scanned_out_on_output( - struct wlr_presentation *presentation, struct wlr_surface *surface, +void wlr_presentation_surface_scanned_out_on_output(struct wlr_surface *surface, struct wlr_output *output); #endif diff --git a/types/scene/surface.c b/types/scene/surface.c index 1a2b31af..c5963afe 100644 --- a/types/scene/surface.c +++ b/types/scene/surface.c @@ -54,11 +54,9 @@ static void handle_scene_buffer_output_sample( } if (event->direct_scanout) { - wlr_presentation_surface_scanned_out_on_output( - root->presentation, surface->surface, scene_output->output); + wlr_presentation_surface_scanned_out_on_output(surface->surface, scene_output->output); } else { - wlr_presentation_surface_textured_on_output( - root->presentation, surface->surface, scene_output->output); + wlr_presentation_surface_textured_on_output(surface->surface, scene_output->output); } } diff --git a/types/wlr_presentation_time.c b/types/wlr_presentation_time.c index e3b10139..49887173 100644 --- a/types/wlr_presentation_time.c +++ b/types/wlr_presentation_time.c @@ -89,24 +89,13 @@ static const struct wlr_surface_synced_impl surface_synced_impl = { .move_state = surface_synced_move_state, }; -static const struct wp_presentation_interface presentation_impl; - -static struct wlr_presentation *presentation_from_resource( - struct wl_resource *resource) { - assert(wl_resource_instance_of(resource, &wp_presentation_interface, - &presentation_impl)); - return wl_resource_get_user_data(resource); -} - static void presentation_handle_feedback(struct wl_client *client, struct wl_resource *presentation_resource, struct wl_resource *surface_resource, uint32_t id) { - struct wlr_presentation *presentation = - presentation_from_resource(presentation_resource); struct wlr_surface *surface = wlr_surface_from_resource(surface_resource); - struct wlr_addon *addon = wlr_addon_find(&surface->addons, - presentation, &presentation_surface_addon_impl); + struct wlr_addon *addon = + wlr_addon_find(&surface->addons, NULL, &presentation_surface_addon_impl); struct wlr_presentation_surface *p_surface = NULL; if (addon != NULL) { p_surface = wl_container_of(addon, p_surface, addon); @@ -117,7 +106,7 @@ static void presentation_handle_feedback(struct wl_client *client, return; } wlr_addon_init(&p_surface->addon, &surface->addons, - presentation, &presentation_surface_addon_impl); + NULL, &presentation_surface_addon_impl); if (!wlr_surface_synced_init(&p_surface->synced, surface, &surface_synced_impl, &p_surface->pending, &p_surface->current)) { free(p_surface); @@ -163,16 +152,13 @@ static const struct wp_presentation_interface presentation_impl = { static void presentation_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) { - struct wlr_presentation *presentation = data; - struct wl_resource *resource = wl_resource_create(client, &wp_presentation_interface, version, id); if (resource == NULL) { wl_client_post_no_memory(client); return; } - wl_resource_set_implementation(resource, &presentation_impl, presentation, - NULL); + wl_resource_set_implementation(resource, &presentation_impl, NULL, NULL); wp_presentation_send_clock_id(resource, CLOCK_MONOTONIC); } @@ -194,7 +180,7 @@ struct wlr_presentation *wlr_presentation_create(struct wl_display *display, } presentation->global = wl_global_create(display, &wp_presentation_interface, - PRESENTATION_VERSION, presentation, presentation_bind); + PRESENTATION_VERSION, NULL, presentation_bind); if (presentation->global == NULL) { free(presentation); return NULL; @@ -218,9 +204,9 @@ void wlr_presentation_feedback_send_presented( } struct wlr_presentation_feedback *wlr_presentation_surface_sampled( - struct wlr_presentation *presentation, struct wlr_surface *surface) { - struct wlr_addon *addon = wlr_addon_find(&surface->addons, - presentation, &presentation_surface_addon_impl); + struct wlr_surface *surface) { + struct wlr_addon *addon = + wlr_addon_find(&surface->addons, NULL, &presentation_surface_addon_impl); if (addon != NULL) { struct wlr_presentation_surface *p_surface = wl_container_of(addon, p_surface, addon); @@ -313,11 +299,10 @@ static void feedback_handle_output_destroy(struct wl_listener *listener, wlr_presentation_feedback_destroy(feedback); } -static void presentation_surface_queued_on_output( - struct wlr_presentation *presentation, struct wlr_surface *surface, +static void presentation_surface_queued_on_output(struct wlr_surface *surface, struct wlr_output *output, bool zero_copy) { struct wlr_presentation_feedback *feedback = - wlr_presentation_surface_sampled(presentation, surface); + wlr_presentation_surface_sampled(surface); if (feedback == NULL) { return; } @@ -334,16 +319,12 @@ static void presentation_surface_queued_on_output( wl_signal_add(&output->events.destroy, &feedback->output_destroy); } -void wlr_presentation_surface_textured_on_output( - struct wlr_presentation *presentation, struct wlr_surface *surface, +void wlr_presentation_surface_textured_on_output(struct wlr_surface *surface, struct wlr_output *output) { - return presentation_surface_queued_on_output(presentation, surface, - output, false); + return presentation_surface_queued_on_output(surface, output, false); } -void wlr_presentation_surface_scanned_out_on_output( - struct wlr_presentation *presentation, struct wlr_surface *surface, +void wlr_presentation_surface_scanned_out_on_output(struct wlr_surface *surface, struct wlr_output *output) { - return presentation_surface_queued_on_output(presentation, surface, - output, true); + return presentation_surface_queued_on_output(surface, output, true); } |