summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-09-03 08:36:24 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-09-03 08:36:24 +0000
commit4112c90a93f98c236a2689f9dd99d55a6b51b65f (patch)
treeb703eed7198f02becf3ae4b74ae833a8de63bfb5 /lib
parentb0915d54037185ab191fbbbd1973f7de15b1be68 (diff)
correct merge errors
Diffstat (limited to 'lib')
-rw-r--r--lib/mesa/src/util/os_misc.c2
-rw-r--r--lib/mesa/src/util/u_thread.h2
-rw-r--r--lib/mesa/src/vulkan/wsi/wsi_common_x11.c23
3 files changed, 19 insertions, 8 deletions
diff --git a/lib/mesa/src/util/os_misc.c b/lib/mesa/src/util/os_misc.c
index 9b13dcdb9..e184edc89 100644
--- a/lib/mesa/src/util/os_misc.c
+++ b/lib/mesa/src/util/os_misc.c
@@ -194,7 +194,7 @@ bool
os_get_available_system_memory(uint64_t *size)
{
#if DETECT_OS_LINUX
- char *meminfo = os_read_file("/proc/meminfo");
+ char *meminfo = os_read_file("/proc/meminfo", NULL);
if (!meminfo)
return false;
diff --git a/lib/mesa/src/util/u_thread.h b/lib/mesa/src/util/u_thread.h
index 83c8e569d..af44bcfc1 100644
--- a/lib/mesa/src/util/u_thread.h
+++ b/lib/mesa/src/util/u_thread.h
@@ -35,7 +35,7 @@
#ifdef HAVE_PTHREAD
#include <signal.h>
-#if defined(PTHREAD_SETAFFINITY_IN_NP_HEADER) || defined(__OpenBSD__)
+#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#endif
diff --git a/lib/mesa/src/vulkan/wsi/wsi_common_x11.c b/lib/mesa/src/vulkan/wsi/wsi_common_x11.c
index 00f919277..4cc03640e 100644
--- a/lib/mesa/src/vulkan/wsi/wsi_common_x11.c
+++ b/lib/mesa/src/vulkan/wsi/wsi_common_x11.c
@@ -772,6 +772,7 @@ struct x11_swapchain {
uint64_t send_sbc;
uint64_t last_present_msc;
uint32_t stamp;
+ int sent_image_count;
bool has_present_queue;
bool has_acquire_queue;
@@ -854,6 +855,8 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
for (unsigned i = 0; i < chain->base.image_count; i++) {
if (chain->images[i].pixmap == idle->pixmap) {
chain->images[i].busy = false;
+ chain->sent_image_count--;
+ assert(chain->sent_image_count >= 0);
if (chain->has_acquire_queue)
wsi_queue_push(&chain->acquire_queue, i);
break;
@@ -1034,7 +1037,11 @@ x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index,
xshmfence_reset(image->shm_fence);
+ ++chain->sent_image_count;
+ assert(chain->sent_image_count <= chain->base.image_count);
+
++chain->send_sbc;
+
xcb_void_cookie_t cookie =
xcb_present_pixmap(chain->conn,
chain->window,
@@ -1105,11 +1112,9 @@ x11_manage_fifo_queues(void *state)
assert(chain->has_present_queue);
while (chain->status >= 0) {
- /* It should be safe to unconditionally block here. Later in the loop
- * we blocks until the previous present has landed on-screen. At that
- * point, we should have received IDLE_NOTIFY on all images presented
- * before that point so the client should be able to acquire any image
- * other than the currently presented one.
+ /* We can block here unconditionally because after an image was sent to
+ * the server (later on in this loop) we ensure at least one image is
+ * acquirable by the consumer or wait there on such an event.
*/
uint32_t image_index = 0;
result = wsi_queue_pull(&chain->present_queue, &image_index, INT64_MAX);
@@ -1142,7 +1147,12 @@ x11_manage_fifo_queues(void *state)
goto fail;
if (chain->has_acquire_queue) {
- while (chain->last_present_msc < target_msc) {
+ /* Wait for our presentation to occur and ensure we have at least one
+ * image that can be acquired by the client afterwards. This ensures we
+ * can pull on the present-queue on the next loop.
+ */
+ while (chain->last_present_msc < target_msc ||
+ chain->sent_image_count == chain->base.image_count) {
xcb_generic_event_t *event =
xcb_wait_for_special_event(chain->conn, chain->special_event);
if (!event) {
@@ -1485,6 +1495,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->depth = bit_depth;
chain->extent = pCreateInfo->imageExtent;
chain->send_sbc = 0;
+ chain->sent_image_count = 0;
chain->last_present_msc = 0;
chain->has_acquire_queue = false;
chain->has_present_queue = false;