summaryrefslogtreecommitdiffstats
path: root/patches/0001-Add-thread-affinity-to-wayland-clients.patch
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@nokia.com>2012-06-06 13:04:30 +0200
committerAndy Nichols <andy.nichols@nokia.com>2012-06-07 00:44:43 +0200
commit2a5d11c18910c79972591187bb7d381528a119ac (patch)
tree1589b928bda153f047eca57b18e0b4e19ed36387 /patches/0001-Add-thread-affinity-to-wayland-clients.patch
parent33ccf5847722df56822e407daed5c2ea3049f0c9 (diff)
Rebase Add-thread-affinity-to-wayland-clients.patch
The patch now applies cleanly to the tested wayland sha. Change-Id: I7e24fcd34a5a53816d6a75611cd99a0ce9179e20 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'patches/0001-Add-thread-affinity-to-wayland-clients.patch')
-rw-r--r--patches/0001-Add-thread-affinity-to-wayland-clients.patch77
1 files changed, 39 insertions, 38 deletions
diff --git a/patches/0001-Add-thread-affinity-to-wayland-clients.patch b/patches/0001-Add-thread-affinity-to-wayland-clients.patch
index 3838a22b7..9448c4db0 100644
--- a/patches/0001-Add-thread-affinity-to-wayland-clients.patch
+++ b/patches/0001-Add-thread-affinity-to-wayland-clients.patch
@@ -1,32 +1,32 @@
-From 24b8dccb2f48bc8595d40288106d51d3f4605544 Mon Sep 17 00:00:00 2001
+From bb2bb0a9f3751156d9537d2daa4507c8b1eff459 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com>
Date: Mon, 5 Mar 2012 12:44:37 +0100
-Subject: [PATCH 1/2] Add thread affinity to wayland clients
+Subject: [PATCH] Add thread affinity to wayland clients
This makes it possible to marshal requests from more than 1 thread in
wayland clients. However, its not possible to run wl_display_iterate
from other threads than the thread that made the wl_display.
---
src/Makefile.am | 2 +
- src/wayland-client.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++--
- src/wayland-client.h | 6 +++
- 3 files changed, 112 insertions(+), 5 deletions(-)
+ src/wayland-client.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++---
+ src/wayland-client.h | 7 ++++
+ 3 files changed, 115 insertions(+), 5 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
-index f356b54..9aab9de 100644
+index f93954e..836cb31 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
-@@ -24,6 +24,8 @@ libwayland_server_la_SOURCES = \
+@@ -27,6 +27,8 @@ libwayland_server_la_SOURCES = \
event-loop.c
- libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-util.la -lrt
+ libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-util.la -lrt -lm
+libwayland_client_la_LDFLAGS = -pthread
+libwayland_client_la_CFLAGS = -pthread
libwayland_client_la_SOURCES = \
wayland-protocol.c \
wayland-client.c
diff --git a/src/wayland-client.c b/src/wayland-client.c
-index 498a429..9eb4b25 100644
+index ecedd99..c385bfe 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -34,6 +34,7 @@
@@ -36,8 +36,8 @@ index 498a429..9eb4b25 100644
+#include <sys/eventfd.h>
#include "wayland-util.h"
- #include "wayland-client.h"
-@@ -62,6 +63,9 @@ struct wl_display {
+ #include "wayland-os.h"
+@@ -63,6 +64,9 @@ struct wl_display {
struct wl_proxy proxy;
struct wl_connection *connection;
int fd;
@@ -47,22 +47,22 @@ index 498a429..9eb4b25 100644
uint32_t mask;
struct wl_map objects;
struct wl_list global_listener_list;
-@@ -191,7 +195,11 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
- {
- struct wl_closure *closure;
+@@ -193,6 +197,11 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
+ struct wl_closure closure;
va_list ap;
+ int ret;
+ int write_notification_event_fd;
+ uint64_t write_notification_value;
+ ssize_t success;
-
++
+ pthread_mutex_lock(&proxy->display->marshalling_mutex);
+
va_start(ap, opcode);
- closure = wl_connection_vmarshal(proxy->display->connection,
- &proxy->object, opcode, ap,
-@@ -212,6 +220,18 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
- wl_closure_print(closure, &proxy->object, true);
+ ret = wl_closure_vmarshal(&closure, &proxy->object, opcode, ap,
+@@ -213,6 +222,18 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
+ wl_closure_print(&closure, &proxy->object, true);
- wl_closure_destroy(closure);
+ wl_closure_destroy(&closure);
+
+ write_notification_event_fd = proxy->display->write_notification_event_fd;
+ write_notification_value = 1;
@@ -78,7 +78,7 @@ index 498a429..9eb4b25 100644
}
/* Can't do this, there may be more than one instance of an
-@@ -347,6 +367,7 @@ wl_display_connect(const char *name)
+@@ -348,6 +369,7 @@ wl_display_connect(const char *name)
const char *debug;
char *connection, *end;
int flags;
@@ -86,7 +86,7 @@ index 498a429..9eb4b25 100644
debug = getenv("WAYLAND_DEBUG");
if (debug)
-@@ -396,6 +417,21 @@ wl_display_connect(const char *name)
+@@ -397,6 +419,21 @@ wl_display_connect(const char *name)
return NULL;
}
@@ -108,7 +108,7 @@ index 498a429..9eb4b25 100644
return display;
}
-@@ -432,6 +468,18 @@ wl_display_get_fd(struct wl_display *display,
+@@ -433,6 +470,18 @@ wl_display_get_fd(struct wl_display *display,
return display->fd;
}
@@ -125,9 +125,9 @@ index 498a429..9eb4b25 100644
+}
+
static void
- sync_callback(void *data, struct wl_callback *callback, uint32_t time)
+ sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
{
-@@ -445,18 +493,46 @@ static const struct wl_callback_listener sync_listener = {
+@@ -446,18 +495,47 @@ static const struct wl_callback_listener sync_listener = {
sync_callback
};
@@ -145,6 +145,7 @@ index 498a429..9eb4b25 100644
+ threaded_sync_callback
+};
+
++
WL_EXPORT void
wl_display_roundtrip(struct wl_display *display)
{
@@ -179,19 +180,18 @@ index 498a429..9eb4b25 100644
}
static void
-@@ -500,7 +576,11 @@ WL_EXPORT void
- wl_display_iterate(struct wl_display *display, uint32_t mask)
+@@ -503,6 +581,10 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
{
- uint32_t p[2], object, opcode, size;
+ uint32_t p[2], object;
+ int len, opcode, size;
+ uint64_t write_fd;
- int len;
+ ssize_t success;
+
+ pthread_mutex_lock(&display->marshalling_mutex);
mask &= display->mask;
if (mask == 0) {
-@@ -509,6 +589,23 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
+@@ -511,6 +593,23 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
return;
}
@@ -215,7 +215,7 @@ index 498a429..9eb4b25 100644
len = wl_connection_data(display->connection, mask);
while (len > 0) {
-@@ -526,6 +623,8 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
+@@ -528,6 +627,8 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
len -= size;
}
@@ -225,12 +225,12 @@ index 498a429..9eb4b25 100644
fprintf(stderr, "read error: %m\n");
exit(EXIT_FAILURE);
diff --git a/src/wayland-client.h b/src/wayland-client.h
-index b04a7ef..a680cab 100644
+index 06dc6fe..4053474 100644
--- a/src/wayland-client.h
+++ b/src/wayland-client.h
-@@ -25,6 +25,9 @@
-
+@@ -26,6 +26,9 @@
#include "wayland-util.h"
+ #include "wayland-version.h"
+#include <pthread.h>
+#define WAYLAND_CLIENT_THREAD_AFFINITY
@@ -238,16 +238,17 @@ index b04a7ef..a680cab 100644
#ifdef __cplusplus
extern "C" {
#endif
-@@ -94,6 +97,9 @@ uint32_t
- wl_display_get_global(struct wl_display *display,
- const char *interface, uint32_t version);
+@@ -98,6 +101,10 @@ wl_display_get_global(struct wl_display *display,
+
+ void wl_log_set_handler_client(wl_log_func_t handler);
+int wl_display_get_write_notification_fd(struct wl_display *display);
++
+pthread_t wl_display_thread(struct wl_display *display);
+
#ifdef __cplusplus
}
#endif
--
-1.7.5.4
+1.7.9.5