Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to a full Hyprland GL rendering pipeline #3920

Merged
merged 14 commits into from
Nov 24, 2023
Merged

Conversation

vaxerski
Copy link
Member

Also updates wlroots.

Moves the entire rendering pipeline to hyprland instead of having to copy to a wlroots gl fbo at the end, wasting gpu cycles.

@vaxerski vaxerski requested a review from fufexan November 23, 2023 19:05
@h0tc0d3
Copy link

h0tc0d3 commented Nov 23, 2023

I tested on workload, coding, browser, video viewing, games.
I like that the latency has decreased and the system response has improved. Cursor latency is now noticeably lower, especially noticeable in shooter games (xwayland, vfr = on/off, atomic drm, and WLR_DRM_NO_ATOMIC=1, 240hz). Also in shooters, animations have become smoother. In the older version, the cursor delay was is more noticeable.

Copy link
Contributor

@MightyPlaza MightyPlaza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR seems to fix the issue from
#3546
never found out what was the cause

@h0tc0d3
Copy link

h0tc0d3 commented Nov 24, 2023

Jetbrains IDEs when clicking the menu causes hyprland crash.

(gdb) bt full
#0  0x00007faae7eae834 in __pthread_kill_implementation () at /lib64/libc.so.6
#1  0x00007faae7e5c8ee in raise () at /lib64/libc.so.6
#2  0x00007faae7e448ff in abort () at /lib64/libc.so.6
#3  0x000000000067627a in handleUserSignal(int) ()
#4  0x00007faae7e5c9a0 in <signal handler called> () at /lib64/libc.so.6
#5  0x00007faae7eae834 in __pthread_kill_implementation () at /lib64/libc.so.6
#6  0x00007faae7e5c8ee in raise () at /lib64/libc.so.6
#7  0x00007faae7e448ff in abort () at /lib64/libc.so.6
#8  0x00007faae7e4481b in _nl_load_domain.cold () at /lib64/libc.so.6
#9  0x00007faae7e54c57 in  () at /lib64/libc.so.6
#10 0x00007faae89a9b3e in wlr_xwayland_surface_restack () at libwlroots.so.13
#11 0x0000000000863aca in CHyprXWaylandManager::activateSurface(wlr_surface*, bool) ()
#12 0x000000000067f5f9 in CCompositor::focusSurface(wlr_surface*, CWindow*) ()
#13 0x000000000067e95b in CCompositor::focusWindow(CWindow*, wlr_surface*) ()
#14 0x000000000079a721 in Events::listener_mapWindow(void*, void*) ()
#15 0x00000000007843d5 in void std::__invoke_impl<void, void (*&)(void*, void*), void*, void*>(std::__invoke_other, void (*&)(void*, void*), void*&&, void*&&) ()
#16 0x0000000000783fab in std::enable_if<is_invocable_r_v<void, void (*&)(void*, void*), void*, void*>, void>::type std::__invoke_r<void, void (*&)(void*, void*), void*, void*>(void (*&)(void*, void*), void*&&, void*&&) ()
#17 0x0000000000783c1f in std::_Function_handler<void (void*, void*), void (*)(void*, void*)>::_M_invoke(std::_Any_data const&, void*&&, void*&&) ()
#18 0x00000000007d455d in std::function<void (void*, void*)>::operator()(void*, void*) const ()
#19 0x00000000007d3619 in CHyprWLListener::emit(void*) ()
#20 0x00000000007d319e in handleWrapped(wl_listener*, void*) ()
#21 0x00007faae889edcc in wl_signal_emit_mutable () at /lib64/libwayland-server.so.0
#22 0x00007faae896c62b in wlr_surface_map () at libwlroots.so.13
#23 0x00007faae89a9051 in  () at libwlroots.so.13
#24 0x00007faae889edcc in wl_signal_emit_mutable () at /lib64/libwayland-server.so.0
#25 0x00007faae896bb6b in  () at libwlroots.so.13
#26 0x00007faae896bc21 in  () at libwlroots.so.13
#27 0x00007faae7d02056 in ffi_call_unix64 () at /lib64/libffi.so.8
#28 0x00007faae7cfe5ef in ffi_call_int.lto_priv () at /lib64/libffi.so.8
#29 0x00007faae7d013fe in ffi_call () at /lib64/libffi.so.8
#30 0x00007faae889d843 in wl_closure_invoke.constprop () at /lib64/libwayland-server.so.0
#31 0x00007faae88a20b4 in wl_client_connection_data () at /lib64/libwayland-server.so.0
#32 0x00007faae88a08e2 in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#33 0x00007faae88a1125 in wl_display_run () at /lib64/libwayland-server.so.0
#34 0x000000000067ad2c in CCompositor::startCompositor() ()
#35 0x00000000007fcb12 in main ()

