Mesa (main): zink: create a copy context for the screen on init

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 11 01:43:41 UTC 2022


Module: Mesa
Branch: main
Commit: b978761385f0c3cc0f01aaa201badecea2ee0c0b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b978761385f0c3cc0f01aaa201badecea2ee0c0b

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Apr 29 07:41:52 2022 -0400

zink: create a copy context for the screen on init

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252>

---

 src/gallium/drivers/zink/zink_screen.c | 8 ++++++++
 src/gallium/drivers/zink/zink_screen.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 6bce401d2b9..fb402ed1367 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -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;
 
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index ad4e306a700..d6e8c994b4e 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -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;
 



More information about the mesa-commit mailing list