zink: create a copy context for the screen on init
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 29 Apr 2022 11:41:52 +0000 (07:41 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 11 May 2022 01:30:38 +0000 (01:30 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252>

src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_screen.h

index 6bce401..fb402ed 100644 (file)
@@ -1193,6 +1193,9 @@ zink_destroy_screen(struct pipe_screen *pscreen)
       zink_kopper_deinit_displaytarget(screen, entry->data);
    simple_mtx_destroy(&screen->dt_lock);
 
+   if (screen->copy_context)
+      screen->copy_context->base.destroy(&screen->copy_context->base);
+
    if (VK_NULL_HANDLE != screen->debugUtilsCallbackHandle) {
       VKSCR(DestroyDebugUtilsMessengerEXT)(screen->instance, screen->debugUtilsCallbackHandle, NULL);
    }
@@ -2225,6 +2228,11 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
    glsl_type_singleton_init_or_ref();
 
    init_driver_workarounds(screen);
+   screen->copy_context = zink_context(screen->base.context_create(&screen->base, NULL, ZINK_CONTEXT_COPY_ONLY));
+   if (!screen->copy_context) {
+      mesa_loge("zink: failed to create copy context");
+      goto fail;
+   }
 
    return screen;
 
index ad4e306..d6e8c99 100644 (file)
@@ -87,6 +87,7 @@ struct zink_screen {
    VkSemaphore sem;
    VkSemaphore prev_sem;
    struct util_queue flush_queue;
+   struct zink_context *copy_context;
 
    unsigned buffer_rebind_counter;