@vaxerski
Copy link
Member Author

fixed, though idk maybe it's the wlroots bump? it wasnt the renderer

@h0tc0d3
Copy link

h0tc0d3 commented Nov 24, 2023

@vaxerski thanks, this solved the problem.

@h0tc0d3
Copy link

h0tc0d3 commented Nov 24, 2023

Another coredump. I enabled freesync in the monitor and vrr was equal to 0, hyprland crash. Also, turning off Freesync in the monitor causes a coredump. Those. hyprland crashes due to an event from the kernel.

#0  0x00007f90d42ae834 in __pthread_kill_implementation () at /lib64/libc.so.6
#1  0x00007f90d425c8ee in raise () at /lib64/libc.so.6
#2  0x00007f90d42448ff in abort () at /lib64/libc.so.6
#3  0x000000000067627a in handleUserSignal(int) ()
#4  0x00007f90d425c9a0 in <signal handler called> () at /lib64/libc.so.6
#5  0x00007f90d4c13cff in wl_list_remove () at /lib64/libwayland-server.so.0
#6  0x00007f90d4cc2a0f in wlr_output_create_global () at libwlroots.so.13
#7  0x00007f90d4cf59d2 in  () at libwlroots.so.13
#8  0x00007f90d4cf5c35 in  () at libwlroots.so.13
#9  0x00007f90d4cf5c8a in wlr_output_layout_add () at libwlroots.so.13
#10 0x00000000007c0a17 in CMonitor::moveTo(Vector2D const&) ()
#11 0x000000000068ab52 in CCompositor::arrangeMonitors() ()
#12 0x00000000008d51ae in CHyprRenderer::applyMonitorRule(CMonitor*, SMonitorRule*, bool) ()
#13 0x00000000007bcf01 in CMonitor::onConnect(bool) ()
#14 0x000000000068b165 in CCompositor::enterUnsafeState() ()
#15 0x00000000007bdf0f in CMonitor::onDisconnect(bool) ()
#16 0x000000000078ea19 in Events::listener_monitorDestroy(void*, void*) ()
#17 0x00000000007843d5 in void std::__invoke_impl<void, void (*&)(void*, void*), void*, void*>(std::__invoke_other, void (*&)(void*, void*), void*&&, void*&&) ()
#18 0x0000000000783fab in std::enable_if<is_invocable_r_v<void, void (*&)(void*, void*), void*, void*>, void>::type std::__invoke_r<void, void (*&)(void*, void*), void*, void*>(void (*&)(void*, void*), void*&&, void*&&) ()
#19 0x0000000000783c1f in std::_Function_handler<void (void*, void*), void (*)(void*, void*)>::_M_invoke(std::_Any_data const&, void*&&, void*&&) ()
#20 0x00000000007d455d in std::function<void (void*, void*)>::operator()(void*, void*) const ()
#21 0x00000000007d3619 in CHyprWLListener::emit(void*) ()
#22 0x00000000007d319e in handleWrapped(wl_listener*, void*) ()
#23 0x00007f90d4c13dcc in wl_signal_emit_mutable () at /lib64/libwayland-server.so.0
#24 0x00007f90d4cc383b in wlr_output_destroy () at libwlroots.so.13
#25 0x00007f90d4ca58e5 in  () at libwlroots.so.13
#26 0x00007f90d4ca5251 in  () at libwlroots.so.13
#27 0x00007f90d4c9ffd1 in  () at libwlroots.so.13
#28 0x00007f90d4c13dcc in wl_signal_emit_mutable () at /lib64/libwayland-server.so.0
#29 0x00007f90d4c9d837 in  () at libwlroots.so.13
#30 0x00007f90d4c158e2 in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#31 0x00007f90d4c16125 in wl_display_run () at /lib64/libwayland-server.so.0
#32 0x000000000067ad2c in CCompositor::startCompositor() ()
#33 0x00000000007fcb12 in main ()

