zink: Lock around screen_debug_marker_{begin,end}
vkQueueBeginDebugUtilsLabelEXT and vkQueueEndDebugUtilsLabelEXT
require queue to be externally synchronized, which means these functions
require the lock. Unfortunately, there's no guarantee that the debug
markers will be matched in the multithreaded case, but I suppose this is
better than crashing.
Fixes: 015eda4a41 ("zink: deduplicate VkDevice and VkInstance")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38414>
This commit is contained in:
@@ -3779,7 +3779,9 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
|
||||
zink_tracing = screen->instance_info->have_EXT_debug_utils &&
|
||||
(u_trace_is_enabled(U_TRACE_TYPE_PERFETTO) || u_trace_is_enabled(U_TRACE_TYPE_MARKERS));
|
||||
|
||||
simple_mtx_lock(screen->queue_lock);
|
||||
screen->frame_marker_emitted = zink_screen_debug_marker_begin(screen, "frame");
|
||||
simple_mtx_unlock(screen->queue_lock);
|
||||
|
||||
return screen;
|
||||
|
||||
@@ -3875,6 +3877,8 @@ void VKAPI_PTR zink_stub_function_not_loaded()
|
||||
bool
|
||||
zink_screen_debug_marker_begin(struct zink_screen *screen, const char *fmt, ...)
|
||||
{
|
||||
simple_mtx_assert_locked(screen->queue_lock);
|
||||
|
||||
if (!zink_tracing)
|
||||
return false;
|
||||
|
||||
@@ -3900,6 +3904,8 @@ zink_screen_debug_marker_begin(struct zink_screen *screen, const char *fmt, ...)
|
||||
void
|
||||
zink_screen_debug_marker_end(struct zink_screen *screen, bool emitted)
|
||||
{
|
||||
simple_mtx_assert_locked(screen->queue_lock);
|
||||
|
||||
if (emitted)
|
||||
VKSCR(QueueEndDebugUtilsLabelEXT)(screen->queue);
|
||||
}
|
||||
|
||||
@@ -203,8 +203,11 @@ zink_screen_get_pipeline_cache(struct zink_screen *screen, struct zink_program *
|
||||
void VKAPI_PTR
|
||||
zink_stub_function_not_loaded(void);
|
||||
|
||||
/** Requires queue_lock to be held */
|
||||
bool
|
||||
zink_screen_debug_marker_begin(struct zink_screen *screen, const char *fmt, ...);
|
||||
|
||||
/** Requires queue_lock to be held */
|
||||
void
|
||||
zink_screen_debug_marker_end(struct zink_screen *screen, bool emitted);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user