surface->compositor->renderer->flush_damage(surface);
if (pixman_region32_not_empty(&surface->damage))
- TL_POINT("core_flush_damage", TLP_SURFACE(surface),
+ TL_POINT(surface->compositor, "core_flush_damage", TLP_SURFACE(surface),
TLP_OUTPUT(surface->output), TLP_END);
pixman_region32_clear(&surface->damage);
if (output->destroying)
return 0;
- TL_POINT("core_repaint_begin", TLP_OUTPUT(output), TLP_END);
+ TL_POINT(ec, "core_repaint_begin", TLP_OUTPUT(output), TLP_END);
/* Rebuild the surface list and update surface transforms up front. */
weston_compositor_build_view_list(ec);
animation->frame(animation, output, &output->frame_time);
}
- TL_POINT("core_repaint_posted", TLP_OUTPUT(output), TLP_END);
+ TL_POINT(ec, "core_repaint_posted", TLP_OUTPUT(output), TLP_END);
return r;
}
weston_output_schedule_repaint_reset(struct weston_output *output)
{
output->repaint_status = REPAINT_NOT_SCHEDULED;
- TL_POINT("core_repaint_exit_loop", TLP_OUTPUT(output), TLP_END);
+ TL_POINT(output->compositor, "core_repaint_exit_loop",
+ TLP_OUTPUT(output), TLP_END);
}
static int
goto out;
}
- TL_POINT("core_repaint_finished", TLP_OUTPUT(output),
+ TL_POINT(compositor, "core_repaint_finished", TLP_OUTPUT(output),
TLP_VBLANK(stamp), TLP_END);
refresh_nsec = millihz_to_nsec(output->current_mode->refresh);
return;
if (!output->repaint_needed)
- TL_POINT("core_repaint_req", TLP_OUTPUT(output), TLP_END);
+ TL_POINT(compositor, "core_repaint_req", TLP_OUTPUT(output), TLP_END);
loop = wl_display_get_event_loop(compositor->wl_display);
output->repaint_needed = true;
assert(!output->idle_repaint_source);
output->idle_repaint_source = wl_event_loop_add_idle(loop, idle_repaint,
output);
- TL_POINT("core_repaint_enter_loop", TLP_OUTPUT(output), TLP_END);
+ TL_POINT(compositor, "core_repaint_enter_loop", TLP_OUTPUT(output), TLP_END);
}
/** weston_compositor_schedule_repaint
/* wl_surface.damage and wl_surface.damage_buffer */
if (pixman_region32_not_empty(&state->damage_surface) ||
pixman_region32_not_empty(&state->damage_buffer))
- TL_POINT("core_commit_damage", TLP_SURFACE(surface), TLP_END);
+ TL_POINT(surface->compositor, "core_commit_damage", TLP_SURFACE(surface), TLP_END);
pixman_region32_union(&surface->damage, &surface->damage,
&state->damage_surface);
#include <unistd.h>
#include "linux-sync-file.h"
-
#include "timeline.h"
#include "gl-renderer.h"
if (weston_linux_sync_file_read_timestamp(trp->fd,
&tspec) == 0) {
- TL_POINT(tp_name, TLP_GPU(&tspec),
+ TL_POINT(trp->output->compositor, tp_name, TLP_GPU(&tspec),
TLP_OUTPUT(trp->output), TLP_END);
}
}
int fd;
struct timeline_render_point *trp;
- if (!gr->has_native_fence_sync ||
+ if (!weston_log_scope_is_enabled(ec->timeline) ||
+ !gr->has_native_fence_sync ||
sync == EGL_NO_SYNC_KHR)
return;
#include "timeline.h"
#include "weston-log-internal.h"
-WL_EXPORT int weston_timeline_enabled_;
-
struct timeline_emit_context {
FILE *cur;
struct weston_log_subscription *subscription;
};
WL_EXPORT void
-weston_timeline_point(const char *name, ...)
+weston_timeline_point(struct weston_log_scope *timeline_scope,
+ const char *name, ...)
{
- va_list argp;
struct timespec ts;
enum timeline_type otype;
void *obj;
char buf[512];
- struct timeline_emit_context ctx;
+ struct weston_log_subscription *sub = NULL;
+
+ if (!weston_log_scope_is_enabled(timeline_scope))
+ return;
clock_gettime(CLOCK_MONOTONIC, &ts);
- ctx.cur = fmemopen(buf, sizeof(buf), "w");
+ while ((sub = weston_log_subscription_iterate(timeline_scope, sub))) {
+ va_list argp;
+ struct timeline_emit_context ctx = {};
- if (!ctx.cur) {
- weston_log("Timeline error in fmemopen, closing.\n");
- return;
- }
+ memset(buf, 0, sizeof(buf));
+ ctx.cur = fmemopen(buf, sizeof(buf), "w");
+ ctx.subscription = sub;
+
+ if (!ctx.cur) {
+ weston_log("Timeline error in fmemopen, closing.\n");
+ return;
+ }
- fprintf(ctx.cur, "{ \"T\":[%" PRId64 ", %ld], \"N\":\"%s\"",
- (int64_t)ts.tv_sec, ts.tv_nsec, name);
+ fprintf(ctx.cur, "{ \"T\":[%" PRId64 ", %ld], \"N\":\"%s\"",
+ (int64_t)ts.tv_sec, ts.tv_nsec, name);
- va_start(argp, name);
- while (1) {
- otype = va_arg(argp, enum timeline_type);
- if (otype == TLT_END)
- break;
+ va_start(argp, name);
+ while (1) {
+ otype = va_arg(argp, enum timeline_type);
+ if (otype == TLT_END)
+ break;
- obj = va_arg(argp, void *);
- if (type_dispatch[otype]) {
- fprintf(ctx.cur, ", ");
- type_dispatch[otype](&ctx, obj);
+ obj = va_arg(argp, void *);
+ if (type_dispatch[otype]) {
+ fprintf(ctx.cur, ", ");
+ type_dispatch[otype](&ctx, obj);
+ }
+ }
+ va_end(argp);
+
+ fprintf(ctx.cur, " }\n");
+ fflush(ctx.cur);
+ if (ferror(ctx.cur)) {
+ weston_log("Timeline error in constructing entry, closing.\n");
+ } else {
+ weston_log_subscription_printf(ctx.subscription, "%s", buf);
}
- }
- va_end(argp);
- fprintf(ctx.cur, " }\n");
- fflush(ctx.cur);
- if (ferror(ctx.cur)) {
- weston_log("Timeline error in constructing entry, closing.\n");
- } else {
- weston_log_subscription_printf(ctx.subscription, "%s", buf);
- }
+ fclose(ctx.cur);
- fclose(ctx.cur);
+ }
}
#include <libweston/weston-log.h>
#include <wayland-server-core.h>
-extern int weston_timeline_enabled_;
-
enum timeline_type {
TLT_END = 0,
TLT_OUTPUT,
#define TLP_VBLANK(t) TLT_VBLANK, TYPEVERIFY(const struct timespec *, (t))
#define TLP_GPU(t) TLT_GPU, TYPEVERIFY(const struct timespec *, (t))
-#define TL_POINT(...) do { \
- if (weston_timeline_enabled_) \
- weston_timeline_point(__VA_ARGS__); \
+#define TL_POINT(ec, ...) do { \
+ weston_timeline_point(ec->timeline, __VA_ARGS__); \
} while (0)
void
-weston_timeline_point(const char *name, ...);
+weston_timeline_point(struct weston_log_scope *timeline_scope,
+ const char *name, ...);
#endif /* WESTON_TIMELINE_H */