Bug 27704

Summary: [KMS] fbo_firecube broken on rv280 and current mesa
Product: Mesa Reporter: Andrew Randrianasulu <randrik>
Component: Drivers/DRI/r200Assignee: Default DRI bug account <dri-devel>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: fgl_glxgears -fbo on rv280
fbo_firecube on rv280

Description Andrew Randrianasulu 2010-04-16 11:44:08 UTC
same setup as in Bug 27702:

Using mesa master up to 

commit d293c43c9a9658caa5224f710b95a848a912faa1
Author: Brian Paul <brianp@vmware.com>
Date:   Fri Apr 16 10:01:32 2010 -0600
    llvmpipe: rename vars, update comments for texture->resource changes

libdrm up to 

commit 894c86e8400f13f1ee0dfe23ca4b5f98c32d9223
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Fri Apr 9 16:33:38 2010 -0400
    Revert "Fix pkgconfig includes for /usr/include/drm"

and xf86-video-ati 

commit eb5665688ef9b52f03f61546351d0848cab54740
Author: Alex Deucher <alexdeucher@gmail.com>
Date:   Thu Apr 8 00:31:52 2010 -0400
    radeon: don't setup Xv on rn50

on top of xserver 
commit e424d5812300e82de375d83dc0b490a76d865016
Merge: 5b0faf3 0e7703f
Author: Keith Packard <keithp@keithp.com>
Date:   Thu Apr 15 15:01:34 2010 -0700
    Merge remote branch 'whot/for-keith'

and kernel 2.6.34-rc4+ 


with rv280


lspci -vvn

01:00.0 0300: 1002:5964 (rev 01) (prog-if 00 [VGA controller])
        Subsystem: 1787:5964
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 64 (2000ns min), Cache Line Size: 32 bytes
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at d0000000 (32-bit, prefetchable) [size=128M]
        Region 1: I/O ports at c800 [size=256]
        Region 2: Memory at dfef0000 (32-bit, non-prefetchable) [size=64K]
        Expansion ROM at dfec0000 [disabled] [size=128K]
        Capabilities: [58] AGP version 2.0
                Status: RQ=80 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans-
64bit- FW+ AGP3- Rate=x1,x2,x4
                Command: RQ=32 ArqSz=0 Cal=0 SBA+ AGP+ GART64- 64bit- FW-
Rate=x4
        Capabilities: [50] Power Management version 2
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-
        Kernel driver in use: radeon
        Kernel modules: radeon

--------
guest@slax:~/source/mesa/progs/demos$ ./fbo_firecube 
Error: unable to get usable FBO combination!

fbotexture works  fine .....
Comment 1 Andrew Randrianasulu 2010-05-03 01:16:19 UTC
mesa debug build from git master up to 

commit 738cb502371097fa6fb25f397a3cbcd6a5db020c
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon May 3 17:09:17 2010 +1000
    nouveau: fix nouveau_create_context decleration

---------
guest@slax:~/source/mesa$ set_local_mesa.sh progs/demos/fbo_firecube
libGL: OpenDriver: trying /home/guest/source/mesa/lib/r200_dri.so
Mesa: CPU vendor: AuthenticAMD
Mesa: CPU name: AMD Duron(tm) Processor
Mesa: Mesa 7.9-devel DEBUG build May  3 2010 01:04:00
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_2D_ARRAY_EXT, new texture 0x8a936d8.
r200SetTexWrap(tex 0x8a936d8) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8a936d8) max 16.000000.
r200SetTexFilter(tex 0x8a936d8) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_1D_ARRAY_EXT, new texture 0x8a93958.
r200SetTexWrap(tex 0x8a93958) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8a93958) max 16.000000.
r200SetTexFilter(tex 0x8a93958) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_CUBE_MAP, new texture 0x8a9ce38.
r200SetTexWrap(tex 0x8a9ce38) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8a9ce38) max 16.000000.
r200SetTexFilter(tex 0x8a9ce38) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_3D, new texture 0x8a9d0b8.
r200SetTexWrap(tex 0x8a9d0b8) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8a9d0b8) max 16.000000.
r200SetTexFilter(tex 0x8a9d0b8) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_RECTANGLE_ARB, new texture 0x8ac72d0.
r200SetTexWrap(tex 0x8ac72d0) sw GL_CLAMP_TO_EDGE, tw GL_CLAMP_TO_EDGE, rw GL_CLAMP_TO_EDGE
r200SetTexMaxAnisotropy(tex 0x8ac72d0) max 16.000000.
r200SetTexFilter(tex 0x8ac72d0) minf GL_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_2D, new texture 0x8ac7550.
r200SetTexWrap(tex 0x8ac7550) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8ac7550) max 16.000000.
r200SetTexFilter(tex 0x8ac7550) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_1D, new texture 0x8ac77d0.
r200SetTexWrap(tex 0x8ac77d0) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8ac77d0) max 16.000000.
r200SetTexFilter(tex 0x8ac77d0) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_1D, new texture 0x8ade518.
r200SetTexWrap(tex 0x8ade518) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8ade518) max 16.000000.
r200SetTexFilter(tex 0x8ade518) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_2D, new texture 0x8ade798.
r200SetTexWrap(tex 0x8ade798) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8ade798) max 16.000000.
r200SetTexFilter(tex 0x8ade798) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_3D, new texture 0x8adea18.
r200SetTexWrap(tex 0x8adea18) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8adea18) max 16.000000.
r200SetTexFilter(tex 0x8adea18) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_CUBE_MAP, new texture 0x8adec98.
r200SetTexWrap(tex 0x8adec98) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8adec98) max 16.000000.
r200SetTexFilter(tex 0x8adec98) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_RECTANGLE_ARB, new texture 0x8adef18.
r200SetTexWrap(tex 0x8adef18) sw GL_CLAMP_TO_EDGE, tw GL_CLAMP_TO_EDGE, rw GL_CLAMP_TO_EDGE
r200SetTexMaxAnisotropy(tex 0x8adef18) max 16.000000.
r200SetTexFilter(tex 0x8adef18) minf GL_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_1D_ARRAY_EXT, new texture 0x8adf198.
r200SetTexWrap(tex 0x8adf198) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8adf198) max 16.000000.
r200SetTexFilter(tex 0x8adf198) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
r200NewTextureObject(0x8aa5550) target GL_TEXTURE_2D_ARRAY_EXT, new texture 0x8adf418.
r200SetTexWrap(tex 0x8adf418) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8adf418) max 16.000000.
r200SetTexFilter(tex 0x8adf418) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
Mesa warning: software DXTn compression/decompression available
Mesa: MMX cpu detected.
Mesa: 3DNow! cpu detected.
radeon_create_renderbuffer( rrb 0x8db29a0 ) 
radeon_create_renderbuffer( rrb 0x8db2a40 ) 
radeon_create_renderbuffer( rrb 0x8db2ae0 ) 
radeon_resize_buffers(0x8aa5550, fb 0x8db2640) 
radeon_alloc_window_storage(0x8aa5550, rb 0x8db29a0) 
radeon_bind_framebuffer(0x8aa5550, fb 0x8db3678, target GL_FRAMEBUFFER) 
r200NewTextureObject(0x8aa5550) target GL_FALSE, new texture 0x8db39a8.
r200SetTexWrap(tex 0x8db39a8) sw GL_REPEAT, tw GL_REPEAT, rw GL_REPEAT
r200SetTexMaxAnisotropy(tex 0x8db39a8) max 16.000000.
r200SetTexFilter(tex 0x8db39a8) minf GL_NEAREST_MIPMAP_LINEAR, maxf GL_LINEAR, anisotropy 128.
radeonChooseTextureFormat InternalFormat=GL_RGBA(6408) type=GL_UNSIGNED_BYTE format=GL_RGBA
radeonChooseTextureFormat do32bpt=1 force16bpt=0
radeon_teximage 2d: texObj 0x8db39a8, texImage 0x8db3c28, face 0, level 0
radeon_miptree_create(0x8aa0210) new tree is 0x8db3ca0.
compute_tex_image_offset(0x8aa0210) level 0, face 0: rs:2048 512x512 at 0
compute_tex_image_offset(0x8aa0210) level 1, face 0: rs:1024 256x256 at 1048576
compute_tex_image_offset(0x8aa0210) level 2, face 0: rs:512 128x128 at 1310720
compute_tex_image_offset(0x8aa0210) level 3, face 0: rs:256 64x64 at 1376256
compute_tex_image_offset(0x8aa0210) level 4, face 0: rs:128 32x32 at 1392640
compute_tex_image_offset(0x8aa0210) level 5, face 0: rs:64 16x16 at 1396736
compute_tex_image_offset(0x8aa0210) level 6, face 0: rs:32 8x8 at 1397760
compute_tex_image_offset(0x8aa0210) level 7, face 0: rs:32 4x4 at 1398016
compute_tex_image_offset(0x8aa0210) level 8, face 0: rs:32 2x2 at 1398144
compute_tex_image_offset(0x8aa0210) level 9, face 0: rs:32 1x1 at 1398208
calculate_miptree_layout_r100(0x8aa0210, 0x8db3ca0) total size 1398784
teximage_assign_miptree: texObj 0x8db39a8, texImage 0x8db3c28, face 0, level 0, texObj miptree doesn't match, allocated new miptree 0x8db3ca0
r200TexParameter(0x8aa5550, tex 0x8db39a8)  target GL_TEXTURE_2D, pname GL_TEXTURE_MIN_FILTER
r200SetTexMaxAnisotropy(tex 0x8db39a8) max 16.000000.
r200SetTexFilter(tex 0x8db39a8) minf GL_NEAREST, maxf GL_LINEAR, anisotropy 128.
r200TexParameter(0x8aa5550, tex 0x8db39a8)  target GL_TEXTURE_2D, pname GL_TEXTURE_MAG_FILTER
r200SetTexMaxAnisotropy(tex 0x8db39a8) max 16.000000.
r200SetTexFilter(tex 0x8db39a8) minf GL_NEAREST, maxf GL_NEAREST, anisotropy 128.
r200TexEnv( GL_TEXTURE_ENV_MODE )
r200TexParameter(0x8aa5550, tex 0x8db39a8)  target GL_TEXTURE_2D, pname GL_TEXTURE_MAX_LEVEL
radeon_render_texture(0x8aa5550, fb 0x8db3678, rrb (nil), att 0x8db3878)
radeon_wrap_texture(0x8aa5550, rrb 0x8db3f48, texImage 0x8db3c28) 
radeon_update_wrapper(0x8aa5550, rrb 0x8db3f48, texImage 0x8db3c28, texFormat MESA_FORMAT_RGBA8888_REV) 
radeon_update_wrapper(0x8aa5550, rrb 0x8db3f48, texImage 0x8db3c28, texFormat MESA_FORMAT_RGBA8888_REV) 
Begin render texture tid b72c39f0 tex=1 w=512 h=512 refcount=1
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
radeon_new_renderbuffer(0x8aa5550, rrb 0x8db3fe8) 
radeon_alloc_renderbuffer_storage(0x8aa5550, rb 0x8db3fe8) 
radeon_framebuffer_renderbuffer(0x8aa5550, fb 0x8db3678, rb 0x8db3fe8) 
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
radeon_alloc_renderbuffer_storage(0x8aa5550, rb 0x8db3fe8) 
radeon_framebuffer_renderbuffer(0x8aa5550, fb 0x8db3678, rb 0x8db3fe8) 
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
radeon_alloc_renderbuffer_storage(0x8aa5550, rb 0x8db3fe8) 
radeon_framebuffer_renderbuffer(0x8aa5550, fb 0x8db3678, rb 0x8db3fe8) 
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
radeon_validate_framebuffer: HW doesn't support format MESA_FORMAT_RGBA8888_REV as output format of attachment 0
Error: unable to get usable FBO combination!

