Bug 50084

Summary: [g33 sna suse] weird font rendering (missing lines in xterm)
Product: xorg Reporter: Jiri Slaby <jirislaby>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
example of such bad rendering
none
this is how it should look like
none
Xorg.log
none
shifted cursor none

Description Jiri Slaby 2012-05-18 03:54:45 UTC
Created attachment 61790 [details]
example of such bad rendering

It looks like in the picture. I will also attach how it should look like shortly.

This is with "intel(0): SNA compiled from 2.19.0-56-g2fff6bf"

That is 596c0a68709 plus a testing patch from bug 47597.
Comment 1 Jiri Slaby 2012-05-18 03:55:09 UTC
Created attachment 61791 [details]
this is how it should look like
Comment 2 Jiri Slaby 2012-05-18 03:55:32 UTC
Created attachment 61792 [details]
Xorg.log
Comment 3 Chris Wilson 2012-05-18 05:45:13 UTC
Any particular font configuration for xterm? Is there a particular sequence you need to trigger the corruption? Does it redraw correctly? It's working for me with default xterm under xfce4 (with and without compositing) on debian/sid.
Comment 4 Jiri Slaby 2012-05-18 12:23:18 UTC
(In reply to comment #3)
> Any particular font configuration for xterm?

None that I'm aware of. These should be standard fixed utf8 fonts.

> Is there a particular sequence you
> need to trigger the corruption? 

No, it cannot be reproduced reliably. It happens "sometimes", unexpectedly.

> Does it redraw correctly?

Yes, ctrl-l cures that.

> It's working for me
> with default xterm under xfce4 (with and without compositing) on debian/sid.

This is KDE 4.8 on opensuse with (xrender) effects enabled if that helps somehow.
Comment 5 Chris Wilson 2012-05-18 12:38:05 UTC
Thanks, that tells me the suspect is the sna_reversed_glyph_blt() function (or perhaps one of its callers) and that is one of the rare effects, such as using clipping or crossing a boundary...
Comment 6 Chris Wilson 2012-05-24 13:07:10 UTC
Any ideas for reproducing this here? Have you noticed a pattern for when the corruption occurs?
Comment 7 Jiri Slaby 2012-05-27 13:50:29 UTC
(In reply to comment #6)
> Any ideas for reproducing this here? Have you noticed a pattern for when the
> corruption occurs?

Not yet, it happens pretty randomly...
Comment 8 Jiri Slaby 2012-06-05 00:07:40 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Any ideas for reproducing this here? Have you noticed a pattern for when the
> > corruption occurs?
> 
> Not yet, it happens pretty randomly...

Hmm, it looks like it happens sometimes when I press ctrl-r in xterm for reverse searching, find something and press enter. Then the command is moved left few characters (to be right after PS1) while being corrupted.
Comment 9 Jiri Slaby 2012-06-05 04:48:01 UTC
Created attachment 62568 [details]
shifted cursor

Sometimes, after switching from desktop to desktop, it happens that the cursor is rendered one or more lines below actual line. Like in the image.
Comment 10 Chris Wilson 2012-06-05 04:55:35 UTC
I am truly puzzled. :(

Just to check, you are up to date with the latest fixes, in particular the flushing fix from a few days ago?
Comment 11 Jiri Slaby 2012-06-05 05:03:10 UTC
(In reply to comment #10)
> Just to check, you are up to date with the latest fixes, in particular the
> flushing fix from a few days ago?

Which one exactly? I'm at a65c3b7b45.
Comment 12 Chris Wilson 2012-06-05 05:06:51 UTC
I was thinking of

commit 08a630dc5ef87e551865e558fe4fc45ea66457b4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed May 30 08:50:44 2012 +0100

    sna: Ensure we flush scanout even when otherwise idle.

which you have.
Comment 13 Jiri Slaby 2012-06-11 11:04:28 UTC
Bisection might be an option here... Should I try?
Comment 14 Chris Wilson 2012-06-11 12:17:52 UTC
Honestly, no. My suspicion is that we are exercising an error condition in some corner case and the commit will only be indirectly related to the breakage, even so it may still be a good enough clue. I would only proceed iff you have an absolute 100% reliable trigger, in which case I would have expected to have seen this on my box as well by now :(
Comment 15 Jiri Slaby 2012-06-11 13:00:52 UTC
(In reply to comment #14)
> I would only proceed iff you have an absolute 100% reliable trigger

Nah, I don't have a trigger for this :/...
Comment 16 Chris Wilson 2012-06-13 02:32:37 UTC
I suspect this bug is

commit ab3b7fe31b5a9d7924e959f21d29c4f7352ec8cb
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 13 10:35:14 2012 +0100

    sna: Only reuse a write buffer if all external references have been dropped
    
    This avoids the unhappy situation of overwriting an upload buffer that
    we intend to use for a fallback.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Comment 17 Jiri Slaby 2012-06-13 11:40:36 UTC
(In reply to comment #16)
> I suspect this bug is
> 
> commit ab3b7fe31b5a9d7924e959f21d29c4f7352ec8cb
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Wed Jun 13 10:35:14 2012 +0100
> 
>     sna: Only reuse a write buffer if all external references have been dropped

I'm now at 2.19.0-261-g85a749e, but still the cursor is sometimes rendered on a wrong line like in comment #9. I haven't seen text with lines missing yet.
Comment 18 Jiri Slaby 2012-06-13 11:41:56 UTC
(In reply to comment #17)
> I'm now at 2.19.0-261-g85a749e

Which makes no sense to you, I guess. This is 0db789e18 plus my fix for two compiler warnings.
Comment 19 Jiri Slaby 2012-06-14 02:05:50 UTC
(In reply to comment #17)
> I haven't seen text with lines missing yet.

Happened now. With 221534abe2dc04fae8b8fc332104bca275d4863b.
Comment 20 Jiri Slaby 2012-06-14 02:09:12 UTC
BTW the cursor is rendered at the right place. But there is missing a PS1 text before that. It happens like this:

Before:
/tmp> echo ahoy
ahoy
/tmp> X

After:
/tmp> echo ahoy

      X

Where X is cursor. The rest of the text is cleared (replaced by old contents). Sometimes it happens that "echo ahoy" is rendered with lines missing.
Comment 21 Chris Wilson 2012-06-14 02:27:46 UTC
(In reply to comment #20)
> BTW the cursor is rendered at the right place. But there is missing a PS1 text
> before that. It happens like this:
> 
> Before:
> /tmp> echo ahoy
> ahoy
> /tmp> X
> 
> After:
> /tmp> echo ahoy
> 
>       X
> 
> Where X is cursor. The rest of the text is cleared (replaced by old contents).
> Sometimes it happens that "echo ahoy" is rendered with lines missing.

Ok, that's kind of what I expected, except I couldn't rule the possibility of there being a composited offset bug due to switching desktops. Improbable just not impossible. The question just becomes where did that test go, and who dropped it?
Comment 22 Chris Wilson 2012-06-15 04:17:30 UTC
More damage fixes, can you confirm that this bug still exists. (I'd be shocked if those fixed it though.)
Comment 23 Chris Wilson 2012-06-16 07:11:34 UTC
Do you have to leave the terminal invisible on the other desktop for a few minutes before switching back to trigger the missing lines?
Comment 24 Jiri Slaby 2012-06-29 00:39:28 UTC
(In reply to comment #23)
> Do you have to leave the terminal invisible on the other desktop for a few
> minutes before switching back to trigger the missing lines?

I can't tell for sure. It doesn't look like that. Closing a terminal on another desktop at the same place does not necessarily mean this artefact will emerge.
Comment 25 Chris Wilson 2012-07-14 09:34:16 UTC
When cleaning up the fb fallout, I did spot one place where I was using the GC for a cpu operation without first moving the GC itself to the CPU (that has a few side effects such as computing the reduce raster operation and/xor). Out of optimism, did that fix the occasional corruption in xterm?
Comment 26 Jiri Slaby 2012-07-16 08:08:27 UTC
(In reply to comment #25)
> Out of
> optimism, did that fix the occasional corruption in xterm?

You're too optimistic :). It still happens with ea9ec18505645dfec8.
Comment 27 Chris Wilson 2012-07-16 08:20:34 UTC
:(

Ok, I'll dream of finding a test case and meanwhile ponder a way of capturing the right debug info.
Comment 28 Jiri Slaby 2012-08-11 14:14:20 UTC
I would say it is fixed with 1a0590d. I didn't appear for some time.
Comment 29 Chris Wilson 2012-08-11 14:30:58 UTC
I had been entertaining theories about some broken behaviour on gen3...

Glad to hear it has disappeared, for the time being at least! :)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.