From 009ae02e32831d96332e2cd0ef20d8ab2800fa5d Mon Sep 17 00:00:00 2001 From: Quantum Date: Wed, 28 Jul 2021 01:06:06 -0400 Subject: [PATCH] [client] egl: add graph tracking time taken to import frame This tracks the time taken to load the frame buffer into an OpenGL texture. --- client/renderers/EGL/egl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index bdf4d0a4..36f07b54 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -103,6 +103,9 @@ struct Inst bool hadOverlay; _Atomic(struct DesktopDamage *) desktopDamage; + + RingBuffer importTimings; + GraphHandle importGraph; }; static struct Option egl_options[] = @@ -210,6 +213,9 @@ bool egl_create(void ** opaque, const LG_RendererParams params, bool * needsOpen atomic_init(&this->desktopDamage, NULL); + this->importTimings = ringbuffer_new(256, sizeof(float)); + this->importGraph = app_registerGraph("IMPORT", this->importTimings); + *needsOpenGL = false; return true; } @@ -228,6 +234,9 @@ void egl_deinitialize(void * opaque) if (this->imgui) ImGui_ImplOpenGL3_Shutdown(); + app_unregisterGraph(this->importGraph); + ringbuffer_free(&this->importTimings); + egl_desktop_free(&this->desktop); egl_cursor_free (&this->cursor); egl_splash_free (&this->splash); @@ -495,11 +504,13 @@ bool egl_on_frame(void * opaque, const FrameBuffer * frame, int dmaFd, { struct Inst * this = (struct Inst *)opaque; + uint64_t start = nanotime(); if (!egl_desktop_update(this->desktop, frame, dmaFd)) { DEBUG_INFO("Failed to to update the desktop"); return false; } + ringbuffer_push(this->importTimings, &(float){ (nanotime() - start) * 1e-6f }); this->start = true;