johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
6.15k stars 283 forks source link

Blank page when using Nvidia #1107

Closed flandriai closed 10 months ago

flandriai commented 10 months ago

Describe the bug

After upgrading Foliate on Linux Mint 21.2 via the update manager (which successfully installed the latest version from the Flatpak repository) one is unable to read ebooks anymore. The software seemingly works fine, however after trying to open a file, you can see the spinning circle for a long time (indicating that Foliate is loading the book) and after it disappears one can only see a completely "white box" where normally the contents of the book should be. On the top of the window you can read the book's title, the navigation panel is there too on the side (with the table of contents), but you cannot read the book. It does not help changing the theme from light to dark (or vice versa). When selecting dark mode everything changes according to the theme but the book cannot be seen. Activating developer tools does not help to find out what causes the problem, because you cannot see that either.

To Reproduce Steps to reproduce the behavior:

  1. Update Foliate to the latest version.
  2. Open the program.
  3. Try to open a file.
  4. See error.

Expected behavior

I expect (after a short loading period) to see and be able to read the book.

Version:

Additional context I also tried to completely delete and reinstall the software without any success.

johnfactotum commented 10 months ago

Nvidia?

flandriai commented 10 months ago

Yes, my GPU is an Nvidia card.

johnfactotum commented 10 months ago

Probably the same as #1085 and #1093. Try setting WEBKIT_DISABLE_DMABUF_RENDERER=1.

flandriai commented 10 months ago

Probably the same as #1085 and #1093. Try setting WEBKIT_DISABLE_DMABUF_RENDERER=1.

Thank you for the quick answer. I've also searched for the "Use the publisher's font" option but I did not find it in the new version. As I regularly used it first I guessed it has something to do with the problem.

meysampg commented 10 months ago
meysam@freedom-zenbook:~ 
$ WEBKIT_DISABLE_DMABUF_RENDERER=1 foliate

(com.github.johnfactotum.Foliate:321188): com.github.johnfactotum.Foliate-WARNING **: 18:38:23.078: Error: Requiring Tracker, version none: Typelib file for namespace 'Tracker' (any version) not found
getURIFromTracker@resource:///com/github/johnfactotum/Foliate/library.js:16:24
get@resource:///com/github/johnfactotum/Foliate/library.js:56:42
getBookFromIdentifier@resource:///com/github/johnfactotum/Foliate/library.js:105:36
getBook@resource:///com/github/johnfactotum/Foliate/library.js:101:21
activate@resource:///com/github/johnfactotum/Foliate/library.js:394:63
activate@resource:///com/github/johnfactotum/Foliate/library.js:322:18
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

** (com.github.johnfactotum.Foliate:321188): WARNING **: 18:38:23.091: Could not open /sys/class/dmi/id/chassis_type: Failed to open file “/sys/class/dmi/id/chassis_type”: Permission denied

** (com.github.johnfactotum.Foliate:321188): WARNING **: 18:38:23.091: Could not open /sys/firmware/acpi/pm_profile: Failed to open file “/sys/firmware/acpi/pm_profile”: Permission denied

** (com.github.johnfactotum.Foliate:321188): ERROR **: 18:38:23.094: Unable to spawn a new child process: Failed to spawn child process “/usr/lib/x86_64-linux-gnu/webkitgtk-6.0/WebKitNetworkProcess” (No such file or directory)
[1]    321188 trace trap (core dumped)  WEBKIT_DISABLE_DMABUF_RENDERER=1 foliate

meysam@freedom-zenbook:~ 
$ screenfetch                                   
                          ./+o+-       meysam@freedom-zenbook
                  yyyyy- -yyyyyy+      OS: Ubuntu 23.10 mantic
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 6.5.0-10-generic
           .++ .:/++++++/-.+sss/`      Uptime: 10d 21h 54m
         .:++o:  /++++++++/:--:/-      Packages: 1958
        o:+o+:++.`..```.-/oo+++++/     Shell: zsh 5.9
       .:+o:+o/.          `+sssoo+/    Resolution: 2880x1800
  .++/+:+oo+o:`             /sssooo.   DE: GNOME 45.0
 /+++//+:`oo+o               /::--:.   WM: Mutter
 \+/+o+++`o++o               ++////.   WM Theme: Adwaita
  .++.o+++oo+:`             /dddhhh.   GTK Theme: Yaru-prussiangreen-dark [GTK2/3]
       .+.o+oo:.          `oddhhhh+    Icon Theme: Yaru-prussiangreen
        \+.++o+o``-````.:ohdhhhhh+     Font: Ubuntu 11
         `:o+++ `ohhhhhhhhyo++os:      Disk: 35G / 938G (4%)
           .o:`.syhhhhhhh/.oo++o`      CPU: 12th Gen Intel Core i7-12700H @ 20x 4.6GHz [45.0°C]
               /osyyyyyyo++ooo+++/     GPU: Intel Corporation Alder Lake-P Integrated Graphics Controller (rev 0c)
                   ````` +oo+++o\:     RAM: 8333MiB / 15673MiB
                          `oo++.     
johnfactotum commented 10 months ago

@flandriai There's currently no "Use publisher font" option. Publisher fonts are always used, with no way to disable them (except for overriding them with userstyle).

@meysampg That looks like #1102.

iandoug commented 9 months ago

WEBKIT_DISABLE_DMABUF_RENDERER=1 foliate

thanks

catnapster commented 9 months ago

Probably the same as #1085 and #1093. Try setting WEBKIT_DISABLE_DMABUF_RENDERER=1.

Hi - I'm sorry, I don't understand. What am I setting here? Where is this found?

iandoug commented 9 months ago

2023-12-09_23-47

catnapster commented 9 months ago

Hi iandoug. I appreciate the assistance, but... what is that a picture of? I've just installed it via flatpak. This looks like a very handy menu, but I've never seen it before. Where is this found?

iandoug commented 9 months ago

That's part of KDE's MenuEdit. I don't know how to set environment variables in flatpack things ... I installed Foliate via my system package manager.

Strictly speaking I don't know why it is necessary to set environment variables like this ... should the app not handle it?

It used to work fine without it until recently.

The original suggestion above was for use on the command line, like

WEBKIT_DISABLE_DMABUF_RENDERER=1 foliate some-file-name.epub

taniki commented 9 months ago

Flatseal is a convenient GTK app to add some environment variables into flatpack apps. This comment documents a walkthrough https://github.com/johnfactotum/foliate/issues/1115#issuecomment-1809480892

zmazanv commented 8 months ago

Arch Wiki: Window does not appear in Flatpak on Nvidia

This is a known issue with Nvidia in Flatpak environments.

The linked Arch Wiki page includes a band-aid fix which does solve the issue, although inconvenient and not really a long-term solution. This could be made easier with a script if it this isn't resolved any time soon and it becomes too much of a headache to have to update the variable at each driver update.

The advantage over the other proposed "solution" of setting WEBKIT_DISABLE_DMABUF_RENDERER=1 is that you don't lose hardware acceleration. WEBKIT_DISABLE_DMABUF_RENDERER=1 makes the app noticeably sluggish due to this. The app runs perfectly fine with the linked "solution".

The environment variable to set for Nvidia driver version 545.29.06 would be: GBM_BACKENDS_PATH=/usr/lib/x86_64-linux-gnu/GL/nvidia-545-29-06/extra/gbm

The driver version number would need to be updated to match the running Nvidia driver version.

You could then set this with an override with flatpak override --env=GBM_BACKENDS_PATH=/usr/lib/x86_64-linux-gnu/GL/nvidia-XXX-YY-ZZ/extra/gbm com.github.johnfactotum.Foliate or through setting the environment variable in Flatseal, which does the same thing.

imagen

iandoug commented 8 months ago

I am not using flatpak, but standard Gentoo package install. It used to work fine in the past. I need to update my Nvidia driver but need to update kernel first, don't know if this is all related.

zmazanv commented 8 months ago

It likely is unrelated. I just left this here in case someone running the Flatpak version comes across this thread to point them to what the actual issue is. It's related to the containerized environment that the Flatpak apps run in which don't play nicely with Nvidia drivers for certain applications at the moment.

Normal unisolated binaries should work just fine as they don't have these limitations.

Your issue likely lies elsewhere. Best of luck 🫡

Alexey104 commented 8 months ago

Same issue. I am not using neither snap nor flatpak, I use version 3.1.0 from arch repos:

KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 1550x1166: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 1550x1166: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 1550x1166: Permission denied
Failed to create EGL images for DMABufs with file descriptors -1, -1 and -1

I have nvidia_drm.modeset=1 kernel parameter set, but it doesn't make a difference. Setting WEBKIT_DISABLE_DMABUF_RENDERER=1 environment variable solves the problem but leads to awful scrolling performance.

soumyaDghosh commented 5 months ago

@johnfactotum I can add a script that will set the env variable when using with Nvidia. Do you want that?

johnfactotum commented 5 months ago

No, I think it'd be better to follow the upstream.

MahouShoujoMivutilde commented 5 months ago

Just a quick note in case somebody on Arch runs into this:

I have nvidia_drm.modeset=1, and foliate from the repos. It used to work fine (including 3.x version), but I didn't use it for some time, and now it shows a blank page, with Failed to create GBM buffer of size 0x0: Invalid argument in terminal.

OLD FIX

`WEBKIT_DISABLE_COMPOSITING_MODE` and `WEBKIT_DISABLE_DMABUF_RENDERER` are both indeed help but lead to awful performance. I can't set `GBM_BACKENDS_PATH` because I don't have a gbm there (probably because I use nvidia-dkms). Setting it to `/usr/lib/gbm/nvidia-drm_gbm.so` (found it by looking for similar sounding things in `/usr/lib`) didn't help. **However, I've installed flatpak version and it just worked. No performance problems.** ---- #### UPD August 2024 Something changed, and it stopped working. I'm on hyprland 0.42.0. But I can get it to work in [cage](https://github.com/cage-kiosk/cage), but, funnily enough not under xwayland. It has problems of not passing my keyboard layout to the search bar, though. And copy doesn't translate to the host clipboard.


UPD

Figured it out. It's scale! It doesn't like monitor scales above 1 on hyprland, both on wlroots and aquamarine versions.

Setting scale to 1 "fixes" the issue.

BTW, I get the same error in epiphany (webkitgtk-6 too) on higher scales, but the web pages still render.