mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 04:40:07 +01:00
timeline: Make an enum for the timepoint strings
I'll be adding perfetto instrumentation, which will want to know the timepoint name without having to parse it. For now, just pass an enum and add a helper function to convert to strings. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
0c31f7dfd2
commit
5d51042e6b
4 changed files with 60 additions and 15 deletions
|
|
@ -3391,7 +3391,7 @@ paint_node_flush_surface_damage(struct weston_paint_node *pnode)
|
|||
if (!pixman_region32_not_empty(&surface->damage))
|
||||
return;
|
||||
|
||||
TL_POINT(surface->compositor, "core_flush_damage",
|
||||
TL_POINT(surface->compositor, TLP_CORE_FLUSH_DAMAGE,
|
||||
TLP_SURFACE(surface), TLP_OUTPUT(output), TLP_END);
|
||||
|
||||
wl_list_for_each(walk_node, &surface->paint_node_list, surface_link) {
|
||||
|
|
@ -3727,7 +3727,7 @@ weston_output_schedule_repaint_reset(struct weston_output *output)
|
|||
{
|
||||
weston_output_put_back_feedback_list(output);
|
||||
output->repaint_status = REPAINT_NOT_SCHEDULED;
|
||||
TL_POINT(output->compositor, "core_repaint_exit_loop",
|
||||
TL_POINT(output->compositor, TLP_CORE_REPAINT_EXIT_LOOP,
|
||||
TLP_OUTPUT(output), TLP_END);
|
||||
}
|
||||
|
||||
|
|
@ -3743,7 +3743,7 @@ weston_output_repaint(struct weston_output *output, struct timespec *now)
|
|||
uint32_t frame_time_msec;
|
||||
enum weston_hdcp_protection highest_requested = WESTON_HDCP_DISABLE;
|
||||
|
||||
TL_POINT(ec, "core_repaint_begin", TLP_OUTPUT(output), TLP_END);
|
||||
TL_POINT(ec, TLP_CORE_REPAINT_BEGIN, TLP_OUTPUT(output), TLP_END);
|
||||
|
||||
/* Rebuild the surface list and update surface transforms up front. */
|
||||
if (ec->view_list_needs_rebuild)
|
||||
|
|
@ -3850,7 +3850,7 @@ weston_output_repaint(struct weston_output *output, struct timespec *now)
|
|||
|
||||
weston_output_capture_info_repaint_done(output->capture_info);
|
||||
|
||||
TL_POINT(ec, "core_repaint_posted", TLP_OUTPUT(output), TLP_END);
|
||||
TL_POINT(ec, TLP_CORE_REPAINT_POSTED, TLP_OUTPUT(output), TLP_END);
|
||||
|
||||
/* If repaint fails, we aren't going to get weston_output_finish_frame
|
||||
* to trigger a new repaint, so drop it from repaint and hope
|
||||
|
|
@ -3953,7 +3953,7 @@ weston_output_schedule_repaint_restart(struct weston_output *output)
|
|||
timespec_add_nsec(&output->next_repaint, &output->next_repaint,
|
||||
millihz_to_nsec(output->current_mode->refresh));
|
||||
output->repaint_status = REPAINT_SCHEDULED;
|
||||
TL_POINT(output->compositor, "core_repaint_restart",
|
||||
TL_POINT(output->compositor, TLP_CORE_REPAINT_RESTART,
|
||||
TLP_OUTPUT(output), TLP_END);
|
||||
output_repaint_timer_arm(output->compositor);
|
||||
weston_output_damage(output);
|
||||
|
|
@ -4100,7 +4100,7 @@ weston_output_finish_frame(struct weston_output *output,
|
|||
vblank_monotonic = convert_presentation_time_now(compositor,
|
||||
stamp, &now,
|
||||
CLOCK_MONOTONIC);
|
||||
TL_POINT(compositor, "core_repaint_finished", TLP_OUTPUT(output),
|
||||
TL_POINT(compositor, TLP_CORE_REPAINT_FINISHED, TLP_OUTPUT(output),
|
||||
TLP_VBLANK(&vblank_monotonic), TLP_END);
|
||||
|
||||
refresh_nsec = millihz_to_nsec(output->current_mode->refresh);
|
||||
|
|
@ -4385,7 +4385,7 @@ weston_output_schedule_repaint(struct weston_output *output)
|
|||
return;
|
||||
|
||||
if (!output->repaint_needed)
|
||||
TL_POINT(compositor, "core_repaint_req", TLP_OUTPUT(output), TLP_END);
|
||||
TL_POINT(compositor, TLP_CORE_REPAINT_REQ, TLP_OUTPUT(output), TLP_END);
|
||||
|
||||
loop = wl_display_get_event_loop(compositor->wl_display);
|
||||
output->repaint_needed = true;
|
||||
|
|
@ -4401,7 +4401,7 @@ weston_output_schedule_repaint(struct weston_output *output)
|
|||
assert(!output->idle_repaint_source);
|
||||
output->idle_repaint_source = wl_event_loop_add_idle(loop, idle_repaint,
|
||||
output);
|
||||
TL_POINT(compositor, "core_repaint_enter_loop", TLP_OUTPUT(output), TLP_END);
|
||||
TL_POINT(compositor, TLP_CORE_REPAINT_ENTER_LOOP, TLP_OUTPUT(output), TLP_END);
|
||||
}
|
||||
|
||||
/** weston_compositor_schedule_repaint
|
||||
|
|
@ -4842,7 +4842,7 @@ weston_surface_commit_state(struct weston_surface *surface,
|
|||
/* wl_surface.damage and wl_surface.damage_buffer; only valid
|
||||
* in the same cycle as wl_surface.commit */
|
||||
if (status & WESTON_SURFACE_DIRTY_BUFFER) {
|
||||
TL_POINT(surface->compositor, "core_commit_damage",
|
||||
TL_POINT(surface->compositor, TLP_CORE_COMMIT_DAMAGE,
|
||||
TLP_SURFACE(surface), TLP_END);
|
||||
|
||||
pixman_region32_union(&surface->damage, &surface->damage,
|
||||
|
|
|
|||
|
|
@ -573,9 +573,9 @@ timeline_render_point_handler(int fd, uint32_t mask, void *data)
|
|||
&elapsed);
|
||||
timespec_add_nsec(&begin, &end, -elapsed);
|
||||
|
||||
TL_POINT(trp->output->compositor, "renderer_gpu_begin",
|
||||
TL_POINT(trp->output->compositor, TLP_RENDERER_GPU_BEGIN,
|
||||
TLP_GPU(&begin), TLP_OUTPUT(trp->output), TLP_END);
|
||||
TL_POINT(trp->output->compositor, "renderer_gpu_end",
|
||||
TL_POINT(trp->output->compositor, TLP_RENDERER_GPU_END,
|
||||
TLP_GPU(&end), TLP_OUTPUT(trp->output), TLP_END);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -394,6 +394,36 @@ static const type_func type_dispatch[] = {
|
|||
[TLT_GPU] = emit_gpu_timestamp,
|
||||
};
|
||||
|
||||
static const char *
|
||||
tlp_to_string(enum timeline_point_name tlp)
|
||||
{
|
||||
switch (tlp) {
|
||||
case TLP_CORE_FLUSH_DAMAGE:
|
||||
return "core_flush_damage";
|
||||
case TLP_CORE_REPAINT_EXIT_LOOP:
|
||||
return "core_repaint_exit_loop";
|
||||
case TLP_CORE_REPAINT_BEGIN:
|
||||
return "core_repaint_begin";
|
||||
case TLP_CORE_REPAINT_POSTED:
|
||||
return "core_repaint_posted";
|
||||
case TLP_CORE_REPAINT_RESTART:
|
||||
return "core_repaint_restart";
|
||||
case TLP_CORE_REPAINT_FINISHED:
|
||||
return "core_repaint_finished";
|
||||
case TLP_CORE_REPAINT_REQ:
|
||||
return "core_repaint_req";
|
||||
case TLP_CORE_REPAINT_ENTER_LOOP:
|
||||
return "core_repaint_enter_loop";
|
||||
case TLP_CORE_COMMIT_DAMAGE:
|
||||
return "core_commit_damage";
|
||||
case TLP_RENDERER_GPU_BEGIN:
|
||||
return "renderer_gpu_begin";
|
||||
case TLP_RENDERER_GPU_END:
|
||||
return "renderer_gpu_end";
|
||||
}
|
||||
assert(!"not reached");
|
||||
}
|
||||
|
||||
/** Disseminates the message to all subscriptions of the scope \c
|
||||
* timeline_scope
|
||||
*
|
||||
|
|
@ -401,20 +431,21 @@ static const type_func type_dispatch[] = {
|
|||
* instance to pass the timeline scope.
|
||||
*
|
||||
* @param timeline_scope the timeline scope
|
||||
* @param name the name of the timeline point. Interpretable by the tool reading
|
||||
* @param tlp_name the name of the timeline point. Interpretable by the tool reading
|
||||
* the output (wesgr).
|
||||
*
|
||||
* @ingroup log
|
||||
*/
|
||||
WL_EXPORT void
|
||||
weston_timeline_point(struct weston_log_scope *timeline_scope,
|
||||
const char *name, ...)
|
||||
enum timeline_point_name tlp_name, ...)
|
||||
{
|
||||
struct timespec ts;
|
||||
enum timeline_type otype;
|
||||
void *obj;
|
||||
char buf[512];
|
||||
struct weston_log_subscription *sub = NULL;
|
||||
const char *name = tlp_to_string(tlp_name);
|
||||
|
||||
if (!weston_log_scope_is_enabled(timeline_scope))
|
||||
return;
|
||||
|
|
@ -437,7 +468,7 @@ weston_timeline_point(struct weston_log_scope *timeline_scope,
|
|||
fprintf(ctx.cur, "{ \"T\":[%" PRId64 ", %ld], \"N\":\"%s\"",
|
||||
(int64_t)ts.tv_sec, ts.tv_nsec, name);
|
||||
|
||||
va_start(argp, name);
|
||||
va_start(argp, tlp_name);
|
||||
while (1) {
|
||||
otype = va_arg(argp, enum timeline_type);
|
||||
if (otype == TLT_END)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,20 @@ enum timeline_type {
|
|||
TLT_GPU,
|
||||
};
|
||||
|
||||
enum timeline_point_name {
|
||||
TLP_CORE_FLUSH_DAMAGE,
|
||||
TLP_CORE_REPAINT_EXIT_LOOP,
|
||||
TLP_CORE_REPAINT_BEGIN,
|
||||
TLP_CORE_REPAINT_POSTED,
|
||||
TLP_CORE_REPAINT_RESTART,
|
||||
TLP_CORE_REPAINT_FINISHED,
|
||||
TLP_CORE_REPAINT_REQ,
|
||||
TLP_CORE_REPAINT_ENTER_LOOP,
|
||||
TLP_CORE_COMMIT_DAMAGE,
|
||||
TLP_RENDERER_GPU_BEGIN,
|
||||
TLP_RENDERER_GPU_END
|
||||
};
|
||||
|
||||
/** Timeline subscription created for each subscription
|
||||
*
|
||||
* Created automatically by weston_log_scope::new_subscription and
|
||||
|
|
@ -95,6 +109,6 @@ struct weston_timeline_subscription_object {
|
|||
|
||||
void
|
||||
weston_timeline_point(struct weston_log_scope *timeline_scope,
|
||||
const char *name, ...);
|
||||
enum timeline_point_name tlp_name, ...);
|
||||
|
||||
#endif /* WESTON_TIMELINE_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue