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

Blank page in foliate book reader on monitor scales above 1 on Hyprland 0.41.2 and 0.42.0; works fine on all scales in Sway #7341

Open
MahouShoujoMivutilde opened this issue Aug 14, 2024 · 9 comments
Labels
bug Something isn't working
Milestone

Comments

@MahouShoujoMivutilde
Copy link
Contributor

MahouShoujoMivutilde commented Aug 14, 2024

Regression?

No

System Info and Version

System/Version info
Hyprland, built from branch main at commit 3b4aabe04c7756fb0a70d78b6f0e701228f46345 dirty (decorations: fix manual resize not recalculating decos (7323)).
Date: Tue Aug 13 23:00:31 2024
Tag: v0.42.0-18-g3b4aabe0, commits: 5087

flags: (if any)


System Information:
System name: Linux
Node name: alice
Release: 6.6.23.28.realtime1-7-rt-lts
Version: #1 SMP PREEMPT_RT Tue, 06 Aug 2024 08:27:40 +0000


GPU information: 
09:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1) (prog-if 00 [VGA controller])
NVRM version: NVIDIA UNIX x86_64 Kernel Module  555.58.02  Tue Jun 25 01:39:15 UTC 2024


os-release: NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo


plugins:

======Config-Start======


Config File: /home/witch/hdefault-min.conf: Read Succeeded
# vim: ft=hyprlang:

# NOTE: this is default config + some of my bindings

# This is an example Hyprland config file.
# Refer to the wiki for more information.
# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/

# Please note not all available settings / options are set here.
# For a full list, see the wiki

# You can split this configuration into multiple files
# Create your files separately and then link them to this file like this:
# source = ~/.config/hypr/myColors.conf


################
### MONITORS ###
################

# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,1

# exec-once = glxgears

###################
### MY PROGRAMS ###
###################

# See https://wiki.hyprland.org/Configuring/Keywords/

# # Set programs that you use
# $terminal = foot
# $fileManager = dolphin
# $menu = tofi-drun


#################
### AUTOSTART ###
#################

# Autostart necessary processes (like notifications daemons, status bars, etc.)
# Or execute your favorite apps at launch like this:

# exec-once = $terminal
# exec-once = nm-applet &
# exec-once = waybar & hyprpaper & firefox


#############################
### ENVIRONMENT VARIABLES ###
#############################

# See https://wiki.hyprland.org/Configuring/Environment-variables/

env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24

#####################
### LOOK AND FEEL ###
#####################

# Refer to https://wiki.hyprland.org/Configuring/Variables/

# https://wiki.hyprland.org/Configuring/Variables/#general
general {
    gaps_in = 5
    gaps_out = 20

    border_size = 3
    # col.active_border = rgb(ee1111)
    col.active_border = rgb(b30000) # NOTE: red borders from wayland, green for xwayland (see rules)
    # col.inactive_border = rgba(00000000)
    col.inactive_border = rgba(1a0402ff)
    # col.inactive_border = rgba(ffffffaa)

    # Set to true enable resizing windows by clicking and dragging on borders and gaps
    resize_on_border = false

    # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
    allow_tearing = false

    layout = dwindle
}

# https://wiki.hyprland.org/Configuring/Variables/#decoration
decoration {
    rounding = 10

    # Change transparency of focused and unfocused windows
    active_opacity = 1.0
    inactive_opacity = 1.0

    drop_shadow = true
    shadow_range = 4
    shadow_render_power = 3
    col.shadow = rgba(1a1a1aee)

    # https://wiki.hyprland.org/Configuring/Variables/#blur
    blur {
        enabled = true
        size = 3
        passes = 1

        vibrancy = 0.1696
    }
}

# https://wiki.hyprland.org/Configuring/Variables/#animations
animations {
    enabled = true

    # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more

    bezier = myBezier, 0.05, 0.9, 0.1, 1.05

    animation = windows, 1, 7, myBezier
    animation = windowsOut, 1, 7, default, popin 80%
    animation = border, 1, 10, default
    animation = borderangle, 1, 8, default
    animation = fade, 1, 7, default
    animation = workspaces, 1, 6, default
}

