mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-08 12:28:04 +02:00
compositor: set surface->plane from destroyed plane to NULL
In drm backend, the cursor_surface->plane point to
drm_output->cursor_plane.when this output is removed,
drm_output->cursor_plane is destroyed, butcursor_surface->plane
still point to destroyed plane. So once mouse move to this
cursor_surface and system will repaint this cursor_surface,
segment fault will generate in weston_surface_damage_below() function.
V2:
-set surface->plane to NULL whose plane point to unplugged output,
then change weston_surface_damage_below() to do nothing if
surface->plane is NULL (Kristian)
-set surface->plane to NULL in weston_surface_unmap(),
so that all surfaces that have a non-NULL plane pointer wil be
on compositor->surface_list (Kristian).
Backported from 971165368d
bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69777
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
This commit is contained in:
parent
95e758c2b1
commit
98562c36c1
3 changed files with 24 additions and 9 deletions
|
|
@ -1987,8 +1987,8 @@ create_output_for_connector(struct drm_compositor *ec,
|
|||
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,
|
||||
|
|
@ -2063,7 +2063,7 @@ create_sprites(struct drm_compositor *ec)
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ weston_surface_create(struct weston_compositor *compositor)
|
|||
surface->pending.buffer_transform = surface->buffer_transform;
|
||||
surface->pending.buffer_scale = surface->buffer_scale;
|
||||
surface->output = NULL;
|
||||
surface->plane = &compositor->primary_plane;
|
||||
surface->plane = NULL;
|
||||
surface->pending.newly_attached = 0;
|
||||
|
||||
pixman_region32_init(&surface->damage);
|
||||
|
|
@ -578,8 +578,9 @@ weston_surface_damage_below(struct weston_surface *surface)
|
|||
pixman_region32_init(&damage);
|
||||
pixman_region32_subtract(&damage, &surface->transform.boundingbox,
|
||||
&surface->clip);
|
||||
pixman_region32_union(&surface->plane->damage,
|
||||
&surface->plane->damage, &damage);
|
||||
if (surface->plane)
|
||||
pixman_region32_union(&surface->plane->damage,
|
||||
&surface->plane->damage, &damage);
|
||||
pixman_region32_fini(&damage);
|
||||
}
|
||||
|
||||
|
|
@ -1056,6 +1057,7 @@ weston_surface_unmap(struct weston_surface *surface)
|
|||
|
||||
weston_surface_damage_below(surface);
|
||||
surface->output = NULL;
|
||||
surface->plane = NULL;
|
||||
wl_list_remove(&surface->layer_link);
|
||||
wl_list_remove(&surface->link);
|
||||
wl_list_init(&surface->link);
|
||||
|
|
@ -2611,12 +2613,15 @@ idle_handler(void *data)
|
|||
}
|
||||
|
||||
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 */
|
||||
|
|
@ -2626,9 +2631,16 @@ weston_plane_init(struct weston_plane *plane, int32_t x, int32_t y)
|
|||
WL_EXPORT void
|
||||
weston_plane_release(struct weston_plane *plane)
|
||||
{
|
||||
struct weston_surface *surface;
|
||||
|
||||
pixman_region32_fini(&plane->damage);
|
||||
pixman_region32_fini(&plane->clip);
|
||||
|
||||
wl_list_for_each(surface, &plane->compositor->surface_list, link) {
|
||||
if (surface->plane == plane)
|
||||
surface->plane = NULL;
|
||||
}
|
||||
|
||||
wl_list_remove(&plane->link);
|
||||
}
|
||||
|
||||
|
|
@ -3023,7 +3035,7 @@ weston_compositor_init(struct weston_compositor *ec,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -509,6 +509,7 @@ struct weston_layer {
|
|||
};
|
||||
|
||||
struct weston_plane {
|
||||
struct weston_compositor *compositor;
|
||||
pixman_region32_t damage;
|
||||
pixman_region32_t clip;
|
||||
int32_t x, y;
|
||||
|
|
@ -932,7 +933,9 @@ void
|
|||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue