compositor: quick fix for sub-surface mapping
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 30 Jun 2014 08:52:07 +0000 (11:52 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 25 Jul 2014 12:08:06 +0000 (15:08 +0300)
commiteb3cf22018beee559d3239e51fdc82610387fc63
tree7b9ca5c9e4ae377772b1461bc9aefde35c76891a
parent0250a740c2320d0eeafabfedcbea20ef95b45f43
compositor: quick fix for sub-surface mapping

If a client does this:
1. create a main window and map it
2. create a wl_surface, and make it a sub-surface of the main window
3. set the sub-surface to desync
4. commit content to the sub-surface to map it

Then step 4 should cause the sub-surface to become mapped. However,
Weston fails to schedule a repaint in that case, so the sub-surface will
not appear until something else causes a repaint on that output, e.g.
the main window.

A quick and dirty fix is to set the output mask for the surface in
Weston, which allows the repaint to be scheduled. This patch implements
that, and might only work right on single-output systems.

A proper fix would involve rewriting the whole "is surface mapped"
mechanism in Weston, to not rely on output assignments but to have a
separate flag for "mapped", and figuring out how to schedule repaints
for the right outputs.

Following is the actual protocol sequence used to trigger the problem:

[3224648.125]  -> wl_compositor@4.create_surface(new id wl_surface@3)
[3224648.206]  -> xdg_shell@7.get_xdg_surface(new id xdg_surface@8, wl_surface@3)
[3224648.311]  -> xdg_surface@8.set_title("simple-shm")
[3224648.378]  -> wl_surface@3.damage(0, 0, 250, 250)
[3224649.888]  -> wl_shm@6.create_pool(new id wl_shm_pool@9, fd 6, 250000)
[3224650.031]  -> wl_shm_pool@9.create_buffer(new id wl_buffer@10, 0, 250, 250, 1000, 1)
[3224650.244]  -> wl_shm_pool@9.destroy()
[3224651.975]  -> wl_surface@3.attach(wl_buffer@10, 0, 0)
[3224652.100]  -> wl_surface@3.damage(20, 20, 210, 210)
[3224652.243]  -> wl_surface@3.frame(new id wl_callback@11)
[3224652.317]  -> wl_surface@3.commit()
[3228652.535]  -> wl_compositor@4.create_surface(new id wl_surface@12)
[3228652.610]  -> wl_subcompositor@5.get_subsurface(new id wl_subsurface@13, wl_surface@12, wl_surface@3)
[3228652.644]  -> wl_subsurface@13.set_desync()
[3228652.659]  -> wl_subsurface@13.set_position(100, 100)
[3228654.090]  -> wl_shm@6.create_pool(new id wl_shm_pool@14, fd 6, 250000)
[3228654.140]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@15, 0, 250, 250, 1000, 1)
[3228654.180]  -> wl_shm_pool@14.destroy()
[3228654.408]  -> wl_surface@12.attach(wl_buffer@15, 0, 0)
[3228654.436]  -> wl_surface@12.damage(0, 0, 250, 250)
[3228654.462]  -> wl_surface@12.commit()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: George Kiagiadakis <george.kiagiadakis@collabora.com>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
src/compositor.c