Commit graph

22 commits

Author SHA1 Message Date
Simon Ser
706bdf849e drm: store KMS props in a map 2021-03-05 14:18:09 +01:00
Simon Ser
c7c917e39a Read DRM_CAP_ADDFB2_MODIFIERS 2021-02-01 15:52:48 +01:00
Simon Ser
b841139327 Collect plane modifiers
This will be useful once we implement support for modifiers.
2021-02-01 15:08:01 +01:00
Roman Gilg
ceeef3567d Use DRM_CAP_CURSOR_{WIDTH,HEIGTH} for cursor buffer
Hardware often has cursor plane limitations for the buffer size.

Co-authored-by: Simon Ser <contact@emersion.fr>
2020-12-11 12:39:00 +01:00
Simon Ser
a62740e393 Rename drm_can_avoid_composite to drm_prepare
drm_can_avoid_composite doesn't merely checks whether we can avoid
composition: it also prepares a pending atomic request. It's always
necessary to call this function before drm_atomic_commit.

Rename the function to make this clearer.
2020-11-12 20:48:15 -08:00
Simon Ser
aac57e7c75 Hold client buffers till KMS stops using them 2020-09-01 12:36:35 -07:00
Pierre-Loup A. Griffais
fb2fd1127a Revert "Hold client buffers till KMS stops using them"
This reverts commit c9e11ebdbf.
2020-07-24 15:01:28 -07:00
Simon Ser
c9e11ebdbf Hold client buffers till KMS stops using them 2020-07-23 22:26:06 +02:00
Simon Ser
bae255ee1a
Get rid of C_SIDE
wlroots headers can mostly be included with extern "C" blocks. Two
exceptions are the use of `static` for array args and `class` as a
struct field. These can be #define'ed to avoid C++ build errors.

This allows the whole project to be built as a single C++ codebase,
without having to maintain hybrid header files.
2020-06-11 12:44:36 +02:00
Simon Ser
9802890c93
Fix spurious assertions in page_flip_handler
This commit fixes two issues.

A first issue is that fbids_in_req was previously populated
drm_can_avoid_composite and read from in page_flip_handler. As a
result, calling drm_can_avoid_composite then page_flip_handler would
prevent drm_atomic_commit from referencing the right FBs
(page_flip_handler runs in a separate thread and clears fbids_in_req).

To fix this, add a new fbids_queued vector filled by drm_atomic_commit.
Make page_flip_handler read from this new vector instead of
fbids_in_req. As a bonus, this fixes a data race since fbids_queued is
now protected by flip_lock.

The second issue is that drm_can_avoid_composite assumes all layers made
it into a hw plane when liftoff_output_apply succeeds. That's not the
case because libliftoff supports mixed hw plane + composition (where
some layers make it into a hw plane and the others get composited).

To fix this, make drm_can_avoid_composite fail if some but not all
layers make it into a hw plane. In the future, we'll want to support the
mixed mode too.

Closes: https://github.com/Plagman/gamescope/issues/65
References: https://github.com/Plagman/gamescope/issues/41
2020-05-26 16:29:50 +02:00
Simon Ser
bcc7cf3b55
Fix memory leak in drm_can_avoid_composite
We were creating a new DRM blob each page-flip and never destroying it.
Instead, create the mode blob once on startup.
2020-05-26 10:57:57 +02:00
Simon Ser
2062141c49
Introduce drm_free_fb
This function takes care of calling drmModeRmFB. In the future it'll
also take care of releasing the client buffer when using direct
scan-out.
2020-05-19 14:25:59 +02:00
Simon Ser
0ee8d451e4
Replace map_fbid_inflightflips pair with a struct
This makes it explicit what "first" and "second" are. This also allows
to add more fields.
2020-05-19 14:05:52 +02:00
Roman Gilg
8833e07618 feat: add layer debugging via libliftoff log
Activate libliftoff's internal log when layers are enabled and the parameter
'd' is provided.

Note: this needs some patches to libliftoff to make the debug readable that I
have proposed upstream.
2020-03-10 02:02:40 +01:00
Pierre-Loup A. Griffais
56b2aa2d92 wlserver: wire kb+mouse+touch input coming from wlr, mainly libinput.
Add the concept of a cursor coordinate when that initializes when focusing
a surface.

Put some super primitive tap to left-click emulation in there for now.
2020-01-17 02:36:53 -08:00
Pierre-Loup A. Griffais
94ecdfdc6e drm: more logging. 2020-01-13 20:57:39 -08:00
Pierre-Loup A. Griffais
4d6602ba4b DRM: Make liftoff layers conditional for now.
Can't get them to be useful, might need library and amdgpu DC fixes.
2020-01-06 19:36:20 -08:00
Pierre-Loup A. Griffais
6b3e2ddf68 DRM: multi-plane support via libliftoff.
Import libliftoff as subproject and plumb our planes through it.

Wait for a flip to complete immediately after queuing it for now.

Also immediately wait for cursor image uploads, as we don't have to
do Vulkan rendering anymore after queuing an upload.

Cursor shows up with format hack, but is badly corrupt. We might need
to use a DRM dumb_fb rather than going through the same Vulkan image.

Alpha bits of surfaces are ignored again, need to make Steam select
an ARGB visual for overlay windows, probably.

Setting up the "alpha" plane property somehow makes overlays not
show up at all despite liftoff happily letting us go with scanout.
2020-01-05 22:19:04 -08:00
Pierre-Loup A. Griffais
8db29e4c24 Make direct DRM flipping match composite description.
Also overload VulkanPipeline_t some more. :/
2020-01-01 15:30:38 +09:00
Pierre-Loup A. Griffais
c186dc28cf Make all output paths coexist in harmony. 2020-01-01 15:30:38 +09:00
Pierre-Loup A. Griffais
e61b20710e Enough Vulkan stuff to render to an image and flip it on screen.
No texturing yet, that's next after some surgery on the lump of code.
2020-01-01 15:30:37 +09:00
Pierre-Loup A. Griffais
2be0bdbcbb Start of Vulkan compute rendering code. Getting FBIDs (glxgears still OK). 2020-01-01 15:30:37 +09:00
Renamed from src/drm.h (Browse further)