-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
114 additions
and
296 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
From d52610e1e61857709035d7f90330bcec7d27a034 Mon Sep 17 00:00:00 2001 | ||
From 34e1eb1878c1efa9da4a756acf46c646b10c0199 Mon Sep 17 00:00:00 2001 | ||
From: Derek Foreman <[email protected]> | ||
Date: Wed, 20 Sep 2023 10:40:33 -0500 | ||
Subject: [PATCH 2/6] vulkan/wsi/wayland: refactor wayland dispatch code | ||
Subject: [PATCH 1/5] vulkan/wsi/wayland: refactor wayland dispatch code | ||
|
||
We currently have two similar but different bits of code to dispatch | ||
wayland event queues. Pull out as much common code as possible. | ||
|
||
Signed-off-by: Derek Foreman <[email protected]> | ||
--- | ||
src/vulkan/wsi/wsi_common_wayland.c | 401 +++++++++++++++------------- | ||
1 file changed, 208 insertions(+), 193 deletions(-) | ||
src/vulkan/wsi/wsi_common_wayland.c | 405 ++++++++++++++-------------- | ||
1 file changed, 210 insertions(+), 195 deletions(-) | ||
|
||
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c | ||
index 5fd9aaf24ae..72281968de3 100644 | ||
index a11cbd21adb..e80ac56cfe8 100644 | ||
--- a/src/vulkan/wsi/wsi_common_wayland.c | ||
+++ b/src/vulkan/wsi/wsi_common_wayland.c | ||
@@ -96,6 +96,11 @@ struct wsi_wl_display { | ||
|
@@ -212,7 +212,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
wsi_wl_display_finish(display); | ||
return result; | ||
} | ||
@@ -1675,19 +1816,15 @@ wsi_wl_swapchain_wait_for_present(struct wsi_swapchain *wsi_chain, | ||
@@ -1672,19 +1813,15 @@ wsi_wl_swapchain_wait_for_present(struct wsi_swapchain *wsi_chain, | ||
uint64_t timeout) | ||
{ | ||
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; | ||
|
@@ -239,7 +239,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
|
||
/* Need to observe that the swapchain semaphore has been unsignalled, | ||
* as this is guaranteed when a present is complete. */ | ||
@@ -1703,141 +1840,45 @@ wsi_wl_swapchain_wait_for_present(struct wsi_swapchain *wsi_chain, | ||
@@ -1700,141 +1837,45 @@ wsi_wl_swapchain_wait_for_present(struct wsi_swapchain *wsi_chain, | ||
return VK_SUCCESS; | ||
} | ||
|
||
|
@@ -406,7 +406,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
} | ||
|
||
static VkResult | ||
@@ -1847,19 +1888,18 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, | ||
@@ -1844,19 +1885,18 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, | ||
{ | ||
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; | ||
struct wsi_wl_surface *wsi_wl_surface = chain->wsi_wl_surface; | ||
|
@@ -435,7 +435,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
if (ret < 0) | ||
return VK_ERROR_OUT_OF_DATE_KHR; | ||
|
||
@@ -1873,46 +1913,26 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, | ||
@@ -1870,46 +1910,26 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, | ||
} | ||
} | ||
|
||
|
@@ -498,7 +498,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
} | ||
} | ||
|
||
@@ -1933,9 +1953,10 @@ presentation_handle_presented(void *data, | ||
@@ -1930,9 +1950,10 @@ presentation_handle_presented(void *data, | ||
{ | ||
struct wsi_wl_present_id *id = data; | ||
|
||
|
@@ -510,7 +510,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
|
||
wp_presentation_feedback_destroy(feedback); | ||
wl_list_remove(&id->link); | ||
@@ -1948,9 +1969,10 @@ presentation_handle_discarded(void *data, | ||
@@ -1945,9 +1966,10 @@ presentation_handle_discarded(void *data, | ||
{ | ||
struct wsi_wl_present_id *id = data; | ||
|
||
|
@@ -522,7 +522,7 @@ index 5fd9aaf24ae..72281968de3 100644 | |
|
||
wp_presentation_feedback_destroy(feedback); | ||
wl_list_remove(&id->link); | ||
@@ -2198,8 +2220,6 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
@@ -2195,8 +2217,6 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
chain->wsi_wl_surface->chain = NULL; | ||
|
||
if (chain->present_ids.wp_presentation) { | ||
|
@@ -531,14 +531,21 @@ index 5fd9aaf24ae..72281968de3 100644 | |
/* In VK_EXT_swapchain_maintenance1 there is no requirement to wait for all present IDs to be complete. | ||
* Waiting for the swapchain fence is enough. | ||
* Just clean up anything user did not wait for. */ | ||
@@ -2211,7 +2231,6 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
@@ -2208,12 +2228,11 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
} | ||
|
||
wl_proxy_wrapper_destroy(chain->present_ids.wp_presentation); | ||
- pthread_cond_destroy(&chain->present_ids.list_advanced); | ||
pthread_mutex_destroy(&chain->present_ids.lock); | ||
} | ||
|
||
- if (chain->present_ids.queue) | ||
- wl_event_queue_destroy(chain->present_ids.queue); | ||
+ if (chain->queue) | ||
+ wl_event_queue_destroy(chain->queue); | ||
|
||
vk_free(pAllocator, (void *)chain->drm_modifiers); | ||
|
||
@@ -2386,20 +2405,16 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, | ||
chain->drm_modifiers = drm_modifiers_copy; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 588b426986a990b939da1b1e7656b3083e3a965f Mon Sep 17 00:00:00 2001 | ||
From d65354a4b06d573b34a5485b9207d3492c48ff27 Mon Sep 17 00:00:00 2001 | ||
From: Derek Foreman <[email protected]> | ||
Date: Fri, 10 Nov 2023 07:25:35 -0600 | ||
Subject: [PATCH 3/6] vulkan/wsi/wayland: Use commit_timing/commit_queue | ||
Subject: [PATCH 2/5] vulkan/wsi/wayland: Use commit_timing/commit_queue | ||
protocol for FIFO | ||
|
||
The commit_timing protocol allows us to set a presentation timestamp, | ||
|
@@ -32,7 +32,7 @@ index ac822acec67..8b6044f09e5 100644 | |
'presentation-time': 'stable/presentation-time/presentation-time.xml', | ||
'tearing-control-v1': 'staging/tearing-control/tearing-control-v1.xml', | ||
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build | ||
index 9d0db011767..83ad71f06fa 100644 | ||
index c8206eac996..48ea09b99aa 100644 | ||
--- a/src/vulkan/wsi/meson.build | ||
+++ b/src/vulkan/wsi/meson.build | ||
@@ -31,6 +31,8 @@ endif | ||
|
@@ -45,7 +45,7 @@ index 9d0db011767..83ad71f06fa 100644 | |
files_vulkan_wsi += wp_files['presentation-time'] | ||
files_vulkan_wsi += wp_files['tearing-control-v1'] | ||
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c | ||
index 72281968de3..200b15aa37a 100644 | ||
index e80ac56cfe8..28f8f3b5e8f 100644 | ||
--- a/src/vulkan/wsi/wsi_common_wayland.c | ||
+++ b/src/vulkan/wsi/wsi_common_wayland.c | ||
@@ -41,6 +41,8 @@ | ||
|
@@ -128,7 +128,7 @@ index 72281968de3..200b15aa37a 100644 | |
if (display->tearing_control_manager) | ||
wp_tearing_control_manager_v1_destroy(display->tearing_control_manager); | ||
if (display->wl_display_wrapper) | ||
@@ -1922,6 +1945,16 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, | ||
@@ -1919,6 +1942,16 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain, | ||
else | ||
time_left = end_time - now; | ||
|
||
|
@@ -145,7 +145,7 @@ index 72281968de3..200b15aa37a 100644 | |
ret = wsi_wl_display_dispatch_queue_with_timeout(wsi_wl_surface->display, | ||
wsi_wl_surface->display->queue, | ||
time_left); | ||
@@ -1952,10 +1985,16 @@ presentation_handle_presented(void *data, | ||
@@ -1949,10 +1982,16 @@ presentation_handle_presented(void *data, | ||
uint32_t flags) | ||
{ | ||
struct wsi_wl_present_id *id = data; | ||
|
@@ -162,7 +162,7 @@ index 72281968de3..200b15aa37a 100644 | |
pthread_mutex_unlock(&id->chain->present_ids.lock); | ||
|
||
wp_presentation_feedback_destroy(feedback); | ||
@@ -1991,8 +2030,10 @@ frame_handle_done(void *data, struct wl_callback *callback, uint32_t serial) | ||
@@ -1988,8 +2027,10 @@ frame_handle_done(void *data, struct wl_callback *callback, uint32_t serial) | ||
{ | ||
struct wsi_wl_swapchain *chain = data; | ||
|
||
|
@@ -174,7 +174,7 @@ index 72281968de3..200b15aa37a 100644 | |
|
||
wl_callback_destroy(callback); | ||
} | ||
@@ -2001,6 +2042,46 @@ static const struct wl_callback_listener frame_listener = { | ||
@@ -1998,6 +2039,46 @@ static const struct wl_callback_listener frame_listener = { | ||
frame_handle_done, | ||
}; | ||
|
||
|
@@ -221,15 +221,15 @@ index 72281968de3..200b15aa37a 100644 | |
static VkResult | ||
wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
uint32_t image_index, | ||
@@ -2009,6 +2090,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
@@ -2006,6 +2087,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
{ | ||
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; | ||
struct wsi_wl_surface *wsi_wl_surface = chain->wsi_wl_surface; | ||
+ bool mode_fifo = chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR; | ||
|
||
if (chain->buffer_type == WSI_WL_BUFFER_SHM_MEMCPY) { | ||
struct wsi_wl_image *image = &chain->images[image_index]; | ||
@@ -2018,7 +2100,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
@@ -2015,7 +2097,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
|
||
/* For EXT_swapchain_maintenance1. We might have transitioned from FIFO to MAILBOX. | ||
* In this case we need to let the FIFO request complete, before presenting MAILBOX. */ | ||
|
@@ -238,7 +238,7 @@ index 72281968de3..200b15aa37a 100644 | |
int ret = wl_display_dispatch_queue(wsi_wl_surface->display->wl_display, | ||
wsi_wl_surface->display->queue); | ||
if (ret < 0) | ||
@@ -2041,16 +2123,19 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
@@ -2038,16 +2120,19 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
wl_surface_damage(wsi_wl_surface->surface, 0, 0, INT32_MAX, INT32_MAX); | ||
} | ||
|
||
|
@@ -266,7 +266,7 @@ index 72281968de3..200b15aa37a 100644 | |
struct wsi_wl_present_id *id = | ||
vk_zalloc(chain->wsi_wl_surface->display->wsi_wl->alloc, sizeof(*id), sizeof(uintptr_t), | ||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); | ||
@@ -2069,6 +2154,10 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
@@ -2066,6 +2151,10 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
} | ||
|
||
chain->images[image_index].busy = true; | ||
|
@@ -277,7 +277,7 @@ index 72281968de3..200b15aa37a 100644 | |
wl_surface_commit(wsi_wl_surface->surface); | ||
wl_display_flush(wsi_wl_surface->display->wl_display); | ||
|
||
@@ -2184,6 +2273,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain, | ||
@@ -2181,6 +2270,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain, | ||
goto fail_image; | ||
|
||
wl_buffer_add_listener(image->buffer, &buffer_listener, image); | ||
|
@@ -286,8 +286,8 @@ index 72281968de3..200b15aa37a 100644 | |
return VK_SUCCESS; | ||
|
||
@@ -2234,8 +2324,13 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
pthread_mutex_destroy(&chain->present_ids.lock); | ||
} | ||
if (chain->queue) | ||
wl_event_queue_destroy(chain->queue); | ||
|
||
- vk_free(pAllocator, (void *)chain->drm_modifiers); | ||
+ if (chain->commit_queue) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
From 90ee07bcb8a162098a37d32825489b2033aae2e4 Mon Sep 17 00:00:00 2001 | ||
From c1b8ebce704dde66c6ad78e0301afcb7ec1bb379 Mon Sep 17 00:00:00 2001 | ||
From: Simon Ser <[email protected]> | ||
Date: Sat, 25 Nov 2023 16:25:58 +0100 | ||
Subject: [PATCH 4/6] hack: rip out commit-timing-v1 | ||
Subject: [PATCH 3/5] hack: rip out commit-timing-v1 | ||
|
||
--- | ||
src/egl/wayland/wayland-drm/meson.build | 2 +- | ||
src/vulkan/wsi/meson.build | 2 +- | ||
src/vulkan/wsi/wsi_common_wayland.c | 24 ++---------------------- | ||
3 files changed, 4 insertions(+), 24 deletions(-) | ||
src/vulkan/wsi/wsi_common_wayland.c | 23 ++--------------------- | ||
3 files changed, 4 insertions(+), 23 deletions(-) | ||
|
||
diff --git a/src/egl/wayland/wayland-drm/meson.build b/src/egl/wayland/wayland-drm/meson.build | ||
index 8b6044f09e5..83a63385274 100644 | ||
|
@@ -23,7 +23,7 @@ index 8b6044f09e5..83a63385274 100644 | |
'presentation-time': 'stable/presentation-time/presentation-time.xml', | ||
'tearing-control-v1': 'staging/tearing-control/tearing-control-v1.xml', | ||
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build | ||
index 83ad71f06fa..dba95387975 100644 | ||
index 48ea09b99aa..5caea0e8f4f 100644 | ||
--- a/src/vulkan/wsi/meson.build | ||
+++ b/src/vulkan/wsi/meson.build | ||
@@ -32,7 +32,7 @@ endif | ||
|
@@ -36,7 +36,7 @@ index 83ad71f06fa..dba95387975 100644 | |
files_vulkan_wsi += wp_files['presentation-time'] | ||
files_vulkan_wsi += wp_files['tearing-control-v1'] | ||
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c | ||
index 200b15aa37a..89bf4c1f062 100644 | ||
index 28f8f3b5e8f..e06f71e3e83 100644 | ||
--- a/src/vulkan/wsi/wsi_common_wayland.c | ||
+++ b/src/vulkan/wsi/wsi_common_wayland.c | ||
@@ -42,7 +42,6 @@ | ||
|
@@ -82,7 +82,7 @@ index 200b15aa37a..89bf4c1f062 100644 | |
if (display->tearing_control_manager) | ||
wp_tearing_control_manager_v1_destroy(display->tearing_control_manager); | ||
if (display->wl_display_wrapper) | ||
@@ -2073,9 +2065,6 @@ set_timestamp(struct wsi_wl_swapchain *chain) | ||
@@ -2070,9 +2062,6 @@ set_timestamp(struct wsi_wl_swapchain *chain) | ||
} | ||
|
||
timespec_from_nsec(&target_ts, target); | ||
|
@@ -92,25 +92,24 @@ index 200b15aa37a..89bf4c1f062 100644 | |
|
||
wp_commit_queue_v1_set_queue_mode(chain->commit_queue, | ||
WP_COMMIT_QUEUE_V1_QUEUE_MODE_FIFO); | ||
@@ -2091,6 +2080,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
@@ -2088,6 +2077,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, | ||
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; | ||
struct wsi_wl_surface *wsi_wl_surface = chain->wsi_wl_surface; | ||
bool mode_fifo = chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR; | ||
+ //fprintf(stderr, "FIFO = %d\n", mode_fifo); | ||
|
||
if (chain->buffer_type == WSI_WL_BUFFER_SHM_MEMCPY) { | ||
struct wsi_wl_image *image = &chain->images[image_index]; | ||
@@ -2327,9 +2317,6 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
@@ -2327,8 +2317,6 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, | ||
if (chain->commit_queue) | ||
wp_commit_queue_v1_destroy(chain->commit_queue); | ||
|
||
- if (chain->commit_timer) | ||
- wp_commit_timer_v1_destroy(chain->commit_timer); | ||
- | ||
vk_free(pAllocator, (void *)chain->drm_modifiers); | ||
wsi_swapchain_finish(&chain->base); | ||
} | ||
@@ -2391,10 +2378,6 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, | ||
@@ -2391,10 +2379,6 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, | ||
old_chain->commit_queue = NULL; | ||
old_chain->can_timestamp = false; | ||
} | ||
|
@@ -121,7 +120,7 @@ index 200b15aa37a..89bf4c1f062 100644 | |
} | ||
|
||
/* Take ownership of the wsi_wl_surface */ | ||
@@ -2523,12 +2506,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, | ||
@@ -2523,12 +2507,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, | ||
|
||
chain->legacy_fifo_ready = true; | ||
struct wsi_wl_display *dpy = chain->wsi_wl_surface->display; | ||
|
Oops, something went wrong.