Commit graph

97 commits

Author SHA1 Message Date
Simon Ser
c63676eda7 test: add silent mode to libdrm_mock
Useful for benchmarks.
2024-05-21 10:25:35 +02:00
Simon Ser
ee3769e678 test: add prop@fb-damage-clips
Ensure that FB_DAMAGE_CLIPS is ignored if a plane is missing the
property.
2024-05-15 22:12:28 +02:00
Leo Li
4124ee8c7a Keep output layers ordered by allocation priority
To optimize for offloading success, the list of output layers can be
ordered by allocation priority, improving the chances of a higher
allocation score before the deadline.

The allocation algorithm picks DRM planes first, then tests output
layers against them. To reduce the number of tests, the layers can be
ordered such that it matches the DRM plane order. DRM planes in
libliftoff are ordered by primary, followed by all other planes in
descending z-order. We order the layers similarly, with the composition
layer first, followed by layers of descending priority.

In addition to layer priority, it's z-pos and intersection with other
layers are considered. Since to offload a high priority layer, all
intersection layers with higher z-pos will also need to be offloaded.

This also changes when reallocation is necessary. On top of the existing
criteria, reallocation is done when a layer's ordering changes.

With layer priority now considered, the priority test now passes --
enable it.
2023-12-20 16:03:49 +00:00
Simon Ser
25dd6d662e Fix -Wsign-conversion on 32-bit
Closes: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/75
2023-02-22 10:45:05 +01:00
Simon Ser
ce325b1ee6 Turn on -Wsign-conversion
References: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/74
2023-02-16 21:33:36 +01:00
Simon Ser
99ed53677a Turn on -Wdeclaration-after-statement
Enforces code style.
2023-02-16 20:03:42 +01:00
Simon Ser
9e44872217 test/prop: add range/enum/bitmask tests 2023-02-16 12:36:24 +01:00
Simon Ser
a002a240e9 test/prop: simplify by introducing commit() function 2023-02-15 20:12:37 +01:00
Simon Ser
8ec1203e64 test: add IN_FORMATS test 2023-02-15 19:19:24 +01:00
Simon Ser
94f45a91c4 test: add liftoff_mock_plane_add_in_formats() 2023-02-15 19:19:24 +01:00
Simon Ser
8a9167f9fd test/libdrm_mock: add stub blob functions 2023-02-15 19:12:46 +01:00
Simon Ser
0811ce855b test/libdrm_mock: take initial prop value as separate arg
drmModePropertyRes.values never holds the current value. Stop
abusing this field.
2023-02-15 18:39:57 +01:00
Simon Ser
afeeafd6d7 test: add basic test for candidate planes 2023-02-15 18:20:23 +01:00
Simon Ser
3e72fc3c5d test/libdrm_mock: add liftoff_mock_plane_get_id()
Useful when manually calling liftoff_plane_create() is desirable.
2023-02-15 18:20:23 +01:00
Simon Ser
62cd0aad09 test: add dynamic@change-fb-modifier 2023-02-15 18:14:13 +01:00
Simon Ser
a669c85be6 test/libdrm_mock: implement drmCloseBufferHandle() stub 2023-02-15 18:14:13 +01:00
Simon Ser
e03edeffba test/libdrm_mock: implement drmModeGetFB2()
By default, drmModeGetFB2() behaves as-if the kernel didn't support
the IOCTL. That way we don't need to update all tests to set sensible
FB info.

If a test is specifically interested in testing drmModeGetFB2()
behavior, it can call liftoff_mock_drm_set_fb_info().
2023-02-15 18:14:13 +01:00
Simon Ser
d39d1837fb test/libdrm_mock: add helpers to convert from/to object index
libdrm_mock's KMS object IDs record the type and index.
2023-02-15 17:56:50 +01:00
Simon Ser
9c84f7945a Introduce liftoff_layer_unset_property()
This can be used when a propperty doesn't have a default/no-op
value, such as COLOR_ENCODING and COLOR_RANGE.
2022-08-05 23:10:14 +02:00
Stephan Lachnit
493685ff1b
test: add includes to partial drm dependency
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
2022-07-26 10:24:12 +02:00
Simon Ser
378ccb4f84 test/alloc: add zpos-3x-zero-alpha
References: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/59
2022-01-31 14:29:16 +01:00
Simon Ser
223e288ae6 test/alloc: add zpos-3x-zero-fb-id
References: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/59
2022-01-31 14:26:20 +01:00
Simon Ser
7a06f8c597 test/alloc: rename composition-zero-fb-id to composition-no-props
This is more consistent with other test names.
2022-01-31 14:05:58 +01:00
Simon Ser
3004a0dcbd test/alloc: move zero-fb-id-fail to test data 2022-01-31 14:03:47 +01:00
Simon Ser
998d8c6a59 test/alloc: drop test_needs_composition logic
This was fine for simple test cases, but would need to become
more complicated for cases where e.g. zero FB_ID or alpha is
involved. Let's just hardcode the expected value in the test data
instead.
2022-01-31 14:00:20 +01:00
Simon Ser
61a8b85059 test/alloc: pass full test_case to run_test
More metadata will be added to the test_case struct soon.
2022-01-31 14:00:20 +01:00
Simon Ser
addeaf6097 test/alloc: replace test_layer.zpos with test_prop
This allows setting arbitrary props.
2022-01-31 13:39:47 +01:00
Simon Ser
32f97b1c51 test/alloc: check test_layer.compat length
Avoid iterating past the array bounds as a safety net. We should
have more than enough room for now, but let's make sure we don't
get caught.
2022-01-31 13:30:45 +01:00
Simon Ser
3ced3be25a test/alloc: make test data const
We should never mutate the test data.
2022-01-31 13:29:58 +01:00
Simon Ser
2e1dd93b60 test/alloc: add zpos-2x-fail 2021-12-14 18:57:04 +01:00
Simon Ser
1db99c213c test/alloc: add zpos-2x-reverse 2021-12-14 18:57:04 +01:00
Simon Ser
408b6e5463 test/test_prop: add unmatched test case
Add a test case where the plane doesn't have a property set on the
layer.
2021-09-30 14:54:33 +02:00
Simon Ser
bc0d0617ac Remove test/include/
Let's just put header files in test/, no need for a separate subdir.
2021-08-13 22:04:28 +02:00
Simon Ser
32683879e7 Add newline after function return type
Aligns our style with Linux' and Weston's.
2021-08-13 22:02:33 +02:00
Simon Ser
8a971695bd test: introduce liftoff_mock_require_primary_plane
This allows to mimick i915's requirement of failing all commits
which don't have the primary plane enabled.

We could expand our test matrix to test with the param *and* without
it, but since enabling the param just makes the atomic check more
strict there's no real benefit of doing that. Enabling the param
can only make tests fail more often, not the other way around.
2021-08-13 12:28:13 +02:00
Simon Ser
8f8c4d18a5 test: make sure NDEBUG is not defined
If NDEBUG is defined, then assert() becomes a no-op. Make sure it's
not.
2021-08-12 18:15:50 +02:00
Simon Ser
6321e7c5aa Add needs_composition APIs
Right now, compositors are expected to query liftoff_layer_get_plane_id to
decide whether a layer needs to be composited.

However there are cases where a layer has no plane, but still doesn't need
composition (e.g. when FB_ID is zero or when alpha is zero, in the future when
the layer is out of CRTC bounds etc).

Add a new API to make users' life simpler.

Closes: https://github.com/emersion/libliftoff/issues/54
2021-08-09 11:56:55 +02:00
Simon Ser
516cf9404d Stop including stdbool.h from libliftoff.h
We don't use bool there anymore.
2021-07-30 16:22:58 +02:00
Simon Ser
61fd4c099a Make liftoff_output_apply return an int
Callers may want to get more details about the failure, in
particular EPERM indicates that the user isn't DRM master (can
happen on VT switch).
2021-07-27 12:28:00 +02:00
Simon Ser
bcb6e3cfb8 Replace liftoff_layer_get_plane_id with liftoff_layer_get_plane
Users can get back the plane ID with liftoff_plane_get_id.
2021-07-01 11:49:36 +02:00
Simon Ser
562f8b0af6 Allow to choose which planes are managed by libliftoff
Closes: https://github.com/emersion/libliftoff/issues/10
2021-07-01 11:37:10 +02:00
Simon Ser
1616f8ae6a test/alloc: document test_layer and test_setup 2021-06-24 19:05:01 +02:00
Simon Ser
b08bbaa5e6 Split liftoff_log_init into set_handler and set_priority
This allows callers to change only one of those, without the other.
Also rename importance to priority and func to handler.
2021-03-31 12:44:24 +02:00
Simon Ser
eaf52b49fc
test: add test with immutable zpos plane props
Closes: https://github.com/emersion/libliftoff/issues/50
2020-12-05 18:52:52 +01:00
Simon Ser
92fbebbe88
test: add missing plane alpha prop to prop@ignore-alpha
The plane would otherwise not be selected because it's missing the alpha prop.
2020-12-05 18:34:37 +01:00
Simon Ser
40411f6d3e
Don't re-alloc when FB_DAMAGE_CLIPS changes
This is updated at each atomic commit.
2020-12-05 14:36:47 +01:00
Simon Ser
9bfe58b7d2
Don't re-alloc when alpha changes 2020-12-05 13:24:17 +01:00
Simon Ser
eda317c25c
Don't re-alloc on IN_FENCE_FD change 2020-12-05 12:44:08 +01:00
Simon Ser
86d7bc9fd7
test: add dynamic unset-fb and set-fb tests
This adds test cases for 89b37acd98 ("Force re-alloc when previous FB_ID was
0") and 1700cbf1c9 ("Force re-alloc when setting FB to 0").
2020-12-05 12:36:34 +01:00
Simon Ser
b4bddc77a2
test: refactor dynamic test
Make it easier for dynamic tests to change the initial configuration and the
expected final allocation.
2020-12-05 11:54:39 +01:00