rbug: Use the call mutex
Fixes crashes in [soft|llvm]pipe when replacing shaders
This commit is contained in:
parent
0a6f09a76a
commit
07838ff990
|
@ -44,7 +44,10 @@ rbug_destroy(struct pipe_context *_pipe)
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
remove_from_list(&rb_pipe->list);
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->destroy(pipe);
|
||||
rb_pipe->pipe = NULL;
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
FREE(rb_pipe);
|
||||
}
|
||||
|
@ -112,10 +115,12 @@ rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info)
|
|||
pipe_mutex_lock(rb_pipe->draw_mutex);
|
||||
rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE);
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
if (!(rb_pipe->curr.fs && rb_pipe->curr.fs->disabled) &&
|
||||
!(rb_pipe->curr.gs && rb_pipe->curr.gs->disabled) &&
|
||||
!(rb_pipe->curr.vs && rb_pipe->curr.vs->disabled))
|
||||
pipe->draw_vbo(pipe, info);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER);
|
||||
pipe_mutex_unlock(rb_pipe->draw_mutex);
|
||||
|
@ -128,8 +133,10 @@ rbug_create_query(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
return pipe->create_query(pipe,
|
||||
query_type);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -139,8 +146,10 @@ rbug_destroy_query(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->destroy_query(pipe,
|
||||
query);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -150,8 +159,10 @@ rbug_begin_query(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->begin_query(pipe,
|
||||
query);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -161,8 +172,10 @@ rbug_end_query(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->end_query(pipe,
|
||||
query);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static boolean
|
||||
|
@ -173,11 +186,16 @@ rbug_get_query_result(struct pipe_context *_pipe,
|
|||
{
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
boolean ret;
|
||||
|
||||
return pipe->get_query_result(pipe,
|
||||
query,
|
||||
wait,
|
||||
result);
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = pipe->get_query_result(pipe,
|
||||
query,
|
||||
wait,
|
||||
result);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -186,9 +204,14 @@ rbug_create_blend_state(struct pipe_context *_pipe,
|
|||
{
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *ret;
|
||||
|
||||
return pipe->create_blend_state(pipe,
|
||||
blend);
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = pipe->create_blend_state(pipe,
|
||||
blend);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -198,8 +221,10 @@ rbug_bind_blend_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->bind_blend_state(pipe,
|
||||
blend);
|
||||
blend);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -209,8 +234,10 @@ rbug_delete_blend_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->delete_blend_state(pipe,
|
||||
blend);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -219,9 +246,14 @@ rbug_create_sampler_state(struct pipe_context *_pipe,
|
|||
{
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *ret;
|
||||
|
||||
return pipe->create_sampler_state(pipe,
|
||||
sampler);
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = pipe->create_sampler_state(pipe,
|
||||
sampler);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -232,9 +264,11 @@ rbug_bind_fragment_sampler_states(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->bind_fragment_sampler_states(pipe,
|
||||
num_samplers,
|
||||
samplers);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -245,9 +279,11 @@ rbug_bind_vertex_sampler_states(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->bind_vertex_sampler_states(pipe,
|
||||
num_samplers,
|
||||
samplers);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -257,8 +293,10 @@ rbug_delete_sampler_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->delete_sampler_state(pipe,
|
||||
sampler);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -267,9 +305,14 @@ rbug_create_rasterizer_state(struct pipe_context *_pipe,
|
|||
{
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *ret;
|
||||
|
||||
return pipe->create_rasterizer_state(pipe,
|
||||
rasterizer);
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = pipe->create_rasterizer_state(pipe,
|
||||
rasterizer);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -279,8 +322,10 @@ rbug_bind_rasterizer_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->bind_rasterizer_state(pipe,
|
||||
rasterizer);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -290,8 +335,10 @@ rbug_delete_rasterizer_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->delete_rasterizer_state(pipe,
|
||||
rasterizer);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -300,9 +347,14 @@ rbug_create_depth_stencil_alpha_state(struct pipe_context *_pipe,
|
|||
{
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *ret;
|
||||
|
||||
return pipe->create_depth_stencil_alpha_state(pipe,
|
||||
depth_stencil_alpha);
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = pipe->create_depth_stencil_alpha_state(pipe,
|
||||
depth_stencil_alpha);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -312,8 +364,10 @@ rbug_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->bind_depth_stencil_alpha_state(pipe,
|
||||
depth_stencil_alpha);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -323,8 +377,10 @@ rbug_delete_depth_stencil_alpha_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->delete_depth_stencil_alpha_state(pipe,
|
||||
depth_stencil_alpha);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -335,7 +391,10 @@ rbug_create_fs_state(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *result;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
result = pipe->create_fs_state(pipe, state);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
|
@ -350,10 +409,14 @@ rbug_bind_fs_state(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *fs;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
fs = rbug_shader_unwrap(_fs);
|
||||
rb_pipe->curr.fs = rbug_shader(_fs);
|
||||
pipe->bind_fs_state(pipe,
|
||||
fs);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -363,7 +426,9 @@ rbug_delete_fs_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct rbug_shader *rb_shader = rbug_shader(_fs);
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
rbug_shader_destroy(rb_pipe, rb_shader);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -374,7 +439,10 @@ rbug_create_vs_state(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *result;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
result = pipe->create_vs_state(pipe, state);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
|
@ -389,10 +457,14 @@ rbug_bind_vs_state(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *vs;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
vs = rbug_shader_unwrap(_vs);
|
||||
rb_pipe->curr.vs = rbug_shader(_vs);
|
||||
pipe->bind_vs_state(pipe,
|
||||
vs);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -402,7 +474,9 @@ rbug_delete_vs_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct rbug_shader *rb_shader = rbug_shader(_vs);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
rbug_shader_destroy(rb_pipe, rb_shader);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -413,7 +487,10 @@ rbug_create_gs_state(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *result;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
result = pipe->create_gs_state(pipe, state);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
|
@ -428,10 +505,14 @@ rbug_bind_gs_state(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *gs;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
gs = rbug_shader_unwrap(_gs);
|
||||
rb_pipe->curr.gs = rbug_shader(_gs);
|
||||
pipe->bind_gs_state(pipe,
|
||||
gs);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -441,7 +522,9 @@ rbug_delete_gs_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct rbug_shader *rb_shader = rbug_shader(_gs);
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
rbug_shader_destroy(rb_pipe, rb_shader);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -451,10 +534,15 @@ rbug_create_vertex_elements_state(struct pipe_context *_pipe,
|
|||
{
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
void *ret;
|
||||
|
||||
return pipe->create_vertex_elements_state(pipe,
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = pipe->create_vertex_elements_state(pipe,
|
||||
num_elements,
|
||||
vertex_elements);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -464,8 +552,10 @@ rbug_bind_vertex_elements_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->bind_vertex_elements_state(pipe,
|
||||
velems);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -475,8 +565,10 @@ rbug_delete_vertex_elements_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->delete_vertex_elements_state(pipe,
|
||||
velems);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -486,8 +578,10 @@ rbug_set_blend_color(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_blend_color(pipe,
|
||||
blend_color);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -497,8 +591,10 @@ rbug_set_stencil_ref(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_stencil_ref(pipe,
|
||||
stencil_ref);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -508,8 +604,10 @@ rbug_set_clip_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_clip_state(pipe,
|
||||
clip);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -529,10 +627,12 @@ rbug_set_constant_buffer(struct pipe_context *_pipe,
|
|||
resource = unwrapped_resource;
|
||||
}
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_constant_buffer(pipe,
|
||||
shader,
|
||||
index,
|
||||
resource);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -545,6 +645,9 @@ rbug_set_framebuffer_state(struct pipe_context *_pipe,
|
|||
struct pipe_framebuffer_state *state = NULL;
|
||||
unsigned i;
|
||||
|
||||
/* must protect curr status */
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
rb_pipe->curr.nr_cbufs = 0;
|
||||
memset(rb_pipe->curr.cbufs, 0, sizeof(rb_pipe->curr.cbufs));
|
||||
rb_pipe->curr.zsbuf = NULL;
|
||||
|
@ -567,6 +670,8 @@ rbug_set_framebuffer_state(struct pipe_context *_pipe,
|
|||
|
||||
pipe->set_framebuffer_state(pipe,
|
||||
state);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -576,8 +681,10 @@ rbug_set_polygon_stipple(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_polygon_stipple(pipe,
|
||||
poly_stipple);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -587,8 +694,10 @@ rbug_set_scissor_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_scissor_state(pipe,
|
||||
scissor);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -598,8 +707,10 @@ rbug_set_viewport_state(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_viewport_state(pipe,
|
||||
viewport);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -613,6 +724,9 @@ rbug_set_fragment_sampler_views(struct pipe_context *_pipe,
|
|||
struct pipe_sampler_view **views = NULL;
|
||||
unsigned i;
|
||||
|
||||
/* must protect curr status */
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
rb_pipe->curr.num_fs_views = 0;
|
||||
memset(rb_pipe->curr.fs_views, 0, sizeof(rb_pipe->curr.fs_views));
|
||||
memset(rb_pipe->curr.fs_texs, 0, sizeof(rb_pipe->curr.fs_texs));
|
||||
|
@ -629,6 +743,8 @@ rbug_set_fragment_sampler_views(struct pipe_context *_pipe,
|
|||
}
|
||||
|
||||
pipe->set_fragment_sampler_views(pipe, num, views);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -642,6 +758,9 @@ rbug_set_vertex_sampler_views(struct pipe_context *_pipe,
|
|||
struct pipe_sampler_view **views = NULL;
|
||||
unsigned i;
|
||||
|
||||
/* must protect curr status */
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
rb_pipe->curr.num_vs_views = 0;
|
||||
memset(rb_pipe->curr.vs_views, 0, sizeof(rb_pipe->curr.vs_views));
|
||||
memset(rb_pipe->curr.vs_texs, 0, sizeof(rb_pipe->curr.vs_texs));
|
||||
|
@ -658,6 +777,8 @@ rbug_set_vertex_sampler_views(struct pipe_context *_pipe,
|
|||
}
|
||||
|
||||
pipe->set_vertex_sampler_views(pipe, num, views);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -671,6 +792,8 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe,
|
|||
struct pipe_vertex_buffer *buffers = NULL;
|
||||
unsigned i;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
|
||||
if (num_buffers) {
|
||||
memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers));
|
||||
for (i = 0; i < num_buffers; i++)
|
||||
|
@ -681,6 +804,8 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe,
|
|||
pipe->set_vertex_buffers(pipe,
|
||||
num_buffers,
|
||||
buffers);
|
||||
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -697,7 +822,9 @@ rbug_set_index_buffer(struct pipe_context *_pipe,
|
|||
ib = &unwrapped_ib;
|
||||
}
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_index_buffer(pipe, ib);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -707,7 +834,9 @@ rbug_set_sample_mask(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->set_sample_mask(pipe, sample_mask);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -728,6 +857,7 @@ rbug_resource_copy_region(struct pipe_context *_pipe,
|
|||
struct pipe_resource *dst = rb_resource_dst->resource;
|
||||
struct pipe_resource *src = rb_resource_src->resource;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->resource_copy_region(pipe,
|
||||
dst,
|
||||
dst_level,
|
||||
|
@ -737,6 +867,7 @@ rbug_resource_copy_region(struct pipe_context *_pipe,
|
|||
src,
|
||||
src_level,
|
||||
src_box);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -749,11 +880,13 @@ rbug_clear(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->clear(pipe,
|
||||
buffers,
|
||||
rgba,
|
||||
depth,
|
||||
stencil);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -768,6 +901,7 @@ rbug_clear_render_target(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
struct pipe_surface *dst = rb_surface_dst->surface;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->clear_render_target(pipe,
|
||||
dst,
|
||||
rgba,
|
||||
|
@ -775,6 +909,7 @@ rbug_clear_render_target(struct pipe_context *_pipe,
|
|||
dsty,
|
||||
width,
|
||||
height);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -791,6 +926,7 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe,
|
|||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
struct pipe_surface *dst = rb_surface_dst->surface;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->clear_depth_stencil(pipe,
|
||||
dst,
|
||||
clear_flags,
|
||||
|
@ -800,6 +936,7 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe,
|
|||
dsty,
|
||||
width,
|
||||
height);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -809,8 +946,10 @@ rbug_flush(struct pipe_context *_pipe,
|
|||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct pipe_context *pipe = rb_pipe->pipe;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
pipe->flush(pipe,
|
||||
fence);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static struct pipe_sampler_view *
|
||||
|
@ -824,9 +963,11 @@ rbug_context_create_sampler_view(struct pipe_context *_pipe,
|
|||
struct pipe_resource *resource = rb_resource->resource;
|
||||
struct pipe_sampler_view *result;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
result = pipe->create_sampler_view(pipe,
|
||||
resource,
|
||||
templ);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
if (result)
|
||||
return rbug_sampler_view_create(rb_pipe, rb_resource, result);
|
||||
|
@ -852,9 +993,11 @@ rbug_context_create_surface(struct pipe_context *_pipe,
|
|||
struct pipe_resource *resource = rb_resource->resource;
|
||||
struct pipe_surface *result;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
result = pipe->create_surface(pipe,
|
||||
resource,
|
||||
surf_tmpl);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
if (result)
|
||||
return rbug_surface_create(rb_pipe, rb_resource, result);
|
||||
|
@ -865,8 +1008,13 @@ static void
|
|||
rbug_context_surface_destroy(struct pipe_context *_pipe,
|
||||
struct pipe_surface *_surface)
|
||||
{
|
||||
rbug_surface_destroy(rbug_context(_pipe),
|
||||
rbug_surface(_surface));
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct rbug_surface *rb_surface = rbug_surface(_surface);
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
rbug_surface_destroy(rb_pipe,
|
||||
rb_surface);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -884,11 +1032,13 @@ rbug_context_get_transfer(struct pipe_context *_context,
|
|||
struct pipe_resource *resource = rb_resource->resource;
|
||||
struct pipe_transfer *result;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
result = context->get_transfer(context,
|
||||
resource,
|
||||
level,
|
||||
usage,
|
||||
box);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
if (result)
|
||||
return rbug_transfer_create(rb_pipe, rb_resource, result);
|
||||
|
@ -899,8 +1049,13 @@ static void
|
|||
rbug_context_transfer_destroy(struct pipe_context *_pipe,
|
||||
struct pipe_transfer *_transfer)
|
||||
{
|
||||
rbug_transfer_destroy(rbug_context(_pipe),
|
||||
rbug_transfer(_transfer));
|
||||
struct rbug_context *rb_pipe = rbug_context(_pipe);
|
||||
struct rbug_transfer *rb_transfer =rbug_transfer(_transfer);
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
rbug_transfer_destroy(rb_pipe,
|
||||
rb_transfer);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -911,9 +1066,14 @@ rbug_context_transfer_map(struct pipe_context *_context,
|
|||
struct rbug_transfer *rb_transfer = rbug_transfer(_transfer);
|
||||
struct pipe_context *context = rb_pipe->pipe;
|
||||
struct pipe_transfer *transfer = rb_transfer->transfer;
|
||||
void *ret;
|
||||
|
||||
return context->transfer_map(context,
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
ret = context->transfer_map(context,
|
||||
transfer);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -928,9 +1088,11 @@ rbug_context_transfer_flush_region(struct pipe_context *_context,
|
|||
struct pipe_context *context = rb_pipe->pipe;
|
||||
struct pipe_transfer *transfer = rb_transfer->transfer;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
context->transfer_flush_region(context,
|
||||
transfer,
|
||||
box);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -943,8 +1105,10 @@ rbug_context_transfer_unmap(struct pipe_context *_context,
|
|||
struct pipe_context *context = rb_pipe->pipe;
|
||||
struct pipe_transfer *transfer = rb_transfer->transfer;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
context->transfer_unmap(context,
|
||||
transfer);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -963,6 +1127,7 @@ rbug_context_transfer_inline_write(struct pipe_context *_context,
|
|||
struct pipe_context *context = rb_pipe->pipe;
|
||||
struct pipe_resource *resource = rb_resource->resource;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
context->transfer_inline_write(context,
|
||||
resource,
|
||||
level,
|
||||
|
@ -971,6 +1136,7 @@ rbug_context_transfer_inline_write(struct pipe_context *_context,
|
|||
data,
|
||||
stride,
|
||||
layer_stride);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -983,7 +1149,9 @@ static void rbug_redefine_user_buffer(struct pipe_context *_context,
|
|||
struct pipe_context *context = rb_pipe->pipe;
|
||||
struct pipe_resource *resource = rb_resource->resource;
|
||||
|
||||
pipe_mutex_lock(rb_pipe->call_mutex);
|
||||
context->redefine_user_buffer(context, resource, offset, size);
|
||||
pipe_mutex_unlock(rb_pipe->call_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue