gl-renderer: don't move memory in output_rotate_damage

output_rotate_damage shifted an array of pixman regions with a loop.  Now
it uses an index into that array.

This currently only saves 1 pixman_region32_copy, but we can now raise
BUFFER_DAMAGE_COUNT without a performance impact if we run into a
configuration where this is useful.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
compositor: make keep_buffer a bool

The comments already call it bool, so let's just make it one
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.
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.
compositor-drm: use weston_surface_to_buffer_rect instead of weston_transformed_rect

The weston_transformed_rect() call should have the same result as
weston_surface_to_buffer_rect().

Also, this mix of fixed, float, and int is difficult to follow and I don't
trust it, so just convert to fixed for the plane API at the end of the
calculation.
compositor: Remove weston_transformed_rect() and weston_transformed_coord()

The last caller of weston_transformed_rect() has been replaced so we can
remove weston_transformed_rect() - since it was the last caller of
weston_transformed_coord() we can get rid of that too.
compositor: use weston_matrix_transform for weston_output_transform_coordinate

We can greatly simplify weston_output_transform_coordinate now by simply
multiplying by the output matrix and converting the result to fixed point.
compositor: Add weston_matrix_to_transform function

This function examines a matrix to see if it can be built with simple
scale + translate + wl_output_transform enum.