|
| 1 | ++++ ./src/vulkan/wsi/wsi_common_display.c |
| 2 | +@@ -176,6 +176,12 @@ |
| 3 | + |
| 4 | + static uint64_t fence_sequence; |
| 5 | + |
| 6 | ++#ifdef __ANDROID__ |
| 7 | ++static void thread_signal_handler (int signum) { |
| 8 | ++ pthread_exit (0); |
| 9 | ++} |
| 10 | ++#endif |
| 11 | ++ |
| 12 | + ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_mode, VkDisplayModeKHR) |
| 13 | + ICD_DEFINE_NONDISP_HANDLE_CASTS(wsi_display_connector, VkDisplayKHR) |
| 14 | + |
| 15 | +@@ -1341,7 +1347,9 @@ |
| 16 | + .events = POLLIN |
| 17 | + }; |
| 18 | + |
| 19 | ++#ifndef __ANDROID__ |
| 20 | + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); |
| 21 | ++#endif |
| 22 | + for (;;) { |
| 23 | + int ret = poll(&pollfd, 1, -1); |
| 24 | + if (ret > 0) { |
| 25 | +@@ -1369,9 +1377,22 @@ |
| 26 | + static void |
| 27 | + wsi_display_stop_wait_thread(struct wsi_display *wsi) |
| 28 | + { |
| 29 | ++#ifdef __ANDROID__ |
| 30 | ++ struct sigaction actions; |
| 31 | ++ memset (&actions, 0, sizeof (actions)); |
| 32 | ++ sigemptyset (&actions.sa_mask); |
| 33 | ++ actions.sa_flags = 0; |
| 34 | ++ actions.sa_handler = thread_signal_handler; |
| 35 | ++ sigaction (SIGUSR2, &actions, NULL); |
| 36 | ++#endif |
| 37 | ++ |
| 38 | + mtx_lock(&wsi->wait_mutex); |
| 39 | + if (wsi->wait_thread) { |
| 40 | ++#ifndef __ANDROID__ |
| 41 | + pthread_cancel(wsi->wait_thread); |
| 42 | ++#else |
| 43 | ++ pthread_kill(wsi->wait_thread, SIGUSR2); |
| 44 | ++#endif |
| 45 | + pthread_join(wsi->wait_thread, NULL); |
| 46 | + wsi->wait_thread = 0; |
| 47 | + } |
| 48 | +@@ -2215,7 +2236,9 @@ |
| 49 | + |
| 50 | + int udev_fd = udev_monitor_get_fd(mon); |
| 51 | + |
| 52 | ++#ifndef __ANDROID__ |
| 53 | + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); |
| 54 | ++#endif |
| 55 | + |
| 56 | + for (;;) { |
| 57 | + nfds_t nfds = 1; |
| 58 | +@@ -2340,6 +2363,15 @@ |
| 59 | + struct wsi_display *wsi = |
| 60 | + (struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY]; |
| 61 | + |
| 62 | ++#ifdef __ANDROID__ |
| 63 | ++ struct sigaction actions; |
| 64 | ++ memset (&actions, 0, sizeof (actions)); |
| 65 | ++ sigemptyset (&actions.sa_mask); |
| 66 | ++ actions.sa_flags = 0; |
| 67 | ++ actions.sa_handler = thread_signal_handler; |
| 68 | ++ sigaction (SIGUSR2, &actions, NULL); |
| 69 | ++#endif |
| 70 | ++ |
| 71 | + if (wsi) { |
| 72 | + wsi_for_each_connector(connector, wsi) { |
| 73 | + wsi_for_each_display_mode(mode, connector) { |
| 74 | +@@ -2351,7 +2383,11 @@ |
| 75 | + wsi_display_stop_wait_thread(wsi); |
| 76 | + |
| 77 | + if (wsi->hotplug_thread) { |
| 78 | ++#ifndef __ANDROID__ |
| 79 | + pthread_cancel(wsi->hotplug_thread); |
| 80 | ++#else |
| 81 | ++ pthread_kill(wsi->hotplug_thread, SIGUSR2); |
| 82 | ++#endif |
| 83 | + pthread_join(wsi->hotplug_thread, NULL); |
| 84 | + } |
| 85 | + |
0 commit comments