948101d2e2877925680bb0b39de833f5c0f9006d
[platform/upstream/intel-gpu-tools.git] / lib / igt_aux.h
1 /*
2  * Copyright © 2014 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  *
23  * Authors:
24  *    Daniel Vetter <daniel.vetter@ffwll.ch>
25  *
26  */
27
28 #ifndef IGT_AUX_H
29 #define IGT_AUX_H
30
31 #include <intel_bufmgr.h>
32
33 /* auxialiary igt helpers from igt_aux.c */
34 /* generally useful helpers */
35 void igt_fork_signal_helper(void);
36 void igt_stop_signal_helper(void);
37 void igt_exchange_int(void *array, unsigned i, unsigned j);
38 void igt_permute_array(void *array, unsigned size,
39                            void (*exchange_func)(void *array,
40                                                  unsigned i,
41                                                  unsigned j));
42 void igt_progress(const char *header, uint64_t i, uint64_t total);
43 bool igt_check_boolean_env_var(const char *env_var, bool default_value);
44
45 bool igt_aub_dump_enabled(void);
46
47 /* helpers based upon the libdrm buffer manager */
48 void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr);
49 void igt_trash_aperture(void);
50 void igt_cleanup_aperture_trashers(void);
51
52 /* suspend and auto-resume system */
53 void igt_system_suspend_autoresume(void);
54
55 /* dropping priviledges */
56 void igt_drop_root(void);
57
58 void igt_wait_for_keypress(void);
59
60 /* sysinfo cross-arch wrappers from intel_os.c */
61
62 /* These are separate to allow easier testing when porting, see the comment at
63  * the bottom of intel_os.c. */
64 uint64_t intel_get_avail_ram_mb(void);
65 uint64_t intel_get_total_ram_mb(void);
66 uint64_t intel_get_total_swap_mb(void);
67
68 #endif /* IGT_AUX_H */