# # fast animations
# animations {
#     enabled = yes
#     # https://easings.net/
#     # https://www.cssportal.com/css-cubic-bezier-generator/
#     bezier = cst, 0.84, 0.37, 0.2, 0.62

#     animation = windows, 1, 1, cst
#     animation = windowsMove, 1, 2, default
#     animation = windowsOut, 1, 3, default, popin 80%
#     animation = border, 1, 5, default
#     animation = workspaces, 1, 2, default

#     # faster fade
#     animation = fade, 1, 2, default

#     # possibly fucks with gammastep at boot?
#     first_launch_animation = no
# }

# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
dwindle {
    pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
    preserve_split = true # You probably want this
}

# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master {
    new_status = master
}

# https://wiki.hyprland.org/Configuring/Variables/#misc
misc {
    force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
    disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :(
}


#############
### INPUT ###
#############

# https://wiki.hyprland.org/Configuring/Variables/#input
input {
    kb_layout = us,ru
    kb_options = caps:escape,grp:toggle
    # kb_layout = us
    # kb_variant =
    # kb_model =
    # kb_options =
    # kb_rules =


    repeat_delay = 300
    repeat_rate = 50

    follow_mouse = 1

    sensitivity = 0 # -1.0 - 1.0, 0 means no modification.

    touchpad {
        natural_scroll = false
    }
}

# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
    workspace_swipe = false
}

# # Example per-device config
# # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
# device {
#     name = epic-mouse-v1
#     sensitivity = -0.5
# }


####################
### KEYBINDINGSS ###
####################

# some nice mouse binds
bindm = SUPER, mouse:272, movewindow
bindm = SUPER, mouse:273, resizewindow

# compositor bindings

# q
bind = SUPER SHIFT, q, killactive,

# s
bind = SUPER, s, togglefloating,
# a
bind = SUPER, a, pseudo,
# f
bind = SUPER, f, fullscreen, 1
bind = SUPER SHIFT, f, fullscreen, 0

# MASTER
bind=SUPER, o, layoutmsg, orientationcycle left top right center

# h
bind = SUPER, h, movefocus, l
bind = SUPER, h, alterzorder, top
# j
bind = SUPER, j, movefocus, d
bind = SUPER, j, alterzorder, top
# k
bind = SUPER, k, movefocus, u
bind = SUPER, k, alterzorder, top
# l
bind = SUPER, l, movefocus, r
bind = SUPER, l, alterzorder, top

bind = SUPER SHIFT, h, movewindow, l
bind = SUPER SHIFT, j, movewindow, d
bind = SUPER SHIFT, k, movewindow, u
bind = SUPER SHIFT, l, movewindow, r


# MASTER
bind = SUPER, m, layoutmsg, addmaster
bind = SUPER SHIFT, m, layoutmsg, removemaster

# # -
# bind = SUPER SHIFT, underscore, layoutmsg, mfact 0.1
# # +
# bind = SUPER SHIFT, plus, layoutmsg, mfact 0.1

bind = ALT, Tab, cyclenext,          # change focus to another window
bind = ALT, Tab, alterzorder, top   # bring it to the top
bind = ALT SHIFT, Tab, cyclenext, prev
bind = ALT SHIFT, Tab, alterzorder, top


bind = SUPER, 1, workspace, 1
bind = SUPER, 2, workspace, 2
bind = SUPER, 3, workspace, 3
bind = SUPER, 4, workspace, 4
bind = SUPER, 5, workspace, 5
bind = SUPER, 6, workspace, 6
bind = SUPER, 7, workspace, 7
bind = SUPER, 8, workspace, 8
bind = SUPER, 9, workspace, 9
bind = SUPER, 0, workspace, 10

# - or + for relative prev / next open workspace
bind = SUPER, minus, workspace, e-1
bind = SUPER, equal, workspace, e+1
# bind = SUPER SHIFT, grave, workspace, e-1
# bind = SUPER, grave, workspace, e+1
bind = SUPER CTRL, h, workspace, e-1
bind = SUPER CTRL, l, workspace, e+1
bind = SUPER SHIFT CTRL, Tab, workspace, e-1
bind = SUPER CTRL, Tab, workspace, e+1

bind = SUPER, Tab, workspace, previous

