[PATCH weston 03/10] Use presentation timing protocol from wayland-protocols

Jonas Ådahl jadahl at gmail.com
Wed Nov 4 00:49:52 PST 2015


Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 Makefile.am                      |  21 ++-
 clients/presentation-shm.c       |  65 +++++-----
 clients/weston-info.c            |  19 +--
 protocol/presentation_timing.xml | 274 ---------------------------------------
 src/compositor-drm.c             |  14 +-
 src/compositor-fbdev.c           |   2 +-
 src/compositor-headless.c        |   2 +-
 src/compositor-rpi.c             |   6 +-
 src/compositor-wayland.c         |   2 +-
 src/compositor-x11.c             |   2 +-
 src/compositor.c                 |  29 +++--
 tests/presentation-test.c        |  34 ++---
 12 files changed, 101 insertions(+), 369 deletions(-)
 delete mode 100644 protocol/presentation_timing.xml

diff --git a/Makefile.am b/Makefile.am
index 9f7cc9d..175e924 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -123,8 +123,8 @@ nodist_weston_SOURCES =					\
 	protocol/input-method-server-protocol.h		\
 	protocol/workspaces-protocol.c			\
 	protocol/workspaces-server-protocol.h		\
-	protocol/presentation_timing-protocol.c		\
-	protocol/presentation_timing-server-protocol.h	\
+	protocol/presentation-timing-unstable-v1-protocol.c		\
+	protocol/presentation-timing-unstable-v1-server-protocol.h	\
 	protocol/scaler-protocol.c			\
 	protocol/scaler-server-protocol.h		\
 	protocol/linux-dmabuf-unstable-v1-protocol.c	\
@@ -503,8 +503,8 @@ weston_presentation_shm_SOURCES = 			\
 	clients/presentation-shm.c			\
 	shared/helpers.h
 nodist_weston_presentation_shm_SOURCES =		\
-	protocol/presentation_timing-protocol.c		\
-	protocol/presentation_timing-client-protocol.h
+	protocol/presentation-timing-unstable-v1-protocol.c		\
+	protocol/presentation-timing-unstable-v1-client-protocol.h
 weston_presentation_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
 weston_presentation_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la -lm -lrt
 
@@ -554,8 +554,8 @@ nodist_libtoytoolkit_la_SOURCES =			\
 	protocol/scaler-client-protocol.h		\
 	protocol/workspaces-protocol.c			\
 	protocol/workspaces-client-protocol.h		\
-	protocol/presentation_timing-protocol.c		\
-	protocol/presentation_timing-client-protocol.h	\
+	protocol/presentation-timing-unstable-v1-protocol.c		\
+	protocol/presentation-timing-unstable-v1-client-protocol.h	\
 	protocol/xdg-shell-protocol.c			\
 	protocol/xdg-shell-client-protocol.h		\
 	protocol/ivi-application-protocol.c		\
@@ -712,8 +712,8 @@ weston_info_SOURCES = 					\
 	clients/weston-info.c				\
 	shared/helpers.h
 nodist_weston_info_SOURCES =				\
-	protocol/presentation_timing-protocol.c		\
-	protocol/presentation_timing-client-protocol.h
+	protocol/presentation-timing-unstable-v1-protocol.c		\
+	protocol/presentation-timing-unstable-v1-client-protocol.h
 weston_info_LDADD = $(WESTON_INFO_LIBS) libshared.la
 weston_info_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
@@ -1225,8 +1225,8 @@ presentation_weston_SOURCES = 			\
 	tests/presentation-test.c		\
 	shared/helpers.h
 nodist_presentation_weston_SOURCES =		\
-	protocol/presentation_timing-protocol.c	\
-	protocol/presentation_timing-client-protocol.h
+	protocol/presentation-timing-unstable-v1-protocol.c	\
+	protocol/presentation-timing-unstable-v1-client-protocol.h
 presentation_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 presentation_weston_LDADD = libtest-client.la
 
@@ -1348,7 +1348,6 @@ EXTRA_DIST +=					\
 	protocol/text-cursor-position.xml	\
 	protocol/weston-test.xml		\
 	protocol/xdg-shell.xml			\
