From 7c4fa79bfaea6809a39ec2a4905df5f2e2afd758 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Sat, 9 Jul 2022 19:44:28 -0700 Subject: [PATCH] gallium: Add 'name' field to Win32 semaphore import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-By: Mike Blumenkrantz Acked-by: Marek Olšák Part-of: --- src/gallium/auxiliary/driver_noop/noop_pipe.c | 3 ++- src/gallium/auxiliary/driver_trace/tr_screen.c | 4 +++- src/gallium/drivers/zink/zink_fence.c | 3 ++- src/gallium/drivers/zink/zink_fence.h | 2 +- src/gallium/include/pipe/p_screen.h | 1 + src/mesa/main/externalobjects.c | 7 ++++--- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c index 29edab62851..08e825dc7bb 100644 --- a/src/gallium/auxiliary/driver_noop/noop_pipe.c +++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c @@ -619,9 +619,10 @@ static bool noop_check_resource_capability(struct pipe_screen *screen, static void noop_create_fence_win32(struct pipe_screen *screen, struct pipe_fence_handle **fence, void *handle, + const void *name, enum pipe_fd_type type) { - screen->create_fence_win32(screen, fence, handle, type); + screen->create_fence_win32(screen, fence, handle, name, type); } static void noop_set_max_shader_compiler_threads(struct pipe_screen *screen, diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c index 03d978b2a9e..b2f302ed477 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.c +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c @@ -987,6 +987,7 @@ static void trace_screen_create_fence_win32(struct pipe_screen *_screen, struct pipe_fence_handle **fence, void *handle, + const void *name, enum pipe_fd_type type) { struct trace_screen *tr_scr = trace_screen(_screen); @@ -998,11 +999,12 @@ trace_screen_create_fence_win32(struct pipe_screen *_screen, if (fence) trace_dump_arg(ptr, *fence); trace_dump_arg(ptr, handle); + trace_dump_arg(ptr, name); trace_dump_arg_enum(type, tr_util_pipe_fd_type_name(type)); trace_dump_call_end(); - screen->create_fence_win32(screen, fence, handle, type); + screen->create_fence_win32(screen, fence, handle, name, type); } diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c index a6a9277a5fc..067a3d5bef7 100644 --- a/src/gallium/drivers/zink/zink_fence.c +++ b/src/gallium/drivers/zink/zink_fence.c @@ -266,7 +266,7 @@ fail: #ifdef _WIN32 void -zink_create_fence_win32(struct pipe_screen *pscreen, struct pipe_fence_handle **pfence, void *handle, enum pipe_fd_type type) +zink_create_fence_win32(struct pipe_screen *pscreen, struct pipe_fence_handle **pfence, void *handle, const void *name, enum pipe_fd_type type) { struct zink_screen *screen = zink_screen(pscreen); VkResult ret = VK_ERROR_UNKNOWN; @@ -294,6 +294,7 @@ zink_create_fence_win32(struct pipe_screen *pscreen, struct pipe_fence_handle ** sdi.semaphore = mfence->sem; sdi.handleType = flags[type]; sdi.handle = handle; + sdi.name = (LPCWSTR)name; ret = VKSCR(ImportSemaphoreWin32HandleKHR)(screen->dev, &sdi); if (!zink_screen_handle_vkresult(screen, ret)) diff --git a/src/gallium/drivers/zink/zink_fence.h b/src/gallium/drivers/zink/zink_fence.h index 8bb8a881dfc..feac06d30be 100644 --- a/src/gallium/drivers/zink/zink_fence.h +++ b/src/gallium/drivers/zink/zink_fence.h @@ -82,7 +82,7 @@ void zink_create_fence_fd(struct pipe_context *pctx, struct pipe_fence_handle **pfence, int fd, enum pipe_fd_type type); #if defined(_WIN32) void -zink_create_fence_win32(struct pipe_screen *screen, struct pipe_fence_handle **pfence, void *handle, enum pipe_fd_type type); +zink_create_fence_win32(struct pipe_screen *screen, struct pipe_fence_handle **pfence, void *handle, const void *name, enum pipe_fd_type type); #endif void zink_fence_server_signal(struct pipe_context *pctx, struct pipe_fence_handle *pfence); diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 4e500d3d78d..5848183417b 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -416,6 +416,7 @@ struct pipe_screen { void (*create_fence_win32)(struct pipe_screen *screen, struct pipe_fence_handle **fence, void *handle, + const void *name, enum pipe_fd_type type); /** diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index fc815fa2501..5b5a5e00cfc 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -645,11 +645,12 @@ import_semaphoreobj_fd(struct gl_context *ctx, static void import_semaphoreobj_win32(struct gl_context *ctx, struct gl_semaphore_object *semObj, - void *handle) + void *handle, + const void *name) { struct pipe_context *pipe = ctx->pipe; - pipe->screen->create_fence_win32(pipe->screen, &semObj->fence, handle, PIPE_FD_TYPE_SYNCOBJ); + pipe->screen->create_fence_win32(pipe->screen, &semObj->fence, handle, name, PIPE_FD_TYPE_SYNCOBJ); } static void @@ -1162,7 +1163,7 @@ _mesa_ImportSemaphoreWin32HandleEXT(GLuint semaphore, _mesa_HashInsert(ctx->Shared->SemaphoreObjects, semaphore, semObj, true); } - import_semaphoreobj_win32(ctx, semObj, handle); + import_semaphoreobj_win32(ctx, semObj, handle, NULL); } void GLAPIENTRY