Commit graph

228 commits

Author SHA1 Message Date
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
87e5dcfe72 build: bump version to 0.2.0 2021-08-09 11:29:05 +02:00
Simon Ser
89c1d37547 Make liftoff_layer_set_property return negative errno
This allows the caller to check for errors.
2021-08-09 11:27:08 +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
f5a2b541ce Make liftoff_device_register_all_planes return an int
For consistency with liftoff_output_apply.
2021-07-30 16:19:29 +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
a58b638736 build: bump version to 0.1.0 2021-07-01 14:34:53 +02:00
Simon Ser
37a5f27e89 readme: link to the example/ dir 2021-07-01 13:24:28 +02:00
Simon Ser
2e4254b124 readme: link to compositor guidelines 2021-07-01 13:23:26 +02:00
Simon Ser
b94f1e104f doc/compositor: new document 2021-07-01 13:20:46 +02:00
Simon Ser
326c8d67ad Fixup reference to liftoff_layer_get_plane_id in docs 2021-07-01 13:14:23 +02:00
Simon Ser
f1c2ac1981 readme: update short description 2021-07-01 11:55:25 +02:00
Simon Ser
27614202d2 readme: add missing liftoff_device_register_all_planes call 2021-07-01 11:52:58 +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
8260fa67d7 Introduce liftoff_plane_get_id
This allow users calling liftoff_device_register_all_planes to
easily figure out what a liftoff_plane represents.
2021-07-01 11:39:52 +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
799dddd6c4 ci: drop codecov
Instead generate the HTML reports ourselves, and rely on builds.sr.ht
artifacts.
2021-04-30 10:17:59 +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
12eb851a40 readme: reference the example/ dir 2021-03-29 17:39:25 +02:00
Simon Ser
c4ef21af35 Move layer_is_visible to layer.c 2021-02-24 11:40:01 +01:00
Simon Ser
470af77869 Rename pkg-config file to "libliftoff" 2021-02-24 11:01:23 +01:00
Simon Ser
88eb35b084 build: remove libraries keyword arg from pkgconfig.generate
This fixes the following warning:

    ../subprojects/libliftoff/meson.build:53: DEPRECATION: Library liftoff was
    passed to the "libraries" keyword argument of a previous call to generate()
    method instead of first positional argument. Adding liftoff to "Requires"
    field, but this is a deprecated behaviour that will change in a future
    version of Meson. Please report the issue if this warning cannot be avoided
    in your case.
2021-02-24 10:59:23 +01:00
Simon Ser
27462556db Document that liftoff_device_create takes ownership of the FD 2021-02-23 18:10:47 +01:00
Simon Ser
fbc4cf8dba
Stop enabling UNIVERSAL_PLANES
UNIVERSAL_PLANES is implicitly enabled by ATOMIC. No need to require both.
2020-12-22 15:06:13 +01:00
Simon Ser
c9e42e3c14
Improve doc comments
Improve formatting and expand descriptions.
2020-12-06 15:23:01 +01: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
89b37acd98
Force re-alloc when previous FB_ID was 0 2020-12-05 12:34:25 +01:00
Simon Ser
b936348acc
Replace liftoff_layer_property.changed with prev_value
Keep track of the previous value, e.g. to figure out when a layer goes from
disabled (no FB_ID or zero alpha) to enabled.
2020-12-05 12:28:50 +01:00
Simon Ser
1700cbf1c9
Force re-alloc when setting FB to 0 2020-12-05 12:18:36 +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
93a346ff95
example: fix exit status after failed drmModeAtomicCommit 2020-11-12 15:15:55 +01:00
Simon Ser
24abeb923f
Remove DRM_MODE_PAGE_FLIP_EVENT from commit flags
It's illegal to request a page-flip event when performing a test-only commit.
The kernel returns EINVAL in this case [1].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_atomic_uapi.c?id=407ab579637ced6dc32cfb2295afb7259cca4b22#n1318
2020-11-10 16:42:06 +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
Simon Ser
f7837738c4
ci: add freebsd CI 2020-11-05 15:21:51 +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
8ff01dc6a1
Don't pick a plane for fully transparent layers
Layers with alpha = 0 don't need a plane since they aren't visible.

Closes: https://github.com/emersion/libliftoff/issues/48
2020-05-26 21:29:59 +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
44946c44d8
Add support for the alpha property
If the layer is completely opaque, we don't need a plane with the alpha
property.
2020-05-22 17:40:33 +02:00