[client] egl: add graph tracking time taken to import frame

This tracks the time taken to load the frame buffer into an OpenGL texture.
This commit is contained in:
Quantum 2021-07-28 01:06:06 -04:00 committed by Geoffrey McRae
parent 552a37122a
commit 009ae02e32

View File

@ -103,6 +103,9 @@ struct Inst
bool hadOverlay; bool hadOverlay;
_Atomic(struct DesktopDamage *) desktopDamage; _Atomic(struct DesktopDamage *) desktopDamage;
RingBuffer importTimings;
GraphHandle importGraph;
}; };
static struct Option egl_options[] = 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); atomic_init(&this->desktopDamage, NULL);
this->importTimings = ringbuffer_new(256, sizeof(float));
this->importGraph = app_registerGraph("IMPORT", this->importTimings);
*needsOpenGL = false; *needsOpenGL = false;
return true; return true;
} }
@ -228,6 +234,9 @@ void egl_deinitialize(void * opaque)
if (this->imgui) if (this->imgui)
ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplOpenGL3_Shutdown();
app_unregisterGraph(this->importGraph);
ringbuffer_free(&this->importTimings);
egl_desktop_free(&this->desktop); egl_desktop_free(&this->desktop);
egl_cursor_free (&this->cursor); egl_cursor_free (&this->cursor);
egl_splash_free (&this->splash); 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; struct Inst * this = (struct Inst *)opaque;
uint64_t start = nanotime();
if (!egl_desktop_update(this->desktop, frame, dmaFd)) if (!egl_desktop_update(this->desktop, frame, dmaFd))
{ {
DEBUG_INFO("Failed to to update the desktop"); DEBUG_INFO("Failed to to update the desktop");
return false; return false;
} }
ringbuffer_push(this->importTimings, &(float){ (nanotime() - start) * 1e-6f });
this->start = true; this->start = true;