Add a separate variable to keep track of surface mapping.

Mapping a surface should not override a "paintEnabled: false"
in the QML.

Change-Id: Ib28499c24f34fead80e9f9ad0bbe9d72da5e1e9e
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Don't clobber the m_damaged state during rendering.

If the QWaylandSurfaceNode had m_damage during preprocess()
(which it could get if the GUI thread got a surfaceDamaged)
it would call into the item, update its texture and clear its
m_damaged state. This resulted in that the next time we
advanced the buffer queue, the item would not have m_damaged
set and as a result, the texture would not be updated.

Also, the call from preprocess() to updateTexture, though protected by
a mutex in preprocess(), touched a number of variables on the GUI
thread which were not being protected there, such as m_damaged and
smooth().

The QWaylandSurfaceNode was doing this primarily to deal with direct
rendering which has been removed pending a better solution, so we
replace its use with the built-in QSGSimpleTextureNode.

Change-Id: Ifccb6b1149980b4796a182fa8525446a00bbe57f
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Support that clients queue up more than three buffers.

Though it is wrongful behavior on the clients part, a client should
not be allowed to crash the compositor simply by posting it an extra
buffer.

Change-Id: Ia8ba0bbfc63273b0af13b81fbb9a74328289face
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
fix compile with Mesa 10.0

Mesa 10.0 replaces struct wl_buffer with struct wl_resource in the
eglQueryWaylandBufferWL signature. The structures are binary compatible
(struct wl_buffer is a superset of struct wl_resource), but C++
complains about the type mismatch:

 error: cannot convert ‘wl_buffer*’ to ‘wl_resource*’ in argument passing

We are already using struct wl_resource on our side, so removing the now
redundant reinterpret_cast would fix it. But then we could not compile
with Mesa versions older than 10.0 any more, and those are still common
in mainstream distributions today.

A compile-time switch for different Mesa versions is possible, but
unnecessarily clumsy. Instead, re-declare the new signature and use that
independently of the Mesa version. The duplicate declaration can be
removed when backwards compatibility is no longer needed.

Change-Id: I3d0e326f5a0eb88d125b8c9fd23147682e23b94b
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>