Age | Commit message (Collapse) | Author |
|
Stop using wlr_drm_surface.{width,height} to figure out the size of a
gbm_bo. In the future we'll stop using wlr_drm_plane.surf, so these will
be zero. Instead, rely on gbm_bo_get_{width,height}.
|
|
This will be useful once we start re-using wlr_drm_fb.
|
|
|
|
Instead, import the buffer into GBM and KMS in drm_fb_import. Also move
the multi-GPU copy there if necessary.
|
|
|
|
The DRM backend is a little special when it comes to wlr_outputs: the
wlr_drm_connectors are long-lived and are created even when no screen is
connected.
A wlr_drm_connector only advertises a wlr_output to the compositor when
a screen is connected. As such, most of wlr_output's state is invalid
when the connector is disconnected.
We want to stop using wlr_output state on disconnected connectors.
Introduce wlr_drm_connector.name which is always valid regardless of the
connector status to avoid reading wlr_output.name when disconnected.
|
|
This allows the DRM code to have direct access to the wlr_drm_backend
without having to go through an upcast via get_drm_backend_from_backend.
|
|
Stop using drmModeObjectSetProperty, set the property in the crtc_commit
function instead.
|
|
Closes: https://github.com/swaywm/wlroots/issues/2216
|
|
Previously, we only had the pending state (crtc->pending, crtc->mode and
crtc->active). This causes issues when a commit fails: the pending state
is left as-is, and the next commit may read stale data from it.
This will also cause issues when implementing test-only commits: we need
to rollback the pending CRTC state after a test-only commit.
Introduce separate pending and current CRTC states. Properly update the
current state after a commit.
|
|
If the atomic commit fails or is test-only, rollback
wlr_drm_crtc.{mode_id,gamma_lut} blob IDs to their previous value. This
prevents the next commits from failing or applying test-only state.
|
|
We already have the logic to fallback to the legacy interface above. We
just need to avoid calling atomic_add with a zero prop ID.
Closes: https://github.com/swaywm/wlroots/issues/2187
|
|
wlr_output_set_gamma is now double-buffered and applies the gamma LUT on
the next output commit.
|
|
This makes it easier to understand which plane failed.
|
|
We don't need a per-CRTC atomic request anymore. Let's make the request
per-commit so that it's easier to debug.
This is also groundwork for supporting wlr_output_test properly.
|
|
GAMMA_LUT_SIZE isn't an atomic property. It can be used with the legacy
interface too. So we can unify both codepaths and remove
wlr_drm_interface.crtc_get_gamma_size.
It's no guaranteed to exist though, so we still need to keep the
fallback.
|
|
|
|
Use crtc_commit instead.
|
|
Also add a flags argument.
The commit function will also be used for disabling the CRTC.
|
|
|
|
Add a new wlr_drm_crtc.pending bitfield which keeps track of pending
output changes. More fields will be added in the future (e.g. active,
gamma).
|
|
Instead, make the legacy backend call drmModeMoveCursor on page-flip.
|
|
It makes sense to construct as much atomic state as possible in the same
place, so it doesn't get lost if we "reset" it.
|
|
This is just doing atomic incorrectly.
|
|
This is a type which manages gbm_surfaces and imported dmabufs in the
same place, and makes the lifetime management between the two shared. It
should lead to easier to understand code, and fewer special cases.
This also contains a fair bit of refactoring to start using this new
type.
Co-authored-by: Simon Ser <contact@emersion.fr>
|
|
This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
|
|
atomic and legacy now both pass the backend as the user data for the
pageflip event. We than retrieve the correct connector by matching on
the crtc_id passed to the page_flip_handler2.
Wlroots also requires the DRM_CRTC_IN_VBLANK_EVENT capability now.
Fixes #1297
|
|
This is fixed on amdgpu, so we don't need this anymore.
|
|
|
|
We create the EGL config with GBM_FORMAT_ARGB8888, but then initialize GBM BOs
with GBM_FORMAT_XRGB8888. This mismatch confuses Mesa.
Instead, we can always use GBM_FORMAT_ARGB8888, and use DRM_FORMAT_XRGB8888
when calling drmModeAddFB2.
Fixes https://github.com/swaywm/wlroots/issues/1438
|
|
This allows the legacy interface to be used instead of atomic if needed. This
is a workaround to make some Intel GPUs work (if this variable is unset) as
well as to make some AMD GPUs work (if this variable is set).
|
|
|
|
|
|
This commit allows outputs that need a CRTC to steal it from
user-disabled outputs. Note that in the case there are enough
CRTCs, disabled outputs don't loose it (so there's no modeset
and plane initialization needed after DPMS). CRTC allocation
still prefers to keep the old configuration, even if that means
allocating an extra CRTC to a disabled output.
CRTC reallocation now happen when enabling/disabling an output as
well as when trying to modeset. When enabling an output without a
CRTC, we realloc to try to steal a CRTC from a disabled output
(that doesn't really need the CRTC). When disabling an output, we
try to give our CRTC to an output that needs one. Modesetting is
similar to enabling.
A new DRM connector field has been added: `desired_enabled`.
Outputs without CRTCs get automatically disabled. This field keeps
track of the state desired by the user, allowing to automatically
re-enable outputs when a CRTC becomes free.
This required some changes to the allocation algorithm. Previously,
the algorithm tried to keep the previous configuration even if a
new configuration with a better score was possible (it only changed
configuration when the old one didn't work anymore). This is now
changed and the old configuration (still preferred) is only
retained without considering new possibilities when it's perfect
(all outputs have CRTCs).
User-disabled outputs now have `possible_crtcs` set to 0, meaning
they can only retain a previous CRTC (not acquire a new one). The
allocation algorithm has been updated to do not bump the score
when assigning a CRTC to a disabled output.
|
|
It doesn't look like there's any motion on a fix from the AMDGPU side,
and using the legacy interface for this isn't so bad.
|
|
|
|
|
|
These operations are done in 32-bit arithmetics before being casted to 64-bit,
thus can overflow before the cast.
Casting early fixes the issue.
Found through static analysis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Legacy gamma lut size now uses the new legacy_crtc member of
wlr_drm_crtc. This was Previously doen using old_crtc in
wlr_drm_connector, but since this refers to the crtc that was connected to
the ouput, this could give the wrong result.
|
|
|
|
Add wlr_output::enabled
|
|
|
|
Same as what atomic_crtc_set_cursor does
Core was generated by `_build/rootston/rootston'.
Program terminated with signal SIGSEGV, Segmentation fault.
0 0xb6f28a1c in atomic_crtc_move_cursor (drm=0x1ebc8e8, crtc=0x1ead498, x=0, y=0) at ../backend/drm/atomic.c:170
170 if (!crtc || !crtc->cursor) {
(gdb) bt
0 0xb6f28a1c in atomic_crtc_move_cursor (drm=0x1ebc8e8, crtc=0x1ead498, x=0, y=0) at ../backend/drm/atomic.c:170
1 0xb6f2a856 in wlr_drm_connector_move_cursor (output=0x2242b28, x=0, y=0) at ../backend/drm/drm.c:634
2 0xb6f3cea0 in wlr_output_cursor_set_image (cursor=0x21a0338, pixels=0x22e1290 "", stride=24, width=24, height=24, hotspot_x=4, hotspot_y=4) at ../types/wlr_output.c:516
3 0xb6f39da2 in wlr_cursor_set_image (cur=0x22cfc90, pixels=0x22e1290 "", stride=24, width=24, height=24, hotspot_x=4, hotspot_y=4, scale=1) at ../types/wlr_cursor.c:310
4 0xb6f44d2a in wlr_xcursor_manager_set_cursor_image (manager=0x22cfd10, name=0x434420 "left_ptr", cursor=0x22cfc90) at ../types/wlr_xcursor_manager.c:80
5 0x00431c0a in roots_seat_configure_xcursor (seat=0x22cef08) at ../rootston/seat.c:515
6 0x0043137c in roots_seat_init_cursor (seat=0x22cef08) at ../rootston/seat.c:210
7 0x004315ec in roots_seat_create (input=0x218d220, name=0x434594 "seat0") at ../rootston/seat.c:289
8 0x0042ecba in input_get_seat (input=0x218d220, name=0x434594 "seat0") at ../rootston/input.c:39
9 0x0042ed04 in input_add_notify (listener=0x218d228, data=0x218d3b0) at ../rootston/input.c:54
10 0xb6f2f2e6 in wl_signal_emit (signal=0x1ea548c, data=0x218d3b0) at /usr/include/wayland-server-core.h:387
11 0xb6f2f572 in input_add_reemit (listener=0x1ea9990, data=0x218d3b0) at ../backend/multi/backend.c:101
12 0xb6f2db7e in wl_signal_emit (signal=0x1ea992c, data=0x218d3b0) at /usr/include/wayland-server-core.h:387
13 0xb6f2ddaa in handle_device_added (backend=0x1ea9920, libinput_dev=0x2292598) at ../backend/libinput/events.c:87
14 0xb6f2e164 in wlr_libinput_event (backend=0x1ea9920, event=0x2292b78) at ../backend/libinput/events.c:198
15 0xb6f2d678 in wlr_libinput_readable (fd=23, mask=1, _backend=0x1ea9920) at ../backend/libinput/backend.c:28
16 0xb6f2d7c0 in wlr_libinput_backend_start (_backend=0x1ea9920) at ../backend/libinput/backend.c:74
17 0xb6f27170 in wlr_backend_start (backend=0x1ea9920) at ../backend/backend.c:30
18 0xb6f2f320 in multi_backend_start (wlr_backend=0x1ea5480) at ../backend/multi/backend.c:22
19 0xb6f27170 in wlr_backend_start (backend=0x1ea5480) at ../backend/backend.c:30
20 0x0042fbc6 in main (argc=1, argv=0xbe89dd04) at ../rootston/main.c:60
|