protocol: migrate to stable presentation-time.xml

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 <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
[Pekka: updated wayland-protocols dependency to 1.2]
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 538e56e..e01f6b9 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -55,7 +55,7 @@
 #include "libinput-seat.h"
 #include "launcher-util.h"
 #include "vaapi-recorder.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 #include "linux-dmabuf.h"
 
 #ifndef DRM_CAP_TIMESTAMP_MONOTONIC
@@ -608,13 +608,13 @@
 }
 
 /* Determine the type of vblank synchronization to use for the output.
- * 
+ *
  * The pipe parameter indicates which CRTC is in use.  Knowing this, we
  * can determine which vblank sequence type to use for it.  Traditional
  * cards had only two CRTCs, with CRTC 0 using no special flags, and
  * CRTC 1 using DRM_VBLANK_SECONDARY.  The first bit of the pipe
  * parameter indicates this.
- * 
+ *
  * Bits 1-5 of the pipe parameter are 5 bit wide pipe number between
  * 0-31.  If this is non-zero it indicates we're dealing with a
  * multi-gpu situation and we need to calculate the vblank sync
@@ -778,7 +778,7 @@
 		if (timespec_to_nsec(&vbl2now) < refresh_nsec) {
 			drm_output_update_msc(output, vbl.reply.sequence);
 			weston_output_finish_frame(output_base, &ts,
-						PRESENTATION_FEEDBACK_INVALID);
+						WP_PRESENTATION_FEEDBACK_INVALID);
 			return;
 		}
 	}
@@ -800,7 +800,7 @@
 	/* if we cannot page-flip, immediately finish frame */
 	weston_compositor_read_presentation_clock(output_base->compositor, &ts);
 	weston_output_finish_frame(output_base, &ts,
-				   PRESENTATION_FEEDBACK_INVALID);
+				   WP_PRESENTATION_FEEDBACK_INVALID);
 }
 
 static void
@@ -821,8 +821,8 @@
 	struct drm_sprite *s = (struct drm_sprite *)data;
 	struct drm_output *output = s->output;
 	struct timespec ts;
-	uint32_t flags = PRESENTATION_FEEDBACK_KIND_HW_COMPLETION |
-			 PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
+	uint32_t flags = WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION |
+			 WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
 
 	drm_output_update_msc(output, frame);
 	output->vblank_pending = 0;
@@ -847,9 +847,9 @@
 {
 	struct drm_output *output = (struct drm_output *) data;
 	struct timespec ts;
-	uint32_t flags = PRESENTATION_FEEDBACK_KIND_VSYNC |
-			 PRESENTATION_FEEDBACK_KIND_HW_COMPLETION |
-			 PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
+	uint32_t flags = WP_PRESENTATION_FEEDBACK_KIND_VSYNC |
+			 WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION |
+			 WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
 
 	drm_output_update_msc(output, frame);
 
@@ -1298,7 +1298,7 @@
 			/* All other planes are a direct scanout of a
 			 * single client buffer.
 			 */
-			ev->psf_flags = PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
+			ev->psf_flags = WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
 		}
 
 		pixman_region32_fini(&surface_overlap);
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 36d7ae0..19c5e3b 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -48,7 +48,7 @@
 #include "pixman-renderer.h"
 #include "libinput-seat.h"
 #include "gl-renderer.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 
 struct fbdev_backend {
 	struct weston_backend base;
@@ -121,7 +121,7 @@
 	struct timespec ts;
 
 	weston_compositor_read_presentation_clock(output->compositor, &ts);
-	weston_output_finish_frame(output, &ts, PRESENTATION_FEEDBACK_INVALID);
+	weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
 }
 
 static void
diff --git a/src/compositor-headless.c b/src/compositor-headless.c
index ba0d8d7..16b5c39 100644
--- a/src/compositor-headless.c
+++ b/src/compositor-headless.c
@@ -34,7 +34,7 @@
 #include "shared/helpers.h"
 #include "compositor.h"
 #include "pixman-renderer.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 
 struct headless_backend {
 	struct weston_backend base;
@@ -64,7 +64,7 @@
 	struct timespec ts;
 
 	weston_compositor_read_presentation_clock(output->compositor, &ts);
-	weston_output_finish_frame(output, &ts, PRESENTATION_FEEDBACK_INVALID);
+	weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
 }
 
 static int
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 3526ad1..e603b76 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -343,7 +343,7 @@
 	struct timespec ts;
 
 	weston_compositor_read_presentation_clock(output->compositor, &ts);
-	weston_output_finish_frame(output, &ts, PRESENTATION_FEEDBACK_INVALID);
+	weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
 }
 
 static int
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index f48ddc4..75b808e 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -50,7 +50,7 @@
 #include "rpi-renderer.h"
 #include "launcher-util.h"
 #include "libinput-seat.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 
 #if 0
 #define DBG(...) \
@@ -223,7 +223,7 @@
 
 	/* XXX: do a phony dispmanx update and trigger on its completion? */
 	weston_compositor_read_presentation_clock(output->compositor, &ts);
-	weston_output_finish_frame(output, &ts, PRESENTATION_FEEDBACK_INVALID);
+	weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
 }
 
 static int
