[PATCH weston] compositor-drm: Fix a crash with a fullscreen surface with driver mode
Kristian Høgsberg
hoegsberg at gmail.com
Tue Feb 26 08:16:10 PST 2013
On Tue, Feb 26, 2013 at 01:44:58PM +0200, Ander Conselvan de Oliveira wrote:
> If there was a fullscreen surface using driver mode when a vt switch is
> triggered, but something caused it to be gone when switching back (such
> as the client being killed), a call to drm_output_switch_mode() is made
> to restore the old mode, and that sets the output's current drm_fb to
> NULL, so that the new mode is set drm_output_repaint(). This led to a
> crash in vt_func(), because it tried to access output->current for
> restoring the old mode.
>
> Fix this by not setting the mode if there's no current fb. Instead,
> schedule a repaint so that the mode is set in drm_output_repaint().
>
> https://bugs.freedesktop.org/show_bug.cgi?id=60675
Thanks Ander. I'll pick up on the 1.0 branch as well.
Kristian
> ---
> src/compositor-drm.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index a824324..3922e0c 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -1973,6 +1973,16 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
> int ret;
>
> wl_list_for_each(output, &compositor->base.output_list, base.link) {
> + if (!output->current) {
> + /* If something that would cause the output to
> + * switch mode happened while in another vt, we
> + * might not have a current drm_fb. In that case,
> + * schedule a repaint and let drm_output_repaint
> + * handle setting the mode. */
> + weston_output_schedule_repaint(&output->base);
> + continue;
> + }
> +
> drm_mode = (struct drm_mode *) output->base.current;
> ret = drmModeSetCrtc(compositor->drm.fd, output->crtc_id,
> output->current->fb_id, 0, 0,
> --
> 1.7.10.4
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list