From b00c79b587a4903df576008a64a49f851fed234c Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 18 Feb 2016 16:53:27 +0200 Subject: protocol: migrate to stable presentation-time.xml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the unstable presentation_timing.xml file, and use presentation-time.xml from wayland-protocols instead to generate all the Presentation extension bindings. The following renames are done according to the XML changes: - generated header includes - enum constants and macros prefixed with WP_ - interface symbol names prefixed with wp_ - protocol API calls prefixed with wp_ Clients use wp_presentation_interface.name rather than hardcoding the global interface name: presentation-shm, weston-info, presentation-test. Signed-off-by: Pekka Paalanen Reviewed-by: Bryce Harrington Reviewed-by: Jonas Ã…dahl [Pekka: updated wayland-protocols dependency to 1.2] --- clients/presentation-shm.c | 65 +++++++++++++++++++++++----------------------- clients/weston-info.c | 19 +++++++------- 2 files changed, 43 insertions(+), 41 deletions(-) (limited to 'clients') diff --git a/clients/presentation-shm.c b/clients/presentation-shm.c index 120c40ce..1feeb365 100644 --- a/clients/presentation-shm.c +++ b/clients/presentation-shm.c @@ -38,7 +38,7 @@ #include #include "shared/helpers.h" #include "shared/os-compatibility.h" -#include "presentation_timing-client-protocol.h" +#include "presentation-time-client-protocol.h" enum run_mode { RUN_MODE_FEEDBACK, @@ -67,7 +67,7 @@ struct display { struct wl_shm *shm; uint32_t formats; - struct presentation *presentation; + struct wp_presentation *presentation; clockid_t clk_id; struct wl_list output_list; /* struct output::link */ @@ -76,7 +76,7 @@ struct display { struct feedback { struct window *window; unsigned frame_no; - struct presentation_feedback *feedback; + struct wp_presentation_feedback *feedback; struct timespec commit; struct timespec target; uint32_t frame_stamp; @@ -251,7 +251,7 @@ static void destroy_feedback(struct feedback *feedback) { if (feedback->feedback) - presentation_feedback_destroy(feedback->feedback); + wp_presentation_feedback_destroy(feedback->feedback); wl_list_remove(&feedback->link); free(feedback); @@ -344,7 +344,7 @@ paint_pixels(void *image, int width, int height, uint32_t phase) static void feedback_sync_output(void *data, - struct presentation_feedback *presentation_feedback, + struct wp_presentation_feedback *presentation_feedback, struct wl_output *output) { /* not interested */ @@ -357,10 +357,10 @@ pflags_to_str(uint32_t flags, char *str, unsigned len) uint32_t flag; char sym; } desc[] = { - { PRESENTATION_FEEDBACK_KIND_VSYNC, 's' }, - { PRESENTATION_FEEDBACK_KIND_HW_CLOCK, 'c' }, - { PRESENTATION_FEEDBACK_KIND_HW_COMPLETION, 'e' }, - { PRESENTATION_FEEDBACK_KIND_ZERO_COPY, 'z' }, + { WP_PRESENTATION_FEEDBACK_KIND_VSYNC, 's' }, + { WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK, 'c' }, + { WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION, 'e' }, + { WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY, 'z' }, }; unsigned i; @@ -400,7 +400,7 @@ timespec_diff_to_usec(const struct timespec *a, const struct timespec *b) static void feedback_presented(void *data, - struct presentation_feedback *presentation_feedback, + struct wp_presentation_feedback *presentation_feedback, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, @@ -456,7 +456,7 @@ feedback_presented(void *data, static void feedback_discarded(void *data, - struct presentation_feedback *presentation_feedback) + struct wp_presentation_feedback *presentation_feedback) { struct feedback *feedback = data; @@ -465,7 +465,7 @@ feedback_discarded(void *data, destroy_feedback(feedback); } -static const struct presentation_feedback_listener feedback_listener = { +static const struct wp_presentation_feedback_listener feedback_listener = { feedback_sync_output, feedback_presented, feedback_discarded @@ -492,7 +492,7 @@ static void window_create_feedback(struct window *window, uint32_t frame_stamp) { static unsigned seq; - struct presentation *pres = window->display->presentation; + struct wp_presentation *pres = window->display->presentation; struct feedback *feedback; seq++; @@ -505,9 +505,9 @@ window_create_feedback(struct window *window, uint32_t frame_stamp) return; feedback->window = window; - feedback->feedback = presentation_feedback(pres, window->surface); - presentation_feedback_add_listener(feedback->feedback, - &feedback_listener, feedback); + feedback->feedback = wp_presentation_feedback(pres, window->surface); + wp_presentation_feedback_add_listener(feedback->feedback, + &feedback_listener, feedback); feedback->frame_no = seq; @@ -559,21 +559,22 @@ static const struct wl_callback_listener frame_listener_mode_feedback = { redraw_mode_feedback }; -static const struct presentation_feedback_listener feedkick_listener; +static const struct wp_presentation_feedback_listener feedkick_listener; static void window_feedkick(struct window *window) { - struct presentation *pres = window->display->presentation; - struct presentation_feedback *fback; + struct wp_presentation *pres = window->display->presentation; + struct wp_presentation_feedback *fback; - fback = presentation_feedback(pres, window->surface); - presentation_feedback_add_listener(fback, &feedkick_listener, window); + fback = wp_presentation_feedback(pres, window->surface); + wp_presentation_feedback_add_listener(fback, &feedkick_listener, + window); } static void feedkick_presented(void *data, - struct presentation_feedback *presentation_feedback, + struct wp_presentation_feedback *presentation_feedback, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec, @@ -584,7 +585,7 @@ feedkick_presented(void *data, { struct window *window = data; - presentation_feedback_destroy(presentation_feedback); + wp_presentation_feedback_destroy(presentation_feedback); window->refresh_nsec = refresh_nsec; switch (window->mode) { @@ -602,11 +603,11 @@ feedkick_presented(void *data, static void feedkick_discarded(void *data, - struct presentation_feedback *presentation_feedback) + struct wp_presentation_feedback *presentation_feedback) { struct window *window = data; - presentation_feedback_destroy(presentation_feedback); + wp_presentation_feedback_destroy(presentation_feedback); switch (window->mode) { case RUN_MODE_PRESENT: @@ -621,7 +622,7 @@ feedkick_discarded(void *data, } } -static const struct presentation_feedback_listener feedkick_listener = { +static const struct wp_presentation_feedback_listener feedkick_listener = { feedback_sync_output, feedkick_presented, feedkick_discarded @@ -687,7 +688,7 @@ display_add_output(struct display *d, uint32_t name, uint32_t version) } static void -presentation_clock_id(void *data, struct presentation *presentation, +presentation_clock_id(void *data, struct wp_presentation *presentation, uint32_t clk_id) { struct display *d = data; @@ -695,7 +696,7 @@ presentation_clock_id(void *data, struct presentation *presentation, d->clk_id = clk_id; } -static const struct presentation_listener presentation_listener = { +static const struct wp_presentation_listener presentation_listener = { presentation_clock_id }; @@ -730,12 +731,12 @@ registry_handle_global(void *data, struct wl_registry *registry, wl_shm_add_listener(d->shm, &shm_listener, d); } else if (strcmp(interface, "wl_output") == 0) { display_add_output(d, name, version); - } else if (strcmp(interface, "presentation") == 0) { + } else if (strcmp(interface, wp_presentation_interface.name) == 0) { d->presentation = wl_registry_bind(registry, - name, &presentation_interface, 1); - presentation_add_listener(d->presentation, - &presentation_listener, d); + name, &wp_presentation_interface, 1); + wp_presentation_add_listener(d->presentation, + &presentation_listener, d); } } diff --git a/clients/weston-info.c b/clients/weston-info.c index 49d64fef..9d42599a 100644 --- a/clients/weston-info.c +++ b/clients/weston-info.c @@ -34,7 +34,7 @@ #include "shared/helpers.h" #include "shared/os-compatibility.h" -#include "presentation_timing-client-protocol.h" +#include "presentation-time-client-protocol.h" typedef void (*print_info_t)(void *info); typedef void (*destroy_info_t)(void *info); @@ -105,7 +105,7 @@ struct seat_info { struct presentation_info { struct global_info global; - struct presentation *presentation; + struct wp_presentation *presentation; clockid_t clk_id; }; @@ -595,7 +595,7 @@ destroy_presentation_info(void *info) { struct presentation_info *prinfo = info; - presentation_destroy(prinfo->presentation); + wp_presentation_destroy(prinfo->presentation); } static const char * @@ -630,7 +630,7 @@ print_presentation_info(void *info) } static void -presentation_handle_clock_id(void *data, struct presentation *presentation, +presentation_handle_clock_id(void *data, struct wp_presentation *presentation, uint32_t clk_id) { struct presentation_info *prinfo = data; @@ -638,7 +638,7 @@ presentation_handle_clock_id(void *data, struct presentation *presentation, prinfo->clk_id = clk_id; } -static const struct presentation_listener presentation_listener = { +static const struct wp_presentation_listener presentation_listener = { presentation_handle_clock_id }; @@ -647,15 +647,16 @@ add_presentation_info(struct weston_info *info, uint32_t id, uint32_t version) { struct presentation_info *prinfo = xzalloc(sizeof *prinfo); - init_global_info(info, &prinfo->global, id, "presentation", version); + init_global_info(info, &prinfo->global, id, + wp_presentation_interface.name, version); prinfo->global.print = print_presentation_info; prinfo->global.destroy = destroy_presentation_info; prinfo->clk_id = -1; prinfo->presentation = wl_registry_bind(info->registry, id, - &presentation_interface, 1); - presentation_add_listener(prinfo->presentation, &presentation_listener, - prinfo); + &wp_presentation_interface, 1); + wp_presentation_add_listener(prinfo->presentation, + &presentation_listener, prinfo); info->roundtrip_needed = true; } -- cgit v1.2.1