Bug 33738 - PageFlip urxvt/xterm screen corruptions
Summary: PageFlip urxvt/xterm screen corruptions
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-30 19:27 UTC by Chistopher Krakowiak
Modified: 2011-10-06 02:54 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Screenshot of xterm corruption after running quake3 (166.51 KB, image/png)
2011-01-30 19:27 UTC, Chistopher Krakowiak
no flags Details
handle tiling using dfs/uts like r6xx+ (3.97 KB, patch)
2011-01-31 08:42 UTC, Alex Deucher
no flags Details | Splinter Review
new patch (9.74 KB, patch)
2011-02-01 09:02 UTC, Alex Deucher
no flags Details | Splinter Review
new patch against master (5.61 KB, patch)
2011-02-01 16:28 UTC, Alex Deucher
no flags Details | Splinter Review

Description Chistopher Krakowiak 2011-01-30 19:27:12 UTC
Created attachment 42732 [details]
Screenshot of  xterm corruption after running quake3

I get urxvt/xterm after several runnings of fullscreen GL apps when PageFlip is enabled. I am testing it usually using quake3, but it was very annoying when appeared after some xscreensavers and I had to run xfce Terminal or restart Xorg(killing many apps/webbrowser).
This bug probably appeared after adding real PageFlip to xf86-video-ati. Using system xorg-driver-video-ati-6.13.2-3.x86_64 resolves the problem(but probably its not real PageFlip, but buffer-copying). Disabling ColorTiling reduces bug appearance(probably), but the only solution with xf86-video-ati from master, is to explicitly disable PageFlip, or use UMS. Using system/gallium/mesa libGL doesnt change anything, only ddx/PageFlip matters.

ArtiFacts appears mostly in and around xterm/urxvt(text is totally smashed/unreadable), but other apps like gnome/xfce Terminals, WebKit/Gecko and others webbrowsers are very little affected and still fully usable.

I am using PLD Th (2.99/3.0) with 64bit kernel/userspace(multilib) on 15" IBM ThinkPad T60p UXGA(1600x1200) FlexView with FireGL 5200(r500/Radeon X1600), core2duo T7200 and 4GB RAM, nearly identical to airlied one(except he's not 64bit capable), and I didnt tested 32bit. But maybe somebody else got 64bit system and r500.
Comment 1 Michel Dänzer 2011-01-31 04:59:31 UTC
This is because radeon_bo_set_tiling is never called with RADEON_TILING_SURFACE for the DRI2 back buffers used for page flipping. When an app using page flipping quits, there's a 50/50 chance of ending up with the good or bad BO backing up the screen pixmap.

Haven't had time to work out a proper solution yet.
Comment 2 Alex Deucher 2011-01-31 08:42:45 UTC
Created attachment 42753 [details] [review]
handle tiling using dfs/uts like r6xx+

Does this patch fix the issues?
Comment 3 Marc Dietrich 2011-01-31 10:10:54 UTC
I see similar corruption but with rs780. The patch does not fix the issue here, but makes it worse. Instead of the screen corruptions, I see heavy flicker now and later a hard lock.
Comment 4 Chistopher Krakowiak 2011-01-31 11:23:30 UTC
@Alex Deucher: Really thanks. Your patch (nearly)definitely fixed xterm/urxvt corruptions on mine r500. I am still getting few red stripes above wm decorations(fluxbox with grey/red theme) on root window in empty and with webbrowser workspaces(that disappear and reappear after switc. There are still sometimes artifacts in urxvt after scrolling some text, but they disappear after switching workspace.
So not fully, but problem is mostly fixed ;)
Comment 5 Alex Deucher 2011-01-31 22:34:01 UTC
(In reply to comment #4)
> @Alex Deucher: Really thanks. Your patch (nearly)definitely fixed xterm/urxvt
> corruptions on mine r500. I am still getting few red stripes above wm
> decorations(fluxbox with grey/red theme) on root window in empty and with
> webbrowser workspaces(that disappear and reappear after switc. There are still
> sometimes artifacts in urxvt after scrolling some text, but they disappear
> after switching workspace.
> So not fully, but problem is mostly fixed ;)

Can you get a picture of the corruption with the patch applied?
Comment 6 Chistopher Krakowiak 2011-02-01 00:17:24 UTC
> Can you get a picture of the corruption with the patch applied?
Its rather big 12MB MNG assebled from 35MB of PNG's(dumped using scrot in while true; sleep 0.2 ;)
But you can always convert it to PNG's using advmng(which I used to assemble it)

http://carme.pld-linux.org/~evil/radeon/pageflip_corruptions.mng

AS you can see especially Opera is affected(unlike WebKit/Gecko/Dillo) and image viewers (XV,gThumb,EOG), so I was forced to disable PageFlip to be able to watch pr0n (Xv is not affected, but I got much more images ;)
Comment 7 Michel Dänzer 2011-02-01 04:58:25 UTC
Review of attachment 42753 [details] [review]:

::: src/radeon_exa_funcs.c
@@ +601,3 @@
     copy_src = driver_priv->bo;
     copy_pitch = pSrc->devKind;
+    if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) {

This block needs to be extended to include the following if statements operating on src_domain.

RADEONUploadToScreenCS() probably needs similar treatment as well.
Comment 8 Alex Deucher 2011-02-01 09:02:05 UTC
Created attachment 42813 [details] [review]
new patch

This patch should fix up the issues on both pre-6xx and r6xx+.
Comment 9 Marc Dietrich 2011-02-01 12:26:49 UTC
looks perfect! thanks!
Comment 10 Alex Deucher 2011-02-01 16:28:08 UTC
Created attachment 42844 [details] [review]
new patch against master

I've gone ahead and committed the r6xx+ portion of the patch.  Attached is the fix for pre-r6xx asics against ati git master.  If it fixes your issue, I'll go ahead and commit it.
Comment 11 Michel Dänzer 2011-02-02 06:53:54 UTC
(In reply to comment #10)
> Attached is the fix for pre-r6xx asics against ati git master.  If it fixes
> your issue, I'll go ahead and commit it.

The patch basically looks good to me, but for some reason it doesn't work on my PowerBook. Weirdly, it looks like the 'first few' operations work correctly, but then it quickly falls apart. Haven't figured out what's going on yet.
Comment 12 Chistopher Krakowiak 2011-02-02 12:06:02 UTC
(In reply to comment #10)
> Created an attachment (id=42844) [details]
> new patch against master
> 
> I've gone ahead and committed the r6xx+ portion of the patch.  Attached is the
> fix for pre-r6xx asics against ati git master.  If it fixes your issue, I'll go
> ahead and commit it.

I am out of battery, but I started ~10 times quake3, playing between them urxvt/iceweasel/opera w/o seeing any artifacts, so its probably fixed for r500 :)
So you can apply it upstream. I will report there if I will see any artifacts, if problem will reappear after longer using machine,, but I hope it wont.

So thx all for fixing it :D
Comment 13 Alex Deucher 2011-02-02 23:42:47 UTC
(In reply to comment #11)
> The patch basically looks good to me, but for some reason it doesn't work on my
> PowerBook. Weirdly, it looks like the 'first few' operations work correctly,
> but then it quickly falls apart. Haven't figured out what's going on yet.

Does it look like endian problems?
Comment 14 Michel Dänzer 2011-02-03 09:46:52 UTC
(In reply to comment #13)
> Does it look like endian problems?

No, actually it seems to be an xserver EXA bug when updating the screen pixmap pitch. Go ahead and push the fix.
Comment 15 Alex Deucher 2011-02-03 10:59:38 UTC
Pushed:
bb16dd77321e5a64a3cb2d2ca9982117799ac1a8
ef9bfb262db7004bef3704e5d914687e50d3fca4
Comment 16 Tormod Volden 2011-02-04 17:40:19 UTC
ef9bfb262db7004bef3704e5d914687e50d3fca4 broke on RV410. I get corruption (also outside window) with xterm and eog unless I revert that commit. Looks similar to bug 33918.
Comment 17 Chistopher Krakowiak 2011-02-04 17:49:49 UTC
(In reply to comment #16)
> ef9bfb262db7004bef3704e5d914687e50d3fca4 broke on RV410. I get corruption (also
> outside window) with xterm and eog unless I revert that commit. Looks similar
> to bug 33918.

I think that Alex shouldnt revert that patch yet, but wait for other reports with gfx chips they use and results.
And reverting only that one will bring back(Leroy Brown;) identical problem to r500(and some other chip's user).
Comment 18 Alex Deucher 2011-02-04 18:12:37 UTC
(In reply to comment #16)
> ef9bfb262db7004bef3704e5d914687e50d3fca4 broke on RV410. I get corruption (also
> outside window) with xterm and eog unless I revert that commit. Looks similar
> to bug 33918.

You might be hitting the EXA bug mentioned in comment 14.
Comment 19 Thomas Wouters 2011-02-11 11:09:21 UTC
(In reply to comment #16)
> ef9bfb262db7004bef3704e5d914687e50d3fca4 broke on RV410. I get corruption (also
> outside window) with xterm and eog unless I revert that commit. Looks similar
> to bug 33918.

I think I've got the same issue with ATI Mobility Radeon X1400. git bisect told me that this commit is the first bad one.
If I disable ColorTiling, everything looks fine.

(In reply to comment #14)
> (In reply to comment #13)
> > Does it look like endian problems?
> 
> No, actually it seems to be an xserver EXA bug when updating the screen pixmap
> pitch. Go ahead and push the fix.

Is this a guess, or do you know which bug?
Comment 20 Alex Deucher 2011-02-11 11:14:06 UTC
(In reply to comment #19)
> 
> I think I've got the same issue with ATI Mobility Radeon X1400. git bisect told
> me that this commit is the first bad one.
> If I disable ColorTiling, everything looks fine.
> 
> Is this a guess, or do you know which bug?

Please try the patch on bug 33929.
Comment 21 Thomas Wouters 2011-02-12 05:43:42 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > 
> > I think I've got the same issue with ATI Mobility Radeon X1400. git bisect told
> > me that this commit is the first bad one.
> > If I disable ColorTiling, everything looks fine.
> > 
> > Is this a guess, or do you know which bug?
> 
> Please try the patch on bug 33929.

That works. Thanks.
Comment 22 Stefan Dirsch 2011-09-19 10:29:43 UTC
Just bisected the fatal error issue

  "Driver failed PrepareAccess on a pinned pixmap" 

when startig xterm or switching to Linux console (xorg-server 1.6.5 with xf86-video-ati 6.14.2). The bad commit is


commit ef9bfb262db7004bef3704e5d914687e50d3fca4
Author: Alex Deucher <alexdeucher@gmail.com>
Date:   Tue Feb 1 19:24:44 2011 -0500

    kms/pre-6xx: fix pageflipping with tiling
    
    Use UTS/DFS to tile/untile as appropriate for sw access on
    pre-6xx.
    
    Fixes:
    https://bugs.freedesktop.org/show_bug.cgi?id=33738
    
    Signed-off-by: Alex Deucher <alexdeucher@gmail.com>

Setting 

  Option "ColorTiling" "off"

is usable as workaround, whereas setting

  Option "EnablePageFlip" "off"

does not help. This is with a Radeon XPRESS 200M 5975 aka RS482 (1002:5975),
so I believe still something R3xx based (KMS with kernel 3.0).
Comment 23 Michel Dänzer 2011-09-20 04:08:18 UTC
(In reply to comment #22)
>   Option "ColorTiling" "off"
> 
> is usable as workaround, [...]

KMS ColorTiling cannot work with an X server that doesn't support EXA_MIXED_PIXMAPS. I pushed http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=fcf0cca9c0ab0f692b222f619aee8f1cdad3b519 to address this.
Comment 24 Stefan Dirsch 2011-10-06 02:54:48 UTC
Thanks, Michel. Your git commit fixes the issue.


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.