@vaxerski
Copy link
Member Author

I am fairly sure it's a wlroots issue.

@vaxerski
Copy link
Member Author

Simon has done some no-no code, I'll revert wlroots to a rev before that and just stay on the rev for a while.

@h0tc0d3
Copy link

h0tc0d3 commented Nov 24, 2023

Made a more detailed bt for #3920 (comment). There is also a bug that the float xwayland windows is not always centered. Jetbrains IDEs dialog boxes are drawn at the bottom right, and not completely, and wine - battle.net from Blizzard is horizontally shifted to the side.

(gdb) bt full
#0  0x00007fcc118ae834 in __pthread_kill_implementation () at /lib64/libc.so.6
#1  0x00007fcc1185c8ee in raise () at /lib64/libc.so.6
#2  0x00007fcc118448ff in abort () at /lib64/libc.so.6
#3  0x00000000004de0ec in handleUnrecoverableSignal(int) (sig=11) at Hyprland/src/Compositor.cpp:34
#4  0x00007fcc1185c9a0 in <signal handler called> () at /lib64/libc.so.6
#5  0x00007fcc12239cff in wl_list_remove () at /lib64/libwayland-server.so.0
#6  0x00007fcc12345022 in wlr_output_create_global (output=0x5ded9d0, display=0x2303a80) at Hyprland/subprojects/wlroots/types/output/output.c:148
#7  0x00007fcc1237a6f6 in output_update_global (layout=0x5b90980, output=0x5ded9d0) at Hyprland/subprojects/wlroots/types/wlr_output_layout.c:122
#8  0x00007fcc123797cb in output_layout_add (layout=0x5b90980, output=0x5ded9d0, lx=0, ly=0, auto_configured=false) at Hyprland/subprojects/wlroots/types/wlr_output_layout.c:197
        l_output = 0x5e766d0
        is_new = false
#9  0x00007fcc1237970c in wlr_output_layout_add (layout=0x5b90980, output=0x5ded9d0, lx=0, ly=0) at Hyprland/subprojects/wlroots/types/wlr_output_layout.c:208
#10 0x0000000000649436 in CMonitor::moveTo(Vector2D const&) (this=0x5dd3ff0, pos=...) at Hyprland/src/helpers/Monitor.cpp:640
#11 0x00000000004f59fb in CCompositor::arrangeMonitors() (this=0x2302490) at Hyprland/src/Compositor.cpp:2673
        m = 0x5dd3ff0
        it = 0x5dd3ff0
        PXWLFORCESCALEZERO = 0x2311ef8
        toArrange = std::vector of length 2, capacity 2 = {0x5dd3ff0, 0x5e69890}
        arranged = std::vector of length 0, capacity 0
        maxOffset = 0
#12 0x0000000000760e45 in CHyprRenderer::applyMonitorRule(CMonitor*, SMonitorRule*, bool) (this=0x5baf720, pMonitor=0x5e69890, pMonitorRule=0x7fff6dd962f0, force=true) at Hyprland/src/render/Renderer.cpp:1961
        formats = {_M_elems = {std::vector of length 5, capacity 5 = {{first = "DRM_FORMAT_XRGB2101010", second = 808669784}, {first = "DRM_FORMAT_XBGR2101010", second = 808665688}, {first = "DRM_FORMAT_XRGB8888", second = 875713112}, {first = "DRM_FORMAT_XBGR8888", second = 875709016}, {first = "DRM_FORMAT_INVALID", second = 0}}, std::vector of length 3, capacity 3 = {{first = "DRM_FORMAT_XRGB8888", second = 875713112}, {first = "DRM_FORMAT_XBGR8888", second = 875709016}, {first = "DRM_FORMAT_INVALID", second = 0}}}}
        PEVENTVEC = 0x5b87280
        WLRREFRESHRATE = 240000
        set10bit = false
        x = 2560
        y = 1440
#13 0x0000000000644c71 in CMonitor::onConnect(bool) (this=0x5e69890, noRule=false) at Hyprland/src/helpers/Monitor.cpp:133
        PEVENTVEC = 0x5db2180
        monitorRule = {name = "", resolution = {x = 2560, y = 1440}, offset = {x = 0, y = 0}, scale = 1.25, refreshRate = 240, disabled = false, transform = WL_OUTPUT_TRANSFORM_NORMAL, mirrorOf = "", enable10bit = false, drmMode = {clock = 0, hdisplay = 0, hsync_start = 0, hsync_end = 0, htotal = 0, hskew = 0, vdisplay = 0, vsync_start = 0, vsync_end = 0, vtotal = 0, vscan = 0, vrefresh = 0, flags = 0, type = 0, name = '\000' <repeats 31 times>}, vrr = std::optional<int> [no contained value]}
        thisWrapper = 0x5d9c1f0
        found = false
#14 0x00000000004f5fbf in CCompositor::enterUnsafeState() (this=0x2302490) at Hyprland/src/Compositor.cpp:2721
#15 0x00000000006464d4 in CMonitor::onDisconnect(bool) (this=0x5dd3ff0, destroy=true) at Hyprland/src/helpers/Monitor.cpp:247
        PEVENTVEC = 0x5b91920
        BACKUPMON = 0x0
#16 0x0000000000614f27 in Events::listener_monitorDestroy(void*, void*) (owner=0x5dd3ff0, data=0x5ded9d0) at Hyprland/src/events/Monitors.cpp:201
        OUTPUT = 0x5ded9d0
        pMonitor = 0x5dd3ff0
#17 0x000000000060a6cb in std::__invoke_impl<void, void (*&)(void*, void*), void*, void*>(std::__invoke_other, void (*&)(void*, void*), void*&&, void*&&)
    (__f=@0x5dd43a8: 0x614e20 <Events::listener_monitorDestroy(void*, void*)>, __args=@0x7fff6dd96c50: 0x5dd3ff0, __args=@0x7fff6dd96c48: 0x5ded9d0) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:61
#18 0x000000000060a665 in std::__invoke_r<void, void (*&)(void*, void*), void*, void*>(void (*&)(void*, void*), void*&&, void*&&)
    (__fn=@0x5dd43a8: 0x614e20 <Events::listener_monitorDestroy(void*, void*)>, __args=@0x7fff6dd96c50: 0x5dd3ff0, __args=@0x7fff6dd96c48: 0x5ded9d0) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:111
#19 0x000000000060a55d in std::_Function_handler<void (void*, void*), void (*)(void*, void*)>::_M_invoke(std::_Any_data const&, void*&&, void*&&) (__functor=..., __args=@0x7fff6dd96c50: 0x5dd3ff0, __args=@0x7fff6dd96c48: 0x5ded9d0)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/std_function.h:290
#20 0x0000000000659e95 in std::function<void (void*, void*)>::operator()(void*, void*) const (this=0x5dd43a8, __args=0x5dd3ff0, __args=0x5ded9d0) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/std_function.h:591
#21 0x00000000006590a8 in CHyprWLListener::emit(void*) (this=0x5dd4380, data=0x5ded9d0) at Hyprland/src/helpers/WLListener.cpp:59
#22 0x0000000000658fcb in handleWrapped(wl_listener*, void*) (listener=0x5dd4380, data=0x5ded9d0) at Hyprland/src/helpers/WLListener.cpp:13
        pWrap = 0x5dd4380
        e = @0x7fff6dd96d00: <incomplete type>
