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 <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10059>
This commit is contained in:
Mike Blumenkrantz 2021-04-06 10:07:49 -04:00 committed by Marge Bot
parent f89c8ba410
commit c1270d4845
2 changed files with 22 additions and 1 deletions

View File

@ -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;

View File

@ -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 : [