libweston: have one primary_plane per output

The primary_plane is currently shared amongst all outputs, and is the last
barrier to having overlapping outputs.

Split it up and make it per output instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-06-23 12:00:12 -05:00
parent 4def21c196
commit ee7971e2cd
8 changed files with 20 additions and 21 deletions

View File

@ -462,6 +462,7 @@ struct weston_output {
struct wl_signal user_destroy_signal;
void *renderer_state;
struct weston_plane primary_plane;
struct wl_list link;
struct weston_compositor *compositor;
@ -1430,7 +1431,6 @@ struct weston_compositor {
const struct weston_pointer_grab_interface *default_pointer_grab;
/* Repaint state. */
struct weston_plane primary_plane;
uint32_t capabilities; /* combination of enum weston_capability */
struct weston_color_manager *color_manager;

View File

@ -324,7 +324,7 @@ drm_virtual_output_enable(struct weston_output *output_base)
weston_compositor_stack_plane(b->compositor,
&output->scanout_plane->base,
&b->compositor->primary_plane);
&output->base.primary_plane);
return 0;
err:

View File

@ -1938,7 +1938,7 @@ drm_output_init_planes(struct drm_output *output)
weston_compositor_stack_plane(b->compositor,
&output->scanout_plane->base,
&b->compositor->primary_plane);
&output->base.primary_plane);
/* Failing to find a cursor plane is not fatal, as we'll fall back
* to software cursor. */

View File

@ -962,7 +962,7 @@ drm_assign_planes(struct weston_output *output_base)
struct drm_plane_state *plane_state;
struct drm_writeback_state *wb_state = output->wb_state;
struct weston_paint_node *pnode;
struct weston_plane *primary = &output_base->compositor->primary_plane;
struct weston_plane *primary = &output_base->primary_plane;
enum drm_output_propose_state_mode mode = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY;
assert(output);

View File

@ -1035,7 +1035,7 @@ vnc_fb_get_from_view(struct weston_view *view)
static void
vnc_output_assign_planes(struct weston_output *base)
{
struct weston_plane *primary = &base->compositor->primary_plane;
struct weston_plane *primary = &base->primary_plane;
struct vnc_output *output = to_vnc_output(base);
struct weston_paint_node *pnode;
bool topmost = true;

View File

@ -297,7 +297,7 @@ weston_paint_node_create(struct weston_surface *surface,
pixman_region32_init(&pnode->visible);
pixman_region32_copy(&pnode->visible, &view->visible);
pnode->plane = &pnode->surface->compositor->primary_plane;
pnode->plane = &pnode->output->primary_plane;
pnode->plane_next = NULL;
pnode->status = PAINT_NODE_ALL_DIRTY & ~PAINT_NODE_PLANE_DIRTY;
@ -3323,7 +3323,7 @@ weston_output_repaint(struct weston_output *output)
} else {
wl_list_for_each(pnode, &output->paint_node_z_order_list,
z_order_link) {
weston_paint_node_move_to_plane(pnode, &ec->primary_plane);
weston_paint_node_move_to_plane(pnode, &output->primary_plane);
pnode->view->psf_flags = 0;
}
}
@ -3353,7 +3353,7 @@ weston_output_repaint(struct weston_output *output)
pixman_region32_init(&output_damage);
weston_output_flush_damage_for_plane(output, &ec->primary_plane,
weston_output_flush_damage_for_plane(output, &output->primary_plane,
&output_damage);
if (output->full_repaint_needed) {
@ -5689,7 +5689,7 @@ weston_plane_release(struct weston_plane *plane)
continue;
node->plane = NULL;
node->plane_next = &output->compositor->primary_plane;
node->plane_next = &output->primary_plane;
node->status |= PAINT_NODE_PLANE_DIRTY |
PAINT_NODE_VISIBILITY_DIRTY;
}
@ -7464,6 +7464,10 @@ weston_output_init(struct weston_output *output,
*/
if (!compositor)
return;
weston_plane_init(&output->primary_plane, compositor);
weston_compositor_stack_plane(compositor,
&output->primary_plane, NULL);
}
/** Adds weston_output object to pending output list.
@ -7911,6 +7915,8 @@ weston_compositor_create_output(struct weston_compositor *compositor,
WL_EXPORT void
weston_output_destroy(struct weston_output *output)
{
weston_plane_release(&output->primary_plane);
output->destroy(output);
}
@ -8926,9 +8932,6 @@ weston_compositor_create(struct wl_display *display,
wl_list_init(&ec->plugin_api_list);
weston_plane_init(&ec->primary_plane, ec);
weston_compositor_stack_plane(ec, &ec->primary_plane, NULL);
wl_data_device_manager_init(ec->wl_display);
wl_display_init_shm(ec->wl_display);
@ -9010,8 +9013,6 @@ weston_compositor_shutdown(struct weston_compositor *ec)
weston_binding_list_destroy_all(&ec->debug_binding_list);
weston_binding_list_destroy_all(&ec->tablet_tool_binding_list);
weston_plane_release(&ec->primary_plane);
weston_layer_fini(&ec->fade_layer);
weston_layer_fini(&ec->cursor_layer);

View File

@ -545,12 +545,11 @@ out:
static void
repaint_surfaces(struct weston_output *output, pixman_region32_t *damage)
{
struct weston_compositor *compositor = output->compositor;
struct weston_paint_node *pnode;
wl_list_for_each_reverse(pnode, &output->paint_node_z_order_list,
z_order_link) {
if (pnode->plane == &compositor->primary_plane)
if (pnode->plane == &output->primary_plane)
draw_paint_node(pnode, damage);
}
}

View File

@ -1330,7 +1330,6 @@ out:
static void
repaint_views(struct weston_output *output, pixman_region32_t *damage)
{
struct weston_compositor *compositor = output->compositor;
struct weston_paint_node *pnode;
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@ -1338,7 +1337,7 @@ repaint_views(struct weston_output *output, pixman_region32_t *damage)
wl_list_for_each_reverse(pnode, &output->paint_node_z_order_list,
z_order_link) {
if (pnode->plane == &compositor->primary_plane)
if (pnode->plane == &output->primary_plane)
draw_paint_node(pnode, damage);
}
@ -1365,7 +1364,7 @@ update_buffer_release_fences(struct weston_compositor *compositor,
struct weston_buffer_release *buffer_release;
int fence_fd;
if (pnode->plane != &compositor->primary_plane)
if (pnode->plane != &output->primary_plane)
continue;
gs = get_surface_state(view->surface);
@ -1861,7 +1860,7 @@ gl_renderer_repaint_output(struct weston_output *output,
* which surfaces were used in this output repaint. */
wl_list_for_each_reverse(pnode, &output->paint_node_z_order_list,
z_order_link) {
if (pnode->plane == &compositor->primary_plane) {
if (pnode->plane == &output->primary_plane) {
struct gl_surface_state *gs =
get_surface_state(pnode->view->surface);
gs->used_in_output_repaint = false;
@ -2099,7 +2098,7 @@ gl_renderer_flush_damage(struct weston_surface *surface,
*/
texture_used = false;
wl_list_for_each(pnode, &surface->paint_node_list, surface_link) {
if (pnode->plane == &surface->compositor->primary_plane) {
if (pnode->plane == &pnode->output->primary_plane) {
texture_used = true;
break;
}