summarylogtreecommitdiffstats
path: root/0002-Set-the-default-max-buffer-size-to-unbounded.patch
blob: 724a779224da92aa216e0184f019c1eb400dd1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 0d7ae890b76fe390fd3d5f2a6f63f6ad7b000889 Mon Sep 17 00:00:00 2001
From: Erik Chen <erikchen@chromium.org>
Date: Sun, 30 Oct 2022 23:31:57 +0000
Subject: [PATCH 1/2] Set the default max buffer size to unbounded.

Bug: 1342356
Change-Id: I6e6c353504d6817b9bf76bc7e8b24001d7957ad6
---
 src/connection.c      | 2 +-
 src/wayland-private.h | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 8870fd2..d5fbf5f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -588,7 +588,7 @@ wl_connection_queue(struct wl_connection *connection,
 	 *
 	 * We'd like to flush often and get the buffer size back down if possible.
 	 */
-	if (ring_buffer_size(&connection->out) + count > WL_BUFFER_DEFAULT_MAX_SIZE) {
+	if (ring_buffer_size(&connection->out) + count > WL_BUFFER_FLUSH_SIZE) {
 		connection->want_flush = 1;
 		if (wl_connection_flush(connection) < 0 && errno != EAGAIN)
 			return -1;
diff --git a/src/wayland-private.h b/src/wayland-private.h
index fe9120a..b2d1d89 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -48,7 +48,10 @@
 #define WL_MAP_MAX_OBJECTS 0x00f00000
 #define WL_CLOSURE_MAX_ARGS 20
 #define WL_BUFFER_DEFAULT_SIZE_POT 12
-#define WL_BUFFER_DEFAULT_MAX_SIZE (1 << WL_BUFFER_DEFAULT_SIZE_POT)
+// 0 means unbounded.
+#define WL_BUFFER_DEFAULT_MAX_SIZE 0
+// The size at which queueing a request will also trigger a flush.
+#define WL_BUFFER_FLUSH_SIZE (1 << WL_BUFFER_DEFAULT_SIZE_POT)
 
 /**
  * Argument types used in signatures.
-- 
2.45.2