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

Artifacting when drawing, selecting, dragging, erasing, etc. #1263

Open
FarrenHawk opened this issue Oct 24, 2024 · 15 comments
Open

Artifacting when drawing, selecting, dragging, erasing, etc. #1263

FarrenHawk opened this issue Oct 24, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@FarrenHawk
Copy link

Describe the bug
Any form of movement on the canvas results in artifacting, generally wallpaper artifacts, but sometimes artifacts from the eraser or selection tool. The main brush will also often default to selection, but it's not consistent. I feel like this is related to the other issue, because if my memory serves me correctly, I didn't have these issues a couple of months ago. I feel like either a system update or a rnote update created this issue.

To Reproduce
I'm not sure how to reproduce this behavior. My apologies.

Expected behavior
A clear and concise description of what you expected to happen.

Console Output
(I don't know how to get this, I didn't install rnote with flatpak, sorry)

Screenshots
Here's a screen recording of the artifacting. Note that it also occurs with the red border of the eraser tool.

2024-10-24.13-22-58.mp4

Desktop:

  • OS: Arch Linux v6.11.4 (using linux-surface)
  • App Version: Rnote v0.11.0
  • Installation Source: Arch Linux Official repo, I also tried building from source, but the problem wasn't fixed
  • Desktop Environment: Hyprland v0.44.0
  • Display Server: Wayland
  • Input Source: On-Screen-Tablet (Microsoft Surface Laptop Studio)

Additional context
This issue seems very similar to #309

@flxzt flxzt added the bug Something isn't working label Oct 25, 2024
@rightleftspin
Copy link

I'm getting this same issue after updating an hour ago. My specs are as follows.

OS: Nixos Unstable
App Version: Rnote v0.11.0
Installation Source: Nixpkgs, recently updated
Desktop Environment: Niri 0.1.9
Display Server: Wayland
Input Source: Wacom Tablet

@devraza
Copy link

devraza commented Nov 18, 2024

I'm getting this issue too, using version 0.11.0 on Hyprland on NixOS. I'm using a Huion tablet as my input device.

@ibesmrad
Copy link

I have this issue too in both Hyprland and KDE(with Wayland) and using the latest version of rnote.

@sodiboo
Copy link

sodiboo commented Nov 27, 2024

I'm also experiencing this issue on 0.11.0 on NixOS with niri.

The problem is with damage tracking, and only happens with a fractional scale. Somewhere, the damage region is likely rounded to surface-local coordinates (which are integers; one fundamental flaw of the core Wayland protocol that unfortunately cannot be fixed), which is wrong and causes off-by-one errors like this. I couldn't easily find the offending code from a quick search for damage in this repo, which yields zero code results.

The correct way to implement this is to ignore the surface-local coordinates. Because damage is inherently unrelated to surface geometry, there exists a damage_buffer requests on wl_surfaces, which should be used instead. Then, the damage never needs to be rounded and doesn't cause this issue.

The issue doesn't occur on integer scales because then the rounding is exact.

It seems to be the case that every buffer from rnote is an empty buffer with transparent pixels. This issue would be less noticeable if the remainder of the buffer was also content, because then the only effect is that the GPU does slightly more work than necessary. Because the region that wasn't drawn is transparent, it causes the parts that were not drawn to update to a transparent pixel instead. It is part of the surface's opaque region, so most compositors will show the incorrectly damaged parts as black, unless you have a window rule making the whole window transparent, in which case it will show your wallpaper or whatever's behind.

Panning removes the artifacts because it redraws the entire buffer and damages the entire buffer.

@dangooddd
Copy link

dangooddd commented Dec 7, 2024

I have this issue too, with any level of fractional scaling. Without fractional scaling issue dissappears. Runnig on KDE Plasma 6.2 Wayland

@FarrenHawk
Copy link
Author

Ah, that explains it. kinda sucks, because fractional scaling is the only thing that works properly on my laptop due to it being a high dpi screen. normal scale value and everything is too small.

@devraza
Copy link

devraza commented Dec 7, 2024

@HenriHawk42 have you tried a scale of 2?

@FarrenHawk
Copy link
Author

@devraza the scaling appears too large for my laptop (i.e. the buttons are too big)

@Kneemund
Copy link
Collaborator

Kneemund commented Dec 8, 2024

I've tried to reproduce this, and I'm getting these artifacts everywhere when fractional scaling is enabled (e.g. when hovering over elements of the workspace browser), not just within the canvas.

Rnote doesn't interact with Wayland directly, but sodiboo might still be on the right track. It could also be a GTK, mutter or cairo bug (or any other abstraction we use); fractional scaling is experimental after all. I'm not sure, I'll try to do some more testing soon.

@sodiboo
Copy link

sodiboo commented Dec 8, 2024

Rnote doesn't interact with Wayland directly

Yeah, i wasn't able to find much Wayland-specific code. But i am approaching the issue from the perspective of a Wayland compositor (as that's the thing i'm to some extent working on), so i described what is definitely happening at that level.

The actual location of the bug is at some higher level of abstraction, but fundamentally it does look like it's incorrectly rounding the buffer damages to fractional scales (which again, is wrong and unnecessary, because even at the lower level of the stack you are supposed to pass the raw buffer damage, so it shouldn't be rounded anywhere along the chain of custody)

@FarrenHawk
Copy link
Author

switching to an integer scale factor fixed this issue perfectly for me, and this is honestly better because the buttons are bigger for ease of touch. only downside is that other apps are scaled incorrectly. i wonder if i can somehow tell hyprland to use 1.6 scaling for other apps but to use a scale factor of 2 for just rnote

@devraza
Copy link

devraza commented Dec 9, 2024

@HenriHawk42 maybe you could have a script running that changes the scale factor depending on whether you've got focus on rnote or not.

@FarrenHawk
Copy link
Author

yuhp, i was thinking that myself

@Doublonmousse
Copy link
Collaborator

Doublonmousse commented Dec 30, 2024

I thought GDK_SCALE=2 would work as a workaround but that isn't activated with the wayland gtk backend (but works on X). Maybe GDK_BACKEND=x11 GDK_SCALE = 2 rnote is a passable workaround.

Also, what versions of gtk are you on ? I can't seem to reproduce this on 4.16.5-2.fc41 with fractional scaling on kde (no matter the renderer, though I know there's a fedora specific patch here, probably unrelated though).

Edit : It still happens with the gl renderer (also applies to the general UI outside of the canvas !), sometimes but less with the ngl renderer and on vulkan I'm not sure (I have a lot of artefacting in some cases but of a different kind, though I'm not sure how specific to my machine this is, I'm on asahi)

@devraza
Copy link

devraza commented Dec 31, 2024

Just GDK_BACKEND=x11 was enough to fix the artifacting for me, though the UI still appears blurry/pixelated.
image

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

10 participants