Commit graph

21 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
273cf8a432
feat: log current planes on apply
It is helpful for debugging to know in which state the available planes on an
output are when a layout is applied that leads to a change.

For that log all planes that are compatible with the output. Currently disabled
planes have multiple properties logged per line to keep the log short.

Example:

== Apply request for output 62 ==
  Note: Reused previous plane allocation 5 times.

Available planes (on output 62):
  Plane 55:
    type: primary
    FB_ID: 93
    IN_FENCE_FD: -1
    CRTC_ID: 62
    CRTC_X: 39
    CRTC_Y: 0
    CRTC_W: 3761
    CRTC_H: 2160
    SRC_X: 0
    SRC_Y: 0
    SRC_W: 2349
    SRC_H: 1349
    COLOR_ENCODING: 0
    COLOR_RANGE: 0
  Plane 61 (inactive):
    type: cursor FB_ID: 0 IN_FENCE_FD: -1 CRTC_ID: 0
    CRTC_X: 0 CRTC_Y: 0 CRTC_W: 0 CRTC_H: 0
    SRC_X: 0 SRC_Y: 0 SRC_W: 0 SRC_H: 0
  Plane 58 (inactive):
    type: overlay FB_ID: 0 IN_FENCE_FD: -1 CRTC_ID: 0
    CRTC_X: 0 CRTC_Y: 0 CRTC_W: 0 CRTC_H: 0
    SRC_X: 0 SRC_Y: 0 SRC_W: 0 SRC_H: 0
    alpha: 65535 pixel blend mode: 0

Committed layers:
  Layer 0x561febd41260:
    FB_ID = 93
    zpos = 0
    SRC_X = 0
    SRC_Y = 0
    SRC_W = 2349
    SRC_H = 1349
    CRTC_X = 39
    CRTC_Y = 0
    CRTC_W = 3761
    CRTC_H = 2160
  Layer 0x561febd3c830:
    FB_ID = 110
    zpos = 2
    SRC_X = 0
    SRC_Y = 0
    SRC_W = 48
    SRC_H = 48
    CRTC_X = 66
    CRTC_Y = 39
    CRTC_W = 48
    CRTC_H = 48

Reset planes: 55 52 49 46 43 40 <p|c> 71 69 67 65 63 61 <c|o> 58

Performing allocation for plane 55 (1/13)
  Layer 0x561febd41260 -> plane 55: applying properties...
  Layer 0x561febd41260 -> plane 55: success
Performing allocation for plane 61 (12/13)
  Layer 0x561febd3c830 -> plane 61: applying properties...
  Layer 0x561febd3c830 -> plane 61: success
Performing allocation for plane 58 (13/13)
Found a better allocation with score=2
  Layer 0x561febd3c830 -> plane 55: applying properties...
  Layer 0x561febd3c830 -> plane 55: success
Performing allocation for plane 61 (12/13)
  Layer 0x561febd41260 -> plane 61: applying properties...
  Layer 0x561febd41260 -> plane 61: success
Performing allocation for plane 58 (13/13)
Found plane allocation for output 0x561febd3e2a0 with score=2

Final assignment of layers to planes:
  [1] Layer 0x561febd41260 -> plane 55 (primary)
  [2] Layer 0x561febd3c830 -> plane 61 (cursor)
2020-03-10 11:59:38 +01:00
Roman Gilg
06f05bf188
feat: log type of assigned planes
Additionally on apply log the type of planes in the final assignment for a
direct overview of the result.
2020-03-10 11:57:59 +01:00
Roman Gilg
80a31d0254
feat: log type information about reset planes
On apply to an output planes associated with the output are being reset. For
easier debugging make clear in the list in the log which planes have which
type.
2020-03-10 11:57:00 +01:00
Roman Gilg
31024f307e
feat: log output relevant data
Log the creation of outputs and simplify output-specific data on apply.
2020-03-10 11:56:58 +01:00
Roman Gilg
afef092218
feat: log device creation
For a new device log relevant data including all planes the output/CRTC
supports.
2020-03-10 11:52:37 +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
6b2cbeb0d4
Indent log on property applying and layer assignment
Indent when applying properties and assigning the layers. The log is better to
read this way. Example:

    Apply on output 0x55c447db2b50.
    Layers on CRTC 62:
      Layer 0x55c447db2a40:
        FB_ID = 108
        zpos = 0
        alpha = 65535
        SRC_X = 0
        SRC_Y = 0
        SRC_W = 3840
        SRC_H = 2160
        CRTC_X = 0
        CRTC_Y = 0
        CRTC_W = 3840
        CRTC_H = 2160
    Disabling planes: 55 52 49 46 43 40 71 69 67 65 63 61 58
    Performing allocation for plane 55 (1/13)
      Layer 0x55c447db2a40 -> plane 55: applying properties...
      Layer 0x55c447db2a40 -> plane 55: incompatible properties
    Performing allocation for plane 61 (12/13)
      Layer 0x55c447db2a40 -> plane 61: applying properties...
      Layer 0x55c447db2a40 -> plane 61: incompatible properties
    Performing allocation for plane 58 (13/13)
      Layer 0x55c447db2a40 -> plane 58: applying properties...
      Layer 0x55c447db2a40 -> plane 58: success
    Found a better allocation with score=1
    Found plane allocation for output 0x55c447db2b50 with score=1
    Assigning layers to planes:
      Layer 0x55c447db2a40 -> plane 58
2020-03-08 14:18:09 +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
64cfbc8e58
Fix format string for plane ID 2020-01-13 10:42:46 +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
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
5faa1e466b
Remove outdated TODO 2019-10-30 20:45:15 +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