libweston: Clean-up timeline to make room for a new approach
With it this removes the parts responsible for creating the file, timeline_log class, removes the debug key binding when creating the compositor instace, keeping only what can be re-used. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
+3
-21
@@ -2368,8 +2368,7 @@ surface_flush_damage(struct weston_surface *surface)
|
|||||||
wl_shm_buffer_get(surface->buffer_ref.buffer->resource))
|
wl_shm_buffer_get(surface->buffer_ref.buffer->resource))
|
||||||
surface->compositor->renderer->flush_damage(surface);
|
surface->compositor->renderer->flush_damage(surface);
|
||||||
|
|
||||||
if (weston_timeline_enabled_ &&
|
if (pixman_region32_not_empty(&surface->damage))
|
||||||
pixman_region32_not_empty(&surface->damage))
|
|
||||||
TL_POINT("core_flush_damage", TLP_SURFACE(surface),
|
TL_POINT("core_flush_damage", TLP_SURFACE(surface),
|
||||||
TLP_OUTPUT(surface->output), TLP_END);
|
TLP_OUTPUT(surface->output), TLP_END);
|
||||||
|
|
||||||
@@ -3528,9 +3527,8 @@ weston_surface_commit_state(struct weston_surface *surface,
|
|||||||
state->buffer_viewport.changed = 0;
|
state->buffer_viewport.changed = 0;
|
||||||
|
|
||||||
/* wl_surface.damage and wl_surface.damage_buffer */
|
/* wl_surface.damage and wl_surface.damage_buffer */
|
||||||
if (weston_timeline_enabled_ &&
|
if (pixman_region32_not_empty(&state->damage_surface) ||
|
||||||
(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("core_commit_damage", TLP_SURFACE(surface), TLP_END);
|
||||||
|
|
||||||
pixman_region32_union(&surface->damage, &surface->damage,
|
pixman_region32_union(&surface->damage, &surface->damage,
|
||||||
@@ -6919,19 +6917,6 @@ weston_environment_get_fd(const char *env)
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
timeline_key_binding_handler(struct weston_keyboard *keyboard,
|
|
||||||
const struct timespec *time, uint32_t key,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
struct weston_compositor *compositor = data;
|
|
||||||
|
|
||||||
if (weston_timeline_enabled_)
|
|
||||||
weston_timeline_close();
|
|
||||||
else
|
|
||||||
weston_timeline_open(compositor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
output_repaint_status_text(struct weston_output *output)
|
output_repaint_status_text(struct weston_output *output)
|
||||||
{
|
{
|
||||||
@@ -7303,9 +7288,6 @@ weston_compositor_create(struct wl_display *display,
|
|||||||
weston_layer_set_position(&ec->cursor_layer,
|
weston_layer_set_position(&ec->cursor_layer,
|
||||||
WESTON_LAYER_POSITION_CURSOR);
|
WESTON_LAYER_POSITION_CURSOR);
|
||||||
|
|
||||||
weston_compositor_add_debug_binding(ec, KEY_T,
|
|
||||||
timeline_key_binding_handler, ec);
|
|
||||||
|
|
||||||
ec->debug_scene =
|
ec->debug_scene =
|
||||||
weston_compositor_add_log_scope(ec->weston_log_ctx, "scene-graph",
|
weston_compositor_add_log_scope(ec->weston_log_ctx, "scene-graph",
|
||||||
"Scene graph details\n",
|
"Scene graph details\n",
|
||||||
|
|||||||
@@ -287,8 +287,7 @@ timeline_submit_render_sync(struct gl_renderer *gr,
|
|||||||
int fd;
|
int fd;
|
||||||
struct timeline_render_point *trp;
|
struct timeline_render_point *trp;
|
||||||
|
|
||||||
if (!weston_timeline_enabled_ ||
|
if (!gr->has_native_fence_sync ||
|
||||||
!gr->has_native_fence_sync ||
|
|
||||||
sync == EGL_NO_SYNC_KHR)
|
sync == EGL_NO_SYNC_KHR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
+2
-85
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2014 Pekka Paalanen <pq@iki.fi>
|
* Copyright © 2014 Pekka Paalanen <pq@iki.fi>
|
||||||
* Copyright © 2014 Collabora, Ltd.
|
* Copyright © 2014, 2019 Collabora, Ltd.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
* a copy of this software and associated documentation files (the
|
* a copy of this software and associated documentation files (the
|
||||||
@@ -34,87 +34,8 @@
|
|||||||
|
|
||||||
#include "timeline.h"
|
#include "timeline.h"
|
||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include "shared/file-util.h"
|
|
||||||
|
|
||||||
struct timeline_log {
|
|
||||||
clock_t clk_id;
|
|
||||||
FILE *file;
|
|
||||||
unsigned series;
|
|
||||||
struct wl_listener compositor_destroy_listener;
|
|
||||||
};
|
|
||||||
|
|
||||||
WL_EXPORT int weston_timeline_enabled_;
|
WL_EXPORT int weston_timeline_enabled_;
|
||||||
static struct timeline_log timeline_ = { CLOCK_MONOTONIC, NULL, 0 };
|
|
||||||
|
|
||||||
static int
|
|
||||||
weston_timeline_do_open(void)
|
|
||||||
{
|
|
||||||
const char *prefix = "weston-timeline-";
|
|
||||||
const char *suffix = ".log";
|
|
||||||
char fname[1000];
|
|
||||||
|
|
||||||
timeline_.file = file_create_dated(NULL, prefix, suffix,
|
|
||||||
fname, sizeof(fname));
|
|
||||||
if (!timeline_.file) {
|
|
||||||
const char *msg;
|
|
||||||
|
|
||||||
switch (errno) {
|
|
||||||
case ETIME:
|
|
||||||
msg = "failure in datetime formatting";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
msg = strerror(errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
weston_log("Cannot open '%s*%s' for writing: %s\n",
|
|
||||||
prefix, suffix, msg);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
weston_log("Opened timeline file '%s'\n", fname);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
timeline_notify_destroy(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
weston_timeline_close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
weston_timeline_open(struct weston_compositor *compositor)
|
|
||||||
{
|
|
||||||
if (weston_timeline_enabled_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (weston_timeline_do_open() < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
timeline_.compositor_destroy_listener.notify = timeline_notify_destroy;
|
|
||||||
wl_signal_add(&compositor->destroy_signal,
|
|
||||||
&timeline_.compositor_destroy_listener);
|
|
||||||
|
|
||||||
if (++timeline_.series == 0)
|
|
||||||
++timeline_.series;
|
|
||||||
|
|
||||||
weston_timeline_enabled_ = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
weston_timeline_close(void)
|
|
||||||
{
|
|
||||||
if (!weston_timeline_enabled_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
weston_timeline_enabled_ = 0;
|
|
||||||
|
|
||||||
wl_list_remove(&timeline_.compositor_destroy_listener.link);
|
|
||||||
|
|
||||||
fclose(timeline_.file);
|
|
||||||
timeline_.file = NULL;
|
|
||||||
weston_log("Timeline log file closed.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timeline_emit_context {
|
struct timeline_emit_context {
|
||||||
FILE *cur;
|
FILE *cur;
|
||||||
@@ -262,15 +183,12 @@ weston_timeline_point(const char *name, ...)
|
|||||||
char buf[512];
|
char buf[512];
|
||||||
struct timeline_emit_context ctx;
|
struct timeline_emit_context ctx;
|
||||||
|
|
||||||
clock_gettime(timeline_.clk_id, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
ctx.out = timeline_.file;
|
|
||||||
ctx.cur = fmemopen(buf, sizeof(buf), "w");
|
ctx.cur = fmemopen(buf, sizeof(buf), "w");
|
||||||
ctx.series = timeline_.series;
|
|
||||||
|
|
||||||
if (!ctx.cur) {
|
if (!ctx.cur) {
|
||||||
weston_log("Timeline error in fmemopen, closing.\n");
|
weston_log("Timeline error in fmemopen, closing.\n");
|
||||||
weston_timeline_close();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +213,6 @@ weston_timeline_point(const char *name, ...)
|
|||||||
fflush(ctx.cur);
|
fflush(ctx.cur);
|
||||||
if (ferror(ctx.cur)) {
|
if (ferror(ctx.cur)) {
|
||||||
weston_log("Timeline error in constructing entry, closing.\n");
|
weston_log("Timeline error in constructing entry, closing.\n");
|
||||||
weston_timeline_close();
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(ctx.out, "%s", buf);
|
fprintf(ctx.out, "%s", buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2014 Pekka Paalanen <pq@iki.fi>
|
* Copyright © 2014 Pekka Paalanen <pq@iki.fi>
|
||||||
* Copyright © 2014 Collabora, Ltd.
|
* Copyright © 2014, 2019 Collabora, Ltd.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
* a copy of this software and associated documentation files (the
|
* a copy of this software and associated documentation files (the
|
||||||
@@ -29,14 +29,6 @@
|
|||||||
|
|
||||||
extern int weston_timeline_enabled_;
|
extern int weston_timeline_enabled_;
|
||||||
|
|
||||||
struct weston_compositor;
|
|
||||||
|
|
||||||
void
|
|
||||||
weston_timeline_open(struct weston_compositor *compositor);
|
|
||||||
|
|
||||||
void
|
|
||||||
weston_timeline_close(void);
|
|
||||||
|
|
||||||
enum timeline_type {
|
enum timeline_type {
|
||||||
TLT_END = 0,
|
TLT_END = 0,
|
||||||
TLT_OUTPUT,
|
TLT_OUTPUT,
|
||||||
|
|||||||
@@ -124,10 +124,9 @@ Rotate the window (if supported)
|
|||||||
.SS DEBUG BINDINGS
|
.SS DEBUG BINDINGS
|
||||||
The combination \fBmod + Shift + Space\fR begins a debug binding. Debug
|
The combination \fBmod + Shift + Space\fR begins a debug binding. Debug
|
||||||
bindings are completed by pressing an additional key. For example, pressing
|
bindings are completed by pressing an additional key. For example, pressing
|
||||||
T next may toggle timeline recording, and F may toggle texture mesh
|
F may toggle texture mesh wireframes with the GL renderer.
|
||||||
wireframes with the GL renderer. (In fact, most debug effects can be
|
(In fact, most debug effects can be disabled again by repeating the command.)
|
||||||
disabled again by repeating the command.) Debug bindings are often tied to
|
Debug bindings are often tied to specific backends.
|
||||||
specific backends.
|
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR weston (1),
|
.BR weston (1),
|
||||||
|
|||||||
Reference in New Issue
Block a user