aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-04-30 19:06:51 +0200
committerMarge Bot <[email protected]>2020-05-11 09:09:34 +0000
commitb8fd70eef2cb5936e8ccb4d237e50084d6ff2a7c (patch)
treebee7748bb4228e7e3962ac577abfd0d1bac5bb81 /src
parentc668bdf05cf3aa6907b678c35805962ea79b258b (diff)
zink: load vk_GetMemoryFdKHR while creating screen
We're about to load some more extension-pointers as well, so let's create a separate place for doing this. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4835>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/zink/zink_resource.c5
-rw-r--r--src/gallium/drivers/zink/zink_screen.c15
2 files changed, 15 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index e8073b45988..5467fe487b9 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -318,11 +318,6 @@ zink_resource_get_handle(struct pipe_screen *pscreen,
}
if (whandle->type == WINSYS_HANDLE_TYPE_FD) {
-
- if (!screen->vk_GetMemoryFdKHR)
- screen->vk_GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(screen->dev, "vkGetMemoryFdKHR");
- if (!screen->vk_GetMemoryFdKHR)
- return false;
fd_info.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR;
fd_info.memory = res->mem;
fd_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 9d751d30eff..fae39c6ec1b 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -704,6 +704,18 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
winsys->displaytarget_display(winsys, res->dt, winsys_drawable_handle, sub_box);
}
+static bool
+load_device_extensions(struct zink_screen *screen)
+{
+ if (screen->have_KHR_external_memory_fd) {
+ screen->vk_GetMemoryFdKHR = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(screen->dev, "vkGetMemoryFdKHR");
+ if (!screen->vk_GetMemoryFdKHR)
+ return false;
+ }
+
+ return true;
+}
+
static struct pipe_screen *
zink_internal_create_screen(struct sw_winsys *winsys, int fd)
{
@@ -785,6 +797,9 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd)
if (vkCreateDevice(screen->pdev, &dci, NULL, &screen->dev) != VK_SUCCESS)
goto fail;
+ if (!load_device_extensions(screen))
+ goto fail;
+
screen->winsys = winsys;
screen->base.get_name = zink_get_name;