diff options
Diffstat (limited to 'recipes-graphics/vulkan')
10 files changed, 472 insertions, 9 deletions
diff --git a/recipes-graphics/vulkan/vulkan-loader-1.3.275.0.imx/0001-LF-11869-change-mali-wsi-layer-activating-order.patch b/recipes-graphics/vulkan/vulkan-loader-1.3.275.0.imx/0001-LF-11869-change-mali-wsi-layer-activating-order.patch new file mode 100644 index 000000000..da738aabe --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-loader-1.3.275.0.imx/0001-LF-11869-change-mali-wsi-layer-activating-order.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From 3448c245b15928aa5a5a3695d9271fb201eb2e3b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuan Tian <yuan.tian@nxp.com> | ||
| 3 | Date: Sat, 27 Apr 2024 06:06:54 +0800 | ||
| 4 | Subject: [PATCH] LF-11869 change mali wsi layer activating order | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 7 | |||
| 8 | Signed-off-by: Yuan Tian <yuan.tian@nxp.com> | ||
| 9 | --- | ||
| 10 | loader/loader.c | 12 ++++++++++++ | ||
| 11 | 1 file changed, 12 insertions(+) | ||
| 12 | |||
| 13 | diff --git a/loader/loader.c b/loader/loader.c | ||
| 14 | index e646b28b4..55912c178 100644 | ||
| 15 | --- a/loader/loader.c | ||
| 16 | +++ b/loader/loader.c | ||
| 17 | @@ -2906,6 +2906,7 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s | ||
| 18 | #if !defined(_WIN32) | ||
| 19 | char temp_path[2048]; | ||
| 20 | #endif | ||
| 21 | + bool has_wsi_layer = false; | ||
| 22 | |||
| 23 | // Now, parse the paths | ||
| 24 | next_file = search_path; | ||
| 25 | @@ -2965,6 +2966,10 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s | ||
| 26 | name = full_path; | ||
| 27 | |||
| 28 | VkResult local_res; | ||
| 29 | + if(!strcmp(name,"/etc/vulkan/implicit_layer.d/VkLayer_window_system_integration.json")) { | ||
| 30 | + has_wsi_layer = true; | ||
| 31 | + continue; | ||
| 32 | + } | ||
| 33 | local_res = add_if_manifest_file(inst, name, out_files); | ||
| 34 | |||
| 35 | // Incomplete means this was not a valid data file. | ||
| 36 | @@ -2975,6 +2980,13 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s | ||
| 37 | break; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | + | ||
| 41 | + if(has_wsi_layer) { | ||
| 42 | + name = "/etc/vulkan/implicit_layer.d/VkLayer_window_system_integration.json"; | ||
| 43 | + vk_result = add_if_manifest_file(inst, name, out_files); | ||
| 44 | + has_wsi_layer = false; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | loader_closedir(inst, dir_stream); | ||
| 48 | if (vk_result != VK_SUCCESS) { | ||
| 49 | goto out; | ||
| 50 | -- | ||
| 51 | 2.34.1 | ||
| 52 | |||
diff --git a/recipes-graphics/vulkan/vulkan-loader-1.4.328.1/0001-LF-11869-change-mali-wsi-layer-activating-order.patch b/recipes-graphics/vulkan/vulkan-loader-1.4.328.1/0001-LF-11869-change-mali-wsi-layer-activating-order.patch new file mode 100644 index 000000000..f54919cd9 --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-loader-1.4.328.1/0001-LF-11869-change-mali-wsi-layer-activating-order.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From 91aff12a127428ff558d57d93b91b0b909321c35 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuan Tian <yuan.tian@nxp.com> | ||
| 3 | Date: Sat, 27 Apr 2024 06:06:54 +0800 | ||
| 4 | Subject: [PATCH] LF-11869 change mali wsi layer activating order | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 7 | |||
| 8 | Signed-off-by: Yuan Tian <yuan.tian@nxp.com> | ||
| 9 | --- | ||
| 10 | loader/loader.c | 12 ++++++++++++ | ||
| 11 | 1 file changed, 12 insertions(+) | ||
| 12 | |||
| 13 | diff --git a/loader/loader.c b/loader/loader.c | ||
| 14 | index 9064cd633..5b00870a4 100644 | ||
| 15 | --- a/loader/loader.c | ||
| 16 | +++ b/loader/loader.c | ||
| 17 | @@ -3034,6 +3034,7 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s | ||
| 18 | #if !defined(_WIN32) | ||
| 19 | char temp_path[2048]; | ||
| 20 | #endif | ||
| 21 | + bool has_wsi_layer = false; | ||
| 22 | |||
| 23 | // Now, parse the paths | ||
| 24 | char *next_file = search_path; | ||
| 25 | @@ -3100,6 +3101,10 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s | ||
| 26 | name = full_path; | ||
| 27 | |||
| 28 | VkResult local_res; | ||
| 29 | + if(!strcmp(name,"/etc/vulkan/implicit_layer.d/VkLayer_window_system_integration.json")) { | ||
| 30 | + has_wsi_layer = true; | ||
| 31 | + continue; | ||
| 32 | + } | ||
| 33 | local_res = add_if_manifest_file(inst, name, out_files); | ||
| 34 | |||
| 35 | // Incomplete means this was not a valid data file. | ||
| 36 | @@ -3110,6 +3115,13 @@ VkResult add_data_files(const struct loader_instance *inst, char *search_path, s | ||
| 37 | break; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | + | ||
| 41 | + if(has_wsi_layer) { | ||
| 42 | + name = "/etc/vulkan/implicit_layer.d/VkLayer_window_system_integration.json"; | ||
| 43 | + vk_result = add_if_manifest_file(inst, name, out_files); | ||
| 44 | + has_wsi_layer = false; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | loader_closedir(inst, dir_stream); | ||
| 48 | if (vk_result != VK_SUCCESS) { | ||
| 49 | goto out; | ||
diff --git a/recipes-graphics/vulkan/vulkan-loader_%.bbappend b/recipes-graphics/vulkan/vulkan-loader_%.bbappend new file mode 100644 index 000000000..8f28ab1be --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-loader_%.bbappend | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | SRC_URI:append:imx-nxp-bsp = " \ | ||
| 2 | file://0001-LF-11869-change-mali-wsi-layer-activating-order.patch \ | ||
| 3 | " | ||
| 4 | |||
| 5 | PACKAGE_ARCH:imx-nxp-bsp = "${MACHINE_SOCARCH}" | ||
| 6 | |||
| 7 | # libvulkan.so is loaded dynamically, so put it in the main package | ||
| 8 | SOLIBS:imx-nxp-bsp = ".so*" | ||
| 9 | FILES_SOLIBSDEV:imx-nxp-bsp = "" | ||
| 10 | INSANE_SKIP:${PN}:imx-nxp-bsp += "dev-so" | ||
diff --git a/recipes-graphics/vulkan/vulkan-loader_1.3.261.1.imx.bbappend b/recipes-graphics/vulkan/vulkan-loader_1.3.261.1.imx.bbappend deleted file mode 100644 index c1a9902b7..000000000 --- a/recipes-graphics/vulkan/vulkan-loader_1.3.261.1.imx.bbappend +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | # libvulkan.so is loaded dynamically, so put it in the main package | ||
| 2 | SOLIBS = ".so*" | ||
| 3 | FILES_SOLIBSDEV = "" | ||
| 4 | INSANE_SKIP:${PN} += "dev-so" | ||
| 5 | |||
| 6 | # Override default mesa drivers with i.MX GPU drivers | ||
| 7 | RRECOMMENDS:${PN}:imxvulkan = "libvulkan-imx" | ||
| 8 | # Override default mesa drivers with i.MX GPU drivers | ||
| 9 | RRECOMMENDS:${PN}:mx95-nxp-bsp = "mali-imx-libvulkan" | ||
diff --git a/recipes-graphics/vulkan/vulkan-loader_1.3.275.0.imx.bbappend b/recipes-graphics/vulkan/vulkan-loader_1.3.275.0.imx.bbappend new file mode 100644 index 000000000..8cac41b53 --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-loader_1.3.275.0.imx.bbappend | |||
| @@ -0,0 +1 @@ | |||
| FILESEXTRAPATHS:prepend:imx-nxp-bsp := "${THISDIR}/vulkan-loader-1.3.275.0.imx:" | |||
diff --git a/recipes-graphics/vulkan/vulkan-loader_1.4.328.1.bbappend b/recipes-graphics/vulkan/vulkan-loader_1.4.328.1.bbappend new file mode 100644 index 000000000..93f780c9c --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-loader_1.4.328.1.bbappend | |||
| @@ -0,0 +1 @@ | |||
| FILESEXTRAPATHS:prepend:imx-nxp-bsp := "${THISDIR}/vulkan-loader-1.4.328.1:" | |||
diff --git a/recipes-graphics/vulkan/vulkan-wsi-layer/0001-MGS-6801-ccc-vkmark-on-wayland.patch b/recipes-graphics/vulkan/vulkan-wsi-layer/0001-MGS-6801-ccc-vkmark-on-wayland.patch new file mode 100644 index 000000000..48cfcd765 --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-wsi-layer/0001-MGS-6801-ccc-vkmark-on-wayland.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From ada74fb0ca3099f33d173eb664bd7e42025a3277 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> | ||
| 3 | Date: Mon, 9 Dec 2024 09:15:11 +0800 | ||
| 4 | Subject: [PATCH 1/2] MGS-6801 [#ccc] vkmark on wayland | ||
| 5 | |||
| 6 | Extend the wayland surface properties with VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [i.MX-specific] | ||
| 9 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> | ||
| 10 | Signed-off-by: Jiyu Yang <jiyu.yang@nxp.com> | ||
| 11 | --- | ||
| 12 | wsi/wayland/surface_properties.cpp | 2 +- | ||
| 13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/wsi/wayland/surface_properties.cpp b/wsi/wayland/surface_properties.cpp | ||
| 16 | index e6435b9..bc1a737 100644 | ||
| 17 | --- a/wsi/wayland/surface_properties.cpp | ||
| 18 | +++ b/wsi/wayland/surface_properties.cpp | ||
| 19 | @@ -89,7 +89,7 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_ | ||
| 20 | |||
| 21 | /* Composite alpha */ | ||
| 22 | pSurfaceCapabilities->supportedCompositeAlpha = static_cast<VkCompositeAlphaFlagBitsKHR>( | ||
| 23 | - VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR | VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR); | ||
| 24 | + VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR | VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR); | ||
| 25 | return VK_SUCCESS; | ||
| 26 | } | ||
| 27 | |||
| 28 | -- | ||
| 29 | 2.37.1 | ||
| 30 | |||
diff --git a/recipes-graphics/vulkan/vulkan-wsi-layer/0002-MGS-6823-nxp-Add-support-of-VK_COMPOSITE_ALPHA_OPAQU.patch b/recipes-graphics/vulkan/vulkan-wsi-layer/0002-MGS-6823-nxp-Add-support-of-VK_COMPOSITE_ALPHA_OPAQU.patch new file mode 100644 index 000000000..9955f415e --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-wsi-layer/0002-MGS-6823-nxp-Add-support-of-VK_COMPOSITE_ALPHA_OPAQU.patch | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | From 4293d8835eaa45168c070793eefd8867c6ec7605 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuan Tian <yuan.tian@nxp.com> | ||
| 3 | Date: Thu, 27 Jul 2023 18:25:16 +0800 | ||
| 4 | Subject: [PATCH 2/2] MGS-6823 [#nxp] Add support of | ||
| 5 | VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR feature | ||
| 6 | |||
| 7 | Mali vulkan driver doesn't support VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR. It caused unwanted blending effect in many vulkan cases. | ||
| 8 | Add support of this feature to solve the problem. | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [i.MX-specific] | ||
| 11 | Signed-off-by: Yuan Tian <yuan.tian@nxp.com> | ||
| 12 | Signed-off-by: Jiyu Yang <jiyu.yang@nxp.com> | ||
| 13 | --- | ||
| 14 | wsi/wayland/swapchain.cpp | 161 ++++++++++++++++++++++++++++++++++++++ | ||
| 15 | wsi/wayland/swapchain.hpp | 9 +++ | ||
| 16 | 2 files changed, 170 insertions(+) | ||
| 17 | |||
| 18 | Index: git/wsi/wayland/swapchain.cpp | ||
| 19 | =================================================================== | ||
| 20 | --- git.orig/wsi/wayland/swapchain.cpp | ||
| 21 | +++ git/wsi/wayland/swapchain.cpp | ||
| 22 | @@ -38,6 +38,7 @@ | ||
| 23 | #include <cstdio> | ||
| 24 | #include <climits> | ||
| 25 | #include <functional> | ||
| 26 | +#include <poll.h> | ||
| 27 | |||
| 28 | #include "util/drm/drm_utils.hpp" | ||
| 29 | #include "util/log.hpp" | ||
| 30 | @@ -72,12 +73,152 @@ swapchain::~swapchain() | ||
| 31 | wsialloc_delete(m_wsi_allocator); | ||
| 32 | } | ||
| 33 | m_wsi_allocator = nullptr; | ||
| 34 | + if (wlc.opaque_region) | ||
| 35 | + { | ||
| 36 | + wl_compositor_destroy(wlc.wl_compositor); | ||
| 37 | + wl_registry_destroy(wlc.registry); | ||
| 38 | + wl_region_destroy(wlc.opaque_region); | ||
| 39 | + wlc = {0}; | ||
| 40 | + } | ||
| 41 | if (m_buffer_queue != nullptr) | ||
| 42 | { | ||
| 43 | wl_event_queue_destroy(m_buffer_queue); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | +static inline int | ||
| 48 | +poll_event(struct wl_display *wl_dpy, short int events, int timeout) | ||
| 49 | +{ | ||
| 50 | + int ret; | ||
| 51 | + struct pollfd pfd[1]; | ||
| 52 | + | ||
| 53 | + pfd[0].fd = wl_display_get_fd(wl_dpy); | ||
| 54 | + pfd[0].events = events; | ||
| 55 | + | ||
| 56 | + do | ||
| 57 | + { | ||
| 58 | + ret = poll(pfd, 1, timeout); | ||
| 59 | + } | ||
| 60 | + while (ret == -1 && errno == EINTR); | ||
| 61 | + | ||
| 62 | + return ret; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +static int | ||
| 66 | +dispatch_queue_op(struct wl_display *wl_dpy, | ||
| 67 | + struct wl_event_queue *wl_queue, int timeout) | ||
| 68 | +{ | ||
| 69 | + int ret; | ||
| 70 | + | ||
| 71 | + if (wl_display_prepare_read_queue(wl_dpy, wl_queue) == -1) | ||
| 72 | + { | ||
| 73 | + return wl_display_dispatch_queue_pending(wl_dpy, wl_queue); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + for (;;) | ||
| 77 | + { | ||
| 78 | + ret = wl_display_flush(wl_dpy); | ||
| 79 | + | ||
| 80 | + if (ret != -1 || errno != EAGAIN) | ||
| 81 | + break; | ||
| 82 | + | ||
| 83 | + if (poll_event(wl_dpy, POLLOUT, -1) == -1) | ||
| 84 | + { | ||
| 85 | + wl_display_cancel_read(wl_dpy); | ||
| 86 | + return -1; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /* Don't stop if flushing hits an EPIPE; continue so we can read any | ||
| 91 | + * protocol error that may have triggered it. */ | ||
| 92 | + if (ret < 0 && errno != EPIPE) | ||
| 93 | + { | ||
| 94 | + wl_display_cancel_read(wl_dpy); | ||
| 95 | + return -1; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + ret = poll_event(wl_dpy, POLLIN, timeout); | ||
| 99 | + | ||
| 100 | + /* cancel read when on error or timeout. */ | ||
| 101 | + if (ret == -1 || ret == 0) | ||
| 102 | + { | ||
| 103 | + wl_display_cancel_read(wl_dpy); | ||
| 104 | + return ret; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + if (wl_display_read_events(wl_dpy) == -1) | ||
| 108 | + return -1; | ||
| 109 | + | ||
| 110 | + return wl_display_dispatch_queue_pending(wl_dpy, wl_queue); | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +static void | ||
| 114 | +sync_callback(void *data, struct wl_callback *callback, uint32_t serial) | ||
| 115 | +{ | ||
| 116 | + int *done = (int *)data; | ||
| 117 | + | ||
| 118 | + *done = 1; | ||
| 119 | + wl_callback_destroy(callback); | ||
| 120 | +} | ||
| 121 | + | ||
| 122 | +static const struct wl_callback_listener sync_listener = { | ||
| 123 | + sync_callback | ||
| 124 | +}; | ||
| 125 | + | ||
| 126 | +static int | ||
| 127 | +roundtrip_queue(struct wl_display *wl_dpy, struct wl_event_queue *wl_queue) | ||
| 128 | +{ | ||
| 129 | + struct wl_callback *callback; | ||
| 130 | + int done, ret = 0; | ||
| 131 | + | ||
| 132 | + done = 0; | ||
| 133 | + | ||
| 134 | + /* | ||
| 135 | + * This is to block read & dispatch events in other threads, so that the | ||
| 136 | + * callback is with correct queue and listener when 'done' event. | ||
| 137 | + */ | ||
| 138 | + while (wl_display_prepare_read_queue(wl_dpy, wl_queue) == -1) | ||
| 139 | + wl_display_dispatch_queue_pending(wl_dpy, wl_queue); | ||
| 140 | + | ||
| 141 | + callback = wl_display_sync(wl_dpy); | ||
| 142 | + | ||
| 143 | + if (callback == NULL) | ||
| 144 | + { | ||
| 145 | + wl_display_cancel_read(wl_dpy); | ||
| 146 | + return -1; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + wl_proxy_set_queue((struct wl_proxy *) callback, wl_queue); | ||
| 150 | + wl_callback_add_listener(callback, &sync_listener, &done); | ||
| 151 | + | ||
| 152 | + wl_display_cancel_read(wl_dpy); | ||
| 153 | + | ||
| 154 | + while (!done && ret >= 0) | ||
| 155 | + ret = dispatch_queue_op(wl_dpy, wl_queue, 5); | ||
| 156 | + | ||
| 157 | + if (ret == -1 && !done) | ||
| 158 | + wl_callback_destroy(callback); | ||
| 159 | + | ||
| 160 | + return ret; | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +static void | ||
| 164 | +registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, | ||
| 165 | + const char *interface, uint32_t version) | ||
| 166 | +{ | ||
| 167 | + wl_context *pwlc = (wl_context *)data; | ||
| 168 | + | ||
| 169 | + if(!pwlc->wl_compositor) | ||
| 170 | + { | ||
| 171 | + pwlc->wl_compositor = (wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 1); | ||
| 172 | + wl_proxy_set_queue((struct wl_proxy *)pwlc->wl_compositor, pwlc->wl_queue); | ||
| 173 | + } | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +static const struct wl_registry_listener registry_listener = { | ||
| 177 | + registry_handle_global | ||
| 178 | +}; | ||
| 179 | + | ||
| 180 | VkResult swapchain::init_platform(VkDevice device, const VkSwapchainCreateInfoKHR *swapchain_create_info, | ||
| 181 | bool &use_presentation_thread) | ||
| 182 | { | ||
| 183 | @@ -124,6 +265,21 @@ VkResult swapchain::init_platform(VkDevi | ||
| 184 | use_presentation_thread = | ||
| 185 | WAYLAND_FIFO_PRESENTATION_THREAD_ENABLED && (m_present_mode != VK_PRESENT_MODE_MAILBOX_KHR); | ||
| 186 | |||
| 187 | + if (swapchain_create_info->compositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR) | ||
| 188 | + { | ||
| 189 | + wlc.wl_queue = m_buffer_queue; | ||
| 190 | + wlc.registry = wl_display_get_registry(m_display); | ||
| 191 | + wl_proxy_set_queue((struct wl_proxy *)(wlc.registry), m_buffer_queue); | ||
| 192 | + wl_registry_add_listener(wlc.registry, ®istry_listener, &wlc); | ||
| 193 | + | ||
| 194 | + roundtrip_queue(m_display, m_buffer_queue); | ||
| 195 | + | ||
| 196 | + wlc.opaque_region = wl_compositor_create_region(wlc.wl_compositor); | ||
| 197 | + wl_proxy_set_queue((struct wl_proxy *)(wlc.opaque_region), m_buffer_queue); | ||
| 198 | + | ||
| 199 | + wl_region_add(wlc.opaque_region, 0, 0, swapchain_create_info->imageExtent.width, swapchain_create_info->imageExtent.height); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | return VK_SUCCESS; | ||
| 203 | } | ||
| 204 | |||
| 205 | @@ -494,6 +650,11 @@ void swapchain::present_image(const pend | ||
| 206 | set_error_state(VK_ERROR_SURFACE_LOST_KHR); | ||
| 207 | } | ||
| 208 | |||
| 209 | + if (wlc.opaque_region) | ||
| 210 | + { | ||
| 211 | + wl_surface_set_opaque_region(m_surface, wlc.opaque_region); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | wl_surface_attach(m_surface, image_data->buffer, 0, 0); | ||
| 215 | |||
| 216 | auto present_sync_fd = image_data->present_fence.export_sync_fd(); | ||
| 217 | Index: git/wsi/wayland/swapchain.hpp | ||
| 218 | =================================================================== | ||
| 219 | --- git.orig/wsi/wayland/swapchain.hpp | ||
| 220 | +++ git/wsi/wayland/swapchain.hpp | ||
| 221 | @@ -78,6 +78,14 @@ struct image_creation_parameters | ||
| 222 | } | ||
| 223 | }; | ||
| 224 | |||
| 225 | +struct wl_context | ||
| 226 | +{ | ||
| 227 | + struct wl_event_queue *wl_queue; | ||
| 228 | + struct wl_compositor *wl_compositor; | ||
| 229 | + struct wl_registry *registry; | ||
| 230 | + struct wl_region *opaque_region; | ||
| 231 | +}; | ||
| 232 | + | ||
| 233 | class swapchain : public wsi::swapchain_base | ||
| 234 | { | ||
| 235 | public: | ||
| 236 | @@ -190,6 +198,7 @@ private: | ||
| 237 | |||
| 238 | struct wl_display *m_display; | ||
| 239 | struct wl_surface *m_surface; | ||
| 240 | + struct wl_context wlc = {0}; | ||
| 241 | /** Raw pointer to the WSI Surface that this swapchain was created from. The Vulkan specification ensures that the | ||
| 242 | * surface is valid until swapchain is destroyed. */ | ||
| 243 | surface *m_wsi_surface; | ||
diff --git a/recipes-graphics/vulkan/vulkan-wsi-layer/0003-Update-minimum-version-of-CMake.patch b/recipes-graphics/vulkan/vulkan-wsi-layer/0003-Update-minimum-version-of-CMake.patch new file mode 100644 index 000000000..0bc00de02 --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-wsi-layer/0003-Update-minimum-version-of-CMake.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From 0c4ed8178a25135ced9df8c8a8909e2882bfe869 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Maged Elnaggar <maged.elnaggar@arm.com> | ||
| 3 | Date: Tue, 17 Jun 2025 10:33:44 +0000 | ||
| 4 | Subject: [PATCH] Update minimum version of CMake | ||
| 5 | |||
| 6 | Set CMake minimum required version range to 3.4.3...4.0 | ||
| 7 | to silence compatibility errors in CMake 4.0 | ||
| 8 | by explicitly opting into all policies up to 4.0 | ||
| 9 | |||
| 10 | Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer/-/commit/1eafebc56a7f735cd4e8298956d596c64ac9f681] | ||
| 11 | Signed-off-by: Maged Elnaggar <maged.elnaggar@arm.com> | ||
| 12 | Change-Id: I2e0527dde4e764e9c17f519fc0ddd3c0e382fa31 | ||
| 13 | --- | ||
| 14 | CMakeLists.txt | 2 +- | ||
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 18 | index 4dc800c..b91cd54 100644 | ||
| 19 | --- a/CMakeLists.txt | ||
| 20 | +++ b/CMakeLists.txt | ||
| 21 | @@ -20,7 +20,7 @@ | ||
| 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 23 | # SOFTWARE. | ||
| 24 | |||
| 25 | -cmake_minimum_required(VERSION 3.4.3) | ||
| 26 | +cmake_minimum_required(VERSION 3.4.3...4.0) | ||
| 27 | project(VkLayer_window_system_integration) | ||
| 28 | |||
| 29 | find_package(PkgConfig REQUIRED) | ||
| 30 | -- | ||
| 31 | 2.34.1 | ||
| 32 | |||
diff --git a/recipes-graphics/vulkan/vulkan-wsi-layer_git.bb b/recipes-graphics/vulkan/vulkan-wsi-layer_git.bb new file mode 100644 index 000000000..efa6accb3 --- /dev/null +++ b/recipes-graphics/vulkan/vulkan-wsi-layer_git.bb | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | DESCRIPTION = "Vulkan Window System Integration Layer" | ||
| 2 | LICENSE = "MIT" | ||
| 3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c2e771b72d60a13d2de384cb49055d00" | ||
| 4 | DEPENDS = "libdrm vulkan-loader" | ||
| 5 | |||
| 6 | PV = "0.0+git${SRCPV}" | ||
| 7 | |||
| 8 | SRC_URI = "git://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git;protocol=https;branch=main \ | ||
| 9 | file://0001-MGS-6801-ccc-vkmark-on-wayland.patch \ | ||
| 10 | file://0002-MGS-6823-nxp-Add-support-of-VK_COMPOSITE_ALPHA_OPAQU.patch \ | ||
| 11 | file://0003-Update-minimum-version-of-CMake.patch" | ||
| 12 | SRCREV = "cb1a50cf7e640ad7306e673131ded98c0f133628" | ||
| 13 | |||
| 14 | inherit cmake pkgconfig | ||
| 15 | |||
| 16 | PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', 'headless', d)}" | ||
| 17 | |||
| 18 | PACKAGECONFIG[headless] = " \ | ||
| 19 | -DBUILD_WSI_HEADLESS=1, \ | ||
| 20 | -DBUILD_WSI_HEADLESS=0, \ | ||
| 21 | ,,, \ | ||
| 22 | wayland" | ||
| 23 | PACKAGECONFIG[wayland] = " \ | ||
| 24 | -DBUILD_WSI_WAYLAND=1 -DENABLE_WAYLAND_FIFO_PRESENTATION_THREAD=1 -DSELECT_EXTERNAL_ALLOCATOR=dma_buf_heaps, \ | ||
| 25 | -DBUILD_WSI_WAYLAND=0, \ | ||
| 26 | wayland wayland-native wayland-protocols,,, \ | ||
| 27 | headless" | ||
| 28 | |||
| 29 | EXTRA_OECMAKE = " \ | ||
| 30 | -DBUILD_WSI_DISPLAY=0 \ | ||
| 31 | -DBUILD_WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN=1 \ | ||
| 32 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 33 | -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ | ||
| 34 | -DENABLE_INSTRUMENTATION=1 \ | ||
| 35 | -DKERNEL_HEADER_DIR=${KERNEL_HEADER_DIR} \ | ||
| 36 | -DVULKAN_WSI_LAYER_EXPERIMENTAL=0 " | ||
| 37 | |||
| 38 | # The KERNEL_HEADER_DIR setting is required by the CMake apparently | ||
| 39 | # in order to find the DRM headers. However, the Yocto build provides | ||
| 40 | # the DRM headers via a separate recipe libdrm in order to avoid the | ||
| 41 | # kernel dependency. The CMake fails if the variable is not defined, | ||
| 42 | # so set it to an invalid value in case the build ever actually needs | ||
| 43 | # the kernel headers for something else. | ||
| 44 | KERNEL_HEADER_DIR = "KERNEL_HEADER_DIR_NOT_PROVIDED_BY_YOCTO" | ||
| 45 | |||
| 46 | do_install() { | ||
| 47 | install -d ${D}${sysconfdir}/vulkan/implicit_layer.d | ||
| 48 | install -m 0755 ${B}/libVkLayer_window_system_integration.so ${D}${sysconfdir}/vulkan/implicit_layer.d/ | ||
| 49 | install -m 0644 ${B}/VkLayer_window_system_integration.json ${D}${sysconfdir}/vulkan/implicit_layer.d | ||
| 50 | } | ||
| 51 | |||
| 52 | # Adjust packaging variables for unversioned library | ||
| 53 | SOLIBS = ".so" | ||
| 54 | FILES_SOLIBSDEV = "" | ||
