Commit graph

52 commits

Author SHA1 Message Date
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
Simon Ser
679e2bb0cd
Allow caller to pass commit flags
When the caller wants to perform a modeset, they will need to pass
DRM_MODE_ATOMIC_ALLOW_MODESET in the atomic commit flags, otherwise the driver
will fail the commit. libliftoff also needs to provide these flags in its
test-only commits.
2020-11-10 16:27:55 +01:00
Jan Beich
0095702303 build: ignore warnings in libdrm headers
In file included from ../log.c:4:
In file included from ../include/log.h:4:
In file included from ../include/libliftoff.h:8:
/usr/local/include/xf86drmMode.h:551:19: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
        uint32_t lessees[0];
                         ^
/usr/local/include/xf86drmMode.h:558:19: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
        uint32_t objects[0];
                         ^
2020-10-31 09:17:13 +01:00
Jan Beich
ca097d55bc test: bump POSIX version for CLOCK_MONOTONIC
test/bench.c:99:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &start);
                      ^
test/bench.c:106:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &end);
                      ^
2020-10-31 09:17:13 +01:00
Simon Ser
b0042828ad
test: add test with fully transparent layer 2020-05-26 21:30:31 +02:00
Simon Ser
5603060a9b
Take disabled layers into account in non_composition_layers_len
Disabled layers (with FB_ID = 0) don't need a plane. Fix the
non_composition_layers_len count in this case.

Closes: https://github.com/emersion/libliftoff/issues/49
2020-05-26 20:08:12 +02:00
Simon Ser
46095c6428
test/libdrm_mock: add prefix to logs
Allows to easily tell where they're coming from.
2020-05-26 18:55:47 +02:00
Simon Ser
6d4e22a5f8
test: a test-only commit doesn't apply properties
This fixes a misunderstanding of the DRM API. Only a regular commit applies
properties.

Fixes: b16078769e ("test/libdrm_mock: a test-only commit applies properties")
2020-05-26 18:49:04 +02:00
Simon Ser
95da3ee649
Add support for the rotation property 2020-05-26 11:35:50 +02:00
Simon Ser
234dce4f20
test: add test for alpha prop 2020-05-22 17:44:41 +02:00
Simon Ser
c214afa3ee
test: allow to attach props to mock planes
This allows tests to have planes which have additional properties, like
"alpha".
2020-05-22 17:39:56 +02:00
Simon Ser
7cca504ae6
test: add internal mutable prop list
This will allow tests to register their own properties.
2020-05-22 17:39:33 +02:00
Simon Ser
2b02f50553
Replace assert(0) with abort()
This avoids -Wreturn-type warnings.
2020-05-19 12:10:17 +02:00
Simon Ser
b16078769e
test/libdrm_mock: a test-only commit applies properties
The previous mock library assumed the DRM client would always set all
properties in the atomic request. However, if a previous test-only commit
has set a property, there's no need to set it again.

Accomodate for this in libdrm_mock. This will be useful when we'll skip
setting properties that haven't changed in libliftoff.

References: https://github.com/emersion/libliftoff/issues/37
2020-01-13 12:14:33 +01:00
Simon Ser
7286146341
test: add a test with a zero FB_ID
References: 53a7bfebc9 ("Don't allocate planes for layers without a FB")
2019-12-19 17:54:49 +01:00
Simon Ser
71200724c5
test: add a test with a layer without any prop set
Makes sure libliftoff doesn't allocate a plane for the layer and doesn't crash.

References: 799f694587 ("Fix segfault when FB_ID isn't set")
References: 53a7bfebc9 ("Don't allocate planes for layers without a FB")
2019-12-19 17:50:40 +01:00
Simon Ser
657a9917c5
Add a way to force FB composition
Closes: https://github.com/emersion/libliftoff/issues/17
2019-12-13 11:38:14 +01:00
Simon Ser
d8c20ddac2
Don't re-use prev alloc on composition layer change 2019-12-12 23:23:53 +01:00
Simon Ser
333e454e98
test: make mock drmModeAtomicAddProperty return cursor
For consistency with the original libdrm function.
2019-11-29 11:06:57 +01:00
Simon Ser
e09ebdac27
test: add empty test
Make sure calling apply() with no layer works as expected.
2019-11-29 10:57:24 +01:00
Simon Ser
ceb4a1ff9e
Replace liftoff_device_apply with liftoff_output_apply
Compositors need to drive multiple connectors, each with its own vblank timings.
For each device, there's one separate rendering loop per output.

It's not possible to call liftoff_device_apply each time we want to submit a new
frame to one output, because this could touch another's output state, submitting
a new frame there in the process. When the other output will submit a new frame,
it'll get EBUSY (can't submit two frames without waiting for vblank).

Closes: https://github.com/emersion/libliftoff/issues/21
2019-11-24 18:13:40 +01:00
Simon Ser
ef75ba26e0
Don't re-use previous allocation if a layer has been removed
Start from scratch since we may be able to come up with a better allocation
(if the layer made another layer fall back to composition for instance).

Closes: https://github.com/emersion/libliftoff/issues/30
2019-11-24 13:25:59 +01:00
Simon Ser
44d65288d7
Fixup display → device bulk rename
I managed to do a bit of a mess here.

Fixes: b0e2b083f9 ("Rename display to device")
2019-11-24 13:07:12 +01:00
Simon Ser
d51e2fb2fe
test/libdrm_mock: bump resource limitations
Bump the maximum number of layers and properties to allow more aggressive
benchmarking.
2019-10-30 21:16:42 +01:00
Simon Ser
8272b61150
test: add benchmark
This is a pretty basic benchmark measuring the time spent in
liftoff_display_apply.

The current behaviour tries to reproduce the worst case scenario: layers don't
intersect and one plane is incompatible with all layers.
2019-10-30 21:16:42 +01:00
Simon Ser
30073e5295
test: add a new test for layer priority
This test continuously updates a layer's FB for some time, and keeps another
layer static. The continously updated layer should be put in a plane.

The test is disabled for now because priorities aren't implemented yet.
2019-10-30 20:41:25 +01:00
Simon Ser
a8cba323eb
test: add a dynamic test
This new test checks that the library can re-use the previous plane allocation
without starting from scratch.
2019-10-15 12:08:02 +03:00
Simon Ser
ca0cbbee02
test: add liftoff_mock_commit_count
This allows tests to read the number of atomic commits performed by the library.
2019-10-14 18:44:48 +03:00
Simon Ser
6849a6af1f
test: refactor build
Put the tests definition inside a big dictionary (with the executable test name
and the subtests). This allows to easily add more executables.
2019-10-14 18:44:48 +03:00
Simon Ser
5115e96cd9
test: add composition tests 2019-10-11 14:31:17 +03:00
Simon Ser
1ee86c6290
Add logging functions
This allows turning on and off debug logs, as well as defining a logging
callback.
2019-10-11 12:03:14 +03:00
Simon Ser
7382dfd346
Add intersection check for layers over the current one
Make sure we don't use planes with lower zpos for layers over the previous ones,
unless there is no collision.

This adds the last intersection check.

Closes: https://github.com/emersion/libliftoff/issues/3
2019-09-15 23:54:29 +03:00
Simon Ser
c63c8c0d15
test: add zpos-4x-disjoint-alt
And restore the original zpos-4x-disjoint test. Depending on the constraints on
the last two layers, one branch of the layer zpos check or the other is taken.

Fixes: 8617ddfd05 ("Add intersection check for planes under the current one")
2019-09-15 23:48:10 +03:00
Simon Ser
8617ddfd05
Add intersection check for planes under the current one
References: https://github.com/emersion/libliftoff/issues/3
2019-09-15 22:31:10 +03:00
Simon Ser
c5d22e1310
Add intersection checks for composited layer on top check
has_composited_layer_on_top is now less strict and performs plane intersection
checks before returning true.

This allows for more layers to be assigned to planes, the relevant tests have
been enabled.

References: https://github.com/emersion/libliftoff/issues/3
2019-09-15 17:08:32 +03:00
Simon Ser
b447a3bc34
test: prevent layers from being assigned to primary plane
In these tests, we always want to use the same layer for the primary plane.
Prevent othr layers from ending up on the primary plane.
2019-09-15 16:56:24 +03:00
Simon Ser
8c93a6fc88
test: add alloc@zpos-4x-domino-partial
This is a variant of alloc@zpos-4x-domino-fail, with plane ordering changed so
that one layer can be mapped to a plane.
2019-09-14 21:18:20 +03:00
Simon Ser
a93ea4a300
test: add alloc@zpos-4x-domino-fail
This test makes sure composited layers make layers underneath fall back to
composition too, in a transitive manner. That is, if plane A is under plane B
which is itself under plane C, plane A falling back to composition means that
both planes B and C fall back to composition too (even if C isn't directly
underneath A).
2019-09-14 21:05:14 +03:00
Simon Ser
07e04a50b6
Make composited layers prevent plane allocation underneath
If a layer cannot be mapped to a plane, make it so all layers under it also fail
plane allocation so that they can be properly composited on the primary plane.

A test was incorrect and has been fixed. Another test had two possible solutions
and has been updated with the one libliftoff yields.
2019-09-14 21:03:30 +03:00
Simon Ser
d9024483c8
test: make our mock drmModeAtomicReq support more properties
We are hitting the 64 properties limit in some new tests.
2019-09-14 20:59:11 +03:00
Simon Ser
a3b8bc33ea
test: add various zpos tests
Some of these are failing, so they are disabled for now.
2019-09-14 12:59:37 +03:00
Simon Ser
3200016033
test: add basic zpos tests
zpos-3x maps three layers to primary, cursor and one of the overlays planes.

zpos-4x-partial sets up 4 layers but is only able to find a plane for 3 layers,
because ordering between the two overlay planes is undefined.
2019-09-13 22:53:15 +03:00
Simon Ser
de8175c998
test: add an alloc test with 3 layers 2019-09-13 22:35:23 +03:00
Simon Ser
060023c6f1
test: fix atomic commit layer compatibility
Used wrong index while iterating.
2019-09-13 22:34:34 +03:00
Simon Ser
fccdebfd6e
test: introduce structured alloc tests
This is a new kind of tests defined by a static structure. The structure
contains the layers and planes to setup as well as the expected result.
2019-09-13 19:47:00 +03:00
Simon Ser
54bb501cae
test: add liftoff_mock_drm_get_plane
Allows to get a mock plane from a plane ID.
2019-09-13 19:46:21 +03:00