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

[Bug]: Frame copy failed on wayland #125

Open
loss-and-quick opened this issue Nov 13, 2024 · 7 comments
Open

[Bug]: Frame copy failed on wayland #125

loss-and-quick opened this issue Nov 13, 2024 · 7 comments

Comments

@loss-and-quick
Copy link

Steps for reproducing the issue

Just run app

What is the buggy behavior?

Not working due Frame copy failed

What is the expected behavior?

To change backlight

Logs

[2024-11-13T12:56:52Z DEBUG wluma] Using Config {
        als: Time {
            thresholds: {
                9: "dim",
                16: "normal",
                13: "bright",
                18: "dark",
                0: "night",
                20: "night",
                7: "dark",
                11: "normal",
            },
        },
        output: [
            Backlight(
                BacklightOutput {
                    name: "eDP-1",
                    path: "/sys/class/backlight/nvidia_0",
                    capturer: Wayland(
                        Any,
                    ),
                    min_brightness: 1,
                },
            ),
            Backlight(
                BacklightOutput {
                    name: "keyboard-dell",
                    path: "/sys/bus/platform/devices/dell-laptop/leds/dell::kbd_backlight",
                    capturer: None,
                    min_brightness: 0,
                },
            ),
        ],
    }
[2024-11-13T12:56:52Z DEBUG wluma::brightness::backlight] Using direct write on /sys/class/backlight/nvidia_0 to change brightness value
[2024-11-13T12:56:52Z WARN  wluma] Skipping 'keyboard-dell' as it might be disconnected: No such file or directory (os error 2)
[2024-11-13T12:56:52Z INFO  wluma] Continue adjusting brightness and wluma will learn your preference over time.
[2024-11-13T12:56:52Z DEBUG wluma::frame::capturer::wayland] Detected support for wlr-screencopy-unstable-v1 protocol
[2024-11-13T12:56:52Z DEBUG wluma::frame::capturer::wayland] Detected support for linux-dmabuf-v1 protocol
[2024-11-13T12:56:52Z DEBUG wluma::frame::capturer::wayland] Using output 'Najing CEC Panda FPD Technology CO. ltd 0x004D  (eDP-1)' for config 'eDP-1'
[2024-11-13T12:56:52Z DEBUG wluma::frame::capturer::wayland] Using wlr-screencopy-unstable-v1 protocol to request frames
[2024-11-13T12:56:53Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-13T12:56:54Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-13T12:56:55Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-13T12:56:56Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-13T12:56:57Z DEBUG wluma::frame::capturer::wayland] Frame copy failed

Version

4.5.1-1 from aur

Environment

NAME="Arch Linux"
BUILD_ID=rolling
Linux 6.11.7-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 08 Nov 2024 17:57:58 +0000 x86_64 GNU/Linux
clang 18.1.8-4
hyprland-git 0.45.0.r17.bb160cfe-1
lib32-vulkan-icd-loader 1.3.295-1
rustup 1.27.1-1
vulkan-headers 1:1.3.295-1
vulkan-icd-loader 1.3.295-1
xdg-desktop-portal-hyprland 1.3.8-1
WLR_DRM_NO_MODIFIERS=
@maximbaz
Copy link
Owner

Hmmm, do you have multiple GPUs? Could you try to force usage of a specific one to see if it helps? Like so #63 (comment)

@loss-and-quick
Copy link
Author

do you have multiple GPUs?

@maximbaz , I have only one GPU (it is Nvidia)

@maximbaz
Copy link
Owner

Unfortunately I'm really not sure how to debug this, compositor does not send us any information about the error, just that it failed 😞 We have a few hyprland users, while it's possible that you are the only one on hyprland-git, I suspect the issue might be somewhere with Nvidia, though I cannot imagine where...

Perhaps one thing we could try: could you install vulkan-validation-layers package and then run these commands:

export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
export VK_LOADER_DEBUG=all
cargo run

If you see some errors, please share!

@loss-and-quick
Copy link
Author

loss-and-quick commented Nov 14, 2024

         Running `target/debug/wluma`
INFO:              Vulkan Loader Version 1.3.295
[2024-11-14T13:07:48Z DEBUG wluma] Using Config {
        als: Time {
            thresholds: {
                20: "night",
                7: "dark",
                11: "normal",
                18: "dark",
                13: "bright",
                16: "normal",
                0: "night",
                9: "dim",
            },
        },
        output: [
            Backlight(
                BacklightOutput {
                    name: "eDP-1",
                    path: "/sys/class/backlight/nvidia_0",
                    capturer: Wayland(
                        Any,
                    ),
                    min_brightness: 1,
                },
            ),
        ],
    }
[2024-11-14T13:07:48Z DEBUG wluma::brightness::backlight] Using direct write on /sys/class/backlight/nvidia_0 to change brightness value
[2024-11-14T13:07:48Z INFO  wluma] Continue adjusting brightness and wluma will learn your preference over time.
[2024-11-14T13:07:48Z DEBUG wluma::frame::capturer::wayland] Detected support for wlr-screencopy-unstable-v1 protocol
[2024-11-14T13:07:48Z DEBUG wluma::frame::capturer::wayland] Detected support for linux-dmabuf-v1 protocol
[2024-11-14T13:07:48Z DEBUG wluma::frame::capturer::wayland] Using output 'Najing CEC Panda FPD Technology CO. ltd 0x004D  (eDP-1)' for config 'eDP-1'
[2024-11-14T13:07:48Z DEBUG wluma::frame::capturer::wayland] Using wlr-screencopy-unstable-v1 protocol to request frames
LAYER:             Searching for implicit layer manifest files
LAYER:                In following locations:
LAYER:                   /home/minicx/.config/vulkan/implicit_layer.d
LAYER:                   /etc/xdg/vulkan/implicit_layer.d
LAYER:                   /etc/vulkan/implicit_layer.d
LAYER:                   /home/minicx/.local/share/vulkan/implicit_layer.d
LAYER:                   /usr/local/share/vulkan/implicit_layer.d
LAYER:                   /usr/share/vulkan/implicit_layer.d
LAYER:                Found the following files:
LAYER:                   /usr/share/vulkan/implicit_layer.d/nvidia_layers.json
INFO:              Found manifest file /usr/share/vulkan/implicit_layer.d/nvidia_layers.json (file version 1.0.1)
LAYER:             Searching for explicit layer manifest files
LAYER:                In following locations:
LAYER:                   /home/minicx/.config/vulkan/explicit_layer.d
LAYER:                   /etc/xdg/vulkan/explicit_layer.d
LAYER:                   /etc/vulkan/explicit_layer.d
LAYER:                   /home/minicx/.local/share/vulkan/explicit_layer.d
LAYER:                   /usr/local/share/vulkan/explicit_layer.d
LAYER:                   /usr/share/vulkan/explicit_layer.d
LAYER:                Found the following files:
LAYER:                   /usr/share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json
INFO:              Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json (file version 1.2.0)
DRIVER:            Searching for driver manifest files
DRIVER:               In following locations:
DRIVER:                  /home/minicx/.config/vulkan/icd.d
DRIVER:                  /etc/xdg/vulkan/icd.d
DRIVER:                  /etc/vulkan/icd.d
DRIVER:                  /home/minicx/.local/share/vulkan/icd.d
DRIVER:                  /usr/local/share/vulkan/icd.d
DRIVER:                  /usr/share/vulkan/icd.d
DRIVER:               Found the following files:
DRIVER:                  /usr/share/vulkan/icd.d/nvidia_icd.json
DRIVER:            Found ICD manifest file /usr/share/vulkan/icd.d/nvidia_icd.json, version 1.0.1
DEBUG | DRIVER:    Searching for ICD drivers named libGLX_nvidia.so.0
WARNING | LAYER:   env var 'VK_INSTANCE_LAYERS' defined and adding layers "VK_LAYER_KHRONOS_validation"
WARNING | LAYER:   env var 'VK_INSTANCE_LAYERS' defined and adding layers "VK_LAYER_KHRONOS_validation"
DEBUG | LAYER:     Loading layer library libVkLayer_khronos_validation.so
INFO | LAYER:      Insert instance layer "VK_LAYER_KHRONOS_validation" (libVkLayer_khronos_validation.so)
LAYER:             vkCreateInstance layer callstack setup to:
LAYER:                <Application>
LAYER:                  ||
LAYER:                <Loader>
LAYER:                  ||
LAYER:                VK_LAYER_KHRONOS_validation
LAYER:                        Type: Explicit
LAYER:                        Manifest: /usr/share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json
LAYER:                        Library:  libVkLayer_khronos_validation.so
LAYER:                  ||
LAYER:                <Drivers>
INFO | DRIVER:     linux_read_sorted_physical_devices:
INFO | DRIVER:          Original order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
INFO | DRIVER:          Sorted order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
INFO | DRIVER:     linux_read_sorted_physical_devices:
INFO | DRIVER:          Original order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
INFO | DRIVER:          Sorted order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
DEBUG | DRIVER:    Copying old device 0 into new device 0
INFO | DRIVER:     linux_read_sorted_physical_devices:
INFO | DRIVER:          Original order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
INFO | DRIVER:          Sorted order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
DEBUG | DRIVER:    Copying old device 0 into new device 0
INFO | DRIVER:     linux_read_sorted_physical_devices:
INFO | DRIVER:          Original order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
INFO | DRIVER:          Sorted order:
INFO | DRIVER:                [0] NVIDIA GeForce RTX 3050 Laptop GPU
DEBUG | DRIVER:    Copying old device 0 into new device 0
INFO | LAYER:      Inserted device layer "VK_LAYER_KHRONOS_validation" (libVkLayer_khronos_validation.so)
DRIVER | LAYER:    vkCreateDevice layer callstack setup to:
DRIVER | LAYER:       <Application>
DRIVER | LAYER:         ||
DRIVER | LAYER:       <Loader>
DRIVER | LAYER:         ||
LAYER:                VK_LAYER_KHRONOS_validation
LAYER:                        Type: Explicit
LAYER:                        Manifest: /usr/share/vulkan/explicit_layer.d/VkLayer_khronos_validation.json
LAYER:                        Library:  libVkLayer_khronos_validation.so
LAYER:                  ||
DRIVER | LAYER:       <Device>
DRIVER | LAYER:           Using "NVIDIA GeForce RTX 3050 Laptop GPU" with driver: "libGLX_nvidia.so.0"
[2024-11-14T13:07:49Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-14T13:07:50Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-14T13:07:51Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-14T13:07:52Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-14T13:07:53Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-14T13:07:54Z DEBUG wluma::frame::capturer::wayland] Frame copy failed
[2024-11-14T13:07:55Z DEBUG wluma::frame::capturer::wayland] Frame copy failed

