Subject: bug#79295: [Bug] Artifacts in margin with display-line-numbers-mode (relative)

From: Marco Neumaier <[email-masked]>
Date: Mon, 25 Aug 2025 10:35:07 +0200

I checked already if it depends on fractional scaling, but that´s not the
case. Will double check though.
My CPU is an AMD 9700X and i´m using its iGPU. I´m also running a very
recent MESA version (25.x, I have to check the exact version)
and I also just found this thread:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/12809 where also Emacs is
mentioned.
Maybe it´s related.

Am Mo., 25. Aug. 2025 um 09:28 Uhr schrieb Po Lu <[email-masked]>:

> Eli Zaretskii <[email-masked]> writes:
>
> > [Please use Reply All to reply, to keep the bug tracker on the CC list.]
> >
> >> Date: Sun, 24 Aug 2025 21:07:05 +0200
> >> From: Marco <[email-masked]>
> >>
> >> Hi,
> >>
> >> thanks for looking into it. I made some more tests today.
> >>
> >> Findings:
> >>
> >> The issue occurs only in a Wayland session.
> >>
> >> When running Emacs in a true X11 session, the problem does not appear
> at
> >> all. If I'm wrong I'll correct myself.
> >>
> >> Setting GDK_BACKEND=x11 while under Wayland does not eliminate the
> >> problem, which suggests it still goes through XWayland and the
> >> compositor path.
> >>
> >> The artifacts are visible in screenshots and occur sometimes across the
> >> whole display width, though their colors sometimes differ slightly,
> >> which suggests this is a rendering bug.
> >>
> >> Most of the time they look similar to what you see here:
> >> https://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00023.html
> >> or
> >>
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2018-01/png1wmnm51YOW.png
> >>
> >> It only seem to occur when the emacs window is maximized!
> >>
> >> With absolute line numbers, I cannot reproduce the problem — it only
> >> appears with relative line numbers.
> >>
> >> Conclusion:
> >> This looks like a rendering bug in the GTK/Wayland (or XWayland) stack,
> >> but Emacs may be triggering it in a specific way when drawing relative
> >> line numbers.
> >>
> >> This is maybe related: When opening emacs in nw mode and using relative
> >> line number I also see artifacts, i.e.  lines across the whole window
> >> width in a color slightly darker than the background. The height of the
> >> line is the same like the block cursor height.
> >>
> >> Again: This does not happen in a real x11 session.
> >
> > Thanks for the footwork.
> >
> > Po Lu, any ideas?  Are problems like this with Wayland known to exist?
>
> I'm not aware of any such problems, but I would still ask the OP whether
> he has enabled fractional scaling on his Wayland desktop, which is a
> recent innovation that has the potential to produce artifacts in
> rendered text (particularly if the compositor believes a frame to be
> completely opaque).
>