Bug 27603 - [nouveau] Celestia 1.6.0 crashes with nv04_surface_copy_swizzle assertion
Summary: [nouveau] Celestia 1.6.0 crashes with nv04_surface_copy_swizzle assertion
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/nouveau (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Nouveau Project
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-12 07:10 UTC by Alex Buell
Modified: 2010-05-03 05:01 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Alex Buell 2010-04-12 07:10:43 UTC
Hardware: NV34M 64MB on Dell Inspiron 5150 laptop

Software: 

Celestia 1.6.0
Linux 2.6.32 

(w/ the following installed out of tree)
libdrm 2.4.20
nouveau-drm 20100316
xf86-video-nouveau 0.0.15 pre 20100329
xorg-server 1.7.6

glxgears works, therefore novueau and dri2 up and running.

$ celestia 
Initializing ARB vertex programs . . .
Loading ARB vertex program: shaders/diffuse_arb.vp
Loading ARB vertex program: shaders/specular_arb.vp
Loading ARB vertex program: shaders/haze_arb.vp
Loading ARB vertex program: shaders/bumpdiffuse_arb.vp
Loading ARB vertex program: shaders/bumphaze_arb.vp
Loading ARB vertex program: shaders/shadowtex_arb.vp
Loading ARB vertex program: shaders/diffuse_texoff_arb.vp
Loading ARB vertex program: shaders/rings_arb.vp
Loading ARB vertex program: shaders/ringshadow_arb.vp
Loading ARB vertex program: shaders/night_arb.vp
Loading ARB vertex program: shaders/glossmap_arb.vp
Loading ARB vertex program: shaders/diffuse2_arb.vp
Loading ARB vertex program: shaders/haze2_arb.vp
Loading ARB vertex program: shaders/diffuse_texoff2_arb.vp
Loading ARB vertex program: shaders/specular2_arb.vp
Loading ARB vertex program: shaders/night2_arb.vp
Loading ARB vertex program: shaders/star_arb.vp
Loading ARB vertex program: shaders/multishadow_arb.vp
Loading ARB vertex program: shaders/texphong_arb.vp
Loading ARB vertex program: shaders/texphong_alpha_arb.vp
Loading ARB vertex program: shaders/ell_galaxy_arb.vp
All ARB vertex programs loaded successfully.
render path: 8
celestia: nv04_surface_2d.c:170: nv04_surface_copy_swizzle: Assertion `!(dst->offset & 63)' failed.

Splash screen displayed perfectly then crashed out with this assertion error.
Comment 1 Alex Buell 2010-04-12 07:31:20 UTC
(In reply to comment #0)
> Celestia 1.6.0
> Linux 2.6.32 
> 
> (w/ the following installed out of tree)
> libdrm 2.4.20
> nouveau-drm 20100316
> xf86-video-nouveau 0.0.15 pre 20100329
> xorg-server 1.7.6

Forgot about mesa library, it's 7.8.1. 

Thanks.
Comment 2 Xavier 2010-04-12 07:48:24 UTC
I think it could work with that branch :
http://repo.or.cz/w/mesa/mesa-lb.git/shortlog/refs/heads/stable%23new_2d
which should be merged some day.
Comment 3 Alex Buell 2010-04-12 08:26:00 UTC
(In reply to comment #2)
> I think it could work with that branch :
> http://repo.or.cz/w/mesa/mesa-lb.git/shortlog/refs/heads/stable%23new_2d
> which should be merged some day.

I'm having trouble getting git to clone that tree onto my machine. What's the correct invocation of git to use with this? 

Sorry, I'd really like to test this tree and see if that solves my problem!
Comment 4 Xavier 2010-04-12 14:59:07 UTC
You have to go to the main page to find the git and http URL :
http://repo.or.cz/w/mesa/mesa-lb.git
(you can find this link on the first line of each git page.

Then try the stable branch.

If you are on 0.0.15, it won't be that easy, you probably should first upgrade kernel module / libdrm / ddx to 0.0.16 (well, current git).

A few useful links (happy reading) :
http://nouveau.freedesktop.org/wiki/InstallNouveau
http://nouveau.freedesktop.org/wiki/InstallDRM
http://nouveau.freedesktop.org/wiki/GalliumHowto

http://nouveau.freedesktop.org/wiki/TroubleShooting
http://nouveau.freedesktop.org/wiki/FAQ
Comment 5 Alex Buell 2010-04-12 15:37:14 UTC
(In reply to comment #4)
> You have to go to the main page to find the git and http URL :
> http://repo.or.cz/w/mesa/mesa-lb.git
> (you can find this link on the first line of each git page.
> 
> Then try the stable branch.

Thanks, I just tried that:
% git clone git://repo.or.cz/mesa/mesa-lb.git/ mesa
Initialized empty Git repository in /home/alex/src/opengl/mesa/.git/
remote: Counting objects: 288777, done.
remote: Compressing objects: 100% (52440/52440), done.
remote: Total 288777 (delta 240300), reused 281772 (delta 234422)
Receiving objects: 100% (288777/288777), 86.32 MiB | 745 KiB/s, done.
Resolving deltas: 100% (240300/240300), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

I'm not sure why that's happening. 

> If you are on 0.0.15, it won't be that easy, you probably should first upgrade
> kernel module / libdrm / ddx to 0.0.16 (well, current git).

I'm already on 0.0.16, not to worry. I made sure of that before starting with this!

Thanks for your help so far!
Comment 6 Xavier 2010-04-12 15:59:23 UTC
Just FYI, Luca made this repository before he got commit access to mesa. Since he got access a while ago, he will progressively merge all of this work, and that mesa-lb repo is pretty much dying now (though it should still work well).

Luca already rebased the new 2d engine to mesa master locally, so I suppose it will be available soon in one way or another.

Anyway there are plenty of good reasons to first clone official mesa :
http://cgit.freedesktop.org/mesa/mesa

$ git clone git://anongit.freedesktop.org/mesa/mesa

If you still want to try the new 2d right now, you can add mesa-lb as remote :
$ cd mesa/
$ git remote add lb git://repo.or.cz/mesa/mesa-lb.git/
Then you can use lb/stable branch


Otherwise there should be a very simple hack/workaround for that specific assertion.
Comment 7 Younes Manton 2010-04-12 16:20:05 UTC
You can work around this by setting NOUVEAU_NO_SWIZZLE=1 in your env.

If you know your way around GDB maybe you can run your app under it and when it asserts do something like:

'where'

and

'print *dst'

so we can get an idea of what this unaligned surface is and where it's being passed from.
Comment 8 Alex Buell 2010-04-12 17:02:32 UTC
(In reply to comment #7)

> You can work around this by setting NOUVEAU_NO_SWIZZLE=1 in your env.

Yes, that got me past the crash, thanks for that one, most helpful. 

Unfortunately, celestia is unusable, lots of corruption on things shown, as if mipmaps weren't being manipulated correctly. This is with Mesa 7.8.1. 

> If you know your way around GDB maybe you can run your app under it and when it
> asserts do something like:
> 
> 'where'

Sure, doing that now without NOUVEAU_NO_SWIZZLE;

$ gdb `which celestia`
> run
[ ... ]
All ARB vertex programs loaded successfully.
render path: 8
celestia: nv04_surface_2d.c:170: nv04_surface_copy_swizzle: Assertion `!(dst->offset & 63)' failed.

Program received signal SIGABRT, Aborted.
0xb7fe1424 in __kernel_vsyscall ()
(gdb) where
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb6b2b6e0 in *__GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb6b2cf15 in *__GI_abort () at abort.c:88
#3  0xb6b2490e in *__GI___assert_fail (
    assertion=0xb5d9fddd "!(dst->offset & 63)", 
    file=0xb5d9fd8b "nv04_surface_2d.c", line=170, 
    function=0xb5da01bd "nv04_surface_copy_swizzle") at assert.c:78
#4  0xb5c26f0d in nv04_surface_copy_swizzle (ctx=0x91c3418, dst=0x930d818, 
    dx=0, dy=0, src=0x92f71c8, sx=0, sy=0, w=64, h=64) at nv04_surface_2d.c:170
#5  nv04_surface_copy (ctx=0x91c3418, dst=0x930d818, dx=0, dy=0, 
    src=0x92f71c8, sx=0, sy=0, w=64, h=64) at nv04_surface_2d.c:297
#6  0xb5bd3a5b in nv30_transfer_del (ptx=0x9366790) at nv30_transfer.c:134
#7  0xb5c300a3 in st_texture_image_unmap (st=0x92f94b0, stImage=0x93c3a30)
    at state_tracker/st_texture.c:221
#8  0xb5cf04df in st_TexImage (ctx=0x92b9088, dims=2, target=34070, level=0, 
    internalFormat=3, width=64, height=64, depth=1, border=0, format=6407, 
    type=5121, pixels=0x93f4fa0, unpack=0x92c7e08, texObj=0x93f12f8, 
    texImage=0x93c3a30, imageSize=0, compressed_src=0 '\000')
    at state_tracker/st_cb_texture.c:735
#9  0xb5cf0db8 in st_TexImage2D (ctx=0x92b9088, target=34070, level=0, 
    internalFormat=3, width=64, height=64, border=0, format=6407, type=5121, 
    pixels=0x93f4fa0, unpack=0x92c7e08, texObj=0x93f12f8, texImage=0x93c3a30)
