[RFCv3 weston 07/15] compositor: add stub implementation of presentation interface
Pekka Paalanen
ppaalanen at gmail.com
Fri Mar 7 04:03:55 PST 2014
From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
You can bind to the global interface, and it delivers a fake clock id.
All requests on it raise an error.
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
src/compositor.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 69 insertions(+), 1 deletion(-)
diff --git a/src/compositor.c b/src/compositor.c
index 16b9b57..cd07a0d 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1,7 +1,7 @@
/*
* Copyright © 2010-2011 Intel Corporation
* Copyright © 2008-2011 Kristian Høgsberg
- * Copyright © 2012 Collabora, Ltd.
+ * Copyright © 2012-2014 Collabora, Ltd.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
@@ -54,6 +54,7 @@
#include "compositor.h"
#include "scaler-server-protocol.h"
+#include "presentation_timing-server-protocol.h"
#include "../shared/os-compatibility.h"
#include "git-version.h"
#include "version.h"
@@ -3475,6 +3476,69 @@ bind_scaler(struct wl_client *client,
}
static void
+presentation_destroy(struct wl_client *client, struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static void
+presentation_feedback(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *surface,
+ uint32_t callback)
+{
+ wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_METHOD,
+ "presentation_feedback unimplemented");
+}
+
+static void
+presentation_queue(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *surface,
+ uint32_t tv_sec_hi,
+ uint32_t tv_sec_lo,
+ uint32_t tv_nsec)
+{
+ wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_METHOD,
+ "presentation_queue unimplemented");
+}
+
+static void
+presentation_discard_queue(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *surface)
+{
+ wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_METHOD,
+ "presentation_discard_queue unimplemented");
+}
+
+static const struct presentation_interface presentation_implementation = {
+ presentation_destroy,
+ presentation_feedback,
+ presentation_queue,
+ presentation_discard_queue
+};
+
+static void
+bind_presentation(struct wl_client *client,
+ void *data, uint32_t version, uint32_t id)
+{
+ struct weston_compositor *compositor = data;
+ struct wl_resource *resource;
+
+ resource = wl_resource_create(client, &presentation_interface,
+ MIN(version, 1), id);
+ if (resource == NULL) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+
+ wl_resource_set_implementation(resource, &presentation_implementation,
+ compositor, NULL);
+ presentation_send_clock_id(resource, CLOCK_MONOTONIC);
+}
+
+static void
compositor_bind(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
@@ -3568,6 +3632,10 @@ weston_compositor_init(struct weston_compositor *ec,
ec, bind_scaler))
return -1;
+ if (!wl_global_create(ec->wl_display, &presentation_interface, 1,
+ ec, bind_presentation))
+ return -1;
+
wl_list_init(&ec->view_list);
wl_list_init(&ec->plane_list);
wl_list_init(&ec->layer_list);
--
1.8.3.2
More information about the wayland-devel
mailing list