Use fixed number of threads and sequential mode for reftests

This fixes #1975 and #2577.

The reference tests use now 4 threads for rendering and layout. The number is quite random. In terms of performance it would be better to choose the thread number based on the given hardware, but on the other hand a fixed number might make the tests more reproduceable. I went with the later.

Also, this PR addes new `check-ref-cpu-sequential` and `check-ref-gpu-sequential` make/test targets, which will run the tests with only one layout and render thread.