Bug 33977

Summary: X core font rendering is "laggy"
Product: xorg Reporter: James Laird <abrasive>
Component: Driver/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: abrasive, gooseyard, hramrach, jamie, vincent-fdt
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description James Laird 2011-02-06 19:31:13 UTC
I'm having trouble with terminals under X after updating xf86-video-nouveau and libdrm.
When entering characters (in urxvt), the cursor in the previous cell is only cleared after some delay, and lines printed in the terminal are often not displayed until I generate more output or update some other part of the screen.  There are also remnants of text visible in the fractional row under the last terminal row. This seems to be an issue only with X core fonts, and not with Xft ones.

I have an NV50 card, and the issue appeared after updating xf86-video-nouveau from a git snapshot on 2010-08-19 to one from 2010-12-17. The issue is still present on 2011-02-06. The upgrade necessitated upgrading libdrm from 2.4.21 to 2.4.23.
Comment 1 James Laird 2011-02-06 19:57:03 UTC
git bisect reveals the culprit:
9a5142fae6e1a0a470352f511427916e6fa01b9c is the first bad commit
commit 9a5142fae6e1a0a470352f511427916e6fa01b9c
Author: Maarten Maathuis <madman2003@gmail.com>
Date:   Fri Aug 27 21:11:59 2010 +0200

    nv50/exa: Stop using wfb by default, but add an option to enable it.
    
    - Some scenarios, such as those heavy in core font rendering might prefer wfb.
    - Other (modern) situations are better of with wfb disabled.
    
    Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Comment 2 James Laird 2011-02-06 20:10:14 UTC
(In reply to comment #1)
> commit 9a5142fae6e1a0a470352f511427916e6fa01b9c
>     nv50/exa: Stop using wfb by default, but add an option to enable it.

And setting WrappedFB to True in the xorg.conf makes it work again.
Comment 3 Maarten Maathuis 2011-02-07 01:15:43 UTC
This is an xserver issue which i recently fixed.

http://cgit.freedesktop.org/xorg/xserver/commit/?id=541b25038a5de74411a094570b407c5ae018c2ba

I have asked for it to be also put in the next 1.9 release, will have to wait how this goes.
Comment 4 Michel Dänzer 2011-02-07 08:05:24 UTC
(In reply to comment #3)
> This is an xserver issue which i recently fixed.
> 
> http://cgit.freedesktop.org/xorg/xserver/commit/?id=541b25038a5de74411a094570b407c5ae018c2ba

During the review of that patch, I got the impression the problem you were trying to solve was output being delayed somewhat, but appearing on its own eventually. However, this bug report talks about some output not appearing until further user action. That sounds like maybe the driver flushes the command stream to the hardware in the block handler before EXA gets a chance to upload deferred software rendering?
Comment 5 Maarten Maathuis 2011-02-07 09:23:29 UTC
In all my testing the output does appear regardless of further actions. It was just a delay issue for me. But indeed, it's possible this is a flush issue (i thought i checked that, but now I'm not sure). I'll have a look at it, including the xserver side of it.
Comment 6 Maarten Maathuis 2011-02-07 10:09:27 UTC
The "gaps in text" problem at high throughput isn't fixed by adding a flush in the driver, for that the original solution is still needed. Even flushing every 10 ms isn't enough to get the same result. The latency issues at low throughput (typing for example) is pretty much solved with an extra driver flush after small uploads to the screen pixmap.
Comment 7 Michel Dänzer 2011-02-09 01:32:04 UTC
(In reply to comment #6)
> The "gaps in text" problem at high throughput isn't fixed by adding a flush in
> the driver, for that the original solution is still needed. Even flushing every
> 10 ms isn't enough to get the same result.

I'm still not 100% convinced this problem is severe enough to justify the throughput penalty of the patch though... Since the radeon driver recently switched to always using DownloadFrom/UploadToScreen to access tiled GPU pixmaps, I've been looking for it but haven't really noticed it yet (my xserver checkout doesn't have your patch yet).


> The latency issues at low throughput (typing for example) is pretty much solved
> with an extra driver flush after small uploads to the screen pixmap.

Not sure why you'd need any 'extra flushes' besides the flush in your BlockHandler, which has always been necessary. Just make sure this flush happens after ExaBlockHandler (i.e. after calling down the wrapper chain).
Comment 8 Maarten Maathuis 2011-02-09 03:11:32 UTC
I'm openminded to a revert, considering it's only an esthetical issue. I just don't know what will happen on high cpu loads (outside xorg). Will the BlockHandler still be called every 50ms?
Comment 9 Michel Dänzer 2011-02-09 03:24:27 UTC
(In reply to comment #8)
> I just don't know what will happen on high cpu loads (outside xorg). Will the
> BlockHandler still be called every 50ms?

The BlockHandler is only called before the X server blocks waiting for input or client requests. This may never happen if clients send rendering requests more quickly than the server can process them (e.g. x11perf), but in that case you'll probably flush to the hardware regularly anyway due to running out of command stream space. If that's not the case, the driver needs another mechanism to ensure flushes occur at appropriate intervals.
Comment 10 Maarten Maathuis 2011-02-09 03:30:37 UTC
I was more worried about the xserver-exa side latency. It would be nice to have some kind of maximum latency. The driver can't do anything if the pixmap isn't anywhere in the driver.
Comment 11 Michel Dänzer 2011-02-09 03:54:42 UTC
(In reply to comment #10)
> I was more worried about the xserver-exa side latency. It would be nice to have
> some kind of maximum latency. The driver can't do anything if the pixmap isn't
> anywhere in the driver.

Hmm, that's a good point. So if you've double-checked that the driver is flushing properly in the BlockHandler, and there's still no timeout interval in exaDamageReport_mixed which provides a better tradeoff between latency and throughput, let's leave it at that for now.


However, then the question remains what is the cause of the '[...] not displayed until I generate more output or update some other part of the screen' in this report. That doesn't sound like something your EXA change would help with.
Comment 12 Marcin Slusarz 2011-02-09 12:22:00 UTC
Maarten: your latest ddx patch (exa: Flush (S)IFC to the frontbuffer immediately) fixed this bug for me. I had very similar effects in xterm as the reporter.
Comment 13 Maarten Maathuis 2011-02-09 12:28:36 UTC
Just to be clear, nouveau uses a "FlushCallback" instead a call in the BlockHandler. This should apparently cover more cases than the BlockHandler, but I don't know the specifics.
Comment 14 Maarten Maathuis 2011-02-09 12:29:17 UTC
That should be "instead of a call".
Comment 15 Michel Dänzer 2011-02-09 22:37:50 UTC
(In reply to comment #13)
> Just to be clear, nouveau uses a "FlushCallback" instead a call in the
> BlockHandler. This should apparently cover more cases than the BlockHandler,
> but I don't know the specifics.

Neither place alone is sufficient. Flushing in the FlushCallback is necessary for DRI2 texture-from-pixmap and flushing in the BlockHandler is necessary to avoid GPU commands being delayed indefinitely when the server goes idle.
Comment 16 Ilia Mirkin 2013-08-19 16:40:50 UTC
It appears that this bug report has laid dormant for quite a while. Sorry we haven't gotten to it. Since we fix bugs all the time, chances are pretty good that your issue has been fixed with the latest software. Please give it a shot. (Linux kernel 3.10.7, xf86-video-nouveau 1.0.9, mesa 9.1.6, or their git versions.) If upgrading to the latest isn't an option for you, your distro's bugzilla is probably the right destination for your bug report.

In an effort to clean up our bug list, we're pre-emptively closing all bugs that haven't seen updates since 2011. If the original issue remains, please make sure to provide fresh info, see http://nouveau.freedesktop.org/wiki/Bugs/ for what we need to see, and re-open this one.

Thanks,

The Nouveau Team
Comment 17 Vincent Lefevre 2013-08-19 17:14:18 UTC
It would be better to close this bug as FIXED, since it was really fixed, apparent around 2011-02-24 and two months later in Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614938
Comment 18 Ilia Mirkin 2013-08-19 17:44:56 UTC
It was probably apparent, but it was a bulk message, I didn't really look at each item too carefully but rather used the date of comments as the closing criteria. Updating the status to FIXED instead of INVALID.

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.