-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
wsi-termux-x11.patch
143 lines (126 loc) · 5.43 KB
/
wsi-termux-x11.patch
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 97c26d6b08a..13b299b7fd8 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -1466,7 +1466,7 @@ wsi_common_queue_present(const struct wsi_device *wsi,
assert(!has_signal_dma_buf);
#endif
- if (wsi->sw)
+ if (wsi->sw || swapchain->present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR)
wsi->WaitForFences(device, 1, &swapchain->fences[image_index],
true, ~0ull);
diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
index d82f9d5f1e1..38831de5ea5 100644
--- a/src/vulkan/wsi/wsi_common_drm.c
+++ b/src/vulkan/wsi/wsi_common_drm.c
@@ -43,6 +43,9 @@
static VkResult
wsi_dma_buf_export_sync_file(int dma_buf_fd, int *sync_file_fd)
{
+#if defined (__ANDROID__) && defined (__TERMUX__)
+ return VK_ERROR_FEATURE_NOT_PRESENT;
+#else
/* Don't keep trying an IOCTL that doesn't exist. */
static bool no_dma_buf_sync_file = false;
if (no_dma_buf_sync_file)
@@ -66,11 +69,15 @@ wsi_dma_buf_export_sync_file(int dma_buf_fd, int *sync_file_fd)
*sync_file_fd = export.fd;
return VK_SUCCESS;
+#endif
}
static VkResult
wsi_dma_buf_import_sync_file(int dma_buf_fd, int sync_file_fd)
{
+#if defined (__ANDROID__) && defined (__TERMUX__)
+ return VK_ERROR_FEATURE_NOT_PRESENT;
+#else
/* Don't keep trying an IOCTL that doesn't exist. */
static bool no_dma_buf_sync_file = false;
if (no_dma_buf_sync_file)
@@ -92,6 +99,7 @@ wsi_dma_buf_import_sync_file(int dma_buf_fd, int sync_file_fd)
}
return VK_SUCCESS;
+#endif
}
static VkResult
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index f6d711297e3..36b4ec1f14b 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -439,7 +439,7 @@ wsi_x11_get_connection(struct wsi_device *wsi_dev,
static const VkFormat formats[] = {
VK_FORMAT_R5G6B5_UNORM_PACK16,
- VK_FORMAT_B8G8R8A8_SRGB,
+ // VK_FORMAT_B8G8R8A8_SRGB,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_A2R10G10B10_UNORM_PACK32,
};
@@ -1417,7 +1417,6 @@ x11_acquire_next_image_poll_find_index(struct x11_swapchain *chain, uint32_t *im
for (uint32_t i = 0; i < chain->base.image_count; i++) {
if (!chain->images[i].busy) {
/* We found a non-busy image */
- xshmfence_await(chain->images[i].shm_fence);
*image_index = i;
chain->images[i].busy = true;
chain->present_poll_acquire_count++;
@@ -1573,7 +1572,6 @@ x11_acquire_next_image_from_queue(struct x11_swapchain *chain,
}
assert(image_index < chain->base.image_count);
- xshmfence_await(chain->images[image_index].shm_fence);
*image_index_out = image_index;
@@ -1616,8 +1614,6 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index,
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
#endif
- xshmfence_reset(image->shm_fence);
-
++chain->sent_image_count;
assert(chain->sent_image_count <= chain->base.image_count);
@@ -2196,14 +2192,23 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
return VK_ERROR_OUT_OF_HOST_MEMORY;
cookie =
- xcb_dri3_pixmap_from_buffer_checked(chain->conn,
- image->pixmap,
- chain->window,
- image->base.sizes[0],
- pCreateInfo->imageExtent.width,
- pCreateInfo->imageExtent.height,
- image->base.row_pitches[0],
- chain->depth, bpp, fd);
+ xcb_dri3_pixmap_from_buffers_checked(chain->conn,
+ image->pixmap,
+ chain->window,
+ image->base.num_planes,
+ pCreateInfo->imageExtent.width,
+ pCreateInfo->imageExtent.height,
+ image->base.row_pitches[0],
+ image->base.offsets[0],
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ chain->depth, bpp,
+ 1274,
+ &fd);
}
error = xcb_request_check(chain->conn, cookie);
@@ -2212,6 +2217,10 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
goto fail_image;
}
+ image->sync_fence = 0;
+ image->busy = false;
+ return VK_SUCCESS;
+
out_fence:
fence_fd = xshmfence_alloc_shm();
if (fence_fd < 0)
@@ -2254,10 +2263,6 @@ x11_image_finish(struct x11_swapchain *chain,
xcb_void_cookie_t cookie;
if (!chain->base.wsi->sw || chain->has_mit_shm) {
- cookie = xcb_sync_destroy_fence(chain->conn, image->sync_fence);
- xcb_discard_reply(chain->conn, cookie.sequence);
- xshmfence_unmap_shm(image->shm_fence);
-
cookie = xcb_free_pixmap(chain->conn, image->pixmap);
xcb_discard_reply(chain->conn, cookie.sequence);