----------

it was done with RADEON_DEBUG=tex
Comment 2 smoki 2013-01-11 02:26:22 UTC
 It fails in 8888 formats chooser, but it works for every format in firecube just fine here on rv280 if i leave in radeon_texture.c just one format in that function:

 static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa,
					   GLenum srcFormat,
					   GLenum srcType, GLboolean fbo)
{
	return _radeon_texformat_argb8888;
}

 Also 'fgl_glxgears -fbo' started to work OK and many other games. For example
frogatto fail to work because of this, now start just fine, etc.

 If someone think this is OK, i can sent a patch to mesa-dev?
Comment 3 smoki 2013-01-11 02:43:58 UTC
Created attachment 72832 [details]
fgl_glxgears -fbo on rv280
Comment 4 smoki 2013-01-11 02:45:17 UTC
Created attachment 72833 [details]
fbo_firecube on rv280
Comment 5 smoki 2013-01-11 09:50:53 UTC
 Checked with piglt fbo tests (current git master) it passes more tests: before patch it is 14/28 and after this patch it is 28/33 . Seems to be nice improvement :).
Comment 6 Andreas Boll 2013-01-11 10:07:17 UTC
Nice work!
Please send the patch to mesa-dev
Comment 7 Alex Deucher 2013-01-11 14:41:59 UTC
Possibly related to bug 51658.
Comment 8 smoki 2013-01-16 16:28:36 UTC
On Fri, Jan 11, 2013 at 6:37 AM, smoki <smoki00790 at gmail.com> wrote:
> Piglit passes more fbo tests on rv280, 14/28 before and now 28/33.
> Also should fix bug:
> https://bugs.freedesktop.org/show_bug.cgi?id=27704

Does this regress anything in piglit?  It's been a while since I
looked at this code, I think the issue may be that r1xx/r2xx asics
only support ARGB render buffers while the texture hardware supports
both ARGB and RGBA formats so you may run into cases where you can
texture from a buffer, but can't render to it, at least not without an
intermediate blit to convert the format first.

Alex

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

 I am not member on the mesa dev list, so to quick answer here :).

 No, no regress in piglit i've seen at all, only better... i even played whole Drawn 2 game: 
 http://www.drawngame.com/games/dark-flight
under wine in OpenGL mode, it works perfectly now, needs culling under fbo which is fixed now and this fix to display text and so works exactly the same as with nvidia on Windows. 

 It can further pass 2 more test in piglit if those are ported from intel:

 fbo-nodepth-test
 http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d4f2daefabdc4ca1dd778a9265475c65ef52936

 i've tried that one and it pass and maybe this for fbo-cubemap - but not tried: 

 http://cgit.freedesktop.org/mesa/mesa/commit/?id=80513ec8b4c812b9c6249cc5824337a5f04ab34c

 Now i checked supertuxkart game, it has some problems with alpha in XRGB8888 format. Under non-fbo mode kart model have black background, and under fbo models are transparent. I fixed it for non fbo case with R200_TXFORMAT_ALPHA_IN_MAP for XRGB8888 also in r200_blit, but don't know where is this format controled for fbos?  I mentoioned this because text is slightly transparent also in that Drawn game, it only works with with fbo extension in opengl mode, i guess that needs the same fix for XRGB8888 format to expect alpha under fbo, etc... But OK that can be another bug :).
Comment 9 Michel Dänzer 2013-01-16 16:37:48 UTC
(In reply to comment #8)
>  I am not member on the mesa dev list, so to quick answer here :).

You can post to the list as a non-member, your posts just go through the moderation queue then. Please don't abuse bugzilla like this.

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.