[PATCH weston] rpi: fix segfault at startup in rpi_flippipe_init() v2

John Sadler deathofathousandpapercuts at gmail.com
Wed Sep 9 06:18:45 PDT 2015


On 08/09/15 13:31, Pekka Paalanen wrote:
> From: John Sadler <deathofathousandpapercuts at gmail.com>
>
> When running with the RPi backend, Weston now segfaults at startup on the
> line:
>
>     flippipe->clk_id = output->base.compositor->presentation_clock;
>
> in `rpi_flippipe_init()`.
>
> This is because `output->base.compositor` is NULL. This problem did not
> exist on 1.8.0, and it looks like it may have been introduced by 954f183e2f.
>
> This commit ensures that the `compositor` is initialised in `rpi_backend`
> and that flippipe init uses the compositor pointer from backend.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91885
>
> Signed-off-by: John Sadler <deathofathousandpapercuts at gmail.com>
>
> Changes in v2:
> - fix summary to not break the build
> - use output->backend->compositor in rpi_flippipe_init() instead of
>   output->base.compositor. The latter is set by weston_output_init()
>   which gets called later than rpi_flippipe_init().
>
> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
>
> ---
> Hi John,
>
> a good find! I adjusted this patch a bit. If you can give a Tested-by
> for the v2, I can push this.

Sure. I re-built with your v2 and ran on RPi2. It runs fine, no segfault.

Tested-by: John Sadler <deathofathousandpapercuts at gmail.com>

Thanks,

John.
>
> Thanks,
> pq
> ---
>  src/compositor-rpi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
> index 602cbee..0aeb077 100644
> --- a/src/compositor-rpi.c
> +++ b/src/compositor-rpi.c
> @@ -184,6 +184,7 @@ rpi_flippipe_handler(int fd, uint32_t mask, void *data)
>  static int
>  rpi_flippipe_init(struct rpi_flippipe *flippipe, struct rpi_output *output)
>  {
> +	struct weston_compositor *compositor = output->backend->compositor;
>  	struct wl_event_loop *loop;
>  	int fd[2];
>  
> @@ -192,9 +193,9 @@ rpi_flippipe_init(struct rpi_flippipe *flippipe, struct rpi_output *output)
>  
>  	flippipe->readfd = fd[0];
>  	flippipe->writefd = fd[1];
> -	flippipe->clk_id = output->base.compositor->presentation_clock;
> +	flippipe->clk_id = compositor->presentation_clock;
>  
> -	loop = wl_display_get_event_loop(output->base.compositor->wl_display);
> +	loop = wl_display_get_event_loop(compositor->wl_display);
>  	flippipe->source = wl_event_loop_add_fd(loop, flippipe->readfd,
>  						WL_EVENT_READABLE,
>  						rpi_flippipe_handler, output);
> @@ -498,6 +499,7 @@ rpi_backend_create(struct weston_compositor *compositor,
>  	backend->base.destroy = rpi_backend_destroy;
>  	backend->base.restore = rpi_restore;
>  
> +	backend->compositor = compositor;
>  	backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
>  	backend->single_buffer = param->renderer.single_buffer;
>  



More information about the wayland-devel mailing list