Bug 10182

Summary: _mesa_free_framebuffer_data assertion failed by GLEAN
Product: Mesa Reporter: Wei Wang <wei.z.wang>
Component: Mesa coreAssignee: mesa-dev
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: medium CC: eric, haihao.xiang, nian.wu, rankincj
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: xorg's log
xorg.conf
dereference the framebuffer

Description Wei Wang 2007-03-04 22:23:06 UTC
Env
===
Mesa: master, 95577064040ceeaaf7b0a460f91eac951cf8af18
Xserver: branch server-1.3-branch, 1182baa08ad4ca3b2beb730946284d051d4f36ed
Platform: i965, i945


Description
===========
Glean introduces the failure at the beginning of its execution and complains outht error log:

basic:  PASS rgba8, db, win+pmap, id 35
glean: main/framebuffer.c:219: _mesa_free_framebuffer_data: Assertion `fb->RefCount == 0' failed.

And the gdb stack is:
(gdb) bt
#0  0x0000003cb902f765 in raise () from /lib64/libc.so.6
#1  0x0000003cb9031050 in abort () from /lib64/libc.so.6
#2  0x0000003cb9028ed6 in __assert_fail () from /lib64/libc.so.6
#3  0x00002b9f7068c0d2 in _mesa_free_framebuffer_data (fb=0xf9e)
    at main/framebuffer.c:219
#4  0x00002b9f7068c169 in _mesa_destroy_framebuffer (fb=0xa91610)
    at main/framebuffer.c:203
#5  0x00002b9f7063abe8 in intelDestroyBuffer (driDrawPriv=Variable "driDrawPriv" is not available.
)
    at intel_screen.c:460
#6  0x00002b9f7062f836 in driDestroyDrawable (dpy=0x59ee60, drawablePrivate=Variable "drawablePrivate" is not available.
)
    at ../common/dri_util.c:710
#7  0x00002b9f7062f21f in __driGarbageCollectDrawables (drawHash=0x5a6970)
    at ../common/dri_util.c:138
#8  0x00002b9f7062f3d2 in driCreateNewContext (dpy=0x59ee60, modes=0x5a5500,
    render_type=Variable "render_type" is not available.
) at ../common/dri_util.c:837
#9  0x00002b9f6f8d43b6 in CreateContext (dpy=0x59ee60, vis=0x5a7b00,
    fbconfig=0x0, shareList=0x0, allowDirect=1, contextID=0, use_glx_1_3=0,
    renderType=0) at glxcmds.c:353
#10 0x00002b9f6f8d4755 in glXCreateContext (dpy=Variable "dpy" is not available.
) at glxcmds.c:430
#11 0x00000000004100d5 in RenderingContext (this=0x7fff3b39e8f0, ws=Variable "ws" is not available.
)
    at rc.cpp:119
#12 0x0000000000410d73 in GLEAN::BaseTest<GLEAN::BasicResult>::run (
    this=0x58f1e0, environment=Variable "environment" is not available.
) at tbase.h:277
#13 0x000000000040d116 in main (argc=3, argv=Variable "argv" is not available.
) at main.cpp:128
(gdb)
Comment 1 Wei Wang 2007-03-04 22:25:39 UTC
Created attachment 8974 [details]
xorg's log
Comment 2 Wei Wang 2007-03-04 22:26:03 UTC
Created attachment 8975 [details]
xorg.conf
Comment 3 haihao 2007-03-04 22:47:34 UTC
Created attachment 8976 [details] [review]
dereference the framebuffer

replace _mesa_destroy_framebuffer with _mesa_dereference_framebuffer since the code for framebuffer is rewritten in mesa core
Comment 4 haihao 2007-03-04 23:10:39 UTC
Other dri drivers maybe have the save issue.
Comment 5 WuNian 2007-03-05 01:16:16 UTC
In my i965 machine, if DRI is enabled, glxinfo can run normally.
If I exported LIBGL_ALWAYS_INDIRECT=1, glxinfo will report this assertion failed and crash Xorg with segmentation fault.
Comment 6 haihao 2007-03-05 19:39:38 UTC
If the fix is ok, I will check it into git.
Comment 7 Wei Tang 2007-03-05 21:50:23 UTC
the attached patch could resolution the bug. 
BTW, this bug caused by the following commit:

commit 38a88db1fc69b774ded3b7a44126e0b0f61e886b
Merge: 9f37be6... afa780c...
Author: Brian <brian@yutani.localnet.net>
Date:   Wed Feb 28 11:58:30 2007 -0700

    Merge branch 'master' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa


Comment 8 Michel Dänzer 2007-03-05 23:17:10 UTC
See the recent thread about this on the mesa3d-dev list. Brian told me he discovered additional issues with the reference counting, so the ultimate fix might look differently, but it might still be worth pushing this for now.
Comment 9 haihao 2007-03-05 23:50:47 UTC
fixed. commit:1c70cde8881f794782780cbd695da0882f78c769
Comment 10 Brian Paul 2007-03-06 09:12:38 UTC
I've just checked in my additional reference counting fixes.
Checkin a510bc3ee1a696da120c09ee4ec33dc033f671ac
Comment 11 Roland Scheidegger 2007-03-06 14:35:35 UTC
*** Bug 10201 has been marked as a duplicate of this bug. ***
Comment 12 xuji 2007-03-07 23:42:00 UTC
verified with mesa master commit:325196f548f8e46aa8fcc7b030e81ba939e7f6b7
Comment 13 Adam Jackson 2009-08-24 12:26:04 UTC
Mass version move, cvs -> git

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.