mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
cogl: Install cogl-trace.h and include from cogl.h
This is so that cogl-trace.h can start using things from cogl-macros.h, and so that it doesn't leak cogl-config.h into the world, while exposing it to e.g. gnome-shell so that it can make use of it as well. There is no practical reason why we shouldn't just include cogl-trace.h via cogl.h as we do with everything else. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1059
This commit is contained in:
parent
8699482475
commit
238e41d493
@ -29,10 +29,10 @@
|
||||
* of #ClutterMasterClock.
|
||||
*/
|
||||
|
||||
#include <cogl/cogl-trace.h>
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-master-clock-default.h"
|
||||
#include "clutter-debug.h"
|
||||
|
@ -78,7 +78,6 @@
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
struct _ClutterStageQueueRedrawEntry
|
||||
{
|
||||
|
@ -47,8 +47,6 @@
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-view-private.h"
|
||||
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
#define MAX_STACK_RECTS 256
|
||||
|
||||
typedef struct _ClutterStageViewCoglPrivate
|
||||
|
@ -46,3 +46,5 @@
|
||||
#mesondefine COGL_HAS_X11_SUPPORT
|
||||
#mesondefine COGL_HAS_XLIB
|
||||
#mesondefine COGL_HAS_XLIB_SUPPORT
|
||||
|
||||
#mesondefine COGL_HAS_TRACING
|
||||
|
@ -23,6 +23,8 @@
|
||||
#ifdef HAVE_TRACING
|
||||
|
||||
#include <sysprof-capture.h>
|
||||
#include <sysprof-capture-writer.h>
|
||||
#include <sysprof-clock.h>
|
||||
#include <syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
@ -30,6 +32,18 @@
|
||||
#define COGL_TRACE_OUTPUT_FILE "cogl-trace-sp-capture.syscap"
|
||||
#define BUFFER_LENGTH (4096 * 4)
|
||||
|
||||
struct _CoglTraceContext
|
||||
{
|
||||
SysprofCaptureWriter *writer;
|
||||
};
|
||||
|
||||
typedef struct _CoglTraceThreadContext
|
||||
{
|
||||
int cpu_id;
|
||||
GPid pid;
|
||||
char *group;
|
||||
} CoglTraceThreadContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fd;
|
||||
@ -228,6 +242,37 @@ cogl_set_tracing_disabled_on_thread (GMainContext *main_context)
|
||||
g_source_unref (source);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_trace_end (CoglTraceHead *head)
|
||||
{
|
||||
SysprofTimeStamp end_time;
|
||||
CoglTraceContext *trace_context;
|
||||
CoglTraceThreadContext *trace_thread_context;
|
||||
|
||||
end_time = g_get_monotonic_time () * 1000;
|
||||
trace_context = cogl_trace_context;
|
||||
trace_thread_context = g_private_get (&cogl_trace_thread_data);
|
||||
|
||||
g_mutex_lock (&cogl_trace_mutex);
|
||||
if (!sysprof_capture_writer_add_mark (trace_context->writer,
|
||||
head->begin_time,
|
||||
trace_thread_context->cpu_id,
|
||||
trace_thread_context->pid,
|
||||
(uint64_t) end_time - head->begin_time,
|
||||
trace_thread_context->group,
|
||||
head->name,
|
||||
NULL))
|
||||
{
|
||||
/* XXX: g_main_context_get_thread_default() might be wrong, it probably
|
||||
* needs to store the GMainContext in CoglTraceThreadContext when creating
|
||||
* and use it here.
|
||||
*/
|
||||
if (errno == EPIPE)
|
||||
cogl_set_tracing_disabled_on_thread (g_main_context_get_thread_default ());
|
||||
}
|
||||
g_mutex_unlock (&cogl_trace_mutex);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <string.h>
|
||||
|
@ -19,31 +19,20 @@
|
||||
#ifndef COGL_TRACE_H
|
||||
#define COGL_TRACE_H
|
||||
|
||||
#include "cogl-config.h"
|
||||
|
||||
#ifdef HAVE_TRACING
|
||||
|
||||
#include <glib.h>
|
||||
#include <sysprof-capture-writer.h>
|
||||
#include <sysprof-clock.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct _CoglTraceContext
|
||||
{
|
||||
SysprofCaptureWriter *writer;
|
||||
} CoglTraceContext;
|
||||
#include "cogl/cogl-defines.h"
|
||||
#include "cogl/cogl-macros.h"
|
||||
|
||||
typedef struct _CoglTraceThreadContext
|
||||
{
|
||||
int cpu_id;
|
||||
GPid pid;
|
||||
char *group;
|
||||
} CoglTraceThreadContext;
|
||||
#ifdef COGL_HAS_TRACING
|
||||
|
||||
typedef struct _CoglTraceContext CoglTraceContext;
|
||||
|
||||
typedef struct _CoglTraceHead
|
||||
{
|
||||
SysprofTimeStamp begin_time;
|
||||
uint64_t begin_time;
|
||||
const char *name;
|
||||
} CoglTraceHead;
|
||||
|
||||
@ -69,36 +58,8 @@ cogl_trace_begin (CoglTraceHead *head,
|
||||
head->name = name;
|
||||
}
|
||||
|
||||
static inline void
|
||||
cogl_trace_end (CoglTraceHead *head)
|
||||
{
|
||||
SysprofTimeStamp end_time;
|
||||
CoglTraceContext *trace_context;
|
||||
CoglTraceThreadContext *trace_thread_context;
|
||||
|
||||
end_time = g_get_monotonic_time () * 1000;
|
||||
trace_context = cogl_trace_context;
|
||||
trace_thread_context = g_private_get (&cogl_trace_thread_data);
|
||||
|
||||
g_mutex_lock (&cogl_trace_mutex);
|
||||
if (!sysprof_capture_writer_add_mark (trace_context->writer,
|
||||
head->begin_time,
|
||||
trace_thread_context->cpu_id,
|
||||
trace_thread_context->pid,
|
||||
(uint64_t) end_time - head->begin_time,
|
||||
trace_thread_context->group,
|
||||
head->name,
|
||||
NULL))
|
||||
{
|
||||
/* XXX: g_main_context_get_thread_default() might be wrong, it probably
|
||||
* needs to store the GMainContext in CoglTraceThreadContext when creating
|
||||
* and use it here.
|
||||
*/
|
||||
if (errno == EPIPE)
|
||||
cogl_set_tracing_disabled_on_thread (g_main_context_get_thread_default ());
|
||||
}
|
||||
g_mutex_unlock (&cogl_trace_mutex);
|
||||
}
|
||||
void
|
||||
cogl_trace_end (CoglTraceHead *head);
|
||||
|
||||
static inline void
|
||||
cogl_auto_trace_end_helper (CoglTraceHead **head)
|
||||
@ -126,7 +87,7 @@ cogl_auto_trace_end_helper (CoglTraceHead **head)
|
||||
ScopedCoglTrace##Name = &CoglTrace##Name; \
|
||||
}
|
||||
|
||||
#else /* HAVE_TRACING */
|
||||
#else /* COGL_HAS_TRACING */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -142,6 +103,6 @@ void cogl_set_tracing_enabled_on_thread (void *data,
|
||||
const char *filename);
|
||||
void cogl_set_tracing_disabled_on_thread (void *data);
|
||||
|
||||
#endif /* HAVE_TRACING */
|
||||
#endif /* COGL_HAS_TRACING */
|
||||
|
||||
#endif /* COGL_TRACE_H */
|
||||
|
@ -121,6 +121,7 @@
|
||||
#include <cogl/cogl-poll.h>
|
||||
#include <cogl/cogl-fence.h>
|
||||
#include <cogl/cogl-glib-source.h>
|
||||
#include <cogl/cogl-trace.h>
|
||||
/* XXX: This will definitly go away once all the Clutter winsys
|
||||
* code has been migrated down into Cogl! */
|
||||
#include <cogl/deprecated/cogl-clutter.h>
|
||||
|
@ -12,6 +12,7 @@ cdata.set('COGL_HAS_X11', have_x11)
|
||||
cdata.set('COGL_HAS_X11_SUPPORT', have_x11)
|
||||
cdata.set('COGL_HAS_XLIB', have_x11)
|
||||
cdata.set('COGL_HAS_XLIB_SUPPORT', have_x11)
|
||||
cdata.set('COGL_HAS_TRACING', have_profiler)
|
||||
|
||||
cogl_defines_h = configure_file(
|
||||
input: 'cogl-defines.h.meson',
|
||||
@ -89,6 +90,7 @@ cogl_headers = [
|
||||
'cogl-texture-2d.h',
|
||||
'cogl-texture-2d-sliced.h',
|
||||
'cogl-types.h',
|
||||
'cogl-trace.h',
|
||||
'cogl.h',
|
||||
]
|
||||
|
||||
@ -288,7 +290,6 @@ cogl_sources = [
|
||||
'cogl-blend-string.h',
|
||||
'cogl-debug.c',
|
||||
'cogl-trace.c',
|
||||
'cogl-trace.h',
|
||||
'cogl-sub-texture-private.h',
|
||||
'cogl-texture-private.h',
|
||||
'cogl-texture-2d-private.h',
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gunixfdlist.h>
|
||||
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
#define META_SYSPROF_PROFILER_DBUS_PATH "/org/gnome/Sysprof3/Profiler"
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "backends/native/meta-renderer-native.h"
|
||||
#include "backends/native/meta-seat-native.h"
|
||||
#include "backends/native/meta-stage-native.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/meta-border.h"
|
||||
#include "meta/main.h"
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "backends/native/meta-kms-impl-simple.h"
|
||||
#include "backends/native/meta-kms-update-private.h"
|
||||
#include "backends/native/meta-udev.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
/**
|
||||
* SECTION:kms
|
||||
|
@ -69,9 +69,8 @@
|
||||
#include "backends/native/meta-output-kms.h"
|
||||
#include "backends/native/meta-renderer-native-gles3.h"
|
||||
#include "backends/native/meta-renderer-native.h"
|
||||
//#include "cogl/cogl-framebuffer.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "cogl/cogl-framebuffer.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "core/boxes-private.h"
|
||||
|
||||
#ifndef EGL_DRM_MASTER_FD_EXT
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "backends/x11/meta-event-x11.h"
|
||||
#include "backends/x11/meta-stage-x11.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "compositor/meta-window-actor-x11.h"
|
||||
#include "compositor/meta-window-actor-wayland.h"
|
||||
#include "compositor/meta-window-actor-private.h"
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "compositor/compositor-private.h"
|
||||
#include "compositor/meta-compositor-x11.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/bell.h"
|
||||
#include "core/boxes-private.h"
|
||||
#include "core/display-private.h"
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "core/stack.h"
|
||||
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/frame.h"
|
||||
#include "core/main-private.h"
|
||||
#include "core/meta-workspace-manager-private.h"
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <X11/Xutil.h> /* Just for the definition of the various gravities */
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "meta/common.h"
|
||||
#include "meta/main.h"
|
||||
|
||||
@ -769,7 +769,7 @@ destroy_later (MetaLater *later)
|
||||
unref_later (later);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TRACING
|
||||
#ifdef COGL_HAS_TRACING
|
||||
static const char *
|
||||
later_type_to_string (MetaLaterType when)
|
||||
{
|
||||
|
@ -67,7 +67,7 @@
|
||||
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/boxes-private.h"
|
||||
#include "core/constraints.h"
|
||||
#include "core/edge-resistance.h"
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/boxes-private.h"
|
||||
#include "core/meta-workspace-manager-private.h"
|
||||
#include "core/workspace-private.h"
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "clutter/wayland/clutter-wayland-compositor.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl-wayland-server.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "compositor/meta-surface-actor-wayland.h"
|
||||
#include "compositor/meta-surface-actor.h"
|
||||
#include "compositor/meta-window-actor-private.h"
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "compositor/meta-compositor-x11.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/bell.h"
|
||||
#include "core/display-private.h"
|
||||
#include "core/meta-workspace-manager-private.h"
|
||||
|
Loading…
Reference in New Issue
Block a user