[PATCH 2/8] compositor: add stub implementation of presentation interface
Louis-Francis Ratté-Boulianne
lfrb at collabora.com
Mon Sep 15 13:16:41 PDT 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.
Changes in v4:
* queuing methods were extractracted for a later series
[Louis-Francis Ratté-Boulianne: split queuing feature]
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de at gmail.com>
---
src/compositor.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/src/compositor.c b/src/compositor.c
index a219766..d789508 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
@@ -55,6 +55,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"
@@ -3736,6 +3737,46 @@ 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 const struct presentation_interface presentation_implementation = {
+ presentation_destroy,
+ presentation_feedback
+};
+
+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)
{
@@ -3830,6 +3871,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.9.3
More information about the wayland-devel
mailing list