Commit graph

83 commits

Author SHA1 Message Date
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
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