#23 0x00007fcc12239dcc in wl_signal_emit_mutable () at /lib64/libwayland-server.so.0
#24 0x00007fcc12345fd9 in wlr_output_destroy (output=0x5ded9d0) at Hyprland/subprojects/wlroots/types/output/output.c:448
        cursor = 0x23342f8
        tmp_cursor = 0x7fcc123296b6 <get_drm_prop+166>
        layer = 0x7fff6dd96dc0
        tmp_layer = 0x7fff6dd96f10
#25 0x00007fcc123252eb in disconnect_drm_connector (conn=0x5ded9d0) at Hyprland/subprojects/wlroots/backend/drm/drm.c:1789
#26 0x00007fcc12324f67 in scan_drm_connectors (drm=0x2334200, event=0x7fff6dd96f98) at Hyprland/subprojects/wlroots/backend/drm/drm.c:1633
        c = 0x5ded9d0
        wlr_conn = 0x5ded9d0
        drm_conn = 0x5d9c010
        conn_id = 107
        index = 0
        i = 0
        res = 0x5d0a4f0
        seen_len = 4
        __vla_expr0 = 5
        new_outputs_len = 0
        __vla_expr1 = 5
        conn = 0x7fcc117922ae <device_read_uevent_file+94>
        tmp_conn = 0x5d5ca30
        index = 0
Python Exception <class 'gdb.error'>: frame address is not available.
#27 0x00007fcc123223ff in handle_dev_change (listener=0x23342f8, data=0x7fff6dd96f94) at Hyprland/subprojects/wlroots/backend/drm/backend.c:158
        drm = 0x2334200
        change = 0x7fff6dd96f94
#28 0x00007fcc12239dcc in wl_signal_emit_mutable () at /lib64/libwayland-server.so.0
#29 0x00007fcc1231fa6e in handle_udev_event (fd=10, mask=1, data=0x2317f60) at Hyprland/subprojects/wlroots/backend/session/session.c:213
        event = {type = WLR_DEVICE_HOTPLUG, {hotplug = {connector_id = 107, prop_id = 0}}}
        devnum = 57856
        dev = 0x2334ce0
        session = 0x2317f60
        udev_dev = 0x6321e70
        sysname = 0x5d6e290 "card0"
        devnode = 0x6315b40 "/dev/dri/card0"
        action = 0x7fcc117a03aa "change"
        seat = 0x7fcc122b6d15 "seat0"
#30 0x00007fcc1223b8e2 in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#31 0x00007fcc1223c125 in wl_display_run () at /lib64/libwayland-server.so.0
#32 0x00000000004e3954 in CCompositor::startCompositor() (this=0x2302490) at Hyprland/src/Compositor.cpp:553
#33 0x0000000000682e44 in main(int, char**) (argc=1, argv=0x7fff6dd97938) at Hyprland/src/main.cpp:106
        cmd = "Hyprland"
        configPath = ""
        ignoreSudo = false
        args = std::vector of length 0, capacity 0

@vaxerski
Copy link
Member Author

There is also a bug that the float xwayland windows is not always centered. Jetbrains IDEs dialog boxes are drawn at the bottom right, and not completely, and wine - battle.net from Blizzard is horizontally shifted to the side.

unrelated to this mr

@h0tc0d3
Copy link

h0tc0d3 commented Nov 24, 2023

@vaxerski Then this is apparently a wlroots problem. The problem started after updating wlroots and applying this MR. Xwayland windows start in a random position and out of screen.
screenshot_1700794200
screenshot_1700799073

@vaxerski
Copy link
Member Author

likely

@vaxerski vaxerski merged commit 2ebfd0c into main Nov 24, 2023
@h0tc0d3
Copy link

h0tc0d3 commented Nov 24, 2023

@vaxerski looks like a hyprland problem https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3767

The problem is caused by fractional scaling. If scale = 1.0 then all xwayland windows are drawn normally. But if you set it to 1.25, then the windows are drawn randomly.

xwayland {
  force_zero_scaling = true
  use_nearest_neighbor = true
}

@vaxerski
Copy link
Member Author

oh no it is definitely a hyprland issue, I meant that it's likely something changed in xwayland / wlr that hyprland doesn't like. This is tracked at #3029

@vaxerski vaxerski deleted the wlroots-off-renderer branch August 18, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants