Hi On Sat, Sep 24, 2016 at 12:00 AM Dave Airlie <airl...@gmail.com> wrote:
> On 14 September 2016 at 04:00, <marcandre.lur...@redhat.com> wrote: > > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > > > When updating the sampler views, virgl might need to flush. After > > flushing, the resources are reattached, however, the sampler > > enabled_mask isn't yet updated, and some views could be in the process > > of being removed, which lead to the following crash: > > > > Thread 1 "heaven_x64" received signal SIGSEGV, Segmentation fault. > > 0x00007f83893cc3de in virgl_attach_res_sampler_views > > (vctx=vctx@entry=0x1c22c00, > shader_type=shader_type@entry=1) at virgl_context.c:113 > > 113 res = virgl_resource(tinfo->views[i]->base.texture); > > (gdb) bt > > #0 0x00007f83893cc3de in virgl_attach_res_sampler_views > > (vctx=vctx@entry=0x1c22c00, > shader_type=shader_type@entry=1) at virgl_context.c:113 > > #1 0x00007f83893cc703 in virgl_reemit_res (vctx=0x1c22c00) at > virgl_context.c:182 > > #2 virgl_flush_eq (ctx=ctx@entry=0x1c22c00, closure=0x1c22c00) at > virgl_context.c:637 > > #3 0x00007f83893ccbf8 in virgl_flush_from_st (ctx=0x1c22c00, > fence=<optimized out>, flags=<optimized out>) at virgl_context.c:659 > > #4 0x00007f83893cd6b0 in virgl_encoder_write_cmd_dword > > (ctx=ctx@entry=0x1c22c00, > dword=dword@entry=67075) at virgl_encode.c:43 > > #5 0x00007f83893cd76b in virgl_encode_delete_object (ctx=0x1c22c00, > handle=1306480, object=object@entry=6) at virgl_encode.c:72 > > #6 0x00007f83893ccc81 in virgl_destroy_sampler_view (ctx=<optimized > out>, view=0x7aca1b0) at virgl_context.c:741 > > #7 0x00007f83893cca17 in pipe_sampler_view_reference (view=0x0, > ptr=0x1c22fc8) at ../../../../src/gallium/auxiliary/util/u_inlines.h:151 > > #8 virgl_set_sampler_views (ctx=0x1c22c00, shader_type=1, > start_slot=<optimized out>, num_views=<optimized out>, views=<optimized > out>) at virgl_context.c:724 > > #9 0x00007f8388fffd68 in cso_set_sampler_views (ctx=0x1ca2ee0, > shader_stage=<optimized out>, count=9, views=<optimized out>) at > cso_cache/cso_context.c:1301 > > #10 0x00007f8388e670c1 in update_textures (st=<optimized out>, > mesa_shader=<optimized out>, prog=<optimized out>, max_units=16, > sampler_views=0x1c8c140, num_textures=0x1c8c644) at > state_tracker/st_atom_texture.c:465 > > #11 0x00007f8388e6296d in st_validate_state (st=st@entry=0x1c8a710, > pipeline=pipeline@entry=ST_PIPELINE_RENDER) at state_tracker/st_atom.c:289 > > #12 0x00007f8388e8343b in st_draw_vbo (ctx=0x1c50600, > prims=0x7ffe99b5a580, nr_prims=1, ib=0x7ffe99b5a560, > index_bounds_valid=<optimized out>, min_index=<optimized out>, > max_index=<optimized out>, tfb_vertcount=0x0, stream=0, > > indirect=0x0) at state_tracker/st_draw.c:176 > > #13 0x00007f8388e44d34 in vbo_validated_drawrangeelements > > (ctx=ctx@entry=0x1c50600, > mode=mode@entry=4, index_bounds_valid=index_bounds_valid@entry=0 '\000', > start=start@entry=4294967295, end=end@entry=4294967295, count=count@entry > =2688, > > type=5123, indices=0x0, basevertex=0, numInstances=1, baseInstance=0) at > vbo/vbo_exec_array.c:849 > > #14 0x00007f8388e44db5 in vbo_exec_DrawElementsInstanced (mode=4, > > #count=2688, type=5123, indices=0x0, numInstances=1) at > > #vbo/vbo_exec_array.c:1030 > > > > Instead, remove the views from enabled_mask immediately. > > Couldn't this in theory still happen a few lines up, where we are removing > things from the remaining_mask? > Right, it looks like it could happen there too, I guess you could add tinfo->enabled_mask &= ~(1 << i); there too Dave. > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > -- Marc-André Lureau
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev