mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 09:20:08 +01:00
timeline: Add weston_timeline_profiling() and use it
When we use perfetto, we'll want to enable the renderer timepoints, which are currently gated behind weston_log_scope_is_enabled(). So let's make a function that checks if either the timeline scope or perfetto is enabled. We do not yet process these timepoints, that comes in a future commit. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
da1dca9d77
commit
b3635c17f4
3 changed files with 28 additions and 3 deletions
|
|
@ -525,7 +525,7 @@ static void
|
||||||
timeline_begin_render_query(struct gl_renderer *gr, GLuint query)
|
timeline_begin_render_query(struct gl_renderer *gr, GLuint query)
|
||||||
{
|
{
|
||||||
if (gl_features_has(gr, FEATURE_GPU_TIMELINE) &&
|
if (gl_features_has(gr, FEATURE_GPU_TIMELINE) &&
|
||||||
weston_log_scope_is_enabled(gr->compositor->timeline))
|
weston_timeline_profiling(gr->compositor->timeline))
|
||||||
gr->begin_query(GL_TIME_ELAPSED_EXT, query);
|
gr->begin_query(GL_TIME_ELAPSED_EXT, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,7 +533,7 @@ static void
|
||||||
timeline_end_render_query(struct gl_renderer *gr)
|
timeline_end_render_query(struct gl_renderer *gr)
|
||||||
{
|
{
|
||||||
if (gl_features_has(gr, FEATURE_GPU_TIMELINE) &&
|
if (gl_features_has(gr, FEATURE_GPU_TIMELINE) &&
|
||||||
weston_log_scope_is_enabled(gr->compositor->timeline))
|
weston_timeline_profiling(gr->compositor->timeline))
|
||||||
gr->end_query(GL_TIME_ELAPSED_EXT);
|
gr->end_query(GL_TIME_ELAPSED_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -608,7 +608,7 @@ timeline_submit_render_sync(struct gl_renderer *gr,
|
||||||
struct timeline_render_point *trp;
|
struct timeline_render_point *trp;
|
||||||
|
|
||||||
if (!gl_features_has(gr, FEATURE_GPU_TIMELINE) ||
|
if (!gl_features_has(gr, FEATURE_GPU_TIMELINE) ||
|
||||||
!weston_log_scope_is_enabled(gr->compositor->timeline) ||
|
!weston_timeline_profiling(gr->compositor->timeline) ||
|
||||||
sync == EGL_NO_SYNC_KHR)
|
sync == EGL_NO_SYNC_KHR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#include <libweston/weston-log.h>
|
#include <libweston/weston-log.h>
|
||||||
#include "timeline.h"
|
#include "timeline.h"
|
||||||
#include "weston-log-internal.h"
|
#include "weston-log-internal.h"
|
||||||
|
#include "weston-trace.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timeline itself is not a subscriber but a scope (a producer of data), and it
|
* Timeline itself is not a subscriber but a scope (a producer of data), and it
|
||||||
|
|
@ -494,3 +495,24 @@ weston_timeline_point(struct weston_log_scope *timeline_scope,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check if weston is tracing performance events
|
||||||
|
*
|
||||||
|
* @param timeline_scope the timeline scope
|
||||||
|
*
|
||||||
|
* Returns true if weston is generating performance events for either perfetto
|
||||||
|
* or the timeline log scope.
|
||||||
|
*
|
||||||
|
* @ingroup log
|
||||||
|
*/
|
||||||
|
WL_EXPORT bool
|
||||||
|
weston_timeline_profiling(struct weston_log_scope *timeline_scope)
|
||||||
|
{
|
||||||
|
if (weston_log_scope_is_enabled(timeline_scope))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (util_perfetto_is_tracing_enabled())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,4 +111,7 @@ void
|
||||||
weston_timeline_point(struct weston_log_scope *timeline_scope,
|
weston_timeline_point(struct weston_log_scope *timeline_scope,
|
||||||
enum timeline_point_name tlp_name, ...);
|
enum timeline_point_name tlp_name, ...);
|
||||||
|
|
||||||
|
bool
|
||||||
|
weston_timeline_profiling(struct weston_log_scope *timeline_scope);
|
||||||
|
|
||||||
#endif /* WESTON_TIMELINE_H */
|
#endif /* WESTON_TIMELINE_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue