Bug 39261 - Openarena does not work with Sandy Bridge New Acceleration on GMA45
Summary: Openarena does not work with Sandy Bridge New Acceleration on GMA45
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-15 07:14 UTC by darkbasic
Modified: 2012-03-26 05:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Xorg.log (29.28 KB, text/plain)
2011-07-15 07:14 UTC, darkbasic
no flags Details
xorg.log with full debug (1.62 MB, text/plain)
2011-07-16 11:57 UTC, darkbasic
no flags Details

Description darkbasic 2011-07-15 07:14:22 UTC
Created attachment 49151 [details]
Xorg.log

Gentoo amd64 with mesa git master, xf86-video-intel git master, libdrm git master, linux-3.0.0-rc7. I tried with xorg-server-1.10.3 with and without patches, it didn't work. I even tried xorg-server git master + the "Remove the cacheing of the last scratch PixmapRec" patchset:
http://lists.x.org/archives/xorg-devel/2011-June/023006.html
http://lists.x.org/archives/xorg-devel/2011-June/023008.html
http://lists.x.org/archives/xorg-devel/2011-June/023005.html
http://lists.x.org/archives/xorg-devel/2011-June/023007.html

It still doesn't work, the screen goes black as soon as I start openarena.

I attached Xorg.log
Comment 1 Chris Wilson 2011-07-16 04:37:19 UTC
I have just *one* machine that replicates this issue, bizarrely. I'm hoping that might give me some more inspiration.

So far, it looks to be related to the VidMode change, changing resolution using xrandr, then starting the game and running at that resolution is fine. AFAICT, it is issuing the batches containing the copies for the swapbuffers and the scanout does appear to match the frontbuffer (and the output is lit)... But those copies appear to have no affect... The implication would seem to be that we disagree with mesa over the name of the backbuffer (hence copying from a clear buffer when asked to swap).
Comment 2 darkbasic 2011-07-16 05:01:42 UTC
I had this bug even with Sandy Bridge (Core i5 2500K), but I didn't apply any xorg patch.
Comment 4 darkbasic 2011-07-16 06:45:13 UTC
What the fuck, it fixed the problem and... it's so damn fast! From 57fps to 90+fps in openarena, I can't believe it!
You did a so damn good job, congrats!
Comment 5 darkbasic 2011-07-16 08:33:05 UTC
I didn't notice it during the benchmark, but there are lots of artifacts, something like a *HEAVY* flickering. There is no problem when running it windowed.
Comment 6 Chris Wilson 2011-07-16 09:50:57 UTC
Let's recap the current status: your X server now has all the dri2 patches? You see the flicker during normal gameplay (vblank_mode=1) or during the benchmark (vblank_mode=0)? Any warnings in dmesg, Xorg.log?

Flicker is usually caused by when we get the front/back buffers muddled up. But equally it could be a bug lurking elsewhere in the pageflipping code.
Comment 7 Chris Wilson 2011-07-16 09:53:49 UTC
Might be worth compiling with --enable-debug[=full] to see if that catches any errors. With --enable-debug=full, it will be quite slow as it generates a voluminous log file which may be helpful if you can reproduce the flicker with it enabled.
Comment 8 darkbasic 2011-07-16 10:08:42 UTC
> your X server now has all the dri2 patches?
Yes, it has 8 patches now (the 4 I linked + the 4 you linked).


>You see the flicker during normal gameplay (vblank_mode=1) or during
> the benchmark (vblank_mode=0)?
I always keep SwapBufferWaits disabled and vblank_mode=0, during the benchmark it was simply too fast to notice it. Everything works flawlessly if it's not fullscreen.


> Any warnings in Xorg.log?

Yes, but I wouldn't have notice them if it wasn't for grep:

laptop ~ # cat /var/log/Xorg.0.log | grep "(EE)"
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    68.898] (EE) Query no Synaptics: 6003C8
[    68.898] (EE) SynPS/2 Synaptics TouchPad Unable to query/initialize Synaptics hardware.
[    68.910] (EE) PreInit returned 11 for "SynPS/2 Synaptics TouchPad"
laptop ~ # cat /var/log/Xorg.0.log | grep "(WW)"
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    67.419] (WW) intel(0): Option "SwapBuffersWait" is not used
[   200.178] (WW) intel(0): sna_dri_get_msc:1483 get vblank counter failed: Invalid argument
[   341.049] (WW) intel(0): sna_dri_get_msc:1483 get vblank counter failed: Invalid argument
[   341.070] (WW) intel(0): sna_dri_get_msc:1483 get vblank counter failed: Invalid argument
[   344.717] (WW) intel(0): sna_dri_get_msc:1483 get vblank counter failed: Invalid argument
[   344.722] (WW) intel(0): sna_dri_get_msc:1483 get vblank counter failed: Invalid argument




>Any warnings in dmesg?

Just something backlight related, since 2.6.39 intel has native backlight support, but it just sucks too hard to use it and so I patch the kernel with samsung-backlight and it complains about duplicate driver or something similar:

[   18.364160] ACPI: AC Adapter [ADP1] (on-line)
[   18.590489] samsung_backlight: found laptop model 'X360'
[   18.590512] ------------[ cut here ]------------
[   18.590520] WARNING: at drivers/video/backlight/backlight.c:314 backlight_device_register+0xfb/0x16e()
[   18.590523] Hardware name: X360                       
[   18.590526] samsung: invalid backlight type
[   18.590528] Modules linked in: samsung_backlight(+) soundcore snd_page_alloc ac power_supply tpm_tis tpm psmouse sky2 pcspkr serio_raw tpm_bios processor thermal fan evdev container
[   18.590547] Pid: 392, comm: modprobe Not tainted 3.0.0-rc7 #1
[   18.590550] Call Trace:
[   18.590557]  [<ffffffff81042a4d>] ? warn_slowpath_common+0x78/0x8c
[   18.590562]  [<ffffffff81042b00>] ? warn_slowpath_fmt+0x45/0x4a
[   18.590569]  [<ffffffff812b79c9>] ? device_private_init+0x3a/0x40
[   18.590573]  [<ffffffff81206c3d>] ? backlight_device_register+0xfb/0x16e
[   18.590580]  [<ffffffffa007b01a>] ? dmi_check_cb+0x1a/0x1a [samsung_backlight]
[   18.590586]  [<ffffffffa007b0e8>] ? samsung_init+0xce/0xfe6 [samsung_backlight]
[   18.590592]  [<ffffffffa007b01a>] ? dmi_check_cb+0x1a/0x1a [samsung_backlight]
[   18.590598]  [<ffffffff81002078>] ? do_one_initcall+0x78/0x131
[   18.590604]  [<ffffffff8106ee20>] ? sys_init_module+0xb7/0x207
[   18.590610]  [<ffffffff81403792>] ? system_call_fastpath+0x16/0x1b
[   18.590613] ---[ end trace d27716271cc15a8d ]---
[   18.619196] ACPI: Battery Slot [BAT1] (battery present)
[   18.736303] iTCO_vendor_support: vendor-support=0
[   18.738982] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.06
[   18.739332] iTCO_wdt: Found a ICH9M-E TCO device (Version=2, TCOBASE=0x0460)
[   18.739421] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
[   18.767676] samsung_laptop: found laptop model 'X360'
[   18.768660] ------------[ cut here ]------------
[   18.768671] WARNING: at fs/sysfs/dir.c:455 sysfs_add_one+0x8c/0x9e()
[   18.768674] Hardware name: X360                       
[   18.768677] sysfs: cannot create duplicate filename '/class/backlight/samsung'
[   18.768680] Modules linked in: samsung_laptop(+) iTCO_wdt iTCO_vendor_support rfkill snd battery samsung_backlight soundcore snd_page_alloc ac power_supply tpm_tis tpm psmouse sky2 pcspkr serio_raw tpm_bios processor thermal fan evdev container
[   18.768708] Pid: 392, comm: modprobe Tainted: G        W   3.0.0-rc7 #1
[   18.768711] Call Trace:
[   18.768718]  [<ffffffff81042a4d>] ? warn_slowpath_common+0x78/0x8c
[   18.768723]  [<ffffffff81042b00>] ? warn_slowpath_fmt+0x45/0x4a
[   18.768729]  [<ffffffff811395e8>] ? sysfs_add_one+0x8c/0x9e
[   18.768733]  [<ffffffff8113a2f1>] ? sysfs_do_create_link+0x100/0x1a7
[   18.768740]  [<ffffffff812b800d>] ? device_add+0x216/0x5d0
[   18.768746]  [<ffffffff810372ac>] ? complete_all+0x32/0x41
[   18.768752]  [<ffffffff81206c4e>] ? backlight_device_register+0x10c/0x16e
[   18.768759]  [<ffffffffa00a401d>] ? dmi_check_cb+0x1d/0x1d [samsung_laptop]
[   18.768765]  [<ffffffffa00a4532>] ? samsung_init+0x515/0xfe3 [samsung_laptop]
[   18.768771]  [<ffffffffa00a401d>] ? dmi_check_cb+0x1d/0x1d [samsung_laptop]
[   18.768776]  [<ffffffff81002078>] ? do_one_initcall+0x78/0x131
[   18.768782]  [<ffffffff8106ee20>] ? sys_init_module+0xb7/0x207
[   18.768788]  [<ffffffff81403792>] ? system_call_fastpath+0x16/0x1b
[   18.768792] ---[ end trace d27716271cc15a8e ]---




> Flicker is usually caused by when we get the front/back buffers muddled up.
> But equally it could be a bug lurking elsewhere in the pageflipping code.

There are also artifacts like horizontal scans, like with noisy analog transmissions. I'm sorry but I don't how to describe it.
Comment 9 darkbasic 2011-07-16 10:16:21 UTC
> Might be worth compiling with --enable-debug

Where should I enable debug? xorg-server? libdrm? mesa? xf86-video-intel? All of them?
Comment 10 Chris Wilson 2011-07-16 10:38:27 UTC
Telepathy failed. Enable debug in the ddx [xf86-video-intel].
Comment 11 darkbasic 2011-07-16 11:57:59 UTC
Created attachment 49181 [details]
xorg.log with full debug

Here it is, it take down the whole X server while closing openarena :D

I am going to remove immediately the debug option because even switching from firefox to thunderbird is a pain in the ass with debugit enabled -.-
Comment 12 Chris Wilson 2011-07-16 13:12:27 UTC
That we hit an assert is good to know, it gives me to something to track down at least...
Comment 13 Chris Wilson 2011-07-17 02:14:08 UTC
I've been trying to reproduce this on an gm965 (which is closely related to the gm45) and I haven't yet seen the flicker using an external DVI output, either in the benchmarks or running the game by hand, with and without debugging enabled.

If you look in /var/log/gdm/:0.log* hopefully the assertion failure message from when X dies will have been recorded. Otherwise if I can ask you hook gdb up to your Xserver and play the game one more time with debugging. Note, you will need to ssh in from a second computer to attach gdb.
Comment 14 darkbasic 2011-07-20 03:18:08 UTC
As soon as I start "gdb /usr/bin/Xorg $(pidof X)" from ssh I lose control of mouse and keyboard in my laptop and so I can't start openarena anymore :(
Comment 15 Chris Wilson 2011-07-20 03:49:05 UTC
Hmm, that gdb invocation looks wrong (but it has been some time since I RTFM): try sudo gdb --pid=$(pidof X) (again from a remote ssh login).
Comment 16 darkbasic 2011-07-20 06:18:50 UTC
I still loose control of my mouse and my keyboard :(
Comment 17 darkbasic 2011-07-23 03:40:44 UTC
Any suggestion? Should something like "wait 10 && openarena" work? It would be enough to trigger the flickering but I will have to click to "exit" to trigger the X crash and I will not be able to do it  without the keyboard :(
Also, with debug enabled the X server behaves strangely: clicking on the "X" to close an application does switch to another one @_@
Comment 18 Chris Wilson 2011-07-23 08:05:56 UTC
I'm not actually sure. Loosing apparent control of input devices is expected when attaching gdb to X, as X is suspended until you tell gdb to continue. That's why we need to attach gdb from a remote computer so that we can monitor X without needing its display. You could use a .gdbinit script to tell gdb to automatically continue, but you would still loose control when X crashed and we would still not get the backtrace, unless we told it to automatically dump the stacktrace and exit. Hmm.

Even more bizarre is that the behaviour should not change with debug enabled. Granted I may have made a typo or two, but I hope insignificant...
Comment 19 Peter Hjalmarsson 2011-07-26 00:00:20 UTC
(In reply to comment #16)
> I still loose control of my mouse and my keyboard :(

When gdb has started you will in your ssh session be presented with a prompt, right? What happends if you write "contiune" and press enter?
Comment 20 Chris Wilson 2011-11-27 04:22:18 UTC
The original issue should now be fixed in a recent xserver, and the debug should now be debugged!
Comment 21 darkbasic 2011-12-21 14:57:40 UTC
Yes, the original issue is fixed (thanks!).
I'm sorry if it took so much time to answer but I get a bad day trying to find a working combo of kernel/xorg for a daily use with SNA :/
With linux-3.0.x everything seemed to work except konsole (yes, kde's terminal emulator!) which is very strange: as soon as I started konsole xorg did crash XD
With xorg-server-1.11.99.2, linux-3.2-rc6+ and latest libdrm/mesa/xf86-video-intel SNA does work flawlessly (except vaapi being 25% slower).
Comment 22 Chris Wilson 2011-12-21 15:27:48 UTC
vaapi is affected? how?

I use 3.2 with i915.i915_enable_fbc=0 as that is causing some nasty issues on my SNB laptops. You also definitely want a 3.1+ kernel since I've tweaked SNA to assume we LLC on SNB and the kernel doesn't yet have the feature flag for me to use the old code paths for SNB on older kernels.

Can you grab some profiling data with vaapi?
Comment 23 darkbasic 2011-12-22 02:50:40 UTC
I know, that's strange (after seeing konsole taking down the whole xorg server that's not so strange after all :)

Multi threaded decoding (SwapbuffersWait OFF):

mplayer2 -vc ffh264 -lavdopts threads=3 -benchmark -nosound <file>

Time elapsed: 81.897s


vaapi (kwin desktop effects OFF, SwapbuffersWait OFF, NO SNA):

mplayer -vo vaapi -va vaapi -benchmark <file>
Time elapsed: 82.468s


vaapi (kwin desktop effects OFF, SwapbuffersWait OFF, SNA):

mplayer -vo vaapi -va vaapi -benchmark <file>

Time elapsed: 101.282s


Here is the test video I used: http://www.sendspace.com/file/qv2ws9 (86 seconds, 200MB)


I do use libva git g45-h264 branch (http://cgit.freedesktop.org/libva/log/?h=g45-h264) + latest 5 patches from http://cgit.freedesktop.org/vaapi/intel-driver/log/?h=g45-h264


I did also boot with i915.i915_enable_fbc=0 and i915.lvds_downclock=0.


> Can you grab some profiling data with vaapi?

Yes, just let me know how.
Comment 24 darkbasic 2011-12-22 02:59:49 UTC
It seems sendspace removed the file, I uploaded it on my own server:
http://files.linuxsystems.it/test.mkv
Comment 25 Chris Wilson 2012-03-26 05:24:17 UTC
vaapi should be better, but since the libva driver is extremely poor I don't hold much hope. Only that SNA should be no worse than UXA.


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.