iXit / Mesa-3D

Please use official https://gitlab.freedesktop.org/mesa/mesa/ !
https://github.com/iXit/Mesa-3D/wiki
66 stars 13 forks source link

Age of Conan crashes on start #130

Closed Altosk closed 8 years ago

Altosk commented 9 years ago

On a nine apitrace it crashes on IDirect3DTexture9::UnlockRect and hard locks my computer but using D3D_ALWAYS_SOFTWARE=1 allowed me to get the trace. Replaying the trace file in qapitrace complains about an unhandled exception.

Playing a trace file of wined3d on nine crashes at DrawIndexedPrimitive.

amd r2 290x is my video card

sarnex commented 9 years ago

Come to #d3d9 on irc.freenode.net and ping me, we have an apitrace server. Also, can you post the log with NINE_DEBUG=all, thanks.

Altosk commented 9 years ago

heres NINE_DEBUG=all log https://www.sendspace.com/file/qe1k88

axeldavy commented 9 years ago

I think the application is writing outside the buffer. We see in the log it uses ATI2 format (likely not supported on llvmpipe, thus why you don't hit the bug).

ATI2 is a special format that relies on a hack to work: the info returned to the app is wrong, but the app knows that it is wrong for this format, and deduces the correct info from the wrong info. We do specially the 'wrong behaviour' for this format, but it looks like we do only when the buffer is in cpu memory. All games tested so far using this format were filling the data in cpu memory, and then would copy to gpu memory. Here the game maps the gpu memory and writes to it.

Can you try the following thing (hoping that will be sufficient, because else some tricks may be needed):

at surface9.c, line 408 replace the line pLockedRect->Pitch = This->transfer->stride; with if (is_ATI1_ATI2(This->base.info.format)) pLockedRect->Pitch = This->desc.Height; else pLockedRect->Pitch = This->transfer->stride;

Altosk commented 9 years ago

tested and crashed but wine d3d trace played till the end new log : https://www.sendspace.com/file/l9lihc

axeldavy commented 9 years ago

Is it the log for the wined3d trace ?

Wine doesn't advertise ATI2 on radeonsi, the change I asked you to do shouldn't change anything to the fact it runs or not.

Is it crashing at same location ? If yes, I guess a bigger fix is needed, I will tell here when I have written it.

Altosk commented 9 years ago

no the log is from nine. wined3d replay crashed a drawindexedprim on nine now it doesnt which is weird given what you said

axeldavy commented 9 years ago

ok, I wrote something. I test it doesn't regress anything else, then I'd ask you to test

axeldavy commented 9 years ago

Ok, can you test current git and report ?

Altosk commented 9 years ago

ok compiling now

Altosk commented 9 years ago

tested with git still crashes and i tried with both the patch on git and what you suggested

Altosk commented 9 years ago

actually hang on i mess up compiling

Altosk commented 9 years ago

still crashes. my other games work fine now.

axeldavy commented 9 years ago

There is likely some other factors intervening.

are you compiling with gcc 5.0 or gcc 5.1 ?

Altosk commented 9 years ago

gcc 4.9.3

axeldavy commented 9 years ago

Is it crashing at the same location than before ?

Altosk commented 9 years ago

nine:unknown:QueryInterface: This=0x7cbb6028 riid=0x33e2f8 ppvObject=0x33e2f4 nine:basetexture9:Dump: NineBaseTexture9(0x7cbb6028->NULL/0x7cbb6108): Pool=DEFAULT Type=TEXTURE Usage= Format=D3DFMT_A8R8G8B8 Dims=32x16x1/1 LastLevel=5 Lod=0(4294967295) nine:device9:CreateTexture: This=0x7c54c490 Width=32 Height=16 Levels=0 Usage= Format=D3DFMT_A8R8G8B8 Pool=DEFAULT ppOut=0x33e66c pSharedHandle=(nil) nine:texture9:ctor: (0x7cbb7628) Width=32 Height=16 Levels=0 Usage= Format=D3DFMT_A8R8G8B8 Pool=DEFAULT pSharedHandle=(nil) nine:basetexture9:ctor: This=0x7cbb7628, pParams=0x33e504 initResource=(nil) Type=3 format=21 Pool=0 Usage=0 nine:resource9:ctor: This=0x7cbb7628 pParams=0x33e504 initResource=(nil) Allocate=1 Type=3 Pool=0 Usage=0 nine:resource9:ctor: (0x7cbb7628) Creating pipe_resource. these are the last entries in my log.

Altosk commented 9 years ago

to answer your question, yes it is still crashing in the same timeframe

Altosk commented 9 years ago

dmesg complains about this : [ 226.084129] radeon 0000:01:00.0: va above limit (0x002032E6 > 0x00200000) if thats is any help

axeldavy commented 9 years ago

I need to know whether the ATI1/ATI2 patch solves something or not.

Can you confirm the log looks different for you with the patch and without ?

Altosk commented 9 years ago

okay ATI1/2 patch gets me farther when i compare the logs that I posted but it looks like it crashes at nine:resource9:ctor: (0x7cbb7d48) Creating pipe_resource now

Altosk commented 9 years ago

replaying the trace on wined3d gives me this: err:d3d:resource_init Failed to allocate system memory. 571 @0 IDirect3DDevice9::CreateTexture(this = 0x7c982c28, Width = 4096, Height = 4096, Levels = 0, Usage = 0x0, Format = D3DFMT_A8R8G8B8, Pool = D3DPOOL_DEFAULT, ppTexture = &0x7caeaf28, pSharedHandle = NULL) = D3D_OK 571: warning: failed with 0x8007000e (E_OUTOFMEMORY): Out of memory.

Altosk commented 9 years ago

axel those patches do not help at all I just reverted and did a apitace after the revert and comparing it to one before revert shows it crashing at the same point as with the patches.

Altosk commented 9 years ago

heres an apitrace https://www.sendspace.com/file/bjy5k9

axeldavy commented 9 years ago

same thing apitrace really short and doesn't show the bug. Did you cut the trace or ?

Altosk commented 9 years ago

i didnt cut the trace thats as far as i get with both apitraces i posted

Altosk commented 9 years ago

latest git broke the patch that fixed the kernel crashing

axeldavy commented 9 years ago

what was the last working git for this game ?

Altosk commented 9 years ago

I think theres a bug between the patch and thread_submit=true i removed it from the command line and the game crashes at the new point that i pointed at in the pull request.

siro20 commented 8 years ago

For ageofConan the first patch is required (ATI1/ATI2 stride width) and there's a problem in nine resource management: err = util_hash_table_set(This->pdata, refguid, header); is wrong as the pointer refguid is stored in the list. The pointer is under application control and we don't know what happens to memory after leaving this function. NineResource9_GetPrivateData isn't able to find the entry as the data where refguid is pointing to has changed. The correct implementation would be to create a copy of GUID and store it in the header. util_hash_table_set has to point to the GUID in the header, as it is under our control and the contents won't change.

Altosk commented 8 years ago

with siro patch it start to a black screen with no movie or anything

siro20 commented 8 years ago

The game plays when minimized and idle when in fullscreen, it looks like this is because of broken window handling.

siro20 commented 8 years ago

The ticket should be closed as the bug is fixed.

Altosk commented 8 years ago

siro should i open another ticket about rendering when miminized and not when the window is in focus?

siro20 commented 8 years ago

Yes please