Mesa (staging/20.1): vulkan/wsi/x11: add sent image counter
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Sep 1 18:41:21 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: 1792fb1d38585b1027807de9948b4a8f354a335b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1792fb1d38585b1027807de9948b4a8f354a335b
Author: Roman Gilg <subdiff at gmail.com>
Date: Mon Aug 31 11:33:27 2020 +0200
vulkan/wsi/x11: add sent image counter
Add a counter to count how many images from our swapchain are currently "sent"
to the X server via Present extension. An image is sent when it has been
presented but we have not yet received an idle event for it.
CC: mesa-stable
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Reviewed-by: Simon Ser <contact at emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6513>
(cherry picked from commit d0bc1ad3776bce7d4b356e2a3d8bdbb9ae64e588)
---
.pick_status.json | 2 +-
src/vulkan/wsi/wsi_common_x11.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index aa15c7eef6c..57a91f02bc5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -283,7 +283,7 @@
"description": "vulkan/wsi/x11: add sent image counter",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 00f9192777b..da02569e94b 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/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,
@@ -1485,6 +1492,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;
More information about the mesa-commit
mailing list