Merge branch 'frame-scheduler-helper' into 'master'

Draft: render: add frame scheduler helper

See merge request wlroots/wlroots!3783
This commit is contained in:
Simon Ser 2022-11-14 17:37:40 +00:00
commit e7737537ef
13 changed files with 479 additions and 7 deletions

View file

@ -48,6 +48,8 @@ struct wlr_renderer_impl {
uint32_t (*get_render_buffer_caps)(struct wlr_renderer *renderer);
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,
@ -62,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

@ -14,6 +14,8 @@
#include <wlr/backend.h>
#include <wlr/render/wlr_texture.h>
struct timespec;
struct wlr_renderer_impl;
struct wlr_drm_format_set;
struct wlr_buffer;
@ -112,6 +114,20 @@ bool wlr_renderer_init_wl_shm(struct wlr_renderer *r,
*/
int wlr_renderer_get_drm_fd(struct wlr_renderer *r);
/**
* Get the current GPU time.
*/
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.
*