[Mesa-dev] questions about assertion hit in vmwgfx/svga driver

Chris Fester camaronut at gmail.com
Wed Oct 10 15:35:34 PDT 2012


Brian,

Thanks for the suggestion.  I will try to use the latest mesa source
as my next step.  Hopefully I won't incur the wrath of versionitis
between the guest OS and the chroot environment.  :)

Chris

On Wed, Oct 10, 2012 at 5:14 PM, Brian Paul <brianp at vmware.com> wrote:
> On 10/10/2012 04:03 PM, Chris Fester wrote:
>>
>> Hi all,
>>
>> I'm working on a project involving virtualizing a rather old Linux
>> distribution with 3D support.  Some of the details of the setup:
>>
>> Host: Ubuntu 12.04 AMD64, fglrx-updates package installed
>> -- Vmware guest: Ubuntu 12.04 32 bit, stock packages
>> ---- chrooted sandbox environment: Fedora Core 2 with gcc 3.3.3 (many
>> modifications)
>>
>> The chrooted environment properly mounts up /proc, /dev/shm, /dev/pts,
>> /sys, etc.  It also bind mounts /tmp so we get the socket for X11
>> communication, as well as /dev/dri.
>>
>> It has been a long process getting all the dependencies to compile,
>> writing a little assembly to mimic compiler built-ins, using
>> libatomicops instead of compiler built-ins, and finally getting mesa
>> to build.  But I am now able to run glxgears from within the chrooted
>> sandbox at about 100fps.  Also glxinfo reports that I do have direct
>> rendering.  Woohoo!
>>
>> All of the source that I have built has been obtained with apt-get
>> source<ubuntu package name>.  I wanted to be sure that everything
>> being compiled in the chroot was exactly the same version as what I
>> was running in the guest OS.  Specifically, the Ubuntu version of the
>> mesa source package: mesa_8.0.3+8.0.2-0ubuntu3.2.
>>
>> So the down side... I have hit an assertion in
>> src/gallium/drivers/svga/svga_resource_buffer_upload.c while running
>> my company's GL application.  The assertion details:
>>
>> src/gallium/drivers/svga/svga_resource_buffer_upload.c:591
>> assert(!sbuf->head.prev&&  !sbuf->head.next);
>>
>>
>> The prev and next pointers happen to be the same value.  They're also
>> identical to the prev and next pointers in svga->dirty_buffers.  And
>> topping it all off, the pointers all point to the location of
>> &svga->dirty_buffers.
>>
>> Below I've pasted more details from GDB.  My question is regarding the
>> linked list handling.  I've noticed in the Linux doubly-linked-list
>> implementation, the following happens on a deletion (from
>> /usr/include/linux/list.h):
>>
>> static __inline__ void list_del(struct list_head *entry)
>> {
>>          __list_del(entry->prev, entry->next);
>>          entry->next = entry->prev = 0;  //<------------------- set to 0!
>> }
>>
>> And the code from src/gallium/auxiliary/util/u_double_list.h:
>>
>> static INLINE void list_del(struct list_head *item)
>> {
>>      item->prev->next = item->next;
>>      item->next->prev = item->prev;
>> }
>>
>> Note that next and prev are not zero-ed out here.
>>
>> I also noticed this bit of code:
>> svga_resource_buffer_upload.c:290 (in svga_buffer_upload_flush()):
>>     LIST_DEL(&sbuf->head);
>> #ifdef DEBUG
>>     sbuf->head.next = sbuf->head.prev = NULL;
>> #endif
>>
>> Why the #ifdef DEBUG here?  Should the setting of next and prev to
>> NULL take place all the time?  Or should they be set to NULL in the
>> u_double_list.h header's list_del()?
>>
>> I realize that my setup is pretty unique and this assertion may be my
>> responsibility.  If the svga/list code as it stands is correct, then
>> I'd appreciate any advice on what may be incorrect in my setup  that
>> could cause the error.  If I remove the assert, the application
>> continues on happily, although I need to give it more soak time.
>>
>> Thanks for your efforts and your time!
>> Chris Fester
>>
>> GDB information (email me directly if you require more context)
>> follows.  Note that I had to replace the assert with code that would
>> generate a segfault, due to the application I am running replaces the
>> default assert mechanism and stomps on the stack :(.
>>
>> (gdb) p svga->dirty_buffers
>> $19 = {prev = 0x9563728, next = 0x9563728}
>> (gdb) p sbuf->head
>> $20 = {prev = 0x9563728, next = 0x9563728}
>> (gdb) p&svga->dirty_buffers
>>
>> $21 = (struct list_head *) 0x9563728
>>
>> (gdb) bt
>> #0  0x413e56b8 in svga_buffer_handle (svga=0x955f490, buf=0x1)
>>      at svga_resource_buffer_upload.c:597
>> #1  0x413e78d8 in svga_hwtnl_flush (hwtnl=0x9538b18) at svga_draw.c:184
>> #2  0x413eb6ed in update_state (svga=0x955f490, atoms=0x416f49e0,
>>      state=0x9563710) at svga_state.c:131
>> #3  0x413eb85f in svga_update_state (svga=0x955f490, max_level=0)
>>      at svga_state.c:209
>> #4  0x413eb8cc in svga_update_state_retry (svga=0x955f490, max_level=0)
>>      at svga_state.c:234
>> #5  0x413e96c3 in svga_draw_vbo (pipe=0x955f490, info=0xbfcc4050)
>>      at svga_pipe_draw.c:348
>> #6  0x41481521 in st_draw_vbo (ctx=0x95af2b8, arrays=0x960cc38,
>>      prims=0x960b520, nr_prims=1, ib=0x0, index_bounds_valid=0 '\0',
>>      min_index=0, max_index=4, tfb_vertcount=0x0)
>>      at state_tracker/st_draw.c:1112
>> #7  0x4152ead3 in vbo_exec_vtx_flush (exec=0x960b100, keepUnmapped=1
>> '\001')
>>      at vbo/vbo_context.h:91
>> #8  0x4152a9b2 in vbo_exec_FlushVertices_internal (exec=0x960b100,
>>      unmap=0 '\0') at vbo/vbo_exec_api.c:444
>> #9  0x4152bf8c in vbo_exec_FlushVertices (ctx=0x95af2b8, flags=4294967292)
>>      at vbo/vbo_exec_api.c:1195
>> #10 0x414fea84 in _mesa_set_enable (ctx=0x95af2b8, cap=2929, state=1
>> '\001')
>>      at main/enable.c:350
>>
>> (frame 0 - buf was optimized out, but sbuf is as follows):
>> (gdb) p *sbuf
>> $23 = {b = {b = {reference = {count = 5}, screen = 0x95488e0,
>>        target = PIPE_BUFFER, format = PIPE_FORMAT_R8_UNORM, width0 =
>> 65536,
>>        height0 = 1, depth0 = 1, array_size = 1, last_level = 0, nr_samples
>> = 0,
>>        usage = 4, bind = 16, flags = 0}, vtbl = 0x416f49a0}, swbuf = 0x0,
>>    user = 0 '\0', key = {flags = 20, format = SVGA3D_BUFFER, size = {
>>        width = 65536, height = 1, depth = 1}, numFaces = 1, numMipLevels =
>> 1,
>>      cachable = 1}, handle = 0x95f4528, map = {count = 0, ranges = {{
>>          start = 160, end = 240}, {start = 0, end = 0}<repeats 31 times>},
>>      num_ranges = 1}, uploaded = {buffer = 0x0, offset = 0, start = 0,
>>      end = 0}, hwbuf = 0x960f6e8, dma = {pending = 1 '\001', flags = {
>>        discard = 0, unsynchronized = 1, reserved = 0}, boxes = 0x9563824,
>>      svga = 0x955f490}, head = {prev = 0x9563728, next = 0x9563728}}
>>
>> (gdb) p *svga
>> $24 = {pipe = {winsys = 0x0, screen = 0x95488e0, priv = 0x0, draw =
>> 0x9539800,
>> <function pointers here>
>>      texture_barrier = 0, create_video_decoder = 0, create_video_buffer =
>> 0},
>>    swc = 0x9563738, debug = {no_swtnl = 0 '\0', force_swtnl = 0 '\0',
>>      use_min_mipmap = 0 '\0', shader_id = 4, disable_shader = 4294967295,
>>      no_line_width = 0 '\0', force_hw_line_stipple = 0 '\0'}, swtnl = {
>>      draw = 0x9539800, backend = 0x95356e8, hw_prim = 0, new_vbuf = 0
>> '\0',
>>      new_vdecl = 0 '\0'}, fs_bm = 0x95478d0, vs_bm = 0x95487d0, state = {
>>      dirty = {0, 0, 0, 4294967295}, texture_timestamp = 9, sw = {ve_format
>> = {
>>          1, 0<repeats 31 times>}, need_swvfetch = 0 '\0',
>>        need_pipeline = 0 '\0', need_swtnl = 0 '\0', in_swtnl_draw = 0
>> '\0'},
>>      hw_draw = {rs = {3452816845, 0, 3452816845, 0, 3452816845, 1,
>> 3452816845,
>>          3452816845, 0, 3452816845, 3452816845, 0, 3452816845, 0,
>> 3452816845,
>>          3452816845, 3452816845, 3452816845, 3452816845, 1065353216, 0,
>>          1117782016, 3452816845, 3452816845, 3452816845, 3452816845,
>>          3452816845, 0, 3452816845, 3452816845, 2, 0, 5, 6, 1, 1,
>>          3452816845<repeats 11 times>, 15, 3452816845, 3452816845,
>> 3452816845,
>>          3452816845, 3452816845, 3452816845, 3452816845, 0, 0, 0,
>> 3452816845,
>>          3452816845, 3452816845, 3452816845, 3452816845, 0, 0, 3452816845,
>>          3452816845, 0, 3452816845<repeats 17 times>, 0, 3452816845,
>>          3452816845, 3452816845, 3452816845, 3452816845, 3452816845,
>>          3452816845, 0, 3452816845, 3452816845, 3452816845, 3452816845,
>>          3452816845, 3452816845}, ts = {{
>>            3452816845<repeats 30 times>}<repeats 16 times>}, cb = {{{
>>              0.00249999994, 0, 0, 0}, {0, -0.00333333341, 0, 0}, {0, 0,
>> -1, 0},
>>            {-1, 1, 0, 1}, {1, 1, 0.5, 1}, {-0.00124999997, 0.00166666671,
>> 0.5,
>>              0}, {-431602080, -431602080, -431602080,
>>              -431602080}<repeats 250 times>}, {{0, 0, 0, 1}, {1, 0, 0, 0},
>> {0,
>>              0, 1, 1}, {0, 0, 0, 0.999599993}, {-431602080, -431602080,
>>              -431602080, -431602080}<repeats 252 times>}, {{-431602080,
>>              -431602080, -431602080, -431602080}<repeats 256 times>}},
>>        fs = 0x985aa68, vs = 0x985c4e8, views = {{texture = 0x0, v = 0x0,
>>            min_lod = 0, max_lod = 0, dirty = 0}<repeats 16 times>},
>>        num_views = 0}, hw_clear = {viewport = {x = 0, y = 0, w = 800, h =
>> 600},
>>        depthrange = {zmin = 0, zmax = 1}, framebuffer = {width = 0, height
>> = 0,
>>          nr_cbufs = 0, cbufs = {0x985de10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
>> 0x0},
>>          zsbuf = 0x985de68}, prescale = {translate = {-0.00124999997,
>>            0.00166666671, 0.5, 0}, scale = {1, 1, 0.5, 1},
>>          enabled = 1 '\001'}}}, curr = {blend = 0x985a860, depth =
>> 0x9860038,
>>      rast = 0x985a7e0, sampler = {0x0<repeats 16 times>}, velems =
>> 0x985bad0,
>>      sampler_views = {0x0<repeats 16 times>}, fs = 0x9859c00, vs =
>> 0x985ac88,
>>      vb = {{stride = 8, buffer_offset = 200, buffer = 0x960ed90}, {stride
>> = 0,
>>          buffer_offset = 0, buffer = 0x0}<repeats 31 times>}, ib = {
>>        index_size = 0, offset = 0, buffer = 0x0}, cb = {0x97f7450,
>> 0x960f740,
>>        0x0}, framebuffer = {width = 800, height = 600, nr_cbufs = 1, cbufs
>> = {
>>          0x985de10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, zsbuf =
>> 0x985de68},
>>      depthscale = 1.1920929e-07, nr_fbs = 1, poly_stipple = {stipple = {
>>          0<repeats 32 times>}}, scissor = {minx = 0, miny = 0, maxx = 800,
>>        maxy = 600}, blend_color = {color = {0, 0, 0, 0}}, stencil_ref = {
>>        ref_value = "\000"}, clip = {ucp = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0,
>> 0,
>>            0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
>> {0,
>>            0, 0, 0}}}, viewport = {scale = {400, -300, 0.5, 1}, translate
>> = {
>>          400, 300, 0.5, 0}}, num_samplers = 0, num_sampler_views = 0,
>>      num_vertex_buffers = 1, reduced_prim = 4, tex_flags = {flag_1d = 0,
>>        flag_srgb = 0}, any_user_vertex_buffers = 0 '\0',
>>      zero_stride_vertex_elements = 0, num_zero_stride_vertex_elements = 0,
>>      zero_stride_constants = {0<repeats 128 times>}}, dirty = 1568, rebind
>> = {
>>      rendertargets = 0, texture_samplers = 1}, upload_ib = 0x9548828,
>>    upload_vb = 0x9548850, hwtnl = 0x9538b18, sq = 0x0, dirty_buffers = {
>>      prev = 0x9563728, next = 0x9563728}}
>>
>> This all was initiated by our application doing a glEnable( GL_DEPTH_TEST
>> ).
>
>
> You might want to try the latest Mesa sources from git.  It should be easy
> to build/install in your guest if you've got the other pieces in place.
>
> Otherwise, if your app is proprietary, maybe you could make an apitrace of
> the GL calls and send it to me for testing.
>
> https://github.com/apitrace/apitrace
>
> -Brian



-- 
Oh, meltdown... It's one of these annoying buzzwords. We prefer to
call it an unrequested fission surplus.
-- Mr. Burns, The Simpsons


More information about the mesa-dev mailing list