1. 20 Dec, 2018 1 commit
    • Pekka Paalanen's avatar
      build: replace IN_WESTON with UNIT_TEST · a23ce295
      Pekka Paalanen authored and Daniel Stone's avatar Daniel Stone committed
      
      
      Remove IN_WESTON in favour of the already defined UNIT_TEST which is
      used to modify a compilation unit to expose more functions for unit
      tests to prod at.
      
      Originally IN_WESTON meant that compilation unit was being compiled for
      use in the Weston compositor, but it probably never really did anything
      more than change what WL_EXPORT means in matrix.c.
      
      This patch not only simplifies the logic, but it fixes the Meson build
      of test-matrix: IN_WESTON was defined there even when matrix.c was being
      built outside of Weston, which caused it to depend on libwayland
      headers, which were not included in the Meson build of test-matrix.
      Test-matrix has no reason to depend in libwayland in any way, so this
      patch fixes that.
      Reported-by: unrelentingtech's avatarGreg V <greg@unrelenting.technology>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pq@iki.fi>
      a23ce295
  2. 15 Jun, 2015 1 commit
  3. 05 Jun, 2013 1 commit
    • Daniel Stone's avatar
      configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS · c228e23b
      Daniel Stone authored
      
      
      AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
      macros to expose the largest extent of functionality supported by the
      underlying system.  This is required since these macros are often
      limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
      on some systems hide declarations which are not part of the X/Open spec.
      
      Since this goes into config.h rather than the command line, ensure all
      source is consistently including config.h before anything else,
      including system libraries.  This doesn't need to be guarded by a
      HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
      modular transition.
      Signed-off-by: Daniel Stone's avatarDaniel Stone <daniel@fooishbar.org>
      
      [pq: rebased and converted more files]
      c228e23b
  4. 28 Jan, 2013 1 commit
  5. 07 Dec, 2012 1 commit
    • Kristian Høgsberg's avatar
      Link matrix.c into weston again · 3a8d3f2e
      Kristian Høgsberg authored
      We want to make sure that the matrix symbols are exported from weston and
      that modules get them from there.  To do that, we pull matrix.[ch] out of
      libshared and back into weston.  calibrator now also links to matrix.[ch]
      and we add a IN_WESTON define to enable the WL_EXPORT macro when compiled
      inside weston.
      3a8d3f2e
  6. 06 Dec, 2012 1 commit
  7. 13 Nov, 2012 1 commit
  8. 04 Oct, 2012 1 commit
  9. 27 Jan, 2012 5 commits
    • Pekka Paalanen's avatar
      compositor: simplify the matrix inversion API · d1f0ab63
      Pekka Paalanen authored
      
      
      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's avatarPekka Paalanen <ppaalanen@gmail.com>
      d1f0ab63
    • Pekka Paalanen's avatar
      tests: add matrix-test · 4520d5ca
      Pekka Paalanen authored
      
      
      Add a new directory tests/ for unit test applications. This directory
      will be built only if --enable-tests is given to ./configure.
      
      Add matrix-test application. It excercises especially the
      weston_matrix_invert() and weston_matrix_inverse_transform() functions.
      It has one test for correctness and precision, and other tests for
      measuring the speed of various matrix operations.
      
      For the record, the correctness test prints:
      
      a random matrix:
         1.112418e-02   2.628150e+00   8.205844e+02  -1.147526e-04
         4.943677e-04  -1.117819e-04  -9.158849e-06   3.678122e-02
         7.915063e-03  -3.093254e-04  -4.376583e+02   3.424706e-02
        -2.504038e+02   2.481788e+03  -7.545445e+01   1.752909e-03
      
      The matrix multiplied by its inverse, error:
         0.000000e+00  -0.000000e+00  -0.000000e+00  -0.000000e+00
         0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
        -0.000000e+00  -0.000000e+00   0.000000e+00  -0.000000e+00
         0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
      max abs error: 0, original determinant 11595.2
      
      Running a test loop for 10 seconds...
      test fail, det: -0.00464805, error sup: inf
      test fail, det: -0.0424053, error sup: 1.30787e-06
      test fail, det: 5.15191, error sup: 1.15956e-06
      tests: 6791767 ok, 1 not invertible but ok, 3 failed.
      Total: 6791771 iterations.
      
      These results are expected with the current precision thresholds in
      src/matrix.c and tests/matrix-test.c. The random number generator is
      seeded with a constant, so the random numbers should be the same on
      every run. Machine speed and scheduling affect how many iterations are
      run.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
      4520d5ca
    • Pekka Paalanen's avatar
      compositor: implement inverse matrix transformation · 75b47ec4
      Pekka Paalanen authored
      
      
      Implement 4x4 matrix inversion based on LU-decomposition with partial
      pivoting.
      
      Instead of simply computing the inverse matrix explicitly, introduce the
      type struct weston_inverse_matrix for storing the LU-decomposition and
      the permutation from pivoting. Using doubles, this struct has greater
      precision than struct weston_matrix.
      
      If you need only few (less than 5, presumably) multiplications with the
      inverse matrix, is it cheaper to use weston_inverse_matrix, and not
      compute the inverse matrix explicitly into a weston_matrix.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
      75b47ec4
    • Pekka Paalanen's avatar
      compositor: drop inverse matrix from weston_transform · 061b7471
      Pekka Paalanen authored
      
      
      Remove the inverse matrix member from struct weston_transform. It is
      easier (and probably faster, too) to create and store only forward
      transformation matrices in a list, multiply them once, and then invert
      the final matrix, rather than creating both forward and inverse
      matrices, and multiplying both.
      
      Add a stub for the 4x4 matrix inversion function.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
      061b7471
    • Pekka Paalanen's avatar
      compositor: move matrix code to separate files · 668ca37b
      Pekka Paalanen authored
      
      
      Move matrix code to separate files to allow writing unit tests for it.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
      668ca37b