Module: Mesa
Branch: staging/23.1
Commit: 08c4ca60176be77571b054198be9889e2622a22f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08c4ca60176be77571b054198be9889e2622a22f

Author: antonino <[email protected]>
Date:   Thu Aug 17 15:07:04 2023 +0200

vulkan: Extend vkGet/SetPrivateDataEXT handling to VkSurface

VkSurface is handled by WSI and it doesn't extend `vk_object_base` so it
needs special handling.

Fixes: 3c87618d357 ("vulkan: Handle vkGet/SetPrivateDataEXT on Android 
swapchains")
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24752>
(cherry picked from commit 5fe289d74158a93bdac0dad6cc410f6585f0ae3d)

---

 .pick_status.json              |  2 +-
 src/vulkan/runtime/vk_object.c | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 7529ab54446..d158bcb4194 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -580,7 +580,7 @@
         "description": "vulkan: Extend vkGet/SetPrivateDataEXT handling to 
VkSurface",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "3c87618d357a4f75a4f47b2638c8f89939fd6c61"
     },
diff --git a/src/vulkan/runtime/vk_object.c b/src/vulkan/runtime/vk_object.c
index 9180d2ce132..b46a0f77554 100644
--- a/src/vulkan/runtime/vk_object.c
+++ b/src/vulkan/runtime/vk_object.c
@@ -175,8 +175,8 @@ get_swapchain_private_data_locked(struct vk_device *device,
                                   uint64_t **private_data)
 {
    if (unlikely(device->swapchain_private == NULL)) {
-      /* Even though VkSwapchain is a non-dispatchable object, we know a
-       * priori that it is actually a pointer so we can use
+      /* Even though VkSwapchain/Surface are non-dispatchable objects, we know
+       * a priori that these are actually pointers so we can use
        * the pointer hash table for them.
        */
       device->swapchain_private = _mesa_pointer_hash_table_create(NULL);
@@ -222,7 +222,12 @@ vk_object_base_private_data(struct vk_device *device,
     * vkGet/SetPrivateDataEXT call on a swapchain because the loader will
     * handle it.
     */
-   if (objectType == VK_OBJECT_TYPE_SWAPCHAIN_KHR) {
+#ifdef ANDROID
+   if (objectType == VK_OBJECT_TYPE_SWAPCHAIN_KHR ||
+       objectType == VK_OBJECT_TYPE_SURFACE_KHR) {
+#else
+   if (objectType == VK_OBJECT_TYPE_SURFACE_KHR) {
+#endif
       mtx_lock(&device->swapchain_private_mtx);
       VkResult result = get_swapchain_private_data_locked(device, objectHandle,
                                                           slot, private_data);

Reply via email to