mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
cogl: Store CPU and GPU rendering timestamps in frame info
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1762>
This commit is contained in:
parent
8c258d1de1
commit
f1024564a2
@ -126,7 +126,8 @@ cogl_frame_info_get_rendering_duration_ns (CoglFrameInfo *info)
|
|||||||
{
|
{
|
||||||
int64_t gpu_time_rendering_done_ns;
|
int64_t gpu_time_rendering_done_ns;
|
||||||
|
|
||||||
if (!info->timestamp_query)
|
if (!info->timestamp_query ||
|
||||||
|
info->gpu_time_before_buffer_swap_ns == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
gpu_time_rendering_done_ns =
|
gpu_time_rendering_done_ns =
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "winsys/cogl-onscreen-egl.h"
|
#include "winsys/cogl-onscreen-egl.h"
|
||||||
|
|
||||||
#include "cogl-context-private.h"
|
#include "cogl-context-private.h"
|
||||||
|
#include "cogl-frame-info-private.h"
|
||||||
#include "cogl-renderer-private.h"
|
#include "cogl-renderer-private.h"
|
||||||
#include "cogl-trace.h"
|
#include "cogl-trace.h"
|
||||||
#include "winsys/cogl-winsys-egl-private.h"
|
#include "winsys/cogl-winsys-egl-private.h"
|
||||||
@ -269,6 +270,21 @@ cogl_onscreen_egl_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||||||
COGL_FRAMEBUFFER (onscreen),
|
COGL_FRAMEBUFFER (onscreen),
|
||||||
COGL_FRAMEBUFFER_STATE_BIND);
|
COGL_FRAMEBUFFER_STATE_BIND);
|
||||||
|
|
||||||
|
if (cogl_has_feature (context, COGL_FEATURE_ID_GET_GPU_TIME))
|
||||||
|
{
|
||||||
|
info->gpu_time_before_buffer_swap_ns =
|
||||||
|
cogl_context_get_gpu_time_ns (context);
|
||||||
|
}
|
||||||
|
|
||||||
|
info->cpu_time_before_buffer_swap_us = g_get_monotonic_time ();
|
||||||
|
|
||||||
|
/* Set up a timestamp query for when all rendering will be finished. */
|
||||||
|
if (cogl_has_feature (context, COGL_FEATURE_ID_TIMESTAMP_QUERY))
|
||||||
|
{
|
||||||
|
info->timestamp_query =
|
||||||
|
cogl_framebuffer_create_timestamp_query (COGL_FRAMEBUFFER (onscreen));
|
||||||
|
}
|
||||||
|
|
||||||
if (n_rectangles && egl_renderer->pf_eglSwapBuffersWithDamage)
|
if (n_rectangles && egl_renderer->pf_eglSwapBuffersWithDamage)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
|
Loading…
Reference in New Issue
Block a user