libweston: Convert timeline points to use the timeline scope

With the timeline scope being created it is time to convert TL_POINT()
to use the timeline scope through the compositor instance.

This patch removes the global variable allowing to run the new timeline
code.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 5 years ago
parent da104ebe5b
commit 3203ff68ad
  1. 17
      libweston/compositor.c
  2. 6
      libweston/renderer-gl/gl-renderer.c
  3. 71
      libweston/timeline.c
  4. 10
      libweston/timeline.h

@ -2369,7 +2369,7 @@ surface_flush_damage(struct weston_surface *surface)
surface->compositor->renderer->flush_damage(surface); surface->compositor->renderer->flush_damage(surface);
if (pixman_region32_not_empty(&surface->damage)) 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); TLP_OUTPUT(surface->output), TLP_END);
pixman_region32_clear(&surface->damage); pixman_region32_clear(&surface->damage);
@ -2631,7 +2631,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data)
if (output->destroying) if (output->destroying)
return 0; 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. */ /* Rebuild the surface list and update surface transforms up front. */
weston_compositor_build_view_list(ec); weston_compositor_build_view_list(ec);
@ -2709,7 +2709,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data)
animation->frame(animation, output, &output->frame_time); 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; return r;
} }
@ -2718,7 +2718,8 @@ static void
weston_output_schedule_repaint_reset(struct weston_output *output) weston_output_schedule_repaint_reset(struct weston_output *output)
{ {
output->repaint_status = REPAINT_NOT_SCHEDULED; 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 static int
@ -2877,7 +2878,7 @@ weston_output_finish_frame(struct weston_output *output,
goto out; goto out;
} }
TL_POINT("core_repaint_finished", TLP_OUTPUT(output), TL_POINT(compositor, "core_repaint_finished", TLP_OUTPUT(output),
TLP_VBLANK(stamp), TLP_END); TLP_VBLANK(stamp), TLP_END);
refresh_nsec = millihz_to_nsec(output->current_mode->refresh); refresh_nsec = millihz_to_nsec(output->current_mode->refresh);
@ -3064,7 +3065,7 @@ weston_output_schedule_repaint(struct weston_output *output)
return; return;
if (!output->repaint_needed) 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); loop = wl_display_get_event_loop(compositor->wl_display);
output->repaint_needed = true; output->repaint_needed = true;
@ -3080,7 +3081,7 @@ weston_output_schedule_repaint(struct weston_output *output)
assert(!output->idle_repaint_source); assert(!output->idle_repaint_source);
output->idle_repaint_source = wl_event_loop_add_idle(loop, idle_repaint, output->idle_repaint_source = wl_event_loop_add_idle(loop, idle_repaint,
output); 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 /** weston_compositor_schedule_repaint
@ -3529,7 +3530,7 @@ weston_surface_commit_state(struct weston_surface *surface,
/* wl_surface.damage and wl_surface.damage_buffer */ /* wl_surface.damage and wl_surface.damage_buffer */
if (pixman_region32_not_empty(&state->damage_surface) || if (pixman_region32_not_empty(&state->damage_surface) ||
pixman_region32_not_empty(&state->damage_buffer)) 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, pixman_region32_union(&surface->damage, &surface->damage,
&state->damage_surface); &state->damage_surface);

@ -42,7 +42,6 @@
#include <unistd.h> #include <unistd.h>
#include "linux-sync-file.h" #include "linux-sync-file.h"
#include "timeline.h" #include "timeline.h"
#include "gl-renderer.h" #include "gl-renderer.h"
@ -253,7 +252,7 @@ timeline_render_point_handler(int fd, uint32_t mask, void *data)
if (weston_linux_sync_file_read_timestamp(trp->fd, if (weston_linux_sync_file_read_timestamp(trp->fd,
&tspec) == 0) { &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); TLP_OUTPUT(trp->output), TLP_END);
} }
} }
@ -287,7 +286,8 @@ timeline_submit_render_sync(struct gl_renderer *gr,
int fd; int fd;
struct timeline_render_point *trp; 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) sync == EGL_NO_SYNC_KHR)
return; return;

@ -37,8 +37,6 @@
#include "timeline.h" #include "timeline.h"
#include "weston-log-internal.h" #include "weston-log-internal.h"
WL_EXPORT int weston_timeline_enabled_;
struct timeline_emit_context { struct timeline_emit_context {
FILE *cur; FILE *cur;
struct weston_log_subscription *subscription; struct weston_log_subscription *subscription;
@ -320,48 +318,59 @@ static const type_func type_dispatch[] = {
}; };
WL_EXPORT void 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; struct timespec ts;
enum timeline_type otype; enum timeline_type otype;
void *obj; void *obj;
char buf[512]; 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); 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) { memset(buf, 0, sizeof(buf));
weston_log("Timeline error in fmemopen, closing.\n"); ctx.cur = fmemopen(buf, sizeof(buf), "w");
return; ctx.subscription = sub;
}
if (!ctx.cur) {
weston_log("Timeline error in fmemopen, closing.\n");
return;
}
fprintf(ctx.cur, "{ \"T\":[%" PRId64 ", %ld], \"N\":\"%s\"", fprintf(ctx.cur, "{ \"T\":[%" PRId64 ", %ld], \"N\":\"%s\"",
(int64_t)ts.tv_sec, ts.tv_nsec, name); (int64_t)ts.tv_sec, ts.tv_nsec, name);
va_start(argp, name); va_start(argp, name);
while (1) { while (1) {
otype = va_arg(argp, enum timeline_type); otype = va_arg(argp, enum timeline_type);
if (otype == TLT_END) if (otype == TLT_END)
break; break;
obj = va_arg(argp, void *); obj = va_arg(argp, void *);
if (type_dispatch[otype]) { if (type_dispatch[otype]) {
fprintf(ctx.cur, ", "); fprintf(ctx.cur, ", ");
type_dispatch[otype](&ctx, obj); 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"); fclose(ctx.cur);
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); }
} }

@ -33,8 +33,6 @@
#include <libweston/weston-log.h> #include <libweston/weston-log.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
extern int weston_timeline_enabled_;
enum timeline_type { enum timeline_type {
TLT_END = 0, TLT_END = 0,
TLT_OUTPUT, TLT_OUTPUT,
@ -71,12 +69,12 @@ struct weston_timeline_subscription_object {
#define TLP_VBLANK(t) TLT_VBLANK, TYPEVERIFY(const struct timespec *, (t)) #define TLP_VBLANK(t) TLT_VBLANK, TYPEVERIFY(const struct timespec *, (t))
#define TLP_GPU(t) TLT_GPU, TYPEVERIFY(const struct timespec *, (t)) #define TLP_GPU(t) TLT_GPU, TYPEVERIFY(const struct timespec *, (t))
#define TL_POINT(...) do { \ #define TL_POINT(ec, ...) do { \
if (weston_timeline_enabled_) \ weston_timeline_point(ec->timeline, __VA_ARGS__); \
weston_timeline_point(__VA_ARGS__); \
} while (0) } while (0)
void void
weston_timeline_point(const char *name, ...); weston_timeline_point(struct weston_log_scope *timeline_scope,
const char *name, ...);
#endif /* WESTON_TIMELINE_H */ #endif /* WESTON_TIMELINE_H */

Loading…
Cancel
Save