From 45ca284eeee7790663a10cc3b8af5ccf00ebb059 Mon Sep 17 00:00:00 2001 From: Rose Hudson Date: Fri, 2 Jun 2023 11:10:35 +0100 Subject: render/gles2: implement timer API --- include/render/gles2.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'include/render/gles2.h') diff --git a/include/render/gles2.h b/include/render/gles2.h index 619566fb..930cf07d 100644 --- a/include/render/gles2.h +++ b/include/render/gles2.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -14,6 +15,11 @@ #include #include +// mesa ships old GL headers that don't include this type, so for distros that use headers from +// mesa we need to def it ourselves until they update. +// https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23144 +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VEXTPROC) (GLenum pname, GLint64 *data); + struct wlr_gles2_pixel_format { uint32_t drm_format; // optional field, if empty then internalformat = format @@ -47,6 +53,7 @@ struct wlr_gles2_renderer { bool EXT_texture_type_2_10_10_10_REV; bool OES_texture_half_float_linear; bool EXT_texture_norm16; + bool EXT_disjoint_timer_query; } exts; struct { @@ -57,6 +64,12 @@ struct wlr_gles2_renderer { PFNGLPUSHDEBUGGROUPKHRPROC glPushDebugGroupKHR; PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES; PFNGLGETGRAPHICSRESETSTATUSKHRPROC glGetGraphicsResetStatusKHR; + PFNGLGENQUERIESEXTPROC glGenQueriesEXT; + PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT; + PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT; + PFNGLGETQUERYOBJECTIVEXTPROC glGetQueryObjectivEXT; + PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT; + PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT; } procs; struct { @@ -78,6 +91,15 @@ struct wlr_gles2_renderer { uint32_t viewport_width, viewport_height; }; +struct wlr_gles2_render_timer { + struct wlr_render_timer base; + struct wlr_gles2_renderer *renderer; + struct timespec cpu_start; + struct timespec cpu_end; + GLuint id; + GLint64 gl_cpu_end; +}; + struct wlr_gles2_buffer { struct wlr_buffer *buffer; struct wlr_gles2_renderer *renderer; @@ -116,6 +138,7 @@ struct wlr_gles2_render_pass { struct wlr_render_pass base; struct wlr_gles2_buffer *buffer; float projection_matrix[9]; + struct wlr_gles2_render_timer *timer; }; bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer, @@ -128,6 +151,8 @@ const uint32_t *get_gles2_shm_formats(const struct wlr_gles2_renderer *renderer, struct wlr_gles2_renderer *gles2_get_renderer( struct wlr_renderer *wlr_renderer); +struct wlr_gles2_render_timer *gles2_get_render_timer( + struct wlr_render_timer *timer); struct wlr_gles2_texture *gles2_get_texture( struct wlr_texture *wlr_texture); @@ -140,6 +165,7 @@ void push_gles2_debug_(struct wlr_gles2_renderer *renderer, #define push_gles2_debug(renderer) push_gles2_debug_(renderer, _WLR_FILENAME, __func__) void pop_gles2_debug(struct wlr_gles2_renderer *renderer); -struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *buffer); +struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *buffer, + struct wlr_gles2_render_timer *timer); #endif -- cgit v1.2.3