bind = SUPER SHIFT, 1, movetoworkspacesilent, 1
bind = SUPER SHIFT, 2, movetoworkspacesilent, 2
bind = SUPER SHIFT, 3, movetoworkspacesilent, 3
bind = SUPER SHIFT, 4, movetoworkspacesilent, 4
bind = SUPER SHIFT, 5, movetoworkspacesilent, 5
bind = SUPER SHIFT, 6, movetoworkspacesilent, 6
bind = SUPER SHIFT, 7, movetoworkspacesilent, 7
bind = SUPER SHIFT, 8, movetoworkspacesilent, 8
bind = SUPER SHIFT, 9, movetoworkspacesilent, 9
bind = SUPER SHIFT, 0, movetoworkspacesilent, 10


# other bindings
bind = SUPER, RETURN, exec, foot

# windowrulev2 = float,class:floating
# windowrulev2 = dimaround,class:floating
# bind = SUPER ALT, RETURN, exec, foot -a floating

# d
bind = SUPER, d, exec, tofi-drun --width 30% --fuzzy-match true
bind = SUPER SHIFT, d, exec, tofi-run --history=false --width 30% --fuzzy-match true | xargs -r hyprctl dispatch exec

bind = SUPER, y, exec, extra-tools
bind = SUPER, g, exec, qalculate-qt

bind = , Print, exec, mksrc-wl
bind = SUPER, Print, exec, mksrc-wl active
bind = SHIFT, Print, exec, mksrc-wl area
bind = CTRL, Print, exec, mksrc-wl area-edit

##############################
### WINDOWS AND WORKSPACES ###
##############################

# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules

# Example windowrule v1
# windowrule = float, ^(kitty)$

# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$

windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.

# Show when using xwayland
windowrulev2 = bordercolor rgb(65b770) rgba(00000000), xwayland:1
windowrulev2 = bordersize 3, xwayland:1

======Config-End========

Description

Foliate (installed from arch repos) is a book reader that uses webkitgtk-6.0 to render text.

Horrifying, I know. But it's the only one that didn't lag in large books, didn't look like ass, didn't randomly disrespect formatting, didn't try run my library by importing my books to some location without me asking it to do so, had actual GUI and not a meme-tier latin-only hotkeys, etc.

On scale 1 it works fine, without errors.

On anything above one you'll get this:

❯ foliate book.epub
Failed to create GBM buffer of size 0x0: Invalid argument
...

And a blank white page instead of your book.

I can observe this behavior on both wlroots (0.41.2) and aquamarine (hyprland 3b4aabe, aquamarine 9312aa2).

Happens regardless if nvidia specific environment variables are set.

Now, if you look at foliate repo, there are issues about blank pages. johnfactotum/foliate#1107, johnfactotum/foliate#1115, johnfactotum/foliate#1271, with some advice (bad if you don't like slideshow scroll) how to "fix" it - WEBKIT_DISABLE_DMABUF_RENDERER=1

So why make issue here?

Well, because it works on sway 1.9 with wlroots0.17 from arch repos on all scales.

I don't use nix, so because of the need for outdated dependencies I can't easily check when it started happening or if scales above 1 were always broken.

I certainly didn't use 1.25 I use now from the beginning of the fractional scaling support, so my comment on one of those issues might just be flatpak disrespecting scaling and working solely for that reason.

Even on sway+wlroots from 3 years ago it works fine on all scales, hyprland has this issue as early as 0.23beta, and probably always had. #7341 (comment)

Other WebKitGTK-6.0 apps

  • epiphany (gnome web) has the same error on scales above 1, but manages to render the page properly. Might be some internal fallback that's just absent in foliate, idk.

  • newsflash also works on scales above 1, but the whole interface is slightly blurry, which is strange, it's not xwayland. No GBM error.

  • gfeeds works, interface as normal. No GBM error.

  • setzer seems to work, but with interface slightly blurry like newsflash. No GBM error.

Again, I don't know if they just have some internal fallback - the performance is not horrible. But that's just simple webpages, not a million words long books.

But what curious is why sway works. Sway or wlroots, that don't support (proprietary) nvidia, so any nvidia specific fallback on their side is unlikely.

