render: add wlr_render_timestamp

This commit is contained in:
Simon Ser 2022-09-23 22:47:59 +02:00
parent b4765809b5
commit c38c080742
5 changed files with 146 additions and 0 deletions

View file

@ -63,6 +63,10 @@ struct wlr_gles2_renderer {
PFNGLPUSHDEBUGGROUPKHRPROC glPushDebugGroupKHR;
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES;
PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT;
PFNGLGENQUERIESEXTPROC glGenQueriesEXT;
PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT;
PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT;
PFNGLGETQUERYOBJECTI64VEXTPROC glGetQueryObjecti64vEXT;
} procs;
struct {
@ -118,6 +122,12 @@ struct wlr_gles2_texture {
struct wlr_addon buffer_addon;
};
struct wlr_gles2_timestamp {
struct wlr_render_timestamp base;
struct wlr_gles2_renderer *renderer;
GLuint query;
};
bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
const struct wlr_gles2_pixel_format *format);

View file

@ -49,6 +49,7 @@ struct wlr_renderer_impl {
struct wlr_texture *(*texture_from_buffer)(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);
bool (*get_time)(struct wlr_renderer *r, struct timespec *t);
struct wlr_render_timestamp *(*create_timestamp)(struct wlr_renderer *r);
};
void wlr_renderer_init(struct wlr_renderer *renderer,
@ -63,4 +64,17 @@ struct wlr_texture_impl {
void wlr_texture_init(struct wlr_texture *texture,
const struct wlr_texture_impl *impl, uint32_t width, uint32_t height);
struct wlr_render_timestamp {
const struct wlr_render_timestamp_impl *impl;
};
struct wlr_render_timestamp_impl {
void (*destroy)(struct wlr_render_timestamp *timestamp);
bool (*get_time)(struct wlr_render_timestamp *timestamp,
struct timespec *t);
};
void wlr_render_timestamp_init(struct wlr_render_timestamp *timestamp,
const struct wlr_render_timestamp_impl *impl);
#endif

View file

@ -119,6 +119,15 @@ int wlr_renderer_get_drm_fd(struct wlr_renderer *r);
*/
bool wlr_renderer_get_time(struct wlr_renderer *r, struct timespec *t);
struct wlr_render_timestamp;
struct wlr_render_timestamp *wlr_renderer_create_timestamp(struct wlr_renderer *r);
bool wlr_render_timestamp_get_time(struct wlr_render_timestamp *timestamp,
struct timespec *t);
void wlr_render_timestamp_destroy(struct wlr_render_timestamp *timestamp);
/**
* Destroys the renderer.
*