For zink, we want to know if we should pass command stream markers down to
the underlying driver, but we don't have our own trace context we're
recording trace events with. We definitely want those markers if the
underlying driver is going to be doing perfetto tracing, or is requesting
marker tracing. So, create an interface for querying those flags before
they get copied down to an actual u_trace_context.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20657>
}
}
-static void
+void
u_trace_state_init(void)
{
util_call_once(&u_trace_state.once, u_trace_state_init_once);
}
+bool
+u_trace_is_enabled(enum u_trace_type type)
+{
+ /* Active is only tracked in a given u_trace context, so if you're asking us
+ * if U_TRACE_TYPE_PERFETTO (_ENV | _ACTIVE) is enabled, then just check
+ * _ENV ("perfetto tracing is desired, but perfetto might not be running").
+ */
+ type &= ~U_TRACE_TYPE_PERFETTO_ACTIVE;
+
+ return (u_trace_state.enabled_traces & type) == type;
+}
+
static void
queue_init(struct u_trace_context *utctx)
{
void u_trace_init(struct u_trace *ut, struct u_trace_context *utctx);
void u_trace_fini(struct u_trace *ut);
+void u_trace_state_init(void);
+bool u_trace_is_enabled(enum u_trace_type type);
+
bool u_trace_has_points(struct u_trace *ut);
struct u_trace_iterator