More tests are going to need this.
The API is changed to work by copy in and copy out to match the other
color_util API. Hopefully this makes the caller code easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I will be needing it in a new test, so let's share it.
For convenience, this also adds client back-pointer in struct surface so
that I don't need to pass client explicitly.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Iterate over rgb[] array instead of repeating the code for .r, .g and
.b.
Also in process_pipeline_comparison() f_max_err variable is dropped
since it was not used much.
This should make the code easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Individual struct fields are inconvenient to index into, yet most
operations on a color just repeat the same for each of RGB channel.
Being able to index into RGB avoids repeating the same code for each
channel.
Alpha channel is left as separate, since it is almost never handled the
same as RGB.
The union keeps the old .r, .g and .b addressing working. The static
asserts ensure the aliasing is correct.
For demonstration, two simple functions in color_util.c are converted.
Unfortunately initializers need to be corrected everywhere. Field .a is
not explicitly initialized because it is unused in these cases.
This change should make code easier to read.
This change requires gnu99 or c11 standard. gnu99 is already the default
in top-level meson.build.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
No functional change. Moved color processing
functions into shared files which can be used
between different tests.
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Now that GL-renderer and color manager implement linear light blending
for sRGB EOTF, add a test case to verify the result is expected.
As noted in test comments, this new tests is quite powerful in ensuring
the whole linear light pipeline is working correctly with 1D LUTs in
GL-renderer. This test will even catch smashing source_lut.scale = 1.0f
and source_lut.offset = 0.0f which would result in wrong texture sample
positions for LUT data.
As the assumption is that by default content and outputs are in sRGB
color space, this test should not need fix-ups or become stale when more
color management features are implemented.
The sRGB EOTF can be found in:
http://www.color.org/sRGB.pdf (beware, typos)
https://www.w3.org/Graphics/Color/srgbhttps://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#TRANSFER_SRGB
Note on AMD Polaris 11 error threshold: this is quite likely due to
using fp16 format shadow framebuffer and GCN fp32 to fp16 conversion
instruction rounding mode. When using fp32 shadow framebuffer, the error
glitch is not present and the threshold could be significantly lower.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Instead of checking just the monotonicity of the blending results, this
changes the alpha-blending test to compute the reference blend result
itself and then comparing to the compositor result. This way we can be
sure that the compositor implements the exact correct formula and not
something that just looks nice, as verifying the reference images are
actually correct is hard.
The reference image is renamed to follow the fact that this is not
primarily a monotonicity test anymore. The reference image is also
redundant, but I think it has documentary value.
The #if 0'd block of code was very useful in figuring out blending
errors in a future test case, so it is included here. I have a feeling
we are going to need it again.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Refactor the alpha-blending test to allow using all three images
foreground, background, and screenshot in a future new verification
function.
This is a pure refactoring, no change in behavior.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Fixed a leak found by ASan:
Direct leak of 160 byte(s) in 2 object(s) allocated from:
#0 0x7f511fe11518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
#1 0x7f511fc76373 in zalloc ../../git/wayland/src/wayland-private.h:232
#2 0x7f511fc76373 in proxy_create ../../git/wayland/src/wayland-client.c:422
#3 0x7f511fc79dcc in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
#4 0x7f511fc79dcc in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
#5 0x7f511fc7b17b in wl_proxy_marshal_constructor_versioned ../../git/wayland/src/wayland-client.c:873
#6 0x5583e5348f43 in wl_registry_bind /home/pq/local/include/wayland-client-protocol.h:1165
#7 0x5583e535140b in bind_to_singleton_global ../../git/weston/tests/weston-test-client-helper.c:1863
#8 0x5583e5348752 in alpha_blend_monotonic ../../git/weston/tests/alpha-blending-test.c:219
#9 0x5583e5348571 in wrapalpha_blend_monotonic ../../git/weston/tests/alpha-blending-test.c:200
#10 0x5583e53554cc in run_test ../../git/weston/tests/weston-test-runner.c:162
#11 0x5583e5355b6d in run_case ../../git/weston/tests/weston-test-runner.c:277
#12 0x5583e5355913 in for_each_test_case ../../git/weston/tests/weston-test-runner.c:235
#13 0x5583e5355df5 in testsuite_run ../../git/weston/tests/weston-test-runner.c:311
#14 0x7f511aaaf752 in client_thread_routine ../../git/weston/tests/weston-test.c:404
#15 0x7f511f88cfa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This allows tests to give a meaningful name for their fixture setups
when they use more than one of them.
If a test uses DECLARE_FIXTURE_SETUP_WITH_ARG(), it must now pass a
third argument naming the field which is struct fixture_metadata. This
also means that the fixture setup data must now be a struct, it cannot
be a plain type anymore. A compiler error is generated if the field type
is not the expected one.
All tests using DECLARE_FIXTURE_SETUP_WITH_ARG() and converted to the
new form and given names for their fixture setups.
The fixture setup names not actually used yet, that will be another
patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In anticipation of invasive future work on color management, add an
alpha blending test to make sure we don't break alpha blending.
The idea for doing a monotonicity test came from glennk on #dri-devel in
Freenode IRC.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>