Commit graph

194 commits

Author SHA1 Message Date
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
b0e2b083f9
Rename display to device
"Display" can also mean "screen"/"monitor", so it's kind of confusing for
this usage.
2019-11-24 12:59:10 +01:00
Simon Ser
5f39331f78
Keep track of the update frequency of each layer
Keep track of the number of layer updates per 60 page-flips.

We could implement a more fine-grained tracking, for instance with a sliding
window. However it's a lot more complex than the current solution and the gains
are not clear. I'd prefer to keep the current solution and experiment with other
solutions once we have a good test-bed.

References: https://github.com/emersion/libliftoff/issues/22
2019-11-15 21:43:44 +01:00
Matt Hoosier
78cc612f10 example: improve CRTC search algorithm
Add a fallback case for finding an eligible CRTC for the
selected connector. The encoder picked may not have been
wired up to that connector by the previous DRM master.
2019-11-08 00:08:06 +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
af36f762ca
log: reset log callback to default when NULL is passed 2019-10-30 20:52:30 +01:00
Simon Ser
5faa1e466b
Remove outdated TODO 2019-10-30 20:45:15 +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
b06596085d
example/multi-output: new example
This example sets up libliftoff with multiple outputs, with a fixed number of
layers per output.
2019-10-30 18:54:21 +01:00
Simon Ser
db6366dc25
Add build-* to .gitignore 2019-10-19 13:46:11 +03:00
Simon Ser
ef29d341cb
Move plane allocation algorithm to alloc.c
And move plane-related functions to plane.c.
2019-10-19 13:43:09 +03:00
Simon Ser
ba80e32054
Introduce liftoff_log_errno
Like perror, but uses the liftoff logging infrastructure.
2019-10-19 13:35:14 +03:00
Simon Ser
dc9c39ed5c
Introduce display_test_commit
This function wraps drmModeAtomicCommit and handles error conditions and
logging.
2019-10-19 13:15:34 +03:00
Simon Ser
cb0794469c
readme: add link to intro blog post 2019-10-16 10:44:29 +03: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
29dfe66ecf
example: add dynamic example
This example demonstrates how incremental layer updates should be applied. It
contains a basic rendering loop. Each layers has a back-buffer and a
front-buffer. The color of one of the layers will change at each frame.
2019-10-15 12:08:02 +03:00
Simon Ser
5a66e567ec
Track layer property changes
This commit adds basic per-property change tracking.

When only FB_ID has changed, we try to re-use the previous allocation. If that
fails, go on with regular plane allocation.

Closes: https://github.com/emersion/libliftoff/issues/6
2019-10-15 12:07:43 +03:00
Simon Ser
76cca57504
example: add a description of each example 2019-10-15 11:55:23 +03:00
Simon Ser
fe2e7d0133
Extract plane allocation constraints in functions
Instead of baking plane allocation constraints in output_choose_layers, extract
constraints checked at each step in check_layer_plane_compatible and final
constraints in check_alloc_valid.
2019-10-15 11:42:40 +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
14d64ebe39
ci: add codecov 2019-10-14 18:04:59 +03:00
Simon Ser
72f5e9bd2f
Add TODO about remaining plane counting optimization 2019-10-13 01:25:08 +03:00
Simon Ser
927efe09d2
example/compositor: handle out-of-bounds coords when compositing 2019-10-11 22:54:54 +03:00
Simon Ser
aacbcf40b4
Split plane functions into a separate file 2019-10-11 17:09:35 +03:00
Simon Ser
5115e96cd9
test: add composition tests 2019-10-11 14:31:17 +03:00
Simon Ser
d63b4291da
example/compositor: take advantage of the composition layer
Create a special layer that we will use only for composition.

If we manage to put all other layers into planes, we don't need to use it.
Otherwise, blend other layers that didn't make it in a plane.
2019-10-11 14:31:17 +03:00
Simon Ser
e9433997d9
Add liftoff_output_set_composition_layer
This lets the library user define a layer where composition will happen. At the
moment there can be at most one composition layer per output, on the primary
plane. It should be possible to remove these restrictions in the future if
desirable.

The composition layer will be put on a plane if and only if composition is
needed.

The compositor needs to know where composited layers will be blended to resolve
zpos conflicts.

Closes: https://github.com/emersion/libliftoff/issues/9
2019-10-11 14:31:17 +03:00
Simon Ser
5b8cbd76db
readme: add CI badge 2019-10-11 13:07:10 +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
3671a64ade
Add opaque structs forward declaration in libliftoff.h 2019-09-30 14:19:27 -04:00
Simon Ser
fe1ee8563d
example/compositor: add flag to specify number of layers 2019-09-30 12:25:38 +03:00
Simon Ser
dd0e550a99
readme: add missing variable decl in example 2019-09-26 10:43:05 +03:00
Simon Ser
de7a7fe5f9
example/compositor: new example 2019-09-25 15:58:38 +03:00
Simon Ser
03679c9303
example/simple: don't hardcode number of layers, use white background 2019-09-25 15:16:14 +03:00
Simon Ser
a30668b06e
example: refactor dumb FB helper
This is necessary for the upcoming composer example.
2019-09-25 15:06:46 +03:00
Simon Ser
a7128585fe
example: extract helpers into separate file 2019-09-25 14:08:07 +03:00
Simon Ser
42b58e8802
example/simple: disable CRTCs we don't use 2019-09-25 12:26:06 +03:00
Simon Ser
35da32683f
Unset CRTC_ID on planes before plane allocation
If a plane was previously enabled on another CRTC, we need to set its CRTC_ID to
zero. Otherwise atomic commits fail with:

    [drm:drm_atomic_check_only [drm]] [PLANE:31:primary A] CRTC set but no FB
2019-09-25 12:23:42 +03:00
Simon Ser
3999474b32
Move example to its own directory 2019-09-16 23:41:19 +03:00
Simon Ser
67549c6c9f
readme: add basic usage 2019-09-16 11:38:54 +03:00
Simon Ser
74040a817b
Rename plane_alloc and plane_data
Rename plane_alloc to alloc_result and plane_data to alloc_step. This is more
accurate and less confusing.
2019-09-16 00:13:04 +03:00
Simon Ser
0596d6f66e
Rename on_top to over
Rename has_composited_layer_on_top to has_composited_layer_over. This is more
consistent with has_allocated_layer_over.

While at it, add a comment to explain why has_allocated_layer_over is named like
so.
2019-09-16 00:00:03 +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
e898ce0631
Fix format string in liftoff_display_apply 2019-09-15 23:28:08 +03:00
Simon Ser
00fb6fce21
ci: add .build.yml 2019-09-15 22:44:18 +03:00
Simon Ser
cf861bae35
Remove last_plane_zpos from plane allocation state
Comparing with the last plane zpos isn't enough, we now perform intersection
checks too. The last plane zpos isn't used anymore, remove it.
2019-09-15 22:32:42 +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