-	protocol/presentation_timing.xml	\
 	protocol/scaler.xml			\
 	protocol/ivi-application.xml		\
 	protocol/ivi-hmi-controller.xml
diff --git a/clients/presentation-shm.c b/clients/presentation-shm.c
index 120c40c..9083d8e 100644
--- a/clients/presentation-shm.c
+++ b/clients/presentation-shm.c
@@ -38,7 +38,7 @@
 #include <wayland-client.h>
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
-#include "presentation_timing-client-protocol.h"
+#include "presentation-timing-unstable-v1-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 zwl_presentation1 *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 zwl_presentation_feedback1 *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);
+		zwl_presentation_feedback1_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 zwl_presentation_feedback1 *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' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_VSYNC, 's' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_HW_CLOCK, 'c' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_HW_COMPLETION, 'e' },
+		{ ZWL_PRESENTATION_FEEDBACK1_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 zwl_presentation_feedback1 *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 zwl_presentation_feedback1 *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 zwl_presentation_feedback1_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 zwl_presentation1 *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 = zwl_presentation1_feedback(pres, window->surface);
+	zwl_presentation_feedback1_add_listener(feedback->feedback,
+						&feedback_listener, feedback);
 
 	feedback->frame_no = seq;
 
@@ -559,21 +559,21 @@ static const struct wl_callback_listener frame_listener_mode_feedback = {
 	redraw_mode_feedback
 };
 
-static const struct presentation_feedback_listener feedkick_listener;
+static const struct zwl_presentation_feedback1_listener feedkick_listener;
 
 static void
 window_feedkick(struct window *window)
 {
-	struct presentation *pres = window->display->presentation;
-	struct presentation_feedback *fback;
+	struct zwl_presentation1 *pres = window->display->presentation;
+	struct zwl_presentation_feedback1 *fback;
 
-	fback = presentation_feedback(pres, window->surface);
-	presentation_feedback_add_listener(fback, &feedkick_listener, window);
+	fback = zwl_presentation1_feedback(pres, window->surface);
+	zwl_presentation_feedback1_add_listener(fback, &feedkick_listener, window);
 }
 
 static void
 feedkick_presented(void *data,
-		   struct presentation_feedback *presentation_feedback,
+		   struct zwl_presentation_feedback1 *presentation_feedback,
 		   uint32_t tv_sec_hi,
 		   uint32_t tv_sec_lo,
 		   uint32_t tv_nsec,
@@ -584,7 +584,7 @@ feedkick_presented(void *data,
 {
 	struct window *window = data;
 
-	presentation_feedback_destroy(presentation_feedback);
+	zwl_presentation_feedback1_destroy(presentation_feedback);
 	window->refresh_nsec = refresh_nsec;
 
 	switch (window->mode) {
@@ -602,11 +602,11 @@ feedkick_presented(void *data,
 
 static void
 feedkick_discarded(void *data,
-		   struct presentation_feedback *presentation_feedback)
+		   struct zwl_presentation_feedback1 *presentation_feedback)
 {
 	struct window *window = data;
 
-	presentation_feedback_destroy(presentation_feedback);
+	zwl_presentation_feedback1_destroy(presentation_feedback);
 
 	switch (window->mode) {
 	case RUN_MODE_PRESENT:
@@ -621,7 +621,7 @@ feedkick_discarded(void *data,
 	}
 }
 
-static const struct presentation_feedback_listener feedkick_listener = {
+static const struct zwl_presentation_feedback1_listener feedkick_listener = {
 	feedback_sync_output,
 	feedkick_presented,
 	feedkick_discarded
@@ -687,7 +687,8 @@ 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 zwl_presentation1 *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 zwl_presentation1_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, "zwl_presentation1") == 0) {
 		d->presentation =
 			wl_registry_bind(registry,
-					 name, &presentation_interface, 1);
-		presentation_add_listener(d->presentation,
-					  &presentation_listener, d);
+					 name, &zwl_presentation1_interface, 1);
+		zwl_presentation1_add_listener(d->presentation,
+					       &presentation_listener, d);
 	}
 }
 
diff --git a/clients/weston-info.c b/clients/weston-info.c
index f22781c..f885e27 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-timing-unstable-v1-client-protocol.h"
 
 typedef void (*print_info_t)(void *info);
 typedef void (*destroy_info_t)(void *info);
@@ -102,7 +102,7 @@ struct seat_info {
 
 struct presentation_info {
 	struct global_info global;
-	struct presentation *presentation;
+	struct zwl_presentation1 *presentation;
 
 	clockid_t clk_id;
 };
@@ -567,7 +567,7 @@ destroy_presentation_info(void *info)
 {
 	struct presentation_info *prinfo = info;
 
-	presentation_destroy(prinfo->presentation);
+	zwl_presentation1_destroy(prinfo->presentation);
 }
 
 static const char *
@@ -602,7 +602,8 @@ print_presentation_info(void *info)
 }
 
 static void
-presentation_handle_clock_id(void *data, struct presentation *presentation,
+presentation_handle_clock_id(void *data,
+			     struct zwl_presentation1 *presentation,
 			     uint32_t clk_id)
 {
 	struct presentation_info *prinfo = data;
@@ -610,7 +611,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 zwl_presentation1_listener presentation_listener = {
 	presentation_handle_clock_id
 };
 
@@ -625,9 +626,11 @@ add_presentation_info(struct weston_info *info, uint32_t id, uint32_t version)
 
 	prinfo->clk_id = -1;
 	prinfo->presentation = wl_registry_bind(info->registry, id,
-						&presentation_interface, 1);
-	presentation_add_listener(prinfo->presentation, &presentation_listener,
-				  prinfo);
+						&zwl_presentation1_interface,
+						1);
+	zwl_presentation1_add_listener(prinfo->presentation,
+				       &presentation_listener,
+				       prinfo);
 
 	info->roundtrip_needed = true;
 }
diff --git a/protocol/presentation_timing.xml b/protocol/presentation_timing.xml
deleted file mode 100644
index 10a5f14..0000000
--- a/protocol/presentation_timing.xml
+++ /dev/null
@@ -1,274 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="presentation_timing">
-<!-- wrap:70 -->
-
-  <copyright>
-    Copyright © 2013-2014 Collabora, Ltd.
-
-    Permission is hereby granted, free of charge, to any person obtaining a
-    copy of this software and associated documentation files (the "Software"),
-    to deal in the Software without restriction, including without limitation
-    the rights to use, copy, modify, merge, publish, distribute, sublicense,
-    and/or sell copies of the Software, and to permit persons to whom the
-    Software is furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice (including the next
-    paragraph) shall be included in all copies or substantial portions of the
-    Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE SOFTWARE.
-  </copyright>
-
-  <interface name="presentation" version="1">
-    <description summary="timed presentation related wl_surface requests">
-
-<!-- Introduction -->
-
-      The main feature of this interface is accurate presentation
-      timing feedback to ensure smooth video playback while maintaining
-      audio/video synchronization. Some features use the concept of a
-      presentation clock, which is defined in presentation.clock_id
-      event.
-
-      Request 'feedback' can be regarded as an additional wl_surface
-      method. It is part of the double-buffered surface state update
-      mechanism, where other requests first set up the state and then
-      wl_surface.commit atomically applies the state into use. In
-      other words, wl_surface.commit submits a content update.
-
-<!-- Completing presentation -->
-
-      When the final realized presentation time is available, e.g.
-      after a framebuffer flip completes, the requested
-      presentation_feedback.presented events are sent. The final
-      presentation time can differ from the compositor's predicted
-      display update time and the update's target time, especially
-      when the compositor misses its target vertical blanking period.
-    </description>
-
-    <enum name="error">
-      <description summary="fatal presentation errors">
-        These fatal protocol errors may be emitted in response to
-        illegal presentation requests.
-      </description>
-      <entry name="invalid_timestamp" value="0"
-             summary="invalid value in tv_nsec"/>
-      <entry name="invalid_flag" value="1"
-             summary="invalid flag"/>
-    </enum>
-
-    <request name="destroy" type="destructor">
-      <description summary="unbind from the presentation interface">
-        Informs the server that the client will not be using this
-        protocol object anymore. This does not affect any existing
-        objects created by this interface.
-      </description>
-    </request>
-
-    <request name="feedback">
-      <description summary="request presentation feedback information">
-        Request presentation feedback for the current content submission
-        on the given surface. This creates a new presentation_feedback
-        object, which will deliver the feedback information once. If
-        multiple presentation_feedback objects are created for the same
-        submission, they will all deliver the same information.
-
-        For details on what information is returned, see
-        presentation_feedback interface.
-      </description>
-
-      <arg name="surface" type="object" interface="wl_surface"
-           summary="target surface"/>
-      <arg name="callback" type="new_id" interface="presentation_feedback"
-           summary="new feedback object"/>
-    </request>
-
-    <event name="clock_id">
-      <description summary="clock ID for timestamps">
-        This event tells the client in which clock domain the
-        compositor interprets the timestamps used by the presentation
-        extension. This clock is called the presentation clock.
-
-        The compositor sends this event when the client binds to the
-        presentation interface. The presentation clock does not change
-        during the lifetime of the client connection.
-
-        The clock identifier is platform dependent. Clients must be
-        able to query the current clock value directly, not by asking
-        the compositor.
-
-        On Linux/glibc, the identifier value is one of the clockid_t
-        values accepted by clock_gettime(). clock_gettime() is defined
-        by POSIX.1-2001.
-
-        Compositors should prefer a clock which does not jump and is
-        not slewed e.g. by NTP. The absolute value of the clock is
-        irrelevant. Precision of one millisecond or better is
-        recommended.
-
-        Timestamps in this clock domain are expressed as tv_sec_hi,
-        tv_sec_lo, tv_nsec triples, each component being an unsigned
-        32-bit value. Whole seconds are in tv_sec which is a 64-bit
-        value combined from tv_sec_hi and tv_sec_lo, and the
-        additional fractional part in tv_nsec as nanoseconds. Hence,
-        for valid timestamps tv_nsec must be in [0, 999999999].
-
-        Note that clock_id applies only to the presentation clock,
-        and implies nothing about e.g. the timestamps used in the
-        Wayland core protocol input events.
-      </description>
-
-      <arg name="clk_id" type="uint" summary="platform clock identifier"/>
-    </event>
-
-  </interface>
-
-  <interface name="presentation_feedback" version="1">
-    <description summary="presentation time feedback event">
-      A presentation_feedback object returns an indication that a
-      wl_surface content update has become visible to the user.
-      One object corresponds to one content update submission
-      (wl_surface.commit). There are two possible outcomes: the
-      content update is presented to the user, and a presentation
-      timestamp delivered; or, the user did not see the content
-      update because it was superseded or its surface destroyed,
-      and the content update is discarded.
-
-      Once a presentation_feedback object has delivered an 'presented'
-      or 'discarded' event it is automatically destroyed.
-    </description>
-
-    <event name="sync_output">
-      <description summary="presentation synchronized to this output">
-        As presentation can be synchronized to only one output at a
-        time, this event tells which output it was. This event is only
-        sent prior to the presented event.
-
-        As clients may bind to the same global wl_output multiple
-        times, this event is sent for each bound instance that matches
-        the synchronized output. If a client has not bound to the
-        right wl_output global at all, this event is not sent.
-      </description>
-
-      <arg name="output" type="object" interface="wl_output"
-           summary="presentation output"/>
-    </event>
-
-    <enum name="kind">
-      <description summary="bitmask of flags in presented event">
-        These flags provide information about how the presentation of
-        the related content update was done. The intent is to help
-        clients assess the reliability of the feedback and the visual
-        quality with respect to possible tearing and timings. The
-        flags are:
-
-        VSYNC:
-        The presentation was synchronized to the "vertical retrace" by
-        the display hardware such that tearing does not happen.
-        Relying on user space scheduling is not acceptable for this
-        flag. If presentation is done by a copy to the active
-        frontbuffer, then it must guarantee that tearing cannot
-        happen.
-
-        HW_CLOCK:
-        The display hardware provided measurements that the hardware
-        driver converted into a presentation timestamp. Sampling a
-        clock in user space is not acceptable for this flag.
-
-        HW_COMPLETION:
-        The display hardware signalled that it started using the new
-        image content. The opposite of this is e.g. a timer being used
-        to guess when the display hardware has switched to the new
-        image content.
-
-        ZERO_COPY:
-        The presentation of this update was done zero-copy. This means
-        the buffer from the client was given to display hardware as
-        is, without copying it. Compositing with OpenGL counts as
-        copying, even if textured directly from the client buffer.
-        Possible zero-copy cases include direct scanout of a
-        fullscreen surface and a surface on a hardware overlay.
-      </description>
-
-      <entry name="vsync" value="0x1" summary="presentation was vsync'd"/>
-      <entry name="hw_clock" value="0x2"
-             summary="hardware provided the presentation timestamp"/>
-      <entry name="hw_completion" value="0x4"
-             summary="hardware signalled the start of the presentation"/>
-      <entry name="zero_copy" value="0x8"
-             summary="presentation was done zero-copy"/>
-    </enum>
-
-    <event name="presented">
-      <description summary="the content update was displayed">
-        The associated content update was displayed to the user at the
-        indicated time (tv_sec_hi/lo, tv_nsec). For the interpretation of
-        the timestamp, see presentation.clock_id event.
-
-        The timestamp corresponds to the time when the content update
-        turned into light the first time on the surface's main output.
-        Compositors may approximate this from the framebuffer flip
-        completion events from the system, and the latency of the
-        physical display path if known.
-
-        This event is preceded by all related sync_output events
-        telling which output's refresh cycle the feedback corresponds
-        to, i.e. the main output for the surface. Compositors are
-        recommended to choose the output containing the largest part
-        of the wl_surface, or keeping the output they previously
-        chose. Having a stable presentation output association helps
-        clients predict future output refreshes (vblank).
-
-        Argument 'refresh' gives the compositor's prediction of how
-        many nanoseconds after tv_sec, tv_nsec the very next output
-        refresh may occur. This is to further aid clients in
-        predicting future refreshes, i.e., estimating the timestamps
-        targeting the next few vblanks. If such prediction cannot
-        usefully be done, the argument is zero.
-
-        The 64-bit value combined from seq_hi and seq_lo is the value
-        of the output's vertical retrace counter when the content
-        update was first scanned out to the display. This value must
-        be compatible with the definition of MSC in
-        GLX_OML_sync_control specification. Note, that if the display
-        path has a non-zero latency, the time instant specified by
-        this counter may differ from the timestamp's.
-
-        If the output does not have a constant refresh rate, explicit
-        video mode switches excluded, then the refresh argument must
-        be zero.
-
-        If the output does not have a concept of vertical retrace or a
-        refresh cycle, or the output device is self-refreshing without
-        a way to query the refresh count, then the arguments seq_hi
-        and seq_lo must be zero.
-      </description>
-
-      <arg name="tv_sec_hi" type="uint"
-           summary="high 32 bits of the seconds part of the presentation timestamp"/>
-      <arg name="tv_sec_lo" type="uint"
-           summary="low 32 bits of the seconds part of the presentation timestamp"/>
-      <arg name="tv_nsec" type="uint"
-           summary="nanoseconds part of the presentation timestamp"/>
-      <arg name="refresh" type="uint" summary="nanoseconds till next refresh"/>
-      <arg name="seq_hi" type="uint"
-           summary="high 32 bits of refresh counter"/>
-      <arg name="seq_lo" type="uint"
-           summary="low 32 bits of refresh counter"/>
-      <arg name="flags" type="uint" summary="combination of 'kind' values"/>
-    </event>
-
-    <event name="discarded">
-      <description summary="the content update was not displayed">
-        The content update was never displayed to the user.
-      </description>
-    </event>
-  </interface>
-
-</protocol>
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 41f9a82..aee7ad7 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-timing-unstable-v1-server-protocol.h"
 #include "linux-dmabuf.h"
 
 #ifndef DRM_CAP_TIMESTAMP_MONOTONIC
@@ -821,8 +821,8 @@ vblank_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec,
 	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 = ZWL_PRESENTATION_FEEDBACK1_KIND_HW_COMPLETION |
+			 ZWL_PRESENTATION_FEEDBACK1_KIND_HW_CLOCK;
 
 	drm_output_update_msc(output, frame);
 	output->vblank_pending = 0;
@@ -847,9 +847,9 @@ page_flip_handler(int fd, unsigned int frame,
 {
 	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 = ZWL_PRESENTATION_FEEDBACK1_KIND_VSYNC |
+			 ZWL_PRESENTATION_FEEDBACK1_KIND_HW_COMPLETION |
+			 ZWL_PRESENTATION_FEEDBACK1_KIND_HW_CLOCK;
 
 	drm_output_update_msc(output, frame);
 
@@ -1281,7 +1281,7 @@ drm_assign_planes(struct weston_output *output_base)
 			/* All other planes are a direct scanout of a
 			 * single client buffer.
 			 */
-			ev->psf_flags = PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
+			ev->psf_flags = ZWL_PRESENTATION_FEEDBACK1_KIND_ZERO_COPY;
 		}
 
 		pixman_region32_fini(&surface_overlap);
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 57c54c2..490718c 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-timing-unstable-v1-server-protocol.h"
 
 struct fbdev_backend {
 	struct weston_backend base;
diff --git a/src/compositor-headless.c b/src/compositor-headless.c
index ba0d8d7..323e2be 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-timing-unstable-v1-server-protocol.h"
 
 struct headless_backend {
 	struct weston_backend base;
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 4d7ea7b..e8c3172 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -51,7 +51,7 @@
 #include "rpi-renderer.h"
 #include "launcher-util.h"
 #include "libinput-seat.h"
-#include "presentation_timing-server-protocol.h"
+#include "presentation-timing-unstable-v1-server-protocol.h"
 
 #if 0
 #define DBG(...) \
@@ -258,8 +258,8 @@ static void
 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 = ZWL_PRESENTATION_FEEDBACK1_KIND_VSYNC |
+			 ZWL_PRESENTATION_FEEDBACK1_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 dc39cbe..1558a79 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-timing-unstable-v1-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 ccb7867..b465433 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-timing-unstable-v1-server-protocol.h"
 #include "linux-dmabuf.h"
 
 #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
diff --git a/src/compositor.c b/src/compositor.c
index f8437e8..80cd983 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-timing-unstable-v1-server-protocol.h"
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
 #include "shared/timespec-util.h"
@@ -443,7 +443,7 @@ static void
 weston_presentation_feedback_discard(
 		struct weston_presentation_feedback *feedback)
 {
-	presentation_feedback_send_discarded(feedback->resource);
+	zwl_presentation_feedback1_send_discarded(feedback->resource);
 	wl_resource_destroy(feedback->resource);
 }
 
@@ -473,16 +473,17 @@ weston_presentation_feedback_present(
 		if (wl_resource_get_client(o) != client)
 			continue;
 
-		presentation_feedback_send_sync_output(feedback->resource, o);
+		zwl_presentation_feedback1_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);
+	zwl_presentation_feedback1_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);
 }
 
@@ -4353,7 +4354,7 @@ presentation_feedback(struct wl_client *client,
 		goto err_calloc;
 
 	feedback->resource = wl_resource_create(client,
-					&presentation_feedback_interface,
+					&zwl_presentation_feedback1_interface,
 					1, callback);
 	if (!feedback->resource)
 		goto err_create;
@@ -4372,7 +4373,7 @@ err_calloc:
 	wl_client_post_no_memory(client);
 }
 
-static const struct presentation_interface presentation_implementation = {
+static const struct zwl_presentation1_interface presentation_implementation = {
 	presentation_destroy,
 	presentation_feedback
 };
@@ -4384,7 +4385,7 @@ bind_presentation(struct wl_client *client,
 	struct weston_compositor *compositor = data;
 	struct wl_resource *resource;
 
-	resource = wl_resource_create(client, &presentation_interface,
+	resource = wl_resource_create(client, &zwl_presentation1_interface,
 				      MIN(version, 1), id);
 	if (resource == NULL) {
 		wl_client_post_no_memory(client);
@@ -4393,7 +4394,7 @@ bind_presentation(struct wl_client *client,
 
 	wl_resource_set_implementation(resource, &presentation_implementation,
 				       compositor, NULL);
-	presentation_send_clock_id(resource, compositor->presentation_clock);
+	zwl_presentation1_send_clock_id(resource, compositor->presentation_clock);
 }
 
 static void
@@ -4502,7 +4503,7 @@ weston_compositor_create(struct wl_display *display, void *user_data)
 			      ec, bind_scaler))
 		goto fail;
 
-	if (!wl_global_create(ec->wl_display, &presentation_interface, 1,
+	if (!wl_global_create(ec->wl_display, &zwl_presentation1_interface, 1,
 			      ec, bind_presentation))
 		goto fail;
 
diff --git a/tests/presentation-test.c b/tests/presentation-test.c
index 27f33da..6d4fc3e 100644
--- a/tests/presentation-test.c
+++ b/tests/presentation-test.c
@@ -33,14 +33,14 @@
 
 #include "shared/helpers.h"
 #include "weston-test-client-helper.h"
-#include "presentation_timing-client-protocol.h"
+#include "presentation-timing-unstable-v1-client-protocol.h"
 
-static struct presentation *
+static struct zwl_presentation1 *
 get_presentation(struct client *client)
 {
 	struct global *g;
 	struct global *global_pres = NULL;
-	static struct presentation *pres;
+	static struct zwl_presentation1 *pres;
 
 	if (pres)
 		return pres;
@@ -60,7 +60,7 @@ get_presentation(struct client *client)
 	assert(global_pres->version == 1);
 
 	pres = wl_registry_bind(client->wl_registry, global_pres->name,
-				&presentation_interface, 1);
+				&zwl_presentation1_interface, 1);
 	assert(pres);
 
 	return pres;
@@ -68,7 +68,7 @@ get_presentation(struct client *client)
 
 struct feedback {
 	struct client *client;
-	struct presentation_feedback *obj;
+	struct zwl_presentation_feedback1 *obj;
 
 	enum {
 		FB_PENDING = 0,
@@ -93,7 +93,7 @@ timespec_from_proto(struct timespec *tm, uint32_t tv_sec_hi,
 
 static void
 feedback_sync_output(void *data,
-		     struct presentation_feedback *presentation_feedback,
+		     struct zwl_presentation_feedback1 *presentation_feedback,
 		     struct wl_output *output)
 {
 	struct feedback *fb = data;
@@ -106,7 +106,7 @@ feedback_sync_output(void *data,
 
 static void
 feedback_presented(void *data,
-		   struct presentation_feedback *presentation_feedback,
+		   struct zwl_presentation_feedback1 *presentation_feedback,
 		   uint32_t tv_sec_hi,
 		   uint32_t tv_sec_lo,
 		   uint32_t tv_nsec,
@@ -127,7 +127,7 @@ feedback_presented(void *data,
 
 static void
 feedback_discarded(void *data,
-		   struct presentation_feedback *presentation_feedback)
+		   struct zwl_presentation_feedback1 *presentation_feedback)
 {
 	struct feedback *fb = data;
 
@@ -135,7 +135,7 @@ feedback_discarded(void *data,
 	fb->result = FB_DISCARDED;
 }
 
-static const struct presentation_feedback_listener feedback_listener = {
+static const struct zwl_presentation_feedback1_listener feedback_listener = {
 	feedback_sync_output,
 	feedback_presented,
 	feedback_discarded
@@ -148,8 +148,10 @@ feedback_create(struct client *client, struct wl_surface *surface)
 
 	fb = xzalloc(sizeof *fb);
 	fb->client = client;
-	fb->obj = presentation_feedback(get_presentation(client), surface);
-	presentation_feedback_add_listener(fb->obj, &feedback_listener, fb);
+	fb->obj = zwl_presentation1_feedback(get_presentation(client), surface);
+	zwl_presentation_feedback1_add_listener(fb->obj,
+						&feedback_listener,
+						fb);
 
 	return fb;
 }
@@ -169,10 +171,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' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_VSYNC, 's' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_HW_CLOCK, 'c' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_HW_COMPLETION, 'e' },
+		{ ZWL_PRESENTATION_FEEDBACK1_KIND_ZERO_COPY, 'z' },
 	};
 	unsigned i;
 
@@ -212,7 +214,7 @@ feedback_print(struct feedback *fb)
 static void
 feedback_destroy(struct feedback *fb)
 {
-	presentation_feedback_destroy(fb->obj);
+	zwl_presentation_feedback1_destroy(fb->obj);
 	free(fb);
 }
 
-- 
2.4.3



More information about the wayland-devel mailing list