---Type <return> to continue, or q <return> to quit---
    at state_tracker/st_cb_texture.c:768
#10 0xb5cc1d66 in _mesa_TexImage2D (target=34070, level=0, internalFormat=3, 
    width=64, height=64, border=0, format=6407, type=5121, pixels=0x93f4fa0)
    at main/teximage.c:2278
#11 0xb789af87 in gluBuild2DMipmapLevelsCore (target=34070, internalFormat=3, 
    width=64, height=64, widthPowerOf2=64, heightPowerOf2=64, format=6407, 
    type=5121, userLevel=0, baseLevel=0, maxLevel=6, data=0x93f4fa0)
    at libutil/mipmap.c:3873
#12 0xb789c6e8 in gluBuild2DMipmaps (target=34070, internalFormat=3, width=64, 
    height=64, format=6407, type=5121, data=0x93f4fa0) at libutil/mipmap.c:4606

> 'print *dst'

(gdb) print *dst
No symbol "dst" in current context.

Is this useful? I hope it helps improve Gallium3D. At least it works quite nicely with Oolite (a space trading / strategy game based on Elite 20 years ago)

Thanks.

I also tried to check out the official mesa.git but it gave up at this point:


% git clone http://cgit.freedesktop.org/mesa/mesa
[ ... ]
got ef916e4c4555c77f0f597f71c68056b22f052557
error: inflate: data stream error (incorrect header check)
error: inflate: data stream error (incorrect header check)
got 6320f9f860a80dba076e172cfeb76b9417833e04
error: File fcbe4171b46d72c388a67c1602460633c29611b3 (http://cgit.freedesktop.org/mesa/mesa/objects/fc/be4171b46d72c388a67c1602460633c29611b3) corrupt
error: Unable to find fcbe4171b46d72c388a67c1602460633c29611b3 under http://cgit.freedesktop.org/mesa/mesa
Cannot obtain needed tree fcbe4171b46d72c388a67c1602460633c29611b3
while processing commit c28dd492cd4f44f11de17f3b4fe569d3665736ca.
fatal: Fetch failed.

I've never used git before, but I've got experience using subversion and cvs (shows my age!), and am getting to grips with it!

Thanks!
Comment 9 Xavier 2010-04-13 04:18:49 UTC
Don't ask me why, but the stupid hack supposed to break things is what actually worked best for me (on top of mesa master) :
http://paste.pocoo.org/show/201196/

I still think the proper fix will come with the new 2d engine. So it probably does not matter much to find how that assert was reached, since it's all already fixed.

That said, just for completeness, to print dst, you need to :
1) switch to frame 4 nv04_surface_copy_swizzle where the code asserts and where dst is defined
2) build mesa with -O0 so that the value does not get optimized out

(gdb) frame 4
#4  0xb601c88b in nv04_surface_copy_swizzle (ctx=0x911c300, dst=0x928ec00, 
    dx=0, dy=0, src=0x92da248, sx=0, sy=0, w=64, h=64) at nv04_surface_2d.c:170
170		    assert(!(dst->offset & 63));
(gdb) print dst
$1 = (struct pipe_surface *) 0x928ec00
(gdb) print *dst
$2 = {reference = {count = 1}, texture = 0x9339b20, 
  format = PIPE_FORMAT_B8G8R8X8_UNORM, width = 64, height = 64, layout = 0, 
  offset = 21844, usage = 128, zslice = 0, face = 1, level = 0}
Comment 10 Alex Buell 2010-04-13 06:03:59 UTC
Right, OK I've just built the latest mesa.git sources and installed. Tested with celestia, still crashes at the same place. However running with NOUVEAU_NO_SWIZZLE=1 gets the app running. 

However as someone already noted, there are problems running this app on NV3x hardware, whilst some things do get rendered, others are wildly corrupted. This is with today's latest official mesa.git sources. 

I suppose the next step is to merge Luca's work into my local mesa.git repository and try again with that. 

Many thanks!
Comment 11 Alex Buell 2010-04-14 05:47:07 UTC
To resolve these issues with Celestia, it is necessary to compile and install the origin/nvfx-next branch from the official mesa.git respository. It should be noted, however that it is very slow but that's a different issue altogether and can be addressed at some point in the future. 

I would like to see the work from the nvfv branch be merged into the official mesa releases, maybe for 7.9.x? 

Thanks for all the help given!
Comment 12 Xavier 2010-04-14 12:19:03 UTC
Can you try with NOUVEAU_VTXIDX_IN_VRAM=1 ?

There is a very recent regression that causes a huge performance drop for my agp card at least.
By setting the above variable, it goes from 2-3fps to 10-15fps :)
Comment 13 Alex Buell 2010-04-14 12:49:04 UTC
(In reply to comment #12)
> Can you try with NOUVEAU_VTXIDX_IN_VRAM=1 ?
> 
> There is a very recent regression that causes a huge performance drop for my
> agp card at least.
> By setting the above variable, it goes from 2-3fps to 10-15fps :)

Yes, that was a huge improvement with that variable set, thanks for that one!
Comment 14 Alex Buell 2010-05-03 03:16:40 UTC
Could someone please merge the fix for this into the stable mesa.git tree?
Comment 15 Xavier 2010-05-03 04:49:22 UTC
It's not a fix... It's a complete rewrite of the 2d engine.
It will probably be merged some day by its own author, not by "someone".

There is no such thing as a stable mesa.git tree. The mesa.git tree contains experimental branches (like nvfx-next), main development branch (master), and stable release branch (7.8).
This kind of work is only ever merged in master. But why do you care and what difference does it make to you where the code lies ?

And did you forget that 3d is unsupported and bugs are not wanted ?

http://nouveau.freedesktop.org/wiki/
- Bugs in the 3-D driver are under product “Mesa”, component “Drivers/DRI/nouveau”, but please do not submit bugs on the 3-D support yet.
- Any 3-D functionality that might exist is still unsupported. Do not ask for instructions to try it. But you can read GalliumHowto in case you are brave enough.
http://nouveau.freedesktop.org/wiki/GalliumHowto
- Warning: the Nouveau 3D drivers are not yet suitable for ordinary users.
Bug reports on the 3D drivers are not accepted.

You should be thankful that someone already wrote code that fix your problem and that code is very easily available in official mesa.git tree, and that someone else took the time to answer you and point to that code :)

PS : I am not a developer and have no influence on what gets merged in mesa, neither on the 3d support / bug policy.
And this bug looks more like unofficial user support than anything. Feel free to send me private mails if you have further questions.
Comment 16 Alex Buell 2010-05-03 05:01:47 UTC
Ah now, thank you for the explanation on the mesa.git tree, sorry, seems my confusion arose on the mailing list with references to a 'stable' mesa.git tree and its development branches.

All is now clear.


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.