diff options
author | emersion <contact@emersion.fr> | 2018-01-21 00:06:35 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-01-21 00:06:35 +0100 |
commit | 0365b587f03411d6a55017e111a991d466decc35 (patch) | |
tree | 8d4668c9c51e60535b560a3f3e367fc421c9b72b /include | |
parent | 78c13ead163e76b1c0ff344eefeadcaeffb3890e (diff) |
output: add damage tracking via buffer age
Diffstat (limited to 'include')
-rw-r--r-- | include/backend/drm/renderer.h | 2 | ||||
-rw-r--r-- | include/rootston/output.h | 7 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_output.h | 4 | ||||
-rw-r--r-- | include/wlr/render/egl.h | 14 | ||||
-rw-r--r-- | include/wlr/types/wlr_output.h | 14 |
5 files changed, 32 insertions, 9 deletions
diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h index 45127cd0..a3f19fc3 100644 --- a/include/backend/drm/renderer.h +++ b/include/backend/drm/renderer.h @@ -45,7 +45,7 @@ bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane, struct wlr_drm_bac int32_t width, uint32_t height, uint32_t format); void wlr_drm_surface_finish(struct wlr_drm_surface *surf); -void wlr_drm_surface_make_current(struct wlr_drm_surface *surf); +bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age); struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf); struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf); void wlr_drm_surface_post(struct wlr_drm_surface *surf); diff --git a/include/rootston/output.h b/include/rootston/output.h index e8241de7..c0022d1a 100644 --- a/include/rootston/output.h +++ b/include/rootston/output.h @@ -5,6 +5,8 @@ #include <pixman.h> #include <wayland-server.h> +#define ROOTS_OUTPUT_PREVIOUS_DAMAGE_LEN 2 + struct roots_desktop; struct roots_output { @@ -15,9 +17,12 @@ struct roots_output { struct roots_view *fullscreen_view; struct timespec last_frame; - pixman_region32_t damage, previous_damage; + pixman_region32_t damage; bool frame_pending; + pixman_region32_t previous_damage[ROOTS_OUTPUT_PREVIOUS_DAMAGE_LEN]; + size_t previous_damage_idx; + struct wl_listener frame; struct wl_listener mode; struct wl_listener needs_swap; diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 56404ec7..f2b65066 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -18,8 +18,8 @@ struct wlr_output_impl { int32_t hotspot_x, int32_t hotspot_y, bool update_pixels); bool (*move_cursor)(struct wlr_output *output, int x, int y); void (*destroy)(struct wlr_output *output); - void (*make_current)(struct wlr_output *output); - void (*swap_buffers)(struct wlr_output *output); + bool (*make_current)(struct wlr_output *output, int *buffer_age); + bool (*swap_buffers)(struct wlr_output *output); void (*set_gamma)(struct wlr_output *output, uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); uint32_t (*get_gamma_size)(struct wlr_output *output); diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index bdb8d286..c292a6f8 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -11,8 +11,12 @@ struct wlr_egl { EGLConfig config; EGLContext context; - const char *egl_exts; - const char *gl_exts; + const char *egl_exts_str; + const char *gl_exts_str; + + struct { + bool buffer_age; + } egl_exts; struct wl_display *wl_display; }; @@ -65,4 +69,10 @@ bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image); */ const char *egl_error(void); +bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface, + int *buffer_age); + +// TODO: remove +int wlr_egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface); + #endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 33d27501..3267a608 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -33,6 +33,8 @@ struct wlr_output_cursor { struct wl_listener surface_destroy; }; +#define WLR_OUTPUT_PREVIOUS_DAMAGE_COUNT 2 + struct wlr_output_impl; struct wlr_output { @@ -55,7 +57,7 @@ struct wlr_output { enum wl_output_transform transform; bool needs_swap; - pixman_region32_t damage, previous_damage; + pixman_region32_t damage; float transform_matrix[16]; // Note: some backends may have zero modes @@ -104,13 +106,19 @@ void wlr_output_set_scale(struct wlr_output *output, float scale); void wlr_output_destroy(struct wlr_output *output); void wlr_output_effective_resolution(struct wlr_output *output, int *width, int *height); -void wlr_output_make_current(struct wlr_output *output); +/** + * Makes the output GL context current. + * + * `buffer_age` is set to the drawing buffer age in number of frames or -1 if + * unknown. + */ +bool wlr_output_make_current(struct wlr_output *output, int *buffer_age); /** * Swaps the output buffers. If the time of the frame isn't known, set `when` to * NULL. If the compositor doesn't support damage tracking, set `damage` to * NULL. */ -void wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when, +bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when, pixman_region32_t *damage); void wlr_output_set_gamma(struct wlr_output *output, uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); |