protocol: add role error code to xdg_shell

Needed for properly reporting role violations from
xdg_shell.get_xdg_surface and .get_xdg_popup.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
compositor: send error for surface role resets

With the more accurate definition of wl_surface roles in Wayland,
enforce the restriction: a role is always set permanently, and
attempting to change it is a protocol error.

This patch is based on Jasper's patch:
http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html

The difference in this patch compared to his are:

- send role errors on the interface whose request triggers it, not on
  wl_surface

- an interface could have several requests assigning different roles,
  cannot use wl_interface as the unique key; use an arbitary string
  instead

- ensure in window-manager.c that create_shell_surface() ->
  create_common_surface() is never called with surface->configure set,
  to avoid compositor abort

- use wl_resource_post_no_memory() where appropriate instead of
  hand-rolling it with wl_resource_post_error()

Ideally we would not add weston_surface::role_name field, but use
weston_surface::configure. At the moment this is not possible though,
because at least shell.c uses several different roles with the same
configure function. Drag'n'drop uses two configure functions for the
same role. The configure hook is also reset in several places,
which is not good for role tracking.

This patch overlooks the wl_surface roles assigned in privileged
extensions: screensaver, panel, background, lock, input panel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
tests: add role conflict sub-surface vs. wl_shell_surface

Add tests for triggering the role conflict when a wl_surface is already
a wl_shell_surface and then attempted to be made into a sub-surface, and
vice versa.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
releasing: update web host name

Signed-off-by: Daniel Stone <daniels@collabora.com>
Very OCD cosmetic nitpick
weston_surface: Add surface-to-buffer and buffer-to-surface matrices
gl-renderer: Call glViewport after the context is made current
Use pixel coordinates for weston_output.matrix

Previously, weston_output.matrix was in GL coordinates and therefore only
really useful for the GL backend.
zoom: Use pixels instead of GL coordinates

Previously, the zoom functions used GL coordinates natively which doesn't
work with the new output matrix calculations.  This changes zoom to work in
pixel coordinates to match the new output matrix format.  This also cleans
up the math in the zoom code substantially.
pixman-renderer: Add a weston_matrix_to_pixman_transform function and
simplify the buffer-to-output matrix computation

Now that we have a buffer-to-surface matrix and the global-to-output matrix
is in pixels, we can remove a large chunk of confusing code from the pixman
renderer.  Hopefully, having this stuff in weston core will keep the pixman
renderer from gettin broken quite as often.
pixman-renderer: Use output->matrix for region transformations and enable output zoom
compositor: Move weston_matrix_transform_region to compositor.c and export it

We're going to use this to replace much of the other transform code so
it's no longer just relevant to pixman-renderer.c
compositor: add weston_matrix_transform_rect() and use it for where appropriate

New function that transforms a pixman_box32_t rectangle by a matrix.

Since pixman rectangles are represented by 2 corners, non-90 degree
rotations can't be properly represented.  This function gives the
axis aligned rectangle that encloses the rotated rectangle.

We use this for matrix_transform_region() and weston_matrix_transform_rect(),
simplifying them and allowing them to work for non 90 degree rotations.
compositor: use matrix transforms for surface_to_buffer functions

Now that we have weston_matrix_transform and appropriate matrices we can
use that instead of weston_transformed_coord + scaler_surface_to_buffer.

scaler_surface_to_buffer no longer has users, so remove it.
compositor: use weston_matrix_transform_region for overlay setup
compositor: Remove weston_transformed_region

Replace all uses of weston_transform_region with
weston_matrix_transform_region, then remove the function completely.
matrix: Add functions to decompose a transformation matrix into basic operations

Adds an internal weston_matrix_decompose() which takes a matrix and decomposes
translation, rotation, shear and scale parameters to re-create it.

This information is cached the first time any helper functions are used to extract
these values and dirtied whenever a matrix multiplication takes place.

Note that these may not be the same values used to compose the matrix in the first
place.
compositor: Add a function to test if images transformed by a matrix should be bilinearly filtered

If a transformation matrix causes a scale, a rotation not a multiple of 90
degrees or a non-integer translation then textures rendered with
it would benefit from bilinear filtering.

This test is done in a lazy fashion by examining elements of the matrix
to check for a simple pattern that indicates these conditions are met.
renderers: use weston_matrix_needs_filtering to choose filter parameters in gl and pixman renderers

Note: This causes a performance drop when zoomed under pixman.  Also, pixman
has clever optimization algorithms to switch from BILINEAR to NEAREST
automatically when it detects they'll have the same result - we still do our
own test here because the pixman check misses a few opportunities when the
display is flipped.
squish me pixman renderer filtering