@@ -257,8 +257,8 @@
 rpi_output_update_complete(struct rpi_output *output,
 			   const struct timespec *stamp)
 {
-	uint32_t flags = PRESENTATION_FEEDBACK_KIND_VSYNC |
-			 PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
+	uint32_t flags = WP_PRESENTATION_FEEDBACK_KIND_VSYNC |
+			 WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
 
 	DBG("frame update complete(%ld.%09ld)\n",
 	    (long)stamp->tv_sec, (long)stamp->tv_nsec);
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index d1c020d..8a1878c 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -47,7 +47,7 @@
 #include "shared/os-compatibility.h"
 #include "shared/cairo-util.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 #include "linux-dmabuf.h"
 
 #define WINDOW_TITLE "Weston Compositor"
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 13a5d73..cca6ab7 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -55,7 +55,7 @@
 #include "shared/config-parser.h"
 #include "shared/helpers.h"
 #include "shared/image-loader.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 #include "linux-dmabuf.h"
 
 #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
@@ -371,7 +371,7 @@
 	struct timespec ts;
 
 	weston_compositor_read_presentation_clock(output->compositor, &ts);
-	weston_output_finish_frame(output, &ts, PRESENTATION_FEEDBACK_INVALID);
+	weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
 }
 
 static int
diff --git a/src/compositor.c b/src/compositor.c
index 98efb4c..3e3fc8c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -55,7 +55,7 @@
 
 #include "compositor.h"
 #include "scaler-server-protocol.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-time-server-protocol.h"
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
 #include "shared/timespec-util.h"
@@ -443,7 +443,7 @@
 weston_presentation_feedback_discard(
 		struct weston_presentation_feedback *feedback)
 {
-	presentation_feedback_send_discarded(feedback->resource);
+	wp_presentation_feedback_send_discarded(feedback->resource);
 	wl_resource_destroy(feedback->resource);
 }
 
@@ -473,16 +473,16 @@
 		if (wl_resource_get_client(o) != client)
 			continue;
 
-		presentation_feedback_send_sync_output(feedback->resource, o);
+		wp_presentation_feedback_send_sync_output(feedback->resource, o);
 	}
 
 	secs = ts->tv_sec;
-	presentation_feedback_send_presented(feedback->resource,
-					     secs >> 32, secs & 0xffffffff,
-					     ts->tv_nsec,
-					     refresh_nsec,
-					     seq >> 32, seq & 0xffffffff,
-					     flags | feedback->psf_flags);
+	wp_presentation_feedback_send_presented(feedback->resource,
+						secs >> 32, secs & 0xffffffff,
+						ts->tv_nsec,
+						refresh_nsec,
+						seq >> 32, seq & 0xffffffff,
+						flags | feedback->psf_flags);
 	wl_resource_destroy(feedback->resource);
 }
 
@@ -496,7 +496,7 @@
 {
 	struct weston_presentation_feedback *feedback, *tmp;
 
-	assert(!(flags & PRESENTATION_FEEDBACK_INVALID) ||
+	assert(!(flags & WP_PRESENTATION_FEEDBACK_INVALID) ||
 	       wl_list_empty(list));
 
 	wl_list_for_each_safe(feedback, tmp, list, link)
@@ -2489,7 +2489,7 @@
 	 * the deadline given by repaint_msec? In that case we delay until
 	 * the deadline of the next frame, to give clients a more predictable
 	 * timing of the repaint cycle to lock on. */
-	if (presented_flags == PRESENTATION_FEEDBACK_INVALID && msec < 0)
+	if (presented_flags == WP_PRESENTATION_FEEDBACK_INVALID && msec < 0)
 		msec += refresh_nsec / 1000000;
 
 	if (msec < 1)
@@ -4605,7 +4605,7 @@
 		goto err_calloc;
 
 	feedback->resource = wl_resource_create(client,
-					&presentation_feedback_interface,
+					&wp_presentation_feedback_interface,
 					1, callback);
 	if (!feedback->resource)
 		goto err_create;
@@ -4624,7 +4624,7 @@
 	wl_client_post_no_memory(client);
 }
 
-static const struct presentation_interface presentation_implementation = {
+static const struct wp_presentation_interface presentation_implementation = {
 	presentation_destroy,
 	presentation_feedback
 };
@@ -4636,7 +4636,7 @@
 	struct weston_compositor *compositor = data;
 	struct wl_resource *resource;
 
-	resource = wl_resource_create(client, &presentation_interface,
+	resource = wl_resource_create(client, &wp_presentation_interface,
 				      version, id);
 	if (resource == NULL) {
 		wl_client_post_no_memory(client);
@@ -4645,7 +4645,7 @@
 
 	wl_resource_set_implementation(resource, &presentation_implementation,
 				       compositor, NULL);
-	presentation_send_clock_id(resource, compositor->presentation_clock);
+	wp_presentation_send_clock_id(resource, compositor->presentation_clock);
 }
 
 static void
@@ -4754,7 +4754,7 @@
 			      ec, bind_scaler))
 		goto fail;
 
-	if (!wl_global_create(ec->wl_display, &presentation_interface, 1,
+	if (!wl_global_create(ec->wl_display, &wp_presentation_interface, 1,
 			      ec, bind_presentation))
 		goto fail;
 
diff --git a/src/compositor.h b/src/compositor.h
index 58ae94b..794a1b0 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -1221,7 +1221,7 @@
 			      struct weston_plane *above);
 
 /* An invalid flag in presented_flags to catch logic errors. */
-#define PRESENTATION_FEEDBACK_INVALID (1U << 31)
+#define WP_PRESENTATION_FEEDBACK_INVALID (1U << 31)
 
 void
 weston_output_finish_frame(struct weston_output *output,