[Mesa-dev] [PATCH] virgl: fix flushing while removing sampler views
Dave Airlie
airlied at gmail.com
Fri Sep 23 20:00:38 UTC 2016
On 14 September 2016 at 04:00, <marcandre.lureau at redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau at 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 at entry=0x1c22c00,
shader_type=shader_type at 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 at entry=0x1c22c00,
shader_type=shader_type at 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 at 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 at entry=0x1c22c00,
dword=dword at entry=67075) at virgl_encode.c:43
> #5 0x00007f83893cd76b in virgl_encode_delete_object (ctx=0x1c22c00,
handle=1306480, object=object at 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 at entry=0x1c8a710,
pipeline=pipeline at 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 at entry=0x1c50600,
mode=mode at entry=4, index_bounds_valid=index_bounds_valid at entry=0 '\000',
start=start at entry=4294967295, end=end at entry=4294967295, count=count at 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?
Dave.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160924/e465dd42/attachment.html>
More information about the mesa-dev
mailing list