Unfortunately I'm really not sure how to debug this, compositor does not send us any information about the error, just that it failed 😞 We have a few hyprland users, while it's possible that you are the only one on hyprland-git, I suspect the issue might be somewhere with Nvidia, though I cannot imagine where...

Perhaps one thing we could try: could you install vulkan-validation-layers package and then run these commands:

export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
export VK_LOADER_DEBUG=all
cargo run

If you see some errors, please share!

@maximbaz ,I'm using hyprland-git

@maximbaz
Copy link
Owner

Thanks for trying, unfortunately there's nothing that could point to an issue 🤔 Does https://github.com/russelltg/wl-screenrec/ work for you? It uses similar approach to capture frames.

@loss-and-quick
Copy link
Author

loss-and-quick commented Nov 14, 2024

Thanks for trying, unfortunately there's nothing that could point to an issue 🤔 Does https://github.com/russelltg/wl-screenrec/ work for you? It uses similar approach to capture frames.

Opening libva device from DRM device /dev/dri/renderD128
[AVHWFramesContext @ 0x563978c43ec0] Failed to create surface: 14 (the requested RT Format is not supported).
[AVHWFramesContext @ 0x563978c43ec0] Unable to allocate a surface from internal buffer pool.
failed to create encoder(s): Failed to create vaapi frame context for capture surfaces of format BGRZ 1920x1080
thread 'main' panicked at src/main.rs:904:51:
enc left in intermediate state
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Check:
russelltg/wl-screenrec#79
russelltg/wl-screenrec#95

@maximbaz
Copy link
Owner

Nice findings, let's wait until vulkan renderer lands there and if that works, I'm very hopeful we'll also be able to find a bug here!

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

No branches or pull requests

2 participants