diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-02-10 09:45:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-10 09:45:18 -0500 |
commit | 07856580c446607fa55888db8ae75491e0447c20 (patch) | |
tree | fe1ab648a792adfd9d66f3975ff093f2ed5a4844 /backend | |
parent | 039f112c31eea17e45c121db9b470fa36bbf9af9 (diff) | |
parent | bf6d24540000339029a30715f1f72b5b95a45018 (diff) |
Merge pull request #619 from emersion/swap-with-damage
Swap buffers with damage
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 7 | ||||
-rw-r--r-- | backend/drm/renderer.c | 11 | ||||
-rw-r--r-- | backend/headless/output.c | 3 | ||||
-rw-r--r-- | backend/wayland/output.c | 11 | ||||
-rw-r--r-- | backend/x11/backend.c | 10 |
5 files changed, 18 insertions, 24 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 08ced783..e1bf63db 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -190,7 +190,8 @@ static bool wlr_drm_connector_make_current(struct wlr_output *output, return wlr_drm_surface_make_current(&conn->crtc->primary->surf, buffer_age); } -static bool wlr_drm_connector_swap_buffers(struct wlr_output *output) { +static bool wlr_drm_connector_swap_buffers(struct wlr_output *output, + pixman_region32_t *damage) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; if (!drm->session->active) { @@ -203,7 +204,7 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output) { } struct wlr_drm_plane *plane = crtc->primary; - struct gbm_bo *bo = wlr_drm_surface_swap_buffers(&plane->surf); + struct gbm_bo *bo = wlr_drm_surface_swap_buffers(&plane->surf, damage); if (drm->parent) { bo = wlr_drm_surface_mgpu_copy(&plane->mgpu_surf, bo); } @@ -635,7 +636,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, GL_UNSIGNED_BYTE, bo_data); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0); - wlr_drm_surface_swap_buffers(&plane->surf); + wlr_drm_surface_swap_buffers(&plane->surf, NULL); gbm_bo_unmap(bo, bo_data); diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 0310a96a..80d3bd9a 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -133,14 +133,13 @@ bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage); } -struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf) { +struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf, + pixman_region32_t *damage) { if (surf->front) { gbm_surface_release_buffer(surf->gbm, surf->front); } - if (!eglSwapBuffers(surf->renderer->egl.display, surf->egl)) { - wlr_log(L_ERROR, "eglSwapBuffers failed"); - } + wlr_egl_swap_buffers(&surf->renderer->egl, surf->egl, damage); surf->front = surf->back; surf->back = gbm_surface_lock_front_buffer(surf->gbm); @@ -156,7 +155,7 @@ struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf) { glViewport(0, 0, surf->width, surf->height); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); - return wlr_drm_surface_swap_buffers(surf); + return wlr_drm_surface_swap_buffers(surf, NULL); } void wlr_drm_surface_post(struct wlr_drm_surface *surf) { @@ -244,7 +243,7 @@ struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest, glClear(GL_COLOR_BUFFER_BIT); wlr_render_with_matrix(dest->renderer->wlr_rend, tex, &matrix); - return wlr_drm_surface_swap_buffers(dest); + return wlr_drm_surface_swap_buffers(dest, NULL); } bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm, diff --git a/backend/headless/output.c b/backend/headless/output.c index aac7cc20..507595a5 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -55,7 +55,8 @@ static bool output_make_current(struct wlr_output *wlr_output, int *buffer_age) buffer_age); } -static bool output_swap_buffers(struct wlr_output *wlr_output) { +static bool output_swap_buffers(struct wlr_output *wlr_output, + pixman_region32_t *damage) { return true; // No-op } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index a9140ff7..0bbf6d42 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -47,7 +47,8 @@ static bool wlr_wl_output_make_current(struct wlr_output *wlr_output, buffer_age); } -static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output) { +static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output, + pixman_region32_t *damage) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)wlr_output; @@ -59,12 +60,8 @@ static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output) { output->frame_callback = wl_surface_frame(output->surface); wl_callback_add_listener(output->frame_callback, &frame_listener, output); - if (!eglSwapBuffers(output->backend->egl.display, output->egl_surface)) { - wlr_log(L_ERROR, "eglSwapBuffers failed: %s", egl_error()); - return false; - } - - return true; + return wlr_egl_swap_buffers(&output->backend->egl, output->egl_surface, + damage); } static void wlr_wl_output_transform(struct wlr_output *_output, diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 44e29be1..411d0ef6 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -401,16 +401,12 @@ static bool output_make_current(struct wlr_output *wlr_output, int *buffer_age) return wlr_egl_make_current(&x11->egl, output->surf, buffer_age); } -static bool output_swap_buffers(struct wlr_output *wlr_output) { +static bool output_swap_buffers(struct wlr_output *wlr_output, + pixman_region32_t *damage) { 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; - } - - return true; + return wlr_egl_swap_buffers(&x11->egl, output->surf, damage); } static struct wlr_output_impl output_impl = { |