libweston: move weston_output::mode_list init to core
Initialize the list in weston_output_init() instead of doing it separately in each backend. One would expect weston_output_init() to initialize all weston_output members, at least those that are not NULL. We rely on the set_size() functions to be called only once, as is assert()'d. If set_size() becomes callable multiple times, this patch will force them to be fixed to properly manage the mode list instead of losing all members. compositor-wayland.c is strange in wayland_output_create_for_parent_output(): it first called wayland_output_set_size() that initialized the mode list with a single mode manufactured from width and height and set that mode as current. Then it continued to reset the mode list and adding the list of modes from the parent output, leaving the current mode left to point to a mode struct that is no longer in the mode list and with a broken 'link' element. This patch changes things such that the manufactured mode is left in the list, and the parent mode list is added. This is probably not quite right either. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Emre Ucan <eucan@de.adit-jv.com> Reviewed-by: Ian Ray <ian.ray@ge.com> Acked-by Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
be2f6b0f75
commit
4270414549
@ -3375,8 +3375,6 @@ create_output_for_connector(struct drm_backend *b,
|
||||
|
||||
weston_output_init(&output->base, b->compositor);
|
||||
|
||||
wl_list_init(&output->base.mode_list);
|
||||
|
||||
for (i = 0; i < output->connector->count_modes; i++) {
|
||||
drm_mode = drm_output_add_mode(output, &output->connector->modes[i]);
|
||||
if (!drm_mode) {
|
||||
|
@ -523,7 +523,6 @@ fbdev_output_create(struct fbdev_backend *backend,
|
||||
output->mode.width = output->fb_info.x_resolution;
|
||||
output->mode.height = output->fb_info.y_resolution;
|
||||
output->mode.refresh = output->fb_info.refresh_rate;
|
||||
wl_list_init(&output->base.mode_list);
|
||||
wl_list_insert(&output->base.mode_list, &output->mode.link);
|
||||
|
||||
output->base.current_mode = &output->mode;
|
||||
|
@ -201,7 +201,6 @@ headless_output_set_size(struct weston_output *base,
|
||||
output->mode.width = output_width;
|
||||
output->mode.height = output_height;
|
||||
output->mode.refresh = 60000;
|
||||
wl_list_init(&output->base.mode_list);
|
||||
wl_list_insert(&output->base.mode_list, &output->mode.link);
|
||||
|
||||
output->base.current_mode = &output->mode;
|
||||
|
@ -488,7 +488,6 @@ rdp_output_set_size(struct weston_output *base,
|
||||
assert(!output->base.current_mode);
|
||||
|
||||
wl_list_init(&output->peers);
|
||||
wl_list_init(&output->base.mode_list);
|
||||
|
||||
initMode.flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
|
||||
initMode.width = width;
|
||||
|
@ -1318,7 +1318,6 @@ wayland_output_set_size(struct weston_output *base, int width, int height)
|
||||
output->mode.height = output_height;
|
||||
output->mode.refresh = 60000;
|
||||
output->scale = output->base.scale;
|
||||
wl_list_init(&output->base.mode_list);
|
||||
wl_list_insert(&output->base.mode_list, &output->mode.link);
|
||||
|
||||
output->base.current_mode = &output->mode;
|
||||
@ -1369,7 +1368,6 @@ wayland_output_create_for_parent_output(struct wayland_backend *b,
|
||||
output->base.make = poutput->physical.make;
|
||||
output->base.model = poutput->physical.model;
|
||||
|
||||
wl_list_init(&output->base.mode_list);
|
||||
wl_list_insert_list(&output->base.mode_list, &poutput->mode_list);
|
||||
wl_list_init(&poutput->mode_list);
|
||||
|
||||
|
@ -999,7 +999,6 @@ x11_output_set_size(struct weston_output *base, int width, int height)
|
||||
output->mode.height = output_height;
|
||||
output->mode.refresh = 60000;
|
||||
output->scale = output->base.scale;
|
||||
wl_list_init(&output->base.mode_list);
|
||||
wl_list_insert(&output->base.mode_list, &output->mode.link);
|
||||
|
||||
output->base.current_mode = &output->mode;
|
||||
|
@ -4710,6 +4710,7 @@ weston_output_init(struct weston_output *output,
|
||||
|
||||
pixman_region32_init(&output->previous_damage);
|
||||
pixman_region32_init(&output->region);
|
||||
wl_list_init(&output->mode_list);
|
||||
}
|
||||
|
||||
/** Adds weston_output object to pending output list.
|
||||
|
Loading…
Reference in New Issue
Block a user