blob: 9599d8138cb68636335680dd4bdf2c2c971e0579 [file] [log] [blame]
Pekka Paalanenb5026542014-11-12 15:09:24 +02001/*
2 * Copyright © 2014 Pekka Paalanen <pq@iki.fi>
3 * Copyright © 2014 Collabora, Ltd.
4 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -07005 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
Pekka Paalanenb5026542014-11-12 15:09:24 +020012 *
Bryce Harringtona0bbfea2015-06-11 15:35:43 -070013 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
Pekka Paalanenb5026542014-11-12 15:09:24 +020025 */
26
27#ifndef WESTON_TIMELINE_H
28#define WESTON_TIMELINE_H
29
30extern int weston_timeline_enabled_;
31
32struct weston_compositor;
33
34void
35weston_timeline_open(struct weston_compositor *compositor);
36
37void
38weston_timeline_close(void);
39
40enum timeline_type {
41 TLT_END = 0,
42 TLT_OUTPUT,
43 TLT_SURFACE,
44 TLT_VBLANK,
Alexandros Frantzis75d38ef2017-09-27 15:09:13 +030045 TLT_GPU,
Pekka Paalanenb5026542014-11-12 15:09:24 +020046};
47
48#define TYPEVERIFY(type, arg) ({ \
49 typeof(arg) tmp___ = (arg); \
50 (void)((type)0 == tmp___); \
51 tmp___; })
52
53#define TLP_END TLT_END, NULL
54#define TLP_OUTPUT(o) TLT_OUTPUT, TYPEVERIFY(struct weston_output *, (o))
55#define TLP_SURFACE(s) TLT_SURFACE, TYPEVERIFY(struct weston_surface *, (s))
56#define TLP_VBLANK(t) TLT_VBLANK, TYPEVERIFY(const struct timespec *, (t))
Alexandros Frantzis75d38ef2017-09-27 15:09:13 +030057#define TLP_GPU(t) TLT_GPU, TYPEVERIFY(const struct timespec *, (t))
Pekka Paalanenb5026542014-11-12 15:09:24 +020058
59#define TL_POINT(...) do { \
60 if (weston_timeline_enabled_) \
61 weston_timeline_point(__VA_ARGS__); \
62} while (0)
63
64void
65weston_timeline_point(const char *name, ...);
66
67#endif /* WESTON_TIMELINE_H */