Commit graph

28 commits

Author SHA1 Message Date
Simon Ser
35c06e8995 Add option to set timeout for liftoff_output_apply()
The default limit of 1ms might be too short if the compositor
calls liftoff_output_apply() early in the vblank cycle, or too
long if the refresh rate is high. The compositor is in a better
spot to decide how much time should be spent on atomic tests, so
add an option for that.

Closes: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/78
2024-05-21 08:45:56 +00:00
Simon Ser
25dd6d662e Fix -Wsign-conversion on 32-bit
Closes: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/75
2023-02-22 10:45:05 +01:00
Simon Ser
ce325b1ee6 Turn on -Wsign-conversion
References: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/74
2023-02-16 21:33:36 +01:00
Simon Ser
b2721f739c Turn on -Wfloat-conversion
References: https://gitlab.freedesktop.org/emersion/libliftoff/-/issues/74
2023-02-16 21:07:05 +01:00
Simon Ser
99ed53677a Turn on -Wdeclaration-after-statement
Enforces code style.
2023-02-16 20:03:42 +01: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
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
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
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
93a346ff95
example: fix exit status after failed drmModeAtomicCommit 2020-11-12 15:15:55 +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
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
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
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
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
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
76cca57504
example: add a description of each example 2019-10-15 11:55:23 +03:00
Simon Ser
927efe09d2
example/compositor: handle out-of-bounds coords when compositing 2019-10-11 22:54:54 +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
fe1ee8563d
example/compositor: add flag to specify number of layers 2019-09-30 12:25:38 +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
3999474b32
Move example to its own directory 2019-09-16 23:41:19 +03:00