1bf215546Sopenharmony_ci
2bf215546Sopenharmony_ci#ifndef INLINE_DEBUG_HELPER_H
3bf215546Sopenharmony_ci#define INLINE_DEBUG_HELPER_H
4bf215546Sopenharmony_ci
5bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
6bf215546Sopenharmony_ci#include "util/u_debug.h"
7bf215546Sopenharmony_ci#include "util/u_tests.h"
8bf215546Sopenharmony_ci
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci/* Helper function to wrap a screen with
11bf215546Sopenharmony_ci * one or more debug drivers.
12bf215546Sopenharmony_ci */
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ci#include "driver_ddebug/dd_public.h"
15bf215546Sopenharmony_ci#include "driver_trace/tr_public.h"
16bf215546Sopenharmony_ci#include "driver_rbug/rbug_public.h"
17bf215546Sopenharmony_ci#include "driver_noop/noop_public.h"
18bf215546Sopenharmony_ci
19bf215546Sopenharmony_ci#ifdef __cplusplus
20bf215546Sopenharmony_ciextern "C" {
21bf215546Sopenharmony_ci#endif
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ci/*
24bf215546Sopenharmony_ci * TODO: Audit the following *screen_create() - all of
25bf215546Sopenharmony_ci * them should return the original screen on failuire.
26bf215546Sopenharmony_ci */
27bf215546Sopenharmony_cistatic inline struct pipe_screen *
28bf215546Sopenharmony_cidebug_screen_wrap(struct pipe_screen *screen)
29bf215546Sopenharmony_ci{
30bf215546Sopenharmony_ci   screen = ddebug_screen_create(screen);
31bf215546Sopenharmony_ci   screen = rbug_screen_create(screen);
32bf215546Sopenharmony_ci   screen = trace_screen_create(screen);
33bf215546Sopenharmony_ci   screen = noop_screen_create(screen);
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci   if (debug_get_bool_option("GALLIUM_TESTS", FALSE))
36bf215546Sopenharmony_ci      util_run_tests(screen);
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci   return screen;
39bf215546Sopenharmony_ci}
40bf215546Sopenharmony_ci
41bf215546Sopenharmony_ci#ifdef __cplusplus
42bf215546Sopenharmony_ci}
43bf215546Sopenharmony_ci#endif
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ci#endif // INLINE_DEBUG_HELPER_H
46