How to reproduce

Install foliate from arch repos (no flatpak/snap sandbox to interfere with anything) and use any .epub book.

Hyprland:

  1. Set monitor = ,preferred,auto,1.25, (same for the scale 2)
  2. Run foliate book.epub and observe the blank page and an error mentioned above
  3. Close foliate
  4. Set monitor = ,preferred,auto,1
  5. Run foliate book.epub again and observe properly rendered book page

Sway:

If needed, copy default config to user config directory, since we will be editing it.

mkdir -p ~/.config/sway
cp /etc/sway/config ~/.config/sway/config
  1. Replace default output statement with output * scale 1, press Super+Shift+C to reload config
  2. Run foliate book.epub - page is displayed properly
  3. Close foliate
  4. Change the scale to 1.25, press Super+Shift+C to reload config
  5. Because it's Sway, terminals now are blurry until you reopen them. We don't care about them.
  6. Run foliate book.epub - page is still displayed properly
  7. Change the scale to 2, press Super+Shift+C to reload config
  8. Run foliate book.epub - page is still displayed properly

Crash reports, logs, images, videos

Screenshots

On 3b4aabe

epiphany-scale-1.25

epiphany-scale-1 25

epiphany-scale-1

epiphany-scale-1

foliate-scale-1

foliate-scale-1

foliate-scale-1.25

foliate-scale-1 25

foliate-scale-2

foliate-scale-2

0.41.2

foliate-scale-1

foliate-scale-1

foliate-scale-2

foliate-scale-2

sway 1.9 + wlroots 0.17

epiphany-aka-gnome-web-scale-1

epiphany-aka-gnome-web-scale-1

foliate-scale-1

foliate-scale-1

foliate-scale-1.25

foliate-scale-1 25

foliate-scale-2

foliate-scale-2

@MahouShoujoMivutilde MahouShoujoMivutilde added the bug Something isn't working label Aug 14, 2024
@vaxerski
Copy link
Member

vaxerski commented Aug 15, 2024

WAYLAND_DEBUG=1 from launching on hyprland and sway please

@MahouShoujoMivutilde
Copy link
Contributor Author

MahouShoujoMivutilde commented Aug 15, 2024

@vaxerski vaxerski added this to the 0.43.0 milestone Aug 16, 2024
@romanstingler
Copy link
Contributor

There was an update in 'egl-wayland' 1.16 which fixed a QT6 Webengine bug
https://github.com/NVIDIA/egl-wayland/releases/tag/1.1.16
worth a try in the meantime

@MahouShoujoMivutilde
Copy link
Contributor Author

MahouShoujoMivutilde commented Aug 26, 2024

Status:

On 58669fe aquamarine 0.4.1_r218.g8b72861-1, foliate 3.1.1.r25.g4fbeecb-1, gtk4 1:4.16.2-1 (with GSK_RENDERER=ngl), webkitgtk-6.0 2.46.0-2, nvidia 560.35.03-3, egl-wayland 4:1.1.16-1, mesa 1:24.2.3-1

The behavior is the same - scale 1 works fine, same GBM error on scales above 1 and empty window.


