compositor: quick fix for sub-surface mapping
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 <0f6ae7001e34c37b02fb2c1c2573ddf8f442136a@collabora.co.uk>
Cc: George Kiagiadakis <71278ab428eb8ff2ccba523a5db9af98c7b62b46@collabora.com>
Cc: Jason Ekstrand <b186559eaedf698788888c8a2559b4efb4db10d6@intel.com>

eyolfson/weston,udoprog/weston,Fantu/compositor-spice,kwm81/weston,jonnylamb/weston,giucam/weston,mchalupa/weston,Tarnyko/weston-xdg_surface_present,udoprog/weston,Gnurou/weston,Tarnyko/weston-xdg_surface_present,jonnylamb/weston,xorgy/weston,mchalupa/weston,Fantu/compositor-spice,kwm81/weston,krezovic/weston,krezovic/weston,Fantu/compositor-spice,giucam/weston,sir-murray/weston,xorgy/weston,eyolfson/weston,sir-murray/weston,Gnurou/weston