From 0365b587f03411d6a55017e111a991d466decc35 Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 21 Jan 2018 00:06:35 +0100 Subject: output: add damage tracking via buffer age --- include/backend/drm/renderer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/backend') 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); -- cgit v1.2.3 From bb4aeb3b2f8d739b042ab8c2f2b9b6d1caf6e26b Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 2 Feb 2018 21:01:59 +0100 Subject: backend/drm: support updating cursor when session is paused --- backend/drm/backend.c | 2 ++ backend/drm/drm.c | 21 ++++++++++++++------- include/backend/drm/drm.h | 4 ++-- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'include/backend') diff --git a/backend/drm/backend.c b/backend/drm/backend.c index dc6757a5..2b54336f 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -91,6 +91,8 @@ static void session_signal(struct wl_listener *listener, void *data) { struct wlr_drm_plane *plane = conn->crtc->cursor; drm->iface->crtc_set_cursor(drm, conn->crtc, (plane && plane->cursor_enabled) ? plane->cursor_bo : NULL); + drm->iface->crtc_move_cursor(drm, conn->crtc, conn->cursor_x, + conn->cursor_y); } } else { wlr_log(L_INFO, "DRM fd paused"); diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 1b0b9b2b..8d102d8a 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -517,10 +517,6 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_renderer *renderer = &drm->renderer; - if (!drm->session->active) { - return false; - } - struct wlr_drm_crtc *crtc = conn->crtc; if (!crtc) { return false; @@ -540,6 +536,9 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, if (!buf && update_pixels) { // Hide the cursor plane->cursor_enabled = false; + if (!drm->session->active) { + return true; + } return drm->iface->crtc_set_cursor(drm, crtc, NULL); } plane->cursor_enabled = true; @@ -637,6 +636,10 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, gbm_bo_unmap(bo, bo_data); + if (!drm->session->active) { + return true; + } + bool ok = drm->iface->crtc_set_cursor(drm, crtc, bo); if (ok) { wlr_output_update_needs_swap(output); @@ -648,9 +651,6 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, int x, int y) { 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) { - return false; - } if (!conn->crtc) { return false; } @@ -670,6 +670,13 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, box.y -= plane->cursor_hotspot_y; } + conn->cursor_x = box.x; + conn->cursor_y = box.y; + + if (!drm->session->active) { + return true; + } + bool ok = drm->iface->crtc_move_cursor(drm, conn->crtc, box.x, box.y); if (ok) { wlr_output_update_needs_swap(output); diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 72671f45..af472ede 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -123,8 +123,8 @@ struct wlr_drm_connector { union wlr_drm_connector_props props; - uint32_t width; - uint32_t height; + uint32_t width, height; + int32_t cursor_x, cursor_y; drmModeCrtc *old_crtc; -- cgit v1.2.3