swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.4k stars 1.1k forks source link

Handling multiple displays with different format/modifier combinations after a4ef377 #8105

Open matt1606 opened 5 months ago

matt1606 commented 5 months ago

Comparing two versions here:

Regards
Mateusz

kennylevinsen commented 5 months ago

not affected: sway-debug.125c743.log,

This log does not light up DVI-I-1. Only eDP-1 and HDMI-A-1 gets lit up.

so far by static code analysis I was able to find the faulty path:

This does not look right - drm_connector_test and drm_connector_comit_state is the old path, not the new one.

However, I do suspect we might have a multi-gpu issue with the new backend-wide commits. Specifically, in the per-connector code-path, we skip blit and test of secondary GPUs.

With the new backend-wide wlroots logic, we commit all connectors, but we're still skipping the blit in drm_connector_prepare leading to no primary fb being present when we test all connectors, which fails.


As a terrible hack, this seems to work:

diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index 9defa7c6..f42ccee6 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -333,7 +333,7 @@ static void set_plane_props(struct atomic *atom, struct wlr_drm_backend *drm,

        if (fb == NULL) {
                wlr_log(WLR_ERROR, "Failed to acquire FB for plane %"PRIu32, plane->id);
-               atom->failed = true;
+               // atom->failed = true;
                return;
        }
kennylevinsen commented 5 months ago

Try with this branch: https://gitlab.freedesktop.org/kennylevinsen/wlroots/-/tree/displaylink-hack?ref_type=heads

This combines https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4639 with a better hack for DisplayLink. The old one was broken, leading to additional copies.

matt1606 commented 5 months ago

Hi, Tested a fresh build of:

and it works! - sway-debug.bc258a3.log

I was starting to debug other DisplayLink issues I've seen so far, mostly with the high CPU usage by the DisplayLinkManager process when a window was maximized in the DisplayLink connected display, but that was still in the not affected versions from OP, and was caused by enabling the direct scan-out. Some observations and relevant log parts: high_cpu_usage_when_maximized_window_in_DisplayLink_connected_display.txt

With the patches from your branch, the problem of high CPU usage for the DisplayLinkManager process when a windows is maximized seems to be gone, and the logs show that the direct scan-out doesn't get enabled: sway-debug.DisplayLinkManager_maximized_window.log Of course watching a full screen video via DisplayLink is an overkill, but that's the pitfall of how it's implemented in Linux (the kernel/user space split and the related lack of DMA when using USB): image

I'll test it more extensively during next few days and share the results. Big thanks for now!

Regards Mateusz

Dev-Aligator commented 2 months ago

The Displaylink-hack doesn't seem to work with:

What can be done to get the display working again?

kennylevinsen commented 2 months ago

The Displaylink-hack doesn't seem to work with:

* Hyprland v0.41.2
* libliftoff 0.5.0-1

This is the sway issue tracker. Hyprland discussions belong on the Hyprland issue tracker.