diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:03:59 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 11:03:59 +0000 |
commit | 577c1a78c1ab321c4df5b5f8b402820e577dc301 (patch) | |
tree | 188bcdd93c705f4c5f18bd57befdd182ca8b8c50 /lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c | |
parent | 8c790d282ea10b253ddcb20649fcdcc54c1a003f (diff) |
Import Mesa 18.3.2
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c')
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c | 157 |
1 files changed, 28 insertions, 129 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c index b0c283d9b..e1f3c4f28 100644 --- a/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c +++ b/lib/mesa/src/gallium/auxiliary/driver_rbug/rbug_context.c @@ -63,7 +63,7 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) } else if ((rb_pipe->draw_rule.blocker & flag) && (rb_pipe->draw_blocker & RBUG_BLOCK_RULE)) { unsigned k; - bool block = false; + boolean block = FALSE; unsigned sh; debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__, @@ -76,21 +76,21 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) { if (rb_pipe->draw_rule.shader[sh] && rb_pipe->draw_rule.shader[sh] == rb_pipe->curr.shader[sh]) - block = true; + block = TRUE; } if (rb_pipe->draw_rule.surf && rb_pipe->draw_rule.surf == rb_pipe->curr.zsbuf) - block = true; + block = TRUE; if (rb_pipe->draw_rule.surf) for (k = 0; k < rb_pipe->curr.nr_cbufs; k++) if (rb_pipe->draw_rule.surf == rb_pipe->curr.cbufs[k]) - block = true; + block = TRUE; if (rb_pipe->draw_rule.texture) { for (sh = 0; sh < ARRAY_SIZE(rb_pipe->curr.num_views); sh++) { for (k = 0; k < rb_pipe->curr.num_views[sh]; k++) { if (rb_pipe->draw_rule.texture == rb_pipe->curr.texs[sh][k]) { - block = true; + block = TRUE; sh = PIPE_SHADER_TYPES; /* to break out of both loops */ break; } @@ -114,19 +114,10 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) } static void -rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *_info, - unsigned _drawid_offset, - const struct pipe_draw_indirect_info *_indirect, - const struct pipe_draw_start_count_bias *draws, - unsigned num_draws) +rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - struct pipe_draw_info info; - - info = *_info; - if(_info->index_size && !_info->has_user_indices) - info.index.resource = rbug_resource_unwrap(_info->index.resource); mtx_lock(&rb_pipe->draw_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE); @@ -136,7 +127,7 @@ rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *_info, if (!(rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] && rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT]->disabled) && !(rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] && rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY]->disabled) && !(rb_pipe->curr.shader[PIPE_SHADER_VERTEX] && rb_pipe->curr.shader[PIPE_SHADER_VERTEX]->disabled)) - pipe->draw_vbo(pipe, &info, _drawid_offset, _indirect, draws, num_draws); + pipe->draw_vbo(pipe, info); mtx_unlock(&rb_pipe->call_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER); @@ -173,13 +164,13 @@ rbug_destroy_query(struct pipe_context *_pipe, mtx_unlock(&rb_pipe->call_mutex); } -static bool +static boolean rbug_begin_query(struct pipe_context *_pipe, struct pipe_query *query) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - bool ret; + boolean ret; mtx_lock(&rb_pipe->call_mutex); ret = pipe->begin_query(pipe, query); @@ -203,15 +194,15 @@ rbug_end_query(struct pipe_context *_pipe, return ret; } -static bool +static boolean rbug_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, - bool wait, + boolean wait, union pipe_query_result *result) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - bool ret; + boolean ret; mtx_lock(&rb_pipe->call_mutex); ret = pipe->get_query_result(pipe, @@ -224,7 +215,7 @@ rbug_get_query_result(struct pipe_context *_pipe, } static void -rbug_set_active_query_state(struct pipe_context *_pipe, bool enable) +rbug_set_active_query_state(struct pipe_context *_pipe, boolean enable) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; @@ -494,7 +485,7 @@ rbug_delete_vs_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_shader *rb_shader = rbug_shader(_vs); - mtx_lock(&rb_pipe->call_mutex); + mtx_unlock(&rb_pipe->call_mutex); rbug_shader_destroy(rb_pipe, rb_shader); mtx_unlock(&rb_pipe->call_mutex); } @@ -606,7 +597,7 @@ rbug_set_blend_color(struct pipe_context *_pipe, static void rbug_set_stencil_ref(struct pipe_context *_pipe, - const struct pipe_stencil_ref stencil_ref) + const struct pipe_stencil_ref *stencil_ref) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; @@ -633,7 +624,7 @@ rbug_set_clip_state(struct pipe_context *_pipe, static void rbug_set_constant_buffer(struct pipe_context *_pipe, enum pipe_shader_type shader, - uint index, bool take_ownership, + uint index, const struct pipe_constant_buffer *_cb) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -649,7 +640,7 @@ rbug_set_constant_buffer(struct pipe_context *_pipe, mtx_lock(&rb_pipe->call_mutex); pipe->set_constant_buffer(pipe, shader, - index, take_ownership, + index, _cb ? &cb : NULL); mtx_unlock(&rb_pipe->call_mutex); } @@ -739,8 +730,6 @@ rbug_set_sampler_views(struct pipe_context *_pipe, enum pipe_shader_type shader, unsigned start, unsigned num, - unsigned unbind_num_trailing_slots, - bool take_ownership, struct pipe_sampler_view **_views) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -769,8 +758,7 @@ rbug_set_sampler_views(struct pipe_context *_pipe, views = unwrapped_views; } - pipe->set_sampler_views(pipe, shader, start, num, - unbind_num_trailing_slots, take_ownership, views); + pipe->set_sampler_views(pipe, shader, start, num, views); mtx_unlock(&rb_pipe->call_mutex); } @@ -778,8 +766,6 @@ rbug_set_sampler_views(struct pipe_context *_pipe, static void rbug_set_vertex_buffers(struct pipe_context *_pipe, unsigned start_slot, unsigned num_buffers, - unsigned unbind_num_trailing_slots, - bool take_ownership, const struct pipe_vertex_buffer *_buffers) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -801,8 +787,8 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe, } pipe->set_vertex_buffers(pipe, start_slot, - num_buffers, unbind_num_trailing_slots, - take_ownership, buffers); + num_buffers, + buffers); mtx_unlock(&rb_pipe->call_mutex); } @@ -930,7 +916,6 @@ rbug_flush_resource(struct pipe_context *_pipe, static void rbug_clear(struct pipe_context *_pipe, unsigned buffers, - const struct pipe_scissor_state *scissor_state, const union pipe_color_union *color, double depth, unsigned stencil) @@ -941,7 +926,6 @@ rbug_clear(struct pipe_context *_pipe, mtx_lock(&rb_pipe->call_mutex); pipe->clear(pipe, buffers, - scissor_state, color, depth, stencil); @@ -1015,31 +999,6 @@ rbug_flush(struct pipe_context *_pipe, mtx_unlock(&rb_pipe->call_mutex); } -static void -rbug_create_fence_fd(struct pipe_context *_pipe, - struct pipe_fence_handle **fence, int fd, - enum pipe_fd_type type) -{ - struct rbug_context *rb_pipe = rbug_context(_pipe); - struct pipe_context *pipe = rb_pipe->pipe; - - mtx_lock(&rb_pipe->call_mutex); - pipe->create_fence_fd(pipe, fence, fd, type); - mtx_unlock(&rb_pipe->call_mutex); -} - -static void -rbug_fence_server_sync(struct pipe_context *_pipe, - struct pipe_fence_handle *fence) -{ - struct rbug_context *rb_pipe = rbug_context(_pipe); - struct pipe_context *pipe = rb_pipe->pipe; - - mtx_lock(&rb_pipe->call_mutex); - pipe->fence_server_sync(pipe, fence); - mtx_unlock(&rb_pipe->call_mutex); -} - static struct pipe_sampler_view * rbug_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *_resource, @@ -1108,7 +1067,7 @@ rbug_context_surface_destroy(struct pipe_context *_pipe, static void * -rbug_context_buffer_map(struct pipe_context *_context, +rbug_context_transfer_map(struct pipe_context *_context, struct pipe_resource *_resource, unsigned level, unsigned usage, @@ -1123,34 +1082,7 @@ rbug_context_buffer_map(struct pipe_context *_context, void *map; mtx_lock(&rb_pipe->call_mutex); - map = context->buffer_map(context, - resource, - level, - usage, - box, &result); - mtx_unlock(&rb_pipe->call_mutex); - - *transfer = rbug_transfer_create(rb_pipe, rb_resource, result); - return *transfer ? map : NULL; -} - -static void * -rbug_context_texture_map(struct pipe_context *_context, - struct pipe_resource *_resource, - unsigned level, - unsigned usage, - const struct pipe_box *box, - struct pipe_transfer **transfer) -{ - struct rbug_context *rb_pipe = rbug_context(_context); - struct rbug_resource *rb_resource = rbug_resource(_resource); - struct pipe_context *context = rb_pipe->pipe; - struct pipe_resource *resource = rb_resource->resource; - struct pipe_transfer *result; - void *map; - - mtx_lock(&rb_pipe->call_mutex); - map = context->texture_map(context, + map = context->transfer_map(context, resource, level, usage, @@ -1180,7 +1112,7 @@ rbug_context_transfer_flush_region(struct pipe_context *_context, static void -rbug_context_buffer_unmap(struct pipe_context *_context, +rbug_context_transfer_unmap(struct pipe_context *_context, struct pipe_transfer *_transfer) { struct rbug_context *rb_pipe = rbug_context(_context); @@ -1189,24 +1121,7 @@ rbug_context_buffer_unmap(struct pipe_context *_context, struct pipe_transfer *transfer = rb_transfer->transfer; mtx_lock(&rb_pipe->call_mutex); - context->buffer_unmap(context, - transfer); - rbug_transfer_destroy(rb_pipe, - rb_transfer); - mtx_unlock(&rb_pipe->call_mutex); -} - -static void -rbug_context_texture_unmap(struct pipe_context *_context, - struct pipe_transfer *_transfer) -{ - struct rbug_context *rb_pipe = rbug_context(_context); - struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); - struct pipe_context *context = rb_pipe->pipe; - struct pipe_transfer *transfer = rb_transfer->transfer; - - mtx_lock(&rb_pipe->call_mutex); - context->texture_unmap(context, + context->transfer_unmap(context, transfer); rbug_transfer_destroy(rb_pipe, rb_transfer); @@ -1258,17 +1173,6 @@ rbug_context_texture_subdata(struct pipe_context *_context, mtx_unlock(&rb_pipe->call_mutex); } -static void -rbug_context_texture_barrier(struct pipe_context *_context, unsigned flags) -{ - struct rbug_context *rb_pipe = rbug_context(_context); - struct pipe_context *context = rb_pipe->pipe; - - mtx_lock(&rb_pipe->call_mutex); - context->texture_barrier(context, - flags); - mtx_unlock(&rb_pipe->call_mutex); -} struct pipe_context * rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) @@ -1343,31 +1247,26 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.set_stream_output_targets = rbug_set_stream_output_targets; rb_pipe->base.resource_copy_region = rbug_resource_copy_region; rb_pipe->base.blit = rbug_blit; + rb_pipe->base.flush_resource = rbug_flush_resource; rb_pipe->base.clear = rbug_clear; rb_pipe->base.clear_render_target = rbug_clear_render_target; rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; rb_pipe->base.flush = rbug_flush; - rb_pipe->base.create_fence_fd = rbug_create_fence_fd; - rb_pipe->base.fence_server_sync = rbug_fence_server_sync; rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; rb_pipe->base.create_surface = rbug_context_create_surface; rb_pipe->base.surface_destroy = rbug_context_surface_destroy; - rb_pipe->base.buffer_map = rbug_context_buffer_map; - rb_pipe->base.buffer_unmap = rbug_context_buffer_unmap; - rb_pipe->base.texture_map = rbug_context_texture_map; - rb_pipe->base.texture_unmap = rbug_context_texture_unmap; + rb_pipe->base.transfer_map = rbug_context_transfer_map; + rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata; rb_pipe->base.texture_subdata = rbug_context_texture_subdata; - rb_pipe->base.texture_barrier = rbug_context_texture_barrier; - rb_pipe->base.flush_resource = rbug_flush_resource; rb_pipe->pipe = pipe; rbug_screen_add_to_list(rb_screen, contexts, rb_pipe); - if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", false)) { + if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", FALSE)) { rb_pipe->draw_blocked = RBUG_BLOCK_BEFORE; } |