mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-22 06:59:44 -05:00
output: add damage tracking via buffer age
This commit is contained in:
parent
78c13ead16
commit
0365b587f0
21 changed files with 163 additions and 81 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue