From 0619657d0071afa20a51901feea80a8ca640c624 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 20 Oct 2021 16:11:46 +0200 Subject: [PATCH] Delegate direct scan-out to wlr_scene Depends on [1]. [1]: https://github.com/swaywm/wlroots/pull/3279 --- output.c | 71 +------------------------------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-) diff --git a/output.c b/output.c index db71d75..12968b0 100644 --- a/output.c +++ b/output.c @@ -98,61 +98,6 @@ send_frame_done(struct cg_output *output, const struct timespec *when) wlr_scene_node_for_each_surface(&output->server->scene->node, send_frame_done_iterator, &data); } -static void -count_surface_iterator(struct wlr_surface *surface, int sx, int sy, void *data) -{ - size_t *n = data; - (*n)++; -} - -static bool -scan_out_primary_view(struct cg_output *output) -{ - struct cg_server *server = output->server; - struct wlr_output *wlr_output = output->wlr_output; - - struct cg_drag_icon *drag_icon; - wl_list_for_each (drag_icon, &server->seat->drag_icons, link) { - if (drag_icon->wlr_drag_icon->mapped) { - return false; - } - } - - struct cg_view *view = seat_get_focus(server->seat); - if (!view || !view->wlr_surface) { - return false; - } - - size_t n_surfaces = 0; - wlr_scene_node_for_each_surface(view->scene_node, count_surface_iterator, &n_surfaces); - if (n_surfaces > 1) { - return false; - } - -#if CAGE_HAS_XWAYLAND - if (view->type == CAGE_XWAYLAND_VIEW) { - struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view); - if (!wl_list_empty(&xwayland_view->xwayland_surface->children)) { - return false; - } - } -#endif - - struct wlr_surface *surface = view->wlr_surface; - - if (!surface->buffer) { - return false; - } - - if ((float) surface->current.scale != wlr_output->scale || - surface->current.transform != wlr_output->transform) { - return false; - } - - wlr_output_attach_buffer(wlr_output, &surface->buffer->base); - return wlr_output_commit(wlr_output); -} - static void output_enable(struct cg_output *output) { @@ -204,21 +149,7 @@ handle_output_frame(struct wl_listener *listener, void *data) return; } - /* Check if we can scan-out the primary view. */ - static bool last_scanned_out = false; - bool scanned_out = scan_out_primary_view(output); - - if (scanned_out && !last_scanned_out) { - wlr_log(WLR_DEBUG, "Scanning out primary view"); - } - if (last_scanned_out && !scanned_out) { - wlr_log(WLR_DEBUG, "Stopping primary view scan out"); - } - last_scanned_out = scanned_out; - - if (!scanned_out) { - wlr_scene_output_commit(output->scene_output); - } + wlr_scene_output_commit(output->scene_output); struct timespec now = {0}; clock_gettime(CLOCK_MONOTONIC, &now);