(weird scaling of nested sway in hyprland was caused by #7499)

@vaxerski vaxerski modified the milestones: 0.43.0, 0.44.0 Sep 10, 2024
@MahouShoujoMivutilde
Copy link
Contributor Author

Tried to hunt it down, in vm, using 1 Jun 2024 box.

"Broken" here means scales above 1 reproduce the issue (blank page).

0.40.0 is broken - hyprwayland-scanner first introduced
0.37.1 is broken - before wlroots fork
0.33.1 is broken - there is no GBM error (still a blank page). Unfortunately, didn't pay attention if other earlier versions also had no error
0.27.2 is invalid - scale setting (1.25; 2) is ignored? - scale is 1, so it works
0.24.1 is broken
0.23beta is broken - earliest available in the arch linux archive

I think, it's safe to say, it never worked properly with scales above 1.

I also tested older versions of sway and wlroots:

sway 1.9 wlroots 0.17.1 works
sway 1.7 wlroots 0.15.0 works (from almost 3 years ago)

Another note:

Foliate 2.6.4 that uses gtk3 3.24.41 and webkit2gtk 2.42.5 works on any scale, but works like a slideshow on large books, so I assume it has some fallback to software render internally that just didn't get ported to gtk4. I didn't investigate it further, as the performance is unusable anyway, and gpu render clearly can work (sway) on gtk4 too without any performance issues.

@MahouShoujoMivutilde
Copy link
Contributor Author

Possibly related to the order of the app getting the wp_fractional_scale_v1.preferred_scale event on different compositors on scales above 1 #7854 (comment)

I can make epiphany (and other gtk4 apps) work on gtk 4.16.1 without GSK_RENDERER on scale 1, but not on scale 1.25.

On scales above 1 it works only with GSK_RENDERER set to either of cairo, opengl, gl, ngl.

On scale 1 it starts to work with broadway and vulkan too, so - with all renderers on the list from GSK_RENDERER=help.

On plasma-desktop 6.1.5 scale 1.25 (in qemu, virtio) on gtk 4.16.1 without GSK_RENDERER, both foliate and epiphany work as expected (no error, content is rendered).

@vaxerski
Copy link
Member

maybe this is a bug in whatever toolkit it uses then? hyprland's fsv1 impl is correct and within the spec.

@MahouShoujoMivutilde
Copy link
Contributor Author

Hard to tell.

But here is WAYLAND_DEBUG=1 foliate 3.1.1 (gtk 4.16.1) from different wayland compositors with different backends.

Here, only hyprland at scale 1.25 has this issue.

You might be right, and it's perfectly within spec, and it's just the case of people looking at popular implementations and copying, and, as the result, them becoming de facto spec the apps and toolkits are tested against.

It might be something else is wrong, and scales above 1 just trigger the logic that ultimately leads to some other buggy code, with the scaling doing its part correctly.

Idk.

Looking at the logs, what jumps out to me (as someone who doesn't know anything about how wayland compositor should be designed), is that plasma, mutter, sway and niri have something like this

(scale 1.25)

{Default Queue} wp_fractional_scale_v1#39.preferred_scale(150)
wl_surface#38.preferred_buffer_scale(2)

(scale 1)

{Default Queue} wp_fractional_scale_v1#45.preferred_scale(120)
wl_surface#44.preferred_buffer_scale(1)

And one time each.

While hyprland has it 3 times

(scale 1)

209-{Default Queue} wl_keyboard#34.repeat_info(50, 300)
210:{Default Queue} wp_fractional_scale_v1#39.preferred_scale(120)
211-xdg_toplevel#42.wm_capabilities(array[8])
--
382-{Default Queue} wl_callback#45.done(657742)
383:{Default Queue} wp_fractional_scale_v1#39.preferred_scale(120)
384-{Default Queue} wl_keyboard#34.enter(351, wl_surface#38, array[0])
--
392-{Default Queue} wl_data_device#28.selection(wl_data_offer#4278190080)
393:{Default Queue} wp_fractional_scale_v1#39.preferred_scale(120)
394-{Default Queue} wl_pointer#25.enter(354, wl_surface#38, 432.97656250, 376.97265625)

(scale 1.25)

209-{Default Queue} wl_keyboard#34.repeat_info(50, 300)
❗210:{Default Queue} wp_fractional_scale_v1#39.preferred_scale(120)
211-xdg_toplevel#42.wm_capabilities(array[8])
--
382-{Default Queue} wl_callback#45.done(616220)
383:{Default Queue} wp_fractional_scale_v1#39.preferred_scale(150)
384-{Default Queue} wl_keyboard#34.enter(300, wl_surface#38, array[0])
--
392-{Default Queue} wl_data_device#28.selection(wl_data_offer#4278190080)
393:{Default Queue} wp_fractional_scale_v1#39.preferred_scale(150)
394-{Default Queue} wl_pointer#25.enter(303, wl_surface#38, 75.96875000, 469.77343750)

with preferred_buffer_scale somewhere way after. Also, notice that it first starts with 120.

This seems weird, but I don't know how much it matters.

@vaxerski
Copy link
Member

Also, notice that it first starts with 120.

yeah we do this and it shouldnt matter

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

No branches or pull requests

3 participants