Commit graph

32 commits

Author SHA1 Message Date
Roman Gilg
138f2f2ac5
feat: add log format flags
With these flags API consumers can optimize the depiction of libliftoff's debug
log.

For now the two flags for a section start and end are introduced. It is
guaranteed that one section always ends before the next one begins.

Is no callback function setup section starts and ends in the default stderr
output will be marked with an empty line.

BREAKING CHANGE: The signature of the log callback changes.
2020-03-10 11:59:42 +01:00
Roman Gilg
c05f290f95
feat: log continuous debug messages into per-device buffers
Instead of exposing to consumers write streaming log data into a per-device
buffer that gets created on request and destroyed after the buffer has been
written to the log.

Passing a NULL string to the internal continuous log function triggers a write
of the buffer to the log.

BREAKING CHANGE: continuous log function is moved from log header to private
header.
2020-03-10 11:59:42 +01:00
Roman Gilg
8028aef654
feat: log disabling planes without line breaks
Enumerating all planes to be disabled makes the log unnecessary
sparse. Instead just list all planes in a single line.

For that introduce new API function to log something without line
break in the end and adapt the log callback function pointer.

BREAKING CHANGE: log callback function arguments change.
2020-03-10 11:52:37 +01:00
Roman Gilg
d68b1fc8d7
Add log verbosity helper
Separate function to check verbosity level, which can be used in other internal
parts as well.
2020-03-08 13:05:30 +01:00
Roman Gilg
b713b17d31
Log re-use only on change
On debug verbosity logging every reuse of planes is spamming the log making it
difficult to debug the process.

With this patch only the change of reusing the same allocation is logged and
how often the allocation was reused after this changed back again.
2020-03-08 13:00:08 +01:00
Simon Ser
95d16704b9
Move device_test_commit to device.c 2020-01-13 12:22:47 +01:00
Simon Ser
53a7bfebc9
Don't allocate planes for layers without a FB
When FB_ID is unet or zero, don't try to allocate a plane for the layer. There's
nothing to display anyway.
2019-12-19 17:50:20 +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
c9cdf8ec50
Log layer configuration before alloc 2019-12-12 23:40:01 +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
da59787f4a
Fix DEBUG logs printed when level is set to ERROR 2019-12-12 15:44:45 +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
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
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
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
aacbcf40b4
Split plane functions into a separate file 2019-10-11 17:09:35 +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
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
e85a1a5ecf
Add layer_intersects
This will be useful for implementing optimizations in case planes don't collide.
In these cases we can ignore some zpos constraints.

References: https://github.com/emersion/libliftoff/issues/3
2019-09-15 17:00:48 +03:00
Simon Ser
caac9bc87f
Rename library to liftoff
Let's make these planes useful!
2019-09-12 11:40:21 +03:00
Simon Ser
c4a8afb39b
Add basic support for zpos
This commit adds special handling for the layer zpos property. Setting it won't
forward it to KMS, instead it will be handled internally.

The plane zpos (either retrieved from KMS if the property is supported, or
guessed from the plane type and ID) is checked during plane allocation to have
the same ordering as the layer zpos. This adds more constraints to the
allocation.

Note that the new constraints are too strict. In case two layers don't overlap,
there's no need for one plane to be on top of the other. See [1].

Also, the new constraints don't account for underlay planes [2].

[1]: https://github.com/emersion/libhwc/issues/3
[2]: https://github.com/emersion/libhwc/issues/7

Closes: https://github.com/emersion/libhwc/issues/4
2019-09-12 11:27:00 +03:00
Simon Ser
e2df5e73d0
List planes by allocation order
Given a primary plane with zpos=0 and overlay planes with zpos 1 2, we want
first to allocate the primary plane, then the furthest overlay plane, then the
remaining one: 0 2 1.

References: https://github.com/emersion/libhwc/issues/3
2019-09-09 20:55:43 +03:00
Simon Ser
42db49c6fe
Guess zpos from plane type
Many drivers don't expose the zpos plane property. We can guess it from the
plane type though: primary, overlay, cursor. Except some drivers expose
underlays too: underlays, primary, overlay, cursor. Underlay planes don't have a
special type, they are just marked as overlays. To detect them, check whether
their plane ID is less than the primary plane ID.

References: https://github.com/emersion/libhwc/issues/3
2019-09-08 18:33:09 +03:00
Simon Ser
d90d7bdc36
Check plane is compatible with CRTC
This allows us to rule out some potential solutions.

Closes: https://github.com/emersion/libhwc/issues/2
2019-09-08 17:41:25 +03:00
Simon Ser
165d013b80
Change planes to be a linked list instead of an array
We'll need this anyway when we allow users to choose which planes to give us.
Let's not start building algorithms on top of arrays.
2019-09-08 15:26:50 +03:00
Simon Ser
c3f546328e
Add basic docs 2019-08-23 19:37:53 +03:00
Simon Ser
6d5221370e
Disable unused planes 2019-08-23 18:48:13 +03:00
Simon Ser
9fe471dd6b
Initial experiments 2019-08-21 23:07:37 +03:00