output->base.gamma_size = output->original_crtc->gamma_size;
output->base.set_gamma = drm_output_set_gamma;
- weston_plane_init(&output->cursor_plane, 0, 0);
- weston_plane_init(&output->fb_plane, 0, 0);
+ weston_plane_init(&output->cursor_plane, &ec->base, 0, 0);
+ weston_plane_init(&output->fb_plane, &ec->base, 0, 0);
weston_compositor_stack_plane(&ec->base, &output->cursor_plane, NULL);
weston_compositor_stack_plane(&ec->base, &output->fb_plane,
memcpy(sprite->formats, plane->formats,
plane->count_formats * sizeof(plane->formats[0]));
drmModeFreePlane(plane);
- weston_plane_init(&sprite->plane, 0, 0);
+ weston_plane_init(&sprite->plane, &ec->base, 0, 0);
weston_compositor_stack_plane(&ec->base, &sprite->plane,
&ec->base.primary_plane);
wl_list_init(&view->link);
wl_list_init(&view->layer_link);
- view->plane = &surface->compositor->primary_plane;
+ view->plane = NULL;
pixman_region32_init(&view->clip);
pixman_region32_init(&damage);
pixman_region32_subtract(&damage, &view->transform.boundingbox,
&view->clip);
- pixman_region32_union(&view->plane->damage,
- &view->plane->damage, &damage);
+ if (view->plane)
+ pixman_region32_union(&view->plane->damage,
+ &view->plane->damage, &damage);
pixman_region32_fini(&damage);
}
weston_view_damage_below(view);
view->output = NULL;
+ view->plane = NULL;
wl_list_remove(&view->layer_link);
wl_list_init(&view->layer_link);
wl_list_remove(&view->link);
}
WL_EXPORT void
-weston_plane_init(struct weston_plane *plane, int32_t x, int32_t y)
+weston_plane_init(struct weston_plane *plane,
+ struct weston_compositor *ec,
+ int32_t x, int32_t y)
{
pixman_region32_init(&plane->damage);
pixman_region32_init(&plane->clip);
plane->x = x;
plane->y = y;
+ plane->compositor = ec;
/* Init the link so that the call to wl_list_remove() when releasing
* the plane without ever stacking doesn't lead to a crash */
WL_EXPORT void
weston_plane_release(struct weston_plane *plane)
{
+ struct weston_view *view;
+
pixman_region32_fini(&plane->damage);
pixman_region32_fini(&plane->clip);
+ wl_list_for_each(view, &plane->compositor->view_list, link) {
+ if (view->plane == plane)
+ view->plane = NULL;
+ }
+
wl_list_remove(&plane->link);
}
wl_list_init(&ec->axis_binding_list);
wl_list_init(&ec->debug_binding_list);
- weston_plane_init(&ec->primary_plane, 0, 0);
+ weston_plane_init(&ec->primary_plane, ec, 0, 0);
weston_compositor_stack_plane(ec, &ec->primary_plane, NULL);
s = weston_config_get_section(ec->config, "keyboard", NULL, NULL);
};
struct weston_plane {
+ struct weston_compositor *compositor;
pixman_region32_t damage;
pixman_region32_t clip;
int32_t x, y;
weston_layer_init(struct weston_layer *layer, struct wl_list *below);
void
-weston_plane_init(struct weston_plane *plane, int32_t x, int32_t y);
+weston_plane_init(struct weston_plane *plane,
+ struct weston_compositor *ec,
+ int32_t x, int32_t y);
void
weston_plane_release(struct weston_plane *plane);