Bug 26428 - [KMS] doom3-demo aborts early on rv280
Summary: [KMS] doom3-demo aborts early on rv280
Status: RESOLVED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Radeon (show other bugs)
Version: XOrg git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-04 09:22 UTC by Andrew Randrianasulu
Modified: 2010-08-03 00:01 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
doom3 cfg (4.70 KB, text/plain)
2010-02-04 09:23 UTC, Andrew Randrianasulu
no flags Details
dmesg (15.63 KB, text/plain)
2010-02-04 09:23 UTC, Andrew Randrianasulu
no flags Details
my .drirc (1.06 KB, text/plain)
2010-02-04 09:24 UTC, Andrew Randrianasulu
no flags Details
X log (34.14 KB, text/plain)
2010-02-04 09:24 UTC, Andrew Randrianasulu
no flags Details
testcase output (test from bug 21693) (28.89 KB, image/jpeg)
2010-02-04 12:05 UTC, Andrew Randrianasulu
no flags Details
possible fix for bogus cube texture tracking (1.00 KB, patch)
2010-06-12 07:38 UTC, Roland Scheidegger
no flags Details | Splinter Review
fix calculation of compressed mipmaps (2.79 KB, patch)
2010-06-12 07:42 UTC, Roland Scheidegger
no flags Details | Splinter Review

Description Andrew Randrianasulu 2010-02-04 09:22:24 UTC
this is my old 

01:00.0 VGA compatible controller: ATI Technologies Inc RV280 [Radeon 9200 SE] (rev 01) (prog-if 00 [VGA controller])
        Subsystem: Hightech Information System Ltd. Excalibur 9200SE VIVO 128M
        Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 16
        Memory at d0000000 (32-bit, prefetchable) [size=128M]
        I/O ports at c800 [size=256]
        Memory at dfef0000 (32-bit, non-prefetchable) [size=64K]
        Expansion ROM at dfec0000 [disabled] [size=128K]
        Capabilities: [58] AGP version 2.0
        Capabilities: [50] Power Management version 2
        Kernel driver in use: radeon
        Kernel modules: radeon, radeonfb
-------

trying to play doom3-demo resulted in

[drm:r100_cs_track_cube] *ERROR* Cube texture offset greater than object size 22080 20480
[drm:r100_cs_track_texture_print] *ERROR* pitch                      512
[drm:r100_cs_track_texture_print] *ERROR* use_pitch                  0
[drm:r100_cs_track_texture_print] *ERROR* width                      128
[drm:r100_cs_track_texture_print] *ERROR* width_11                   2048
[drm:r100_cs_track_texture_print] *ERROR* height                     128
[drm:r100_cs_track_texture_print] *ERROR* height_11                  2048
[drm:r100_cs_track_texture_print] *ERROR* num levels                 7
[drm:r100_cs_track_texture_print] *ERROR* depth                      0
[drm:r100_cs_track_texture_print] *ERROR* bpp                        4
[drm:r100_cs_track_texture_print] *ERROR* coordinate type            2
[drm:r100_cs_track_texture_print] *ERROR* width round to power of 2  0
[drm:r100_cs_track_texture_print] *ERROR* height round to power of 2 0
[drm:r100_cs_track_texture_print] *ERROR* compress format            1
[drm:radeon_cs_ioctl] *ERROR* Invalid command stream !


this kernel (25.33-rc6+ , with "lib/idr bug" commit reverted) not very stable, so i'll update this bug step by step.
Comment 1 Andrew Randrianasulu 2010-02-04 09:23:02 UTC
Created attachment 33069 [details]
doom3 cfg
Comment 2 Andrew Randrianasulu 2010-02-04 09:23:48 UTC
Created attachment 33070 [details]
dmesg
Comment 3 Andrew Randrianasulu 2010-02-04 09:24:25 UTC
Created attachment 33071 [details]
my .drirc
Comment 4 Andrew Randrianasulu 2010-02-04 09:24:59 UTC
Created attachment 33072 [details]
X log
Comment 5 Pauli 2010-02-04 09:31:54 UTC
I have been testing Saurbraten and I have been able to get same cube
texture error from starting Campaign "Private Stan Sauer: Run & Gun
Part I". Trying to run forward and turning a bit right seems to cause
crash quite often.

Just in case if someone prefers open source test case.

On Thu, Feb 4, 2010 at 7:22 PM,  <bugzilla-daemon@freedesktop.org> wrote:
> http://bugs.freedesktop.org/show_bug.cgi?id=26428
>
> trying to play doom3-demo resulted in
>
> [drm:r100_cs_track_cube] *ERROR* Cube texture offset greater than object size
> 22080 20480
> [drm:r100_cs_track_texture_print] *ERROR* pitch                      512
> [drm:r100_cs_track_texture_print] *ERROR* use_pitch                  0
> [drm:r100_cs_track_texture_print] *ERROR* width                      128
> [drm:r100_cs_track_texture_print] *ERROR* width_11                   2048
> [drm:r100_cs_track_texture_print] *ERROR* height                     128
> [drm:r100_cs_track_texture_print] *ERROR* height_11                  2048
> [drm:r100_cs_track_texture_print] *ERROR* num levels                 7
> [drm:r100_cs_track_texture_print] *ERROR* depth                      0
> [drm:r100_cs_track_texture_print] *ERROR* bpp                        4
> [drm:r100_cs_track_texture_print] *ERROR* coordinate type            2
> [drm:r100_cs_track_texture_print] *ERROR* width round to power of 2  0
> [drm:r100_cs_track_texture_print] *ERROR* height round to power of 2 0
> [drm:r100_cs_track_texture_print] *ERROR* compress format            1
> [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
>
>
> this kernel (25.33-rc6+ , with "lib/idr bug" commit reverted) not very stable,
> so i'll update this bug step by step.
>
>
Comment 6 Alan Swanson 2010-02-04 11:35:34 UTC
Essentially the same error and exit on start up with UT2004 on rv250. Reverting "drm/radeon/kms/r200: fix bug in CS parser", or rather the one that fixes inverted checks for CUBE and 3D textures for bug 24159 since two commits were made with same summary, fixes UT2004.

UT2004 runs fine but the following is printed which might be related to a cube texture problem; "File r200_tcl.c function r200_run_tcl_render line 563. Rendering was 6 commands larger than predicted size. We might overflow command buffer."
Comment 7 Andrew Randrianasulu 2010-02-04 12:01:16 UTC
may be testcase from http://bugs.freedesktop.org/show_bug.cgi?id=21693 can help here ... trying it right now ....
Comment 8 Andrew Randrianasulu 2010-02-04 12:05:28 UTC
Created attachment 33082 [details]
testcase output (test from bug 21693)

It doesn't abort
Comment 9 Andrew Randrianasulu 2010-04-21 08:27:36 UTC
Same error with drm-radeon-testing kernel up to  commit 10fd883ce384706f88554a0b08cc4d63345e7d8b
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Apr 20 16:34:20 2010 +1000
    agp/intel: put back check that we have a driver for the bridge.

and mesa master up to
commit 9e258fc2bd6f2b9950606a0a92bb92c8959d9efd
Author: Vinson Lee <vlee@vmware.com>
Date:   Tue Apr 20 18:48:04 2010 -0700
    gallivm: Remove unnecessary headers.

------------

[drm:r100_cs_track_cube] *ERROR* Cube texture offset greater than object size 22080 20480
[drm:r100_cs_track_texture_print] *ERROR* pitch                      512
[drm:r100_cs_track_texture_print] *ERROR* use_pitch                  0
[drm:r100_cs_track_texture_print] *ERROR* width                      128
[drm:r100_cs_track_texture_print] *ERROR* width_11                   2048
[drm:r100_cs_track_texture_print] *ERROR* height                     128
[drm:r100_cs_track_texture_print] *ERROR* height_11                  2048
[drm:r100_cs_track_texture_print] *ERROR* num levels                 7
[drm:r100_cs_track_texture_print] *ERROR* depth                      0
[drm:r100_cs_track_texture_print] *ERROR* bpp                        4
[drm:r100_cs_track_texture_print] *ERROR* coordinate type            2
[drm:r100_cs_track_texture_print] *ERROR* width round to power of 2  0
[drm:r100_cs_track_texture_print] *ERROR* height round to power of 2 0
[drm:r100_cs_track_texture_print] *ERROR* compress format            1
[drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
Comment 10 Andrew Randrianasulu 2010-05-05 15:15:43 UTC
using mesa debug build and RADEON_DEBUG=tex i  have some additional info

-----
radeon_validate_texture_miptree: Using miptree 0x114bff08
Checking image level 0, face 0, mt 0x114bff08 ... OK
Checking image level 1, face 0, mt 0x114bff08 ... OK
Checking image level 2, face 0, mt 0x114bff08 ... OK
Checking image level 3, face 0, mt 0x114bff08 ... OK
Checking image level 4, face 0, mt 0x114bff08 ... OK
Checking image level 5, face 0, mt 0x114bff08 ... OK
Checking image level 6, face 0, mt 0x114bff08 ... OK
Checking image level 7, face 0, mt 0x114bff08 ... OK
setup_hardware_state(0xc1b4338, tex 0x114bfc10) log2(w 7, h 6, d 0), texelBytes 4. format 2
r200UpdateTextureEnv( 0xc1b9678, 0 )
calculate_min_max_lod(0x114c0508) target GL_TEXTURE_2D, min 0, max 7.
radeon_validate_texture_miptree: Validating texture 0x114c0508 now, minLod = 0, maxLod = 7
Checking if miptree 0x114c0810 matches texObj 0x114c0508
target 3553 vs 3553
format 46 vs 46
numLevels 8 vs 8
width0 128 vs 128
height0 64 vs 64
depth0 1 vs 1
MATCHED
radeon_validate_texture_miptree: Using miptree 0x114c0810
Checking image level 0, face 0, mt 0x114c0810 ... OK
Checking image level 1, face 0, mt 0x114c0810 ... OK
Checking image level 2, face 0, mt 0x114c0810 ... OK
Checking image level 3, face 0, mt 0x114c0810 ... OK
Checking image level 4, face 0, mt 0x114c0810 ... OK
Checking image level 5, face 0, mt 0x114c0810 ... OK
Checking image level 6, face 0, mt 0x114c0810 ... OK
Checking image level 7, face 0, mt 0x114c0810 ... OK
setup_hardware_state(0xc1b4338, tex 0x114c0508) log2(w 7, h 6, d 0), texelBytes 8. format 46
r200UpdateTextureEnv( 0xc1b9678, 0 )
calculate_min_max_lod(0x114c0e70) target GL_TEXTURE_2D, min 0, max 6.
radeon_validate_texture_miptree: Validating texture 0x114c0e70 now, minLod = 0, maxLod = 6
Checking if miptree 0x114c1178 matches texObj 0x114c0e70
target 3553 vs 3553
format 46 vs 46
numLevels 7 vs 7
width0 64 vs 64
height0 32 vs 32
depth0 1 vs 1
drmRadeonCmdBuffer: -1. Kernel failed to parse or rejected command stream. See dmesg for more info.
pure virtual method called
signal caught: Aborted
si_code -6
Trying to exit gracefully..
pure virtual method called
double fault Aborted, bailing out
shutdown terminal support
Àâàðèéíûé îñòàíîâ

kernel still print:
[drm:r100_cs_track_cube] *ERROR* Cube texture offset greater than object size 22080 20480
[drm:r100_cs_track_texture_print] *ERROR* pitch                      512
[drm:r100_cs_track_texture_print] *ERROR* use_pitch                  0
[drm:r100_cs_track_texture_print] *ERROR* width                      128
[drm:r100_cs_track_texture_print] *ERROR* width_11                   2048
[drm:r100_cs_track_texture_print] *ERROR* height                     128
[drm:r100_cs_track_texture_print] *ERROR* height_11                  2048
[drm:r100_cs_track_texture_print] *ERROR* num levels                 7
[drm:r100_cs_track_texture_print] *ERROR* depth                      0
[drm:r100_cs_track_texture_print] *ERROR* bpp                        4
[drm:r100_cs_track_texture_print] *ERROR* coordinate type            2
[drm:r100_cs_track_texture_print] *ERROR* width round to power of 2  0
[drm:r100_cs_track_texture_print] *ERROR* height round to power of 2 0
[drm:r100_cs_track_texture_print] *ERROR* compress format            1
[drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
Comment 11 Roland Scheidegger 2010-06-10 06:44:05 UTC
(In reply to comment #10)
> using mesa debug build and RADEON_DEBUG=tex i  have some additional info
> 
> -----
> radeon_validate_texture_miptree: Using miptree 0x114bff08
> Checking image level 0, face 0, mt 0x114bff08 ... OK
> Checking image level 1, face 0, mt 0x114bff08 ... OK
> Checking image level 2, face 0, mt 0x114bff08 ... OK
> Checking image level 3, face 0, mt 0x114bff08 ... OK
> Checking image level 4, face 0, mt 0x114bff08 ... OK
> Checking image level 5, face 0, mt 0x114bff08 ... OK
> Checking image level 6, face 0, mt 0x114bff08 ... OK
> Checking image level 7, face 0, mt 0x114bff08 ... OK

I don't think this corresponds to the texture which is rejected.

> [drm:r100_cs_track_cube] *ERROR* Cube texture offset greater than object size
> 22080 20480
> [drm:r100_cs_track_texture_print] *ERROR* width                      128
> [drm:r100_cs_track_texture_print] *ERROR* height                     128
> [drm:r100_cs_track_texture_print] *ERROR* bpp                        4
> [drm:r100_cs_track_texture_print] *ERROR* coordinate type            2
> [drm:r100_cs_track_texture_print] *ERROR* compress format            1

Just like bug #28459 this also has the seemingly impossible bpp == 4 and compress != 0 case (bug #1). But I doubt it's the problem, as the cube texture tracking code can't cope with compressed textures anyway (bug #2) - its size calculation should be similar to what's done for non-cube compressed textures.
I've also got my serious doubts about the size calculation with cube mipmaps, that offset stuff looks seriously wrong to me but I didn't look closer (that would be bug #3).
Since I think there's something else entirely going on (more bugs), since if you actually look at the numbers 128*128*4 (which is what the cube texture tracking code seemingly would calculate as it ignores compress bits) would be already 64k. That can only mean the cube faces (the sizes aren't printed) were smaller than the corresponding texture faces, which, while the hardware allows this, should never happen. There also appears to be a bug (let's call it bug #4) with the command checker on the R200_PP_TXFORMAT_X packets since it ignores the TEX_COORD_TYPES 3 and 4 - I don't think the driver would ever use 4 but 3 is projected 2d and certainly used. Hence I think something similar to bug #1 could be going on when actually 2d proj is active but due to a former packet tex_coord_type is still set to cubic (this would explain the different sized cube faces).
I think there are more bugs in the verifier, for one it doesn't really seem to handle ATI_fragment_shader very well (PP_CNTL_X and PP_TXMULTI_CTL regs mostly). These allow for instance enabled texture units with sampling disabled which the verifier might refuse if it doesn't like the bound texture (I'm not entirely sure though this can actually be a problem or is disallowed by the API). Also it would completely miss to check for bogus textures in the first phase, if sampling is only done there and not in the second phase, but at least this shouldn't cause any unwarranted rejection :-). Unfortunately checking correctly both phases seems quite complicated.
Comment 12 Roland Scheidegger 2010-06-12 07:38:57 UTC
Created attachment 36234 [details] [review]
possible fix for bogus cube texture tracking

With some luck this could fix the bug, though it only addresses issue 4 I mentioned.
Comment 13 Roland Scheidegger 2010-06-12 07:42:32 UTC
Created attachment 36235 [details] [review]
fix calculation of compressed mipmaps

Totally untested too but this addresses issue 2 I mentioned. With that only the strange cube_info.offset and mipmap handling I have no idea how that's supposed to work would remain (at least as far as the more obvious issues in texture tracking are concerned).
Comment 14 Andrew Randrianasulu 2010-06-12 10:09:45 UTC
(In reply to comment #13)
> Created an attachment (id=36235) [details]
> fix calculation of compressed mipmaps
> 
> Totally untested too but this addresses issue 2 I mentioned. With that only the
> strange cube_info.offset and mipmap handling I have no idea how that's supposed
> to work would remain (at least as far as the more obvious issues in texture
> tracking are concerned).


This patch + patch from comment #12 + another patch from bug #28459 seems to fix problem kernel-side :) Thanks a lot!
Comment 15 Alex Deucher 2010-06-12 10:23:27 UTC
I'll send the patches to Dave and stable.
Comment 16 Fabio Pedretti 2010-08-03 00:01:22 UTC
Patches merged in 2.6.34.2 and 2.6.35.


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.