Bug 79843 - i855gm: Display corruption in presence of graphics memory pressure
Summary: i855gm: Display corruption in presence of graphics memory pressure
Status: CLOSED WORKSFORME
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: XOrg git
Hardware: x86 (IA32) Linux (All)
: lowest normal
Assignee: Intel GFX Bugs mailing list
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-09 16:31 UTC by Bruno
Modified: 2017-07-24 22:53 UTC (History)
1 user (show)

See Also:
i915 platform: I85X
i915 features: GEM/Other


Attachments
Remaining corruption (23.76 KB, image/png)
2014-06-11 19:32 UTC, Bruno
no flags Details

Description Bruno 2014-06-09 16:31:41 UTC
As determined with the help if Chris, on my i855GM system graphics corruption seems to be triggered by i915 moving objects to/from GPU memory/aperture.

The corruption is visible either as:
- ghost-screenshot of some previously displayed surface, usually reflowed to different width
- on some GTK applications, on scroll down by 1 line all the rest of the surface gets repainted with repetitions of new line (common on hexchat/xchat, but also mail view pane of claws-mail or pidgin message window). Scroll-up is not affected.


History of theses corruptions: exist since a long time, show up mostly when compositing (in Enlightenment, maybe due to fallback to software rendering as E wants shaders for OpenGL acceleration)

Latest software stack used for testing:
- Kernel "drm-intel-nightly: 2014y-06m-02d-19h-49m-25s" on top of 3.15-rc8
- x11-libs/libdrm-2.4.52
- xf86-video-intel GIT from 31 may 2014

See also mail exchange with Chris:
  Message-ID: <20140427223402.572010a9@neptune.home>
which ended with:
  "Hmm. They do suggest that your system is under memory pressure - it has
to move objects in and out the GPU address space regularly - but they
don't suggest that you are out of memory."
Comment 1 Chris Wilson 2014-06-09 17:51:32 UTC
It would also be worthwhile testing with --enable-debug=pixmap
Comment 2 Chris Wilson 2014-06-10 22:42:49 UTC
I think I can reproduce the scrolling corruption using ivb + kwin (xrendr compositing + native) + blt. Will pursue.
Comment 3 Chris Wilson 2014-06-11 07:09:40 UTC
Found one issue on the hunt for the scrolling corruption. Not sure if this is as relevant for 855gm, but it is worth testing:

commit 53c1faa5093f8a0c969e3ebe9f27ee1ce5137e14
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 11 07:59:41 2014 +0100

    sna: Mark the GPU as all damaged when discarding CPU bo during uploads
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Comment 4 Chris Wilson 2014-06-11 15:01:52 UTC
Here's something else to test wrt scrolling:

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ac3867e..fc3f889 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5448,6 +5448,7 @@ sna_self_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
                goto fallback;
        }
 
+       sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_WRITE | MOVE_ASYNC_HINT);
        if (priv->gpu_damage || (priv->cpu_damage == NULL && priv->gpu_bo)) {
                assert(priv->gpu_bo);
Comment 5 Chris Wilson 2014-06-11 15:08:25 UTC
And then please test

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ac3867e..c9af183 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5487,7 +5487,7 @@ fallback:
                if (!sna_pixmap_move_to_cpu(pixmap, MOVE_READ | MOVE_WRITE))
                        goto free_boxes;
 
-               if (alu == GXcopy && pixmap->drawable.bitsPerPixel >= 8) {
+               if (alu == GXcopy && pixmap->drawable.bitsPerPixel >= 8 && 0) {
                        assert(pixmap->devKind);
                        if (sigtrap_get() == 0) {
                                FbBits *dst_bits, *src_bits;
Comment 6 Bruno 2014-06-11 16:46:57 UTC
Tested with -intel at commit f19195f7ea317f5601543724c725c4b63fdc3f60, both corruptions happen with no complaint by --enable-debug=pixmap.

Will now update to latest -intel to include commit from comment #3

Are changes from comment #4 and comment #5 to test individually on top of the one from comment #3 or cumulative (3, 3+4, 3+4+5 or 3, 3+4, 3+5 or even 3, 4, 5)?
Comment 7 Chris Wilson 2014-06-11 16:50:22 UTC
#4 and #5 should be applied on top of the current tree. They are mutually exclusive: #4 tests whether the bug is on the CPU or GPU side of things, and #5 tests the custom memmove branch vs fbBlt.
Comment 8 Chris Wilson 2014-06-11 17:59:38 UTC
I think I nailed it,

commit e3a0e40310b6c46b2f887bc0d75b11cc06ec8fa0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 11 18:07:46 2014 +0100

    sna: Fix direction flags for memmove
    
    Under a compositor, the current deltas may invert the sense of the copy
    direction, causing scrolling corruption. Simplify handling those flags
    by making them invariant for the function.
    
    Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79843
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

That should fix the scrolling. The jury is still out as for the cause of the other type of corruption.
Comment 9 Bruno 2014-06-11 19:32:58 UTC
Created attachment 100899 [details]
Remaining corruption

(In reply to comment #8)
> That should fix the scrolling. The jury is still out as for the cause of the
> other type of corruption.

It looks like this effectively fixes the hexchat/message pane scrolling issue where whole area is filled with last line.

A similar corruption remains (happens more sporadically or less easy to reproduce, even in a row when it happens).
On screenshot:
- left is expected rendering
- middle is corruption when scrolling down to bottom with touchpad scroll area
- right is corruption when scrolling exactly one line down to bottom with scrollbar arrow
(black boxes is my work to hide part of mailbox name for privacy reasons)
Each time it happens it's that same spurious Trash folder showing up (no idea where it comes from and why it's so much indented to the right and with simple folder icon instead of trash icon).



Other corruption case still happens as you expected.
Comment 10 Chris Wilson 2015-04-03 09:33:44 UTC
Maybe I accidentally fixed this? :)
Comment 11 Humberto Israel Perez Rodriguez 2015-08-11 15:59:25 UTC
Hi Bruno, could you please provide information to last comment
Thanks
Comment 12 Ileana 2016-04-19 11:02:24 UTC
No updates for a long time. Is this still an issue?
Comment 13 Bruno 2016-04-19 20:35:00 UTC
(In reply to Ileana from comment #12)
> No updates for a long time. Is this still an issue?

Sorry for not replying earlier.

For now I'm not seeing corruption of any kind (running linux 4.4.0,xf86-video-intel 2.99.917, libdrm 2.4.65) nor did I see corruptions in recent times. Though it's hard to tell if the issue is gone or if it has become much harder to trigger.

So closing as `works for me`.


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.