spice-0.14.3.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. From c74ae160e3ac6d726fd312ba36f5ca4bfed0eb9c Mon Sep 17 00:00:00 2001
  2. From: Frediano Ziglio <fziglio@redhat.com>
  3. Date: Wed, 15 Apr 2020 13:36:13 +0100
  4. Subject: [PATCH 01/11] Fix compatibility with MSG_NOSIGNAL and Darwin
  5. Darwin does not have MSG_NOSIGNAL but allows to set a SO_NOSIGPIPE
  6. option to disable sending SIGPIPE writing to closed socket.
  7. Note that *BSD has the SO_NOSIGPIPE option but does not affect all
  8. write calls so instead continue to use MSG_NOSIGNAL instead on
  9. that systems.
  10. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  11. ---
  12. server/net-utils.c | 12 ++++++++++++
  13. server/net-utils.h | 1 +
  14. server/reds.c | 1 +
  15. server/sys-socket.h | 4 ++++
  16. 4 files changed, 18 insertions(+)
  17. diff --git a/server/net-utils.c b/server/net-utils.c
  18. index 144bfd8f..78b94886 100644
  19. --- a/server/net-utils.c
  20. +++ b/server/net-utils.c
  21. @@ -150,3 +150,15 @@ int red_socket_get_no_delay(int fd)
  22. return delay_val;
  23. }
  24. +
  25. +/**
  26. + * red_socket_set_nosigpipe
  27. + * @fd: a socket file descriptor
  28. + */
  29. +void red_socket_set_nosigpipe(int fd, bool enable)
  30. +{
  31. +#if defined(SO_NOSIGPIPE) && defined(__APPLE__)
  32. + int val = !!enable;
  33. + setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (const void *) &val, sizeof(val));
  34. +#endif
  35. +}
  36. diff --git a/server/net-utils.h b/server/net-utils.h
  37. index f95d689a..b93ec0ab 100644
  38. --- a/server/net-utils.h
  39. +++ b/server/net-utils.h
  40. @@ -24,5 +24,6 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout);
  41. bool red_socket_set_no_delay(int fd, bool no_delay);
  42. int red_socket_get_no_delay(int fd);
  43. bool red_socket_set_non_blocking(int fd, bool non_blocking);
  44. +void red_socket_set_nosigpipe(int fd, bool enable);
  45. #endif /* RED_NET_UTILS_H_ */
  46. diff --git a/server/reds.c b/server/reds.c
  47. index ee8cf387..d91b32b0 100644
  48. --- a/server/reds.c
  49. +++ b/server/reds.c
  50. @@ -2458,6 +2458,7 @@ static RedLinkInfo *reds_init_client_connection(RedsState *reds, int socket)
  51. }
  52. red_socket_set_keepalive(socket, TRUE, KEEPALIVE_TIMEOUT);
  53. + red_socket_set_nosigpipe(socket, true);
  54. link = g_new0(RedLinkInfo, 1);
  55. link->reds = reds;
  56. diff --git a/server/sys-socket.h b/server/sys-socket.h
  57. index 3a3b7878..2935cfb5 100644
  58. --- a/server/sys-socket.h
  59. +++ b/server/sys-socket.h
  60. @@ -139,4 +139,8 @@ int socket_newpair(int type, int protocol, int sv[2]);
  61. #define socketpair(family, type, protocol, sv) socket_newpair(type, protocol, sv)
  62. #endif
  63. +#if defined(SO_NOSIGPIPE) && defined(__APPLE__)
  64. +#define MSG_NOSIGNAL 0
  65. +#endif
  66. +
  67. #endif // RED_SYS_SOCKET_H_
  68. --
  69. 2.28.0
  70. From c3ca9e8db128fb8e9fa033f8f1aabb96514f6f94 Mon Sep 17 00:00:00 2001
  71. From: Frediano Ziglio <fziglio@redhat.com>
  72. Date: Wed, 15 Apr 2020 14:30:37 +0100
  73. Subject: [PATCH 02/11] Fix compatibility with pthread_setname_np and Darwin
  74. On Darwin pthread_setname_np accepts only an argument and
  75. set current thread name.
  76. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  77. ---
  78. server/red-worker.c | 5 +++++
  79. 1 file changed, 5 insertions(+)
  80. diff --git a/server/red-worker.c b/server/red-worker.c
  81. index 12a8e739..2f07337e 100644
  82. --- a/server/red-worker.c
  83. +++ b/server/red-worker.c
  84. @@ -1120,6 +1120,9 @@ static void *red_worker_main(void *arg)
  85. RedWorker *worker = arg;
  86. spice_debug("begin");
  87. +#if defined(__APPLE__)
  88. + pthread_setname_np("SPICE Worker");
  89. +#endif
  90. SPICE_VERIFY(MAX_PIPE_SIZE > WIDE_CLIENT_ACK_WINDOW &&
  91. MAX_PIPE_SIZE > NARROW_CLIENT_ACK_WINDOW); //ensure wakeup by ack message
  92. @@ -1159,7 +1162,9 @@ bool red_worker_run(RedWorker *worker)
  93. #ifndef _WIN32
  94. pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL);
  95. #endif
  96. +#if !defined(__APPLE__)
  97. pthread_setname_np(worker->thread, "SPICE Worker");
  98. +#endif
  99. return r == 0;
  100. }
  101. --
  102. 2.28.0
  103. From d728111a51c8c08806e78c3b0d46d92a048b865a Mon Sep 17 00:00:00 2001
  104. From: Frediano Ziglio <fziglio@redhat.com>
  105. Date: Wed, 15 Apr 2020 14:35:10 +0100
  106. Subject: [PATCH 03/11] Fix compatibility with mremap and Darwin
  107. Darwin does not have mremap. Use munmap+mmap instead.
  108. That code is not in a hot path, number of nodes do not change very
  109. often.
  110. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  111. ---
  112. tools/reds_stat.c | 7 +++----
  113. 1 file changed, 3 insertions(+), 4 deletions(-)
  114. diff --git a/tools/reds_stat.c b/tools/reds_stat.c
  115. index deffec1b..7d35c45b 100644
  116. --- a/tools/reds_stat.c
  117. +++ b/tools/reds_stat.c
  118. @@ -86,7 +86,6 @@ int main(int argc, char **argv)
  119. pid_t kvm_pid = 0;
  120. uint32_t num_of_nodes = 0;
  121. size_t shm_size;
  122. - size_t shm_old_size;
  123. int shm_name_len;
  124. int ret = EXIT_FAILURE;
  125. int fd;
  126. @@ -142,11 +141,11 @@ int main(int argc, char **argv)
  127. printf("spice statistics\n\n");
  128. if (num_of_nodes != reds_stat->num_of_nodes) {
  129. num_of_nodes = reds_stat->num_of_nodes;
  130. - shm_old_size = shm_size;
  131. + munmap(reds_stat, shm_size);
  132. shm_size = header_size + num_of_nodes * sizeof(SpiceStatNode);
  133. - reds_stat = mremap(reds_stat, shm_old_size, shm_size, MREMAP_MAYMOVE);
  134. + reds_stat = (SpiceStat *)mmap(NULL, shm_size, PROT_READ, MAP_SHARED, fd, 0);
  135. if (reds_stat == (SpiceStat *)MAP_FAILED) {
  136. - perror("mremap");
  137. + perror("mmap");
  138. goto error;
  139. }
  140. reds_nodes = (SpiceStatNode *)((char *) reds_stat + header_size);
  141. --
  142. 2.28.0
  143. From 20e058fd9ba28892adffc8d2ade809b698577756 Mon Sep 17 00:00:00 2001
  144. From: Frediano Ziglio <fziglio@redhat.com>
  145. Date: Wed, 15 Apr 2020 20:47:05 +0100
  146. Subject: [PATCH 04/11] Fix compatibility with TCP_KEEPIDLE and Darwin
  147. Darwin uses for the same setting the TCP_KEEPALIVE option.
  148. Use TCP_KEEPALIVE instead of TCP_KEEPIDLE for Darwin.
  149. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  150. ---
  151. server/net-utils.c | 6 +++++-
  152. 1 file changed, 5 insertions(+), 1 deletion(-)
  153. diff --git a/server/net-utils.c b/server/net-utils.c
  154. index 78b94886..32ceb3b8 100644
  155. --- a/server/net-utils.c
  156. +++ b/server/net-utils.c
  157. @@ -35,6 +35,10 @@
  158. #include "net-utils.h"
  159. #include "sys-socket.h"
  160. +#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) && defined(__APPLE__)
  161. +#define TCP_KEEPIDLE TCP_KEEPALIVE
  162. +#endif
  163. +
  164. /**
  165. * red_socket_set_keepalive:
  166. * @fd: a socket file descriptor
  167. @@ -57,7 +61,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
  168. return true;
  169. }
  170. -#ifdef HAVE_TCP_KEEPIDLE
  171. +#ifdef TCP_KEEPIDLE
  172. if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
  173. if (errno != ENOTSUP) {
  174. g_warning("setsockopt for keepalive timeout failed, %s", strerror(errno));
  175. --
  176. 2.28.0
  177. From eb21efe8e5d6fa2cc893b1f7fec356fd06834d30 Mon Sep 17 00:00:00 2001
  178. From: Frediano Ziglio <fziglio@redhat.com>
  179. Date: Wed, 15 Apr 2020 20:50:56 +0100
  180. Subject: [PATCH 05/11] Fix compatibility with ENOTSUP and Darwin
  181. Darwin uses also the constant EOPNOTSUPP for the same reasons.
  182. In some versions EOPNOTSUPP is defined as ENOTSUP.
  183. Check both values, not only ENOTSUP.
  184. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  185. ---
  186. server/net-utils.c | 12 +++++++++---
  187. 1 file changed, 9 insertions(+), 3 deletions(-)
  188. diff --git a/server/net-utils.c b/server/net-utils.c
  189. index 32ceb3b8..f0aecc3d 100644
  190. --- a/server/net-utils.c
  191. +++ b/server/net-utils.c
  192. @@ -39,6 +39,12 @@
  193. #define TCP_KEEPIDLE TCP_KEEPALIVE
  194. #endif
  195. +#if defined(EOPNOTSUPP) && EOPNOTSUPP != ENOTSUP
  196. +#define NOTSUP_ERROR(err) ((err) == ENOTSUP || (err) == EOPNOTSUPP)
  197. +#else
  198. +#define NOTSUP_ERROR(err) ((err) == ENOTSUP)
  199. +#endif
  200. +
  201. /**
  202. * red_socket_set_keepalive:
  203. * @fd: a socket file descriptor
  204. @@ -51,7 +57,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
  205. int keepalive = !!enable;
  206. if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) == -1) {
  207. - if (errno != ENOTSUP) {
  208. + if (!NOTSUP_ERROR(errno)) {
  209. g_warning("setsockopt for keepalive failed, %s", strerror(errno));
  210. return false;
  211. }
  212. @@ -63,7 +69,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
  213. #ifdef TCP_KEEPIDLE
  214. if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
  215. - if (errno != ENOTSUP) {
  216. + if (!NOTSUP_ERROR(errno)) {
  217. g_warning("setsockopt for keepalive timeout failed, %s", strerror(errno));
  218. return false;
  219. }
  220. @@ -86,7 +92,7 @@ bool red_socket_set_no_delay(int fd, bool no_delay)
  221. if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
  222. &optval, sizeof(optval)) != 0) {
  223. - if (errno != ENOTSUP && errno != ENOPROTOOPT) {
  224. + if (!NOTSUP_ERROR(errno) && errno != ENOPROTOOPT) {
  225. spice_warning("setsockopt failed, %s", strerror(errno));
  226. return false;
  227. }
  228. --
  229. 2.28.0
  230. From f93264cb497ea3ab45d35ab3e03546d1cdaa1600 Mon Sep 17 00:00:00 2001
  231. From: Frediano Ziglio <fziglio@redhat.com>
  232. Date: Wed, 15 Apr 2020 21:15:34 +0100
  233. Subject: [PATCH 06/11] Fix compatibility with TCP sockets and Darwin
  234. Using socket pairs and trying to set a TCP level option on the
  235. socket setsockopt returns EINVAL error and not ENOTSUP as
  236. expected.
  237. Check this case and handle as ENOTSUP (ignoring it).
  238. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  239. ---
  240. server/net-utils.c | 26 +++++++++++++++++++++++---
  241. 1 file changed, 23 insertions(+), 3 deletions(-)
  242. diff --git a/server/net-utils.c b/server/net-utils.c
  243. index f0aecc3d..e9778e73 100644
  244. --- a/server/net-utils.c
  245. +++ b/server/net-utils.c
  246. @@ -45,6 +45,25 @@
  247. #define NOTSUP_ERROR(err) ((err) == ENOTSUP)
  248. #endif
  249. +static inline bool
  250. +darwin_einval_on_unix_socket(int fd, int err)
  251. +{
  252. +#if defined(__APPLE__)
  253. + if (err == EINVAL) {
  254. + union {
  255. + struct sockaddr sa;
  256. + char buf[1024];
  257. + } addr;
  258. + socklen_t len = sizeof(addr);
  259. +
  260. + if (getsockname(fd, &addr.sa, &len) == 0 && addr.sa.sa_family == AF_UNIX) {
  261. + return true;
  262. + }
  263. + }
  264. +#endif
  265. + return false;
  266. +}
  267. +
  268. /**
  269. * red_socket_set_keepalive:
  270. * @fd: a socket file descriptor
  271. @@ -57,7 +76,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
  272. int keepalive = !!enable;
  273. if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) == -1) {
  274. - if (!NOTSUP_ERROR(errno)) {
  275. + if (!NOTSUP_ERROR(errno) && !darwin_einval_on_unix_socket(fd, errno)) {
  276. g_warning("setsockopt for keepalive failed, %s", strerror(errno));
  277. return false;
  278. }
  279. @@ -69,7 +88,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
  280. #ifdef TCP_KEEPIDLE
  281. if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
  282. - if (!NOTSUP_ERROR(errno)) {
  283. + if (!NOTSUP_ERROR(errno) && !darwin_einval_on_unix_socket(fd, errno)) {
  284. g_warning("setsockopt for keepalive timeout failed, %s", strerror(errno));
  285. return false;
  286. }
  287. @@ -92,7 +111,8 @@ bool red_socket_set_no_delay(int fd, bool no_delay)
  288. if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
  289. &optval, sizeof(optval)) != 0) {
  290. - if (!NOTSUP_ERROR(errno) && errno != ENOPROTOOPT) {
  291. + if (!NOTSUP_ERROR(errno) && errno != ENOPROTOOPT &&
  292. + !darwin_einval_on_unix_socket(fd, errno)) {
  293. spice_warning("setsockopt failed, %s", strerror(errno));
  294. return false;
  295. }
  296. --
  297. 2.28.0
  298. From 2e6271dbbab76e3868a6cee1c9a800d87ccd30a1 Mon Sep 17 00:00:00 2001
  299. From: osy <osy@turing.llc>
  300. Date: Fri, 4 Mar 2022 19:17:58 -0800
  301. Subject: [PATCH 07/11] red-stream: disable socket_set_cork() on Darwin
  302. TCP_NOPUSH is broken and cannot be used.
  303. ---
  304. server/red-stream.c | 5 +++--
  305. 1 file changed, 3 insertions(+), 2 deletions(-)
  306. diff --git a/server/red-stream.c b/server/red-stream.c
  307. index 2c13aa2f..77d44c9a 100644
  308. --- a/server/red-stream.c
  309. +++ b/server/red-stream.c
  310. @@ -42,7 +42,7 @@
  311. #include "websocket.h"
  312. // compatibility for *BSD systems
  313. -#if !defined(TCP_CORK) && !defined(_WIN32)
  314. +#if !defined(TCP_CORK) && !defined(_WIN32) && !defined(__APPLE__)
  315. #define TCP_CORK TCP_NOPUSH
  316. #endif
  317. @@ -105,7 +105,8 @@ struct RedStreamPrivate {
  318. SpiceCoreInterfaceInternal *core;
  319. };
  320. -#ifndef _WIN32
  321. +// TCP_NOPUSH is broken on Darwin
  322. +#if !defined(_WIN32) && !defined(__APPLE__)
  323. /**
  324. * Set TCP_CORK on socket
  325. */
  326. --
  327. 2.28.0
  328. From 740fb04a95ff2a5aebd67f488e7d6f19b62fe3c1 Mon Sep 17 00:00:00 2001
  329. From: osy <osy@turing.llc>
  330. Date: Fri, 4 Mar 2022 19:20:06 -0800
  331. Subject: [PATCH 08/11] meson: fix build on Darwin
  332. ---
  333. meson.build | 4 +++-
  334. server/tests/meson.build | 6 +++++-
  335. tools/meson.build | 2 +-
  336. 3 files changed, 9 insertions(+), 3 deletions(-)
  337. diff --git a/meson.build b/meson.build
  338. index f8f89798..6d0a35a1 100644
  339. --- a/meson.build
  340. +++ b/meson.build
  341. @@ -102,7 +102,9 @@ foreach dep : ['libjpeg', 'zlib']
  342. spice_server_deps += dependency(dep)
  343. endforeach
  344. -if host_machine.system() != 'windows'
  345. +if host_machine.system() in ['darwin', 'ios']
  346. + # librt and libm not required
  347. +elif host_machine.system() != 'windows'
  348. foreach dep : ['librt', 'libm']
  349. spice_server_deps += compiler.find_library(dep)
  350. endforeach
  351. diff --git a/server/tests/meson.build b/server/tests/meson.build
  352. index 09ba0f22..7e1bbf73 100644
  353. --- a/server/tests/meson.build
  354. +++ b/server/tests/meson.build
  355. @@ -72,8 +72,12 @@ if host_machine.system() != 'windows'
  356. tests += [
  357. ['test-stream', true],
  358. ['test-stat-file', true],
  359. - ['test-websocket', false],
  360. ]
  361. + if host_machine.system() not in ['darwin', 'ios']
  362. + tests += [
  363. + ['test-websocket', false],
  364. + ]
  365. + endif
  366. endif
  367. if spice_server_has_gstreamer
  368. diff --git a/tools/meson.build b/tools/meson.build
  369. index 8ec2cc91..4962f63d 100644
  370. --- a/tools/meson.build
  371. +++ b/tools/meson.build
  372. @@ -1,4 +1,4 @@
  373. -if host_machine.system() != 'windows'
  374. +if host_machine.system() not in ['ios', 'windows']
  375. executable('reds_stat', 'reds_stat.c',
  376. install : false,
  377. include_directories : spice_server_include,
  378. --
  379. 2.28.0
  380. From a411fbcb321347356a78126e923bd49aa91381df Mon Sep 17 00:00:00 2001
  381. From: osy <osy@turing.llc>
  382. Date: Fri, 4 Mar 2022 19:23:44 -0800
  383. Subject: [PATCH 09/11] reds: always send monitors config
  384. When the Windows VDagent sees a new monitor config, it will trigger a
  385. refresh of the display resolution. This is needed when the device driver
  386. does not have the capability to see the resolution change directly from
  387. QEMU (for example VirtIO GPU) and depends on VDagent to see the change.
  388. ---
  389. server/reds.c | 2 +-
  390. 1 file changed, 1 insertion(+), 1 deletion(-)
  391. diff --git a/server/reds.c b/server/reds.c
  392. index d91b32b0..9513b5cf 100644
  393. --- a/server/reds.c
  394. +++ b/server/reds.c
  395. @@ -1256,7 +1256,7 @@ void reds_on_main_agent_data(RedsState *reds, MainChannelClient *mcc, const void
  396. return;
  397. case AGENT_MSG_FILTER_MONITORS_CONFIG:
  398. reds_on_main_agent_monitors_config(reds, mcc, message, size);
  399. - return;
  400. + break;
  401. case AGENT_MSG_FILTER_PROTO_ERROR:
  402. red_channel_client_shutdown(RED_CHANNEL_CLIENT(mcc));
  403. return;
  404. --
  405. 2.28.0
  406. From e32a7ea61569b7771f0ef655fba86f6d23d53d31 Mon Sep 17 00:00:00 2001
  407. From: osy <osy@turing.llc>
  408. Date: Fri, 4 Mar 2022 20:09:34 -0800
  409. Subject: [PATCH 10/11] gstreamer-encoder: work without Orc
  410. If Orc is missing, GStreamer will still work.
  411. ---
  412. meson.build | 6 +++++-
  413. server/gstreamer-encoder.c | 11 +++++++++++
  414. 2 files changed, 16 insertions(+), 1 deletion(-)
  415. diff --git a/meson.build b/meson.build
  416. index 6d0a35a1..f8ad4f07 100644
  417. --- a/meson.build
  418. +++ b/meson.build
  419. @@ -134,7 +134,11 @@ if spice_server_gst_version != 'no'
  420. dep = '@0@-@1@'.format(dep, spice_server_gst_version)
  421. spice_server_deps += dependency(dep)
  422. endforeach
  423. - spice_server_deps += dependency('orc-0.4')
  424. + orc_dep = dependency('orc-0.4', required : false)
  425. + if orc_dep.found()
  426. + spice_server_deps += orc_dep
  427. + spice_server_config_data.set('HAVE_GST_ORC', '1')
  428. + endif
  429. gst_def = 'HAVE_GSTREAMER'
  430. if spice_server_gst_version == '1.0'
  431. diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c
  432. index 3ca04d7a..238463f2 100644
  433. --- a/server/gstreamer-encoder.c
  434. +++ b/server/gstreamer-encoder.c
  435. @@ -25,7 +25,9 @@
  436. #include <gst/app/gstappsrc.h>
  437. #include <gst/app/gstappsink.h>
  438. #include <gst/video/video.h>
  439. +#ifdef HAVE_GST_ORC
  440. #include <orc/orcprogram.h>
  441. +#endif
  442. #include "red-common.h"
  443. #include "video-encoder.h"
  444. @@ -1705,6 +1707,7 @@ static void spice_gst_encoder_get_stats(VideoEncoder *video_encoder,
  445. }
  446. }
  447. +#ifdef HAVE_GST_ORC
  448. /* Check if ORC library can work.
  449. * ORC library is used quite extensively by GStreamer
  450. * to generate code dynamically. If ORC cannot work, GStreamer
  451. @@ -1728,6 +1731,14 @@ static bool orc_check(void)
  452. }
  453. return orc_dynamic_code_ok;
  454. }
  455. +#else // HAVE_GST_ORC
  456. +/* If we don't have Orc, GStreamer will still work
  457. + */
  458. +static bool orc_check(void)
  459. +{
  460. + return true;
  461. +}
  462. +#endif
  463. VideoEncoder *gstreamer_encoder_new(SpiceVideoCodecType codec_type,
  464. uint64_t starting_bit_rate,
  465. --
  466. 2.28.0
  467. From 02cae4922d55c488cce790835ee2fccd61e34dbd Mon Sep 17 00:00:00 2001
  468. From: osy <osy@turing.llc>
  469. Date: Sun, 18 Dec 2022 23:20:48 -0800
  470. Subject: [PATCH 11/11] red-qxl: remove cookie assertion on scanout
  471. The original check ensures we do not have an outstanding GL_DRAW. However,
  472. in QEMU, there is no guarantee that a scanout cannot happen while the async
  473. GL_DRAW has not returned a result yet. This introduces a race where if a
  474. scanout is called while there is an outstanding GL_DRAW, QEMU will crash.
  475. The removal of this check enforces a new contract with the SPICE client.
  476. Every GL_DRAW must be matched with a GL_DONE (i.e. with a call to
  477. `spice_display_channel_gl_draw_done()` in the client) even if the render
  478. context is no longer valid. Otherwise, the assertion crash will happen in
  479. the next call to `spice_qxl_gl_draw_async()`.
  480. ---
  481. server/red-qxl.c | 1 -
  482. 1 file changed, 1 deletion(-)
  483. diff --git a/server/red-qxl.c b/server/red-qxl.c
  484. index dbfcd440..8cdf86f5 100644
  485. --- a/server/red-qxl.c
  486. +++ b/server/red-qxl.c
  487. @@ -703,7 +703,6 @@ void spice_qxl_gl_scanout(QXLInstance *qxl,
  488. spice_return_if_fail(qxl != NULL);
  489. QXLState *qxl_state = qxl->st;
  490. - spice_return_if_fail(qxl_state->gl_draw_cookie == GL_DRAW_COOKIE_INVALID);
  491. pthread_mutex_lock(&qxl_state->scanout_mutex);
  492. --
  493. 2.28.0
  494. --- a/subprojects/spice-common/meson.build 2022-03-04 19:26:32.000000000 -0800
  495. +++ b/subprojects/spice-common/meson.build 2022-03-04 19:26:03.000000000 -0800
  496. @@ -14,7 +14,9 @@
  497. '-Wall',
  498. '-Wextra',
  499. '-Werror',
  500. - '-Wno-unused-parameter']
  501. + '-Wno-unused-parameter',
  502. + '-Wno-unused-function',
  503. + '-Wno-deprecated-declarations']
  504. if get_option('alignment-checks')
  505. spice_common_global_cflags += ['-DSPICE_DEBUG_ALIGNMENT']
  506. @@ -137,7 +139,7 @@
  507. if get_option('python-checks')
  508. foreach module : ['six', 'pyparsing']
  509. message('Checking for python module @0@'.format(module))
  510. - cmd = run_command(python, '-m', module)
  511. + cmd = run_command(python, '-c', 'import @0@'.format(module))
  512. if cmd.returncode() != 0
  513. error('Python module @0@ not found'.format(module))
  514. endif
  515. From 8bb90e55aa5cb80c7a8366c3faa0bba508b1e89f Mon Sep 17 00:00:00 2001
  516. From: Frediano Ziglio <freddy77@gmail.com>
  517. Date: Thu, 20 Aug 2020 11:31:36 +0100
  518. Subject: [PATCH] inputs-channel: Support more mouse buttons
  519. Extend mouse button bits support.
  520. Allows to support up to 16 buttons.
  521. Partly based on a patch from Kevin Pouget (RED_MOUSE_BUTTON_STATE_TO_AGENT
  522. macro, updated on new protocol constants).
  523. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  524. Acked-by: Kevin Pouget <kpouget@redhat.com>
  525. ---
  526. server/inputs-channel.c | 15 ++++++++-------
  527. 1 file changed, 8 insertions(+), 7 deletions(-)
  528. diff --git a/server/inputs-channel.c b/server/inputs-channel.c
  529. index f22421f30..80ea8a897 100644
  530. --- a/server/inputs-channel.c
  531. +++ b/server/inputs-channel.c
  532. @@ -117,15 +117,16 @@ const VDAgentMouseState *InputsChannel::get_mouse_state()
  533. return &mouse_state;
  534. }
  535. -#define RED_MOUSE_STATE_TO_LOCAL(state) \
  536. - ((state & SPICE_MOUSE_BUTTON_MASK_LEFT) | \
  537. - ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) << 1) | \
  538. +// middle and right states are inverted
  539. +// all buttons from SPICE_MOUSE_BUTTON_MASK_SIDE are mapped a bit higher
  540. +// to avoid conflicting with some internal Qemu bit
  541. +#define RED_MOUSE_STATE_TO_LOCAL(state) \
  542. + ((state & SPICE_MOUSE_BUTTON_MASK_LEFT) | \
  543. + ((state & (SPICE_MOUSE_BUTTON_MASK_MIDDLE|0xffe0)) << 1) | \
  544. ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) >> 1))
  545. -#define RED_MOUSE_BUTTON_STATE_TO_AGENT(state) \
  546. - (((state & SPICE_MOUSE_BUTTON_MASK_LEFT) ? VD_AGENT_LBUTTON_MASK : 0) | \
  547. - ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) ? VD_AGENT_MBUTTON_MASK : 0) | \
  548. - ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) ? VD_AGENT_RBUTTON_MASK : 0))
  549. +// mouse button constants are defined to be off-one between agent and SPICE protocol
  550. +#define RED_MOUSE_BUTTON_STATE_TO_AGENT(state) ((state) << 1)
  551. void InputsChannel::activate_modifiers_watch()
  552. {
  553. --
  554. GitLab