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

4 monitor setup very choppy and flickering #842

Open
jens-hj opened this issue Dec 7, 2024 · 12 comments
Open

4 monitor setup very choppy and flickering #842

jens-hj opened this issue Dec 7, 2024 · 12 comments
Labels
bug Something isn't working question Further information is requested

Comments

@jens-hj
Copy link

jens-hj commented Dec 7, 2024

Problem

I have 3 2k monitors and one 4k (Samsung TV). Previously I have been unable to get the 4k one detected at all, but it seems to be able to do so now. However, in order to get all monitors to display a proper image I have to lower their refresh rate to ~120Hz each, whereas they are all 165Hz monitors except for the 4k TV.

Sometimes I am able to put two of the three 2k monitors to 165Hz with no issues, but increasing the third above 100Hz will make it flicker at a very high rate, almost looking like it's at half brightness due to being off/showing black half the time, but the flicker itself is also noticeable.

It seems completely random to me which of the 3 2k monitors that happen to be the one that wants to flicker on each reboot.

Furthermore, even though I am able to run the monitors at 120Hz this is not what I see at all, I perceive something much closer to 30-60Hz at most. It is very noticeably choppy and laggy, also very obvious upon scrolling or with animations.

Result of niri msg outputs: niri-msg-outputs.txt
My outputs configuration: niri-output-config.txt

System Information

  • niri version: niri stable 0.1.10-1
  • Distro: NixOS 25.05.20241201.ac35b10 (Warbler)
  • GPU: NVIDIA RTX 2070S
  • CPU: Intel Core i5 12600K
@jens-hj jens-hj added the bug Something isn't working label Dec 7, 2024
@YaLTeR
Copy link
Owner

YaLTeR commented Dec 7, 2024

Inability to set them all to high refresh rate sounds like a bandwidth limitation; Smithay currently lacks the infrastructure to try different modifier configurations to make this work in more cases.

I'm really not sure about flickering though, sounds a bit like a driver issue.

The lagginess and low framerate I guess needs profiling to pinpoint. It would involve building niri with a special feature flag and building the Tracy profiler, if you want to get into it.

Do you have the frame drops on other compositors?

@YaLTeR YaLTeR added the question Further information is requested label Dec 7, 2024
@YaLTeR
Copy link
Owner

YaLTeR commented Dec 7, 2024

Oh yeah, a quick thing to check: clients that redraw big shm surfaces, notably Firefox and anything else GTK 3, will currently cause frame drops on niri when focusing/unfocusing them (which happens during scrolling or workspace switches). So, do the frame drops happen even without Firefox or other GTK 3 clients?

@jens-hj
Copy link
Author

jens-hj commented Dec 7, 2024

Inability to set them all to high refresh rate sounds like a bandwidth limitation; Smithay currently lacks the infrastructure to try different modifier configurations to make this work in more cases.

I'm really not sure about flickering though, sounds a bit like a driver issue.

I guess I will look more into the NVIDIA drivers, however I thought I got it right.

The lagginess and low framerate I guess needs profiling to pinpoint. It would involve building niri with a special feature flag and building the Tracy profiler, if you want to get into it.

I would love for niri to work properly, so I wouldn't mind getting a bit into the weeds, but will probably need more detail/guidance.

Do you have the frame drops on other compositors?

I have no issues like this on Hyprland

Oh yeah, a quick thing to check: clients that redraw big shm surfaces, notably Firefox and anything else GTK 3, will currently cause frame drops on niri when focusing/unfocusing them (which happens during scrolling or workspace switches). So, do the frame drops happen even without Firefox or other GTK 3 clients?

Let me test this real quick

@jens-hj
Copy link
Author

jens-hj commented Dec 7, 2024

Also, it seems to be a 50/50 chance of being able to output to the 4k TV. Sometimes the outputs are recognized as DP-1, DP-2, DP-3, and HDMI-A-1, where it works. And sometimes as DP-2, DP-3, DP-4, and HDMI-A-3, where the TV just displays "No Signal".

I have changed my config to use the monitor manufacturer, model, and serial instead of the connectors names now to make it more consistent, but there is still one quirk.

@YaLTeR
Copy link
Owner

YaLTeR commented Dec 8, 2024

Also, it seems to be a 50/50 chance of being able to output to the 4k TV. Sometimes the outputs are recognized as DP-1, DP-2, DP-3, and HDMI-A-1, where it works. And sometimes as DP-2, DP-3, DP-4, and HDMI-A-3, where the TV just displays "No Signal".

Hm, not sure about this. I usually see inconsistent connector names when I have two GPUs and they initialize themselves in parallel, grabbing the available connector names first come first serve. Also with some thunderbolt docks.

I would love for niri to work properly, so I wouldn't mind getting a bit into the weeds, but will probably need more detail/guidance.

You'll need to build and run niri with cargo build --release --features=profile-with-tracy-ondemand. Then you'll need to build and run the Tracy profiler v0.11.1 from https://github.com/wolfpld/tracy/tree/v0.11.1

Attach it to niri, record a few seconds of dropped frames, then save the recording and upload it somewhere here.

@jens-hj
Copy link
Author

jens-hj commented Dec 8, 2024

You'll need to build and run niri with cargo build --release --features=profile-with-tracy-ondemand. Then you'll need to build and run the Tracy profiler v0.11.1 from wolfpld/tracy@v0.11.1

I have built niri perfectly fine, however attempting to build tracy I keep getting this

/nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/atomic_base.h:481:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.

I have attempted to use the -Wno-error and -Wno-fatal-errors flags, but doesn't change anything.

I created this flake.nix for building:

{
  description = "tracy";

  inputs = { flake-utils.url = "github:numtide/flake-utils"; };

  outputs = { self, flake-utils, nixpkgs, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        overlays = [ ];
        pkgs = import nixpkgs { inherit system overlays; };
      in with pkgs; {
        devShells.default = pkgs.mkShell rec {
          nativeBuildInputs = [ pkgs.pkg-config ];
          buildInputs = with pkgs; [
            capstone
            glfw
            freetype
            cmake
            gcc
            dbus
            libxkbcommon
            wayland
            egl-wayland
            wayland-protocols
          ];
          LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
        };
      });
}

I don't know if I should go elsewhere with this problem, but maybe you have had similar problem when building tracer yourself, so figured I would put it here first at least.

@YaLTeR
Copy link
Owner

YaLTeR commented Dec 8, 2024

Hm, no, haven't seen this error. More of the files would help (i.e. not just the innermost function).

Also, make sure you're building the profiler. Tracy has a setup where you can build separate components from the base directory, and to build the profiler you need to use cmake specifically from the profiler/ subdirectory.

@jens-hj
Copy link
Author

jens-hj commented Dec 8, 2024

I found these instructions in the tracy manual that I have followed.
image

Here's the full error:

In file included from /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:41,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/address_waiter.cpp:17:
In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’,
    inlined from ‘void std::atomic<bool>::store(bool, std::memory_order)’ at /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:104:20,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all_relaxed() [with Context = tbb::detail::r1::address_context]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:440:53,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all() [with Context = tbb::detail::r1::address_context]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:423:26,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::destroy() [with Context = tbb::detail::r1::address_context]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:456:24,
    inlined from ‘void tbb::detail::r1::clear_address_waiter_table()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/address_waiter.cpp:60:40:
/nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/atomic_base.h:481:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
In file included from /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:41,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_bounded_queue.cpp:17:
In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’,
    inlined from ‘void std::atomic<bool>::store(bool, std::memory_order)’ at /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:104:20,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all_relaxed() [with Context = long unsigned int]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:440:53,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all() [with Context = long unsigned int]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:423:26,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::destroy() [with Context = long unsigned int]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:456:24,
    inlined from ‘tbb::detail::r1::concurrent_monitor::~concurrent_monitor()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:487:16,
    inlined from ‘void tbb::detail::r1::deallocate_bounded_queue_rep(uint8_t*, std::size_t)’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_bounded_queue.cpp:45:40:
/nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/atomic_base.h:481:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make[2]: *** [_deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/build.make:76: _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [_deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/build.make:132: _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.o] Error 1
In file included from /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:41,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/mutex.h:21,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/threading_control.h:20,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/threading_control.cpp:17:
In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’,
    inlined from ‘void std::atomic<bool>::store(bool, std::memory_order)’ at /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:104:20,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all_relaxed() [with Context = tbb::detail::r1::market_context]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:440:53,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all() [with Context = tbb::detail::r1::market_context]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:423:26,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::destroy() [with Context = tbb::detail::r1::market_context]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:456:24,
    inlined from ‘tbb::detail::r1::thread_control_monitor::~thread_control_monitor()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/thread_control_monitor.h:102:16,
    inlined from ‘void tbb::detail::r1::cache_aligned_deleter::operator()(T*) const [with T = tbb::detail::r1::thread_control_monitor]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/scheduler_common.h:75:16,
    inlined from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = tbb::detail::r1::thread_control_monitor; _Dp = tbb::detail::r1::cache_aligned_deleter]’ at /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/unique_ptr.h:404:17,
    inlined from ‘tbb::detail::r1::threading_control_impl::~threading_control_impl()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/threading_control.h:42:7,
    inlined from ‘void tbb::detail::r1::cache_aligned_deleter::operator()(T*) const [with T = tbb::detail::r1::threading_control_impl]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/scheduler_common.h:75:16,
    inlined from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = tbb::detail::r1::threading_control_impl; _Dp = tbb::detail::r1::cache_aligned_deleter]’ at /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/unique_ptr.h:404:17,
    inlined from ‘tbb::detail::r1::threading_control::~threading_control()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/threading_control.h:92:7,
    inlined from ‘void tbb::detail::r1::cache_aligned_deleter::operator()(T*) const [with T = tbb::detail::r1::threading_control]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/scheduler_common.h:75:16,
    inlined from ‘void tbb::detail::r1::threading_control::destroy()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/threading_control.cpp:244:12:
/nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/atomic_base.h:481:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make[2]: *** [_deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/build.make:482: _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/threading_control.cpp.o] Error 1
In file included from /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:41,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/task_dispatcher.h:20,
                 from /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/arena.cpp:17:
In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’,
    inlined from ‘void std::atomic<bool>::store(bool, std::memory_order)’ at /nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/atomic:104:20,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all_relaxed() [with Context = long unsigned int]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:440:53,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all() [with Context = long unsigned int]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:423:26,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::destroy() [with Context = long unsigned int]’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:456:24,
    inlined from ‘tbb::detail::r1::concurrent_monitor::~concurrent_monitor()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:487:16,
    inlined from ‘tbb::detail::r1::arena_base::~arena_base()’ at /home/jens/repos/tracy/profiler/build/_deps/tbb-src/src/tbb/arena.h:186:8:
/nix/store/xzfmarrq8x8s4ivpya24rrndqsq2ndiz-gcc-13.3.0/include/c++/13.3.0/bits/atomic_base.h:481:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make[2]: *** [_deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/build.make:104: _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/arena.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:386: _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

@YaLTeR
Copy link
Owner

YaLTeR commented Dec 8, 2024

Well, not sure. This is straight up a tbb library error.

@YaLTeR
Copy link
Owner

YaLTeR commented Jan 1, 2025

Hi, were you able to get it working?

@jens-hj
Copy link
Author

jens-hj commented Jan 1, 2025

Unfortunately, I have not had the time to look any further into this yet.

@cmeissl
Copy link
Contributor

cmeissl commented Jan 3, 2025

smithay now provides the DrmOutputManager abstraction which should help working around bandwidth limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants