[Mesa-dev] [PATCH 07/16] anv/cmd_buffer: return a VkResult in cmd_buffer_setup_attachments
--- src/intel/vulkan/genX_cmd_buffer.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index ae153d2..b46a922 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -381,7 +381,7 @@ transition_depth_buffer(struct anv_cmd_buffer *cmd_buffer, /** * Setup anv_cmd_state::attachments for vkCmdBeginRenderPass. */ -static void +static VkResult genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, struct anv_render_pass *pass, const VkRenderPassBeginInfo *begin) @@ -393,7 +393,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, if (pass->attachment_count == 0) { state->attachments = NULL; - return; + return VK_SUCCESS; } state->attachments = vk_alloc(_buffer->pool->alloc, @@ -402,7 +402,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (state->attachments == NULL) { /* FIXME: Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ - abort(); + return VK_ERROR_OUT_OF_HOST_MEMORY; } bool need_null_state = false; @@ -557,6 +557,8 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, anv_state_flush(cmd_buffer->device, state->render_pass_states); } + + return VK_SUCCESS; } VkResult @@ -589,6 +591,7 @@ genX(BeginCommandBuffer)( genX(cmd_buffer_emit_state_base_address)(cmd_buffer); + VkResult result = VK_SUCCESS; if (cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { cmd_buffer->state.pass = @@ -597,13 +600,13 @@ genX(BeginCommandBuffer)( _buffer->state.pass->subpasses[pBeginInfo->pInheritanceInfo->subpass]; cmd_buffer->state.framebuffer = NULL; - genX(cmd_buffer_setup_attachments)(cmd_buffer, cmd_buffer->state.pass, - NULL); + result = genX(cmd_buffer_setup_attachments)(cmd_buffer, + cmd_buffer->state.pass, NULL); cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS; } - return VK_SUCCESS; + return result; } VkResult -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/16] anv/cmd_buffer: skip vkCmdDraw*() on broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 12 1 file changed, 12 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index cbad144..c78855b 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1664,6 +1664,9 @@ void genX(CmdDraw)( struct anv_pipeline *pipeline = cmd_buffer->state.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); + if (cmd_buffer->error_status != VK_SUCCESS) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) @@ -1694,6 +1697,9 @@ void genX(CmdDrawIndexed)( struct anv_pipeline *pipeline = cmd_buffer->state.pipeline; const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); + if (cmd_buffer->error_status != VK_SUCCESS) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) @@ -1734,6 +1740,9 @@ void genX(CmdDrawIndirect)( struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; + if (cmd_buffer->error_status != VK_SUCCESS) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstance) @@ -1768,6 +1777,9 @@ void genX(CmdDrawIndexedIndirect)( struct anv_bo *bo = buffer->bo; uint32_t bo_offset = buffer->offset + offset; + if (cmd_buffer->error_status != VK_SUCCESS) + return; + genX(cmd_buffer_flush_state)(cmd_buffer); /* TODO: We need to stomp base vertex to 0 somehow */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/16] blorp: handle out of memory without crashing in various batch emissions
--- src/intel/blorp/blorp_genX_exec.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index 8f322b0..dc1b773 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -276,6 +276,8 @@ blorp_emit_vertex_buffers(struct blorp_batch *batch, const unsigned num_dwords = 1 + GENX(VERTEX_BUFFER_STATE_length) * 2; uint32_t *dw = blorp_emitn(batch, GENX(3DSTATE_VERTEX_BUFFERS), num_dwords); + if (!dw) + return; for (unsigned i = 0; i < 2; i++) { GENX(VERTEX_BUFFER_STATE_pack)(batch, dw, [i]); @@ -381,6 +383,8 @@ blorp_emit_vertex_elements(struct blorp_batch *batch, const unsigned num_dwords = 1 + GENX(VERTEX_ELEMENT_STATE_length) * num_elements; uint32_t *dw = blorp_emitn(batch, GENX(3DSTATE_VERTEX_ELEMENTS), num_dwords); + if (!dw) + return; for (unsigned i = 0; i < num_elements; i++) { GENX(VERTEX_ELEMENT_STATE_pack)(batch, dw, [i]); @@ -1021,6 +1025,9 @@ blorp_emit_depth_stencil_state(struct blorp_batch *batch, uint32_t offset = 0; uint32_t *dw = blorp_emit_dwords(batch, GENX(3DSTATE_WM_DEPTH_STENCIL_length)); + if (!dw) + return 0; + GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, dw, ); #else uint32_t offset; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/16] anv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 2c9aec8..8b752c4 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -640,6 +640,9 @@ genX(CmdExecuteCommands)( assert(primary->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); + if (primary->error_status != VK_SUCCESS) + return; + /* The secondary command buffers will assume that the PMA fix is disabled * when they begin executing. Make sure this is true. */ @@ -648,6 +651,9 @@ genX(CmdExecuteCommands)( for (uint32_t i = 0; i < commandBufferCount; i++) { ANV_FROM_HANDLE(anv_cmd_buffer, secondary, pCmdBuffers[i]); + if (secondary->error_status != VK_SUCCESS) + return; + assert(secondary->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY); if (secondary->usage_flags & -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/16] anv/cmd_buffer: track error scenarios during command buffer recording
The vkCmd*() functions do not report errors, instead, any errors should be reported by the time we call vkEndCommandBuffer(). This means that we need to track things such as "out of host memory" and use that information to avoid executing code that could lead to crashes (due to the fact that the command buffer could not allocate the memory it needs) and report the error when the client calls vkEndCommandBuffer(). Notice this patch is not sufficient to track and report all possible cases of out of host memory situations that can be produced while recording command buffers. Later patches will fix some of the missing cases. Also, some allocations may occur deep into the driver code (for example during batch emissions) and are more difficult to track because at that point we don't even have access to the command buffer object. Dealing with these scenarios would require more changes but for now this is sufficient to make CTS happy. Fixes: dEQP-VK.api.out_of_host_memory.cmd_begin_render_pass --- src/intel/vulkan/anv_cmd_buffer.c | 5 + src/intel/vulkan/anv_private.h | 7 +++ src/intel/vulkan/genX_cmd_buffer.c | 22 +++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index cab1dd7..01447b0 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -117,6 +117,8 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer) { struct anv_cmd_state *state = _buffer->state; + cmd_buffer->error_status = VK_SUCCESS; + memset(>descriptors, 0, sizeof(state->descriptors)); memset(>push_constants, 0, sizeof(state->push_constants)); memset(state->binding_tables, 0, sizeof(state->binding_tables)); @@ -185,6 +187,8 @@ static VkResult anv_create_cmd_buffer( if (cmd_buffer == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + cmd_buffer->error_status = VK_SUCCESS; + cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC; cmd_buffer->device = device; cmd_buffer->pool = pool; @@ -217,6 +221,7 @@ static VkResult anv_create_cmd_buffer( return VK_SUCCESS; fail: + cmd_buffer->error_status = result; vk_free(_buffer->pool->alloc, cmd_buffer); return result; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index d3e32bc..46b51a9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1377,6 +1377,13 @@ struct anv_cmd_buffer { VkCommandBufferLevel level; struct anv_cmd_state state; + + /** +* Current error status of the command buffer. Used to track inconsistent +* or incomplete command buffer states that are the consequence of run-time +* errors such as out of memory scenarios. +*/ + VkResult error_status; }; VkResult anv_cmd_buffer_init_batch_bo_chain(struct anv_cmd_buffer *cmd_buffer); diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index b46a922..cbad144 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -401,8 +401,8 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer, sizeof(state->attachments[0]), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (state->attachments == NULL) { - /* FIXME: Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ - return VK_ERROR_OUT_OF_HOST_MEMORY; + /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */ + return cmd_buffer->error_status = VK_ERROR_OUT_OF_HOST_MEMORY; } bool need_null_state = false; @@ -615,6 +615,9 @@ genX(EndCommandBuffer)( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); + if (cmd_buffer->error_status != VK_SUCCESS) + return cmd_buffer->error_status; + /* We want every command buffer to start with the PMA fix in a known state, * so we disable it at the end of the command buffer. */ @@ -2470,7 +2473,14 @@ void genX(CmdBeginRenderPass)( cmd_buffer->state.framebuffer = framebuffer; cmd_buffer->state.pass = pass; cmd_buffer->state.render_area = pRenderPassBegin->renderArea; - genX(cmd_buffer_setup_attachments)(cmd_buffer, pass, pRenderPassBegin); + VkResult result = + genX(cmd_buffer_setup_attachments)(cmd_buffer, pass, pRenderPassBegin); + + /* If we failed to setup the attachments we should not try to go further */ + if (result != VK_SUCCESS) { + assert(cmd_buffer->error_status != VK_SUCCESS); + return; + } genX(flush_pipeline_select_3d)(cmd_buffer); @@ -2483,6 +2493,9 @@ void genX(CmdNextSubpass)( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); + if (cmd_buffer->error_status != VK_SUCCESS) + return; + assert(cmd_buffer->level ==
[Mesa-dev] [PATCH 11/16] anv: handle out of memory situations during queue submissions
--- src/intel/vulkan/anv_batch_chain.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index d0a1b03..aae5f78 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1244,8 +1244,11 @@ anv_cmd_buffer_execbuf(struct anv_device *device, adjust_relocations_from_state_pool(ss_pool, _buffer->surface_relocs, cmd_buffer->last_ss_pool_center); - anv_execbuf_add_bo(, _pool->bo, _buffer->surface_relocs, - _buffer->pool->alloc); + VkResult result = + anv_execbuf_add_bo(, _pool->bo, _buffer->surface_relocs, + _buffer->pool->alloc); + if (result != VK_SUCCESS) + return result; /* First, we walk over all of the bos we've seen and add them and their * relocations to the validate list. @@ -1361,7 +1364,7 @@ anv_cmd_buffer_execbuf(struct anv_device *device, cmd_buffer->surface_relocs.relocs[i].presumed_offset = -1; } - VkResult result = anv_device_execbuf(device, , execbuf.bos); + result = anv_device_execbuf(device, , execbuf.bos); anv_execbuf_finish(, _buffer->pool->alloc); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 16/16] anv/cmd_buffer: handle out of device memory during binding table emission
--- src/intel/vulkan/genX_cmd_buffer.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 8b752c4..23d7493 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1112,7 +1112,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, uint32_t *bt_map = bt_state->map; if (bt_state->map == NULL) - return VK_ERROR_OUT_OF_DEVICE_MEMORY; + return cmd_buffer->error_status = VK_ERROR_OUT_OF_DEVICE_MEMORY; if (stage == MESA_SHADER_COMPUTE && get_cs_prog_data(cmd_buffer->state.compute_pipeline)->uses_num_work_groups) { @@ -1295,7 +1295,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer, *state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, size, 32); if (state->map == NULL) - return VK_ERROR_OUT_OF_DEVICE_MEMORY; + return cmd_buffer->error_status = VK_ERROR_OUT_OF_DEVICE_MEMORY; for (uint32_t s = 0; s < map->sampler_count; s++) { struct anv_pipeline_binding *binding = >sampler_to_descriptor[s]; @@ -1345,6 +1345,7 @@ flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer) if (result != VK_SUCCESS) { assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY); + cmd_buffer->error_status = VK_SUCCESS; result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); assert(result == VK_SUCCESS); @@ -1817,6 +1818,8 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer) result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE, ); if (result != VK_SUCCESS) { assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY); + + cmd_buffer->error_status = VK_SUCCESS; result = anv_cmd_buffer_new_binding_table_block(cmd_buffer); assert(result == VK_SUCCESS); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/16] anv: don't crash if we fail to grow the reloc list
--- src/intel/vulkan/anv_batch_chain.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 3f6039e..4cbfb4d 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -151,8 +151,9 @@ anv_reloc_list_add(struct anv_reloc_list *list, const uint32_t domain = target_bo->is_winsys_bo ? I915_GEM_DOMAIN_RENDER : 0; - anv_reloc_list_grow(list, alloc, 1); - /* TODO: Handle failure */ + VkResult result = anv_reloc_list_grow(list, alloc, 1); + if (result != VK_SUCCESS) + return 0; /* XXX: Can we use I915_EXEC_HANDLE_LUT? */ index = list->num_relocs++; @@ -174,8 +175,9 @@ anv_reloc_list_append(struct anv_reloc_list *list, const VkAllocationCallbacks *alloc, struct anv_reloc_list *other, uint32_t offset) { - anv_reloc_list_grow(list, alloc, other->num_relocs); - /* TODO: Handle failure */ + VkResult result = anv_reloc_list_grow(list, alloc, other->num_relocs); + if (result != VK_SUCCESS) + return; memcpy(>relocs[list->num_relocs], >relocs[0], other->num_relocs * sizeof(other->relocs[0])); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/16] anv/cmd_buffer: skip vkCmdDispatch() on broken command buffers
--- src/intel/vulkan/genX_cmd_buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index c78855b..2c9aec8 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1929,6 +1929,9 @@ void genX(CmdDispatch)( struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline; const struct brw_cs_prog_data *prog_data = get_cs_prog_data(pipeline); + if (cmd_buffer->error_status != VK_SUCCESS) + return; + if (prog_data->uses_num_work_groups) { struct anv_state state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 12, 4); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/16] anv: handle out of memory scenarios in anv_batch_emit_batch()
Fixes: dEQP-VK.api.out_of_host_memory.cmd_execute_commands --- src/intel/vulkan/anv_batch_chain.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 162ef2e..d0a1b03 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -227,8 +227,11 @@ anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other) size = other->next - other->start; assert(size % 4 == 0); - if (batch->next + size > batch->end) - batch->extend_cb(batch, batch->user_data); + if (batch->next + size > batch->end) { + VkResult result = batch->extend_cb(batch, batch->user_data); + if (result != VK_SUCCESS) + return; + } assert(batch->next + size <= batch->end); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/16] anv: do not try to ref/unref NULL shaders
This situation can happen if we failed to allocate memory for the shader. --- src/intel/vulkan/anv_private.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index c73196a..d3e32bc 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1551,6 +1551,9 @@ anv_shader_bin_destroy(struct anv_device *device, struct anv_shader_bin *shader) static inline void anv_shader_bin_ref(struct anv_shader_bin *shader) { + if (!shader) + return; + assert(shader->ref_cnt >= 1); __sync_fetch_and_add(>ref_cnt, 1); } @@ -1558,6 +1561,9 @@ anv_shader_bin_ref(struct anv_shader_bin *shader) static inline void anv_shader_bin_unref(struct anv_device *device, struct anv_shader_bin *shader) { + if (!shader) + return; + assert(shader->ref_cnt >= 1); if (__sync_fetch_and_add(>ref_cnt, -1) == 1) anv_shader_bin_destroy(device, shader); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/16] blorp: handle out of memory in blorp_emitn()
--- src/intel/blorp/blorp_genX_exec.h | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index f0c4f38..8f322b0 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -110,14 +110,16 @@ _blorp_combine_address(struct blorp_batch *batch, void *location, _blorp_cmd_pack(cmd)(batch, (void *)_dst, ), \ _dst = NULL) -#define blorp_emitn(batch, cmd, n) ({\ - uint32_t *_dw = blorp_emit_dwords(batch, n); \ - struct cmd template = {\ - _blorp_cmd_header(cmd), \ - .DWordLength = n - _blorp_cmd_length_bias(cmd), \ - }; \ - _blorp_cmd_pack(cmd)(batch, _dw, ); \ - _dw + 1; /* Array starts at dw[1] */ \ +#define blorp_emitn(batch, cmd, n) ({ \ + uint32_t *_dw = blorp_emit_dwords(batch, n); \ + if (_dw) {\ + struct cmd template = {\ +_blorp_cmd_header(cmd), \ +.DWordLength = n - _blorp_cmd_length_bias(cmd), \ + }; \ + _blorp_cmd_pack(cmd)(batch, _dw, ); \ + } \ + _dw ? _dw + 1 : NULL; /* Array starts at dw[1] */ \ }) /* 3DSTATE_URB -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/16] anv/blorp: return early if we failed to create the shader binary
--- src/intel/vulkan/anv_blorp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index d79c5e0..c871f03 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -72,6 +72,9 @@ upload_blorp_shader(struct blorp_context *blorp, key, key_size, kernel, kernel_size, prog_data, prog_data_size, _map); + if (!bin) + return; + /* The cache already has a reference and it's not going anywhere so there * is no need to hold a second reference. */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/16] anv: ensure that we don't ever try to adjust relocations more than once
There is a CTS tests that creates that situation by forcing OOM during a queue submision and then trying again without the OOM enforcement. The driver returns the appropriate out of memory error on the first try, but the relocations had already been computed and stored, so in the second attempt, we duplicate the deltas and end up with offsets outside the BO limits. Fixes: dEQP-VK.api.out_of_host_memory.complex --- src/intel/vulkan/anv_batch_chain.c | 12 ++-- src/intel/vulkan/anv_cmd_buffer.c | 2 ++ src/intel/vulkan/anv_private.h | 6 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index aae5f78..7df4ef2 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1242,8 +1242,16 @@ anv_cmd_buffer_execbuf(struct anv_device *device, struct anv_execbuf execbuf; anv_execbuf_init(); - adjust_relocations_from_state_pool(ss_pool, _buffer->surface_relocs, - cmd_buffer->last_ss_pool_center); + /* Remember if we have adjusted the relocation offsets so we only ever do +* this once +*/ + struct anv_cmd_state *state = _buffer->state; + if (!state->adjusted_relocation_offsets) { + adjust_relocations_from_state_pool(ss_pool, _buffer->surface_relocs, + cmd_buffer->last_ss_pool_center); + state->adjusted_relocation_offsets = true; + } + VkResult result = anv_execbuf_add_bo(, _pool->bo, _buffer->surface_relocs, _buffer->pool->alloc); diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index dd5e6c8..adc7c19 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -142,6 +142,7 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer) state->need_query_wa = true; state->pma_fix_enabled = false; state->hiz_enabled = false; + state->adjusted_relocation_offsets = false; if (state->attachments != NULL) { vk_free(_buffer->pool->alloc, state->attachments); @@ -198,6 +199,7 @@ static VkResult anv_create_cmd_buffer( cmd_buffer->pool = pool; cmd_buffer->level = level; cmd_buffer->state.attachments = NULL; + cmd_buffer->state.adjusted_relocation_offsets = false; result = anv_cmd_buffer_init_batch_bo_chain(cmd_buffer); if (result != VK_SUCCESS) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 46b51a9..15d1401 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1309,6 +1309,12 @@ struct anv_cmd_state { */ struct anv_state null_surface_state; + /** +* A flag indicating whether we have adjusted relation offsets for this +* command buffer. +*/ + bool adjusted_relocation_offsets; + struct { struct anv_buffer * index_buffer; uint32_t index_type; /**< 3DSTATE_INDEX_BUFFER.IndexFormat */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/16] anv: handle out of memory situations in anv_batch_emit_dwords()
--- src/intel/vulkan/anv_batch_chain.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 4cbfb4d..162ef2e 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -197,8 +197,11 @@ anv_reloc_list_append(struct anv_reloc_list *list, void * anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords) { - if (batch->next + num_dwords * 4 > batch->end) - batch->extend_cb(batch, batch->user_data); + if (batch->next + num_dwords * 4 > batch->end) { + VkResult result = batch->extend_cb(batch, batch->user_data); + if (result != VK_SUCCESS) + return NULL; + } void *p = batch->next; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/16] anv/cmd_buffer: handle out of memory during vkCmdPushConstants
Fixes: dEQP-VK.api.out_of_host_memory.cmd_push_constants --- src/intel/vulkan/anv_cmd_buffer.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 01447b0..dd5e6c8 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -160,13 +160,17 @@ anv_cmd_buffer_ensure_push_constants_size(struct anv_cmd_buffer *cmd_buffer, if (*ptr == NULL) { *ptr = vk_alloc(_buffer->pool->alloc, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (*ptr == NULL) + if (*ptr == NULL) { + cmd_buffer->error_status = VK_ERROR_OUT_OF_HOST_MEMORY; return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + } } else if ((*ptr)->size < size) { *ptr = vk_realloc(_buffer->pool->alloc, *ptr, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (*ptr == NULL) + if (*ptr == NULL) { + cmd_buffer->error_status = VK_ERROR_OUT_OF_HOST_MEMORY; return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + } } (*ptr)->size = size; @@ -730,7 +734,11 @@ void anv_CmdPushConstants( ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); anv_foreach_stage(stage, stageFlags) { - anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, stage, client_data); + VkResult result = + anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, + stage, client_data); + if (result != VK_SUCCESS) + return; memcpy(cmd_buffer->state.push_constants[stage]->client_data + offset, pValues, size); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/16] anv: Handle out of memory situations better
There are a number of work-in-progress CTS tests that check OOM handling and raised a number of issues that this series addresses. Particularly noteworthy is the case of command buffer recording: since the various vkCmd*() functions do not return errors, it is expected that drivers survive until vkEndCommanBuffer() and report any errors at that point. This requires that we are particularly careful with out of memory scenarios, since we need to make sure that vkCmd*() commands do not attempt to access memory that we have failed to allocate in a previous step. We achieve this by tracking errors generated during command buffer recording into the command buffer object and, generally, avoiding to execute new vkCmd*() functions if the command buffer recording has generated an error before. In general, I tried to only guard execution of vkCmd*() commands that the tests showed needed to be guarded since most of the vkCmd*() commands are safe to execute in any scenario. This series fixes all the issues raised with the new tests and a few more that I found by inspection but I am sure we could do better in more places. It is a first step though and the tests are still in development. Iago Toral Quiroga (16): blorp: handle out of memory in blorp_emitn() blorp: handle out of memory without crashing in various batch emissions anv: don't crash if we fail to grow the reloc list anv: handle out of memory situations in anv_batch_emit_dwords() anv: do not try to ref/unref NULL shaders anv/blorp: return early if we failed to create the shader binary anv/cmd_buffer: return a VkResult in cmd_buffer_setup_attachments anv/cmd_buffer: track error scenarios during command buffer recording anv: handle out of memory scenarios in anv_batch_emit_batch() anv/cmd_buffer: handle out of memory during vkCmdPushConstants anv: handle out of memory situations during queue submissions anv: ensure that we don't ever try to adjust relocations more than once anv/cmd_buffer: skip vkCmdDraw*() on broken command buffers anv/cmd_buffer: skip vkCmdDispatch() on broken command buffers anv/cmd_buffer: skip vkCmdExecuteCommands() on broken command buffers anv/cmd_buffer: handle out of device memory during binding table emission src/intel/blorp/blorp_genX_exec.h | 25 ++- src/intel/vulkan/anv_batch_chain.c | 45 +++ src/intel/vulkan/anv_blorp.c | 3 ++ src/intel/vulkan/anv_cmd_buffer.c | 21 +++-- src/intel/vulkan/anv_private.h | 19 src/intel/vulkan/genX_cmd_buffer.c | 63 -- 6 files changed, 142 insertions(+), 34 deletions(-) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radv: disabled scaled formats for transfers.
From: Dave AirlieThese really are only supported for vertex buffers. Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_formats.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 3742dcf..9b21e04 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -498,7 +498,7 @@ static bool radv_is_storage_image_format_supported(struct radv_physical_device * } } -static bool radv_is_buffer_format_supported(VkFormat format) +static bool radv_is_buffer_format_supported(VkFormat format, bool *scaled) { const struct vk_format_description *desc = vk_format_description(format); unsigned data_format, num_format; @@ -510,6 +510,7 @@ static bool radv_is_buffer_format_supported(VkFormat format) num_format = radv_translate_buffer_numformat(desc, vk_format_get_first_non_void_channel(format)); + *scaled = (num_format == V_008F0C_BUF_NUM_FORMAT_SSCALED) || (num_format == V_008F0C_BUF_NUM_FORMAT_USCALED); return data_format != V_008F0C_BUF_DATA_FORMAT_INVALID && num_format != ~0; } @@ -547,6 +548,7 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical VkFormatFeatureFlags linear = 0, tiled = 0, buffer = 0; const struct vk_format_description *desc = vk_format_description(format); bool blendable; + bool scaled = false; if (!desc) { out_properties->linearTilingFeatures = linear; out_properties->optimalTilingFeatures = tiled; @@ -559,10 +561,11 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical linear |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; } - if (radv_is_buffer_format_supported(format)) { - buffer |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT | - VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | - VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT; + if (radv_is_buffer_format_supported(format, )) { + buffer |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT; + if (!scaled) + buffer |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT | + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT; } if (vk_format_is_depth_or_stencil(format)) { @@ -594,13 +597,13 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical tiled |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; } } - if (util_is_power_of_two(vk_format_get_blocksize(format))) { + if (util_is_power_of_two(vk_format_get_blocksize(format)) && !scaled) { tiled |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR | VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR; } } - if (util_is_power_of_two(vk_format_get_blocksize(format))) { + if (util_is_power_of_two(vk_format_get_blocksize(format)) && !scaled) { linear |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR | VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 25/25] gallium: implement the backend of threaded GL dispatch
From: Marek Olšák--- src/gallium/include/state_tracker/st_api.h | 19 +++ src/gallium/state_trackers/dri/dri_context.c| 10 ++ src/gallium/state_trackers/dri/dri_drawable.c | 6 ++ src/gallium/state_trackers/dri/dri_screen.c | 21 + src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 src/mesa/state_tracker/st_context.c | 13 + src/mesa/state_tracker/st_manager.c | 19 +++ 7 files changed, 92 insertions(+) diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index a999774..bf9a7e9 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -410,20 +410,33 @@ struct st_context_iface boolean (*share)(struct st_context_iface *stctxi, struct st_context_iface *stsrci); /** * Look up and return the info of a resource for EGLImage. * * This function is optional. */ boolean (*get_resource_for_egl_image)(struct st_context_iface *stctxi, struct st_context_resource *stres); + + /** +* Start the thread if the API has a worker thread. +* Called after the context has been created and fully initialized on both +* sides (e.g. st/mesa and st/dri). +*/ + void (*start_thread)(struct st_context_iface *stctxi); + + /** +* If the API is multithreaded, wait for all queued commands to complete. +* Called from the main thread. +*/ + void (*thread_finish)(struct st_context_iface *stctxi); }; /** * Represent a state tracker manager. * * This interface is implemented by the state tracker manager. It corresponds * to a "display" in the window system. */ struct st_manager @@ -447,20 +460,26 @@ struct st_manager */ boolean (*get_egl_image)(struct st_manager *smapi, void *egl_image, struct st_egl_image *out); /** * Query an manager param. */ int (*get_param)(struct st_manager *smapi, enum st_manager_param param); + + /** +* Call the loader function setBackgroundContext. Called from the worker +* thread. +*/ + void (*set_background_context)(struct st_context_iface *stctxi); }; /** * Represent a rendering API such as OpenGL or OpenVG. * * Implemented by the state tracker and used by the state tracker manager. */ struct st_api { /** diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 3d8af65..91d2d1f 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -149,20 +149,27 @@ dri_create_context(gl_api api, const struct gl_config * visual, goto fail; } ctx->st->st_manager_private = (void *) ctx; ctx->stapi = stapi; if (ctx->st->cso_context) { ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context); ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context); } + /* Do this last. */ + if (ctx->st->start_thread && + /* the driver loader must implement this */ + screen->sPriv->dri2.backgroundCallable && + driQueryOptionb(>optionCache, "mesa_glthread")) + ctx->st->start_thread(ctx->st); + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; fail: if (ctx && ctx->st) ctx->st->destroy(ctx->st); free(ctx); return GL_FALSE; } @@ -215,20 +222,23 @@ GLboolean dri_make_current(__DRIcontext * cPriv, __DRIdrawable * driDrawPriv, __DRIdrawable * driReadPriv) { /* dri_util.c ensures cPriv is not null */ struct dri_context *ctx = dri_context(cPriv); struct dri_drawable *draw = dri_drawable(driDrawPriv); struct dri_drawable *read = dri_drawable(driReadPriv); struct st_context_iface *old_st = ctx->stapi->get_current(ctx->stapi); + if (old_st && old_st->thread_finish) + old_st->thread_finish(old_st); + /* Flush the old context here so we don't have to flush on unbind() */ if (old_st && old_st != ctx->st) old_st->flush(old_st, ST_FLUSH_FRONT, NULL); ++ctx->bind_count; if (!draw && !read) return ctx->stapi->make_current(ctx->stapi, ctx->st, NULL, NULL); else if (!draw || !read) return GL_FALSE; diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index fd3b458..3c2e307 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -210,23 +210,27 @@ dri_drawable_validate_att(struct dri_context *ctx, } /** * These are used for GLX_EXT_texture_from_pixmap */ static void dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, GLint format, __DRIdrawable *dPriv)
[Mesa-dev] [PATCH 12/25] Revert "mesa: make _mesa_alloc_dispatch_table() static"
From: Marek OlšákThis reverts commit 4009d22b61e76850b1b725f4e491da05c2406fa4. glthread needs it. --- src/mesa/main/api_exec.h | 4 src/mesa/main/context.c | 10 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h index 655cb32..f55f56b 100644 --- a/src/mesa/main/api_exec.h +++ b/src/mesa/main/api_exec.h @@ -23,22 +23,26 @@ */ #ifndef API_EXEC_H #define API_EXEC_H #ifdef __cplusplus extern "C" { #endif +struct _glapi_table; struct gl_context; +extern struct _glapi_table * +_mesa_alloc_dispatch_table(void); + extern void _mesa_initialize_exec_table(struct gl_context *ctx); extern void _mesa_initialize_dispatch_tables(struct gl_context *ctx); extern struct _glapi_table * _mesa_new_nop_table(unsigned numEntries); #ifdef __cplusplus diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4b654de..0a9c65c 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -992,22 +992,22 @@ _mesa_new_nop_table(unsigned numEntries) #endif return table; } /** * Allocate and initialize a new dispatch table. The table will be * populated with pointers to "no-op" functions. In turn, the no-op * functions will call nop_handler() above. */ -static struct _glapi_table * -alloc_dispatch_table(void) +struct _glapi_table * +_mesa_alloc_dispatch_table(void) { /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI * Mesa we do this to accommodate different versions of libGL and various * DRI drivers. */ int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); struct _glapi_table *table = _mesa_new_nop_table(numEntries); @@ -1065,21 +1065,21 @@ alloc_dispatch_table(void) * * The table entries for specifying vertex attributes are set up by * install_vtxfmt() and _mesa_loopback_init_api_table(), and End() and dlists * are set by install_vtxfmt() as well. */ static struct _glapi_table * create_beginend_table(const struct gl_context *ctx) { struct _glapi_table *table; - table = alloc_dispatch_table(); + table = _mesa_alloc_dispatch_table(); if (!table) return NULL; /* Fill in functions which return a value, since they should return some * specific value even if they emit a GL_INVALID_OPERATION error from them * being called within glBegin()/glEnd(). */ #define COPY_DISPATCH(func) SET_##func(table, GET_##func(ctx->Exec)) COPY_DISPATCH(GenLists); @@ -1202,21 +1202,21 @@ _mesa_initialize_context(struct gl_context *ctx, if (!shared) return GL_FALSE; } _mesa_reference_shared_state(ctx, >Shared, shared); if (!init_attrib_groups( ctx )) goto fail; /* setup the API dispatch tables with all nop functions */ - ctx->OutsideBeginEnd = alloc_dispatch_table(); + ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(); if (!ctx->OutsideBeginEnd) goto fail; ctx->Exec = ctx->OutsideBeginEnd; ctx->CurrentClientDispatch = ctx->CurrentServerDispatch = ctx->OutsideBeginEnd; ctx->FragmentProgram._MaintainTexEnvProgram = (getenv("MESA_TEX_PROG") != NULL); ctx->VertexProgram._MaintainTnlProgram = (getenv("MESA_TNL_PROG") != NULL); @@ -1229,21 +1229,21 @@ _mesa_initialize_context(struct gl_context *ctx, * Drivers will want to override this list with just the formats * they can handle, and confirm that appropriate fallbacks exist in * _mesa_choose_tex_format(). */ memset(>TextureFormatSupported, GL_TRUE, sizeof(ctx->TextureFormatSupported)); switch (ctx->API) { case API_OPENGL_COMPAT: ctx->BeginEnd = create_beginend_table(ctx); - ctx->Save = alloc_dispatch_table(); + ctx->Save = _mesa_alloc_dispatch_table(); if (!ctx->BeginEnd || !ctx->Save) goto fail; /* fall-through */ case API_OPENGL_CORE: break; case API_OPENGLES: /** * GL_OES_texture_cube_map says * "Initially all texture generation modes are set to REFLECTION_MAP_OES" -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 16/25] glapi: Mark vertex attrib pointer functions as async.
From: Eric AnholtThese don't actually read data out of the pointers, they set the pointers (or offsets in a VBO) to be used in a later draw call. v2: Don't forget glVertexAttribIPointer, and don't bother with annotations on aliases. --- src/mapi/glapi/gen/GL3x.xml | 2 +- src/mapi/glapi/gen/gl_API.xml | 30 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mapi/glapi/gen/GL3x.xml b/src/mapi/glapi/gen/GL3x.xml index 6b91945..65f12a4 100644 --- a/src/mapi/glapi/gen/GL3x.xml +++ b/src/mapi/glapi/gen/GL3x.xml @@ -249,21 +249,21 @@ - + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 0da1589..c0e7c38 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -3146,21 +3146,21 @@ - + @@ -3174,67 +3174,67 @@ - + - + - + - + - + @@ -4709,21 +4709,21 @@ - + @@ -4845,21 +4845,21 @@ - + @@ -5799,21 +5799,21 @@ - + @@ -9172,73 +9172,73 @@ - + - + - + - + - + - + -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 17/25] mesa: Statically allocate glthread command buffer in the batch struct.
From: Eric AnholtThis avoids an extra pointer dereference in the marshalling functions, which, with the instruction count doing in the low 30s, could actually matter for main-thread performance. --- src/mesa/main/glthread.c | 5 ++--- src/mesa/main/glthread.h | 8 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index c4d1031..8f300d4 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -38,39 +38,38 @@ #include "main/marshal_generated.h" #ifdef HAVE_PTHREAD static void glthread_allocate_batch(struct gl_context *ctx) { struct glthread_state *glthread = ctx->GLThread; /* TODO: handle memory allocation failure. */ - glthread->batch = calloc(1, sizeof(*glthread->batch)); + glthread->batch = malloc(sizeof(*glthread->batch)); if (!glthread->batch) return; - glthread->batch->buffer = malloc(MARSHAL_MAX_CMD_SIZE); + memset(glthread->batch, 0, offsetof(struct glthread_batch, buffer)); } static void glthread_unmarshal_batch(struct gl_context *ctx, struct glthread_batch *batch) { size_t pos = 0; _glapi_set_dispatch(ctx->CurrentServerDispatch); while (pos < batch->used) pos += _mesa_unmarshal_dispatch_cmd(ctx, >buffer[pos]); assert(pos == batch->used); - free(batch->buffer); free(batch); } static void * glthread_worker(void *data) { struct gl_context *ctx = data; struct glthread_state *glthread = ctx->GLThread; ctx->Driver.SetBackgroundContext(ctx); diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index c38fef3..98ae115 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -87,28 +87,28 @@ struct glthread_state */ struct glthread_batch { /** * Next batch of commands to execute after this batch, or NULL if this is * the last set of commands queued. Protected by ctx->Marshal.Mutex. */ struct glthread_batch *next; /** -* Points to the first command in the batch. +* Amount of data used by batch commands, in bytes. */ - uint8_t *buffer; + size_t used; /** -* Amount of data used by batch commands, in bytes. +* Data contained in the command buffer. */ - size_t used; + uint8_t buffer[MARSHAL_MAX_CMD_SIZE]; }; void _mesa_glthread_init(struct gl_context *ctx); void _mesa_glthread_destroy(struct gl_context *ctx); void _mesa_glthread_flush_batch(struct gl_context *ctx); void _mesa_glthread_finish(struct gl_context *ctx); #else /* HAVE_PTHREAD */ -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 22/25] mesa: Track the current vertex/element array buffers for glthread.
From: Eric AnholtWe want to support glthread on GLES contexts with reasonable apps, and on desktop for apps that use VBOs but haven't completely moved to core GL. To do so, we have to deal with the "the user may or may not pass user pointers to draw calls" problem. --- src/mapi/glapi/gen/ARB_base_instance.xml | 9 +- .../glapi/gen/ARB_draw_elements_base_vertex.xml| 12 ++- src/mapi/glapi/gen/ARB_draw_instanced.xml | 3 +- src/mapi/glapi/gen/ARB_vertex_array_object.xml | 3 +- src/mapi/glapi/gen/GL3x.xml| 3 +- src/mapi/glapi/gen/gl_API.xml | 59 src/mapi/glapi/gen/gl_marshal.py | 4 - src/mesa/main/glthread.h | 12 +++ src/mesa/main/marshal.c| 103 + src/mesa/main/marshal.h| 57 10 files changed, 231 insertions(+), 34 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_base_instance.xml b/src/mapi/glapi/gen/ARB_base_instance.xml index 5bd6cab..e3bbcd1 100644 --- a/src/mapi/glapi/gen/ARB_base_instance.xml +++ b/src/mapi/glapi/gen/ARB_base_instance.xml @@ -1,38 +1,41 @@ - + - + - + diff --git a/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml b/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml index 7c7a6a4..2f1a93d 100644 --- a/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml +++ b/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml @@ -1,48 +1,52 @@ - + - + - + - + diff --git a/src/mapi/glapi/gen/ARB_draw_instanced.xml b/src/mapi/glapi/gen/ARB_draw_instanced.xml index 52dba3c..8d7fd63 100644 --- a/src/mapi/glapi/gen/ARB_draw_instanced.xml +++ b/src/mapi/glapi/gen/ARB_draw_instanced.xml @@ -8,21 +8,22 @@ - + diff --git a/src/mapi/glapi/gen/ARB_vertex_array_object.xml b/src/mapi/glapi/gen/ARB_vertex_array_object.xml index 4a392db..4f21137 100644 --- a/src/mapi/glapi/gen/ARB_vertex_array_object.xml +++ b/src/mapi/glapi/gen/ARB_vertex_array_object.xml @@ -3,21 +3,22 @@ - + diff --git a/src/mapi/glapi/gen/GL3x.xml b/src/mapi/glapi/gen/GL3x.xml index 65f12a4..b603e1f 100644 --- a/src/mapi/glapi/gen/GL3x.xml +++ b/src/mapi/glapi/gen/GL3x.xml @@ -249,21 +249,22 @@ - + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index ae1c9ea..c94 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -3146,95 +3146,102 @@ - + - + - + - + - + - + - + @@ -3723,21 +3730,22 @@ - + @@ -4709,21 +4717,22 @@ - + @@ -4845,21 +4854,22 @@ - + @@ -5010,21 +5020,21 @@ - + @@ -5799,21 +5809,22 @@ - + @@ -9172,73 +9183,79 @@ -
[Mesa-dev] [PATCH 23/25] mesa/glthread: don't set a dispatch table if we aren't the owner
From: Gregory HainautFix crashes when glxMakeCurrent is called. Signed-off-by: Gregory Hainaut Signed-off-by: Marek Olšák --- src/mesa/main/glthread.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index 8f300d4..8ee7d8d 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -166,23 +166,30 @@ _mesa_glthread_destroy(struct gl_context *ctx) * point, and no batches queued. */ assert(!glthread->batch->used); assert(!glthread->batch->next); free(glthread->batch); assert(!glthread->batch_queue); free(glthread); ctx->GLThread = NULL; - /* Remove ourselves from the dispatch table. */ - ctx->CurrentClientDispatch = ctx->CurrentServerDispatch; - _glapi_set_dispatch(ctx->CurrentClientDispatch); + /* Remove ourselves from the dispatch table except if another ctx/thread +* already installed a new dispatch table. +* +* Typically glxMakeCurrent will bind a new context (install new table) then +* old context might be deleted. +*/ + if (_glapi_get_dispatch() == ctx->MarshalExec) { + ctx->CurrentClientDispatch = ctx->CurrentServerDispatch; + _glapi_set_dispatch(ctx->CurrentClientDispatch); + } } void _mesa_glthread_flush_batch(struct gl_context *ctx) { struct glthread_state *glthread = ctx->GLThread; struct glthread_batch *batch; if (!glthread) return; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 24/25] mesa/glthread: restore the dispatch table when incompatible gl calls are detected
From: Gregory HainautWhile a context only has a single glthread, the context itself can be attached to several threads. Therefore the dispatch table must be updated in all threads before the destruction of glthread. In others words, glthread can only be destroyed safely when the context is deleted. Fixes remaining crashes in the glx-multithread-makecurrent* tests. V2: (Timothy Arceri) updated gl_API.dtd marshal_fail description. Signed-off-by: Gregory Hainaut --- src/mapi/glapi/gen/gl_API.dtd| 6 +++--- src/mapi/glapi/gen/gl_marshal.py | 3 ++- src/mesa/main/glthread.c | 8 src/mesa/main/glthread.h | 7 +++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd index dc4a199..b464250 100644 --- a/src/mapi/glapi/gen/gl_API.dtd +++ b/src/mapi/glapi/gen/gl_API.dtd @@ -124,23 +124,23 @@ param: "width" field in the protocol for TexImage1D. marshal - One of "sync", "async", "draw", or "custom", defaulting to async unless one of the arguments is something we know we can't codegen for. If "sync", we finish any queued glthread work and call the Mesa implementation directly. If "async", we queue the function call to be performed by glthread. If "custom", the prototype will be generated but a custom implementation will be present in marshal.c. If "draw", it will follow the "async" rules except that "indices" are ignored (since they may come from a VBO). marshal_fail - an expression that, if it evaluates true, causes glthread -to finish and tear down before the Mesa implementation is called -directly. Used to disable glthread for GL compatibility interactions -that we don't want to track state for. +to switch back to the Mesa implementation and call it directly. Used +to disable glthread for GL compatibility interactions that we don't +want to track state for. glx: rop - Opcode value for "render" commands sop - Opcode value for "single" commands vendorpriv - Opcode value for vendor private (or vendor private with reply) commands large - set to "true" of the render command can use RenderLarge protocol. doubles_in_order - older commands always put GLdouble data at the start of the render packet. Newer commands (e.g., ProgramEnvParameter4dvARB) put the in the order that they appear diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 1652759..d73f08b 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -232,21 +232,22 @@ class PrintCode(gl_XML.gl_print_base): out('size_t cmd_size = {0};'.format(' + '.join(size_terms))) out('{0} *cmd;'.format(struct)) out('debug_print_marshal("{0}");'.format(func.name)) self.validate_count_or_return(func) if func.marshal_fail: out('if ({0}) {{'.format(func.marshal_fail)) with indent(): -out('_mesa_glthread_destroy(ctx);') +out('_mesa_glthread_finish(ctx);') +out('_mesa_glthread_restore_dispatch(ctx);') self.print_sync_dispatch(func) out('return;') out('}') out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {') with indent(): self.print_async_dispatch(func) out('} else {') with indent(): self.print_sync_dispatch(func) diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index 8ee7d8d..d2ce0ff 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -166,20 +166,28 @@ _mesa_glthread_destroy(struct gl_context *ctx) * point, and no batches queued. */ assert(!glthread->batch->used); assert(!glthread->batch->next); free(glthread->batch); assert(!glthread->batch_queue); free(glthread); ctx->GLThread = NULL; + _mesa_glthread_restore_dispatch(ctx); + + puts(__func__); +} + +void +_mesa_glthread_restore_dispatch(struct gl_context *ctx) +{ /* Remove ourselves from the dispatch table except if another ctx/thread * already installed a new dispatch table. * * Typically glxMakeCurrent will bind a new context (install new table) then * old context might be deleted. */ if (_glapi_get_dispatch() == ctx->MarshalExec) { ctx->CurrentClientDispatch = ctx->CurrentServerDispatch; _glapi_set_dispatch(ctx->CurrentClientDispatch); } diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 04eb5ff..327c549 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -112,31 +112,38 @@ struct glthread_batch /** * Data contained in the
[Mesa-dev] [PATCH 13/25] mesa: Connect the generated GL command marshalling code to the build.
From: Eric Anholtv2: Rebase on the Begin/End changes, and just disable this feature on non-GL-core. v3: (Timothy Arceri) enable for non-GL-core contexts. Remove unrelated safe_mul() hunk. while loop style fix. --- src/mesa/Makefile.sources | 2 ++ src/mesa/main/glthread.c | 15 +++ 2 files changed, 17 insertions(+) diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index b2d0783..134d5e9 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -125,20 +125,22 @@ MAIN_FILES = \ main/histogram.h \ main/image.c \ main/image.h \ main/imports.c \ main/imports.h \ main/light.c \ main/light.h \ main/lines.c \ main/lines.h \ main/macros.h \ + main/marshal_generated.c \ + main/marshal_generated.h \ main/matrix.c \ main/matrix.h \ main/mipmap.c \ main/mipmap.h \ main/mm.c \ main/mm.h \ main/mtypes.h \ main/multisample.c \ main/multisample.h \ main/objectlabel.c \ diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index 8877a69..c4d1031 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -47,22 +47,29 @@ glthread_allocate_batch(struct gl_context *ctx) /* TODO: handle memory allocation failure. */ glthread->batch = calloc(1, sizeof(*glthread->batch)); if (!glthread->batch) return; glthread->batch->buffer = malloc(MARSHAL_MAX_CMD_SIZE); } static void glthread_unmarshal_batch(struct gl_context *ctx, struct glthread_batch *batch) { + size_t pos = 0; + _glapi_set_dispatch(ctx->CurrentServerDispatch); + while (pos < batch->used) + pos += _mesa_unmarshal_dispatch_cmd(ctx, >buffer[pos]); + + assert(pos == batch->used); + free(batch->buffer); free(batch); } static void * glthread_worker(void *data) { struct gl_context *ctx = data; struct glthread_state *glthread = ctx->GLThread; @@ -105,20 +112,28 @@ glthread_worker(void *data) } void _mesa_glthread_init(struct gl_context *ctx) { struct glthread_state *glthread = calloc(1, sizeof(*glthread)); if (!glthread) return; + ctx->MarshalExec = _mesa_create_marshal_table(ctx); + if (!ctx->MarshalExec) { + free(glthread); + return; + } + + ctx->CurrentClientDispatch = ctx->MarshalExec; + pthread_mutex_init(>mutex, NULL); pthread_cond_init(>new_work, NULL); pthread_cond_init(>work_done, NULL); glthread->batch_queue_tail = >batch_queue; ctx->GLThread = glthread; glthread_allocate_batch(ctx); pthread_create(>thread, NULL, glthread_worker, ctx); -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/25] mesa: Add support for NULL arguments like in glBufferData() in marshalling.
From: Eric AnholtThis will let us support things like glBufferData() that should be asynchronous. --- src/mapi/glapi/gen/gl_marshal.py | 38 ++ src/mapi/glapi/gen/marshal_XML.py | 5 - 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index e4137f4..3b9868f 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -111,39 +111,56 @@ class PrintCode(gl_XML.gl_print_base): 'DISPATCH_CMD_{0}, cmd_size);'.format(func.name)) for p in func.fixed_params: if p.count: out('memcpy(cmd->{0}, {0}, {1});'.format( p.name, p.size_string())) else: out('cmd->{0} = {0};'.format(p.name)) if func.variable_params: out('char *variable_data = (char *) (cmd + 1);') for p in func.variable_params: -out(('memcpy(variable_data, {0}, {1});').format( +if p.img_null_flag: +out('cmd->{0}_null = !{0};'.format(p.name)) +out('if (!cmd->{0}_null) {{'.format(p.name)) +with indent(): +out(('memcpy(variable_data, {0}, {1});').format( +p.name, p.size_string(False))) +out('variable_data += {0};'.format( +p.size_string(False))) +out('}') +else: +out(('memcpy(variable_data, {0}, {1});').format( p.name, p.size_string(False))) -out('variable_data += {0};'.format( +out('variable_data += {0};'.format( p.size_string(False))) + if not func.fixed_params and not func.variable_params: out('(void) cmd;\n') out('_mesa_post_marshal_hook(ctx);') def print_async_struct(self, func): out('struct marshal_cmd_{0}'.format(func.name)) out('{') with indent(): out('struct marshal_cmd_base cmd_base;') for p in func.fixed_params: if p.count: out('{0} {1}[{2}];'.format( p.get_base_type_string(), p.name, p.count)) else: out('{0} {1};'.format(p.type_string(), p.name)) + +for p in func.variable_params: +if p.img_null_flag: +out('bool {0}_null; /* If set, no data follows ' +'for "{0}" */'.format(p.name)) + for p in func.variable_params: if p.count_scale != 1: out(('/* Next {0} bytes are ' '{1} {2}[{3}][{4}] */').format( p.size_string(), p.get_base_type_string(), p.name, p.counter, p.count_scale)) else: out(('/* Next {0} bytes are ' '{1} {2}[{3}] */').format( p.size_string(), p.get_base_type_string(), @@ -164,21 +181,31 @@ class PrintCode(gl_XML.gl_print_base): out('const {0} {1} = cmd->{1};'.format( p.type_string(), p.name)) if func.variable_params: for p in func.variable_params: out('const {0} * {1};'.format( p.get_base_type_string(), p.name)) out('const char *variable_data = (const char *) (cmd + 1);') for p in func.variable_params: out('{0} = (const {1} *) variable_data;'.format( p.name, p.get_base_type_string())) -out('variable_data += {0};'.format(p.size_string(False))) + +if p.img_null_flag: +out('if (cmd->{0}_null)'.format(p.name)) +with indent(): +out('{0} = NULL;'.format(p.name)) +out('else') +with indent(): +out('variable_data += {0};'.format(p.size_string(False))) +else: +out('variable_data += {0};'.format(p.size_string(False))) + self.print_sync_call(func) out('}') def validate_count_or_return(self, func): # Check that any counts for variable-length arguments might be < 0, in # which case the command alloc or the memcpy would blow up before we # get to the validation in Mesa core. for p in func.parameters: if p.is_variable_length(): out('if (unlikely({0} < 0)) {{'.format(p.size_string())) @@ -191,21 +218,24 @@ class PrintCode(gl_XML.gl_print_base): def print_async_marshal(self, func):
[Mesa-dev] [PATCH 15/25] mesa: Custom thread marshalling for Flush.
From: Paul Berry--- src/mapi/glapi/gen/gl_API.xml | 3 +-- src/mesa/main/marshal.c | 33 + src/mesa/main/marshal.h | 8 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index c7a7253..0da1589 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -2370,22 +2370,21 @@ - - + diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index c0760d2..14577dd 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -24,20 +24,53 @@ /** \file marshal.c * * Custom functions for marshalling GL calls from the main thread to a worker * thread when automatic code generation isn't appropriate. */ #include "marshal.h" #include "dispatch.h" #include "marshal_generated.h" +struct marshal_cmd_Flush +{ + struct marshal_cmd_base cmd_base; +}; + + +void +_mesa_unmarshal_Flush(struct gl_context *ctx, + const struct marshal_cmd_Flush *cmd) +{ + CALL_Flush(ctx->CurrentServerDispatch, ()); +} + + +void GLAPIENTRY +_mesa_marshal_Flush(void) +{ + GET_CURRENT_CONTEXT(ctx); + struct marshal_cmd_Flush *cmd = + _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_Flush, + sizeof(struct marshal_cmd_Flush)); + (void) cmd; + _mesa_post_marshal_hook(ctx); + + /* Flush() needs to be handled specially. In addition to telling the +* background thread to flush, we need to ensure that our own buffer is +* submitted to the background thread so that it will complete in a finite +* amount of time. +*/ + _mesa_glthread_flush_batch(ctx); +} + + struct marshal_cmd_ShaderSource { struct marshal_cmd_base cmd_base; GLuint shader; GLsizei count; /* Followed by GLint length[count], then the contents of all strings, * concatenated. */ }; diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h index 0b69d66..0e0e9b2 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -103,20 +103,28 @@ _mesa_post_marshal_hook(struct gl_context *ctx) { /* This can be enabled for debugging whether a failure is a synchronization * problem between the main thread and the worker thread, or a failure in * how we actually marshal. */ if (false) _mesa_glthread_finish(ctx); } struct marshal_cmd_ShaderSource; +struct marshal_cmd_Flush; void GLAPIENTRY _mesa_marshal_ShaderSource(GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length); void _mesa_unmarshal_ShaderSource(struct gl_context *ctx, const struct marshal_cmd_ShaderSource *cmd); +void GLAPIENTRY +_mesa_marshal_Flush(void); + +void +_mesa_unmarshal_Flush(struct gl_context *ctx, + const struct marshal_cmd_Flush *cmd); + #endif /* MARSHAL_H */ -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 21/25] mesa: Disable glthread when glBegin() is called.
From: Eric AnholtglBegin() swaps dispatch tables, and we don't have any code in place for handling that in glthread (which also messes with dispatch tables), and I don't particularly care to at this point. --- src/mapi/glapi/gen/gl_API.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index c0e7c38..ae1c9ea 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -1141,21 +1141,21 @@ - + -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/25] mesa: Create pointers for multithread marshalling dispatch table.
From: Paul BerryThis patch splits the context's CurrentDispatch pointer into two pointers, CurrentClientDispatch, and CurrentServerDispatch, so that when doing multithread marshalling, we can distinguish between the dispatch table that's being used by the client (to serialize GL calls into the marshal buffer) and the dispatch table that's being used by the server (to execute the GL calls). --- src/mapi/glapi/gen/gl_apitemp.py | 8 src/mesa/main/context.c | 13 +++-- src/mesa/main/dlist.c| 28 src/mesa/main/glthread.c | 7 +++ src/mesa/main/mtypes.h | 21 ++--- src/mesa/main/robustness.c | 4 ++-- src/mesa/main/varray.c | 8 src/mesa/vbo/vbo_exec_api.c | 14 +++--- 8 files changed, 69 insertions(+), 34 deletions(-) diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py index 5e985a2..4951692 100644 --- a/src/mapi/glapi/gen/gl_apitemp.py +++ b/src/mapi/glapi/gen/gl_apitemp.py @@ -127,25 +127,25 @@ class PrintGlOffsets(gl_XML.gl_print_base): * KEYWORD2 - usually nothing, but might be __stdcall on Win32 * NAME(n) - builds the final function name (usually add "gl" prefix) * DISPATCH(func, args, msg) - code to do dispatch of named function. * msg is a printf-style debug message. * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value * * Here is an example which generates the usual OpenGL functions: * #define KEYWORD1 * #define KEYWORD2 * #define NAME(func) gl##func - * #define DISPATCH(func, args, msg) \\ - * struct _glapi_table *dispatch = CurrentDispatch; \\ + * #define DISPATCH(func, args, msg) \\ + * struct _glapi_table *dispatch = CurrentClientDispatch; \\ * (*dispatch->func) args - * #define RETURN DISPATCH(func, args, msg)\\ - * struct _glapi_table *dispatch = CurrentDispatch; \\ + * #define RETURN DISPATCH(func, args, msg) \\ + * struct _glapi_table *dispatch = CurrentClientDispatch; \\ * return (*dispatch->func) args * */ #if defined( NAME ) #ifndef KEYWORD1 #define KEYWORD1 #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 95a337b..4b654de 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1206,21 +1206,21 @@ _mesa_initialize_context(struct gl_context *ctx, _mesa_reference_shared_state(ctx, >Shared, shared); if (!init_attrib_groups( ctx )) goto fail; /* setup the API dispatch tables with all nop functions */ ctx->OutsideBeginEnd = alloc_dispatch_table(); if (!ctx->OutsideBeginEnd) goto fail; ctx->Exec = ctx->OutsideBeginEnd; - ctx->CurrentDispatch = ctx->OutsideBeginEnd; + ctx->CurrentClientDispatch = ctx->CurrentServerDispatch = ctx->OutsideBeginEnd; ctx->FragmentProgram._MaintainTexEnvProgram = (getenv("MESA_TEX_PROG") != NULL); ctx->VertexProgram._MaintainTnlProgram = (getenv("MESA_TNL_PROG") != NULL); if (ctx->VertexProgram._MaintainTnlProgram) { /* this is required... */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; } @@ -1335,20 +1335,21 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_reference_buffer_object(ctx, >Pack.BufferObj, NULL); _mesa_reference_buffer_object(ctx, >Unpack.BufferObj, NULL); _mesa_reference_buffer_object(ctx, >DefaultPacking.BufferObj, NULL); _mesa_reference_buffer_object(ctx, >Array.ArrayBufferObj, NULL); /* free dispatch tables */ free(ctx->BeginEnd); free(ctx->OutsideBeginEnd); free(ctx->Save); free(ctx->ContextLost); + free(ctx->MarshalExec); /* Shared context state (display lists, textures, etc) */ _mesa_reference_shared_state(ctx, >Shared, NULL); /* needs to be after freeing shared state */ _mesa_free_display_list_data(ctx); _mesa_free_errors_data(ctx); free((void *)ctx->Extensions.String); @@ -1659,21 +1660,21 @@ _mesa_make_current( struct gl_context *newCtx, assert(_mesa_get_current_context() == newCtx); if (!newCtx) { _glapi_set_dispatch(NULL); /* none current */ if (curCtx) { _mesa_reference_framebuffer(>WinSysDrawBuffer, NULL); _mesa_reference_framebuffer(>WinSysReadBuffer, NULL); } } else { - _glapi_set_dispatch(newCtx->CurrentDispatch); + _glapi_set_dispatch(newCtx->CurrentClientDispatch); if (drawBuffer && readBuffer) { assert(_mesa_is_winsys_fbo(drawBuffer)); assert(_mesa_is_winsys_fbo(readBuffer)); _mesa_reference_framebuffer(>WinSysDrawBuffer, drawBuffer); _mesa_reference_framebuffer(>WinSysReadBuffer, readBuffer); /* * Only
[Mesa-dev] [PATCH 19/25] mesa: Add support for asynchronous glDraw* on GL core.
From: Eric Anholt--- src/mapi/glapi/gen/gl_marshal.py | 4 src/mapi/glapi/gen/marshal_XML.py | 9 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 3b9868f..1a63343 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -237,20 +237,24 @@ class PrintCode(gl_XML.gl_print_base): self.validate_count_or_return(func) out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {') with indent(): self.print_async_dispatch(func) out('} else {') with indent(): self.print_sync_dispatch(func) out('}') +if func.marshal == 'draw': +out('/* We relied on all vertex and index data being in VBOs */') +out('assert(ctx->API == API_OPENGL_CORE);') + out('}') def print_async_body(self, func): out('/* {0}: marshalled asynchronously */'.format(func.name)) self.print_async_struct(func) self.print_async_unmarshal(func) self.print_async_marshal(func) out('') out('') diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index 9d5688d..d56e4dd 100644 --- a/src/mapi/glapi/gen/marshal_XML.py +++ b/src/mapi/glapi/gen/marshal_XML.py @@ -57,35 +57,30 @@ class marshal_function(gl_XML.gl_function): self.fixed_params.append(p) # Store the "marshal" attribute, if present. self.marshal = element.get('marshal') def marshal_flavor(self): """Find out how this function should be marshalled between client and server threads.""" # If a "marshal" attribute was present, that overrides any # determination that would otherwise be made by this function. -if self.marshal != None: -if self.marshal == 'draw': -# TODO: as a temporary measure, do draw functions -# synchronously, since they may access client memory -# via vertex attribute pointers. -return 'sync' +if self.marshal not in (None, 'draw'): return self.marshal if self.exec_flavor == 'skip': # Functions marked exec="skip" are not yet implemented in # Mesa, so don't bother trying to marshal them. return 'skip' if self.return_type != 'void': return 'sync' for p in self.parameters: if p.is_output: return 'sync' -if p.is_pointer() and not (p.count or p.counter): +if p.is_pointer() and not (p.count or p.counter) and not (self.marshal == 'draw' and p.name == 'indices'): return 'sync' if p.count_parameter_list: # Parameter size is determined by enums; haven't # written logic to handle this yet. TODO: fix. return 'sync' return 'async' -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/25] mesa: Custom thread marshalling for ShaderSource.
From: Paul Berry--- src/mapi/glapi/gen/gl_API.xml | 2 +- src/mesa/Makefile.sources | 1 + src/mesa/main/marshal.c | 123 ++ src/mesa/main/marshal.h | 10 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/mesa/main/marshal.c diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index e29825d..c7a7253 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -5468,21 +5468,21 @@ - + diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 134d5e9..aa35540 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -125,20 +125,21 @@ MAIN_FILES = \ main/histogram.h \ main/image.c \ main/image.h \ main/imports.c \ main/imports.h \ main/light.c \ main/light.h \ main/lines.c \ main/lines.h \ main/macros.h \ + main/marshal.c \ main/marshal_generated.c \ main/marshal_generated.h \ main/matrix.c \ main/matrix.h \ main/mipmap.c \ main/mipmap.h \ main/mm.c \ main/mm.h \ main/mtypes.h \ main/multisample.c \ diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c new file mode 100644 index 000..c0760d2 --- /dev/null +++ b/src/mesa/main/marshal.c @@ -0,0 +1,123 @@ +/* + * Copyright © 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** \file marshal.c + * + * Custom functions for marshalling GL calls from the main thread to a worker + * thread when automatic code generation isn't appropriate. + */ + +#include "marshal.h" +#include "dispatch.h" +#include "marshal_generated.h" + +struct marshal_cmd_ShaderSource +{ + struct marshal_cmd_base cmd_base; + GLuint shader; + GLsizei count; + /* Followed by GLint length[count], then the contents of all strings, +* concatenated. +*/ +}; + + +void +_mesa_unmarshal_ShaderSource(struct gl_context *ctx, + const struct marshal_cmd_ShaderSource *cmd) +{ + const GLint *cmd_length = (const GLint *) (cmd + 1); + const GLchar *cmd_strings = (const GLchar *) (cmd_length + cmd->count); + /* TODO: how to deal with malloc failure? */ + const GLchar * *string = malloc(cmd->count * sizeof(const GLchar *)); + int i; + + for (i = 0; i < cmd->count; ++i) { + string[i] = cmd_strings; + cmd_strings += cmd_length[i]; + } + CALL_ShaderSource(ctx->CurrentServerDispatch, + (cmd->shader, cmd->count, string, cmd_length)); + free(string); +} + + +static size_t +measure_ShaderSource_strings(GLsizei count, const GLchar * const *string, + const GLint *length_in, GLint *length_out) +{ + int i; + size_t total_string_length = 0; + + for (i = 0; i < count; ++i) { + if (length_in == NULL || length_in[i] < 0) { + if (string[i]) +length_out[i] = strlen(string[i]); + } else { + length_out[i] = length_in[i]; + } + total_string_length += length_out[i]; + } + return total_string_length; +} + + +void GLAPIENTRY +_mesa_marshal_ShaderSource(GLuint shader, GLsizei count, + const GLchar * const *string, const GLint *length) +{ + /* TODO: how to report an error if count < 0? */ + + GET_CURRENT_CONTEXT(ctx); + /* TODO: how to deal with malloc failure? */ + const size_t fixed_cmd_size = sizeof(struct marshal_cmd_ShaderSource); + STATIC_ASSERT(sizeof(struct marshal_cmd_ShaderSource) % sizeof(GLint) == 0); + size_t length_size = count * sizeof(GLint); + GLint *length_tmp = malloc(length_size); +
[Mesa-dev] [PATCH 08/25] glapi: Generate GL API marshalling code from the XML.
From: Paul BerryThis is not yet used in the build, just generated. v2: Add missing build dependencies. v3: Avoid mixing declarations and code, remove logic for avoiding emitting code that the compiler's optimizer can deal with anyway. v4: (Timothy Arceri) move safe_mul() genereation here from a later patch. --- src/mapi/glapi/gen/Makefile.am | 8 + src/mapi/glapi/gen/gl_marshal.py | 298 + src/mapi/glapi/gen/gl_marshal_h.py | 86 +++ src/mapi/glapi/gen/marshal_XML.py | 96 src/mesa/Android.gen.mk| 12 ++ src/mesa/SConscript| 16 ++ src/mesa/main/.gitignore | 2 + 7 files changed, 518 insertions(+) create mode 100644 src/mapi/glapi/gen/gl_marshal.py create mode 100644 src/mapi/glapi/gen/gl_marshal_h.py create mode 100644 src/mapi/glapi/gen/marshal_XML.py diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 079b1bb..1375855 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -47,20 +47,22 @@ endif if HAVE_SPARC_ASM MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_sparc.S endif BUILT_SOURCES = \ $(MESA_GLAPI_OUTPUTS) \ $(MESA_GLAPI_ASM_OUTPUTS) \ $(MESA_DIR)/main/enums.c \ $(MESA_DIR)/main/api_exec.c \ + $(MESA_DIR)/main/marshal_generated.c \ + $(MESA_DIR)/main/marshal_generated.h \ $(MESA_DIR)/main/dispatch.h \ $(MESA_DIR)/main/remap_helper.h \ $(MESA_GLX_DIR)/indirect.c \ $(MESA_GLX_DIR)/indirect.h \ $(MESA_GLX_DIR)/indirect_init.c \ $(MESA_GLX_DIR)/indirect_size.h \ $(MESA_GLX_DIR)/indirect_size.c EXTRA_DIST= \ $(BUILT_SOURCES) \ $(MESA_GLAPI_DIR)/glapi_gentable.c \ @@ -280,20 +282,26 @@ $(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) $(PYTHON_GEN) $(srcdir)/gl_SPARC_asm.py -f $(srcdir)/gl_and_es_API.xml > $@ ## $(MESA_DIR)/main/enums.c: gl_enums.py $(srcdir)/../registry/gl.xml $(PYTHON_GEN) $(srcdir)/gl_enums.py -f $(srcdir)/../registry/gl.xml > $@ $(MESA_DIR)/main/api_exec.c: gl_genexec.py apiexec.py $(COMMON) $(PYTHON_GEN) $(srcdir)/gl_genexec.py -f $(srcdir)/gl_and_es_API.xml > $@ +$(MESA_DIR)/main/marshal_generated.c: gl_marshal.py marshal_XML.py $(COMMON) + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ + +$(MESA_DIR)/main/marshal_generated.h: gl_marshal_h.py marshal_XML.py $(COMMON) + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ + $(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON) $(PYTHON_GEN) $(srcdir)/gl_table.py -f $(srcdir)/gl_and_es_API.xml -m remap_table > $@ $(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) $(PYTHON_GEN) $(srcdir)/remap_helper.py -f $(srcdir)/gl_and_es_API.xml > $@ ## $(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) $(PYTHON_GEN) $(srcdir)/glX_proto_send.py -f $(srcdir)/gl_API.xml -m proto \ diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py new file mode 100644 index 000..b7e05ac --- /dev/null +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python + +# Copyright (C) 2012 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import contextlib +import getopt +import gl_XML +import license +import marshal_XML +import sys + +header = """ +#include "api_exec.h" +#include "context.h" +#include "dispatch.h" +#include "glthread.h" +#include "marshal.h" +#include "marshal_generated.h" +""" + + +current_indent = 0 + + +def out(str): +if str: +print ' '*current_indent + str +else: +print '' + + +@contextlib.contextmanager +def indent(delta = 3): +
[Mesa-dev] [PATCH 09/25] mesa: Validate count parameters when marshalling.
From: Eric AnholtOtherwise, for example, glDeleteBuffers(-1, ) gets you a segfault instead of GL_INVALID_VALUE. --- src/mapi/glapi/gen/gl_marshal.py | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index b7e05ac..e4137f4 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -168,36 +168,51 @@ class PrintCode(gl_XML.gl_print_base): out('const {0} * {1};'.format( p.get_base_type_string(), p.name)) out('const char *variable_data = (const char *) (cmd + 1);') for p in func.variable_params: out('{0} = (const {1} *) variable_data;'.format( p.name, p.get_base_type_string())) out('variable_data += {0};'.format(p.size_string(False))) self.print_sync_call(func) out('}') +def validate_count_or_return(self, func): +# Check that any counts for variable-length arguments might be < 0, in +# which case the command alloc or the memcpy would blow up before we +# get to the validation in Mesa core. +for p in func.parameters: +if p.is_variable_length(): +out('if (unlikely({0} < 0)) {{'.format(p.size_string())) +with indent(): +out('_mesa_glthread_finish(ctx);') +out('_mesa_error(ctx, GL_INVALID_VALUE, "{0}({1} < 0)");'.format(func.name, p.size_string())) +out('return;') +out('}') + def print_async_marshal(self, func): out('static void GLAPIENTRY') out('_mesa_marshal_{0}({1})'.format( func.name, func.get_parameter_string())) out('{') with indent(): out('GET_CURRENT_CONTEXT(ctx);') struct = 'struct marshal_cmd_{0}'.format(func.name) size_terms = ['sizeof({0})'.format(struct)] for p in func.variable_params: size_terms.append(p.size_string()) out('size_t cmd_size = {0};'.format(' + '.join(size_terms))) out('{0} *cmd;'.format(struct)) out('debug_print_marshal("{0}");'.format(func.name)) +self.validate_count_or_return(func) + out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {') with indent(): self.print_async_dispatch(func) out('} else {') with indent(): self.print_sync_dispatch(func) out('}') out('}') -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/25] mesa: Add an attribute for conditions to turn off threading.
From: Eric AnholtThe threading for GL core is in place, but there are so few applications actually using a core GL context that it would be nice to extend support back. However, some of the features of compat GL (particularly user vertex arrays) would be so expensive to track state for that we want to be able to disable threading when we discover that the app is using them. --- src/mapi/glapi/gen/gl_API.dtd | 7 ++- src/mapi/glapi/gen/gl_marshal.py | 8 src/mapi/glapi/gen/marshal_XML.py | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd index 133bc04..dc4a199 100644 --- a/src/mapi/glapi/gen/gl_API.dtd +++ b/src/mapi/glapi/gen/gl_API.dtd @@ -32,21 +32,22 @@ count CDATA #IMPLIED value NMTOKEN #REQUIRED> + marshal NMTOKEN #IMPLIED + marshal_failCDATA #IMPLIED> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/25] mesa: Add infrastructure for a worker thread to process GL commands.
From: Eric Anholtv2: Keep an allocated buffer around instead of checking for one at the start of every GL command. Inline the now-small space allocation function. v3: Remove duplicate !glthread->shutdown check, process remaining work before shutdown. v4: Fix leaks on destroy. V5: (Timothy Arceri) fix order of source files in makefile --- src/mesa/Makefile.sources | 1 + src/mesa/main/context.c | 3 + src/mesa/main/glthread.c | 228 ++ src/mesa/main/glthread.h | 130 ++ src/mesa/main/marshal.h | 112 +++ src/mesa/main/mtypes.h| 2 + 6 files changed, 476 insertions(+) create mode 100644 src/mesa/main/glthread.c create mode 100644 src/mesa/main/glthread.h create mode 100644 src/mesa/main/marshal.h diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 17f84fd..b2d0783 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -108,20 +108,21 @@ MAIN_FILES = \ main/framebuffer.c \ main/framebuffer.h \ main/get.c \ main/get.h \ main/get_hash.h \ main/genmipmap.c \ main/genmipmap.h \ main/getstring.c \ main/glformats.c \ main/glformats.h \ + main/glthread.c \ main/glheader.h \ main/hash.c \ main/hash.h \ main/hint.c \ main/hint.h \ main/histogram.c \ main/histogram.h \ main/image.c \ main/image.h \ main/imports.c \ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8349b88..95a337b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -93,20 +93,21 @@ #include "debug_output.h" #include "depth.h" #include "dlist.h" #include "eval.h" #include "extensions.h" #include "fbobject.h" #include "feedback.h" #include "fog.h" #include "formats.h" #include "framebuffer.h" +#include "glthread.h" #include "hint.h" #include "hash.h" #include "light.h" #include "lines.h" #include "macros.h" #include "matrix.h" #include "multisample.h" #include "performance_monitor.h" #include "performance_query.h" #include "pipelineobj.h" @@ -1286,20 +1287,22 @@ fail: void _mesa_free_context_data( struct gl_context *ctx ) { if (!_mesa_get_current_context()){ /* No current context, but we may need one in order to delete * texture objs, etc. So temporarily bind the context now. */ _mesa_make_current(ctx, NULL, NULL); } + _mesa_glthread_destroy(ctx); + /* unreference WinSysDraw/Read buffers */ _mesa_reference_framebuffer(>WinSysDrawBuffer, NULL); _mesa_reference_framebuffer(>WinSysReadBuffer, NULL); _mesa_reference_framebuffer(>DrawBuffer, NULL); _mesa_reference_framebuffer(>ReadBuffer, NULL); _mesa_reference_program(ctx, >VertexProgram.Current, NULL); _mesa_reference_program(ctx, >VertexProgram._Current, NULL); _mesa_reference_program(ctx, >VertexProgram._TnlProgram, NULL); diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c new file mode 100644 index 000..76eb0cf --- /dev/null +++ b/src/mesa/main/glthread.c @@ -0,0 +1,228 @@ +/* + * Copyright © 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** @file glthread.c + * + * Support functions for the glthread feature of Mesa. + * + * In multicore systems, many applications end up CPU-bound with about half + * their time spent inside their rendering thread and half inside Mesa. To + * alleviate this, we put a shim layer in Mesa at the GL dispatch level that + * quickly logs the GL commands to a buffer to be processed by a worker + * thread. + */ + +#include "main/mtypes.h" +#include "main/glthread.h" +#include "main/marshal.h" +#include "main/marshal_generated.h" + +#ifdef HAVE_PTHREAD + +static void
[Mesa-dev] Initial version of threaded GL dispatch V2
Since Marek is busy with other things at the moment I thought I'd try keep the momentum going on getting the initial implementation committed. Gregory Hainaut has fixed the piglit crashes in the previous version, and I've addressed the review feedback. I've also pushed some standalone patches. The only thing I didn't address was adding EGL/GBM support as that code is unfamiliar to me and it looks like we can pass a -plaform= arg to piglit to get waffle to use a different platform for testing anyway (also Gregory did some basic EGL testing with PCSX2). One thing that still concerns me is the use of _mesa_glthread_finish() This seems to assume that the context itself is only accessed by a single thread. See patch 14, 22 & 24 as an example of what I mean. I'm not sure how this should be solved (assuming its a real problem). Please review. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/25] glapi: Annotate functions with "marshal" attribute.
From: Paul BerrySeveral API functions require special treatment in order to be marshalled to a background thread. Others can't be safely executed in a background thread and need to be executed synchronously (e.g. since they return data through a pointer argument). This annotation will be used when code generating thread marshalling code, to ensure that each function is marshalled in the correct way. Note that PixelMap functions are marked as synchronous for now since their pointer may be relative to buffer on the GPU, so we'll need special logic to marshal them properly. v2: Move description of attribute types to a comment in the dtd file. --- src/mapi/glapi/gen/ARB_base_instance.xml | 6 ++-- .../glapi/gen/ARB_draw_elements_base_vertex.xml| 8 ++--- src/mapi/glapi/gen/ARB_draw_instanced.xml | 4 +-- src/mapi/glapi/gen/EXT_transform_feedback.xml | 2 +- src/mapi/glapi/gen/gl_API.dtd | 11 +- src/mapi/glapi/gen/gl_API.xml | 40 +- 6 files changed, 44 insertions(+), 27 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_base_instance.xml b/src/mapi/glapi/gen/ARB_base_instance.xml index 56de639..5bd6cab 100644 --- a/src/mapi/glapi/gen/ARB_base_instance.xml +++ b/src/mapi/glapi/gen/ARB_base_instance.xml @@ -1,38 +1,38 @@ - + - + - + diff --git a/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml b/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml index 72aa62c..7c7a6a4 100644 --- a/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml +++ b/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml @@ -1,48 +1,48 @@ - + - + - + - + diff --git a/src/mapi/glapi/gen/ARB_draw_instanced.xml b/src/mapi/glapi/gen/ARB_draw_instanced.xml index b1c8221..52dba3c 100644 --- a/src/mapi/glapi/gen/ARB_draw_instanced.xml +++ b/src/mapi/glapi/gen/ARB_draw_instanced.xml @@ -1,28 +1,28 @@ - + - + diff --git a/src/mapi/glapi/gen/EXT_transform_feedback.xml b/src/mapi/glapi/gen/EXT_transform_feedback.xml index 2aa26ad..bbb4486 100644 --- a/src/mapi/glapi/gen/EXT_transform_feedback.xml +++ b/src/mapi/glapi/gen/EXT_transform_feedback.xml @@ -101,18 +101,18 @@ - + diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd index 7822651..133bc04 100644 --- a/src/mapi/glapi/gen/gl_API.dtd +++ b/src/mapi/glapi/gen/gl_API.dtd @@ -31,21 +31,22 @@ + desktop (true | false) "true" + marshal NMTOKEN #IMPLIED> - + - + + + @@ -2591,35 +2599,35 @@ - + - + - + @@ -3134,46 +3142,46 @@ - + - + - + @@ -3716,21 +3724,21 @@ - + @@ -4709,21 +4717,21 @@ - + @@ -8082,21 +8090,21 @@ http://www.w3.org/2001/XInclude"/> http://www.w3.org/2001/XInclude"/> http://www.w3.org/2001/XInclude"/> - + @@ -8130,27 +8138,27 @@ http://www.w3.org/2001/XInclude"/> http://www.w3.org/2001/XInclude"/> http://www.w3.org/2001/XInclude"/> http://www.w3.org/2001/XInclude"/> - + - + http://www.w3.org/2001/XInclude"/> @@ -10192,21 +10200,21 @@
[Mesa-dev] [PATCH 07/25] glapi: Mark compressed teximage functions as sync.
From: Eric AnholtWithout doing some additional tracking, we won't know whether the data will be immediate user data, or will be loaded from a PBO. The normal teximage functions will be sync by default because they don't know up front what the size of their image data is. But for compressed teximage, we have the count information, so they would end up async by default. --- src/mapi/glapi/gen/gl_API.xml | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index ce9ad17..e29825d 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -4487,72 +4487,72 @@ - + - + - + - + - + -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/25] dri_interface: Add new marshalling interfaces to dri_interface.h
From: Paul Berry--- include/GL/internal/dri_interface.h | 39 + 1 file changed, 39 insertions(+) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 598d111..f419ec7 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1651,11 +1651,50 @@ struct __DRIimageLoaderExtensionRec { struct __DRIimageDriverExtensionRec { __DRIextension base; /* Common DRI functions, shared with DRI2 */ __DRIcreateNewScreen2FunccreateNewScreen2; __DRIcreateNewDrawableFunc createNewDrawable; __DRIcreateContextAttribsFunccreateContextAttribs; __DRIgetAPIMaskFunc getAPIMask; }; +/** + * Background callable loader extension. + * + * Loaders expose this extension to indicate to drivers that they are capable + * of handling callbacks from the driver's background drawing threads. + */ +#define __DRI_BACKGROUND_CALLABLE "DRI_BackgroundCallable" +#define __DRI_BACKGROUND_CALLABLE_VERSION 1 + +typedef struct __DRIbackgroundCallableExtensionRec __DRIbackgroundCallableExtension; +struct __DRIbackgroundCallableExtensionRec { + __DRIextension base; + + /** +* Indicate that this thread is being used by the driver as a background +* drawing thread which may make callbacks to the loader. +* +* \param loaderPrivate is the value that was passed to to the driver when +* the context was created. This can be used by the loader to identify +* which context any callbacks are associated with. +* +* If this function is called more than once from any given thread, each +* subsequent call overrides the loaderPrivate data that was passed in the +* previous call. The driver can take advantage of this to re-use a +* background thread to perform drawing on behalf of multiple contexts. +* +* It is permissible for the driver to call this function from a +* non-background thread (i.e. a thread that has already been bound to a +* context using __DRIcoreExtensionRec::bindContext()); when this happens, +* the \c loaderPrivate pointer must be equal to the pointer that was +* passed to the driver when the currently bound context was created. +* +* This call should execute quickly enough that the driver can call it with +* impunity whenever a background thread starts performing drawing +* operations (e.g. it should just set a thread-local variable). +*/ + void (*setBackgroundContext)(void *loaderPrivate); +}; + #endif -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/25] egl: Implement __DRI_BACKGROUND_CALLABLE
From: Eric Anholtv2: (Timothy Arceri) use C99 initializers. --- src/egl/drivers/dri2/egl_dri2.c | 15 +++ src/egl/drivers/dri2/egl_dri2.h | 1 + src/egl/drivers/dri2/platform_x11.c | 2 ++ src/egl/main/eglcontext.c | 2 +- src/egl/main/eglcontext.h | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 4bab6f1..2cab7d0 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -76,20 +76,35 @@ #endif #ifndef DRM_FORMAT_R16 #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R 16 little endian */ #endif #ifndef DRM_FORMAT_GR1616 #define DRM_FORMAT_GR1616fourcc_code('G', 'R', '3', '2') /* [31:0] R:G 16:16 little endian */ #endif +static void +dri_set_background_context(void *loaderPrivate) +{ + _EGLContext *ctx = _eglGetCurrentContext(); + _EGLThreadInfo *t = _eglGetCurrentThread(); + + _eglBindContextToThread(ctx, t); +} + +const __DRIbackgroundCallableExtension background_callable_extension = { + .base = { __DRI_BACKGROUND_CALLABLE, 1 }, + + .setBackgroundContext = dri_set_background_context, +}; + const __DRIuseInvalidateExtension use_invalidate = { .base = { __DRI_USE_INVALIDATE, 1 } }; EGLint dri2_to_egl_attribute_map[] = { 0, EGL_BUFFER_SIZE,/* __DRI_ATTRIB_BUFFER_SIZE */ EGL_LEVEL,/* __DRI_ATTRIB_LEVEL */ EGL_RED_SIZE,/* __DRI_ATTRIB_RED_SIZE */ EGL_GREEN_SIZE,/* __DRI_ATTRIB_GREEN_SIZE */ diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index f981e38..230c066 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -344,20 +344,21 @@ struct dri2_egl_sync { #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3 /* standard typecasts */ _EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl) _EGL_DRIVER_TYPECAST(dri2_egl_image, _EGLImage, obj) _EGL_DRIVER_TYPECAST(dri2_egl_sync, _EGLSync, obj) extern const __DRIimageLookupExtension image_lookup_extension; extern const __DRIuseInvalidateExtension use_invalidate; +extern const __DRIbackgroundCallableExtension background_callable_extension; EGLBoolean dri2_load_driver(_EGLDisplay *disp); /* Helper for platforms not using dri2_create_screen */ void dri2_setup_screen(_EGLDisplay *disp); EGLBoolean dri2_load_driver_swrast(_EGLDisplay *disp); diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index c5bb973..2f1086e 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1416,26 +1416,28 @@ static const __DRIdri2LoaderExtension dri2_loader_extension = { .base = { __DRI_DRI2_LOADER, 3 }, .getBuffers = dri2_x11_get_buffers, .flushFrontBuffer = dri2_x11_flush_front_buffer, .getBuffersWithFormat = dri2_x11_get_buffers_with_format, }; static const __DRIextension *dri2_loader_extensions_old[] = { _loader_extension_old.base, _lookup_extension.base, + _callable_extension.base, NULL, }; static const __DRIextension *dri2_loader_extensions[] = { _loader_extension.base, _lookup_extension.base, + _callable_extension.base, NULL, }; static EGLBoolean dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) { struct dri2_egl_display *dri2_dpy; dri2_dpy = calloc(1, sizeof *dri2_dpy); if (!dri2_dpy) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 5313e1da..05cc523 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -576,21 +576,21 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, return EGL_TRUE; } /** * Bind the context to the thread and return the previous context. * * Note that the context may be NULL. */ -static _EGLContext * +_EGLContext * _eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t) { _EGLContext *oldCtx; oldCtx = t->CurrentContext; if (ctx != oldCtx) { if (oldCtx) oldCtx->Binding = NULL; if (ctx) ctx->Binding = t; diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h index 69bf77d..f2fe806 100644 --- a/src/egl/main/eglcontext.h +++ b/src/egl/main/eglcontext.h @@ -75,20 +75,23 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, extern EGLBoolean _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value); extern EGLBoolean _eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read, _EGLContext **old_ctx, _EGLSurface **old_draw, _EGLSurface **old_read); +extern _EGLContext * +_eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t); + /** * Increment reference count for the context. */ static inline
[Mesa-dev] [PATCH 04/25] glx: Implement __DRI_BACKGROUND_CALLABLE
From: Paul Berryv2: Marek: Add DRI3 support. v3: (Timothy Arceri) use C99 initializers. --- src/glx/dri2_glx.c | 17 - src/glx/dri3_glx.c | 14 ++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index d6eb281..f59e413 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -67,21 +67,21 @@ struct dri2_display ** XFree86-DRI version information */ int driMajor; int driMinor; int driPatch; int swapAvailable; int invalidateAvailable; __glxHashTable *dri2Hash; - const __DRIextension *loader_extensions[4]; + const __DRIextension *loader_extensions[5]; }; struct dri2_drawable { __GLXDRIdrawable base; __DRIdrawable *driDrawable; __DRIbuffer buffers[5]; int bufferCount; int width, height; int have_back; @@ -939,40 +939,53 @@ dri2SetSwapInterval(__GLXDRIdrawable *pdraw, int interval) } static int dri2GetSwapInterval(__GLXDRIdrawable *pdraw) { struct dri2_drawable *priv = (struct dri2_drawable *) pdraw; return priv->swap_interval; } +static void +driSetBackgroundContext(void *loaderPrivate) +{ + struct dri2_context *pcp = (struct dri2_context *) loaderPrivate; + __glXSetCurrentContext(>base); +} + static const __DRIdri2LoaderExtension dri2LoaderExtension = { .base = { __DRI_DRI2_LOADER, 3 }, .getBuffers = dri2GetBuffers, .flushFrontBuffer= dri2FlushFrontBuffer, .getBuffersWithFormat= dri2GetBuffersWithFormat, }; static const __DRIdri2LoaderExtension dri2LoaderExtension_old = { .base = { __DRI_DRI2_LOADER, 3 }, .getBuffers = dri2GetBuffers, .flushFrontBuffer= dri2FlushFrontBuffer, .getBuffersWithFormat= NULL, }; static const __DRIuseInvalidateExtension dri2UseInvalidate = { .base = { __DRI_USE_INVALIDATE, 1 } }; +static const __DRIbackgroundCallableExtension driBackgroundCallable = { + .base = { __DRI_BACKGROUND_CALLABLE, 1 }, + + .setBackgroundContext= driSetBackgroundContext, +}; + _X_HIDDEN void dri2InvalidateBuffers(Display *dpy, XID drawable) { __GLXDRIdrawable *pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable); struct dri2_screen *psc; struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw; if (!pdraw) return; @@ -1390,20 +1403,22 @@ dri2CreateDisplay(Display * dpy) i = 0; if (pdp->driMinor < 1) pdp->loader_extensions[i++] = _old.base; else pdp->loader_extensions[i++] = pdp->loader_extensions[i++] = pdp->loader_extensions[i++] = + pdp->loader_extensions[i++] = + pdp->loader_extensions[i++] = NULL; pdp->dri2Hash = __glxHashCreate(); if (pdp->dri2Hash == NULL) { free(pdp); return NULL; } return >base; } diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 42a94f9..c770326 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -489,37 +489,51 @@ dri3_flush_front_buffer(__DRIdrawable *driDrawable, void *loaderPrivate) psc = (struct dri3_screen *) pdraw->base.psc; (void) __glXInitialize(psc->base.dpy); loader_dri3_flush(draw, __DRI2_FLUSH_DRAWABLE, __DRI2_THROTTLE_FLUSHFRONT); loader_dri3_wait_gl(draw); } +static void +dri_set_background_context(void *loaderPrivate) +{ + struct dri3_context *pcp = (struct dri3_context *)loaderPrivate; + __glXSetCurrentContext(>base); +} + /* The image loader extension record for DRI3 */ static const __DRIimageLoaderExtension imageLoaderExtension = { .base = { __DRI_IMAGE_LOADER, 1 }, .getBuffers = loader_dri3_get_buffers, .flushFrontBuffer= dri3_flush_front_buffer, }; const __DRIuseInvalidateExtension dri3UseInvalidate = { .base = { __DRI_USE_INVALIDATE, 1 } }; +static const __DRIbackgroundCallableExtension driBackgroundCallable = { + .base = { __DRI_BACKGROUND_CALLABLE, 1 }, + + .setBackgroundContext = dri_set_background_context, +}; + static const __DRIextension *loader_extensions[] = { , , , + , NULL }; /** dri3_swap_buffers * * Make the current back buffer visible using the present extension */ static int64_t dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, int64_t remainder, Bool flush) -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/25] dri: Update dri_util to keep track of __DRI_BACKGROUND_CALLABLE
From: Paul Berry--- src/mesa/drivers/dri/common/dri_util.c | 2 ++ src/mesa/drivers/dri/common/dri_util.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index d18c458..f6df488 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -68,20 +68,22 @@ setupLoaderExtensions(__DRIscreen *psp, { int i; for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0) psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0) psp->dri2.image = (__DRIimageLookupExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0) psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i]; +if (strcmp(extensions[i]->name, __DRI_BACKGROUND_CALLABLE) == 0) +psp->dri2.backgroundCallable = (__DRIbackgroundCallableExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0) psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_IMAGE_LOADER) == 0) psp->image.loader = (__DRIimageLoaderExtension *) extensions[i]; } } /** * This pointer determines which driver API we'll use in the case of the * loader not passing us an explicit driver extensions list (that would, diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 6987f55..8fcd632 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -165,20 +165,21 @@ struct __DRIscreenRec { const __DRIextension **extensions; const __DRIswrastLoaderExtension *swrast_loader; struct { /* Flag to indicate that this is a DRI2 screen. Many of the above * fields will not be valid or initializaed in that case. */ const __DRIdri2LoaderExtension *loader; const __DRIimageLookupExtension *image; const __DRIuseInvalidateExtension *useInvalidate; +const __DRIbackgroundCallableExtension *backgroundCallable; } dri2; struct { const __DRIimageLoaderExtension *loader; } image; driOptionCache optionInfo; driOptionCache optionCache; unsigned int api_mask; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/25] mesa: Add SetBackgroundContext to dd_function_table
From: Paul Berry--- src/mesa/drivers/common/driverfuncs.c | 3 +++ src/mesa/main/dd.h| 18 ++ 2 files changed, 21 insertions(+) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 6069138..642cd91 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -194,20 +194,23 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->LightingSpaceChange = NULL; /* GL_ARB_texture_storage */ driver->AllocTextureStorage = _mesa_AllocTextureStorage_sw; /* GL_ARB_texture_view */ driver->TextureView = NULL; /* GL_ARB_texture_multisample */ driver->GetSamplePosition = NULL; + + /* Multithreading */ + driver->SetBackgroundContext = NULL; } /** * Call the ctx->Driver.* state functions with current values to initialize * driver state. * Only the Intel drivers use this so far. */ void _mesa_init_driver_state(struct gl_context *ctx) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 63fc621..f300ad6 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1018,20 +1018,38 @@ struct dd_function_table { const GLuint *num_groups, const GLuint *group_size); /*@}*/ /** * Query information about memory. Device memory is e.g. VRAM. Staging * memory is e.g. GART. All sizes are in kilobytes. */ void (*QueryMemoryInfo)(struct gl_context *ctx, struct gl_memory_info *info); + + /** +* Indicate that this thread is being used by Mesa as a background drawing +* thread for the given GL context. +* +* If this function is called more than once from any given thread, each +* subsequent call overrides the context that was passed in the previous +* call. Mesa takes advantage of this to re-use a background thread to +* perform drawing on behalf of multiple contexts. +* +* Mesa may sometimes call this function from a non-background thread +* (i.e. a thread that has already been bound to a context using +* __DriverAPIRec::MakeCurrent()); when this happens, ctx will be equal to +* the context that is bound to this thread. +* +* Mesa will only call this function if GL multithreading is enabled. +*/ + void (*SetBackgroundContext)(struct gl_context *ctx); }; /** * Per-vertex functions. * * These are the functions which can appear between glBegin and glEnd. * Depending on whether we're inside or outside a glBegin/End pair * and whether we're in immediate mode or building a display list, these * functions behave differently. This structure allows us to switch -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100091] Failure to create folder for on-disk shader cache
https://bugs.freedesktop.org/show_bug.cgi?id=100091 --- Comment #3 from John--- That's right I have both folders. How do you create the identifier? I find it quite strange that the folder's number on disk is only one away from the one expected. Last week when I reported a similar issue on phoronix, I believe it was similar (but without the 32/64b folders). Thanks! -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100093] configure: error: Package requirements (zlib >= 1.2.8) were not met:
https://bugs.freedesktop.org/show_bug.cgi?id=100093 --- Comment #2 from Timothy Arceri--- Probably RHEL 6/CentOS 6. Looks like they ship a heavily patched 1.2.3. However I don't think this is Mesa's problem. We should recommend a version of zlib that see's regular testing against the shader cache. Corrupt output is not unheard of in zlib, so limiting the versions we need to deal with for regression testing is in our interest IMO. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radv: disable mip point pre clamping.
From: Dave AirlieNo idea what this does, but disabling it fixes a bunch of failing CTS tests in the lod area, so let's go with that. Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index ab04473..5f0614f 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2631,7 +2631,7 @@ radv_init_sampler(struct radv_device *device, S_008F38_XY_MAG_FILTER(radv_tex_filter(pCreateInfo->magFilter, max_aniso)) | S_008F38_XY_MIN_FILTER(radv_tex_filter(pCreateInfo->minFilter, max_aniso)) | S_008F38_MIP_FILTER(radv_tex_mipfilter(pCreateInfo->mipmapMode)) | -S_008F38_MIP_POINT_PRECLAMP(1) | +S_008F38_MIP_POINT_PRECLAMP(0) | S_008F38_DISABLE_LSB_CEIL(1) | S_008F38_FILTER_PREC_FIX(1) | S_008F38_ANISO_OVERRIDE(is_vi)); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] radv/amdgpu: Let addrlib calculate the HTILE parameters.
On 7 March 2017 at 10:44, Bas Nieuwenhuizenwrote: > Still not sure we can support miptrees when sampling from > HTILE enabled textures. > > Added the tcCompatible winsys stuff while I'm at it. Do we trust addrlib here? if so go for it. Reviewed-by: Dave Airlie > > Signed-off-by: Bas Nieuwenhuizen > --- > src/amd/vulkan/radv_radeon_winsys.h| 5 + > src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c | 26 > ++ > 2 files changed, 31 insertions(+) > > diff --git a/src/amd/vulkan/radv_radeon_winsys.h > b/src/amd/vulkan/radv_radeon_winsys.h > index 8cf29a38d94..a8a1d2e369f 100644 > --- a/src/amd/vulkan/radv_radeon_winsys.h > +++ b/src/amd/vulkan/radv_radeon_winsys.h > @@ -148,6 +148,7 @@ struct radeon_info { > #define RADEON_SURF_HAS_TILE_MODE_INDEX (1 << 20) > #define RADEON_SURF_FMASK (1 << 21) > #define RADEON_SURF_DISABLE_DCC (1 << 22) > +#define RADEON_SURF_TC_COMPATIBLE_HTILE (1 << 23) > > #define RADEON_SURF_GET(v, field) (((v) >> RADEON_SURF_ ## field ## > _SHIFT) & RADEON_SURF_ ## field ## _MASK) > #define RADEON_SURF_SET(v, field) (((v) & RADEON_SURF_ ## field ## _MASK) > << RADEON_SURF_ ## field ## _SHIFT) > @@ -217,6 +218,10 @@ struct radeon_surf { > > uint64_tdcc_size; > uint64_tdcc_alignment; > + > + uint64_thtile_size; > + uint64_thtile_slice_size; > + uint64_thtile_alignment; > }; > > enum radeon_bo_layout { > diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c > b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c > index dc596ff0574..89e84d60a3a 100644 > --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c > +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c > @@ -260,6 +260,30 @@ static int radv_compute_level(ADDR_HANDLE addrlib, > } > } > > + if (!is_stencil && AddrSurfInfoIn->flags.depth && > + surf_level->mode == RADEON_SURF_MODE_2D && level == 0) { > + ADDR_COMPUTE_HTILE_INFO_INPUT AddrHtileIn = {0}; > + ADDR_COMPUTE_HTILE_INFO_OUTPUT AddrHtileOut = {0}; > + AddrHtileIn.flags.tcCompatible = > AddrSurfInfoIn->flags.tcCompatible; > + AddrHtileIn.pitch = AddrSurfInfoOut->pitch; > + AddrHtileIn.height = AddrSurfInfoOut->height; > + AddrHtileIn.numSlices = AddrSurfInfoOut->depth; > + AddrHtileIn.blockWidth = ADDR_HTILE_BLOCKSIZE_8; > + AddrHtileIn.blockHeight = ADDR_HTILE_BLOCKSIZE_8; > + AddrHtileIn.pTileInfo = AddrSurfInfoOut->pTileInfo; > + AddrHtileIn.tileIndex = AddrSurfInfoOut->tileIndex; > + AddrHtileIn.macroModeIndex = AddrSurfInfoOut->macroModeIndex; > + > + ret = AddrComputeHtileInfo(addrlib, > + , > + ); > + > + if (ret == ADDR_OK) { > + surf->htile_size = AddrHtileOut.htileBytes; > + surf->htile_slice_size = AddrHtileOut.sliceSize; > + surf->htile_alignment = AddrHtileOut.baseAlign; > + } > + } > return 0; > } > > @@ -455,6 +479,8 @@ static int radv_amdgpu_winsys_surface_init(struct > radeon_winsys *_ws, > surf->bo_size = 0; > surf->dcc_size = 0; > surf->dcc_alignment = 1; > + surf->htile_size = surf->htile_slice_size = 0; > + surf->htile_alignment = 1; > > /* Calculate texture layout information. */ > for (level = 0; level <= surf->last_level; level++) { > -- > 2.11.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100093] configure: error: Package requirements (zlib >= 1.2.8) were not met:
https://bugs.freedesktop.org/show_bug.cgi?id=100093 --- Comment #1 from Roland Scheidegger--- What distro ships prehistoric libz versions... libz 1.2.8 is 4 years old. Not sure this qualifies as a bug... (I think even MacOS now ships 1.2.8 albeit 10.11 indeed still shipped a prehistoric 1.2.5 which isn't really useful for compiling anything.) Or are just the headers missing? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100093] configure: error: Package requirements (zlib >= 1.2.8) were not met:
https://bugs.freedesktop.org/show_bug.cgi?id=100093 Bug ID: 100093 Summary: configure: error: Package requirements (zlib >= 1.2.8) were not met: Product: Mesa Version: git Hardware: x86-64 (AMD64) OS: All Status: NEW Keywords: bisected, regression Severity: normal Priority: medium Component: Mesa core Assignee: mesa-dev@lists.freedesktop.org Reporter: v...@freedesktop.org QA Contact: mesa-dev@lists.freedesktop.org CC: g...@chown.ath.cx, mar...@gmail.com, t_arc...@yahoo.com.au mesa: 0ab2dd361fd80c3840b1547cb7e05b4361eaf928 (master 17.1.0-devel) The build now fails on distributions without new enough zlib. There is not a way to build without requiring the shader cache. $ ./autogen.sh checking for ZLIB... no configure: error: Package requirements (zlib >= 1.2.8) were not met: commit 85a9b1b562b6a73b9494b3fad25172da3dc90fc2 Author: Timothy ArceriDate: Wed Mar 1 16:04:23 2017 +1100 util/disk_cache: compress individual cache entries This reduces the cache size for Deus Ex from ~160M to ~30M for radeonsi (these numbers differ from Grigori's results below probably due to different graphics quality settings). I'm also seeing the following improvements in minimum fps in the Shadow of Mordor benchmark on an i5-6400 CPU@2.70GHz, with a HDD: no-cache:~10fps with-cache-no-compression: ~15fps with-cache-and-compression: ~20fps Note: The with cache results are from the second run after closing and opening the game to avoid the in-memory cache. Since we mainly care about decompression I went with Z_BEST_COMPRESSION as suggested on irc by Steinar H. Gunderson who has benchmarked decompression speeds. Grigori Goronzy provided the following stats for Deus Ex: Mankind Divided start-up times on a Athlon X4 860k with a SSD: No Cache 215 sec Cold Cache zlib BEST_COMPRESSION 285 sec Warm Cache zlib BEST_COMPRESSION 33 sec Cold Cache zlib BEST_SPEED 264 sec Warm Cache zlib BEST_SPEED 33 sec Cold Cache no compression266 sec Warm Cache no compression34 sec The total cache size for that game is 48 MiB with BEST_COMPRESSION, 56 MiB with BEST_SPEED and 170 MiB with no compression. These numbers suggest that it may be ok to go with Z_BEST_SPEED but we should gather some actual decompression times before doing so. Other options might be to do the compression in a separate thread, this might allow us to use a higher compression algorithim such as LZMA. Reviewed-by: Grigori Goronzy Acked-by: Marek Olšák -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radv/ac: move to new image intrinsics.
From: Dave AirlieThis hooks up radv to the new image intrinsic builders. Signed-off-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 222 ++-- 1 file changed, 77 insertions(+), 145 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index e472408..ba90822 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -156,13 +156,6 @@ struct nir_to_llvm_context { unsigned gs_max_out_vertices; }; -struct ac_tex_info { - LLVMValueRef args[12]; - int arg_count; - LLVMTypeRef dst_type; - bool has_offset; -}; - static LLVMValueRef get_sampler_desc(struct nir_to_llvm_context *ctx, nir_deref_var *deref, enum desc_type desc_type); @@ -1644,35 +1637,24 @@ static void build_int_type_name( } static LLVMValueRef radv_lower_gather4_integer(struct nir_to_llvm_context *ctx, - struct ac_tex_info *tinfo, - nir_tex_instr *instr, - const char *intr_name, - unsigned coord_vgpr_index) + struct ac_image_args *args, + nir_tex_instr *instr) { - LLVMValueRef coord = tinfo->args[0]; + LLVMValueRef coord = args->addr; LLVMValueRef half_texel[2]; int c; + unsigned coord_vgpr_index = (unsigned)args->offset + (unsigned)args->compare; //TODO Rect { - LLVMValueRef txq_args[10]; - int txq_arg_count = 0; - LLVMValueRef size; - bool da = instr->is_array || instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE; - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, false); - txq_args[txq_arg_count++] = tinfo->args[1]; - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0xf, 0); /* dmask */ - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* unorm */ - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* r128 */ - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, da ? 1 : 0, 0); - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* glc */ - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* slc */ - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* tfe */ - txq_args[txq_arg_count++] = LLVMConstInt(ctx->i32, 0, 0); /* lwe */ - size = ac_build_intrinsic(>ac, "llvm.SI.getresinfo.i32", ctx->v4i32, - txq_args, txq_arg_count, - AC_FUNC_ATTR_READNONE | - AC_FUNC_ATTR_LEGACY); + struct ac_image_args txq_args = { 0 }; + + txq_args.da = instr->is_array || instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE; + txq_args.opcode = ac_image_get_resinfo; + txq_args.dmask = 0xf; + txq_args.addr = ctx->i32zero; + txq_args.resource = args->resource; + LLVMValueRef size = ac_build_image_opcode(>ac, _args); for (c = 0; c < 2; c++) { half_texel[c] = LLVMBuildExtractElement(ctx->builder, size, @@ -1694,80 +1676,70 @@ static LLVMValueRef radv_lower_gather4_integer(struct nir_to_llvm_context *ctx, coord = LLVMBuildInsertElement(ctx->builder, coord, tmp, index, ""); } - tinfo->args[0] = coord; - return ac_build_intrinsic(>ac, intr_name, tinfo->dst_type, tinfo->args, tinfo->arg_count, - AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_NOUNWIND | - AC_FUNC_ATTR_LEGACY); - + args->addr = coord; + return ac_build_image_opcode(>ac, args); } static LLVMValueRef build_tex_intrinsic(struct nir_to_llvm_context *ctx, nir_tex_instr *instr, - struct ac_tex_info *tinfo) -{ - const char *name = "llvm.SI.image.sample"; - const char *infix = ""; - char intr_name[127]; - char type[64]; - bool is_shadow = instr->is_shadow; - bool has_offset = tinfo->has_offset; + struct ac_image_args *args) +{ + if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF) { + return ac_build_buffer_load_format(>ac, + args->resource, + args->addr, + LLVMConstInt(ctx->i32, 0, false), +
Re: [Mesa-dev] assorted uint/unsigned -> enum clean-ups
Totally forgot to look at doing this, thanks Brian for going though. Reviewed-by: Edward O'CallaghanOn 03/07/2017 01:08 PM, Brian Paul wrote: > Use gallium enum types in a bunch of places. > I compile tested most drivers, but not all. > Easy work to do on an airplane. > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > signature.asc Description: OpenPGP digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/5] gbm: Create a gbm_device getter for stride
This will be used so we can query information per plane. Signed-off-by: Ben WidawskyReviewed-by: Eric Engestrom Acked-by: Daniel Stone --- src/gbm/backends/dri/gbm_dri.c | 7 +++ src/gbm/main/gbm.c | 2 +- src/gbm/main/gbmint.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index c3704e505b..3d9c540d95 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -658,6 +658,12 @@ gbm_dri_bo_get_handle_for_plane(struct gbm_bo *_bo, int plane) return ret; } +static uint32_t +gbm_dri_bo_get_stride(struct gbm_bo *_bo, int plane) +{ + return _bo->stride; +} + static void gbm_dri_bo_destroy(struct gbm_bo *_bo) { @@ -1122,6 +1128,7 @@ dri_device_create(int fd) dri->base.base.bo_get_fd = gbm_dri_bo_get_fd; dri->base.base.bo_get_planes = gbm_dri_bo_get_planes; dri->base.base.bo_get_handle = gbm_dri_bo_get_handle_for_plane; + dri->base.base.bo_get_stride = gbm_dri_bo_get_stride; dri->base.base.bo_destroy = gbm_dri_bo_destroy; dri->base.base.destroy = dri_destroy; dri->base.base.surface_create = gbm_dri_surface_create; diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 066ceffc0a..7462e90c4c 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -165,7 +165,7 @@ gbm_bo_get_height(struct gbm_bo *bo) GBM_EXPORT uint32_t gbm_bo_get_stride(struct gbm_bo *bo) { - return bo->stride; + return bo->gbm->bo_get_stride(bo, 0); } /** Get the format of the buffer object diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h index 0ec531d099..26d18bab6b 100644 --- a/src/gbm/main/gbmint.h +++ b/src/gbm/main/gbmint.h @@ -78,6 +78,7 @@ struct gbm_device { int (*bo_get_fd)(struct gbm_bo *bo); int (*bo_get_planes)(struct gbm_bo *bo); union gbm_bo_handle (*bo_get_handle)(struct gbm_bo *bo, int plane); + uint32_t (*bo_get_stride)(struct gbm_bo *bo, int plane); void (*bo_destroy)(struct gbm_bo *bo); struct gbm_surface *(*surface_create)(struct gbm_device *gbm, -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/5] gbm: Export a plane getter function
This will be used by clients that need to know the number of planes allocated for them on behalf of the GL or other API. The best current example of this is when an extra "plane" is allocated to store compression data for the primary plane. v2: Return 1 for cases where there is no image, ie. dumb bo (Daniel) Cc: Daniel StoneSigned-off-by: Ben Widawsky Reviewed-by: Eric Engestrom Acked-by: Daniel Stone --- src/gbm/backends/dri/gbm_dri.c | 27 +++ src/gbm/gbm-symbols-check | 1 + src/gbm/main/gbm.c | 10 ++ src/gbm/main/gbm.h | 3 +++ src/gbm/main/gbmint.h | 1 + 5 files changed, 42 insertions(+) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ac7ede87b6..0b75e411df 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -598,6 +598,32 @@ gbm_dri_bo_get_fd(struct gbm_bo *_bo) return fd; } +static int +get_number_planes(struct gbm_dri_device *dri, __DRIimage *image) +{ + int num_planes = 0; + + /* Dumb buffers are single-plane only. */ + if (!image) + return 1; + + dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_NUM_PLANES, _planes); + + if (num_planes <= 0) + num_planes = 1; + + return num_planes; +} + +static int +gbm_dri_bo_get_planes(struct gbm_bo *_bo) +{ + struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); + struct gbm_dri_bo *bo = gbm_dri_bo(_bo); + + return get_number_planes(dri, bo->image); +} + static void gbm_dri_bo_destroy(struct gbm_bo *_bo) { @@ -1060,6 +1086,7 @@ dri_device_create(int fd) dri->base.base.is_format_supported = gbm_dri_is_format_supported; dri->base.base.bo_write = gbm_dri_bo_write; dri->base.base.bo_get_fd = gbm_dri_bo_get_fd; + dri->base.base.bo_get_planes = gbm_dri_bo_get_planes; dri->base.base.bo_destroy = gbm_dri_bo_destroy; dri->base.base.destroy = dri_destroy; dri->base.base.surface_create = gbm_dri_surface_create; diff --git a/src/gbm/gbm-symbols-check b/src/gbm/gbm-symbols-check index 5a333ffcda..8c4da1b7ea 100755 --- a/src/gbm/gbm-symbols-check +++ b/src/gbm/gbm-symbols-check @@ -18,6 +18,7 @@ gbm_bo_get_format gbm_bo_get_device gbm_bo_get_handle gbm_bo_get_fd +gbm_bo_get_plane_count gbm_bo_write gbm_bo_set_user_data gbm_bo_get_user_data diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index e96297ec52..3779517564 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -223,6 +223,16 @@ gbm_bo_get_fd(struct gbm_bo *bo) return bo->gbm->bo_get_fd(bo); } +/** Get the number of planes for the given bo. + * + * \param bo The buffer object + * \return The number of planes + */ +GBM_EXPORT int +gbm_bo_get_plane_count(struct gbm_bo *bo) +{ + return bo->gbm->bo_get_planes(bo); +} /** Write data into the buffer object * diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 59daaa164d..203a236357 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -316,6 +316,9 @@ int gbm_bo_get_fd(struct gbm_bo *bo); int +gbm_bo_get_plane_count(struct gbm_bo *bo); + +int gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count); void diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h index cfef5eea29..c6a6701464 100644 --- a/src/gbm/main/gbmint.h +++ b/src/gbm/main/gbmint.h @@ -76,6 +76,7 @@ struct gbm_device { void (*bo_unmap)(struct gbm_bo *bo, void *map_data); int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data); int (*bo_get_fd)(struct gbm_bo *bo); + int (*bo_get_planes)(struct gbm_bo *bo); void (*bo_destroy)(struct gbm_bo *bo); struct gbm_surface *(*surface_create)(struct gbm_device *gbm, -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/5] gbm: Export a per plane getter for stride
v2: Preserve legacy behavior when plane is 0 (Jason Ekstrand) EINVAL when input plane is greater than total planes (Jason Ekstrand) Don't leak the image after fromPlanar (Daniel) Move bo->image check below plane count preventing bad index succeeding (Daniel) v3: Fix DRIimage leak (using Jason's recommended change) Make plane 0 return planar stride. This might break legacy behavior (Jason) Cc: Jason EkstrandSigned-off-by: Ben Widawsky Reviewed-by: Eric Engestrom (v1) Acked-by: Daniel Stone --- src/gbm/backends/dri/gbm_dri.c | 45 -- src/gbm/gbm-symbols-check | 1 + src/gbm/main/gbm.c | 15 +- src/gbm/main/gbm.h | 3 +++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 3d9c540d95..ecba3ead5a 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -648,20 +648,53 @@ gbm_dri_bo_get_handle_for_plane(struct gbm_bo *_bo, int plane) } __DRIimage *image = dri->image->fromPlanar(bo->image, plane, NULL); - if (!image) { - /* Use the parent's handle */ - image = bo->image; + if (image) { + dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_HANDLE, ); + dri->image->destroyImage(image); + } else { + dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, ); } - dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_HANDLE, ); - return ret; } static uint32_t gbm_dri_bo_get_stride(struct gbm_bo *_bo, int plane) { - return _bo->stride; + struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); + struct gbm_dri_bo *bo = gbm_dri_bo(_bo); + __DRIimage *image; + int stride = 0; + + if (!dri->image || dri->image->base.version < 11 || !dri->image->fromPlanar) { + /* Preserve legacy behavior if plane is 0 */ + if (plane == 0) + return _bo->stride; + + errno = ENOSYS; + return 0; + } + + if (plane >= get_number_planes(dri, bo->image)) { + errno = EINVAL; + return 0; + } + + if (bo->image == NULL) + return _bo->stride; + + image = dri->image->fromPlanar(bo->image, plane, NULL); + if (!image) { + /* Use the parent stride */ + image = bo->image; + } + + dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, ); + + if (image != bo->image) + dri->image->destroyImage(image); + + return (uint32_t)stride; } static void diff --git a/src/gbm/gbm-symbols-check b/src/gbm/gbm-symbols-check index 1e6dd4d3ec..459006a63f 100755 --- a/src/gbm/gbm-symbols-check +++ b/src/gbm/gbm-symbols-check @@ -14,6 +14,7 @@ gbm_bo_unmap gbm_bo_get_width gbm_bo_get_height gbm_bo_get_stride +gbm_bo_get_stride_for_plane gbm_bo_get_format gbm_bo_get_device gbm_bo_get_handle diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 7462e90c4c..0a9f0bef7e 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -165,7 +165,20 @@ gbm_bo_get_height(struct gbm_bo *bo) GBM_EXPORT uint32_t gbm_bo_get_stride(struct gbm_bo *bo) { - return bo->gbm->bo_get_stride(bo, 0); + return gbm_bo_get_stride_for_plane(bo, 0); +} + +/** Get the stride for the given plane + * + * \param bo The buffer object + * \param plane for which you want the stride + * + * \sa gbm_bo_get_stride() + */ +GBM_EXPORT uint32_t +gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane) +{ + return bo->gbm->bo_get_stride(bo, plane); } /** Get the format of the buffer object diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 67548206c4..1719c5312a 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -304,6 +304,9 @@ uint32_t gbm_bo_get_stride(struct gbm_bo *bo); uint32_t +gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane); + +uint32_t gbm_bo_get_format(struct gbm_bo *bo); struct gbm_device * -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] gbm: Export a per plane getter for offset
Unlike stride, there was no previous offset getter, so it can be right on the first try. v2: Return EINVAL when plane is greater than total planes to make it match the similar APIs. Avoid leak after fromPlanar (Daniel) Make sure when getting offsets we consider dumb images (Daniel) v3: Use Jason's recommendation for handling the non-planar case. Signed-off-by: Ben WidawskyReviewed-by: Eric Engestrom Acked-by: Daniel Stone --- src/gbm/backends/dri/gbm_dri.c | 33 + src/gbm/gbm-symbols-check | 1 + src/gbm/main/gbm.c | 15 +++ src/gbm/main/gbm.h | 3 +++ src/gbm/main/gbmint.h | 1 + 5 files changed, 53 insertions(+) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ecba3ead5a..6215116fd0 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -697,6 +697,38 @@ gbm_dri_bo_get_stride(struct gbm_bo *_bo, int plane) return (uint32_t)stride; } +static uint32_t +gbm_dri_bo_get_offset(struct gbm_bo *_bo, int plane) +{ + struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); + struct gbm_dri_bo *bo = gbm_dri_bo(_bo); + int offset = 0; + + if (!dri->image || dri->image->base.version < 13 || !dri->image->fromPlanar) { + errno = ENOSYS; + return 0; + } + + if (plane >= get_number_planes(dri, bo->image)) { + errno = EINVAL; + return 0; + } + +/* Dumb images have no offset */ + if (!bo->image) + return 0; + + __DRIimage *image = dri->image->fromPlanar(bo->image, plane, NULL); + if (image) { + dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_OFFSET, ); + dri->image->destroyImage(image); + } else { + dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_OFFSET, ); + } + + return (uint32_t)offset; +} + static void gbm_dri_bo_destroy(struct gbm_bo *_bo) { @@ -1162,6 +1194,7 @@ dri_device_create(int fd) dri->base.base.bo_get_planes = gbm_dri_bo_get_planes; dri->base.base.bo_get_handle = gbm_dri_bo_get_handle_for_plane; dri->base.base.bo_get_stride = gbm_dri_bo_get_stride; + dri->base.base.bo_get_offset = gbm_dri_bo_get_offset; dri->base.base.bo_destroy = gbm_dri_bo_destroy; dri->base.base.destroy = dri_destroy; dri->base.base.surface_create = gbm_dri_surface_create; diff --git a/src/gbm/gbm-symbols-check b/src/gbm/gbm-symbols-check index 459006a63f..7ff78ab400 100755 --- a/src/gbm/gbm-symbols-check +++ b/src/gbm/gbm-symbols-check @@ -16,6 +16,7 @@ gbm_bo_get_height gbm_bo_get_stride gbm_bo_get_stride_for_plane gbm_bo_get_format +gbm_bo_get_offset gbm_bo_get_device gbm_bo_get_handle gbm_bo_get_fd diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 0a9f0bef7e..295f6894eb 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -194,6 +194,21 @@ gbm_bo_get_format(struct gbm_bo *bo) return bo->format; } +/** Get the offset for the data of the specified plane + * + * Extra planes, and even the first plane, may have an offset from the start of + * the buffer object. This function will provide the offset for the given plane + * to be used in various KMS APIs. + * + * \param bo The buffer object + * \return The offset + */ +GBM_EXPORT uint32_t +gbm_bo_get_offset(struct gbm_bo *bo, int plane) +{ + return bo->gbm->bo_get_offset(bo, plane); +} + /** Get the gbm device used to create the buffer object * * \param bo The buffer object diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 1719c5312a..b089359b01 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -309,6 +309,9 @@ gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane); uint32_t gbm_bo_get_format(struct gbm_bo *bo); +uint32_t +gbm_bo_get_offset(struct gbm_bo *bo, int plane); + struct gbm_device * gbm_bo_get_device(struct gbm_bo *bo); diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h index 26d18bab6b..ac6078361a 100644 --- a/src/gbm/main/gbmint.h +++ b/src/gbm/main/gbmint.h @@ -79,6 +79,7 @@ struct gbm_device { int (*bo_get_planes)(struct gbm_bo *bo); union gbm_bo_handle (*bo_get_handle)(struct gbm_bo *bo, int plane); uint32_t (*bo_get_stride)(struct gbm_bo *bo, int plane); + uint32_t (*bo_get_offset)(struct gbm_bo *bo, int plane); void (*bo_destroy)(struct gbm_bo *bo); struct gbm_surface *(*surface_create)(struct gbm_device *gbm, -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] gbm: Export a getter for per plane handles
v2: Make the error return be -1 instead of 0 because I think 0 is actually valid. v3: Set errno to EINVAL when the specified plane is above the total planes. (Jason Ekstrand) Return the bo's handle if there is no image ie. for dumb images like cursor (Daniel) Signed-off-by: Ben WidawskyAcked-by: Daniel Stone --- src/gbm/backends/dri/gbm_dri.c | 35 +++ src/gbm/gbm-symbols-check | 1 + src/gbm/main/gbm.c | 18 ++ src/gbm/main/gbm.h | 3 +++ src/gbm/main/gbmint.h | 1 + 5 files changed, 58 insertions(+) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 0b75e411df..c3704e505b 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -624,6 +624,40 @@ gbm_dri_bo_get_planes(struct gbm_bo *_bo) return get_number_planes(dri, bo->image); } +static union gbm_bo_handle +gbm_dri_bo_get_handle_for_plane(struct gbm_bo *_bo, int plane) +{ + struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); + struct gbm_dri_bo *bo = gbm_dri_bo(_bo); + union gbm_bo_handle ret; + ret.s32 = -1; + + if (!dri->image || dri->image->base.version < 13 || !dri->image->fromPlanar) { + errno = ENOSYS; + return ret; + } + + if (plane >= get_number_planes(dri, bo->image)) { + errno = EINVAL; + return ret; + } + + if (!bo->image) { + ret.s32 = bo->handle; + return ret; + } + + __DRIimage *image = dri->image->fromPlanar(bo->image, plane, NULL); + if (!image) { + /* Use the parent's handle */ + image = bo->image; + } + + dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_HANDLE, ); + + return ret; +} + static void gbm_dri_bo_destroy(struct gbm_bo *_bo) { @@ -1087,6 +1121,7 @@ dri_device_create(int fd) dri->base.base.bo_write = gbm_dri_bo_write; dri->base.base.bo_get_fd = gbm_dri_bo_get_fd; dri->base.base.bo_get_planes = gbm_dri_bo_get_planes; + dri->base.base.bo_get_handle = gbm_dri_bo_get_handle_for_plane; dri->base.base.bo_destroy = gbm_dri_bo_destroy; dri->base.base.destroy = dri_destroy; dri->base.base.surface_create = gbm_dri_surface_create; diff --git a/src/gbm/gbm-symbols-check b/src/gbm/gbm-symbols-check index 8c4da1b7ea..1e6dd4d3ec 100755 --- a/src/gbm/gbm-symbols-check +++ b/src/gbm/gbm-symbols-check @@ -19,6 +19,7 @@ gbm_bo_get_device gbm_bo_get_handle gbm_bo_get_fd gbm_bo_get_plane_count +gbm_bo_get_handle_for_plane gbm_bo_write gbm_bo_set_user_data gbm_bo_get_user_data diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 3779517564..066ceffc0a 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -234,6 +234,24 @@ gbm_bo_get_plane_count(struct gbm_bo *bo) return bo->gbm->bo_get_planes(bo); } +/** Get the handle for the specified plane of the buffer object + * + * This function gets the handle for any plane associated with the BO. When + * dealing with multi-planar formats, or formats which might have implicit + * planes based on different underlying hardware it is necessary for the client + * to be able to get this information to pass to the DRM. + * + * \param bo The buffer object + * \param plane the plane to get a handle for + * + * \sa gbm_bo_get_handle() + */ +GBM_EXPORT union gbm_bo_handle +gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane) +{ + return bo->gbm->bo_get_handle(bo, plane); +} + /** Write data into the buffer object * * If the buffer object was created with the GBM_BO_USE_WRITE flag, diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 203a236357..67548206c4 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -318,6 +318,9 @@ gbm_bo_get_fd(struct gbm_bo *bo); int gbm_bo_get_plane_count(struct gbm_bo *bo); +union gbm_bo_handle +gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane); + int gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count); diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h index c6a6701464..0ec531d099 100644 --- a/src/gbm/main/gbmint.h +++ b/src/gbm/main/gbmint.h @@ -77,6 +77,7 @@ struct gbm_device { int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data); int (*bo_get_fd)(struct gbm_bo *bo); int (*bo_get_planes)(struct gbm_bo *bo); + union gbm_bo_handle (*bo_get_handle)(struct gbm_bo *bo, int plane); void (*bo_destroy)(struct gbm_bo *bo); struct gbm_surface *(*surface_create)(struct gbm_device *gbm, -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/5] Per plane GBM functions
This was the first chunk of the Renderbuffer Decompression series (aka GBM modifiers). Splitting this up to make merging easier. These patches are just the new GBM entry points for the functions required to support modifiers. Cc: Kristian H. KristensenCc: Daniel Stone Cc: Eric Engestrom Cc: Jason Ekstrand Ben Widawsky (5): gbm: Export a plane getter function gbm: Export a getter for per plane handles gbm: Create a gbm_device getter for stride gbm: Export a per plane getter for stride gbm: Export a per plane getter for offset src/gbm/backends/dri/gbm_dri.c | 135 + src/gbm/gbm-symbols-check | 4 ++ src/gbm/main/gbm.c | 58 +- src/gbm/main/gbm.h | 12 src/gbm/main/gbmint.h | 4 ++ 5 files changed, 212 insertions(+), 1 deletion(-) -- 2.12.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/51] i965: Order write of query availablity with earlier writes
Chris Wilsonwrites: > Currently we signal the availabilty of the query result using an > unordered pipe-control write. As it is unordered, it may be executed > before the write of the query result itself - and so an observer may > read the query result too early. Fix this by requesting that the write > of the availablity flag is ordered after earlier pipe control writes. > > Testcase: piglit/arb_query_buffer_object-qbo/*async* > Signed-off-by: Chris Wilson > --- > src/mesa/drivers/dri/i965/gen6_queryobj.c | 12 ++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c > b/src/mesa/drivers/dri/i965/gen6_queryobj.c > index bbd3c44fb0..f6b90f77ea 100644 > --- a/src/mesa/drivers/dri/i965/gen6_queryobj.c > +++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c > @@ -60,8 +60,16 @@ set_query_availability(struct brw_context *brw, struct > brw_query_object *query, > */ > if (brw->ctx.Extensions.ARB_query_buffer_object && > brw_is_query_pipelined(query)) { > - brw_emit_pipe_control_write(brw, > - PIPE_CONTROL_WRITE_IMMEDIATE, > + unsigned flags = PIPE_CONTROL_WRITE_IMMEDIATE; > + > + if (available) > + /* Order available *after* the query results */ > + flags |= PIPE_CONTROL_FLUSH_ENABLE; > + else > + /* Make it unavailable *before* any pipelined reads */ > + flags |= PIPE_CONTROL_CS_STALL; AFAIUI this may not actually guarantee that the immediate write will have landed in memory by the time the CS reaches a subsequent pipeline read, it only guarantees that the sync operation will have completed by that time, but not necessarily the post-sync operation used here to update the availability flag. I believe we want a separate PIPE_CONTROL command with CS Stall+Pipe Control Flush set, probably somewhere close to the pipelined read of the availability flag. > + > + brw_emit_pipe_control_write(brw, flags, >query->bo, 2 * sizeof(uint64_t), >available, 0); > } > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] configure.ac: Ensure libomxil-bellagio exists before invoking pkg-config.
On Mon, Mar 6, 2017 at 4:57 PM, Emil Velikovwrote: > On 6 March 2017 at 19:06, Matt Turner wrote: >> I was already tired of seeing the message >> >> Package libomxil-bellagio was not found in the pkg-config search path. >> Perhaps you should add the directory containing `libomxil-bellagio.pc' >> to the PKG_CONFIG_PATH environment variable >> No package 'libomxil-bellagio' found >> >> on every configure, but I just got a distro bug reported where the user >> was confused by this message and thought it indicated a bug. >> --- >> configure.ac | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/configure.ac b/configure.ac >> index d483baa..8d78aa6 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -2195,7 +2195,8 @@ AC_ARG_WITH([omx-libdir], >> [AS_HELP_STRING([--with-omx-libdir=DIR], >> [directory for the OMX libraries])], >> [OMX_LIB_INSTALL_DIR="$withval"], >> -[OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir >> --variable=pluginsdir libomxil-bellagio`]) >> +[OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir >> --exists libomxil-bellagio && \ > We don't need the --define-variable in the above case, do we ? With > that fixed (or with comment in the summary why we need it) the whole I don't know why it's needed to begin with. I presume it's to handle a case where OMX's plugindir is within some non-standard libdir specified by the user. The "--define-variable=..." might be necessary, I don't know how to test it, and I don't think it could hurt anything so I'd rather not touch it. > series is > Reviewed-by: Emil Velikov Thanks! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100063] vsync setting of OpenGL programs is ignored
https://bugs.freedesktop.org/show_bug.cgi?id=100063 --- Comment #7 from Michel Dänzer--- E.g. the VSync setting in Unigine Valley works as expected for me (note that changing the setting only takes effect after clicking the OK button as well). -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/14] gallium: s/uint/enum pipe_render_cond_flag/ for set_render_condition()
--- src/gallium/auxiliary/cso_cache/cso_context.c | 3 ++- src/gallium/auxiliary/cso_cache/cso_context.h | 3 ++- src/gallium/auxiliary/util/u_blitter.h | 2 +- src/gallium/drivers/ddebug/dd_context.c | 2 +- src/gallium/drivers/freedreno/freedreno_query.c | 2 +- src/gallium/drivers/nouveau/nv30/nv30_query.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_query.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 2 +- src/gallium/drivers/r300/r300_query.c | 2 +- src/gallium/drivers/radeon/r600_query.c | 2 +- src/gallium/drivers/svga/svga_pipe_query.c | 2 +- src/gallium/drivers/swr/swr_context.cpp | 2 +- src/gallium/drivers/trace/tr_context.c | 2 +- src/gallium/drivers/virgl/virgl_encode.c| 2 +- src/gallium/drivers/virgl/virgl_encode.h| 2 +- src/gallium/drivers/virgl/virgl_query.c | 2 +- src/gallium/include/pipe/p_context.h| 2 +- 17 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index d033ed3..3d3c44c 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -852,7 +852,8 @@ cso_restore_stencil_ref(struct cso_context *ctx) void cso_set_render_condition(struct cso_context *ctx, struct pipe_query *query, - boolean condition, uint mode) + boolean condition, + enum pipe_render_cond_flag mode) { struct pipe_context *pipe = ctx->pipe; diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 56b1f82..742bbb5 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -150,7 +150,8 @@ void cso_set_stencil_ref(struct cso_context *cso, void cso_set_render_condition(struct cso_context *cso, struct pipe_query *query, - boolean condition, uint mode); + boolean condition, + enum pipe_render_cond_flag mode); #define CSO_BIT_AUX_VERTEX_BUFFER_SLOT0x1 diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index d7d9f4a..f47c3dd 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -535,7 +535,7 @@ static inline void util_blitter_save_render_condition(struct blitter_context *blitter, struct pipe_query *query, boolean condition, - uint mode) + enum pipe_render_cond_flag mode) { blitter->saved_render_cond_query = query; blitter->saved_render_cond_mode = mode; diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c index b425fb7..ed8c51b 100644 --- a/src/gallium/drivers/ddebug/dd_context.c +++ b/src/gallium/drivers/ddebug/dd_context.c @@ -161,7 +161,7 @@ dd_context_set_active_query_state(struct pipe_context *_pipe, boolean enable) static void dd_context_render_condition(struct pipe_context *_pipe, struct pipe_query *query, boolean condition, -uint mode) +enum pipe_render_cond_flag mode) { struct dd_context *dctx = dd_context(_pipe); struct pipe_context *pipe = dctx->pipe; diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c index 18e0c79..1e72c6d 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.c +++ b/src/gallium/drivers/freedreno/freedreno_query.c @@ -84,7 +84,7 @@ fd_get_query_result(struct pipe_context *pctx, struct pipe_query *pq, static void fd_render_condition(struct pipe_context *pctx, struct pipe_query *pq, - boolean condition, uint mode) + boolean condition, enum pipe_render_cond_flag mode) { struct fd_context *ctx = fd_context(pctx); ctx->cond_query = pq; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_query.c b/src/gallium/drivers/nouveau/nv30/nv30_query.c index aa9a12f..83ea3af 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_query.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_query.c @@ -238,7 +238,7 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq, static void nv40_query_render_condition(struct pipe_context *pipe, struct pipe_query *pq, -boolean condition, uint mode) +boolean condition, enum pipe_render_cond_flag mode) { struct nv30_context *nv30 = nv30_context(pipe); struct nv30_query *q = nv30_query(pq); diff --git
[Mesa-dev] [PATCH 06/14] llvmpipe: s/unsigned/enum pipe_shader_type/
--- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 01af052..c9aba1a 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -241,7 +241,7 @@ prepare_shader_sampling( struct llvmpipe_context *lp, unsigned num, struct pipe_sampler_view **views, - unsigned shader_type) + enum pipe_shader_type shader_type) { unsigned i; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/14] softpipe: s/unsigned/enum pipe_shader_type/
--- src/gallium/drivers/softpipe/sp_state_derived.c | 2 +- src/gallium/drivers/softpipe/sp_state_sampler.c | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c| 3 ++- src/gallium/drivers/softpipe/sp_tex_sample.h| 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 0083e33..f34997a 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -282,7 +282,7 @@ compute_cliprect(struct softpipe_context *sp) static void set_shader_sampler(struct softpipe_context *softpipe, - unsigned shader, + enum pipe_shader_type shader, int max_sampler) { int i; diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index a4185c2..c10fd91 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -167,7 +167,7 @@ prepare_shader_sampling( struct softpipe_context *sp, unsigned num, struct pipe_sampler_view **views, - unsigned shader_type, + enum pipe_shader_type shader_type, struct pipe_resource *mapped_tex[PIPE_MAX_SHADER_SAMPLER_VIEWS]) { diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index c457f89..3a8ad2e 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -3443,7 +3443,8 @@ softpipe_create_sampler_state(struct pipe_context *pipe, compute_lambda_func -softpipe_get_lambda_func(const struct pipe_sampler_view *view, unsigned shader) +softpipe_get_lambda_func(const struct pipe_sampler_view *view, + enum pipe_shader_type shader) { if (shader != PIPE_SHADER_FRAGMENT) return compute_lambda_vert; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index d591487..f7774f5 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -155,7 +155,8 @@ struct sp_tgsi_sampler }; compute_lambda_func -softpipe_get_lambda_func(const struct pipe_sampler_view *view, unsigned shader); +softpipe_get_lambda_func(const struct pipe_sampler_view *view, + enum pipe_shader_type shader); void * -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/14] etnaviv: s/unsigned/enum pipe_shader_type/
--- src/gallium/drivers/etnaviv/etnaviv_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c index 1d32c12..93b077b 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -71,7 +71,7 @@ etna_create_sampler_state(struct pipe_context *pipe, } static void -etna_bind_sampler_states(struct pipe_context *pctx, unsigned shader, +etna_bind_sampler_states(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start_slot, unsigned num_samplers, void **samplers) { @@ -292,7 +292,7 @@ etna_vertex_set_sampler_views(struct etna_context *ctx, unsigned nr, } static void -etna_set_sampler_views(struct pipe_context *pctx, unsigned shader, +etna_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start_slot, unsigned num_views, struct pipe_sampler_view **views) { -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/14] draw: s/unsigned/enum pipe_shader_type/
and some s/uint/enum pipe_shader_type/ --- src/gallium/auxiliary/draw/draw_context.c | 10 +- src/gallium/auxiliary/draw/draw_context.h | 10 +- src/gallium/auxiliary/draw/draw_llvm.c| 4 ++-- src/gallium/auxiliary/draw/draw_llvm.h| 5 +++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 46dd0b4..8f1189a 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -440,7 +440,7 @@ draw_set_mapped_vertex_buffer(struct draw_context *draw, void draw_set_mapped_constant_buffer(struct draw_context *draw, -unsigned shader_type, +enum pipe_shader_type shader_type, unsigned slot, const void *buffer, unsigned size ) @@ -720,7 +720,7 @@ draw_total_gs_outputs(const struct draw_context *draw) */ void draw_texture_sampler(struct draw_context *draw, - uint shader, + enum pipe_shader_type shader, struct tgsi_sampler *sampler) { if (shader == PIPE_SHADER_VERTEX) { @@ -738,7 +738,7 @@ draw_texture_sampler(struct draw_context *draw, */ void draw_image(struct draw_context *draw, - uint shader, + enum pipe_shader_type shader, struct tgsi_image *image) { if (shader == PIPE_SHADER_VERTEX) { @@ -756,7 +756,7 @@ draw_image(struct draw_context *draw, */ void draw_buffer(struct draw_context *draw, -uint shader, +enum pipe_shader_type shader, struct tgsi_buffer *buffer) { if (shader == PIPE_SHADER_VERTEX) { @@ -1011,7 +1011,7 @@ draw_set_samplers(struct draw_context *draw, void draw_set_mapped_texture(struct draw_context *draw, -unsigned shader_stage, +enum pipe_shader_type shader_stage, unsigned sview_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t first_level, uint32_t last_level, diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index e605cd6..d8a1470 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -152,17 +152,17 @@ draw_total_gs_outputs(const struct draw_context *draw); void draw_texture_sampler(struct draw_context *draw, - uint shader_type, + enum pipe_shader_type shader_type, struct tgsi_sampler *sampler); void draw_image(struct draw_context *draw, - uint shader_type, + enum pipe_shader_type shader_type, struct tgsi_image *image); void draw_buffer(struct draw_context *draw, - uint shader_type, + enum pipe_shader_type shader_type, struct tgsi_buffer *buffer); void @@ -178,7 +178,7 @@ draw_set_samplers(struct draw_context *draw, void draw_set_mapped_texture(struct draw_context *draw, -unsigned shader_stage, +enum pipe_shader_type shader_stage, unsigned sview_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t first_level, uint32_t last_level, @@ -249,7 +249,7 @@ void draw_set_mapped_vertex_buffer(struct draw_context *draw, void draw_set_mapped_constant_buffer(struct draw_context *draw, -unsigned shader_type, +enum pipe_shader_type shader_type, unsigned slot, const void *buffer, unsigned size); diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 8952dc8..104965b 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -2068,7 +2068,7 @@ draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key) void draw_llvm_set_mapped_texture(struct draw_context *draw, - unsigned shader_stage, + enum pipe_shader_type shader_stage, unsigned sview_idx, uint32_t width, uint32_t height, uint32_t depth, uint32_t first_level, uint32_t last_level, @@ -2113,7 +2113,7 @@ draw_llvm_set_mapped_texture(struct draw_context *draw, void draw_llvm_set_sampler_state(struct draw_context *draw, -unsigned shader_type) +enum pipe_shader_type shader_type) { unsigned i; diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index
[Mesa-dev] [PATCH 01/14] gallium: s/unsigned/enum pipe_shader_type/ for pipe_screen::get_shader_param()
--- src/gallium/auxiliary/draw/draw_context.c| 5 +++-- src/gallium/auxiliary/draw/draw_context.h| 5 +++-- src/gallium/auxiliary/util/u_inlines.h | 3 ++- src/gallium/drivers/ddebug/dd_screen.c | 3 ++- src/gallium/drivers/etnaviv/etnaviv_screen.c | 3 ++- src/gallium/drivers/freedreno/freedreno_screen.c | 3 ++- src/gallium/drivers/i915/i915_screen.c | 4 +++- src/gallium/drivers/llvmpipe/lp_screen.c | 4 +++- src/gallium/drivers/noop/noop_pipe.c | 4 +++- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 3 ++- src/gallium/drivers/nouveau/nv50/nv50_screen.c | 3 ++- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 3 ++- src/gallium/drivers/r300/r300_screen.c | 6 +- src/gallium/drivers/r600/r600_pipe.c | 4 +++- src/gallium/drivers/radeonsi/si_pipe.c | 4 +++- src/gallium/drivers/rbug/rbug_screen.c | 3 ++- src/gallium/drivers/softpipe/sp_screen.c | 4 +++- src/gallium/drivers/svga/svga_screen.c | 8 +--- src/gallium/drivers/swr/swr_screen.cpp | 2 +- src/gallium/drivers/trace/tr_screen.c| 5 +++-- src/gallium/drivers/vc4/vc4_screen.c | 5 +++-- src/gallium/drivers/virgl/virgl_screen.c | 4 +++- src/gallium/include/pipe/p_screen.h | 3 ++- 23 files changed, 62 insertions(+), 29 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 56abcff..46dd0b4 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -1036,7 +1036,8 @@ draw_set_mapped_texture(struct draw_context *draw, * different ways of setting textures, and drivers typically only support one. */ int -draw_get_shader_param_no_llvm(unsigned shader, enum pipe_shader_cap param) +draw_get_shader_param_no_llvm(enum pipe_shader_type shader, + enum pipe_shader_cap param) { switch(shader) { case PIPE_SHADER_VERTEX: @@ -1054,7 +1055,7 @@ draw_get_shader_param_no_llvm(unsigned shader, enum pipe_shader_cap param) * draw_get_shader_param_no_llvm instead. */ int -draw_get_shader_param(unsigned shader, enum pipe_shader_cap param) +draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param) { #ifdef HAVE_LLVM diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 145fc2e..e605cd6 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -299,10 +299,11 @@ boolean draw_need_pipeline(const struct draw_context *draw, unsigned prim ); int -draw_get_shader_param(unsigned shader, enum pipe_shader_cap param); +draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param); int -draw_get_shader_param_no_llvm(unsigned shader, enum pipe_shader_cap param); +draw_get_shader_param_no_llvm(enum pipe_shader_type shader, + enum pipe_shader_cap param); boolean draw_get_option_use_llvm(void); diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index b7b8313..6bc5e66 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -458,7 +458,8 @@ pipe_transfer_unmap( struct pipe_context *context, } static inline void -pipe_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, +pipe_set_constant_buffer(struct pipe_context *pipe, + enum pipe_shader_type shader, uint index, struct pipe_resource *buf) { if (buf) { diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 0e8bd48..9642532 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -93,7 +93,8 @@ dd_screen_get_compute_param(struct pipe_screen *_screen, } static int -dd_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader, +dd_screen_get_shader_param(struct pipe_screen *_screen, + enum pipe_shader_type shader, enum pipe_shader_cap param) { struct pipe_screen *screen = dd_screen(_screen)->screen; diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index ab436b9..0cd2737 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -353,7 +353,8 @@ etna_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param) } static int -etna_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, +etna_screen_get_shader_param(struct pipe_screen *pscreen, + enum pipe_shader_type shader, enum pipe_shader_cap param) { struct etna_screen *screen = etna_screen(pscreen); diff
[Mesa-dev] [PATCH 09/14] virgl: s/unsigned/enum pipe_shader_type/
--- src/gallium/drivers/virgl/virgl_context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 2ee89d7..65ca9b3 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -99,7 +99,7 @@ static void virgl_attach_res_framebuffer(struct virgl_context *vctx) } static void virgl_attach_res_sampler_views(struct virgl_context *vctx, - unsigned shader_type) + enum pipe_shader_type shader_type) { struct virgl_winsys *vws = virgl_screen(vctx->base.screen)->vws; struct virgl_textures_info *tinfo = >samplers[shader_type]; @@ -153,7 +153,7 @@ static void virgl_attach_res_so_targets(struct virgl_context *vctx) } static void virgl_attach_res_uniform_buffers(struct virgl_context *vctx, - unsigned shader_type) + enum pipe_shader_type shader_type) { struct virgl_winsys *vws = virgl_screen(vctx->base.screen)->vws; struct virgl_resource *res; @@ -172,7 +172,7 @@ static void virgl_attach_res_uniform_buffers(struct virgl_context *vctx, */ static void virgl_reemit_res(struct virgl_context *vctx) { - unsigned shader_type; + enum pipe_shader_type shader_type; /* reattach any flushed resources */ /* framebuffer, sampler views, vertex/index/uniform/stream buffers */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/14] swr: s/unsigned/enum pipe_shader_type/
--- src/gallium/drivers/swr/swr_shader.cpp | 2 +- src/gallium/drivers/swr/swr_state.cpp | 4 ++-- src/gallium/drivers/swr/swr_tex_sample.cpp | 4 ++-- src/gallium/drivers/swr/swr_tex_sample.h | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp index 09d8145..a449c58 100644 --- a/src/gallium/drivers/swr/swr_shader.cpp +++ b/src/gallium/drivers/swr/swr_shader.cpp @@ -76,7 +76,7 @@ bool operator==(const swr_jit_gs_key , const swr_jit_gs_key ) static void swr_generate_sampler_key(const struct lp_tgsi_info , struct swr_context *ctx, - unsigned shader_type, + enum pipe_shader_type shader_type, struct swr_jit_sampler_key ) { key.nr_samplers = info.base.file_max[TGSI_FILE_SAMPLER] + 1; diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index b389664..fb284d8 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -748,7 +748,7 @@ swr_update_resource_status(struct pipe_context *pipe, static void swr_update_texture_state(struct swr_context *ctx, - unsigned shader_type, + enum pipe_shader_type shader_type, unsigned num_sampler_views, swr_jit_texture *textures) { @@ -802,7 +802,7 @@ swr_update_texture_state(struct swr_context *ctx, static void swr_update_sampler_state(struct swr_context *ctx, - unsigned shader_type, + enum pipe_shader_type shader_type, unsigned num_samplers, swr_jit_sampler *samplers) { diff --git a/src/gallium/drivers/swr/swr_tex_sample.cpp b/src/gallium/drivers/swr/swr_tex_sample.cpp index 37ad39b..ec2fa15 100644 --- a/src/gallium/drivers/swr/swr_tex_sample.cpp +++ b/src/gallium/drivers/swr/swr_tex_sample.cpp @@ -74,7 +74,7 @@ struct swr_sampler_dynamic_state { const struct swr_sampler_static_state *static_state; - unsigned shader_type; + enum pipe_shader_type shader_type; }; @@ -325,7 +325,7 @@ swr_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct lp_build_sampler_soa * swr_sampler_soa_create(const struct swr_sampler_static_state *static_state, - unsigned shader_type) + enum pipe_shader_type shader_type) { struct swr_sampler_soa *sampler; diff --git a/src/gallium/drivers/swr/swr_tex_sample.h b/src/gallium/drivers/swr/swr_tex_sample.h index cb7e83d..715ca3c 100644 --- a/src/gallium/drivers/swr/swr_tex_sample.h +++ b/src/gallium/drivers/swr/swr_tex_sample.h @@ -44,4 +44,5 @@ struct swr_sampler_static_state { * */ struct lp_build_sampler_soa * -swr_sampler_soa_create(const struct swr_sampler_static_state *key, unsigned shader_type); +swr_sampler_soa_create(const struct swr_sampler_static_state *key, + enum pipe_shader_type shader_type); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/14] freedreno: s/unsigned/enum pipe_shader_type/
--- src/gallium/drivers/freedreno/freedreno_texture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/freedreno_texture.h b/src/gallium/drivers/freedreno/freedreno_texture.h index 6124532..b12ce2f 100644 --- a/src/gallium/drivers/freedreno/freedreno_texture.h +++ b/src/gallium/drivers/freedreno/freedreno_texture.h @@ -32,7 +32,7 @@ #include "pipe/p_context.h" void fd_sampler_states_bind(struct pipe_context *pctx, - unsigned shader, unsigned start, + enum pipe_shader_type shader, unsigned start, unsigned nr, void **hwcso); void fd_set_sampler_views(struct pipe_context *pctx, -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/14] gallium: s/uint/enum pipe_shader_type/ for set_constant_buffer()
--- src/gallium/drivers/ddebug/dd_context.c | 2 +- src/gallium/drivers/etnaviv/etnaviv_state.c | 3 ++- src/gallium/drivers/freedreno/freedreno_state.c | 3 ++- src/gallium/drivers/i915/i915_state.c | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 2 +- src/gallium/drivers/noop/noop_state.c | 2 +- src/gallium/drivers/nouveau/nv30/nv30_state.c | 3 ++- src/gallium/drivers/nouveau/nv50/nv50_state.c | 3 ++- src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 3 ++- src/gallium/drivers/r300/r300_state.c | 2 +- src/gallium/drivers/r600/r600_state_common.c| 3 ++- src/gallium/drivers/radeonsi/si_descriptors.c | 2 +- src/gallium/drivers/rbug/rbug_context.c | 2 +- src/gallium/drivers/softpipe/sp_state_shader.c | 2 +- src/gallium/drivers/svga/svga_pipe_constants.c | 2 +- src/gallium/drivers/swr/swr_state.cpp | 2 +- src/gallium/drivers/trace/tr_context.c | 2 +- src/gallium/drivers/vc4/vc4_state.c | 3 ++- src/gallium/drivers/virgl/virgl_context.c | 2 +- src/gallium/include/pipe/p_context.h| 2 +- 20 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c index ba47b73..b425fb7 100644 --- a/src/gallium/drivers/ddebug/dd_context.c +++ b/src/gallium/drivers/ddebug/dd_context.c @@ -371,7 +371,7 @@ DD_IMM_STATE(polygon_stipple, const struct pipe_poly_stipple, *state, state) static void dd_context_set_constant_buffer(struct pipe_context *_pipe, - uint shader, uint index, + enum pipe_shader_type shader, uint index, const struct pipe_constant_buffer *constant_buffer) { struct dd_context *dctx = dd_context(_pipe); diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index 141a34a..dbb6c54 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -86,7 +86,8 @@ etna_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask) } static void -etna_set_constant_buffer(struct pipe_context *pctx, uint shader, uint index, +etna_set_constant_buffer(struct pipe_context *pctx, + enum pipe_shader_type shader, uint index, const struct pipe_constant_buffer *cb) { struct etna_context *ctx = etna_context(pctx); diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index 8c90405..804d2b7 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -89,7 +89,8 @@ fd_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask) * index>0 will be UBO's.. well, I'll worry about that later */ static void -fd_set_constant_buffer(struct pipe_context *pctx, uint shader, uint index, +fd_set_constant_buffer(struct pipe_context *pctx, + enum pipe_shader_type shader, uint index, const struct pipe_constant_buffer *cb) { struct fd_context *ctx = fd_context(pctx); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 9506044..3747922 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -675,7 +675,7 @@ static void i915_delete_vs_state(struct pipe_context *pipe, void *shader) } static void i915_set_constant_buffer(struct pipe_context *pipe, - uint shader, uint index, + enum pipe_shader_type shader, uint index, const struct pipe_constant_buffer *cb) { struct i915_context *i915 = i915_context(pipe); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index af47b52..e666959 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -3054,7 +3054,7 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs) static void llvmpipe_set_constant_buffer(struct pipe_context *pipe, - uint shader, uint index, + enum pipe_shader_type shader, uint index, const struct pipe_constant_buffer *cb) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c index 7ae89c8..32a54e9 100644 --- a/src/gallium/drivers/noop/noop_state.c +++ b/src/gallium/drivers/noop/noop_state.c @@ -158,7 +158,7 @@ static void noop_set_framebuffer_state(struct pipe_context *ctx, } static void noop_set_constant_buffer(struct pipe_context *ctx, - uint shader, uint index, + enum pipe_shader_type shader, uint index,
[Mesa-dev] [PATCH 14/14] util/indices: minor clean-ups
--- src/gallium/auxiliary/indices/u_indices.c | 2 +- src/gallium/auxiliary/indices/u_indices_gen.py | 5 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c index cb9e460..3d1ebed 100644 --- a/src/gallium/auxiliary/indices/u_indices.c +++ b/src/gallium/auxiliary/indices/u_indices.c @@ -85,7 +85,7 @@ u_index_translator(unsigned hw_mask, { unsigned in_idx; unsigned out_idx; - int ret = U_TRANSLATE_NORMAL; + enum indices_mode ret = U_TRANSLATE_NORMAL; assert(in_index_size == 1 || in_index_size == 2 || diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py index fb6b310..23d8bd7 100644 --- a/src/gallium/auxiliary/indices/u_indices_gen.py +++ b/src/gallium/auxiliary/indices/u_indices_gen.py @@ -70,7 +70,7 @@ pv_idx = dict(first='PV_FIRST', last='PV_LAST') pr_idx = dict(prdisable='PR_DISABLE', prenable='PR_ENABLE') def prolog(): -print '''/* File automatically generated by indices.py */''' +print '''/* File automatically generated by u_indices_gen.py */''' print copyright print r''' @@ -79,11 +79,8 @@ def prolog(): * Functions to translate and generate index lists */ -#include "indices/u_indices.h" #include "indices/u_indices_priv.h" -#include "pipe/p_compiler.h" #include "util/u_debug.h" -#include "pipe/p_defines.h" #include "util/u_memory.h" -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] assorted uint/unsigned -> enum clean-ups
Use gallium enum types in a bunch of places. I compile tested most drivers, but not all. Easy work to do on an airplane. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/14] radeonsi: s/uint/enum pipe_shader_type/
This can probably be done in more places in the driver. --- src/gallium/drivers/radeonsi/si_descriptors.c | 3 ++- src/gallium/drivers/radeonsi/si_state.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index f7cf6b7..10acb27 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -1230,7 +1230,8 @@ static void si_set_shader_buffers(struct pipe_context *ctx, } } -void si_get_shader_buffers(struct si_context *sctx, uint shader, +void si_get_shader_buffers(struct si_context *sctx, + enum pipe_shader_type shader, uint start_slot, uint count, struct pipe_shader_buffer *sbuf) { diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index f572d2f..88827a8 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -289,7 +289,8 @@ void si_set_mutable_tex_desc_fields(struct r600_texture *tex, uint32_t *state); void si_get_pipe_constant_buffer(struct si_context *sctx, uint shader, uint slot, struct pipe_constant_buffer *cbuf); -void si_get_shader_buffers(struct si_context *sctx, uint shader, +void si_get_shader_buffers(struct si_context *sctx, + enum pipe_shader_type shader, uint start_slot, uint count, struct pipe_shader_buffer *sbuf); void si_set_ring_buffer(struct pipe_context *ctx, uint slot, -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/14] cso: s/unsigned/enum pipe_shader_type/
--- src/gallium/auxiliary/cso_cache/cso_context.c | 11 ++- src/gallium/auxiliary/cso_cache/cso_context.h | 11 ++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 0f12304..d033ed3 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -1203,7 +1203,7 @@ unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx) enum pipe_error -cso_single_sampler(struct cso_context *ctx, unsigned shader_stage, +cso_single_sampler(struct cso_context *ctx, enum pipe_shader_type shader_stage, unsigned idx, const struct pipe_sampler_state *templ) { if (templ) { @@ -1537,7 +1537,8 @@ cso_restore_stream_outputs(struct cso_context *ctx) /* constant buffers */ void -cso_set_constant_buffer(struct cso_context *cso, unsigned shader_stage, +cso_set_constant_buffer(struct cso_context *cso, +enum pipe_shader_type shader_stage, unsigned index, struct pipe_constant_buffer *cb) { struct pipe_context *pipe = cso->pipe; @@ -1551,7 +1552,7 @@ cso_set_constant_buffer(struct cso_context *cso, unsigned shader_stage, void cso_set_constant_buffer_resource(struct cso_context *cso, - unsigned shader_stage, + enum pipe_shader_type shader_stage, unsigned index, struct pipe_resource *buffer) { @@ -1569,7 +1570,7 @@ cso_set_constant_buffer_resource(struct cso_context *cso, void cso_save_constant_buffer_slot0(struct cso_context *cso, - unsigned shader_stage) + enum pipe_shader_type shader_stage) { util_copy_constant_buffer(>aux_constbuf_saved[shader_stage], >aux_constbuf_current[shader_stage]); @@ -1577,7 +1578,7 @@ cso_save_constant_buffer_slot0(struct cso_context *cso, void cso_restore_constant_buffer_slot0(struct cso_context *cso, - unsigned shader_stage) + enum pipe_shader_type shader_stage) { cso_set_constant_buffer(cso, shader_stage, 0, >aux_constbuf_saved[shader_stage]); diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 2a65354..56b1f82 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -70,7 +70,7 @@ cso_set_samplers(struct cso_context *cso, * samplers one at a time: */ enum pipe_error -cso_single_sampler(struct cso_context *cso, unsigned shader_stage, +cso_single_sampler(struct cso_context *cso, enum pipe_shader_type shader_stage, unsigned idx, const struct pipe_sampler_state *states); void @@ -205,16 +205,17 @@ cso_set_shader_images(struct cso_context *cso, /* constant buffers */ -void cso_set_constant_buffer(struct cso_context *cso, unsigned shader_stage, +void cso_set_constant_buffer(struct cso_context *cso, + enum pipe_shader_type shader_stage, unsigned index, struct pipe_constant_buffer *cb); void cso_set_constant_buffer_resource(struct cso_context *cso, - unsigned shader_stage, + enum pipe_shader_type shader_stage, unsigned index, struct pipe_resource *buffer); void cso_save_constant_buffer_slot0(struct cso_context *cso, -unsigned shader_stage); +enum pipe_shader_type shader_stage); void cso_restore_constant_buffer_slot0(struct cso_context *cso, - unsigned shader_stage); + enum pipe_shader_type shader_stage); /* drawing */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/14] gallium: s/unsigned/enum pipe_shader_type/ for get_compiler_options()
--- src/gallium/drivers/vc4/vc4_program.c | 3 ++- src/gallium/drivers/vc4/vc4_screen.h | 3 ++- src/gallium/include/pipe/p_screen.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 2175343..3d45723 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2197,7 +2197,8 @@ static const nir_shader_compiler_options nir_options = { const void * vc4_screen_get_compiler_options(struct pipe_screen *pscreen, -enum pipe_shader_ir ir, unsigned shader) +enum pipe_shader_ir ir, +enum pipe_shader_type shader) { return _options; } diff --git a/src/gallium/drivers/vc4/vc4_screen.h b/src/gallium/drivers/vc4/vc4_screen.h index 1f91ad3..5205772 100644 --- a/src/gallium/drivers/vc4/vc4_screen.h +++ b/src/gallium/drivers/vc4/vc4_screen.h @@ -112,7 +112,8 @@ vc4_screen_bo_from_handle(struct pipe_screen *pscreen, const void * vc4_screen_get_compiler_options(struct pipe_screen *pscreen, -enum pipe_shader_ir ir, unsigned shader); +enum pipe_shader_ir ir, +enum pipe_shader_type shader); extern uint32_t vc4_debug; diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 1606c2d..8b4239c 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -319,7 +319,7 @@ struct pipe_screen { */ const void *(*get_compiler_options)(struct pipe_screen *screen, enum pipe_shader_ir ir, - unsigned shader); + enum pipe_shader_type shader); /** * Returns a pointer to a driver-specific on-disk shader cache. If the -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100063] vsync setting of OpenGL programs is ignored
https://bugs.freedesktop.org/show_bug.cgi?id=100063 Michel Dänzerchanged: What|Removed |Added QA Contact|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop. |.org|org Component|Drivers/Gallium/radeonsi|Mesa core Assignee|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop. |.org|org --- Comment #6 from Michel Dänzer --- Since explicitly setting vblank_mode=0 works, it sounds like either the games are not actually disabling sync-to-vblank properly (an apitrace of toggling the sync-to-vblank setting in-game might shed some light on this), or vblank_mode is set to 3 (which forces sync-to-vblank regardless of what the application requests) in ~/.drirc or /etc/drirc. Anyway, there's no radeonsi specific code involved in this. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100091] Failure to create folder for on-disk shader cache
https://bugs.freedesktop.org/show_bug.cgi?id=100091 Timothy Arcerichanged: What|Removed |Added Component|Drivers/Gallium/radeonsi|Mesa core QA Contact|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop. |.org|org Assignee|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop. |.org|org -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dir-locals.el: use appropriate c-file-style
On Mon, Mar 6, 2017 at 7:44 PM, Ilia Mirkinwrote: > What's the difference between c-file-style linux and stroustrup? The main differences are that stroustrup sets c-basic-offset to 4 while linux uses 8 and linux defines braces around "else" on single line, i.e.: "} else {". Even if these get tweaked, it seems more accurate to use the linux style as a starting point for these directories. I had originally just wanted to add this for the radv code but Michel suggested that we keep consistent .dir-locals.el files where the coding style is the same. Let me know if this isn't right for those other directories in this patch. The full definitions (from the c-style-alist variable) are: ("stroustrup" (c-basic-offset . 4) (c-comment-only-line-offset . 0) (c-offsets-alist (statement-block-intro . +) (substatement-open . 0) (substatement-label . 0) (label . 0) (statement-cont . +))) ("linux" (c-basic-offset . 8) (c-comment-only-line-offset . 0) (c-hanging-braces-alist (brace-list-open) (brace-entry-open) (substatement-open after) (block-close . c-snug-do-while) (arglist-cont-nonempty)) (c-cleanup-list brace-else-brace) (c-offsets-alist (statement-block-intro . +) (knr-argdecl-intro . 0) (substatement-open . 0) (substatement-label . 0) (label . 0) (statement-cont . +))) Thanks, -Damien ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] util/disk_cache: use LRU eviction rather than random eviction (v2)
Still using random selection of two-character subdirectory in which to check cache files rather than scanning entire cache. v2: Factor out double strlen call --- src/util/disk_cache.c | 78 +++ 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 31a9336582..2a923be3dc 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -438,70 +438,60 @@ make_cache_file_directory(struct disk_cache *cache, const cache_key key) free(dir); } -/* Given a directory path and predicate function, count all entries in - * that directory for which the predicate returns true. Then choose a - * random entry from among those counted. +/* Given a directory path and predicate function, find the entry with + * the oldest access time in that directory for which the predicate + * returns true. * * Returns: A malloc'ed string for the path to the chosen file, (or * NULL on any error). The caller should free the string when * finished. */ static char * -choose_random_file_matching(const char *dir_path, -bool (*predicate)(const struct dirent *, - const char *dir_path)) +choose_lru_file_matching(const char *dir_path, + bool (*predicate)(const struct dirent *, + const char *dir_path)) { DIR *dir; struct dirent *entry; - unsigned int count, victim; + struct stat sb; + char *tmp, *lru_name = NULL; + size_t len; + time_t lru_atime = 0; char *filename; dir = opendir(dir_path); if (dir == NULL) return NULL; - count = 0; - - while (1) { - entry = readdir(dir); - if (entry == NULL) - break; - if (!predicate(entry, dir_path)) - continue; - - count++; - } - - if (count == 0) { - closedir(dir); - return NULL; - } - - victim = rand() % count; - - rewinddir(dir); - count = 0; - while (1) { entry = readdir(dir); if (entry == NULL) break; if (!predicate(entry, dir_path)) continue; - if (count == victim) - break; - count++; + if (fstatat(dirfd(dir), entry->d_name, , 0) == 0) { + if (!lru_atime || (sb.st_atime < lru_atime)) { +len = strlen(entry->d_name) + 1; +tmp = realloc(lru_name, len); +if (tmp) { + lru_name = tmp; + memcpy(lru_name, entry->d_name, len); + lru_atime = sb.st_atime; +} + } + } } - if (entry == NULL) { + if (lru_name == NULL) { closedir(dir); return NULL; } - if (asprintf(, "%s/%s", dir_path, entry->d_name) < 0) + if (asprintf(, "%s/%s", dir_path, lru_name) < 0) filename = NULL; + free(lru_name); closedir(dir); return filename; @@ -533,12 +523,12 @@ is_regular_non_tmp_file(const struct dirent *entry, const char *path) /* Returns the size of the deleted file, (or 0 on any error). */ static size_t -unlink_random_file_from_directory(const char *path) +unlink_lru_file_from_directory(const char *path) { struct stat sb; char *filename; - filename = choose_random_file_matching(path, is_regular_non_tmp_file); + filename = choose_lru_file_matching(path, is_regular_non_tmp_file); if (filename == NULL) return 0; @@ -581,7 +571,7 @@ is_two_character_sub_directory(const struct dirent *entry, const char *path) } static void -evict_random_item(struct disk_cache *cache) +evict_lru_item(struct disk_cache *cache) { const char hex[] = "0123456789abcde"; char *dir_path; @@ -591,6 +581,7 @@ evict_random_item(struct disk_cache *cache) /* With a reasonably-sized, full cache, (and with keys generated * from a cryptographic hash), we can choose two random hex digits * and reasonably expect the directory to exist with a file in it. +* Provides pseudo-LRU eviction to reduce checking all cache files. */ a = rand() % 16; b = rand() % 16; @@ -598,7 +589,7 @@ evict_random_item(struct disk_cache *cache) if (asprintf(_path, "%s/%c%c", cache->path, hex[a], hex[b]) < 0) return; - size = unlink_random_file_from_directory(dir_path); + size = unlink_lru_file_from_directory(dir_path); free(dir_path); @@ -608,18 +599,19 @@ evict_random_item(struct disk_cache *cache) } /* In the case where the random choice of directory didn't find -* something, we choose randomly from the existing directories. +* something, we choose the least recently accessed from the +* existing directories. * * Really, the only reason this code exists is to allow the unit * tests to work, (which use an artificially-small cache to be able * to force a single cached item to be evicted). */ - dir_path = choose_random_file_matching(cache->path, -
[Mesa-dev] [PATCH v2] radv: Use the subresource range in HTILE initialization.
v2: fix levelCount assert. Signed-off-by: Bas Nieuwenhuizen--- src/amd/vulkan/radv_cmd_buffer.c | 16 +++- src/amd/vulkan/radv_image.c | 3 +-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 3796ae4b48c..821306556ec 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -2704,14 +2704,20 @@ void radv_CmdEndRenderPass( static void radv_initialize_htile(struct radv_cmd_buffer *cmd_buffer, - struct radv_image *image) + struct radv_image *image, + const VkImageSubresourceRange *range) { + assert(range->baseMipLevel == 0); + assert(range->levelCount == 1 || range->levelCount == VK_REMAINING_ARRAY_LAYERS); + unsigned layer_count = radv_get_layerCount(image, range); + uint64_t size = image->surface.htile_slice_size * layer_count; + uint64_t offset = image->offset + image->htile_offset + + image->surface.htile_slice_size * range->baseArrayLayer; cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB | RADV_CMD_FLAG_FLUSH_AND_INV_DB_META; - radv_fill_buffer(cmd_buffer, image->bo, image->offset + image->htile_offset, -image->surface.htile_size, 0x); + radv_fill_buffer(cmd_buffer, image->bo, offset, size, 0x); cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB_META | RADV_CMD_FLAG_CS_PARTIAL_FLUSH | @@ -2736,10 +2742,10 @@ static void radv_handle_depth_image_transition(struct radv_cmd_buffer *cmd_buffe } else if (src_layout == VK_IMAGE_LAYOUT_UNDEFINED && radv_layout_has_htile(image, dst_layout)) { /* TODO: merge with the clear if applicable */ - radv_initialize_htile(cmd_buffer, image); + radv_initialize_htile(cmd_buffer, image, range); } else if (!radv_layout_has_htile(image, src_layout) && radv_layout_has_htile(image, dst_layout)) { - radv_initialize_htile(cmd_buffer, image); + radv_initialize_htile(cmd_buffer, image, range); } else if ((radv_layout_has_htile(image, src_layout) && !radv_layout_has_htile(image, dst_layout)) || (radv_layout_is_htile_compressed(image, src_layout) && diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 3d650b02716..dfd70a9eab8 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -590,8 +590,7 @@ static void radv_image_alloc_htile(struct radv_device *device, struct radv_image *image) { - if ((device->debug_flags & RADV_DEBUG_NO_HIZ) || image->layers > 1 || - image->levels > 1) { + if ((device->debug_flags & RADV_DEBUG_NO_HIZ) || image->levels > 1) { image->surface.htile_size = 0; return; } -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] configure.ac: Ensure libomxil-bellagio exists before invoking pkg-config.
On 6 March 2017 at 19:06, Matt Turnerwrote: > I was already tired of seeing the message > > Package libomxil-bellagio was not found in the pkg-config search path. > Perhaps you should add the directory containing `libomxil-bellagio.pc' > to the PKG_CONFIG_PATH environment variable > No package 'libomxil-bellagio' found > > on every configure, but I just got a distro bug reported where the user > was confused by this message and thought it indicated a bug. > --- > configure.ac | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index d483baa..8d78aa6 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -2195,7 +2195,8 @@ AC_ARG_WITH([omx-libdir], > [AS_HELP_STRING([--with-omx-libdir=DIR], > [directory for the OMX libraries])], > [OMX_LIB_INSTALL_DIR="$withval"], > -[OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir > --variable=pluginsdir libomxil-bellagio`]) > +[OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir > --exists libomxil-bellagio && \ We don't need the --define-variable in the above case, do we ? With that fixed (or with comment in the summary why we need it) the whole series is Reviewed-by: Emil Velikov -Emiil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] radv: fix the size of the dynamic_buffers array
A buffer descriptor is 16 bytes, not 16 dwords. Signed-off-by: Fredrik Höglund--- src/amd/vulkan/radv_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 30201a67e7..ab7db88e8d 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -728,7 +728,7 @@ struct radv_cmd_buffer { uint32_t queue_family_index; uint8_t push_constants[MAX_PUSH_CONSTANTS_SIZE]; - uint32_t dynamic_buffers[16 * MAX_DYNAMIC_BUFFERS]; + uint32_t dynamic_buffers[4 * MAX_DYNAMIC_BUFFERS]; VkShaderStageFlags push_constant_stages; struct radv_cmd_buffer_upload upload; -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] radv/ac: fix multiple descriptor sets with dynamic buffers
The dynamic_offset_offset in the descriptor set binding layout is relative to the dynamic_offset_start for the set in the pipeline layout. Cc: 17.0Signed-off-by: Fredrik Höglund --- src/amd/common/ac_nir_to_llvm.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index e472408b0c..a1fe2dd133 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1777,15 +1777,17 @@ static LLVMValueRef visit_vulkan_resource_index(struct nir_to_llvm_context *ctx, unsigned desc_set = nir_intrinsic_desc_set(instr); unsigned binding = nir_intrinsic_binding(instr); LLVMValueRef desc_ptr = ctx->descriptor_sets[desc_set]; - struct radv_descriptor_set_layout *layout = ctx->options->layout->set[desc_set].layout; + struct radv_pipeline_layout *pipeline_layout = ctx->options->layout; + struct radv_descriptor_set_layout *layout = pipeline_layout->set[desc_set].layout; unsigned base_offset = layout->binding[binding].offset; LLVMValueRef offset, stride; if (layout->binding[binding].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC || layout->binding[binding].type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) { + unsigned idx = pipeline_layout->set[desc_set].dynamic_offset_start + + layout->binding[binding].dynamic_offset_offset; desc_ptr = ctx->push_constants; - base_offset = ctx->options->layout->push_constant_size; - base_offset += 16 * layout->binding[binding].dynamic_offset_offset; + base_offset = pipeline_layout->push_constant_size + 16 * idx; stride = LLVMConstInt(ctx->i32, 16, false); } else stride = LLVMConstInt(ctx->i32, layout->binding[binding].size, false); -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/3] radv: fix descriptor set bugs with dynamic buffers
This series fixes some bugs related to multiple descriptor sets with dynamic buffers. I've run the dEQP-VK.*descriptor* tests with these changes, and there are no new passes and no new failures. This series is also available at: git://people.freedesktop.org/~fredrik/mesa radv Fredrik Fredrik Höglund (3): radv: fix the dynamic buffer index in vkCmdBindDescriptorSets radv: fix the size of the dynamic_buffers array radv/ac: fix multiple descriptor sets with dynamic buffers src/amd/common/ac_nir_to_llvm.c | 8 +--- src/amd/vulkan/radv_cmd_buffer.c | 2 +- src/amd/vulkan/radv_private.h| 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] radv: fix the dynamic buffer index in vkCmdBindDescriptorSets
This fixes the wrong dynamic buffer descriptors being updated when firstSet > 0. Cc: 17.0Signed-off-by: Fredrik Höglund --- src/amd/vulkan/radv_cmd_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index d99288a672..bc82993e28 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -1823,7 +1823,7 @@ void radv_CmdBindDescriptorSets( radv_bind_descriptor_set(cmd_buffer, set, idx); for(unsigned j = 0; j < set->layout->dynamic_offset_count; ++j, ++dyn_idx) { - unsigned idx = j + layout->set[i].dynamic_offset_start; + unsigned idx = j + layout->set[i + firstSet].dynamic_offset_start; uint32_t *dst = cmd_buffer->dynamic_buffers + idx * 4; assert(dyn_idx < dynamicOffsetCount); -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/6] build: Replace NEED_RADEON_LLVM with HAVE_GALLIUM_LLVM.
IIRC all the HAVE_GALLIUM_LLVM can now become HAVE_LLVM, but we can do that later. Reviewed-by: Emil Velikov-Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeonsi: fix elimination of literal VS outputs
Yeah, "llvm.amdgcn.exp." is probably not what we want. :) Reviewed-by: Samuel PitoisetOn 03/07/2017 12:55 AM, Marek Olšák wrote: From: Marek Olšák broken when switched to the new intrinsics. --- src/gallium/drivers/radeonsi/si_shader.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index ba29661..2c98715 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6503,32 +6503,35 @@ static void si_init_shader_ctx(struct si_shader_context *ctx, bld_base->op_actions[TGSI_OPCODE_DDX].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDY].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDX_FINE].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDY_FINE].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_EMIT].emit = si_llvm_emit_vertex; bld_base->op_actions[TGSI_OPCODE_ENDPRIM].emit = si_llvm_emit_primitive; bld_base->op_actions[TGSI_OPCODE_BARRIER].emit = si_llvm_emit_barrier; } +#define EXP_TARGET (HAVE_LLVM >= 0x0500 ? 0 : 3) +#define EXP_OUT0 (HAVE_LLVM >= 0x0500 ? 2 : 5) + /* Return true if the PARAM export has been eliminated. */ static bool si_eliminate_const_output(struct si_shader_context *ctx, LLVMValueRef inst, unsigned offset) { struct si_shader *shader = ctx->shader; unsigned num_outputs = shader->selector->info.num_outputs; unsigned i, default_val; /* SPI_PS_INPUT_CNTL_i.DEFAULT_VAL */ bool is_zero[4] = {}, is_one[4] = {}; for (i = 0; i < 4; i++) { LLVMBool loses_info; - LLVMValueRef p = LLVMGetOperand(inst, (HAVE_LLVM >= 0x0500 ? 2 : 5) + i); + LLVMValueRef p = LLVMGetOperand(inst, EXP_OUT0 + i); /* It's a constant expression. Undef outputs are eliminated too. */ if (LLVMIsUndef(p)) { is_zero[i] = true; is_one[i] = true; } else if (LLVMIsAConstantFP(p)) { double a = LLVMConstRealGetDouble(p, _info); if (a == 0) is_zero[i] = true; @@ -6600,24 +6603,24 @@ static void si_eliminate_const_vs_outputs(struct si_shader_context *ctx) if (!lp_is_function(callee)) continue; const char *name = LLVMGetValueName(callee); unsigned num_args = LLVMCountParams(callee); /* Check if this is an export instruction. */ if ((num_args != 9 && num_args != 8) || (strcmp(name, "llvm.SI.export") && -strcmp(name, "llvm.amdgcn.exp."))) +strcmp(name, "llvm.amdgcn.exp.f32"))) continue; - LLVMValueRef arg = LLVMGetOperand(cur, HAVE_LLVM >= 0x0500 ? 0 : 3); + LLVMValueRef arg = LLVMGetOperand(cur, EXP_TARGET); unsigned target = LLVMConstIntGetZExtValue(arg); if (target < V_008DFC_SQ_EXP_PARAM) continue; target -= V_008DFC_SQ_EXP_PARAM; /* Eliminate constant value PARAM exports. */ if (si_eliminate_const_output(ctx, cur, target)) { removed_any = true; @@ -6645,21 +6648,21 @@ static void si_eliminate_const_vs_outputs(struct si_shader_context *ctx) memcpy(current_offset, shader->info.vs_output_param_offset, sizeof(current_offset)); for (i = 0; i < exports.num; i++) { unsigned offset = exports.offset[i]; for (out = 0; out < info->num_outputs; out++) { if (current_offset[out] != offset) continue; - LLVMSetOperand(exports.inst[i], 3, + LLVMSetOperand(exports.inst[i], EXP_TARGET, LLVMConstInt(ctx->i32, V_008DFC_SQ_EXP_PARAM + new_count, 0)); shader->info.vs_output_param_offset[out] = new_count; new_count++; break; } } shader->info.nr_param_exports = new_count; } } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/util: replace pipe_condvar with cnd_t
On 5 March 2017 at 23:41, Timothy Arceriwrote: > pipe_condvar was made unnecessary with fd33a6bcd7f12. > > Cc: Emil Velikov Reviewed-by: Emil Velikov -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radv: handle z offset for 3d image <-> buffer copies.
Reviewed-by: Bas NieuwenhuizenOn Tue, Mar 7, 2017 at 1:30 AM, Dave Airlie wrote: > From: Dave Airlie > > This fixes: > dEQP-VK.pipeline.render_to_image.3d.huge.depth.r8g8b8a8_unorm > > Signed-off-by: Dave Airlie > --- > src/amd/vulkan/radv_meta_copy.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/src/amd/vulkan/radv_meta_copy.c b/src/amd/vulkan/radv_meta_copy.c > index 5473764..54dadde 100644 > --- a/src/amd/vulkan/radv_meta_copy.c > +++ b/src/amd/vulkan/radv_meta_copy.c > @@ -169,6 +169,8 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer > *cmd_buffer, > .pitch = buf_extent_el.width, > }; > > + if (image->type == VK_IMAGE_TYPE_3D) > + img_bsurf.layer = img_offset_el.z; > /* Loop through each 3D or array slice */ > unsigned num_slices_3d = img_extent_el.depth; > unsigned num_slices_array = > pRegions[r].imageSubresource.layerCount; > @@ -276,6 +278,8 @@ meta_copy_image_to_buffer(struct radv_cmd_buffer > *cmd_buffer, > .pitch = buf_extent_el.width, > }; > > + if (image->type == VK_IMAGE_TYPE_3D) > + img_info.layer = img_offset_el.z; > /* Loop through each 3D or array slice */ > unsigned num_slices_3d = img_extent_el.depth; > unsigned num_slices_array = > pRegions[r].imageSubresource.layerCount; > -- > 2.7.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radv: move fast clear before resolve into own loop.
Reviewed-by: Bas NieuwenhuizenOn Tue, Mar 7, 2017 at 12:33 AM, Dave Airlie wrote: > From: Dave Airlie > > Don't fast clear inside the meta loop as things get > confused, fixes a crash in: > dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image.2_bit > > Signed-off-by: Dave Airlie > --- > src/amd/vulkan/radv_meta_resolve_cs.c | 23 +++ > 1 file changed, 15 insertions(+), 8 deletions(-) > > diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c > b/src/amd/vulkan/radv_meta_resolve_cs.c > index 9cb4ce8..3272d1f 100644 > --- a/src/amd/vulkan/radv_meta_resolve_cs.c > +++ b/src/amd/vulkan/radv_meta_resolve_cs.c > @@ -326,6 +326,21 @@ void radv_meta_resolve_compute_image(struct > radv_cmd_buffer *cmd_buffer, > struct radv_meta_saved_compute_state saved_state; > const uint32_t samples = src_image->samples; > const uint32_t samples_log2 = ffs(samples) - 1; > + > + for (uint32_t r = 0; r < region_count; ++r) { > + const VkImageResolve *region = [r]; > + const uint32_t src_base_layer = > + radv_meta_get_iview_layer(src_image, > >srcSubresource, > + >srcOffset); > + VkImageSubresourceRange range; > + range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; > + range.baseMipLevel = region->srcSubresource.mipLevel; > + range.levelCount = 1; > + range.baseArrayLayer = src_base_layer; > + range.layerCount = region->srcSubresource.layerCount; > + radv_fast_clear_flush_image_inplace(cmd_buffer, src_image, > ); > + } > + > radv_meta_save_compute(_state, cmd_buffer, 16); > > for (uint32_t r = 0; r < region_count; ++r) { > @@ -350,14 +365,6 @@ void radv_meta_resolve_compute_image(struct > radv_cmd_buffer *cmd_buffer, > const struct VkOffset3D dstOffset = > radv_sanitize_image_offset(dest_image->type, > region->dstOffset); > > - VkImageSubresourceRange range; > - range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; > - range.baseMipLevel = region->srcSubresource.mipLevel; > - range.levelCount = 1; > - range.baseArrayLayer = src_base_layer; > - range.layerCount = region->srcSubresource.layerCount; > - radv_fast_clear_flush_image_inplace(cmd_buffer, src_image, > ); > - > for (uint32_t layer = 0; layer < > region->srcSubresource.layerCount; > ++layer) { > > -- > 2.7.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] radv/amdgpu: Let addrlib calculate the HTILE parameters.
Still not sure we can support miptrees when sampling from HTILE enabled textures. Added the tcCompatible winsys stuff while I'm at it. Signed-off-by: Bas Nieuwenhuizen--- src/amd/vulkan/radv_radeon_winsys.h| 5 + src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c | 26 ++ 2 files changed, 31 insertions(+) diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h index 8cf29a38d94..a8a1d2e369f 100644 --- a/src/amd/vulkan/radv_radeon_winsys.h +++ b/src/amd/vulkan/radv_radeon_winsys.h @@ -148,6 +148,7 @@ struct radeon_info { #define RADEON_SURF_HAS_TILE_MODE_INDEX (1 << 20) #define RADEON_SURF_FMASK (1 << 21) #define RADEON_SURF_DISABLE_DCC (1 << 22) +#define RADEON_SURF_TC_COMPATIBLE_HTILE (1 << 23) #define RADEON_SURF_GET(v, field) (((v) >> RADEON_SURF_ ## field ## _SHIFT) & RADEON_SURF_ ## field ## _MASK) #define RADEON_SURF_SET(v, field) (((v) & RADEON_SURF_ ## field ## _MASK) << RADEON_SURF_ ## field ## _SHIFT) @@ -217,6 +218,10 @@ struct radeon_surf { uint64_tdcc_size; uint64_tdcc_alignment; + + uint64_thtile_size; + uint64_thtile_slice_size; + uint64_thtile_alignment; }; enum radeon_bo_layout { diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c index dc596ff0574..89e84d60a3a 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c @@ -260,6 +260,30 @@ static int radv_compute_level(ADDR_HANDLE addrlib, } } + if (!is_stencil && AddrSurfInfoIn->flags.depth && + surf_level->mode == RADEON_SURF_MODE_2D && level == 0) { + ADDR_COMPUTE_HTILE_INFO_INPUT AddrHtileIn = {0}; + ADDR_COMPUTE_HTILE_INFO_OUTPUT AddrHtileOut = {0}; + AddrHtileIn.flags.tcCompatible = AddrSurfInfoIn->flags.tcCompatible; + AddrHtileIn.pitch = AddrSurfInfoOut->pitch; + AddrHtileIn.height = AddrSurfInfoOut->height; + AddrHtileIn.numSlices = AddrSurfInfoOut->depth; + AddrHtileIn.blockWidth = ADDR_HTILE_BLOCKSIZE_8; + AddrHtileIn.blockHeight = ADDR_HTILE_BLOCKSIZE_8; + AddrHtileIn.pTileInfo = AddrSurfInfoOut->pTileInfo; + AddrHtileIn.tileIndex = AddrSurfInfoOut->tileIndex; + AddrHtileIn.macroModeIndex = AddrSurfInfoOut->macroModeIndex; + + ret = AddrComputeHtileInfo(addrlib, + , + ); + + if (ret == ADDR_OK) { + surf->htile_size = AddrHtileOut.htileBytes; + surf->htile_slice_size = AddrHtileOut.sliceSize; + surf->htile_alignment = AddrHtileOut.baseAlign; + } + } return 0; } @@ -455,6 +479,8 @@ static int radv_amdgpu_winsys_surface_init(struct radeon_winsys *_ws, surf->bo_size = 0; surf->dcc_size = 0; surf->dcc_alignment = 1; + surf->htile_size = surf->htile_slice_size = 0; + surf->htile_alignment = 1; /* Calculate texture layout information. */ for (level = 0; level <= surf->last_level; level++) { -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] radv: Use the subresource range in HTILE initialization.
Signed-off-by: Bas Nieuwenhuizen--- src/amd/vulkan/radv_cmd_buffer.c | 16 +++- src/amd/vulkan/radv_image.c | 3 +-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 3796ae4b48c..39dd6e367ef 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -2704,14 +2704,20 @@ void radv_CmdEndRenderPass( static void radv_initialize_htile(struct radv_cmd_buffer *cmd_buffer, - struct radv_image *image) + struct radv_image *image, + const VkImageSubresourceRange *range) { + assert(range->baseMipLevel == 0); + assert(range->levelCount == 0 || range->levelCount == VK_REMAINING_ARRAY_LAYERS); + unsigned layer_count = radv_get_layerCount(image, range); + uint64_t size = image->surface.htile_slice_size * layer_count; + uint64_t offset = image->offset + image->htile_offset + + image->surface.htile_slice_size * range->baseArrayLayer; cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB | RADV_CMD_FLAG_FLUSH_AND_INV_DB_META; - radv_fill_buffer(cmd_buffer, image->bo, image->offset + image->htile_offset, -image->surface.htile_size, 0x); + radv_fill_buffer(cmd_buffer, image->bo, offset, size, 0x); cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB_META | RADV_CMD_FLAG_CS_PARTIAL_FLUSH | @@ -2736,10 +2742,10 @@ static void radv_handle_depth_image_transition(struct radv_cmd_buffer *cmd_buffe } else if (src_layout == VK_IMAGE_LAYOUT_UNDEFINED && radv_layout_has_htile(image, dst_layout)) { /* TODO: merge with the clear if applicable */ - radv_initialize_htile(cmd_buffer, image); + radv_initialize_htile(cmd_buffer, image, range); } else if (!radv_layout_has_htile(image, src_layout) && radv_layout_has_htile(image, dst_layout)) { - radv_initialize_htile(cmd_buffer, image); + radv_initialize_htile(cmd_buffer, image, range); } else if ((radv_layout_has_htile(image, src_layout) && !radv_layout_has_htile(image, dst_layout)) || (radv_layout_is_htile_compressed(image, src_layout) && diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 3d650b02716..dfd70a9eab8 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -590,8 +590,7 @@ static void radv_image_alloc_htile(struct radv_device *device, struct radv_image *image) { - if ((device->debug_flags & RADV_DEBUG_NO_HIZ) || image->layers > 1 || - image->levels > 1) { + if ((device->debug_flags & RADV_DEBUG_NO_HIZ) || image->levels > 1) { image->surface.htile_size = 0; return; } -- 2.11.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] radv: Use winsys HTILE info.
Signed-off-by: Bas Nieuwenhuizen--- src/amd/vulkan/radv_cmd_buffer.c | 10 ++--- src/amd/vulkan/radv_device.c | 4 +- src/amd/vulkan/radv_image.c | 83 --- src/amd/vulkan/radv_meta_clear.c | 2 +- src/amd/vulkan/radv_meta_decompress.c | 2 +- src/amd/vulkan/radv_private.h | 4 +- 6 files changed, 18 insertions(+), 87 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index d99288a6722..3796ae4b48c 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -951,7 +951,7 @@ radv_set_depth_clear_regs(struct radv_cmd_buffer *cmd_buffer, va += image->offset + image->clear_value_offset; unsigned reg_offset = 0, reg_count = 0; - if (!image->htile.size || !aspects) + if (!image->surface.htile_size || !aspects) return; if (aspects & VK_IMAGE_ASPECT_STENCIL_BIT) { @@ -990,7 +990,7 @@ radv_load_depth_clear_regs(struct radv_cmd_buffer *cmd_buffer, uint64_t va = cmd_buffer->device->ws->buffer_get_va(image->bo); va += image->offset + image->clear_value_offset; - if (!image->htile.size) + if (!image->surface.htile_size) return; cmd_buffer->device->ws->cs_add_buffer(cmd_buffer->cs, image->bo, 8); @@ -2710,8 +2710,8 @@ static void radv_initialize_htile(struct radv_cmd_buffer *cmd_buffer, cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB | RADV_CMD_FLAG_FLUSH_AND_INV_DB_META; - radv_fill_buffer(cmd_buffer, image->bo, image->offset + image->htile.offset, -image->htile.size, 0x); + radv_fill_buffer(cmd_buffer, image->bo, image->offset + image->htile_offset, +image->surface.htile_size, 0x); cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB_META | RADV_CMD_FLAG_CS_PARTIAL_FLUSH | @@ -2851,7 +2851,7 @@ static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer, unsigned src_queue_mask = radv_image_queue_family_mask(image, src_family, cmd_buffer->queue_family_index); unsigned dst_queue_mask = radv_image_queue_family_mask(image, dst_family, cmd_buffer->queue_family_index); - if (image->htile.size) + if (image->surface.htile_size) radv_handle_depth_image_transition(cmd_buffer, image, src_layout, dst_layout, range, pending_clears); diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index ab04473b01c..9202b8b 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2404,7 +2404,7 @@ radv_initialise_ds_surface(struct radv_device *device, ds->db_stencil_info |= S_028044_TILE_MODE_INDEX(tile_mode_index); } - if (iview->image->htile.size && !level) { + if (iview->image->surface.htile_size && !level) { ds->db_z_info |= S_028040_TILE_SURFACE_ENABLE(1) | S_028040_ALLOW_EXPCLEAR(1); @@ -2427,7 +2427,7 @@ radv_initialise_ds_surface(struct radv_device *device, ds->db_stencil_info |= S_028044_TILE_STENCIL_DISABLE(1); va = device->ws->buffer_get_va(iview->bo) + iview->image->offset + -iview->image->htile.offset; +iview->image->htile_offset; ds->db_htile_data_base = va >> 8; ds->db_htile_surface = S_028ABC_FULL_CACHE(1); } else { diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index b71d8b75a0b..3d650b02716 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -586,89 +586,22 @@ radv_image_alloc_dcc(struct radv_device *device, image->alignment = MAX2(image->alignment, image->surface.dcc_alignment); } -static unsigned -radv_image_get_htile_size(struct radv_device *device, - struct radv_image *image) -{ - unsigned cl_width, cl_height, width, height; - unsigned slice_elements, slice_bytes, base_align; - unsigned num_pipes = device->physical_device->rad_info.num_tile_pipes; - unsigned pipe_interleave_bytes = device->physical_device->rad_info.pipe_interleave_bytes; - - /* Overalign HTILE on P2 configs to work around GPU hangs in -* piglit/depthstencil-render-miplevels 585. -* -* This has been confirmed to help Kabini & Stoney, where the hangs -* are always reproducible. I think I have seen the test hang -* on Carrizo too, though it was very rare there. -*/ - if (device->physical_device->rad_info.chip_class >= CIK && num_pipes < 4) - num_pipes = 4; - - switch (num_pipes) { - case 1: - cl_width = 32; -
Re: [Mesa-dev] [PATCH v3 07/24] i965/fs: generalize the legalization d2x pass
Samuel Iglesias Gonsálvezwrites: > On 04/03/17 00:19, Francisco Jerez wrote: >> Samuel Iglesias Gonsálvez writes: >> >>> Add support to SEL instruction and add an assert to detect unsupported >>> instructions than do d2x conversions. >>> >>> Signed-off-by: Samuel Iglesias Gonsálvez >>> --- >>> >>> Curro, this patch legalizes SEL instruction too. If other optimizations >>> modify later any SEL's (or any other instruction's) destination type >>> (hence, producing a non-lowered d2x conversion), we can call it again >>> around the end of fs_visitor::optimize(). Possibly together with >>> lower_simd_width() just in case it was added later. >>> >> >> This sounds rather scary... How do you make sure that this doesn't lead >> to an infinite legalization-optimization loop in which copy propagation >> reverses the effect of lower_d2x making double conversions illegal >> again? If you do already, why do you need to run lower_d2x multiple >> times? Wouldn't it be sufficient to run it once near the end of >> optimize(), and then re-run copy propagation and possibly DCE? >> > > Right. I am going to change where we call it. > >>> For that reason there is the inst->dst.stride > 1 condition in the >>> test. This detects if either we emitted a strided destination in >>> purpose or it was as a result of a previous lower_d2x run, we don't >>> want to lowered it. >>> >> The problem with this is that if you ended up with dst.stride > 1 due to >> different fields of the same scalar quantity being defined by two >> separate instructions (e.g. by using subscript(dst, ..., i)), you *need* >> to apply the lowering pass regardless, because otherwise the second >> instruction will corrupt the data written by the first instruction. >> >>> However, as I have not hit that case yet, I prefer to wait for your >>> opinion. What do you think? >>> >>> >>> src/mesa/drivers/dri/i965/brw_fs_lower_d2x.cpp | 57 >>> ++ >>> 1 file changed, 41 insertions(+), 16 deletions(-) >>> >>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_lower_d2x.cpp >>> b/src/mesa/drivers/dri/i965/brw_fs_lower_d2x.cpp >>> index a2db1154615..330f2552929 100644 >>> --- a/src/mesa/drivers/dri/i965/brw_fs_lower_d2x.cpp >>> +++ b/src/mesa/drivers/dri/i965/brw_fs_lower_d2x.cpp >>> @@ -33,17 +33,9 @@ fs_visitor::lower_d2x() >>> bool progress = false; >>> >>> foreach_block_and_inst_safe(block, fs_inst, inst, cfg) { >>> - if (inst->opcode != BRW_OPCODE_MOV) >>> - continue; >>> - >>> - if (inst->dst.type != BRW_REGISTER_TYPE_F && >>> - inst->dst.type != BRW_REGISTER_TYPE_D && >>> - inst->dst.type != BRW_REGISTER_TYPE_UD) >>> - continue; >>> - >>> - if (inst->src[0].type != BRW_REGISTER_TYPE_DF && >>> - inst->src[0].type != BRW_REGISTER_TYPE_UQ && >>> - inst->src[0].type != BRW_REGISTER_TYPE_Q) >>> + if (get_exec_type_size(inst) != 8 || >>> + type_sz(inst->dst.type) >= get_exec_type_size(inst) || >> >> Note that some type conversion restrictions apply even if the execution >> type is single-precision, and even if the destination type size is not >> less than the execution type, e.g. according to the hardware docs SEL >> doesn't support F->UD or F->DF conversions which the condition above >> would consider okay. >> > > Right. > >>> + inst->dst.stride > 1) >>> continue; >>> >>>assert(inst->dst.file == VGRF); >>> @@ -61,13 +53,46 @@ fs_visitor::lower_d2x() >>> * So we need to allocate a temporary that's two registers, and then >>> do >>> * a strided MOV to get the lower DWord of every Qword that has the >>> * result. >>> + * >>> + * This pass legalizes all the DF conversions to narrower types. >>> */ >>> - fs_reg temp = ibld.vgrf(inst->src[0].type, 1); >>> - fs_reg strided_temp = subscript(temp, inst->dst.type, 0); >>> - ibld.MOV(strided_temp, inst->src[0]); >>> - ibld.MOV(dst, strided_temp); >>> + switch (inst->opcode) { >> >> I suggest you refactor this into a helper function 'bool >> supports_type_conversion(inst, dst_type, exec_type)' that returns false >> for SEL and likely other things. It might be a useful thing to have in >> other places, e.g. for late optimization passes like copy propagation >> where we need to make sure that no additional illegal conversions are >> introduced. If the value returned is false you'd do what you have below >> for the SEL instruction, if it's true you'd do nothing unless the >> instruction is double-precision and the destination type is smaller than >> the execution type, in which case you'd do what you have below for >> MOV/MOV_INDIRECT. >> > > OK. I'm going to add it as static in the file, so we can promote it to a > header file when it is used within other optimizations/lowerings. > >>> + case SHADER_OPCODE_MOV_INDIRECT: >>> + case
[Mesa-dev] [PATCH] radv: handle z offset for 3d image <-> buffer copies.
From: Dave AirlieThis fixes: dEQP-VK.pipeline.render_to_image.3d.huge.depth.r8g8b8a8_unorm Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_meta_copy.c | 4 1 file changed, 4 insertions(+) diff --git a/src/amd/vulkan/radv_meta_copy.c b/src/amd/vulkan/radv_meta_copy.c index 5473764..54dadde 100644 --- a/src/amd/vulkan/radv_meta_copy.c +++ b/src/amd/vulkan/radv_meta_copy.c @@ -169,6 +169,8 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer, .pitch = buf_extent_el.width, }; + if (image->type == VK_IMAGE_TYPE_3D) + img_bsurf.layer = img_offset_el.z; /* Loop through each 3D or array slice */ unsigned num_slices_3d = img_extent_el.depth; unsigned num_slices_array = pRegions[r].imageSubresource.layerCount; @@ -276,6 +278,8 @@ meta_copy_image_to_buffer(struct radv_cmd_buffer *cmd_buffer, .pitch = buf_extent_el.width, }; + if (image->type == VK_IMAGE_TYPE_3D) + img_info.layer = img_offset_el.z; /* Loop through each 3D or array slice */ unsigned num_slices_3d = img_extent_el.depth; unsigned num_slices_array = pRegions[r].imageSubresource.layerCount; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 100037] [vmwgfx] Invalid SVGA3D command: 1202
https://bugs.freedesktop.org/show_bug.cgi?id=100037 --- Comment #1 from Deepak--- Hi, Do you used Ubuntu Zesty GNOME and then installed Plasma top of it or used the kubuntu (http://cdimage.ubuntu.com/kubuntu/releases/17.04/alpha-2/) which I guess comes with Plasma desktop. Thanks. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radeonsi: fix elimination of literal VS outputs
From: Marek Olšákbroken when switched to the new intrinsics. --- src/gallium/drivers/radeonsi/si_shader.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index ba29661..2c98715 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6503,32 +6503,35 @@ static void si_init_shader_ctx(struct si_shader_context *ctx, bld_base->op_actions[TGSI_OPCODE_DDX].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDY].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDX_FINE].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_DDY_FINE].emit = si_llvm_emit_ddxy; bld_base->op_actions[TGSI_OPCODE_EMIT].emit = si_llvm_emit_vertex; bld_base->op_actions[TGSI_OPCODE_ENDPRIM].emit = si_llvm_emit_primitive; bld_base->op_actions[TGSI_OPCODE_BARRIER].emit = si_llvm_emit_barrier; } +#define EXP_TARGET (HAVE_LLVM >= 0x0500 ? 0 : 3) +#define EXP_OUT0 (HAVE_LLVM >= 0x0500 ? 2 : 5) + /* Return true if the PARAM export has been eliminated. */ static bool si_eliminate_const_output(struct si_shader_context *ctx, LLVMValueRef inst, unsigned offset) { struct si_shader *shader = ctx->shader; unsigned num_outputs = shader->selector->info.num_outputs; unsigned i, default_val; /* SPI_PS_INPUT_CNTL_i.DEFAULT_VAL */ bool is_zero[4] = {}, is_one[4] = {}; for (i = 0; i < 4; i++) { LLVMBool loses_info; - LLVMValueRef p = LLVMGetOperand(inst, (HAVE_LLVM >= 0x0500 ? 2 : 5) + i); + LLVMValueRef p = LLVMGetOperand(inst, EXP_OUT0 + i); /* It's a constant expression. Undef outputs are eliminated too. */ if (LLVMIsUndef(p)) { is_zero[i] = true; is_one[i] = true; } else if (LLVMIsAConstantFP(p)) { double a = LLVMConstRealGetDouble(p, _info); if (a == 0) is_zero[i] = true; @@ -6600,24 +6603,24 @@ static void si_eliminate_const_vs_outputs(struct si_shader_context *ctx) if (!lp_is_function(callee)) continue; const char *name = LLVMGetValueName(callee); unsigned num_args = LLVMCountParams(callee); /* Check if this is an export instruction. */ if ((num_args != 9 && num_args != 8) || (strcmp(name, "llvm.SI.export") && -strcmp(name, "llvm.amdgcn.exp."))) +strcmp(name, "llvm.amdgcn.exp.f32"))) continue; - LLVMValueRef arg = LLVMGetOperand(cur, HAVE_LLVM >= 0x0500 ? 0 : 3); + LLVMValueRef arg = LLVMGetOperand(cur, EXP_TARGET); unsigned target = LLVMConstIntGetZExtValue(arg); if (target < V_008DFC_SQ_EXP_PARAM) continue; target -= V_008DFC_SQ_EXP_PARAM; /* Eliminate constant value PARAM exports. */ if (si_eliminate_const_output(ctx, cur, target)) { removed_any = true; @@ -6645,21 +6648,21 @@ static void si_eliminate_const_vs_outputs(struct si_shader_context *ctx) memcpy(current_offset, shader->info.vs_output_param_offset, sizeof(current_offset)); for (i = 0; i < exports.num; i++) { unsigned offset = exports.offset[i]; for (out = 0; out < info->num_outputs; out++) { if (current_offset[out] != offset) continue; - LLVMSetOperand(exports.inst[i], 3, + LLVMSetOperand(exports.inst[i], EXP_TARGET, LLVMConstInt(ctx->i32, V_008DFC_SQ_EXP_PARAM + new_count, 0)); shader->info.vs_output_param_offset[out] = new_count; new_count++; break; } } shader->info.nr_param_exports = new_count; } } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radv: move fast clear before resolve into own loop.
From: Dave AirlieDon't fast clear inside the meta loop as things get confused, fixes a crash in: dEQP-VK.api.copy_and_blit.resolve_image.whole_array_image.2_bit Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_meta_resolve_cs.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index 9cb4ce8..3272d1f 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -326,6 +326,21 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer, struct radv_meta_saved_compute_state saved_state; const uint32_t samples = src_image->samples; const uint32_t samples_log2 = ffs(samples) - 1; + + for (uint32_t r = 0; r < region_count; ++r) { + const VkImageResolve *region = [r]; + const uint32_t src_base_layer = + radv_meta_get_iview_layer(src_image, >srcSubresource, + >srcOffset); + VkImageSubresourceRange range; + range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + range.baseMipLevel = region->srcSubresource.mipLevel; + range.levelCount = 1; + range.baseArrayLayer = src_base_layer; + range.layerCount = region->srcSubresource.layerCount; + radv_fast_clear_flush_image_inplace(cmd_buffer, src_image, ); + } + radv_meta_save_compute(_state, cmd_buffer, 16); for (uint32_t r = 0; r < region_count; ++r) { @@ -350,14 +365,6 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer, const struct VkOffset3D dstOffset = radv_sanitize_image_offset(dest_image->type, region->dstOffset); - VkImageSubresourceRange range; - range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - range.baseMipLevel = region->srcSubresource.mipLevel; - range.levelCount = 1; - range.baseArrayLayer = src_base_layer; - range.layerCount = region->srcSubresource.layerCount; - radv_fast_clear_flush_image_inplace(cmd_buffer, src_image, ); - for (uint32_t layer = 0; layer < region->srcSubresource.layerCount; ++layer) { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/5] anv: Handle failure in make_hiz_surface_maybe()
On Mon, Mar 6, 2017 at 10:18 AM, Chad Versacewrote: > make_ccs_surface_maybe() correctly handles failure > isl_surf_get_ccs_surf(). When it fails, the resultant VkImage is still > valid, just without a ccs surface. > > Same of make_mcs_surface_maybe() and isl_surf_get_mcs_surf(). > > Fix make_hiz_surface_maybe() to do the same. > except that isl_surf_get_hiz_surf, as currently called, should *never* fail. When we do gen7 HiZ, we may want to handle failure though... In any case, we probably at least want a perf warning if HiZ surface creation fails given that we expect it not to. > --- > src/intel/vulkan/anv_image.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c > index 52a126fe995..9cb689b208d 100644 > --- a/src/intel/vulkan/anv_image.c > +++ b/src/intel/vulkan/anv_image.c > @@ -158,7 +158,9 @@ make_hiz_surface_maybe(const struct anv_device *dev, > } else { >ok = isl_surf_get_hiz_surf(>isl_dev, > >depth_surface.isl, > >aux_surface.isl); > - assert(ok); > + if (!ok) > + return; > + >add_surface(image, >aux_surface); >image->aux_usage = ISL_AUX_USAGE_HIZ; > } > -- > 2.12.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev