compositor: simplify the matrix inversion API

The compositor will likely do an order of magnitude less matrix
inversions than point transformations with an inverse, hence we do not
really need the optimised path for single-shot invert-and-transform.

Expose only the computing of the explicit inverse matrix in the API.

However, the matrix inversion tests need access to the internal
functions. Designate a unit test build by #defining UNIT_TEST, and
export the internal functions in that case.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/src/matrix.h b/src/matrix.h
index 21c1e78..04b179f 100644
--- a/src/matrix.h
+++ b/src/matrix.h
@@ -28,11 +28,6 @@
 	GLfloat d[16];
 };
 
-struct weston_inverse_matrix {
-	double LU[16];	/* column-major */
-	unsigned p[4];	/* permutation */
-};
-
 struct weston_vector {
 	GLfloat f[4];
 };
@@ -50,10 +45,20 @@
 weston_matrix_transform(struct weston_matrix *matrix, struct weston_vector *v);
 
 int
-weston_matrix_invert(struct weston_inverse_matrix *inverse,
+weston_matrix_invert(struct weston_matrix *inverse,
 		     const struct weston_matrix *matrix);
+
+#ifdef UNIT_TEST
+#  define MATRIX_TEST_EXPORT WL_EXPORT
+
+int
+matrix_invert(double *A, unsigned *p, const struct weston_matrix *matrix);
+
 void
-weston_matrix_inverse_transform(struct weston_inverse_matrix *inverse,
-				struct weston_vector *v);
+inverse_transform(const double *LU, const unsigned *p, GLfloat *v);
+
+#else
+#  define MATRIX_TEST_EXPORT static
+#endif
 
 #endif /* WESTON_MATRIX_H */