output: add damage tracking via buffer age

This commit is contained in:
emersion 2018-01-21 00:06:35 +01:00
parent 78c13ead16
commit 0365b587f0
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
21 changed files with 163 additions and 81 deletions

View file

@ -379,28 +379,23 @@ static void output_destroy(struct wlr_output *wlr_output) {
// output has been allocated on the stack, do not free it
}
static void output_make_current(struct wlr_output *wlr_output) {
static bool output_make_current(struct wlr_output *wlr_output, int *buffer_age) {
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
struct wlr_x11_backend *x11 = output->x11;
if (!eglMakeCurrent(x11->egl.display, output->surf, output->surf, x11->egl.context)) {
wlr_log(L_ERROR, "eglMakeCurrent failed: %s", egl_error());
}
return wlr_egl_make_current(&x11->egl, output->surf, buffer_age);
}
static void output_swap_buffers(struct wlr_output *wlr_output) {
static bool output_swap_buffers(struct wlr_output *wlr_output) {
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
struct wlr_x11_backend *x11 = output->x11;
if (!eglSwapBuffers(x11->egl.display, output->surf)) {
wlr_log(L_ERROR, "eglSwapBuffers failed: %s", egl_error());
return false;
}
// Damage the whole output
// TODO: use the buffer age extension
pixman_region32_union_rect(&wlr_output->damage, &wlr_output->damage,
0, 0, wlr_output->width, wlr_output->height);
wlr_output_update_needs_swap(wlr_output);
return true;
}
static struct wlr_output_impl output_impl = {