From c1270d4845d39939d6a7d3b1b81e0d2f9e33133d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 6 Apr 2021 10:07:49 -0400 Subject: [PATCH] aux/trace: add screen deduplication for zink+lavapipe tracing if zink+lavapipe is enabled at compile-time, special handling is needed to ensure that only the intended screen is traced, otherwise malformed xml will be generated Reviewed-by: Adam Jackson Part-of: --- src/gallium/auxiliary/driver_trace/tr_screen.c | 17 +++++++++++++++++ src/gallium/auxiliary/meson.build | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c index fc2e68f52bb..b9e549c96a7 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.c +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c @@ -703,6 +703,23 @@ trace_screen_create(struct pipe_screen *screen) { struct trace_screen *tr_scr; +#ifdef ZINK_WITH_SWRAST_VK + /* if zink+lavapipe is enabled, ensure that only one driver is traced */ + const char *driver = debug_get_option("MESA_LOADER_DRIVER_OVERRIDE", NULL); + if (driver && !strcmp(driver, "zink")) { + /* the user wants zink: check whether they want to trace zink or lavapipe */ + bool trace_lavapipe = debug_get_bool_option("ZINK_TRACE_LAVAPIPE", NULL); + if (!strncmp(screen->get_name(screen), "zink", 4)) { + /* this is the zink screen: only trace if lavapipe tracing is disabled */ + if (trace_lavapipe) + return screen; + } else { + /* this is the llvmpipe screen: only trace if lavapipe tracing is enabled */ + if (!trace_lavapipe) + return screen; + } + } +#endif if (!trace_enabled()) goto error1; diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index e1bb660ae5d..a30e4418672 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -531,13 +531,17 @@ u_unfilled_gen_c = custom_target( capture : true, ) +libgallium_extra_c_args = [] +if with_swrast_vk and with_gallium_zink + libgallium_extra_c_args += '-DZINK_WITH_SWRAST_VK' +endif libgallium = static_library( 'gallium', [files_libgallium, u_indices_gen_c, u_unfilled_gen_c], include_directories : [ inc_loader, inc_gallium, inc_src, inc_include, include_directories('util') ], - c_args : [c_msvc_compat_args], + c_args : [c_msvc_compat_args, libgallium_extra_c_args], cpp_args : [cpp_msvc_compat_args], gnu_symbol_visibility : 'hidden', dependencies : [