Mesa (master): radv: add support for shader stats dump
Module: Mesa Branch: master Commit: f395e3445df98b0398865a1897bca003f9add6f4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f395e3445df98b0398865a1897bca003f9add6f4 Author: Dave Airlie Date: Tue Nov 22 04:17:49 2016 + radv: add support for shader stats dump I've started working on a shader-db alike for Vulkan, it's based on vktrace and it records pipelines, this adds support to dump the shader stats exactly like radeonsi does, so I can reuse the shader-db scripts it uses. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_device.c | 1 + src/amd/vulkan/radv_pipeline.c | 84 ++ src/amd/vulkan/radv_private.h | 2 + 3 files changed, 87 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 8595973..00f3a07 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -666,6 +666,7 @@ VkResult radv_CreateDevice( } device->allow_fast_clears = env_var_as_boolean("RADV_FAST_CLEARS", false); device->allow_dcc = !env_var_as_boolean("RADV_DCC_DISABLE", false); + device->shader_stats_dump = env_var_as_boolean("RADV_SHADER_STATS", false); if (device->allow_fast_clears && device->allow_dcc) radv_finishme("DCC fast clears have not been tested\n"); diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 404e840..7d7d0c6 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -257,6 +257,81 @@ radv_shader_compile_to_nir(struct radv_device *device, return nir; } +static const char *radv_get_shader_name(struct radv_shader_variant *var, + gl_shader_stage stage) +{ + switch (stage) { + case MESA_SHADER_VERTEX: return "Vertex Shader as VS"; + case MESA_SHADER_FRAGMENT: return "Pixel Shader"; + case MESA_SHADER_COMPUTE: return "Compute Shader"; + default: + return "Unknown shader"; + }; + +} +static void radv_dump_pipeline_stats(struct radv_device *device, struct radv_pipeline *pipeline) +{ + unsigned lds_increment = device->instance->physicalDevice.rad_info.chip_class >= CIK ? 512 : 256; + struct radv_shader_variant *var; + struct ac_shader_config *conf; + int i; + FILE *file = stderr; + unsigned max_simd_waves = 10; + unsigned lds_per_wave = 0; + + for (i = 0; i < MESA_SHADER_STAGES; i++) { + if (!pipeline->shaders[i]) + continue; + var = pipeline->shaders[i]; + + conf = &var->config; + + if (i == MESA_SHADER_FRAGMENT) { + lds_per_wave = conf->lds_size * lds_increment + + align(var->info.fs.num_interp * 48, lds_increment); + } + + if (conf->num_sgprs) { + if (device->instance->physicalDevice.rad_info.chip_class >= VI) + max_simd_waves = MIN2(max_simd_waves, 800 / conf->num_sgprs); + else + max_simd_waves = MIN2(max_simd_waves, 512 / conf->num_sgprs); + } + + if (conf->num_vgprs) + max_simd_waves = MIN2(max_simd_waves, 256 / conf->num_vgprs); + + /* LDS is 64KB per CU (4 SIMDs), divided into 16KB blocks per SIMD +* that PS can use. +*/ + if (lds_per_wave) + max_simd_waves = MIN2(max_simd_waves, 16384 / lds_per_wave); + + fprintf(file, "\n%s:\n", + radv_get_shader_name(var, i)); + if (i == MESA_SHADER_FRAGMENT) { + fprintf(file, "*** SHADER CONFIG ***\n" + "SPI_PS_INPUT_ADDR = 0x%04x\n" + "SPI_PS_INPUT_ENA = 0x%04x\n", + conf->spi_ps_input_addr, conf->spi_ps_input_ena); + } + fprintf(file, "*** SHADER STATS ***\n" + "SGPRS: %d\n" + "VGPRS: %d\n" + "Spilled SGPRs: %d\n" + "Spilled VGPRs: %d\n" + "Code Size: %d bytes\n" + "LDS: %d blocks\n" + "Scratch: %d bytes per wave\n" + "Max Waves: %d\n" + "\n\n\n", + conf->num_sgprs, conf->num_vgprs, + conf->spilled_sgprs, conf->spilled_vgprs, var->code_size, + conf->lds_size, conf->scratch_bytes_per_wave, + max_simd_waves); + } +} + void radv_shader_variant_destroy(struct radv_device *device, struct radv_shader_variant *variant) { @@ -297,6 +372,7 @@ s
Mesa (master): radv/ac: cleanup ddxy emission
Module: Mesa Branch: master Commit: 5697cfb7ec08e827a48adc2cd34364696e209147 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5697cfb7ec08e827a48adc2cd34364696e209147 Author: Dave Airlie Date: Sun Nov 20 23:56:45 2016 + radv/ac: cleanup ddxy emission This cleans up the ddxy emission along the same lines as radeonsi. It also means we don't use LDS on VI chips we use the dspermute interface, it also removes some duplicated code. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 136 +--- 1 file changed, 43 insertions(+), 93 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 1d71795..17cefea 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -130,6 +130,8 @@ struct nir_to_llvm_context { bool has_ddxy; unsigned num_clips; unsigned num_culls; + + bool has_ds_bpermute; }; struct ac_tex_info { @@ -377,14 +379,23 @@ static LLVMValueRef to_float(struct nir_to_llvm_context *ctx, LLVMValueRef v) return v; } +static LLVMValueRef build_gep0(struct nir_to_llvm_context *ctx, + LLVMValueRef base_ptr, LLVMValueRef index) +{ + LLVMValueRef indices[2] = { + ctx->i32zero, + index, + }; + return LLVMBuildGEP(ctx->builder, base_ptr, + indices, 2, ""); +} + static LLVMValueRef build_indexed_load(struct nir_to_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index, bool uniform) { LLVMValueRef pointer; - LLVMValueRef indices[] = {ctx->i32zero, index}; - - pointer = LLVMBuildGEP(ctx->builder, base_ptr, indices, 2, ""); + pointer = build_gep0(ctx, base_ptr, index); if (uniform) LLVMSetMetadata(pointer, ctx->uniform_md_kind, ctx->empty_md); return LLVMBuildLoad(ctx->builder, pointer, ""); @@ -1132,55 +1143,44 @@ static LLVMValueRef get_thread_id(struct nir_to_llvm_context *ctx) #define TID_MASK_TOP 0xfffd #define TID_MASK_LEFT 0xfffe static LLVMValueRef emit_ddxy(struct nir_to_llvm_context *ctx, - nir_alu_instr *instr, + nir_op op, LLVMValueRef src0) { - LLVMValueRef indices[2]; - LLVMValueRef store_ptr, load_ptr0, load_ptr1; LLVMValueRef tl, trbl, result; LLVMValueRef tl_tid, trbl_tid; LLVMValueRef args[2]; + LLVMValueRef thread_id; unsigned mask; int idx; ctx->has_ddxy = true; - if (!ctx->lds) + + if (!ctx->lds && !ctx->has_ds_bpermute) ctx->lds = LLVMAddGlobalInAddressSpace(ctx->module, LLVMArrayType(ctx->i32, 64), "ddxy_lds", LOCAL_ADDR_SPACE); - indices[0] = ctx->i32zero; - indices[1] = get_thread_id(ctx); - store_ptr = LLVMBuildGEP(ctx->builder, ctx->lds, -indices, 2, ""); - - if (instr->op == nir_op_fddx_fine || instr->op == nir_op_fddx) + thread_id = get_thread_id(ctx); + if (op == nir_op_fddx_fine || op == nir_op_fddx) mask = TID_MASK_LEFT; - else if (instr->op == nir_op_fddy_fine || instr->op == nir_op_fddy) + else if (op == nir_op_fddy_fine || op == nir_op_fddy) mask = TID_MASK_TOP; else mask = TID_MASK_TOP_LEFT; - tl_tid = LLVMBuildAnd(ctx->builder, indices[1], + tl_tid = LLVMBuildAnd(ctx->builder, thread_id, LLVMConstInt(ctx->i32, mask, false), ""); - indices[1] = tl_tid; - load_ptr0 = LLVMBuildGEP(ctx->builder, ctx->lds, -indices, 2, ""); - /* for DDX we want to next X pixel, DDY next Y pixel. */ - if (instr->op == nir_op_fddx_fine || - instr->op == nir_op_fddx_coarse || - instr->op == nir_op_fddx) + if (op == nir_op_fddx_fine || + op == nir_op_fddx_coarse || + op == nir_op_fddx) idx = 1; else idx = 2; - trbl_tid = LLVMBuildAdd(ctx->builder, indices[1], + trbl_tid = LLVMBuildAdd(ctx->builder, tl_tid, LLVMConstInt(ctx->i32, idx, false), ""); - indices[1] = trbl_tid; - load_ptr1 = LLVMBuildGEP(ctx->builder, ctx->lds, -indices, 2, ""); - if (ctx->options->family >= CHIP_TONGA) { + if (ctx->has_ds_bpermute) { args[0] = LLVMBuildMul(ctx->builder, tl_tid, LLVMConstInt(ctx->i32, 4, false), ""); args[1] = src0; @@ -1194,8 +1194,13 @@ static LLVMValueRef e
Mesa (master): radv/meta: cleanup resolve vertex state emission
Module: Mesa Branch: master Commit: fa57b771059efb4c409253c75a42785105ba67fa URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa57b771059efb4c409253c75a42785105ba67fa Author: Dave Airlie Date: Mon Nov 21 03:31:09 2016 + radv/meta: cleanup resolve vertex state emission For the hw resolve there is no need to emit any sort of texture coordinates, so drop them all in the meta path. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- src/amd/vulkan/radv_meta_resolve.c | 49 ++ 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index 697a264..66f1466 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -33,7 +33,6 @@ */ struct vertex_attrs { float position[2]; /**< 3DPRIM_RECTLIST */ - float tex_position[2]; }; /* passthrough vertex shader */ @@ -45,8 +44,6 @@ build_nir_vs(void) nir_builder b; nir_variable *a_position; nir_variable *v_position; - nir_variable *a_tex_position; - nir_variable *v_tex_position; nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_VERTEX, NULL); b.shader->info->name = ralloc_strdup(b.shader, "meta_resolve_vs"); @@ -59,16 +56,7 @@ build_nir_vs(void) "gl_Position"); v_position->data.location = VARYING_SLOT_POS; - a_tex_position = nir_variable_create(b.shader, nir_var_shader_in, vec4, -"a_tex_position"); - a_tex_position->data.location = VERT_ATTRIB_GENERIC1; - - v_tex_position = nir_variable_create(b.shader, nir_var_shader_out, vec4, -"v_tex_position"); - v_tex_position->data.location = VARYING_SLOT_VAR0; - nir_copy_var(&b, v_position, a_position); - nir_copy_var(&b, v_tex_position, a_tex_position); return b.shader; } @@ -79,22 +67,16 @@ build_nir_fs(void) { const struct glsl_type *vec4 = glsl_vec4_type(); nir_builder b; - nir_variable *v_tex_position; /* vec4, varying texture coordinate */ nir_variable *f_color; /* vec4, fragment output color */ nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_FRAGMENT, NULL); b.shader->info->name = ralloc_asprintf(b.shader, "meta_resolve_fs"); - v_tex_position = nir_variable_create(b.shader, nir_var_shader_in, vec4, -"v_tex_position"); - v_tex_position->data.location = VARYING_SLOT_VAR0; - f_color = nir_variable_create(b.shader, nir_var_shader_out, vec4, "f_color"); f_color->data.location = FRAG_RESULT_DATA0; - - nir_copy_var(&b, f_color, v_tex_position); + nir_store_var(&b, f_color, nir_imm_vec4(&b, 0.0, 0.0, 0.0, 1.0), 0xf); return b.shader; } @@ -198,7 +180,7 @@ create_pipeline(struct radv_device *device, .inputRate = VK_VERTEX_INPUT_RATE_VERTEX }, }, - .vertexAttributeDescriptionCount = 2, + .vertexAttributeDescriptionCount = 1, .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) { { /* Position */ @@ -207,13 +189,6 @@ create_pipeline(struct radv_device *device, .format = VK_FORMAT_R32G32_SFLOAT, .offset = offsetof(struct vertex_attrs, position), }, - { - /* Texture Coordinate */ - .location = 1, - .binding = 0, - .format = VK_FORMAT_R32G32_SFLOAT, - .offset = offsetof(struct vertex_attrs, tex_position), - }, }, }, .pInputAssemblyState = &(VkPipelineInputAs
Mesa (master): radv: fix sample id loading
Module: Mesa Branch: master Commit: 220912e21432dba996cb2694dea480c65cf6a7c6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=220912e21432dba996cb2694dea480c65cf6a7c6 Author: Dave Airlie Date: Mon Nov 21 01:12:39 2016 + radv: fix sample id loading The sample id is packed into bits 8-12, so adjust things properly. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 741a082..c68cb9c 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -379,6 +379,23 @@ static LLVMValueRef to_float(struct nir_to_llvm_context *ctx, LLVMValueRef v) return v; } +static LLVMValueRef unpack_param(struct nir_to_llvm_context *ctx, +LLVMValueRef param, unsigned rshift, +unsigned bitwidth) +{ + LLVMValueRef value = param; + if (rshift) + value = LLVMBuildLShr(ctx->builder, value, + LLVMConstInt(ctx->i32, rshift, false), ""); + + if (rshift + bitwidth < 32) { + unsigned mask = (1 << bitwidth) - 1; + value = LLVMBuildAnd(ctx->builder, value, +LLVMConstInt(ctx->i32, mask, false), ""); + } + return value; +} + static LLVMValueRef build_gep0(struct nir_to_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index) { @@ -2895,7 +2912,7 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx, result = ctx->start_instance; break; case nir_intrinsic_load_sample_id: - result = ctx->ancillary; + result = unpack_param(ctx, ctx->ancillary, 8, 4); break; case nir_intrinsic_load_sample_pos: result = load_sample_pos(ctx); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radv/ac: add implementation of load_sample_pos intrinsic.
Module: Mesa Branch: master Commit: 3c6151ccafeb47febb8320b7f4f7bbc0e819708e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c6151ccafeb47febb8320b7f4f7bbc0e819708e Author: Dave Airlie Date: Wed Nov 16 03:54:22 2016 + radv/ac: add implementation of load_sample_pos intrinsic. This fixes a bunch of crashes in CTS tests looking for this. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- src/amd/common/ac_nir_to_llvm.c | 12 1 file changed, 12 insertions(+) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 17cefea..741a082 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2764,6 +2764,15 @@ static LLVMValueRef load_sample_position(struct nir_to_llvm_context *ctx, return build_gather_values(ctx, result, 2); } +static LLVMValueRef load_sample_pos(struct nir_to_llvm_context *ctx) +{ + LLVMValueRef values[2]; + + values[0] = emit_ffract(ctx, ctx->frag_pos[0]); + values[1] = emit_ffract(ctx, ctx->frag_pos[1]); + return build_gather_values(ctx, values, 2); +} + static LLVMValueRef visit_interp(struct nir_to_llvm_context *ctx, nir_intrinsic_instr *instr) { @@ -2888,6 +2897,9 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx, case nir_intrinsic_load_sample_id: result = ctx->ancillary; break; + case nir_intrinsic_load_sample_pos: + result = load_sample_pos(ctx); + break; case nir_intrinsic_load_front_face: result = ctx->front_face; break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radv: Store UUID in physical device.
Module: Mesa Branch: master Commit: 43ee4917cadbba7677def091333edbf3cf069f8a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=43ee4917cadbba7677def091333edbf3cf069f8a Author: Bas Nieuwenhuizen Date: Tue Nov 22 00:31:44 2016 +0100 radv: Store UUID in physical device. No sense in repeatedly determining it. Also, it might be dependent on the device as shaders get compiled differently for SI/CIK/VI etc. Signed-off-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_device.c | 18 ++ src/amd/vulkan/radv_pipeline_cache.c | 8 src/amd/vulkan/radv_private.h| 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 390fde0..b731171 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -44,6 +44,13 @@ #include "util/debug.h" struct radv_dispatch_table dtable; +static void +radv_device_get_cache_uuid(void *uuid) +{ + memset(uuid, 0, VK_UUID_SIZE); + snprintf(uuid, VK_UUID_SIZE, "radv-%s", RADV_TIMESTAMP); +} + static VkResult radv_physical_device_init(struct radv_physical_device *device, struct radv_instance *instance, @@ -89,6 +96,8 @@ radv_physical_device_init(struct radv_physical_device *device, goto fail; } + radv_device_get_cache_uuid(device->uuid); + fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n"); device->name = device->rad_info.name; return VK_SUCCESS; @@ -361,13 +370,6 @@ void radv_GetPhysicalDeviceFeatures( }; } -void -radv_device_get_cache_uuid(void *uuid) -{ - memset(uuid, 0, VK_UUID_SIZE); - snprintf(uuid, VK_UUID_SIZE, "radv-%s", RADV_TIMESTAMP); -} - void radv_GetPhysicalDeviceProperties( VkPhysicalDevicephysicalDevice, VkPhysicalDeviceProperties* pProperties) @@ -498,7 +500,7 @@ void radv_GetPhysicalDeviceProperties( }; strcpy(pProperties->deviceName, pdevice->name); - radv_device_get_cache_uuid(pProperties->pipelineCacheUUID); + memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE); } void radv_GetPhysicalDeviceQueueFamilyProperties( diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index b429355..db824a2 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -308,8 +308,8 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache, const void *data, size_t size) { struct radv_device *device = cache->device; + struct radv_physical_device *pdevice = &device->instance->physicalDevice; struct cache_header header; - uint8_t uuid[VK_UUID_SIZE]; if (size < sizeof(header)) return; @@ -322,8 +322,7 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache, return; if (header.device_id != device->instance->physicalDevice.rad_info.pci_id) return; - radv_device_get_cache_uuid(uuid); - if (memcmp(header.uuid, uuid, VK_UUID_SIZE) != 0) + if (memcmp(header.uuid, pdevice->uuid, VK_UUID_SIZE) != 0) return; char *end = (void *) data + size; @@ -405,6 +404,7 @@ VkResult radv_GetPipelineCacheData( { RADV_FROM_HANDLE(radv_device, device, _device); RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache); + struct radv_physical_device *pdevice = &device->instance->physicalDevice; struct cache_header *header; VkResult result = VK_SUCCESS; const size_t size = sizeof(*header) + cache->total_size; @@ -422,7 +422,7 @@ VkResult radv_GetPipelineCacheData( header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE; header->vendor_id = 0x1002; header->device_id = device->instance->physicalDevice.rad_info.pci_id; - radv_device_get_cache_uuid(header->uuid); + memcpy(header->uuid, pdevice->uuid, VK_UUID_SIZE); p += header->header_size; struct cache_entry *entry; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index ad5232b..3d17895 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -258,6 +258,8 @@ struct radv_physical_device { uint32_tpci_vendor_id; uint32_tpci_device_id; + uint8_t uuid[VK_UUID_SIZE]; + struct wsi_device wsi_device; }; @@ -453,8 +455,6 @@ struct radv_device { float sample_locations_16x[16][2]; }; -void radv_device_get_cache_uuid(void *uuid); - struct radv_device_memory { struct radeon_winsys_bo *bo; uint32_t type_index; ___
Mesa (master): radv: Use library mtime for cache UUID.
Module: Mesa Branch: master Commit: d94383970f2cad9f474760b18fd277efeda4c612 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d94383970f2cad9f474760b18fd277efeda4c612 Author: Bas Nieuwenhuizen Date: Tue Nov 22 00:19:30 2016 +0100 radv: Use library mtime for cache UUID. We want to also invalidate the cache when LLVM gets changed. As the specific LLVM revision is not fixed at build time, we will need to check at runtime. Computing a checksum for LLVM is going to be very expensive, so just use the mtime. Tested on my computer that the returned DSO for the LLVM symbol is actually the LLVM DSO. Signed-off-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_device.c | 36 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index b731171..04c0bdc 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -25,10 +25,12 @@ * IN THE SOFTWARE. */ +#include #include #include #include #include +#include #include "radv_private.h" #include "util/strtod.h" @@ -40,15 +42,37 @@ #include "ac_llvm_util.h" #include "vk_format.h" #include "sid.h" -#include "radv_timestamp.h" #include "util/debug.h" struct radv_dispatch_table dtable; -static void +static int +radv_get_function_timestamp(void *ptr, uint32_t* timestamp) +{ + Dl_info info; + struct stat st; + if (!dladdr(ptr, &info) || !info.dli_fname) { + return -1; + } + if (stat(info.dli_fname, &st)) { + return -1; + } + *timestamp = st.st_mtim.tv_sec; + return 0; +} + +static int radv_device_get_cache_uuid(void *uuid) { + uint32_t mesa_timestamp, llvm_timestamp; memset(uuid, 0, VK_UUID_SIZE); - snprintf(uuid, VK_UUID_SIZE, "radv-%s", RADV_TIMESTAMP); + if (radv_get_function_timestamp(radv_device_get_cache_uuid, &mesa_timestamp) || + radv_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, &llvm_timestamp)) + return -1; + + memcpy(uuid, &mesa_timestamp, 4); + memcpy((char*)uuid + 4, &llvm_timestamp, 4); + snprintf((char*)uuid + 8, VK_UUID_SIZE - 8, "radv"); + return 0; } static VkResult @@ -96,7 +120,11 @@ radv_physical_device_init(struct radv_physical_device *device, goto fail; } - radv_device_get_cache_uuid(device->uuid); + if (radv_device_get_cache_uuid(device->uuid)) { + radv_finish_wsi(device); + device->ws->destroy(device->ws); + goto fail; + } fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n"); device->name = device->rad_info.name; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radv: Incorporate GPU family into cache UUID.
Module: Mesa Branch: master Commit: 24427e31ef5949ded323ae193f0e414417972c17 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=24427e31ef5949ded323ae193f0e414417972c17 Author: Bas Nieuwenhuizen Date: Tue Nov 22 00:39:50 2016 +0100 radv: Incorporate GPU family into cache UUID. Invalidates the cache when someone switches cards. Signed-off-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_device.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 04c0bdc..8595973 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -61,9 +61,10 @@ radv_get_function_timestamp(void *ptr, uint32_t* timestamp) } static int -radv_device_get_cache_uuid(void *uuid) +radv_device_get_cache_uuid(enum radeon_family family, void *uuid) { uint32_t mesa_timestamp, llvm_timestamp; + uint16_t f = family; memset(uuid, 0, VK_UUID_SIZE); if (radv_get_function_timestamp(radv_device_get_cache_uuid, &mesa_timestamp) || radv_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, &llvm_timestamp)) @@ -71,7 +72,8 @@ radv_device_get_cache_uuid(void *uuid) memcpy(uuid, &mesa_timestamp, 4); memcpy((char*)uuid + 4, &llvm_timestamp, 4); - snprintf((char*)uuid + 8, VK_UUID_SIZE - 8, "radv"); + memcpy((char*)uuid + 8, &f, 2); + snprintf((char*)uuid + 10, VK_UUID_SIZE - 10, "radv"); return 0; } @@ -120,7 +122,7 @@ radv_physical_device_init(struct radv_physical_device *device, goto fail; } - if (radv_device_get_cache_uuid(device->uuid)) { + if (radv_device_get_cache_uuid(device->rad_info.family, device->uuid)) { radv_finish_wsi(device); device->ws->destroy(device->ws); goto fail; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: fix NULL check
Module: Mesa Branch: master Commit: 581bd1d12a0c8f68110519196673b11940887143 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=581bd1d12a0c8f68110519196673b11940887143 Author: Timothy Arceri Date: Tue Nov 22 13:19:33 2016 +1100 glsl: fix NULL check Fixes copy and paste error in 9d96d3803ab --- src/compiler/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 61a029c..845a793 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2194,7 +2194,7 @@ link_intrastage_shaders(void *mem_ctx, ctx->Driver.NewProgram(ctx, _mesa_shader_stage_to_program(shader_list[0]->Stage), prog->Name); - if (!prog) { + if (!gl_prog) { prog->data->LinkStatus = false; _mesa_delete_linked_shader(ctx, linked); return NULL; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: [rasterizer memory] minify original sizes for block formats
Module: Mesa Branch: master Commit: c5a654786b5b68c5c215e3bd1bc83b02d7e2a0e9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5a654786b5b68c5c215e3bd1bc83b02d7e2a0e9 Author: Ilia Mirkin Date: Sat Nov 12 03:01:15 2016 -0500 swr: [rasterizer memory] minify original sizes for block formats There's no guarantee that mip width/height will be a multiple of the compressed block size. Doing a divide by the block size first yields different results than GL expects, so we do the divide at the end. Signed-off-by: Ilia Mirkin Reviewed-by: Tim Rowley --- .../swr/rasterizer/memory/TilingFunctions.h| 36 +++--- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h index 0694a99..11ed451 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h +++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h @@ -274,9 +274,12 @@ INLINE void ComputeLODOffset1D( else { uint32_t curWidth = baseWidth; -// translate mip width from pixels to blocks for block compressed formats -// @note hAlign is already in blocks for compressed formats so no need to convert -if (info.isBC) curWidth /= info.bcWidth; +// @note hAlign is already in blocks for compressed formats so upconvert +// so that we have the desired alignment post-divide. +if (info.isBC) +{ +hAlign *= info.bcWidth; +} offset = GFX_ALIGN(curWidth, hAlign); for (uint32_t l = 1; l < lod; ++l) @@ -285,7 +288,7 @@ INLINE void ComputeLODOffset1D( offset += curWidth; } -if (info.isSubsampled) +if (info.isSubsampled || info.isBC) { offset /= info.bcWidth; } @@ -312,14 +315,17 @@ INLINE void ComputeLODOffsetX( else { uint32_t curWidth = baseWidth; -// convert mip width from pixels to blocks for block compressed formats -// @note hAlign is already in blocks for compressed formats so no need to convert -if (info.isBC) curWidth /= info.bcWidth; +// @note hAlign is already in blocks for compressed formats so upconvert +// so that we have the desired alignment post-divide. +if (info.isBC) +{ +hAlign *= info.bcWidth; +} curWidth = std::max(curWidth >> 1, 1U); curWidth = GFX_ALIGN(curWidth, hAlign); -if (info.isSubsampled) +if (info.isSubsampled || info.isBC) { curWidth /= info.bcWidth; } @@ -350,9 +356,12 @@ INLINE void ComputeLODOffsetY( offset = 0; uint32_t mipHeight = baseHeight; -// translate mip height from pixels to blocks for block compressed formats -// @note VAlign is already in blocks for compressed formats so no need to convert -if (info.isBC) mipHeight /= info.bcHeight; +// @note vAlign is already in blocks for compressed formats so upconvert +// so that we have the desired alignment post-divide. +if (info.isBC) +{ +vAlign *= info.bcHeight; +} for (uint32_t l = 1; l <= lod; ++l) { @@ -360,6 +369,11 @@ INLINE void ComputeLODOffsetY( offset += ((l != 2) ? alignedMipHeight : 0); mipHeight = std::max(mipHeight >> 1, 1U); } + +if (info.isBC) +{ +offset /= info.bcHeight; +} } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: don't claim to allow setting layer/viewport from VS
Module: Mesa Branch: master Commit: c3dd5b2e3f47f23c8f6651e0d3af6fde7486656d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3dd5b2e3f47f23c8f6651e0d3af6fde7486656d Author: Ilia Mirkin Date: Sun Nov 20 13:13:12 2016 -0500 swr: don't claim to allow setting layer/viewport from VS This may ultimately be possible to support, but for now it's not hooked up and the swr core only supports this output from GS. This normally wouldn't matter, but we lie about supporting GL 3.2, and also the blitter and st/mesa will make use of this functionality if claimed. Signed-off-by: Ilia Mirkin Reviewed-by: Tim Rowley --- src/gallium/drivers/swr/swr_screen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index 8a85128..9723c40 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -250,10 +250,10 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_USER_CONSTANT_BUFFERS: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS: - case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT: return 1; case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 16; + case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT: case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: calculate viewport width/height based on the scale
Module: Mesa Branch: master Commit: 807bc6ea9ee60240b44ca906e875f23d6e4f0ef7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=807bc6ea9ee60240b44ca906e875f23d6e4f0ef7 Author: Ilia Mirkin Date: Fri Nov 18 20:19:24 2016 -0500 swr: calculate viewport width/height based on the scale The former calculations were for min/max y. The width/height don't take translate into account. Signed-off-by: Ilia Mirkin Reviewed-by: Tim Rowley --- src/gallium/drivers/swr/swr_state.cpp | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index a48baec..c4d7f03 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -976,9 +976,9 @@ swr_update_derived(struct pipe_context *pipe, SWR_VIEWPORT_MATRICES *vpm = &ctx->derived.vpm; vp->x = state->translate[0] - state->scale[0]; - vp->width = state->translate[0] + state->scale[0]; + vp->width = 2 * state->scale[0]; vp->y = state->translate[1] - fabs(state->scale[1]); - vp->height = state->translate[1] + fabs(state->scale[1]); + vp->height = 2 * fabs(state->scale[1]); util_viewport_zmin_zmax(state, rasterizer->clip_halfz, &vp->minZ, &vp->maxZ); @@ -991,10 +991,16 @@ swr_update_derived(struct pipe_context *pipe, /* Now that the matrix is calculated, clip the view coords to screen * size. OpenGL allows for -ve x,y in the viewport. */ - vp->x = std::max(vp->x, 0.0f); - vp->y = std::max(vp->y, 0.0f); - vp->width = std::min(vp->width, (float)fb->width); - vp->height = std::min(vp->height, (float)fb->height); + if (vp->x < 0.0f) { + vp->width += vp->x; + vp->x = 0.0f; + } + if (vp->y < 0.0f) { + vp->height += vp->y; + vp->y = 0.0f; + } + vp->width = std::min(vp->width, (float)fb->width - vp->x); + vp->height = std::min(vp->height, (float)fb->height - vp->y); SwrSetViewports(ctx->swrContext, 1, vp, vpm); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: allocate all scratch space in one go for vertex buffers
Module: Mesa Branch: master Commit: d48740568faff4aad78a46c67f73ea3c5ea3bd0c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d48740568faff4aad78a46c67f73ea3c5ea3bd0c Author: Ilia Mirkin Date: Sun Nov 20 16:34:59 2016 -0500 swr: allocate all scratch space in one go for vertex buffers Multiple buffers may reference client arrays. When this happens, we might reach for scratch space multiple times, which could cause later arrays to invalidate the pointers allocated for the earlier ones. This fixes copyteximage 2D_ARRAY. Signed-off-by: Ilia Mirkin Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/swr_scratch.cpp | 4 ++-- src/gallium/drivers/swr/swr_state.cpp | 32 +--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/swr/swr_scratch.cpp b/src/gallium/drivers/swr/swr_scratch.cpp index 28eb2ac..2515c8b 100644 --- a/src/gallium/drivers/swr/swr_scratch.cpp +++ b/src/gallium/drivers/swr/swr_scratch.cpp @@ -35,7 +35,6 @@ swr_copy_to_scratch_space(struct swr_context *ctx, { void *ptr; assert(space); - assert(user_buffer); assert(size); if (size >= 2048) { /* XXX TODO create KNOB_ for this */ @@ -82,7 +81,8 @@ swr_copy_to_scratch_space(struct swr_context *ctx, } /* Copy user_buffer to scratch */ - memcpy(ptr, user_buffer, size); + if (user_buffer) + memcpy(ptr, user_buffer, size); return ptr; } diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index e9ae786..a48baec 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1002,14 +1002,39 @@ swr_update_derived(struct pipe_context *pipe, /* Set vertex & index buffers */ /* (using draw info if called by swr_draw_vbo) */ if (ctx->dirty & SWR_NEW_VERTEX) { - uint32_t size, pitch, max_vertex, partial_inbounds; + uint32_t size, pitch, max_vertex, partial_inbounds, scratch_total; const uint8_t *p_data; + uint8_t *scratch = NULL; /* If being called by swr_draw_vbo, copy draw details */ struct pipe_draw_info info = {0}; if (p_draw_info) info = *p_draw_info; + /* We must get all the scratch space in one go */ + scratch_total = 0; + for (UINT i = 0; i < ctx->num_vertex_buffers; i++) { + struct pipe_vertex_buffer *vb = &ctx->vertex_buffer[i]; + + if (!vb->user_buffer) +continue; + + if (vb->stride) { +size = (info.max_index - info.min_index + 1) * vb->stride; + } else { +/* pitch = 0, means constant value + * set size to 1 vertex */ +size = ctx->velems->stream_pitch[i]; + } + + scratch_total += AlignUp(size, 4); + } + + if (scratch_total) { + scratch = (uint8_t *)swr_copy_to_scratch_space( + ctx, &ctx->scratch->vertex_buffer, NULL, scratch_total); + } + /* vertex buffers */ SWR_VERTEX_BUFFER_STATE swrVertexBuffers[PIPE_MAX_ATTRIBS]; for (UINT i = 0; i < ctx->num_vertex_buffers; i++) { @@ -1046,8 +1071,9 @@ swr_update_derived(struct pipe_context *pipe, size = AlignUp(size, 4); const void *ptr = (const uint8_t *) vb->user_buffer + info.min_index * pitch; -ptr = swr_copy_to_scratch_space( - ctx, &ctx->scratch->vertex_buffer, ptr, size); +memcpy(scratch, ptr, size); +ptr = scratch; +scratch += size; p_data = (const uint8_t *)ptr - info.min_index * pitch; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: call swr_update_derived unconditionally when drawing/ clearing
Module: Mesa Branch: master Commit: 16d42f2f3dcc8bec8d75b53d1e9e9cf5af6e528c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=16d42f2f3dcc8bec8d75b53d1e9e9cf5af6e528c Author: Ilia Mirkin Date: Sun Nov 20 00:04:42 2016 -0500 swr: call swr_update_derived unconditionally when drawing/clearing Currently a sequence like draw/map/draw/map will cause the second map to not wait for the second draw. This is because the first map will clear the resource business bit, and the second draw won't reset it since no state has changed. swr_update_derived does a tiny bit of extra work, including updating the SWR_BACKEND_STATE as well as waiting for prending fences. If that's a problem, we could call swr_update_resource_status directly from draw/clear handlers. Fixes clearbuffer-stencil, clearbuffer-depth, clearbuffer-depth-stencil, and clearbuffer-display-lists. Signed-off-by: Ilia Mirkin Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/swr_clear.cpp | 3 +-- src/gallium/drivers/swr/swr_draw.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/swr/swr_clear.cpp b/src/gallium/drivers/swr/swr_clear.cpp index 0101b4b..ff3eca8 100644 --- a/src/gallium/drivers/swr/swr_clear.cpp +++ b/src/gallium/drivers/swr/swr_clear.cpp @@ -39,8 +39,7 @@ swr_clear(struct pipe_context *pipe, if (!swr_check_render_cond(pipe)) return; - if (ctx->dirty) - swr_update_derived(pipe); + swr_update_derived(pipe); if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { for (unsigned i = 0; i < fb->nr_cbufs; ++i) diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp index 39378e6..920ca9f 100644 --- a/src/gallium/drivers/swr/swr_draw.cpp +++ b/src/gallium/drivers/swr/swr_draw.cpp @@ -90,8 +90,7 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) } /* Update derived state, pass draw info to update function */ - if (ctx->dirty) - swr_update_derived(pipe, info); + swr_update_derived(pipe, info); swr_update_draw_context(ctx); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: [rasterizer memory] minify texture width before alignment
Module: Mesa Branch: master Commit: ee0b6597a9579342029e46bf2bc4a8dd887f7896 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee0b6597a9579342029e46bf2bc4a8dd887f7896 Author: Ilia Mirkin Date: Thu Nov 17 22:40:29 2016 -0500 swr: [rasterizer memory] minify texture width before alignment The minification should happen before alignment, not after. See similar logic on ComputeLODOffsetY. The current logic requires unnecessarily large textures when there's an initial NPOT size. Signed-off-by: Ilia Mirkin Reviewed-by: Tim Rowley --- src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h index 11ed451..350e44b 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h +++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h @@ -284,8 +284,8 @@ INLINE void ComputeLODOffset1D( offset = GFX_ALIGN(curWidth, hAlign); for (uint32_t l = 1; l < lod; ++l) { -curWidth = GFX_ALIGN(std::max(curWidth >> 1, 1U), hAlign); -offset += curWidth; +curWidth = std::max(curWidth >> 1, 1U); +offset += GFX_ALIGN(curWidth, hAlign); } if (info.isSubsampled || info.isBC) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: add infrastr. for compiling optimized shader variants asynchronously
Module: Mesa Branch: master Commit: d984a324bf8702adde68c006f1c3454233871e1c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d984a324bf8702adde68c006f1c3454233871e1c Author: Marek Olšák Date: Thu Oct 13 12:18:53 2016 +0200 radeonsi: add infrastr. for compiling optimized shader variants asynchronously Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.h| 7 ++ src/gallium/drivers/radeonsi/si_state_shaders.c | 136 ++-- 2 files changed, 109 insertions(+), 34 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 2ed0cb7..38aa361 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -435,6 +435,10 @@ struct si_shader_key { uint64_tinputs_to_copy; /* for fixed-func TCS */ } tcs; } mono; + + /* Optimization flags for asynchronous compilation only. */ + union { + } opt; }; struct si_shader_config { @@ -484,7 +488,10 @@ struct si_shader { struct r600_resource*bo; struct r600_resource*scratch_bo; struct si_shader_keykey; + struct util_queue_fence optimized_ready; + boolcompilation_failed; boolis_monolithic; + boolis_optimized; boolis_binary_shared; boolis_gs_copy_shader; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 72d0518..00ccbbd 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1015,33 +1015,73 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, } } +static void si_build_shader_variant(void *job, int thread_index) +{ + struct si_shader *shader = (struct si_shader *)job; + struct si_shader_selector *sel = shader->selector; + struct si_screen *sscreen = sel->screen; + LLVMTargetMachineRef tm; + struct pipe_debug_callback *debug = &sel->debug; + int r; + + if (thread_index >= 0) { + assert(thread_index < ARRAY_SIZE(sscreen->tm)); + tm = sscreen->tm[thread_index]; + if (!debug->async) + debug = NULL; + } else { + tm = sel->tm; + } + + r = si_shader_create(sscreen, tm, shader, debug); + if (unlikely(r)) { + R600_ERR("Failed to build shader variant (type=%u) %d\n", +sel->type, r); + shader->compilation_failed = true; + return; + } + + if (sel->is_debug_context) { + FILE *f = open_memstream(&shader->shader_log, +&shader->shader_log_size); + if (f) { + si_shader_dump(sscreen, shader, NULL, sel->type, f); + fclose(f); + } + } + + si_shader_init_pm4_state(sscreen, shader); +} + /* Select the hw shader variant depending on the current state. */ static int si_shader_select_with_key(struct si_screen *sscreen, struct si_shader_ctx_state *state, struct si_shader_key *key, -LLVMTargetMachineRef tm, -struct pipe_debug_callback *debug, -bool wait, -bool is_debug_context) +int thread_index) { static const struct si_shader_key zeroed; struct si_shader_selector *sel = state->cso; struct si_shader *current = state->current; struct si_shader *iter, *shader = NULL; - int r; - +again: /* Check if we don't need to change anything. * This path is also used for most shaders that don't need multiple * variants, it will cost just a computation of the key and this * test. */ - if (likely(current && memcmp(¤t->key, key, sizeof(*key)) == 0)) + if (likely(current && + memcmp(¤t->key, key, sizeof(*key)) == 0 && + (!current->is_optimized || + util_queue_fence_is_signalled(¤t->optimized_ready return 0; /* This must be done before the mutex is locked, because async GS * compilation calls this function too, and therefore must enter * the mutex first. +* +* Only wait if we are in a draw call. Don't wait if we are +* in a compiler thread. */ - if (wait) + if (thread_index < 0) util_queue_job_wait(&sel->
Mesa (master): radeonsi: don't export ClipVertex and ClipDistance[] if clipping is disabled
Module: Mesa Branch: master Commit: ed3190b3f3a776fc8c75b1e6130a88079166d115 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed3190b3f3a776fc8c75b1e6130a88079166d115 Author: Marek Olšák Date: Sun Nov 13 18:41:43 2016 +0100 radeonsi: don't export ClipVertex and ClipDistance[] if clipping is disabled This is the first user of optimized monolithic shader variants. Cull distances can't be disabled by states. Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c| 6 ++ src/gallium/drivers/radeonsi/si_shader.h| 5 +++-- src/gallium/drivers/radeonsi/si_state.c | 10 +- src/gallium/drivers/radeonsi/si_state_shaders.c | 21 +++-- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 5e57bb3..a80d9c3 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2294,9 +2294,15 @@ handle_semantic: param_count++; break; case TGSI_SEMANTIC_CLIPDIST: + if (shader->key.opt.hw_vs.clip_disable) { + semantic_name = TGSI_SEMANTIC_GENERIC; + goto handle_semantic; + } target = V_008DFC_SQ_EXP_POS + 2 + semantic_index; break; case TGSI_SEMANTIC_CLIPVERTEX: + if (shader->key.opt.hw_vs.clip_disable) + continue; si_llvm_emit_clipvertex(bld_base, pos_args, outputs[i].values); continue; case TGSI_SEMANTIC_PRIMID: diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 38aa361..4cbd1c2 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -320,8 +320,6 @@ struct si_vs_prolog_bits { struct si_vs_epilog_bits { unsignedexport_prim_id:1; /* when PS needs it and GS is disabled */ /* TODO: -* - skip clipdist, culldist (including clipvertex code) exports based -* on which clip_plane_enable bits are set * - skip layer, viewport, clipdist, and culldist parameter exports * if PS doesn't read them */ @@ -438,6 +436,9 @@ struct si_shader_key { /* Optimization flags for asynchronous compilation only. */ union { + struct { + unsignedclip_disable:1; + } hw_vs; /* HW VS (it can be VS, TES, GS) */ } opt; }; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 096c641..b3299a9 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -644,6 +644,7 @@ static void si_emit_clip_state(struct si_context *sctx, struct r600_atom *atom) static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom) { struct radeon_winsys_cs *cs = sctx->b.gfx.cs; + struct si_shader *vs = si_get_vs_state(sctx); struct tgsi_shader_info *info = si_get_vs_info(sctx); struct si_state_rasterizer *rs = sctx->queued.named.rasterizer; unsigned window_space = @@ -652,7 +653,14 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom) info->writes_clipvertex ? SIX_BITS : info->clipdist_writemask; unsigned ucp_mask = clipdist_mask ? 0 : rs->clip_plane_enable & SIX_BITS; unsigned culldist_mask = info->culldist_writemask << info->num_written_clipdistance; - unsigned total_mask = clipdist_mask | culldist_mask; + unsigned total_mask; + + if (vs->key.opt.hw_vs.clip_disable) { + assert(!info->culldist_writemask); + clipdist_mask = 0; + culldist_mask = 0; + } + total_mask = clipdist_mask | culldist_mask; radeon_set_context_reg(cs, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(info->writes_psize) | diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 00ccbbd..1d116f6 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -854,6 +854,17 @@ static unsigned si_get_alpha_test_func(struct si_context *sctx) return PIPE_FUNC_ALWAYS; } +static void si_shader_selector_key_hw_vs(struct si_context *sctx, +struct si_shader_selector *vs, +struct si_shader_key *key) +{ + key->opt.hw_vs.clip_disable = + sctx->queued.named.rasterizer->clip_plane_enable == 0 && + (vs->info.clipdist_writemask ||
Mesa (master): radeonsi: fix culling if clip & cull distances are used at the same time
Module: Mesa Branch: master Commit: d4e9f409e93391fb56b12e6933123198df7ac4bc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4e9f409e93391fb56b12e6933123198df7ac4bc Author: Marek Olšák Date: Sun Nov 13 18:12:36 2016 +0100 radeonsi: fix culling if clip & cull distances are used at the same time Fixed piglits: - arb_cull_distance/clip-cull-3 - arb_cull_distance/clip-cull-4 Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 3ca3553..4a41aa8 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -651,7 +651,8 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom) unsigned clipdist_mask = info->writes_clipvertex ? SIX_BITS : info->clipdist_writemask; unsigned ucp_mask = clipdist_mask ? 0 : rs->clip_plane_enable & SIX_BITS; - unsigned total_mask = clipdist_mask | (info->culldist_writemask << info->num_written_clipdistance); + unsigned culldist_mask = info->culldist_writemask << info->num_written_clipdistance; + unsigned total_mask = clipdist_mask | culldist_mask; radeon_set_context_reg(cs, R_02881C_PA_CL_VS_OUT_CNTL, S_02881C_USE_VTX_POINT_SIZE(info->writes_psize) | @@ -666,7 +667,7 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom) info->writes_viewport_index) | S_02881C_VS_OUT_MISC_SIDE_BUS_ENA(1) | (rs->clip_plane_enable & -clipdist_mask) | (info->culldist_writemask << 8)); +clipdist_mask) | (culldist_mask << 8)); radeon_set_context_reg(cs, R_028810_PA_CL_CLIP_CNTL, rs->pa_cl_clip_cntl | ucp_mask | ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: fast exit si_emit_derived_tess_state early
Module: Mesa Branch: master Commit: fa476e0566f7324ebd8b0be8055333082eba61ef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa476e0566f7324ebd8b0be8055333082eba61ef Author: Marek Olšák Date: Fri Nov 11 22:36:17 2016 +0100 radeonsi: fast exit si_emit_derived_tess_state early Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_pipe.h | 1 + src/gallium/drivers/radeonsi/si_state_draw.c | 25 ++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 8e6a94d..df2f130 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -336,6 +336,7 @@ struct si_context { struct si_shader_selector *last_tcs; int last_num_tcs_input_cp; int last_tes_sh_base; + unsignedlast_num_patches; /* Debug state. */ boolis_debug; diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index affc156..e904164 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -108,6 +108,19 @@ static void si_emit_derived_tess_state(struct si_context *sctx, unsigned tcs_in_layout, tcs_out_layout, tcs_out_offsets; unsigned offchip_layout, hardware_lds_size, ls_hs_config; + if (sctx->last_ls == ls->current && + sctx->last_tcs == tcs && + sctx->last_tes_sh_base == tes_sh_base && + sctx->last_num_tcs_input_cp == num_tcs_input_cp) { + *num_patches = sctx->last_num_patches; + return; + } + + sctx->last_ls = ls->current; + sctx->last_tcs = tcs; + sctx->last_tes_sh_base = tes_sh_base; + sctx->last_num_tcs_input_cp = num_tcs_input_cp; + /* This calculates how shader inputs and outputs among VS, TCS, and TES * are laid out in LDS. */ num_tcs_inputs = util_last_bit64(ls->cso->outputs_written); @@ -153,6 +166,7 @@ static void si_emit_derived_tess_state(struct si_context *sctx, * specific value is taken from the proprietary driver. */ *num_patches = MIN2(*num_patches, 40); + sctx->last_num_patches = *num_patches; output_patch0_offset = input_patch_size * *num_patches; perpatch_output_offset = output_patch0_offset + pervertex_output_patch_size; @@ -168,17 +182,6 @@ static void si_emit_derived_tess_state(struct si_context *sctx, ls_rsrc2 |= S_00B52C_LDS_SIZE(align(lds_size, 256) / 256); } - if (sctx->last_ls == ls->current && - sctx->last_tcs == tcs && - sctx->last_tes_sh_base == tes_sh_base && - sctx->last_num_tcs_input_cp == num_tcs_input_cp) - return; - - sctx->last_ls = ls->current; - sctx->last_tcs = tcs; - sctx->last_tes_sh_base = tes_sh_base; - sctx->last_num_tcs_input_cp = num_tcs_input_cp; - /* Due to a hw bug, RSRC2_LS must be written twice with another * LS register written in between. */ if (sctx->b.chip_class == CIK && sctx->b.family != CHIP_HAWAII) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): winsys/amdgpu: set addrlib flag opt4Space
Module: Mesa Branch: master Commit: 79a8e674aef8d50e79f5d4ab25e0f951d1c69398 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=79a8e674aef8d50e79f5d4ab25e0f951d1c69398 Author: Marek Olšák Date: Fri Nov 11 21:19:34 2016 +0100 winsys/amdgpu: set addrlib flag opt4Space Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/winsys/amdgpu/drm/amdgpu_surface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c b/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c index d8ab28b..08989b5 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c @@ -405,6 +405,7 @@ static int amdgpu_surface_init(struct radeon_winsys *rws, !AddrSurfInfoIn.flags.fmask && tex->nr_samples <= 1 && (flags & RADEON_SURF_OPTIMIZE_FOR_SPACE); + AddrSurfInfoIn.flags.opt4Space = AddrSurfInfoIn.flags.degrade4Space; /* DCC notes: * - If we add MSAA support, keep in mind that CB can't decompress 8bpp ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tgsi/scan: use a big switch for scanning outputs
Module: Mesa Branch: master Commit: 8a2251911eee8fa04d350915fa796cb62db5b814 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a2251911eee8fa04d350915fa796cb62db5b814 Author: Marek Olšák Date: Mon Nov 14 01:59:42 2016 +0100 tgsi/scan: use a big switch for scanning outputs Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 68 ++ 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 40a1340..f0dba0b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -547,47 +547,35 @@ scan_declaration(struct tgsi_shader_info *info, info->output_semantic_index[reg] = (ubyte) semIndex; info->num_outputs = MAX2(info->num_outputs, reg + 1); - if (semName == TGSI_SEMANTIC_COLOR) + switch (semName) { + case TGSI_SEMANTIC_VIEWPORT_INDEX: +info->writes_viewport_index = true; +break; + case TGSI_SEMANTIC_LAYER: +info->writes_layer = true; +break; + case TGSI_SEMANTIC_PSIZE: +info->writes_psize = true; +break; + case TGSI_SEMANTIC_CLIPVERTEX: +info->writes_clipvertex = true; +break; + case TGSI_SEMANTIC_COLOR: info->colors_written |= 1 << semIndex; - - if (procType == PIPE_SHADER_VERTEX || - procType == PIPE_SHADER_GEOMETRY || - procType == PIPE_SHADER_TESS_CTRL || - procType == PIPE_SHADER_TESS_EVAL) { -switch (semName) { -case TGSI_SEMANTIC_VIEWPORT_INDEX: - info->writes_viewport_index = TRUE; - break; -case TGSI_SEMANTIC_LAYER: - info->writes_layer = TRUE; - break; -case TGSI_SEMANTIC_PSIZE: - info->writes_psize = TRUE; - break; -case TGSI_SEMANTIC_CLIPVERTEX: - info->writes_clipvertex = TRUE; - break; -} - } - - if (procType == PIPE_SHADER_FRAGMENT) { -switch (semName) { -case TGSI_SEMANTIC_POSITION: - info->writes_z = TRUE; - break; -case TGSI_SEMANTIC_STENCIL: - info->writes_stencil = TRUE; - break; -case TGSI_SEMANTIC_SAMPLEMASK: - info->writes_samplemask = TRUE; - break; -} - } - - if (procType == PIPE_SHADER_VERTEX) { -if (semName == TGSI_SEMANTIC_EDGEFLAG) { - info->writes_edgeflag = TRUE; -} +break; + case TGSI_SEMANTIC_STENCIL: +info->writes_stencil = true; +break; + case TGSI_SEMANTIC_SAMPLEMASK: +info->writes_samplemask = true; +break; + case TGSI_SEMANTIC_EDGEFLAG: +info->writes_edgeflag = true; +break; + case TGSI_SEMANTIC_POSITION: +if (procType == PIPE_SHADER_FRAGMENT) + info->writes_z = true; +break; } break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: check for !is_linear in do_hardware_msaa_resolve
Module: Mesa Branch: master Commit: 72d1669ed2e943998324db48068936351cf9f9c1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=72d1669ed2e943998324db48068936351cf9f9c1 Author: Marek Olšák Date: Fri Nov 11 21:15:54 2016 +0100 radeonsi: check for !is_linear in do_hardware_msaa_resolve We don't want opt4Space here. Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_blit.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index 075d76a..f5f49c1 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -972,6 +972,7 @@ static bool do_hardware_msaa_resolve(struct pipe_context *ctx, struct si_context *sctx = (struct si_context*)ctx; struct r600_texture *src = (struct r600_texture*)info->src.resource; struct r600_texture *dst = (struct r600_texture*)info->dst.resource; + struct r600_texture *rtmp; unsigned dst_width = u_minify(info->dst.resource->width0, info->dst.level); unsigned dst_height = u_minify(info->dst.resource->height0, info->dst.level); enum pipe_format format = info->src.format; @@ -1074,9 +1075,10 @@ resolve_to_temp: tmp = ctx->screen->resource_create(ctx->screen, &templ); if (!tmp) return false; + rtmp = (struct r600_texture*)tmp; - assert(src->surface.micro_tile_mode == - ((struct r600_texture*)tmp)->surface.micro_tile_mode); + assert(!rtmp->surface.is_linear); + assert(src->surface.micro_tile_mode == rtmp->surface.micro_tile_mode); /* resolve */ si_blitter_begin(ctx, SI_COLOR_RESOLVE | ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: split the shader key into 3 logical parts
Module: Mesa Branch: master Commit: 6d5c2a8b5c33122682d801f9b14a70e3d3d9a5cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d5c2a8b5c33122682d801f9b14a70e3d3d9a5cc Author: Marek Olšák Date: Sun Nov 13 03:17:46 2016 +0100 radeonsi: split the shader key into 3 logical parts key->part.*: prolog and epilog flags only key->as_{ls,es}: special flags key->mono.*: flags for monolithic compilation only Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_pipe.h | 4 +- src/gallium/drivers/radeonsi/si_shader.c| 194 src/gallium/drivers/radeonsi/si_shader.h| 65 src/gallium/drivers/radeonsi/si_state.c | 2 +- src/gallium/drivers/radeonsi/si_state_shaders.c | 132 5 files changed, 203 insertions(+), 194 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index df2f130..847281e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -463,9 +463,9 @@ static inline struct si_shader* si_get_vs_state(struct si_context *sctx) static inline bool si_vs_exports_prim_id(struct si_shader *shader) { if (shader->selector->type == PIPE_SHADER_VERTEX) - return shader->key.vs.epilog.export_prim_id; + return shader->key.part.vs.epilog.export_prim_id; else if (shader->selector->type == PIPE_SHADER_TESS_EVAL) - return shader->key.tes.epilog.export_prim_id; + return shader->key.part.tes.epilog.export_prim_id; else return false; } diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 608cb72..a3388bd 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -68,7 +68,7 @@ static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action, struct lp_build_tgsi_context *bld_base, struct lp_build_emit_data *emit_data); -static void si_dump_shader_key(unsigned shader, union si_shader_key *key, +static void si_dump_shader_key(unsigned shader, struct si_shader_key *key, FILE *f); static void si_build_vs_prolog_function(struct si_shader_context *ctx, @@ -416,7 +416,7 @@ static void declare_input_vs( input, llvm_chan, ""); } - fix_fetch = (ctx->shader->key.vs.fix_fetch >> (2 * input_index)) & 3; + fix_fetch = (ctx->shader->key.mono.vs.fix_fetch >> (2 * input_index)) & 3; if (fix_fetch) { /* The hardware returns an unsigned value; convert it to a * signed one. @@ -1252,7 +1252,7 @@ static void interp_fs_input(struct si_shader_context *ctx, intr_name = interp_param ? "llvm.SI.fs.interp" : "llvm.SI.fs.constant"; if (semantic_name == TGSI_SEMANTIC_COLOR && - ctx->shader->key.ps.prolog.color_two_side) { + ctx->shader->key.part.ps.prolog.color_two_side) { LLVMValueRef args[4]; LLVMValueRef is_face_positive; LLVMValueRef back_attr_number; @@ -1360,7 +1360,7 @@ static void declare_input_fs( if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR && decl->Interp.Interpolate == TGSI_INTERPOLATE_COLOR && - ctx->shader->key.ps.prolog.flatshade_colors) + ctx->shader->key.part.ps.prolog.flatshade_colors) interp_param = NULL; /* load the constant color */ interp_fs_input(ctx, input_index, decl->Semantic.Name, @@ -1832,13 +1832,13 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base, args[3] = lp_build_const_int32(base->gallivm, target); if (ctx->type == PIPE_SHADER_FRAGMENT) { - const union si_shader_key *key = &ctx->shader->key; - unsigned col_formats = key->ps.epilog.spi_shader_col_format; + const struct si_shader_key *key = &ctx->shader->key; + unsigned col_formats = key->part.ps.epilog.spi_shader_col_format; int cbuf = target - V_008DFC_SQ_EXP_MRT; assert(cbuf >= 0 && cbuf < 8); spi_shader_col_format = (col_formats >> (cbuf * 4)) & 0xf; - is_int8 = (key->ps.epilog.color_is_int8 >> cbuf) & 0x1; + is_int8 = (key->part.ps.epilog.color_is_int8 >> cbuf) & 0x1; } args[4] = uint->zero; /* COMPR flag */ @@ -1991,13 +1991,13 @@ static void si_alpha_test(struct lp_build_tgsi_context *bld_base, struct si_shader_context *ctx = si_shader_context(bld_base); struct gallivm_state *gallivm = bld_base->base.gallivm; - if (ctx->shader->key.ps.epilog.alpha_func != PIPE_FUNC_NEVER) { + if (ctx->shader->key.part.ps.epilog.alpha_func != PIPE_FUNC_NEV
Mesa (master): radeonsi: eliminate VS outputs that aren' t used by PS at runtime
Module: Mesa Branch: master Commit: ef6c84b301ce15022d4907dfb0db5764e31e68f5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef6c84b301ce15022d4907dfb0db5764e31e68f5 Author: Marek Olšák Date: Mon Nov 14 09:09:51 2016 +0100 radeonsi: eliminate VS outputs that aren't used by PS at runtime A past commit added the ability to compile "optimized" shader variants asynchronously (not stalling the app). This commit builds upon that and adds what is basically a runtime shader linker. If a VS output isn't used by the currently-bound PS, a new VS compilation is started without that output. The new shader variant is used when it's ready. All apps using separate shader objects I've seen had unused VS outputs. Eliminating unused/useless VS outputs also eliminates the corresponding vertex attribute loads. Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c| 26 - src/gallium/drivers/radeonsi/si_shader.h| 7 ++--- src/gallium/drivers/radeonsi/si_state_shaders.c | 37 ++--- 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 2b43224..abe30e5 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2281,6 +2281,26 @@ static void si_llvm_export_vs(struct lp_build_tgsi_context *bld_base, for (i = 0; i < noutput; i++) { semantic_name = outputs[i].name; semantic_index = outputs[i].sid; + bool export_param = true; + + switch (semantic_name) { + case TGSI_SEMANTIC_POSITION: /* ignore these */ + case TGSI_SEMANTIC_PSIZE: + case TGSI_SEMANTIC_CLIPVERTEX: + case TGSI_SEMANTIC_EDGEFLAG: + break; + case TGSI_SEMANTIC_GENERIC: + case TGSI_SEMANTIC_CLIPDIST: + if (shader->key.opt.hw_vs.kill_outputs & + (1ull << si_shader_io_get_unique_index(semantic_name, semantic_index))) + export_param = false; + break; + default: + if (shader->key.opt.hw_vs.kill_outputs2 & + (1u << si_shader_io_get_unique_index2(semantic_name, semantic_index))) + export_param = false; + break; + } handle_semantic: /* Select the correct target */ @@ -2304,6 +2324,8 @@ handle_semantic: break; case TGSI_SEMANTIC_COLOR: case TGSI_SEMANTIC_BCOLOR: + if (!export_param) + continue; target = V_008DFC_SQ_EXP_PARAM + param_count; assert(i < ARRAY_SIZE(shader->info.vs_output_param_offset)); shader->info.vs_output_param_offset[i] = param_count; @@ -2325,6 +2347,8 @@ handle_semantic: case TGSI_SEMANTIC_FOG: case TGSI_SEMANTIC_TEXCOORD: case TGSI_SEMANTIC_GENERIC: + if (!export_param) + continue; target = V_008DFC_SQ_EXP_PARAM + param_count; assert(i < ARRAY_SIZE(shader->info.vs_output_param_offset)); shader->info.vs_output_param_offset[i] = param_count; @@ -7083,7 +7107,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, si_init_shader_ctx(&ctx, sscreen, shader, tm); ctx.separate_prolog = !is_monolithic; - memset(shader->info.vs_output_param_offset, 0xff, + memset(shader->info.vs_output_param_offset, EXP_PARAM_UNDEFINED, sizeof(shader->info.vs_output_param_offset)); shader->info.uses_instanceid = sel->info.uses_instanceid; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index fc9c913..aa37676 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -322,10 +322,6 @@ struct si_vs_prolog_bits { /* Common VS bits between the shader key and the epilog key. */ struct si_vs_epilog_bits { unsignedexport_prim_id:1; /* when PS needs it and GS is disabled */ - /* TODO: -* - skip layer, viewport, clipdist, and culldist parameter exports -* if PS doesn't read them -*/ }; /* Common TCS bits between the shader key and the epilog key. */ @@ -440,6 +436,8 @@ struct si_shader_key { /* Optimization flags for asynchronous compilation only. */ union { struct { + uint64_tkill_outputs; /* "get_unique_index" bits */ + uint32_tkill_outputs2; /* "get_unique_index2" b
Mesa (master): tgsi/scan: record if a shader writes the position output
Module: Mesa Branch: master Commit: 7dbf83af54067efcbd8fb872bbd1115fcecfab47 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7dbf83af54067efcbd8fb872bbd1115fcecfab47 Author: Marek Olšák Date: Mon Nov 14 02:01:34 2016 +0100 tgsi/scan: record if a shader writes the position output Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 2 ++ src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index f0dba0b..84d6456 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -575,6 +575,8 @@ scan_declaration(struct tgsi_shader_info *info, case TGSI_SEMANTIC_POSITION: if (procType == PIPE_SHADER_FRAGMENT) info->writes_z = true; +else + info->writes_position = true; break; } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 602a870..fe503e8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -110,6 +110,7 @@ struct tgsi_shader_info boolean uses_primid; boolean uses_frontface; boolean uses_invocationid; + boolean writes_position; boolean writes_psize; boolean writes_clipvertex; boolean writes_viewport_index; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: record information about all written and read varyings
Module: Mesa Branch: master Commit: 7e76f9a7a8041e2fe6aa557f1520358f1c323553 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e76f9a7a8041e2fe6aa557f1520358f1c323553 Author: Marek Olšák Date: Mon Nov 14 07:56:57 2016 +0100 radeonsi: record information about all written and read varyings It's just tgsi_shader_info with DEFAULT_VAL varyings removed. Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c| 22 src/gallium/drivers/radeonsi/si_shader.h| 10 ++-- src/gallium/drivers/radeonsi/si_state_shaders.c | 69 + 3 files changed, 98 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 8b56459..2b43224 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -141,6 +141,28 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index) } } +unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index) +{ + switch (name) { + case TGSI_SEMANTIC_FOG: + return 0; + case TGSI_SEMANTIC_LAYER: + return 1; + case TGSI_SEMANTIC_VIEWPORT_INDEX: + return 2; + case TGSI_SEMANTIC_PRIMID: + return 3; + case TGSI_SEMANTIC_COLOR: /* these alias */ + case TGSI_SEMANTIC_BCOLOR: + return 4 + index; + case TGSI_SEMANTIC_TEXCOORD: + return 6 + index; + default: + assert(!"invalid semantic name"); + return 0; + } +} + /** * Get the value of a shader input parameter and extract a bitfield. */ diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 4cbd1c2..fc9c913 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -295,9 +295,12 @@ struct si_shader_selector { /* CS parameters */ unsigned local_size; - /* masks of "get_unique_index" bits */ - uint64_toutputs_written; - uint32_tpatch_outputs_written; + uint64_toutputs_written;/* "get_unique_index" bits */ + uint32_tpatch_outputs_written; /* "get_unique_index" bits */ + uint32_toutputs_written2; /* "get_unique_index2" bits */ + + uint64_tinputs_read;/* "get_unique_index" bits */ + uint32_tinputs_read2; /* "get_unique_index2" bits */ }; /* Valid shader configurations: @@ -539,6 +542,7 @@ int si_compile_llvm(struct si_screen *sscreen, const char *name); void si_shader_destroy(struct si_shader *shader); unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index); +unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index); int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader); void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader, struct pipe_debug_callback *debug, unsigned processor, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index d10084d..e4d8747 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1296,6 +1296,51 @@ void si_init_shader_selector_async(void *job, int thread_index) } sel->main_shader_part = shader; + + /* Unset "outputs_written" flags for outputs converted to +* DEFAULT_VAL, so that later inter-shader optimizations don't +* try to eliminate outputs that don't exist in the final +* shader. +* +* This is only done if non-monolithic shaders are enabled. +*/ + if ((sel->type == PIPE_SHADER_VERTEX || +sel->type == PIPE_SHADER_TESS_EVAL) && + !shader->key.as_ls && + !shader->key.as_es) { + unsigned i; + + for (i = 0; i < sel->info.num_outputs; i++) { + unsigned offset = shader->info.vs_output_param_offset[i]; + + if (offset <= EXP_PARAM_OFFSET_31) + continue; + + unsigned name = sel->info.output_semantic_name[i]; + unsigned index = sel->info.output_semantic_index[i]; + unsigned id; + + switch (name) { + case TGSI_SEMANTIC_GENERIC: + /* don't process indices the function can't handle */ + if (index >= 60) +
Mesa (master): radeonsi: assume that a VS without POSITION is LS
Module: Mesa Branch: master Commit: e59389d73826c88c76c7a4db2a7ca5ef57bdf7b9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e59389d73826c88c76c7a4db2a7ca5ef57bdf7b9 Author: Marek Olšák Date: Mon Nov 14 02:03:28 2016 +0100 radeonsi: assume that a VS without POSITION is LS Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_state_shaders.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 9e95fea..d0869e3 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1124,6 +1124,13 @@ static void si_parse_next_shader_property(const struct tgsi_shader_info *info, case PIPE_SHADER_TESS_EVAL: key->vs.as_ls = 1; break; + default: + /* If POSITION isn't written, it can't be a HW VS. +* Assume that it's a HW LS. (the next shader is TCS) +* This heuristic is needed for separate shader objects. +*/ + if (!info->writes_position) + key->as_ls = 1; } break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: don' t set vs.epilog.export_prim_id if TES is bound
Module: Mesa Branch: master Commit: d2a56985d7b4b22d176c13d8601f98e18e44d3a1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2a56985d7b4b22d176c13d8601f98e18e44d3a1 Author: Marek Olšák Date: Sun Nov 13 17:30:54 2016 +0100 radeonsi: don't set vs.epilog.export_prim_id if TES is bound there is no VS epilog in this case Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_state_shaders.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 9df8f47..72d0518 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -881,10 +881,10 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, key->as_ls = 1; else if (sctx->gs_shader.cso) key->as_es = 1; - - if (!sctx->gs_shader.cso && sctx->ps_shader.cso && - sctx->ps_shader.cso->info.uses_primid) - key->part.vs.epilog.export_prim_id = 1; + else { + if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid) + key->part.vs.epilog.export_prim_id = 1; + } break; case PIPE_SHADER_TESS_CTRL: key->part.tcs.epilog.prim_mode = ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/radeon: add RADEON_SURF_OPTIMIZE_FOR_SPACE
Module: Mesa Branch: master Commit: 49fa4a4e600cbb35c43a85fab2ed4aac3e6acccf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49fa4a4e600cbb35c43a85fab2ed4aac3e6acccf Author: Marek Olšák Date: Fri Nov 11 21:14:03 2016 +0100 gallium/radeon: add RADEON_SURF_OPTIMIZE_FOR_SPACE FORCE_TILING should disable it. It has no effect now, but that may change soon. Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeon/r600_texture.c | 2 ++ src/gallium/drivers/radeon/radeon_winsys.h | 1 + src/gallium/winsys/amdgpu/drm/amdgpu_surface.c | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 97673ee..259ff36 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -253,6 +253,8 @@ static int r600_init_surface(struct r600_common_screen *rscreen, if (is_imported) flags |= RADEON_SURF_IMPORTED; + if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING)) + flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE; r = rscreen->ws->surface_init(rscreen->ws, ptex, flags, bpe, array_mode, surface); diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 3e30e95..3027c4a 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -281,6 +281,7 @@ enum radeon_micro_mode { #define RADEON_SURF_DISABLE_DCC (1 << 22) #define RADEON_SURF_TC_COMPATIBLE_HTILE (1 << 23) #define RADEON_SURF_IMPORTED(1 << 24) +#define RADEON_SURF_OPTIMIZE_FOR_SPACE (1 << 25) struct radeon_surf_level { uint64_toffset; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c b/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c index d65dae7..d8ab28b 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c @@ -402,7 +402,9 @@ static int amdgpu_surface_init(struct radeon_winsys *rws, * requested, because TC-compatible HTILE requires 2D tiling. */ AddrSurfInfoIn.flags.degrade4Space = !AddrSurfInfoIn.flags.tcCompatible && -!(flags & RADEON_SURF_FMASK); +!AddrSurfInfoIn.flags.fmask && +tex->nr_samples <= 1 && +(flags & RADEON_SURF_OPTIMIZE_FOR_SPACE); /* DCC notes: * - If we add MSAA support, keep in mind that CB can't decompress 8bpp ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: remove all varyings for depth-only rendering or rasterization off
Module: Mesa Branch: master Commit: bf75ef3f9201e11bb08a4d03dab20d5ff86f1ebc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf75ef3f9201e11bb08a4d03dab20d5ff86f1ebc Author: Marek Olšák Date: Tue Nov 15 21:15:55 2016 +0100 radeonsi: remove all varyings for depth-only rendering or rasterization off Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_pipe.h | 1 + src/gallium/drivers/radeonsi/si_state.c | 2 ++ src/gallium/drivers/radeonsi/si_state_shaders.c | 19 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 847281e..42cbecb 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -167,6 +167,7 @@ struct si_framebuffer { unsignednr_samples; unsignedlog_samples; unsignedcompressed_cb_mask; + unsignedcolorbuf_enabled_4bit; unsignedspi_shader_col_format; unsignedspi_shader_col_format_alpha; unsignedspi_shader_col_format_blend; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index b3299a9..b4683c5 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2360,6 +2360,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, si_dec_framebuffer_counters(&sctx->framebuffer.state); util_copy_framebuffer_state(&sctx->framebuffer.state, state); + sctx->framebuffer.colorbuf_enabled_4bit = 0; sctx->framebuffer.spi_shader_col_format = 0; sctx->framebuffer.spi_shader_col_format_alpha = 0; sctx->framebuffer.spi_shader_col_format_blend = 0; @@ -2382,6 +2383,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx, si_initialize_color_surface(sctx, surf); } + sctx->framebuffer.colorbuf_enabled_4bit |= 0xf << (i * 4); sctx->framebuffer.spi_shader_col_format |= surf->spi_shader_col_format << (i * 4); sctx->framebuffer.spi_shader_col_format_alpha |= diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 7834f87..cd4b339 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -867,7 +867,24 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx, !vs->info.culldist_writemask; /* Find out if PS is disabled. */ - bool ps_disabled = ps == NULL; + bool ps_disabled = true; + if (ps) { + bool ps_modifies_zs = ps->info.uses_kill || + ps->info.writes_z || + ps->info.writes_stencil || + ps->info.writes_samplemask || + si_get_alpha_test_func(sctx) != PIPE_FUNC_ALWAYS; + + unsigned ps_colormask = sctx->framebuffer.colorbuf_enabled_4bit & + sctx->queued.named.blend->cb_target_mask; + if (!ps->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS]) + ps_colormask &= ps->colors_written_4bit; + + ps_disabled = sctx->queued.named.rasterizer->rasterizer_discard || + (!ps_colormask && + !ps_modifies_zs && + !ps->info.writes_memory); + } /* Find out which VS outputs aren't used by the PS. */ uint64_t outputs_written = vs->outputs_written; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: make si_shader_io_get_unique_index stricter
Module: Mesa Branch: master Commit: c7f3e5c647cce64899ed464755ce69a7d2226eca URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7f3e5c647cce64899ed464755ce69a7d2226eca Author: Marek Olšák Date: Sun Nov 13 19:54:13 2016 +0100 radeonsi: make si_shader_io_get_unique_index stricter Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c| 14 -- src/gallium/drivers/radeonsi/si_state_shaders.c | 11 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index a80d9c3..8b56459 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -123,11 +123,9 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index) case TGSI_SEMANTIC_GENERIC: if (index <= 63-4) return 4 + index; - else - /* same explanation as in the default statement, -* the only user hitting this is st/nine. -*/ - return 0; + + assert(!"invalid generic index"); + return 0; /* patch indices are completely separate and thus start from 0 */ case TGSI_SEMANTIC_TESSOUTER: @@ -138,11 +136,7 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index) return 2 + index; default: - /* Don't fail here. The result of this function is only used -* for LS, TCS, TES, and GS, where legacy GL semantics can't -* occur, but this function is called for all vertex shaders -* before it's known whether LS will be compiled or not. -*/ + assert(!"invalid semantic name"); return 0; } } diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 1d116f6..d10084d 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1425,9 +1425,18 @@ static void *si_create_shader_selector(struct pipe_context *ctx, sel->patch_outputs_written |= 1llu << si_shader_io_get_unique_index(name, index); break; - default: + + case TGSI_SEMANTIC_GENERIC: + /* don't process indices the function can't handle */ + if (index >= 60) + break; + /* fall through */ + case TGSI_SEMANTIC_POSITION: + case TGSI_SEMANTIC_PSIZE: + case TGSI_SEMANTIC_CLIPDIST: sel->outputs_written |= 1llu << si_shader_io_get_unique_index(name, index); + break; } } sel->esgs_itemsize = util_last_bit64(sel->outputs_written) * 16; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: clean up si_emit_clip_regs
Module: Mesa Branch: master Commit: 9d8db805ef6d10bc3b7c6a91963c86ab3874ebf8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d8db805ef6d10bc3b7c6a91963c86ab3874ebf8 Author: Marek Olšák Date: Sun Nov 13 17:51:41 2016 +0100 radeonsi: clean up si_emit_clip_regs Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_state.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 818a393..3ca3553 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -645,10 +645,12 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom) { struct radeon_winsys_cs *cs = sctx->b.gfx.cs; struct tgsi_shader_info *info = si_get_vs_info(sctx); + struct si_state_rasterizer *rs = sctx->queued.named.rasterizer; unsigned window_space = info->properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION]; unsigned clipdist_mask = info->writes_clipvertex ? SIX_BITS : info->clipdist_writemask; + unsigned ucp_mask = clipdist_mask ? 0 : rs->clip_plane_enable & SIX_BITS; unsigned total_mask = clipdist_mask | (info->culldist_writemask << info->num_written_clipdistance); radeon_set_context_reg(cs, R_02881C_PA_CL_VS_OUT_CNTL, @@ -663,12 +665,11 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom) info->writes_layer || info->writes_viewport_index) | S_02881C_VS_OUT_MISC_SIDE_BUS_ENA(1) | - (sctx->queued.named.rasterizer->clip_plane_enable & + (rs->clip_plane_enable & clipdist_mask) | (info->culldist_writemask << 8)); radeon_set_context_reg(cs, R_028810_PA_CL_CLIP_CNTL, - sctx->queued.named.rasterizer->pa_cl_clip_cntl | - (clipdist_mask ? 0 : -sctx->queued.named.rasterizer->clip_plane_enable & SIX_BITS) | + rs->pa_cl_clip_cntl | + ucp_mask | S_028810_CLIP_DISABLE(window_space)); /* reuse needs to be set off if we write oViewport */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: print all flags in si_dump_shader_key
Module: Mesa Branch: master Commit: e6aee45db410eb1dbbaf6590ef5fbb53a54a7d46 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6aee45db410eb1dbbaf6590ef5fbb53a54a7d46 Author: Marek Olšák Date: Mon Nov 14 01:53:24 2016 +0100 radeonsi: print all flags in si_dump_shader_key Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index a3388bd..6d3365c 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6244,10 +6244,12 @@ static void si_dump_shader_key(unsigned shader, struct si_shader_key *key, fprintf(f, " part.vs.epilog.export_prim_id = %u\n", key->part.vs.epilog.export_prim_id); fprintf(f, " as_es = %u\n", key->as_es); fprintf(f, " as_ls = %u\n", key->as_ls); + fprintf(f, " mono.vs.fix_fetch = 0x%x\n", key->mono.vs.fix_fetch); break; case PIPE_SHADER_TESS_CTRL: fprintf(f, " part.tcs.epilog.prim_mode = %u\n", key->part.tcs.epilog.prim_mode); + fprintf(f, " mono.tcs.inputs_to_copy = 0x%"PRIx64"\n", key->mono.tcs.inputs_to_copy); break; case PIPE_SHADER_TESS_EVAL: @@ -6256,6 +6258,9 @@ static void si_dump_shader_key(unsigned shader, struct si_shader_key *key, break; case PIPE_SHADER_GEOMETRY: + fprintf(f, " part.gs.prolog.tri_strip_adj_fix = %u\n", key->part.gs.prolog.tri_strip_adj_fix); + break; + case PIPE_SHADER_COMPUTE: break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: simplify checking for monolithic compilation
Module: Mesa Branch: master Commit: fee71fec25efb9771a7c3fa15b120d4c816b59b5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fee71fec25efb9771a7c3fa15b120d4c816b59b5 Author: Marek Olšák Date: Sun Nov 13 19:21:46 2016 +0100 radeonsi: simplify checking for monolithic compilation Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_compute.c | 1 + src/gallium/drivers/radeonsi/si_shader.c| 9 + src/gallium/drivers/radeonsi/si_shader.h| 1 + src/gallium/drivers/radeonsi/si_state_shaders.c | 6 ++ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index e53ffa4..91f1b0a 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -126,6 +126,7 @@ static void *si_create_compute_state( p_atomic_inc(&sscreen->b.num_shaders_created); program->shader.selector = &sel; + program->shader.is_monolithic = true; if (si_shader_create(sscreen, sctx->tm, &program->shader, &sctx->b.debug)) { diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 6d3365c..5e57bb3 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -8139,14 +8139,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, * Vertex shaders are compiled on demand when a vertex fetch * workaround must be applied. */ - if (!mainp || - shader->key.as_es != mainp->key.as_es || - shader->key.as_ls != mainp->key.as_ls || - (sel->type == PIPE_SHADER_VERTEX && -shader->key.mono.vs.fix_fetch) || - (sel->type == PIPE_SHADER_TESS_CTRL && -shader->key.mono.tcs.inputs_to_copy) || - sel->type == PIPE_SHADER_COMPUTE) { + if (shader->is_monolithic) { /* Monolithic shader (compiled as a whole, has many variants, * may take a long time to compile). */ diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index bed22c1..2ed0cb7 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -484,6 +484,7 @@ struct si_shader { struct r600_resource*bo; struct r600_resource*scratch_bo; struct si_shader_keykey; + boolis_monolithic; boolis_binary_shared; boolis_gs_copy_shader; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 3323d3c..9df8f47 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1024,6 +1024,7 @@ static int si_shader_select_with_key(struct si_screen *sscreen, bool wait, bool is_debug_context) { + static const struct si_shader_key zeroed; struct si_shader_selector *sel = state->cso; struct si_shader *current = state->current; struct si_shader *iter, *shader = NULL; @@ -1064,6 +1065,11 @@ static int si_shader_select_with_key(struct si_screen *sscreen, } shader->selector = sel; shader->key = *key; + shader->is_monolithic = + !sel->main_shader_part || + sel->main_shader_part->key.as_ls != key->as_ls || + sel->main_shader_part->key.as_es != key->as_es || + memcmp(&key->mono, &zeroed.mono, sizeof(key->mono)) != 0; r = si_shader_create(sscreen, tm, shader, debug); if (unlikely(r)) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: decrease the number of texture slots to 24
Module: Mesa Branch: master Commit: bdd860e3076655519d45bd66936ef7be9b7dda63 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdd860e3076655519d45bd66936ef7be9b7dda63 Author: Marek Olšák Date: Sun Nov 6 21:49:29 2016 +0100 radeonsi: decrease the number of texture slots to 24 Company Of Heroes 2 needs only 24. This saves 512 bytes of CE RAM per shader stage. Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 6bfa4e7..3a9f0cf 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -35,7 +35,7 @@ #define SI_MAX_ATTRIBS 16 #define SI_NUM_VERTEX_BUFFERS SI_MAX_ATTRIBS -#define SI_NUM_SAMPLERS32 /* OpenGL textures units per shader */ +#define SI_NUM_SAMPLERS24 /* OpenGL textures units per shader */ #define SI_NUM_CONST_BUFFERS 16 #define SI_NUM_IMAGES 16 #define SI_NUM_SHADER_BUFFERS 16 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: Add missing error-checking to si_create_compute_state (v2)
Module: Mesa Branch: master Commit: 44a3f2ee0974003597b0574f99c2440361d61b35 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44a3f2ee0974003597b0574f99c2440361d61b35 Author: Mun Gwan-gyeong Date: Mon Nov 21 23:20:43 2016 +0900 radeonsi: Add missing error-checking to si_create_compute_state (v2) When the uploading of shader fails on si_shader_binary_upload(), it returns -ENOMEM. We should handle si_shader_binary_upload() failure path on si_create_compute_state(). CID 1394027 v2: Fixes from Edward O'Callaghan's review a) Update explicitly return value check with "si_shader_binary_upload() < 0" b) Update commit message. Signed-off-by: Mun Gwan-gyeong Reviewed-by: Edward O'Callaghan Signed-off-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_compute.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 69d57b9..e53ffa4 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -170,7 +170,11 @@ static void *si_create_compute_state( } si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug, PIPE_SHADER_COMPUTE, stderr); - si_shader_binary_upload(sctx->screen, &program->shader); + if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) { + fprintf(stderr, "LLVM failed to upload shader\n"); + FREE(program); + return NULL; + } } return program; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw: drop some overflow computations
Module: Mesa Branch: master Commit: e442db8e9821d210df0a2f253d7b47bfad23a3bf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e442db8e9821d210df0a2f253d7b47bfad23a3bf Author: Roland Scheidegger Date: Sun Nov 13 16:33:37 2016 +0100 draw: drop some overflow computations It turns out that noone actually cares if the address computations overflow, be it the stride mul or the offset adds. Wrap around seems to be explicitly permitted even by some other API (which is a _very_ surprising result, as these overflow computations were added just for that and made some tests pass at that time - I suspect some later fixes fixed the actual root cause...). So the requirements in that other api were actually sane there all along after all... Still need to make sure the computed buffer size needed is valid, of course. This ditches the shiny new widening mul from these codepaths, ah well... And now that I really understand this, change the fishy min limiting indices to what it really should have done. Which is simply to prevent fetching more values than valid for the last loop iteration. (This makes the code path in the loop minimally more complex for the non-indexed case as we have to skip the optimization combining two adds. I think it should be safe to skip this actually there, but I don't care much about this especially since skipping that optimization actually makes the code easier to read elsewhere.) Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c | 111 ++--- 1 file changed, 46 insertions(+), 65 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 414f2dc..c548572 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -669,18 +669,17 @@ fetch_instanced(struct gallivm_state *gallivm, LLVMValueRef zero = LLVMConstNull(i32_t); LLVMBuilderRef builder = gallivm->builder; LLVMValueRef stride, buffer_overflowed, aos, index_valid; - LLVMValueRef ofbit = NULL; unsigned i; aosf_t = lp_build_vec_type(gallivm, lp_float32_vec4_type()); aosi_t = lp_build_vec_type(gallivm, lp_int32_vec4_type()); - stride = lp_build_umul_overflow(gallivm, vb_stride, index, &ofbit); + /* This mul can overflow. Wraparound is ok. */ + stride = LLVMBuildMul(builder, vb_stride, index, ""); buffer_overflowed = LLVMBuildICmp(builder, LLVMIntUGE, stride, buffer_size_adj, "buffer_overflowed"); - buffer_overflowed = LLVMBuildOr(builder, buffer_overflowed, ofbit, ""); if (0) { lp_build_print_value(gallivm, " instance index = ", index); @@ -759,7 +758,7 @@ fetch_vector(struct gallivm_state *gallivm, LLVMValueRef zero = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context)); LLVMBuilderRef builder = gallivm->builder; struct lp_build_context blduivec; - LLVMValueRef offset, tmp, valid_mask; + LLVMValueRef offset, valid_mask; LLVMValueRef aos_fetch[LP_MAX_VECTOR_WIDTH / 32]; unsigned i; @@ -768,24 +767,11 @@ fetch_vector(struct gallivm_state *gallivm, vb_stride = lp_build_broadcast_scalar(&blduivec, vb_stride); buffer_size_adj = lp_build_broadcast_scalar(&blduivec, buffer_size_adj); - /* -* Sort of interestingly, with interleaved attribs, llvm 3.7+ will -* recognize these calculations to be constant with different attribs -* (the different offset has been added to map_ptr). -* llvm 3.3, however, will not (I can't get llvm 3.4-3.6 to link...) -* -* XXX: could actually avoid this altogether (replacing by simple -* non-widening mul) by precalculating the max index instead outside -* the loop (at the cost of one scalar udiv per vertex element). -*/ - offset = lp_build_mul_32_lohi_cpu(&blduivec, vb_stride, indices, &tmp); + /* This mul can overflow. Wraparound is ok. */ + offset = lp_build_mul(&blduivec, vb_stride, indices); valid_mask = lp_build_compare(gallivm, blduivec.type, - PIPE_FUNC_EQUAL, tmp, blduivec.zero); - - tmp = lp_build_compare(gallivm, blduivec.type, - PIPE_FUNC_LESS, offset, buffer_size_adj); - valid_mask = LLVMBuildAnd(builder, tmp, valid_mask, ""); + PIPE_FUNC_LESS, offset, buffer_size_adj); /* not valid elements use offset 0 */ offset = LLVMBuildAnd(builder, offset, valid_mask, ""); @@ -1566,10 +1552,10 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) LLVMBuilderRef builder; char func_name[64]; struct lp_type vs_type; - LLVMValueRef count, fetch_elts, start_or_maxelt, start; + LLVMValueRef count, fetch_elts, start_or_maxelt; LLVMValueRef vertex_id_offset, start_instance; LLVMValueRef stride, step, io_itr; - LLVMValueRef ind_vec, ind_vec_store, have_elts, fetch_max, tmp; + LLVMValueRef ind_vec, star
Mesa (master): draw: use same argument order for jit draw linear / elts functions
Module: Mesa Branch: master Commit: 8cf7edff7dda8c11a0843a168ad2756f0bd584be URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cf7edff7dda8c11a0843a168ad2756f0bd584be Author: Roland Scheidegger Date: Sun Nov 13 16:31:57 2016 +0100 draw: use same argument order for jit draw linear / elts functions This is a bit simpler. Mostly to make it easier to unify the paths later... Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c | 48 ++ src/gallium/auxiliary/draw/draw_llvm.h | 8 ++-- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 8 ++-- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 8aa2d11..a02c893 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1580,7 +1580,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, LLVMBuilderRef builder; char func_name[64]; struct lp_type vs_type; - LLVMValueRef count, fetch_elts, fetch_elt_max, fetch_count; + LLVMValueRef count, fetch_elts, fetch_elt_max; LLVMValueRef vertex_id_offset, start_instance, start; LLVMValueRef stride, step, io_itr; LLVMValueRef ind_vec; @@ -1631,17 +1631,16 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, arg_types[i++] = get_context_ptr_type(variant); /* context */ arg_types[i++] = get_vertex_header_ptr_type(variant); /* vertex_header */ arg_types[i++] = get_buffer_ptr_type(variant);/* vbuffers */ + arg_types[i++] = int32_type; /* count */ + arg_types[i++] = int32_type; /* start/fetch_elt_max */ + arg_types[i++] = int32_type; /* stride */ + arg_types[i++] = get_vb_ptr_type(variant);/* pipe_vertex_buffer's */ + arg_types[i++] = int32_type; /* instance_id */ + arg_types[i++] = int32_type; /* vertex_id_offset */ + arg_types[i++] = int32_type; /* start_instance */ if (elts) { - arg_types[i++] = LLVMPointerType(int32_type, 0);/* fetch_elts */ - arg_types[i++] = int32_type; /* fetch_elt_max */ - } else - arg_types[i++] = int32_type; /* start */ - arg_types[i++] = int32_type; /* fetch_count / count */ - arg_types[i++] = int32_type; /* stride */ - arg_types[i++] = get_vb_ptr_type(variant); /* pipe_vertex_buffer's */ - arg_types[i++] = int32_type; /* instance_id */ - arg_types[i++] = int32_type; /* vertex_id_offset */ - arg_types[i++] = int32_type; /* start_instance */ + arg_types[i++] = LLVMPointerType(int32_type, 0); /* fetch_elts */ + } func_type = LLVMFunctionType(LLVMInt8TypeInContext(context), arg_types, num_arg_types, 0); @@ -1661,21 +1660,23 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, context_ptr = LLVMGetParam(variant_func, 0); io_ptr= LLVMGetParam(variant_func, 1); vbuffers_ptr = LLVMGetParam(variant_func, 2); + count = LLVMGetParam(variant_func, 3); /* * XXX: stride is actually unused. The stride we use is strictly calculated * from the number of outputs (including the draw_extra outputs). * Should probably fix some day (we need a new vs just because of extra * outputs which the generated vs won't touch). */ - stride= LLVMGetParam(variant_func, 5 + (elts ? 1 : 0)); - vb_ptr= LLVMGetParam(variant_func, 6 + (elts ? 1 : 0)); - system_values.instance_id = LLVMGetParam(variant_func, 7 + (elts ? 1 : 0)); - vertex_id_offset = LLVMGetParam(variant_func, 8 + (elts ? 1 : 0)); - start_instance= LLVMGetParam(variant_func, 9 + (elts ? 1 : 0)); + stride= LLVMGetParam(variant_func, 5); + vb_ptr= LLVMGetParam(variant_func, 6); + system_values.instance_id = LLVMGetParam(variant_func, 7); + vertex_id_offset = LLVMGetParam(variant_func, 8); + start_instance= LLVMGetParam(variant_func, 9); lp_build_name(context_ptr, "context"); lp_build_name(io_ptr, "io"); lp_build_name(vbuffers_ptr, "vbuffers"); + lp_build_name(count, "count"); lp_build_name(stride, "stride"); lp_build_name(vb_ptr, "vb"); lp_build_name(system_values.instance_id, "instance_id"); @@ -1683,20 +1684,16 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, lp_build_name(start_instance, "start_instance"); if (elts) { - fetch_elts= LLVMGetParam(variant_func, 3); fetch_elt_max = LLVMGetParam(
Mesa (master): draw: simplify fetch some more
Module: Mesa Branch: master Commit: 2471aaa02fc2be0f5fea2df7c7ae6af3aab16b26 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2471aaa02fc2be0f5fea2df7c7ae6af3aab16b26 Author: Roland Scheidegger Date: Sun Nov 13 16:33:20 2016 +0100 draw: simplify fetch some more Don't keep the ofbit. This is just a minor simplification, just adjust the buffer size so that there will always be an overflow if buffers aren't valid to fetch from. Also, get rid of control flow from the instanced path too. Not worried about performance, but it's simpler and keeps the code more similar to ordinary fetch. Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c | 118 +++-- 1 file changed, 55 insertions(+), 63 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 2478b11..414f2dc 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -661,22 +661,23 @@ fetch_instanced(struct gallivm_state *gallivm, LLVMValueRef vb_stride, LLVMValueRef map_ptr, LLVMValueRef buffer_size_adj, -LLVMValueRef ofbit, LLVMValueRef *inputs, LLVMValueRef index) { - LLVMValueRef zero = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context)); + LLVMTypeRef i32_t = LLVMInt32TypeInContext(gallivm->context); + LLVMTypeRef aosf_t, aosi_t; + LLVMValueRef zero = LLVMConstNull(i32_t); LLVMBuilderRef builder = gallivm->builder; - LLVMValueRef stride, buffer_overflowed, aos; - LLVMValueRef temp_ptr = - lp_build_alloca(gallivm, - lp_build_vec_type(gallivm, lp_float32_vec4_type()), ""); - struct lp_build_if_state if_ctx; + LLVMValueRef stride, buffer_overflowed, aos, index_valid; + LLVMValueRef ofbit = NULL; unsigned i; + aosf_t = lp_build_vec_type(gallivm, lp_float32_vec4_type()); + aosi_t = lp_build_vec_type(gallivm, lp_int32_vec4_type()); + stride = lp_build_umul_overflow(gallivm, vb_stride, index, &ofbit); - buffer_overflowed = LLVMBuildICmp(builder, LLVMIntUGT, + buffer_overflowed = LLVMBuildICmp(builder, LLVMIntUGE, stride, buffer_size_adj, "buffer_overflowed"); buffer_overflowed = LLVMBuildOr(builder, buffer_overflowed, ofbit, ""); @@ -686,28 +687,22 @@ fetch_instanced(struct gallivm_state *gallivm, lp_build_print_value(gallivm, " buffer overflowed = ", buffer_overflowed); } - lp_build_if(&if_ctx, gallivm, buffer_overflowed); - { - LLVMValueRef val = - lp_build_const_vec(gallivm, lp_float32_vec4_type(), 0); - LLVMBuildStore(builder, val, temp_ptr); - } - lp_build_else(&if_ctx); - { - LLVMValueRef val; - - val = lp_build_fetch_rgba_aos(gallivm, -format_desc, -lp_float32_vec4_type(), -FALSE, -map_ptr, -stride, zero, zero, -NULL); - LLVMBuildStore(builder, val, temp_ptr); - } - lp_build_endif(&if_ctx); + index_valid = LLVMBuildNot(builder, buffer_overflowed, ""); + index_valid = LLVMBuildSExt(builder, index_valid, i32_t, ""); + stride = LLVMBuildAnd(builder, stride, index_valid, ""); - aos = LLVMBuildLoad(builder, temp_ptr, "aos"); + aos = lp_build_fetch_rgba_aos(gallivm, + format_desc, + lp_float32_vec4_type(), + FALSE, + map_ptr, + stride, zero, zero, + NULL); + + index_valid = lp_build_broadcast(gallivm, aosi_t, index_valid); + aos = LLVMBuildBitCast(builder, aos, aosi_t, ""); + aos = LLVMBuildAnd(builder, aos, index_valid, ""); + aos = LLVMBuildBitCast(builder, aos, aosf_t, ""); for (i = 0; i < TGSI_NUM_CHANNELS; i++) { LLVMValueRef index = lp_build_const_int32(gallivm, i); @@ -758,7 +753,6 @@ fetch_vector(struct gallivm_state *gallivm, LLVMValueRef vb_stride, LLVMValueRef map_ptr, LLVMValueRef buffer_size_adj, - LLVMValueRef ofmask, LLVMValueRef *inputs, LLVMValueRef indices) { @@ -786,12 +780,11 @@ fetch_vector(struct gallivm_state *gallivm, */ offset = lp_build_mul_32_lohi_cpu(&blduivec, vb_stride, indices, &tmp); - tmp = lp_build_compare(gallivm, blduivec.type, - PIPE_FUNC_EQUAL, tmp, blduivec.zero); - valid_mask = lp_build_andnot(&blduivec, tmp, ofmask); + valid_mask = lp_build_compare(gallivm, blduivec.type, + PIPE_FUNC_EQUAL, tmp, blduivec.zero); tmp = lp_build_compare(gallivm, blduivec.type, -
Mesa (master): draw: unify linear and elts draw jit functions
Module: Mesa Branch: master Commit: 4e1be31f01e279c35de09333fc3e3a1e72fad599 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e1be31f01e279c35de09333fc3e3a1e72fad599 Author: Roland Scheidegger Date: Sun Nov 13 16:32:24 2016 +0100 draw: unify linear and elts draw jit functions The code for elts and linear paths was nearly 100% identical by now - with the elts path simply having some additional gather for the elements in the main loop (with some additional small differences before the main loop). Hence nuke the separate functions and decide this at jit shader execution time (simply based on the presence of the elts pointer). Some analysis shows that the generated vs jit functions seem to be just very minimally more complex than the former elts functions, and almost none of the additional complexity is in the main loop (basically just the branch logic for the branch fetching the actual indices). Compared to linear, the codesize of the function is of course a bit larger, however the actual executed code in the main loop appears to be near 100% identical (the additional code looking up indices is skipped as expected). So, I would not expect a (meaningful) performance difference with the generated code, neither with elts nor linear, this does however roughly half the compilation time (the compiled shaders should also use only half the memory of course). Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c | 92 +++--- src/gallium/auxiliary/draw/draw_llvm.h | 21 + .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 46 +-- 3 files changed, 70 insertions(+), 89 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index a02c893..2478b11 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -63,8 +63,7 @@ static void -draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *var, - boolean elts); +draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *var); struct draw_gs_llvm_iface { @@ -577,17 +576,13 @@ draw_llvm_create_variant(struct draw_llvm *llvm, variant->vertex_header_ptr_type = LLVMPointerType(vertex_header, 0); - draw_llvm_generate(llvm, variant, FALSE); /* linear */ - draw_llvm_generate(llvm, variant, TRUE); /* elts */ + draw_llvm_generate(llvm, variant); gallivm_compile_module(variant->gallivm); variant->jit_func = (draw_jit_vert_func) gallivm_jit_function(variant->gallivm, variant->function); - variant->jit_func_elts = (draw_jit_vert_func_elts) - gallivm_jit_function(variant->gallivm, variant->function_elts); - gallivm_free_ir(variant->gallivm); variant->list_item_global.base = variant; @@ -1565,25 +1560,23 @@ draw_gs_llvm_epilogue(const struct lp_build_tgsi_gs_iface *gs_base, } static void -draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, - boolean elts) +draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) { struct gallivm_state *gallivm = variant->gallivm; LLVMContextRef context = gallivm->context; LLVMTypeRef int32_type = LLVMInt32TypeInContext(context); LLVMTypeRef arg_types[11]; - unsigned num_arg_types = - elts ? ARRAY_SIZE(arg_types) : ARRAY_SIZE(arg_types) - 1; + unsigned num_arg_types = ARRAY_SIZE(arg_types); LLVMTypeRef func_type; LLVMValueRef context_ptr; LLVMBasicBlockRef block; LLVMBuilderRef builder; char func_name[64]; struct lp_type vs_type; - LLVMValueRef count, fetch_elts, fetch_elt_max; - LLVMValueRef vertex_id_offset, start_instance, start; + LLVMValueRef count, fetch_elts, start_or_maxelt, start; + LLVMValueRef vertex_id_offset, start_instance; LLVMValueRef stride, step, io_itr; - LLVMValueRef ind_vec; + LLVMValueRef ind_vec, ind_vec_store, have_elts, fetch_max, tmp; LLVMValueRef io_ptr, vbuffers_ptr, vb_ptr; LLVMValueRef vb_stride[PIPE_MAX_ATTRIBS]; LLVMValueRef map_ptr[PIPE_MAX_ATTRIBS]; @@ -1597,9 +1590,9 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, unsigned i, j; struct lp_build_context bld, bldivec, blduivec; struct lp_build_loop_state lp_loop; + struct lp_build_if_state if_ctx; const int vector_length = lp_native_vector_width / 32; LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][TGSI_NUM_CHANNELS]; - LLVMValueRef fetch_max; struct lp_build_sampler_soa *sampler = 0; LLVMValueRef ret, clipmask_bool_ptr; struct draw_llvm_variant_key *key = &variant->key; @@ -1624,8 +1617,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, memset(&system_values, 0, sizeof(system_values)); - util_snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u_%s", - variant->shader->variants_cached, elts ? "elts" :
Mesa (master): draw: drop unnecessary index overflow handling from vsplit code
Module: Mesa Branch: master Commit: 78a997f72841310620d18daa9015633343d04db1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=78a997f72841310620d18daa9015633343d04db1 Author: Roland Scheidegger Date: Sun Nov 13 17:17:25 2016 +0100 draw: drop unnecessary index overflow handling from vsplit code This was kind of strange, since it replaced indices which were only overflowing due to bias with MAX_UINT. This would cause an overflow later in the shader, except if stride was 0, however the vertex id would be essentially random then (-1 + eltBias). No test cared about it, though. So, drop this and just use ordinary int arithmetic wraparound as usual. This is much simpler to understand and the results are "more correct" or at least more consistent (vertex id as well as actual fetch results just correspond to wrapped around arithmetic). There's only one catch, it is now possible to hit the cache initialization value also with ushort and ubyte elts path (this wouldn't be an issue if we'd simply handle the eltBias itself later in the shader). Hence, we need to make sure the cache logic doesn't think this element has already been emitted when it has not (I believe some seriously bad things could happen otherwise). So, borrow the logic which handled this from the uint case, but not before fixing it up... Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_pt_vsplit.c | 69 ++--- src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 15 +- 2 files changed, 28 insertions(+), 56 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit.c b/src/gallium/auxiliary/draw/draw_pt_vsplit.c index fb131c3..a68d5bf 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit.c +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit.c @@ -85,7 +85,7 @@ vsplit_flush_cache(struct vsplit_frontend *vsplit, unsigned flags) * Add a fetch element and add it to the draw elements. */ static inline void -vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch, unsigned ofbias) +vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch) { unsigned hash; @@ -93,7 +93,7 @@ vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch, unsigned ofbias /* If the value isn't in the cache or it's an overflow due to the * element bias */ - if (vsplit->cache.fetches[hash] != fetch || ofbias) { + if (vsplit->cache.fetches[hash] != fetch) { /* update cache */ vsplit->cache.fetches[hash] = fetch; vsplit->cache.draws[hash] = vsplit->cache.num_fetch_elts; @@ -108,7 +108,7 @@ vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch, unsigned ofbias /** * Returns the base index to the elements array. - * The value is checked for integer overflow. + * The value is checked for integer overflow (not sure it can happen?). */ static inline unsigned vsplit_get_base_idx(unsigned start, unsigned fetch) @@ -116,39 +116,14 @@ vsplit_get_base_idx(unsigned start, unsigned fetch) return draw_overflow_uadd(start, fetch, MAX_ELT_IDX); } -/** - * Returns the element index adjust for the element bias. - * The final element index is created from the actual element - * index, plus the element bias, clamped to maximum element - * index if that addition overflows. +/* + * The final element index is just element index plus element bias. */ -static inline unsigned -vsplit_get_bias_idx(int idx, int bias, unsigned *ofbias) -{ - int res = idx + bias; - - *ofbias = 0; - - if (idx > 0 && bias > 0) { - if (res < idx) { - res = DRAW_MAX_FETCH_IDX; - *ofbias = 1; - } - } else if (idx < 0 && bias < 0) { - if (res > idx) { - res = DRAW_MAX_FETCH_IDX; - *ofbias = 1; - } - } - - return res; -} - #define VSPLIT_CREATE_IDX(elts, start, fetch, elt_bias)\ unsigned elt_idx; \ - unsigned ofbias;\ - elt_idx = vsplit_get_base_idx(start, fetch);\ - elt_idx = vsplit_get_bias_idx(DRAW_GET_IDX(elts, elt_idx), elt_bias, &ofbias) + elt_idx = vsplit_get_base_idx(start, fetch);\ + elt_idx = (unsigned)((int)(DRAW_GET_IDX(elts, elt_idx)) + (int)elt_bias); + static inline void vsplit_add_cache_ubyte(struct vsplit_frontend *vsplit, const ubyte *elts, @@ -156,7 +131,13 @@ vsplit_add_cache_ubyte(struct vsplit_frontend *vsplit, const ubyte *elts, { struct draw_context *draw = vsplit->draw; VSPLIT_CREATE_IDX(elts, start, fetch, elt_bias); - vsplit_add_cache(vsplit, elt_idx, ofbias); + /* unlike the uint case this can only happen with elt_bias */ + if (elt_bias && elt_idx == DRAW_MAX_FETCH_IDX && !vsplit->cache.has_max_fetch) { + unsigned hash = fetch % MAP_SIZE; + vsplit->cache.fetches[hash] = 0; + vsplit->cache.has_max_fetch = TRUE; + } + vsplit_add_cache(vsplit, elt_idx); } static inline void @@ -165,7 +146,13 @@ vsplit_add_cache_ushort(struct vsplit_fron
Mesa (master): draw: simplify vsplit elts code a bit
Module: Mesa Branch: master Commit: 7a55c436c64a8bb031c8823522cde8f3adc67d89 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a55c436c64a8bb031c8823522cde8f3adc67d89 Author: Roland Scheidegger Date: Sat Nov 12 22:47:22 2016 +0100 draw: simplify vsplit elts code a bit vsplit_get_base_idx explicitly returned idx 0 and set the ofbit in case of overflow. We'd then check the ofbit and use idx 0 instead of looking it up. This was necessary because DRAW_GET_IDX used to return DRAW_MAX_FETCH_IDX and not 0 in case of overflows. However, this is all unnecessary, we can just let DRAW_GET_IDX return 0 in case of overflow. In fact before bbd1e60198548a12be3405fc32dd39a87e8968ab the code already did that, not sure why this particular bit was changed (might have been one half of an attempt to get these indices to actual draw shader execution - in fact I think this would make things less awkward, it would require moving the eltBias handling to the shader as well). Note there's other callers of DRAW_GET_IDX - those code paths however explicitly do not handle index buffer overflows, therefore the overflow value doesn't matter for them. Also do some trivial simplification - for (unsigned) a + b, checking res < a is sufficient for overflow detection, we don't need to check for res < b too (similar for signed). And an index buffer overflow check looked bogus - eltMax is the number of elements in the index buffer, not the maximum element which can be fetched. (Drop the start check against the idx buffer though, this is already covered by end check and end < start). Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_private.h | 7 ++-- src/gallium/auxiliary/draw/draw_pt_vsplit.c | 46 +++-- src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 5 ++- 3 files changed, 18 insertions(+), 40 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index a6aa610..030bb2c 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -489,11 +489,10 @@ void draw_update_viewport_flags(struct draw_context *draw); /** * Return index i from the index buffer. - * If the index buffer would overflow we return the - * maximum possible index. + * If the index buffer would overflow we return index 0. */ #define DRAW_GET_IDX(_elts, _i) \ - (((_i) >= draw->pt.user.eltMax) ? DRAW_MAX_FETCH_IDX : (_elts)[_i]) + (((_i) >= draw->pt.user.eltMax) ? 0 : (_elts)[_i]) /** * Return index of the given viewport clamping it @@ -515,7 +514,7 @@ draw_overflow_uadd(unsigned a, unsigned b, unsigned overflow_value) { unsigned res = a + b; - if (res < a || res < b) { + if (res < a) { res = overflow_value; } return res; diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit.c b/src/gallium/auxiliary/draw/draw_pt_vsplit.c index 8d448f9..fb131c3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit.c +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit.c @@ -33,7 +33,7 @@ #define SEGMENT_SIZE 1024 #define MAP_SIZE 256 -/* The largest possible index withing an index buffer */ +/* The largest possible index within an index buffer */ #define MAX_ELT_IDX 0x struct vsplit_frontend { @@ -108,55 +108,36 @@ vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch, unsigned ofbias /** * Returns the base index to the elements array. - * The value is checked for overflows (both integer overflows - * and the elements array overflow). + * The value is checked for integer overflow. */ static inline unsigned -vsplit_get_base_idx(struct vsplit_frontend *vsplit, -unsigned start, unsigned fetch, unsigned *ofbit) +vsplit_get_base_idx(unsigned start, unsigned fetch) { - struct draw_context *draw = vsplit->draw; - unsigned elt_idx = draw_overflow_uadd(start, fetch, MAX_ELT_IDX); - if (ofbit) - *ofbit = 0; - - /* Overflown indices need to wrap to the first element -* in the index buffer */ - if (elt_idx >= draw->pt.user.eltMax) { - if (ofbit) - *ofbit = 1; - elt_idx = 0; - } - - return elt_idx; + return draw_overflow_uadd(start, fetch, MAX_ELT_IDX); } /** * Returns the element index adjust for the element bias. * The final element index is created from the actual element - * index, plus the element bias, clamped to maximum elememt + * index, plus the element bias, clamped to maximum element * index if that addition overflows. */ static inline unsigned -vsplit_get_bias_idx(struct vsplit_frontend *vsplit, -int idx, int bias, unsigned *ofbias) +vsplit_get_bias_idx(int idx, int bias, unsigned *ofbias) { int res = idx + bias; - if (ofbias) - *ofbias = 0; + *ofbias = 0; if (idx > 0 && bias > 0) { - if (res < idx || res < bias) { + if (res < idx) { res = DRAW_MAX_FETCH_IDX; - if (o
Mesa (master): scons: add llvm 3.9 support.
Module: Mesa Branch: master Commit: 30ae2cbf82c3e40450b20b5c6cd67e87330ce300 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=30ae2cbf82c3e40450b20b5c6cd67e87330ce300 Author: George Kyriazis Date: Wed Nov 9 16:35:48 2016 -0600 scons: add llvm 3.9 support. v2: reworded commit message Reviewed-by: Emil Velikov --- scons/llvm.py | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/scons/llvm.py b/scons/llvm.py index 1fc8a3f..977e47a 100644 --- a/scons/llvm.py +++ b/scons/llvm.py @@ -106,7 +106,24 @@ def generate(env): ]) env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')]) # LIBS should match the output of `llvm-config --libs engine mcjit bitwriter x86asmprinter` -if llvm_version >= distutils.version.LooseVersion('3.7'): +if llvm_version >= distutils.version.LooseVersion('3.9'): +env.Prepend(LIBS = [ +'LLVMX86Disassembler', 'LLVMX86AsmParser', +'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter', +'LLVMDebugInfoCodeView', 'LLVMCodeGen', +'LLVMScalarOpts', 'LLVMInstCombine', +'LLVMInstrumentation', 'LLVMTransformUtils', +'LLVMBitWriter', 'LLVMX86Desc', +'LLVMMCDisassembler', 'LLVMX86Info', +'LLVMX86AsmPrinter', 'LLVMX86Utils', +'LLVMMCJIT', 'LLVMExecutionEngine', 'LLVMTarget', +'LLVMAnalysis', 'LLVMProfileData', +'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser', +'LLVMBitReader', 'LLVMMC', 'LLVMCore', +'LLVMSupport', +'LLVMIRReader', 'LLVMASMParser' +]) +elif llvm_version >= distutils.version.LooseVersion('3.7'): env.Prepend(LIBS = [ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter', @@ -203,7 +220,7 @@ def generate(env): if '-fno-rtti' in cxxflags: env.Append(CXXFLAGS = ['-fno-rtti']) -components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler'] +components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler', 'irreader'] env.ParseConfig('llvm-config --libs ' + ' '.join(components)) env.ParseConfig('llvm-config --ldflags') ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: Handle windows.h and NOMINMAX
Module: Mesa Branch: master Commit: 974d280e815727f84e799cf69058630b954dec7e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=974d280e815727f84e799cf69058630b954dec7e Author: George Kyriazis Date: Fri Nov 11 11:44:05 2016 -0600 swr: Handle windows.h and NOMINMAX Reorder header files so that we have a chance to defined NOMINMAX before mesa include files include windows.h v3: split from bigger patch Reviewed-by: Emil Velikov --- src/gallium/drivers/swr/swr_context.cpp | 16 src/gallium/drivers/swr/swr_context.h | 2 ++ src/gallium/drivers/swr/swr_screen.cpp | 25 +++-- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp index a5ab236..3f57712 100644 --- a/src/gallium/drivers/swr/swr_context.cpp +++ b/src/gallium/drivers/swr/swr_context.cpp @@ -21,6 +21,14 @@ * IN THE SOFTWARE. ***/ +#include "swr_context.h" +#include "swr_memory.h" +#include "swr_screen.h" +#include "swr_resource.h" +#include "swr_scratch.h" +#include "swr_query.h" +#include "swr_fence.h" + #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/u_format.h" @@ -31,14 +39,6 @@ extern "C" { #include "util/u_surface.h" } -#include "swr_context.h" -#include "swr_memory.h" -#include "swr_screen.h" -#include "swr_resource.h" -#include "swr_scratch.h" -#include "swr_query.h" -#include "swr_fence.h" - #include "api.h" #include "backend.h" diff --git a/src/gallium/drivers/swr/swr_context.h b/src/gallium/drivers/swr/swr_context.h index eecfe0d..04e11fe 100644 --- a/src/gallium/drivers/swr/swr_context.h +++ b/src/gallium/drivers/swr/swr_context.h @@ -24,6 +24,8 @@ #ifndef SWR_CONTEXT_H #define SWR_CONTEXT_H +#include "common/os.h" + #include "pipe/p_context.h" #include "pipe/p_state.h" #include "util/u_blitter.h" diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index 0c8f5db..cc79f28 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -21,6 +21,13 @@ * IN THE SOFTWARE. ***/ +#include "swr_context.h" +#include "swr_public.h" +#include "swr_screen.h" +#include "swr_resource.h" +#include "swr_fence.h" +#include "gen_knobs.h" + #include "pipe/p_screen.h" #include "pipe/p_defines.h" #include "util/u_memory.h" @@ -35,13 +42,6 @@ extern "C" { #include "gallivm/lp_bld_limits.h" } -#include "swr_public.h" -#include "swr_screen.h" -#include "swr_context.h" -#include "swr_resource.h" -#include "swr_fence.h" -#include "gen_knobs.h" - #include "jit_api.h" #include @@ -1023,14 +1023,3 @@ swr_create_screen(struct sw_winsys *winsys) return &screen->base; } -struct sw_winsys * -swr_get_winsys(struct pipe_screen *pipe) -{ - return ((struct swr_screen *)pipe)->winsys; -} - -struct sw_displaytarget * -swr_get_displaytarget(struct pipe_resource *resource) -{ - return ((struct swr_resource *)resource)->display_target; -} ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: swr: Added swr build for windows
Module: Mesa Branch: master Commit: 5b4d1500dd3cc43c1d0fc2f83744144fb1742aa9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b4d1500dd3cc43c1d0fc2f83744144fb1742aa9 Author: George Kyriazis Date: Fri Nov 18 11:40:09 2016 -0600 gallium: swr: Added swr build for windows v4: Add windows-specific gen_knobs.{cpp|h} changes v5: remove aggresive squashing of gen_knobs.py to this commit; added SConscript to EXTRA_DIST in Makefile.am Reviewed-by: Emil Velikov --- src/gallium/SConscript | 1 + src/gallium/drivers/swr/Makefile.am | 1 + src/gallium/drivers/swr/SConscript | 216 3 files changed, 218 insertions(+) diff --git a/src/gallium/SConscript b/src/gallium/SConscript index f98268f..9273db7 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -18,6 +18,7 @@ SConscript([ 'drivers/softpipe/SConscript', 'drivers/svga/SConscript', 'drivers/trace/SConscript', +'drivers/swr/SConscript', ]) # diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index 4cd1c33..b22ded0 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -245,6 +245,7 @@ libswrAVX2_la_LDFLAGS = \ include $(top_srcdir)/install-gallium-links.mk EXTRA_DIST = \ + SConscript \ rasterizer/archrast/events.proto \ rasterizer/jitter/scripts/gen_llvm_ir_macros.py \ rasterizer/jitter/scripts/gen_llvm_types.py \ diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript new file mode 100644 index 000..0de51a7 --- /dev/null +++ b/src/gallium/drivers/swr/SConscript @@ -0,0 +1,216 @@ +Import('*') + +from sys import executable as python_cmd +import os.path +import distutils.version + +if not env['swr']: +Return() + +if not env['llvm']: +print 'warning: LLVM disabled: not building swr' +env['swr'] = False +Return() + +if env['LLVM_VERSION'] < distutils.version.LooseVersion('3.9'): +print "warning: swr requires LLVM >= 3.9: not building swr" +env['swr'] = False +Return() + +if env['platform'] != 'windows': +print "warning: swr scons build only supports windows: not building swr" +env['swr'] = False +Return() + +env.MSVC2013Compat() + +env = env.Clone() + +# construct llvm include dir +if env['platform'] == 'windows': +# on windows there is no llvm-config, so LLVM is defined +llvm_includedir = os.path.join(os.environ['LLVM'], 'include') +else: +llvm_includedir = env.backtick('llvm-config --includedir').rstrip() +print "llvm include dir %s" % llvm_includedir + +# the loader is included in the mesa lib itself +# All the remaining files are in loadable modules +loadersource = env.ParseSourceList('Makefile.sources', [ +'LOADER_SOURCES' +]) + +env.Append(CPPDEFINES = [ +'__STDC_CONSTANT_MACROS', +'__STDC_LIMIT_MACROS' +]) + +if not env['msvc'] : +env.Append(CCFLAGS = [ +'-std=c++11', +]) + +swrroot = '#src/gallium/drivers/swr/' + +env.CodeGenerate( +target = 'rasterizer/scripts/gen_knobs.cpp', +script = swrroot + 'rasterizer/scripts/gen_knobs.py', +source = 'rasterizer/scripts/templates/knobs.template', +command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_cpp' +) + +env.CodeGenerate( +target = 'rasterizer/scripts/gen_knobs.h', +script = swrroot + 'rasterizer/scripts/gen_knobs.py', +source = 'rasterizer/scripts/templates/knobs.template', +command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_h' +) + +env.CodeGenerate( +target = 'rasterizer/jitter/state_llvm.h', +script = swrroot + 'rasterizer/jitter/scripts/gen_llvm_types.py', +source = 'rasterizer/core/state.h', +command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET' +) + +env.CodeGenerate( +target = 'rasterizer/jitter/builder_gen.h', +script = swrroot + 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py', +source = os.path.join(llvm_includedir, 'llvm/IR/IRBuilder.h'), +command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_h' +) + +env.CodeGenerate( +target = 'rasterizer/jitter/builder_gen.cpp', +script = swrroot + 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py', +source = os.path.join(llvm_includedir, 'llvm/IR/IRBuilder.h'), +command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_cpp' +) + +env.CodeGenerate( +target = 'rasterizer/jitter/builder_x86.h', +script = swrroot + 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py', +source = '', +command = python_cmd + ' $SCRIPT --output $TARGET --gen_x86_h' +) + +env.CodeGenerate( +target = 'rasterizer/jitter/builder_x86.cpp', +script = swrroot + 'rasterizer/jitter/scripts/gen_llvm_ir_macros.py', +source = '', +command = python_cmd + ' $SCRIPT --output $TARGET --gen_x86_cpp' +) + +env.CodeGenerate( +target = 'swr_context_llvm.h', +script = swrroo
Mesa (master): gallium: Added SWR support for gdi
Module: Mesa Branch: master Commit: 915b4b0d494ad9705a7be59baec9e11a5576503a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=915b4b0d494ad9705a7be59baec9e11a5576503a Author: George Kyriazis Date: Wed Nov 9 16:40:58 2016 -0600 gallium: Added SWR support for gdi Added hooks for screen creation and swap. Still keep llvmpipe the default software renderer. v2: split from bigger patch v3: reword commit message Reviewed-by: Emil Velikov --- src/gallium/targets/libgl-gdi/libgl_gdi.c | 28 +++- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gallium/targets/libgl-gdi/libgl_gdi.c b/src/gallium/targets/libgl-gdi/libgl_gdi.c index 922c186..12576db 100644 --- a/src/gallium/targets/libgl-gdi/libgl_gdi.c +++ b/src/gallium/targets/libgl-gdi/libgl_gdi.c @@ -51,9 +51,12 @@ #include "llvmpipe/lp_public.h" #endif +#ifdef HAVE_SWR +#include "swr/swr_public.h" +#endif static boolean use_llvmpipe = FALSE; - +static boolean use_swr = FALSE; static struct pipe_screen * gdi_screen_create(void) @@ -69,6 +72,8 @@ gdi_screen_create(void) #ifdef HAVE_LLVMPIPE default_driver = "llvmpipe"; +#elif HAVE_SWR + default_driver = "swr"; #else default_driver = "softpipe"; #endif @@ -78,15 +83,21 @@ gdi_screen_create(void) #ifdef HAVE_LLVMPIPE if (strcmp(driver, "llvmpipe") == 0) { screen = llvmpipe_create_screen( winsys ); + if (screen) + use_llvmpipe = TRUE; + } +#endif +#ifdef HAVE_SWR + if (strcmp(driver, "swr") == 0) { + screen = swr_create_screen( winsys ); + if (screen) + use_swr = TRUE; } -#else - (void) driver; #endif + (void) driver; if (screen == NULL) { screen = softpipe_create_screen( winsys ); - } else { - use_llvmpipe = TRUE; } if(!screen) @@ -128,6 +139,13 @@ gdi_present(struct pipe_screen *screen, } #endif +#ifdef HAVE_SWR + if (use_swr) { + swr_gdi_swap(screen, res, hDC); + return; + } +#endif + winsys = softpipe_screen(screen)->winsys, dt = softpipe_resource(res)->dt, gdi_sw_display(winsys, dt, hDC); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): scons: Add swr compile option
Module: Mesa Branch: master Commit: 9085f1a9ccdfdfbdd470c871335edf360cf56c58 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9085f1a9ccdfdfbdd470c871335edf360cf56c58 Author: George Kyriazis Date: Tue Nov 15 18:52:39 2016 -0600 scons: Add swr compile option To buils The SWR driver (currently optional, not compiled by default) v3: add option as opposed to target Reviewed-by: Emil Velikov --- common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/common.py b/common.py index fb0884e..704ad2e 100644 --- a/common.py +++ b/common.py @@ -110,5 +110,6 @@ def AddOptions(opts): opts.Add(BoolOption('texture_float', 'enable floating-point textures and renderbuffers', 'no')) +opts.Add(BoolOption('swr', 'Build OpenSWR', 'no')) if host_platform == 'windows': opts.Add('MSVC_VERSION', 'Microsoft Visual C/C++ version') ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: renamed duplicate swr_create_screen()
Module: Mesa Branch: master Commit: 87bd28210f2b314978989fdcecedc596d17ac856 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=87bd28210f2b314978989fdcecedc596d17ac856 Author: George Kyriazis Date: Thu Nov 17 16:21:12 2016 -0600 swr: renamed duplicate swr_create_screen() There are 2 swr_create_screen() functions. One in swr_loader.cpp, which is used during driver init, and the other is hiding in swr_screen.cpp, which ends up in the arch-specific .dll/.so. Rename the second one to swr_create_screen_internal(), to avoid confusion in header files. Reviewed-by: Emil Velikov --- src/gallium/drivers/swr/swr_loader.cpp | 2 +- src/gallium/drivers/swr/swr_public.h | 4 src/gallium/drivers/swr/swr_screen.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp index 2113c37..9d79fa5 100644 --- a/src/gallium/drivers/swr/swr_loader.cpp +++ b/src/gallium/drivers/swr/swr_loader.cpp @@ -54,7 +54,7 @@ swr_create_screen(struct sw_winsys *winsys) exit(-1); } - util_dl_proc pScreenProc = util_dl_get_proc_address(pLibrary, "swr_create_screen"); + util_dl_proc pScreenProc = util_dl_get_proc_address(pLibrary, "swr_create_screen_internal"); if (!pScreenProc) { fprintf(stderr, "SWR library search failure: %s\n", util_dl_error()); diff --git a/src/gallium/drivers/swr/swr_public.h b/src/gallium/drivers/swr/swr_public.h index 0814c3b..7ef81bf 100644 --- a/src/gallium/drivers/swr/swr_public.h +++ b/src/gallium/drivers/swr/swr_public.h @@ -32,8 +32,12 @@ struct sw_displaytarget; extern "C" { #endif +// driver entry point struct pipe_screen *swr_create_screen(struct sw_winsys *winsys); +// arch-specific dll entry point +PUBLIC struct pipe_screen *swr_create_screen_internal(struct sw_winsys *winsys); + struct sw_winsys *swr_get_winsys(struct pipe_screen *pipe); struct sw_displaytarget *swr_get_displaytarget(struct pipe_resource *resource); diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index cc79f28..8a85128 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -986,7 +986,7 @@ swr_destroy_screen(struct pipe_screen *p_screen) PUBLIC struct pipe_screen * -swr_create_screen(struct sw_winsys *winsys) +swr_create_screen_internal(struct sw_winsys *winsys) { struct swr_screen *screen = CALLOC_STRUCT(swr_screen); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): scons: ignore .hpp files in parse_source_list()
Module: Mesa Branch: master Commit: 2da28dbd11e835ddc17e7656087b6f84c6f950ba URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2da28dbd11e835ddc17e7656087b6f84c6f950ba Author: George Kyriazis Date: Wed Nov 9 16:33:10 2016 -0600 scons: ignore .hpp files in parse_source_list() Drivers that contain C++ .hpp files need to ignore them too, along with .h files, when building source file lists. Reviewed-by: Emil Velikov --- scons/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scons/custom.py b/scons/custom.py index bdb4039..544b15d 100644 --- a/scons/custom.py +++ b/scons/custom.py @@ -281,7 +281,7 @@ def parse_source_list(env, filename, names=None): # cause duplicate actions. f = f[len(cur_srcdir + '/'):] # do not include any headers -if f.endswith('.h'): +if f.endswith(tuple(['.h','.hpp'])): continue srcs.append(f) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: Add support for SWR compilation
Module: Mesa Branch: master Commit: 9aae167e9474b7c220cbc3f172a27c0b6bf9b20a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9aae167e9474b7c220cbc3f172a27c0b6bf9b20a Author: George Kyriazis Date: Fri Nov 11 12:09:36 2016 -0600 gallium: Add support for SWR compilation Include swr library and include -DHAVE_SWR in the compile line. v3: split to a separate commit Reviewed-by: Emil Velikov --- src/gallium/targets/libgl-gdi/SConscript | 4 src/gallium/targets/libgl-xlib/SConscript | 4 src/gallium/targets/osmesa/SConscript | 4 3 files changed, 12 insertions(+) diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript index 2a52363..d3251ca 100644 --- a/src/gallium/targets/libgl-gdi/SConscript +++ b/src/gallium/targets/libgl-gdi/SConscript @@ -30,6 +30,10 @@ if env['llvm']: env.Append(CPPDEFINES = 'HAVE_LLVMPIPE') drivers += [llvmpipe] +if env['swr']: +env.Append(CPPDEFINES = 'HAVE_SWR') +drivers += [swr] + if env['gcc'] and env['machine'] != 'x86_64': # DEF parser in certain versions of MinGW is busted, as does not behave as # MSVC. mingw-w64 works fine. diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index 0a4f31b..d01bb3c 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -48,6 +48,10 @@ if env['llvm']: env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE']) env.Prepend(LIBS = [llvmpipe]) +if env['swr']: +env.Append(CPPDEFINES = 'HAVE_SWR') +env.Prepend(LIBS = [swr]) + if env['platform'] != 'darwin': # Disallow undefined symbols, except with Address Sanitizer, since libasan # is not linked on shared libs, as it should be LD_PRELOAD'ed instead diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targets/osmesa/SConscript index 7a2a00c..47937a2 100644 --- a/src/gallium/targets/osmesa/SConscript +++ b/src/gallium/targets/osmesa/SConscript @@ -30,6 +30,10 @@ if env['llvm']: env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') env.Prepend(LIBS = [llvmpipe]) +if env['swr']: +env.Append(CPPDEFINES = 'HAVE_SWR') +env.Prepend(LIBS = [swr]) + if env['platform'] == 'windows': if env['gcc'] and env['machine'] != 'x86_64': sources += ['osmesa.mingw.def'] ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: Modify gen_knobs.{cpp|h} creation script
Module: Mesa Branch: master Commit: 9e4e1f519084346b08b26b4ded635d44711e8014 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e4e1f519084346b08b26b4ded635d44711e8014 Author: George Kyriazis Date: Fri Nov 18 11:38:30 2016 -0600 swr: Modify gen_knobs.{cpp|h} creation script Modify gen_knobs.py so that each invocation creates a single generated file. This is more similar to how the other generators behave. v5: remove Scoscript edits from this commit; moved to commit that first adds SConscript Acked-by: Emil Velikov --- src/gallium/drivers/swr/Makefile.am| 14 +- .../drivers/swr/rasterizer/scripts/gen_knobs.py| 51 -- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index dd1c2e6..4cd1c33 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -71,11 +71,21 @@ swr_context_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py swr_context.h --input $(srcdir)/swr_context.h \ --output swr_context_llvm.h -rasterizer/scripts/gen_knobs.cpp rasterizer/scripts/gen_knobs.h: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template +rasterizer/scripts/gen_knobs.cpp: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/scripts/gen_knobs.py \ - rasterizer/scripts + --input $(srcdir)/rasterizer/scripts/templates/knobs.template \ + --output rasterizer/scripts/gen_knobs.cpp \ + --gen_cpp + +rasterizer/scripts/gen_knobs.h: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template + $(MKDIR_GEN) + $(PYTHON_GEN) \ + $(srcdir)/rasterizer/scripts/gen_knobs.py \ + --input $(srcdir)/rasterizer/scripts/templates/knobs.template \ + --output rasterizer/scripts/gen_knobs.h \ + --gen_h rasterizer/jitter/state_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py rasterizer/core/state.h $(MKDIR_GEN) diff --git a/src/gallium/drivers/swr/rasterizer/scripts/gen_knobs.py b/src/gallium/drivers/swr/rasterizer/scripts/gen_knobs.py index 3d003fb..225082e 100644 --- a/src/gallium/drivers/swr/rasterizer/scripts/gen_knobs.py +++ b/src/gallium/drivers/swr/rasterizer/scripts/gen_knobs.py @@ -23,13 +23,14 @@ from __future__ import print_function import os import sys +import argparse import knob_defs from mako.template import Template from mako.exceptions import RichTraceback def write_template_to_string(template_filename, **kwargs): try: -template = Template(filename=template_filename) +template = Template(filename=os.path.abspath(template_filename)) # Split + Join fixes line-endings for whatever platform you are using return '\n'.join(template.render(**kwargs).splitlines()) except: @@ -40,37 +41,39 @@ def write_template_to_string(template_filename, **kwargs): print("%s: %s" % (str(traceback.error.__class__.__name__), traceback.error)) def write_template_to_file(template_filename, output_filename, **kwargs): +output_dirname = os.path.dirname(output_filename) +if not os.path.exists(output_dirname): +os.makedirs(output_dirname) with open(output_filename, "w") as outfile: print(write_template_to_string(template_filename, **kwargs), file=outfile) def main(args=sys.argv[1:]): -if len(args) != 1: -print('Usage:', sys.argv[0], '', file=sys.stderr) -return 1 -output_dir = args[0] -if not os.path.isdir(output_dir): -if os.path.exists(output_dir): -print('ERROR: Invalid output directory:', output_dir, file=sys.stderr) -return 1 +# parse args +parser = argparse.ArgumentParser() +parser.add_argument("--input", "-i", help="Path to knobs.template", required=True) +parser.add_argument("--output", "-o", help="Path to output file", required=True) +parser.add_argument("--gen_h", "-gen_h", help="Generate gen_knobs.h", action="store_true", default=False) +parser.add_argument("--gen_cpp", "-gen_cpp", help="Generate gen_knobs.cpp", action="store_true", required=False) -try: -os.makedirs(output_dir) -except: -print('ERROR: Could not create output directory:', output_dir, file=sys.stderr) -return 1 +args = parser.parse_args() -# Output path exists, now just run the template -template_file = os.sep.join([sys.path[0], 'templates', 'knobs.template']) -output_file = os.sep.join([output_dir, 'gen_knobs.cpp']) -output_header = os.sep.join([output_dir, 'gen_knobs.h']) +if args.input: +if args.gen_h: +wr
Mesa (master): mesa: removed redundant #else
Module: Mesa Branch: master Commit: c32318073385dc461b91e407394e57fb76748da8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c32318073385dc461b91e407394e57fb76748da8 Author: George Kyriazis Date: Wed Nov 9 16:31:21 2016 -0600 mesa: removed redundant #else Reviewed-by: Emil Velikov --- src/util/macros.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/macros.h b/src/util/macros.h index 733bf42..6f55ac6 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -178,7 +178,6 @@ do { \ # elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) # if _MSC_VER >= 1800 # define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) -# else # endif # endif # ifndef HAS_TRIVIAL_DESTRUCTOR ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): swr: Windows-related changes
Module: Mesa Branch: master Commit: bc26e8d4a7c0ebfb84723ddc5ccd2834f434dc70 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc26e8d4a7c0ebfb84723ddc5ccd2834f434dc70 Author: George Kyriazis Date: Fri Nov 11 11:57:49 2016 -0600 swr: Windows-related changes - Handle dynamic library loading for windows - Implement swap for gdi - fix prototypes - update include paths on configure-based build for swr_loader.cpp v2: split to multiple patches v3: split and reshuffle some more; renamed title v4: move Makefile.am changes to other commit. Modify header files Reviewed-by: Emil Velikov --- src/gallium/drivers/swr/swr_loader.cpp | 27 --- src/gallium/drivers/swr/swr_public.h | 9 + 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp index 9d79fa5..4d71a67 100644 --- a/src/gallium/drivers/swr/swr_loader.cpp +++ b/src/gallium/drivers/swr/swr_loader.cpp @@ -25,14 +25,16 @@ #include "util/u_dl.h" #include "swr_public.h" +#include "pipe/p_screen.h" + #include -#include typedef pipe_screen *(*screen_create_proc)(struct sw_winsys *winsys); struct pipe_screen * swr_create_screen(struct sw_winsys *winsys) { + char filename[256]; fprintf(stderr, "SWR detected "); util_dl_library *pLibrary = nullptr; @@ -40,14 +42,15 @@ swr_create_screen(struct sw_winsys *winsys) util_cpu_detect(); if (util_cpu_caps.has_avx2) { fprintf(stderr, "AVX2\n"); - pLibrary = util_dl_open("libswrAVX2.so"); + sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX2", UTIL_DL_EXT); } else if (util_cpu_caps.has_avx) { fprintf(stderr, "AVX\n"); - pLibrary = util_dl_open("libswrAVX.so"); + sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX", UTIL_DL_EXT); } else { fprintf(stderr, "no AVX/AVX2 support. Aborting!\n"); exit(-1); } + pLibrary = util_dl_open(filename); if (!pLibrary) { fprintf(stderr, "SWR library load failure: %s\n", util_dl_error()); @@ -65,3 +68,21 @@ swr_create_screen(struct sw_winsys *winsys) return pScreenCreate(winsys); } + + +#ifdef _WIN32 +// swap function called from libl_gdi.c + +void +swr_gdi_swap(struct pipe_screen *screen, + struct pipe_resource *res, + void *hDC) +{ + screen->flush_frontbuffer(screen, + res, + 0, 0, + hDC, + NULL); +} + +#endif /* _WIN32 */ diff --git a/src/gallium/drivers/swr/swr_public.h b/src/gallium/drivers/swr/swr_public.h index 7ef81bf..4b15070 100644 --- a/src/gallium/drivers/swr/swr_public.h +++ b/src/gallium/drivers/swr/swr_public.h @@ -38,10 +38,11 @@ struct pipe_screen *swr_create_screen(struct sw_winsys *winsys); // arch-specific dll entry point PUBLIC struct pipe_screen *swr_create_screen_internal(struct sw_winsys *winsys); -struct sw_winsys *swr_get_winsys(struct pipe_screen *pipe); - -struct sw_displaytarget *swr_get_displaytarget(struct pipe_resource *resource); - +#ifdef _WIN32 +void swr_gdi_swap(struct pipe_screen *screen, + struct pipe_resource *res, + void *hDC); +#endif /* _WIN32 */ #ifdef __cplusplus } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/hsw: Set integer mode in sampling state for stencil texturing
Module: Mesa Branch: master Commit: 44c5ed02d1b173c061c3188e245d384fd4c0abba URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44c5ed02d1b173c061c3188e245d384fd4c0abba Author: Jordan Justen Date: Sat Nov 19 14:52:29 2016 -0800 i965/hsw: Set integer mode in sampling state for stencil texturing Fixes: ES31-CTS.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_pot ES31-CTS.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_npot ES31-CTS.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_pot ES31-CTS.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_npot ES31-CTS.functional.texture.border_clamp.unused_channels.depth24_stencil8_sample_stencil ES31-CTS.functional.texture.border_clamp.unused_channels.depth32f_stencil8_sample_stencil Cc: "13.0" Signed-off-by: Jordan Justen Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_sampler_state.c | 18 +- src/mesa/drivers/dri/i965/brw_state.h | 9 - 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c index 7df2c55..412efb9 100644 --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c @@ -213,7 +213,7 @@ static void upload_default_color(struct brw_context *brw, const struct gl_sampler_object *sampler, mesa_format format, GLenum base_format, - bool is_integer_format, + bool is_integer_format, bool is_stencil_sampling, uint32_t *sdc_offset) { union gl_color_union color; @@ -277,7 +277,7 @@ upload_default_color(struct brw_context *brw, uint32_t *sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR, 4 * 4, 64, sdc_offset); memcpy(sdc, color.ui, 4 * 4); - } else if (brw->is_haswell && is_integer_format) { + } else if (brw->is_haswell && (is_integer_format || is_stencil_sampling)) { /* Haswell's integer border color support is completely insane: * SAMPLER_BORDER_COLOR_STATE is 20 DWords. The first four are * for float colors. The next 12 DWords are MBZ and only exist to @@ -291,10 +291,9 @@ upload_default_color(struct brw_context *brw, memset(sdc, 0, 20 * 4); sdc = &sdc[16]; + bool stencil = format == MESA_FORMAT_S_UINT8 || is_stencil_sampling; const int bits_per_channel = - _mesa_get_format_bits(format, - format == MESA_FORMAT_S_UINT8 ? - GL_STENCIL_BITS : GL_RED_BITS); + _mesa_get_format_bits(format, stencil ? GL_STENCIL_BITS : GL_RED_BITS); /* From the Haswell PRM, "Command Reference: Structures", Page 36: * "If any color channel is missing from the surface format, @@ -389,12 +388,13 @@ upload_default_color(struct brw_context *brw, * Sets the sampler state for a single unit based off of the sampler key * entry. */ -void +static void brw_update_sampler_state(struct brw_context *brw, GLenum target, bool tex_cube_map_seamless, GLfloat tex_unit_lod_bias, mesa_format format, GLenum base_format, bool is_integer_format, + bool is_stencil_sampling, const struct gl_sampler_object *sampler, uint32_t *sampler_state, uint32_t batch_offset_for_sampler_state) @@ -516,8 +516,8 @@ brw_update_sampler_state(struct brw_context *brw, if (wrap_mode_needs_border_color(wrap_s) || wrap_mode_needs_border_color(wrap_t) || wrap_mode_needs_border_color(wrap_r)) { - upload_default_color(brw, sampler, - format, base_format, is_integer_format, + upload_default_color(brw, sampler, format, base_format, + is_integer_format, is_stencil_sampling, &border_color_offset); } @@ -555,7 +555,7 @@ update_sampler_state(struct brw_context *brw, brw_update_sampler_state(brw, texObj->Target, ctx->Texture.CubeMapSeamless, texUnit->LodBias, firstImage->TexFormat, firstImage->_BaseFormat, -texObj->_IsIntegerFormat, +texObj->_IsIntegerFormat, texObj->StencilSampling, sampler, sampler_state, batch_offset_for_sampler_state); } diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 07126e8..176557b 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -335,15 +335,6 @@ void br
Mesa (master): reviewers: add Rob H for the Android EGL+build parts
Module: Mesa Branch: master Commit: 8e0e2478ba13dcb128f1becb63fa0cd7d905876e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e0e2478ba13dcb128f1becb63fa0cd7d905876e Author: Emil Velikov Date: Mon Nov 21 15:59:50 2016 + reviewers: add Rob H for the Android EGL+build parts Signed-off-by: Emil Velikov --- REVIEWERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/REVIEWERS b/REVIEWERS index 09853d6..6bd1676 100644 --- a/REVIEWERS +++ b/REVIEWERS @@ -92,11 +92,13 @@ F: */Makefile.sources ANDROID BUILD R: Emil Velikov +R: Rob Herring F: CleanSpec.mk F: */Android.*mk F: */Makefile.sources ANDROID EGL SUPPORT +R: Rob Herring R: Tomasz Figa F: src/egl/drivers/dri2/platform_android.c ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: sourcetree.html misc updates
Module: Mesa Branch: master Commit: 438086efb17044abf6b6b12a2be42c201e55f88b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=438086efb17044abf6b6b12a2be42c201e55f88b Author: Emil Velikov Date: Wed Jun 29 12:52:57 2016 +0100 docs: sourcetree.html misc updates A mixed bag of updates/fixes - mostly aiming at removing no longer applicable directories. Add a few more state-trackers, drivers, etc. alongside "XXX more" where applicable. Attribute for the GLSL/NIR movement and nukage of src/egl/docs. Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/sourcetree.html | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/sourcetree.html b/docs/sourcetree.html index 0765778..aee3321 100644 --- a/docs/sourcetree.html +++ b/docs/sourcetree.html @@ -27,14 +27,18 @@ each directory. include - Public OpenGL header files src + compiler - Common utility sources for different compilers. + +glsl - the GLSL IR and compiler +nir - the NIR IR and compiler +spriv - the SPIR-V compiler + egl - EGL library sources -docs - EGL documentation drivers - EGL drivers main - main EGL library implementation. This is where all the EGL API functions are implemented, like eglCreateContext(). - glsl - the GLSL compiler mapi - Mesa APIs glapi - OpenGL API dispatch layer. This is where all the GL entrypoints like glClear, glBegin, etc. are generated, as well as @@ -94,7 +98,8 @@ each directory. i915 - Driver for Intel i915/i945. llvmpipe - Software driver using LLVM for runtime code generation. - nv* - Drivers for NVIDIA GPUs. + nouveau - Driver for NVIDIA GPUs. + radeon - Shared module for the r600 and radeonsi drivers. radeonsi - Driver for AMD Southern Island. r300 - Driver for ATI R300 - R500. r600 - Driver for ATI/AMD R600 - Northern Island. @@ -128,6 +133,7 @@ each directory. to another. util - assorted utilities for arithmetic, hashing, surface creation, memory management, 2D blitting, simple rendering, etc. + XXX more state_trackers - @@ -135,9 +141,12 @@ each directory. dri - Meta state tracker for DRI drivers glx - Meta state tracker for GLX vdpau - VDPAU state tracker - wgl - - xorg - Meta state tracker for Xorg video drivers + wgl - Windows WGL state tracker + xa - XA state tracker xvmc - XvMC state tracker + vdpau - VDPAU state tracker + va - VA-API state tracker + omx - OpenMAX state tracker winsys - @@ -148,11 +157,11 @@ each directory. - glx - The GLX library code for building libGL. This is used for - direct rendering drivers. It will dynamically load one of the - xxx_dri.so drivers. + glx - The GLX library code for building libGL using DRI drivers. -lib - where the GL libraries are placed +lib - hardlinks to most binaries as produced by make. +These (shortcuts) are used for development purposes in conjunction with +LD_LIBRARY_PATH and/or LIBGL_DRIVERS_PATH. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: split Codying style into separate document
Module: Mesa Branch: master Commit: e561737c5208765ef450c70879837da059573249 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e561737c5208765ef450c70879837da059573249 Author: Emil Velikov Date: Wed Nov 16 00:31:26 2016 + docs: split Codying style into separate document Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/codingstyle.html | 142 ++ docs/contents.html| 1 + docs/devinfo.html | 128 + 3 files changed, 145 insertions(+), 126 deletions(-) diff --git a/docs/codingstyle.html b/docs/codingstyle.html new file mode 100644 index 000..4dfb0cc --- /dev/null +++ b/docs/codingstyle.html @@ -0,0 +1,142 @@ +http://www.w3.org/TR/html4/loose.dtd";> + + + + Coding Style + + + + + + The Mesa 3D Graphics Library + + + + + +Coding Style + + +Mesa is over 20 years old and the coding style has evolved over time. +Some old parts use a style that's a bit out of date. + +Different sections of mesa can use different coding style as set in the local +EditorConfig (.editorconfig) and/or Emacs (.dir-locals.el) file. + +Alternatively the following is applicable. + +If the guidelines below don't cover something, try following the format of +existing, neighboring code. + + + +Basic formatting guidelines + + + +3-space indentation, no tabs. +Limit lines to 78 or fewer characters. The idea is to prevent line +wrapping in 80-column editors and terminals. There are exceptions, such +as if you're defining a large, static table of information. +Opening braces go on the same line as the if/for/while statement. +For example: + + if (condition) { + foo; + } else { + bar; + } + + +Put a space before/after operators. For example, a = b + c; +and not a=b+c; + +This GNU indent command generally does the right thing for formatting: + + indent -br -i3 -npcs --no-tabs infile.c -o outfile.c + + +Use comments wherever you think it would be helpful for other developers. +Several specific cases and style examples follow. Note that we roughly +follow http://www.stack.nl/~dimitri/doxygen/";>Doxygen conventions. + + +Single-line comments: + + /* null-out pointer to prevent dangling reference below */ + bufferObj = NULL; + +Or, + + bufferObj = NULL; /* prevent dangling reference below */ + +Multi-line comment: + + /* If this is a new buffer object id, or one which was generated but +* never used before, allocate a buffer object now. +*/ + +We try to quote the OpenGL specification where prudent: + + /* Page 38 of the PDF of the OpenGL ES 3.0 spec says: +* +* "An INVALID_OPERATION error is generated for any of the following +* conditions: +* +* * is zero." +* +* Additionally, page 94 of the PDF of the OpenGL 4.5 core spec +* (30.10.2014) also says this, so it's no longer allowed for desktop GL, +* either. +*/ + +Function comment example: + + /** +* Create and initialize a new buffer object. Called via the +* ctx->Driver.CreateObject() driver callback function. +* \param name integer name of the object +* \param type one of GL_FOO, GL_BAR, etc. +* \return pointer to new object or NULL if error +*/ + struct gl_object * + _mesa_create_object(GLuint name, GLenum type) + { + /* function body */ + } + + +Put the function return type and qualifiers on one line and the function +name and parameters on the next, as seen above. This makes it easy to use +grep ^function_name dir/* to find function definitions. Also, +the opening brace goes on the next line by itself (see above.) + +Function names follow various conventions depending on the type of function: + + glFooBar() - a public GL entry point (in glapi_dispatch.c) + _mesa_FooBar() - the internal immediate mode function + save_FooBar()- retained mode (display list) function in dlist.c + foo_bar()- a static (private) function + _mesa_foo_bar() - an internal non-static Mesa function + + +Constants, macros and enumerant names are ALL_UPPERCASE, with _ between +words. +Mesa usually uses camel case for local variables (Ex: "localVarname") +while gallium typically uses underscores (Ex: "local_var_name"). +Global variables are almost never used because Mesa should be thread-safe. + +Booleans. Places that are not directly visible to the GL API +should prefer the use of bool, true, and +false over GLboolean, GL_TRUE, and +GL_FALSE. In C code, this may mean that +#includeneeds to be added. The +try_emit_* methods in src/mesa/program/ir_to_mesa.cpp and +src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples. + + + + + + + diff --git a/docs/contents.html b/docs/contents.html index 294804f..cdecac6 100644 --- a/docs/contents.html +++ b/docs/contents.html @@ -81,6 +81,7 @@ Utilities Help Wanted Development Notes +Coding Style Source Documentation GL Dispatch diff --git a/docs
Mesa (master): docs/repository: refer to Submitting patches
Module: Mesa Branch: master Commit: 49ac732651db92911924dd46e3b985eb32ebadab URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49ac732651db92911924dd46e3b985eb32ebadab Author: Emil Velikov Date: Wed Jun 29 13:40:03 2016 +0100 docs/repository: refer to Submitting patches v2: Improve grammar - add missing "to" (Eric). Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/repository.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/repository.html b/docs/repository.html index 784ae2c..1fb88bf 100644 --- a/docs/repository.html +++ b/docs/repository.html @@ -75,7 +75,8 @@ follow this procedure: Subscribe to the http://lists.freedesktop.org/mailman/listinfo/mesa-dev";>mesa-dev mailing list. -Start contributing to the project by posting patches / review requests to +Start contributing to the project by +submitting patches to the mesa-dev list. Specifically, Use git send-mail to post your patches to mesa-dev. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs/submittingpatches: fix tags mis/abuse
Module: Mesa Branch: master Commit: b571c075e9ab48ccbb71879861117171d2344c6b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b571c075e9ab48ccbb71879861117171d2344c6b Author: Emil Velikov Date: Wed Nov 16 11:54:54 2016 + docs/submittingpatches: fix tags mis/abuse Fix the odd tag so that we're HTML 4.01 Traditional compliant Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/submittingpatches.html | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/submittingpatches.html b/docs/submittingpatches.html index 39b615b..d3e86f5 100644 --- a/docs/submittingpatches.html +++ b/docs/submittingpatches.html @@ -134,7 +134,7 @@ to check for regressions. Patches should be sent to the mesa-dev mailing list for review: https://lists.freedesktop.org/mailman/listinfo/mesa-dev";> -mesa-...@lists.freedesktop.org. +mesa-...@lists.freedesktop.org. When submitting a patch make sure to use https://git-scm.com/docs/git-send-email";>git send-email rather than attaching patches to emails. Sending patches as @@ -161,6 +161,7 @@ state of your old patches to Superseded. When you've reviewed a patch on the mailing list, please be unambiguous about your review. That is, state either + Reviewed-by: Joe Hacker@@ -168,14 +169,17 @@ or Acked-by: Joe Hacker + Rather than saying just "LGTM" or "Seems OK". If small changes are suggested, it's OK to say something like: + With the above fixes, Reviewed-by: Joe Hacker + which tells the patch author that the patch can be committed, as long as the issues are resolved first. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs/autoconf: update glx driver / enable-debug text
Module: Mesa Branch: master Commit: 019f055f32a0c201c769daf9ebbdd76d609866f8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=019f055f32a0c201c769daf9ebbdd76d609866f8 Author: Emil Velikov Date: Wed Jun 29 14:26:36 2016 +0100 docs/autoconf: update glx driver / enable-debug text With earlier commit we folded all the xlib handling in --enable-glx, but we forgot to update the documentation. Elaborate on --enable-debug and drop mentions about depenencies. v2: Grammar - s|haven't|hasn't| (Eric) Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/autoconf.html | 31 +-- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/autoconf.html b/docs/autoconf.html index 5c29e5e..21ff8c1 100644 --- a/docs/autoconf.html +++ b/docs/autoconf.html @@ -55,7 +55,7 @@ to your preference, type: -This will produce libGL.so and several other libraries depending on the +This will produce libGL.so and/or several other libraries depending on the options you have chosen. Later, if you want to rebuild for a different configuration run make realclean before rebuilding. @@ -133,9 +133,11 @@ There are also a few general options for altering the Mesa build: --enable-debug -This option will enable compiler -options and macros to aid in debugging the Mesa libraries. - +This option will set the compiler debug/optimisation levels (if the user +hasn't already set them via the CFLAGS/CXXFLAGS) and macros to aid in +debugging the Mesa libraries. + +Note that enabling this option can lead to noticable loss of performance. --disable-asm There are assembly routines @@ -174,27 +176,22 @@ architecture, the following should be sufficient to configure multilib Mesa -2. Driver Options +2. GL Driver Options There are several different driver modes that Mesa can use. These are described in more detail in the basic installation instructions. The Mesa driver is controlled through the -configure options --enable-xlib-glx, --enable-osmesa, -and --enable-dri. +configure options --enable-glx and --enable-osmesa Xlib It uses Xlib as a software renderer to do all rendering. It corresponds -to the option --enable-xlib-glx. The libX11 and libXext -libraries, as well as the X11 development headers, will be need to -support the Xlib driver. +to the option --enable-glx=xlib or --enable-glx=gallium-xlib. DRIThis mode uses the DRI hardware drivers for -accelerated OpenGL rendering. Enable the DRI drivers with the option ---enable-dri. See the basic -installation instructions for details on prerequisites for the DRI -drivers. +accelerated OpenGL rendering. To enable use --enable-glx=dri +--enable-dri. @@ -252,10 +249,8 @@ will create the libOSMesa16 library with a 16-bit color channel. 3. Library Options -The configure script provides more fine grained control over the GL -libraries that will be built. More details on the specific GL libraries -can be found in the basic installation -instructions. +The configure script provides more fine grained control over the libraries +that will be built. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs/submittingpatches: flesh out "how to nominate" methods
Module: Mesa Branch: master Commit: 07384468afdbf6eb2ce43072452a6a87c261b56a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=07384468afdbf6eb2ce43072452a6a87c261b56a Author: Emil Velikov Date: Wed Nov 16 11:51:50 2016 + docs/submittingpatches: flesh out "how to nominate" methods Currently they are buried within the text, making it hard to find. Move them to the top and be clear what is _not_ a good idea. v2: Minor commit polish, use only "resending" as suggested by Matt. Reviewed-by: Marek Olšák Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/submittingpatches.html | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/submittingpatches.html b/docs/submittingpatches.html index 77b870a..39b615b 100644 --- a/docs/submittingpatches.html +++ b/docs/submittingpatches.html @@ -184,6 +184,24 @@ as the issues are resolved first. Nominating a commit for a stable branch +There are three ways to nominate patch for inclusion of the stable branch and +release. + + + By adding the Cc: mesa-stable@ tag as described below. + Sending the commit ID (as seen in master branch) to the mesa-stable@ mailing list. + Forwarding the patch from the mesa-dev@ mailing list. + + + +Note: resending patch identical to one on mesa-dev@ or one that differs only +by the extra mesa-stable@ tag is not recommended. + + + +The stable tag + + If you want a commit to be applied to a stable branch, you should add an appropriate note to the commit message. @@ -207,16 +225,8 @@ exclusively for the older branch. This "CC" syntax for patch nomination will cause patches to automatically be copied to the mesa-stable@ mailing list when you use "git send-email" to send -patches to the mesa-dev@ mailing list. Also, if you realize that a commit -should be nominated for the stable branch after it has already been committed, -you can send a note directly to the mesa-sta...@lists.freedesktop.org where -the Mesa stable-branch maintainers will receive it. Be sure to mention the -commit ID of the commit of interest (as it appears in the mesa master branch). - -The latest set of patches that have been nominated, accepted, or rejected for -the upcoming stable release can always be seen on the -http://cworth.org/~cworth/mesa-stable-queue/";>Mesa Stable Queue -page. +patches to the mesa-dev@ mailing list. If you prefer using --suppress-cc that +won't have any effect negative effect on the patch nomination. Criteria for accepting patches to the stable branch ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: rework/update install.html
Module: Mesa Branch: master Commit: 0fa854aea5ff0a8fe7ed21fef8e9ae2551bae486 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fa854aea5ff0a8fe7ed21fef8e9ae2551bae486 Author: Emil Velikov Date: Wed Jun 29 13:13:25 2016 +0100 docs: rework/update install.html Still far from perfect, but a few small steps in the right direction. - Split build systems, compilers, third party tools - Mention building mesa for Android (part of AOSP) - Drop explicit "other" dependencies. Reference to disto methods to get them. - HTML 4.01 Traditional compliance fixes - mixed ul and br tags. - nuke dead links README.{CYGWIN,VMS} v2: Squash typos, add note about buggy flex 2.6.2 (Eric), add Suse zipper command (Tobias). Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/install.html | 111 ++ 1 file changed, 71 insertions(+), 40 deletions(-) diff --git a/docs/install.html b/docs/install.html index 8b349c4..7a690c9 100644 --- a/docs/install.html +++ b/docs/install.html @@ -24,7 +24,7 @@ Building with autoconf (Linux/Unix/X11) Building with SCons (Windows/Linux) -Building for other systems +Building with AOSP (Android) Library Information Building OpenGL programs with pkg-config @@ -33,62 +33,85 @@ 1. Prerequisites for building 1.1 General + + +Build system. + + + +Autoconf is required when building on *nix platforms. +http://www.scons.org/";>SCons is required for building on +Windows and optional for Linux (it's an alternative to autoconf/automake.) + +Android Build system when building as native Android component. Autoconf +is used when when building ARC. + + + + + +The following compilers are known to work, if you know of others or you're +willing to maintain support for other compiler get in touch. + + + +GCC 4.2.0 or later (some parts of Mesa may require later versions) +clang - exact minimum requirement is currently unknown. +Microsoft Visual Studio 2013 Update 4 or later is required, for building on Windows. + + + + +Third party/extra tools. + +Note: These should not be required, when building from a release tarball. If +you think you've spotted a bug let developers know by filing a +bug report. + + + http://www.python.org/";>Python - Python is required. Version 2.6.4 or later should work. - http://www.makotemplates.org/";>Python Mako module - Python Mako module is required. Version 0.3.4 or later should work. - -http://www.scons.org/";>SCons is required for building on -Windows and optional for Linux (it's an alternative to autoconf/automake.) - - -lex / yacc - for building the GLSL compiler. - - -On Linux systems, flex and bison are used. -Versions 2.5.35 and 2.4.1, respectively, (or later) should work. - - +lex / yacc - for building the Mesa IR and GLSL compiler. + +On Linux systems, flex and bison versions 2.5.35 and 2.4.1, respectively, +(or later) should work. On Windows with MinGW, install flex and bison with: mingw-get install msys-flex msys-bison For MSVC on Windows, install http://winflexbison.sourceforge.net/";>Win flex-bison. - - -For building on Windows, Microsoft Visual Studio 2013 or later is required. - + +Note: Some versions can be buggy (eg. flex 2.6.2) so do try others if things fail. -1.2 For DRI and hardware acceleration +1.2 Requirements -The following are required for DRI-based hardware acceleration with Mesa: +The requirements depends on the features selected at configure stage. +Check/install the respective -devel package as prompted by the configure error +message. - -http://xorg.freedesktop.org/releases/individual/proto/";> -dri2proto version 2.6 or later -http://dri.freedesktop.org/libdrm/";>libDRM latest version -Xorg server version 1.5 or later -Linux 2.6.28 or later - -If you're using a fedora distro the following command should install all -the needed dependencies: +Here are some common ways to retrieve most/all of the dependencies based on +the packaging tool used by your distro. + - sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \ - gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \ - expat-devel llvm-devel python-mako + zypper source-install --build-deps-only Mesa # openSUSE/SLED/SLES + yum-builddep mesa # yum Fedora, OpenSuse(?) + dnf builddep mesa # dnf Fedora + apt-get build-dep mesa # Debian and derivatives + ... # others - 2. Building with autoconf (Linux/Unix/X11) @@ -139,22 +162,30 @@ This will create: Put them all in the same directory to test them. + +Additional information is available in README.WIN32. + -4. Building for other systems +4. Building with AOSP (Android) -Documentation for other environments (some may be very out of date): +Currently one can build Mesa for Android as part of the AOSP project, yet +your experience might vary. - -README.VMS - VMS -README.CYGWIN - Cygwin -README.WIN32 - Win32 - + +In order to achieve that one should update
Mesa (master): docs: recommend using --enable-mangling over the manual -DUSE...
Module: Mesa Branch: master Commit: 7a39a0091d1371796152b840133b2ca247b12f20 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a39a0091d1371796152b840133b2ca247b12f20 Author: Emil Velikov Date: Wed Jun 29 13:26:07 2016 +0100 docs: recommend using --enable-mangling over the manual -DUSE... Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/contents.html | 2 +- docs/mangling.html | 11 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/contents.html b/docs/contents.html index d2b63a3..c2fe391 100644 --- a/docs/contents.html +++ b/docs/contents.html @@ -66,7 +66,7 @@ Debugging Tips Performance Tips Mesa Extensions -Function Name Mangling +GL Function Name Mangling Gallium llvmpipe driver VMware SVGA3D guest driver Gallium post-processing diff --git a/docs/mangling.html b/docs/mangling.html index c96f2f2..9d92b7d 100644 --- a/docs/mangling.html +++ b/docs/mangling.html @@ -2,7 +2,7 @@ - Function Name Mangling + GL Function Name Mangling @@ -14,7 +14,7 @@ -Function Name Mangling +GL Function Name Mangling If you want to use both Mesa and another OpenGL library in the same @@ -25,12 +25,11 @@ This results in all the Mesa functions being prefixed with -To do this, recompile Mesa with the compiler flag -DUSE_MGL_NAMESPACE. -Add the flag to CFLAGS in the configuration file which you want to use. -For example: +This option is supported only with the autoconf build. To use it add +--enable-mangling to your configure line. -CFLAGS += -DUSE_MGL_NAMESPACE +./configure --enable-mangling ... ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: flesh out releasing.html
Module: Mesa Branch: master Commit: 2edc29ab1e568ed93b038e049eff95529d17fb53 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2edc29ab1e568ed93b038e049eff95529d17fb53 Author: Emil Velikov Date: Wed Nov 16 18:25:41 2016 + docs: flesh out releasing.html Properly document the whole process: - Brief on what, when, where - Picking, testing, branchpoints, pre-release announcement - Releasing, announcement, website and bugzilla updates Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/devinfo.html | 239 - docs/releasing.html | 499 2 files changed, 499 insertions(+), 239 deletions(-) diff --git a/docs/devinfo.html b/docs/devinfo.html index f5642bc..c6e97c6 100644 --- a/docs/devinfo.html +++ b/docs/devinfo.html @@ -18,248 +18,9 @@ -Making a New Mesa Release Adding Extensions -Making a New Mesa Release - - -These are the instructions for making a new Mesa release. - - -Get latest source files - -Use git to get the latest Mesa files from the git repository, from whatever -branch is relevant. This document uses the convention X.Y.Z for the release -being created, which should be created from a branch named X.Y. - - -Perform basic testing - -The release manager should, at the very least, test the code by compiling it, -installing it, and running the latest piglit to ensure that no piglit tests -have regressed since the previous release. - - - -The release manager should do this testing with at least one hardware driver, -(say, whatever is contained in the local development machine), as well as on -both Gallium and non-Gallium software drivers. The software testing can be -performed by running piglit with the following environment-variable set: - - - -LIBGL_ALWAYS_SOFTWARE=1 - - -And Gallium vs. non-Gallium software drivers can be obtained by using the -following configure flags on separate builds: - - ---with-dri-drivers=swrast ---with-gallium-drivers=swrast - - - -Note: If both options are given in one build, both swrast_dri.so drivers will -be compiled, but only one will be installed. The following command can be used -to ensure the correct driver is being tested: - - - -LIBGL_ALWAYS_SOFTWARE=1 glxinfo | grep "renderer string" - - -If any regressions are found in this testing with piglit, stop here, and do -not perform a release until regressions are fixed. - -Update version in file VERSION - - -Increment the version contained in the file VERSION at Mesa's top-level, then -commit this change. - - -Create release notes for the new release - - -Create a new file docs/relnotes/X.Y.Z.html, (follow the style of the previous -release notes). Note that the sha256sums section of the release notes should -be empty at this point. - - - -Two scripts are available to help generate portions of the release notes: - - - ./bin/bugzilla_mesa.sh - ./bin/shortlog_mesa.sh - - - -The first script identifies commits that reference bugzilla bugs and obtains -the descriptions of those bugs from bugzilla. The second script generates a -log of all commits. In both cases, HTML-formatted lists are printed to stdout -to be included in the release notes. - - - -Commit these changes - - -Make the release archives, signatures, and the release tag - -From inside the Mesa directory: - - ./autogen.sh - make -j1 tarballs - - - -After the tarballs are created, the sha256 checksums for the files will -be computed and printed. These will be used in a step below. - - - -It's important at this point to also verify that the constructed tar file -actually builds: - - - - tar xjf MesaLib-X.Y.Z.tar.bz2 - cd Mesa-X.Y.Z - ./configure --enable-gallium-llvm - make -j6 - make install - - - -Some touch testing should also be performed at this point, (run glxgears or -more involved OpenGL programs against the installed Mesa). - - - -Create detached GPG signatures for each of the archive files created above: - - - - gpg --sign --detach MesaLib-X.Y.Z.tar.gz - gpg --sign --detach MesaLib-X.Y.Z.tar.bz2 - gpg --sign --detach MesaLib-X.Y.Z.zip - - - -Tag the commit used for the build: - - - - git tag -s mesa-X.Y.X -m "Mesa X.Y.Z release" - - - -Note: It would be nice to investigate and fix the issue that causes the -tarballs target to fail with multiple build process, such as with "-j4". It -would also be nice to incorporate all of the above commands into a single -makefile target. And instead of a custom "tarballs" target, we should -incorporate things into the standard "make dist" and "make distcheck" targets. - - -Add the sha256sums to the release notes - - -Edit docs/relnotes/X.Y.Z.html to add the sha256sums printed as part of "make -tarballs" in the previous step. Commit this change. - - -Push all commits and the tag created above - - -This is the first step that cannot easily be undone. The release is going -forward from this point: - - - - git push origin
Mesa (master): docs: mention/suggest testing your patch against dEQP
Module: Mesa Branch: master Commit: edbf3ebe1ffbed6456d333552609dd02e9969596 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=edbf3ebe1ffbed6456d333552609dd02e9969596 Author: Emil Velikov Date: Wed Jun 29 11:55:47 2016 +0100 docs: mention/suggest testing your patch against dEQP Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/devinfo.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/devinfo.html b/docs/devinfo.html index c75fa8e..58025e6 100644 --- a/docs/devinfo.html +++ b/docs/devinfo.html @@ -250,8 +250,9 @@ to update the tests themselves. Whenever possible and applicable, test the patch with -http://piglit.freedesktop.org";>Piglit to -check for regressions. +http://piglit.freedesktop.org";>Piglit and/or +https://android.googlesource.com/platform/external/deqp/";>dEQP +to check for regressions. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: split Submitting Patches into separate document
Module: Mesa Branch: master Commit: 259e65c03ec495a4a1e0c1d513ae87f7a429c360 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=259e65c03ec495a4a1e0c1d513ae87f7a429c360 Author: Emil Velikov Date: Wed Nov 16 00:20:56 2016 + docs: split Submitting Patches into separate document Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/contents.html | 1 + docs/devinfo.html | 285 docs/submittingpatches.html | 309 3 files changed, 310 insertions(+), 285 deletions(-) diff --git a/docs/contents.html b/docs/contents.html index cdecac6..d2b63a3 100644 --- a/docs/contents.html +++ b/docs/contents.html @@ -82,6 +82,7 @@ Help Wanted Development Notes Coding Style +Submitting patches Source Documentation GL Dispatch diff --git a/docs/devinfo.html b/docs/devinfo.html index c40ea35..f5642bc 100644 --- a/docs/devinfo.html +++ b/docs/devinfo.html @@ -18,295 +18,10 @@ -Submitting Patches Making a New Mesa Release Adding Extensions -Submitting patches - - -The basic guidelines for submitting patches are: - - - -Patches should be sufficiently tested before submitting. -Code patches should follow Mesa -coding conventions. -Whenever possible, patches should only effect individual Mesa/Gallium -components. -Patches should never introduce build breaks and should be bisectable (see -git bisect.) -Patches should be properly formatted (see below). -Patches should be submitted to mesa-dev for review using -git send-email. -Patches should not mix code changes with code formatting changes (except, -perhaps, in very trivial cases.) - - -Patch formatting - - -The basic rules for patch formatting are: - - - -Lines should be limited to 75 characters or less so that git logs -displayed in 80-column terminals avoid line wrapping. Note that git -log uses 4 spaces of indentation (4 + 75 < 80). -The first line should be a short, concise summary of the change prefixed -with a module name. Examples: - -mesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG - -gallium: add PIPE_CAP_DEVICE_RESET_STATUS_QUERY - -i965: Fix missing type in local variable declaration. - -Subsequent patch comments should describe the change in more detail, -if needed. For example: - -i965: Remove end-of-thread SEND alignment code. - -This was present in Eric's initial implementation of the compaction code -for Sandybridge (commit 077d01b6). There is no documentation saying this -is necessary, and removing it causes no regressions in piglit on any -platform. - -A "Signed-off-by:" line is not required, but not discouraged either. -If a patch address a bugzilla issue, that should be noted in the -patch comment. For example: - - Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89689 - -If there have been several revisions to a patch during the review -process, they should be noted such as in this example: - -st/mesa: add ARB_texture_stencil8 support (v4) - -if we support stencil texturing, enable texture_stencil8 -there is no requirement to support native S8 for this, -the texture can be converted to x24s8 fine. - -v2: fold fixes from Marek in: - a) put S8 last in the list - b) fix renderable to always test for d/s renderable -fixup the texture case to use a stencil only format -for picking the format for the texture view. -v3: hit fallback for getteximage -v4: put s8 back in front, it shouldn't get picked now (Ilia) - -If someone tested your patch, document it with a line like this: - -Tested-by: Joe Hacker- -If the patch was reviewed (usually the case) or acked by someone, -that should be documented with: - -Reviewed-by: Joe Hacker -Acked-by: Joe Hacker - - - - - -Testing Patches - - -It should go without saying that patches must be tested. In general, -do whatever testing is prudent. - - - -You should always run the Mesa test suite before submitting patches. -The test suite can be run using the 'make check' command. All tests -must pass before patches will be accepted, this may mean you have -to update the tests themselves. - - - -Whenever possible and applicable, test the patch with -http://piglit.freedesktop.org";>Piglit and/or -https://android.googlesource.com/platform/external/deqp/";>dEQP -to check for regressions. - - - -Mailing Patches - - -Patches should be sent to the mesa-dev mailing list for review: -https://lists.freedesktop.org/mailman/listinfo/mesa-dev";> -mesa-...@lists.freedesktop.org. -When submitting a patch make sure to use -https://git-scm.com/docs/git-send-email";>git send-email -rather than attaching patches to emails. Sending patches as -attachments prevents people from being able to provide in-line review -comments. - - - -When submitting follow-up patches you can use --in-reply-to to make v2, v3, -etc patches show
Mesa (master): docs: mention that coding style can differ between drivers
Module: Mesa Branch: master Commit: f2d9c7b60c82e1cdcdf83c67091a2b214cbb5f34 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2d9c7b60c82e1cdcdf83c67091a2b214cbb5f34 Author: Emil Velikov Date: Wed Jun 29 11:49:25 2016 +0100 docs: mention that coding style can differ between drivers ... and point people to use/honour the EditorConfig/Emacs files, where applicable. Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- docs/devinfo.html | 6 ++ 1 file changed, 6 insertions(+) diff --git a/docs/devinfo.html b/docs/devinfo.html index afd92fd..c75fa8e 100644 --- a/docs/devinfo.html +++ b/docs/devinfo.html @@ -30,6 +30,12 @@ Mesa is over 20 years old and the coding style has evolved over time. Some old parts use a style that's a bit out of date. + +Different sections of mesa can use different coding style as set in the local +EditorConfig (.editorconfig) and/or Emacs (.dir-locals.el) file. + +Alternatively the following is applicable. + If the guidelines below don't cover something, try following the format of existing, neighboring code. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): loader: automake: whitespace cleanup
Module: Mesa Branch: master Commit: b421fec95804a9d33cc8d40d313ad7bd629f3178 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b421fec95804a9d33cc8d40d313ad7bd629f3178 Author: Emil Velikov Date: Thu Nov 17 15:45:47 2016 + loader: automake: whitespace cleanup Signed-off-by: Emil Velikov Reviewed-by: Eduardo Lima Mitev --- src/loader/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am index 4aa6ca3..ba2e65c 100644 --- a/src/loader/Makefile.am +++ b/src/loader/Makefile.am @@ -45,7 +45,7 @@ libloader_la_CPPFLAGS += \ -I$(top_srcdir)/src/mapi/ \ -DUSE_DRICONF - libloader_la_LIBADD += \ +libloader_la_LIBADD += \ $(top_builddir)/src/mesa/drivers/dri/common/libxmlconfig.la endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: fold always true conditional
Module: Mesa Branch: master Commit: 4f12fcb6d36905fe7df06ce4514817f5139c4158 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f12fcb6d36905fe7df06ce4514817f5139c4158 Author: Emil Velikov Date: Fri Nov 11 16:43:28 2016 + mesa: fold always true conditional Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- src/mesa/main/context.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 80bee16..bd4551e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1696,10 +1696,8 @@ _mesa_make_current( struct gl_context *newCtx, */ newCtx->NewState |= _NEW_BUFFERS; - if (drawBuffer) { -_mesa_check_init_viewport(newCtx, - drawBuffer->Width, drawBuffer->Height); - } + _mesa_check_init_viewport(newCtx, + drawBuffer->Width, drawBuffer->Height); } if (newCtx->FirstTimeCurrent) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): revieweds: add Tomasz for the Android/EGL implementation
Module: Mesa Branch: master Commit: 4fbeac398a846caa2a5be5c2abe1966e97de8174 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fbeac398a846caa2a5be5c2abe1966e97de8174 Author: Emil Velikov Date: Mon Nov 21 14:33:44 2016 + revieweds: add Tomasz for the Android/EGL implementation As mentioned/requested on the mailing list. Signed-off-by: Emil Velikov --- REVIEWERS | 4 1 file changed, 4 insertions(+) diff --git a/REVIEWERS b/REVIEWERS index f822421..09853d6 100644 --- a/REVIEWERS +++ b/REVIEWERS @@ -96,6 +96,10 @@ F: CleanSpec.mk F: */Android.*mk F: */Makefile.sources +ANDROID EGL SUPPORT +R: Tomasz Figa +F: src/egl/drivers/dri2/platform_android.c + WAYLAND EGL SUPPORT R: Daniel Stone F: src/egl/wayland/* ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: drop unneeded assert
Module: Mesa Branch: master Commit: e70d0d22a2dccc1df2c88890a2964491cdafac94 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e70d0d22a2dccc1df2c88890a2964491cdafac94 Author: Emil Velikov Date: Fri Nov 11 16:43:27 2016 + mesa: drop unneeded assert As seen a couple of lines above - there's no way for the assert to trigger. Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- src/mesa/main/framebuffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 20d03fe..c06130d 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -256,7 +256,6 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr, *ptr = NULL; } - assert(!*ptr); if (fb) { mtx_lock(&fb->Mutex); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gbm: automake: remove unused defines
Module: Mesa Branch: master Commit: 4ffa9b284786be1d7979766fa510fc9e77a806bb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ffa9b284786be1d7979766fa510fc9e77a806bb Author: Emil Velikov Date: Thu Nov 17 15:45:46 2016 + gbm: automake: remove unused defines Signed-off-by: Emil Velikov Reviewed-by: Eduardo Lima Mitev --- src/gbm/Makefile.am | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am index aba8d1e..e34c1d4 100644 --- a/src/gbm/Makefile.am +++ b/src/gbm/Makefile.am @@ -4,8 +4,6 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = main/gbm.pc AM_CFLAGS = \ - -D_OS_UNIX=1 \ - -DMODULEDIR='"$(libdir)/gbm"' \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/loader \ -I$(top_srcdir)/src/gbm/main \ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/wayland: remove non-applicable destroyDrawable from error path
Module: Mesa Branch: master Commit: 130b12f96a4e60c88e8ccd5e673413e0a8c0c127 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=130b12f96a4e60c88e8ccd5e673413e0a8c0c127 Author: Emil Velikov Date: Fri Nov 11 16:45:00 2016 + egl/wayland: remove non-applicable destroyDrawable from error path If we fail to create the drawable there's not much point in attampting to destroy it. Signed-off-by: Emil Velikov Reviewed-by: Eric Engestrom --- src/egl/drivers/dri2/platform_wayland.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 4fd4289..395f1e1 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1752,7 +1752,7 @@ dri2_wl_swrast_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, config, dri2_surf); if (dri2_surf->dri_drawable == NULL) { _eglError(EGL_BAD_ALLOC, "swrast->createNewDrawable"); - goto cleanup_dri_drawable; + goto cleanup_surf; } dri2_wl_swap_interval(drv, disp, &dri2_surf->base, @@ -1760,8 +1760,6 @@ dri2_wl_swrast_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, return &dri2_surf->base; - cleanup_dri_drawable: - dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable); cleanup_surf: free(dri2_surf); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: aubinator: Fix resource leak in gen_spec_load_from_path
Module: Mesa Branch: master Commit: d3780e2e4d0138721b43524fcea31e594361c648 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3780e2e4d0138721b43524fcea31e594361c648 Author: Gwan-gyeong Mun Date: Sun Nov 20 16:07:19 2016 +0900 intel: aubinator: Fix resource leak in gen_spec_load_from_path This fixes resource leak in gen_spec_load_from_path XML_ParserCreate failure path CID 1373564 Signed-off-by: Mun Gwan-gyeong Reviewed-by: Lionel Landwerlin --- src/intel/tools/decoder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/tools/decoder.c b/src/intel/tools/decoder.c index 6bd02bf..633251a 100644 --- a/src/intel/tools/decoder.c +++ b/src/intel/tools/decoder.c @@ -539,6 +539,7 @@ gen_spec_load_from_path(const struct gen_device_info *devinfo, XML_SetUserData(ctx.parser, &ctx); if (ctx.parser == NULL) { fprintf(stderr, "failed to create parser\n"); + fclose(input); free(filename); return NULL; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/android: Get gralloc module in dri2_initialize_android( ) (v2)
Module: Mesa Branch: master Commit: 859d0b01217a0241a12a75899dcfb8263787f1ad URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=859d0b01217a0241a12a75899dcfb8263787f1ad Author: Tomasz Figa Date: Thu Nov 10 16:55:52 2016 +0900 egl/android: Get gralloc module in dri2_initialize_android() (v2) Currently droid_open_device() gets a reference to the gralloc module only for its own use and does not store it anywhere. To make it possible to call gralloc methods from code added in further patches, let's refactor current code to get gralloc module in dri2_initialize_android() and store it in dri2_dpy. v2: fixes from Emil's review: a) remove duplicate initialization of 'err'. Signed-off-by: Tomasz Figa Reviewed-by: Emil Velikov Reviewed-by: Tapani Pälli --- src/egl/drivers/dri2/egl_dri2.h | 4 src/egl/drivers/dri2/platform_android.c | 27 +++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index c039b64..fd4e87b 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -219,6 +219,10 @@ struct dri2_egl_display char *device_name; #endif +#ifdef HAVE_ANDROID_PLATFORM + const gralloc_module_t *gralloc; +#endif + int is_render_node; int is_different_gpu; }; diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index f62a038..fc49932 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -856,19 +856,14 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy) } static int -droid_open_device(void) +droid_open_device(struct dri2_egl_display *dri2_dpy) { - const hw_module_t *mod; - int fd = -1, err; + int fd = -1, err = -EINVAL; - err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mod); - if (!err) { - const gralloc_module_t *gr = (gralloc_module_t *) mod; - - err = -EINVAL; - if (gr->perform) - err = gr->perform(gr, GRALLOC_MODULE_PERFORM_GET_DRM_FD, &fd); - } + if (dri2_dpy->gralloc->perform) + err = dri2_dpy->gralloc->perform(dri2_dpy->gralloc, + GRALLOC_MODULE_PERFORM_GET_DRM_FD, + &fd); if (err || fd < 0) { _eglLog(_EGL_WARNING, "fail to get drm fd"); fd = -1; @@ -963,6 +958,7 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy) { struct dri2_egl_display *dri2_dpy; const char *err; + int ret; _eglSetLogProc(droid_log); @@ -972,9 +968,16 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy) if (!dri2_dpy) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); + ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, + (const hw_module_t **)&dri2_dpy->gralloc); + if (ret) { + err = "DRI2: failed to get gralloc module"; + goto cleanup_display; + } + dpy->DriverData = (void *) dri2_dpy; - dri2_dpy->fd = droid_open_device(); + dri2_dpy->fd = droid_open_device(dri2_dpy); if (dri2_dpy->fd < 0) { err = "DRI2: failed to open device"; goto cleanup_display; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/android: Use gralloc:: lock_ycbcr for resolving YUV formats (v2)
Module: Mesa Branch: master Commit: 51727b1cf57e8c4630767eb9ead207b102ffa489 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51727b1cf57e8c4630767eb9ead207b102ffa489 Author: Tomasz Figa Date: Thu Nov 10 16:55:53 2016 +0900 egl/android: Use gralloc::lock_ycbcr for resolving YUV formats (v2) There is an interface that can be used to query YUV buffers for their internal format. Specifically, if gralloc:lock_ycbcr() is given no SW usage flags, it's supposed to return plane offsets instead of pointers. Let's use this interface to implement support for YUV formats in Android EGL backend. v2: Fixes from Emil's review: a) Added comments for parts that might be not clear, b) Changed get_fourcc_yuv() to return -1 on failure, c) Changed is_yuv() to use bool. Signed-off-by: Tomasz Figa Reviewed-by: Emil Velikov Reviewed-by: Tapani Pälli --- src/egl/drivers/dri2/platform_android.c | 164 ++-- 1 file changed, 137 insertions(+), 27 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index fc49932..373e2c0 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -31,6 +31,7 @@ #include #include #include +#include #if ANDROID_VERSION >= 0x402 #include @@ -43,6 +44,52 @@ #define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1)) +struct droid_yuv_format { + /* Lookup keys */ + int native; /* HAL_PIXEL_FORMAT_ */ + int is_ycrcb; /* 0 if chroma order is {Cb, Cr}, 1 if {Cr, Cb} */ + int chroma_step; /* Distance in bytes between subsequent chroma pixels. */ + + /* Result */ + int fourcc; /* __DRI_IMAGE_FOURCC_ */ +}; + +/* The following table is used to look up a DRI image FourCC based + * on native format and information contained in android_ycbcr struct. */ +static const struct droid_yuv_format droid_yuv_formats[] = { + /* Native format, YCrCb, Chroma step, DRI image FourCC */ + { HAL_PIXEL_FORMAT_YCbCr_420_888, 0, 2, __DRI_IMAGE_FOURCC_NV12 }, + { HAL_PIXEL_FORMAT_YCbCr_420_888, 0, 1, __DRI_IMAGE_FOURCC_YUV420 }, + { HAL_PIXEL_FORMAT_YCbCr_420_888, 1, 1, __DRI_IMAGE_FOURCC_YVU420 }, + { HAL_PIXEL_FORMAT_YV12,1, 1, __DRI_IMAGE_FOURCC_YVU420 }, +}; + +static int +get_fourcc_yuv(int native, int is_ycrcb, int chroma_step) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(droid_yuv_formats); ++i) + if (droid_yuv_formats[i].native == native && + droid_yuv_formats[i].is_ycrcb == is_ycrcb && + droid_yuv_formats[i].chroma_step == chroma_step) + return droid_yuv_formats[i].fourcc; + + return -1; +} + +static bool +is_yuv(int native) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(droid_yuv_formats); ++i) + if (droid_yuv_formats[i].native == native) + return true; + + return false; +} + static int get_format_bpp(int native) { @@ -57,9 +104,6 @@ get_format_bpp(int native) case HAL_PIXEL_FORMAT_RGB_565: bpp = 2; break; - case HAL_PIXEL_FORMAT_YV12: - bpp = 1; - break; default: bpp = 0; break; @@ -76,7 +120,6 @@ static int get_fourcc(int native) case HAL_PIXEL_FORMAT_BGRA_: return __DRI_IMAGE_FOURCC_ARGB; case HAL_PIXEL_FORMAT_RGBA_: return __DRI_IMAGE_FOURCC_ABGR; case HAL_PIXEL_FORMAT_RGBX_: return __DRI_IMAGE_FOURCC_XBGR; - case HAL_PIXEL_FORMAT_YV12: return __DRI_IMAGE_FOURCC_YVU420; default: _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", native); } @@ -541,35 +584,80 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) } static _EGLImage * -droid_create_image_from_prime_fd(_EGLDisplay *disp, _EGLContext *ctx, - struct ANativeWindowBuffer *buf, int fd) +droid_create_image_from_prime_fd_yuv(_EGLDisplay *disp, _EGLContext *ctx, + struct ANativeWindowBuffer *buf, int fd) { - unsigned int offsets[3] = { 0, 0, 0 }; - unsigned int pitches[3] = { 0, 0, 0 }; + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + struct android_ycbcr ycbcr; + size_t offsets[3]; + size_t pitches[3]; + int is_ycrcb; + int fourcc; + int ret; - const int fourcc = get_fourcc(buf->format); - if (fourcc == -1) { - _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); + if (!dri2_dpy->gralloc->lock_ycbcr) { + _eglLog(_EGL_WARNING, "Gralloc does not support lock_ycbcr"); return NULL; } - pitches[0] = buf->stride * get_format_bpp(buf->format); - if (pitches[0] == 0) { - _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); + memset(&ycbcr, 0, sizeof(ycbcr)); + ret = dri2_dpy->gralloc->lock_ycbcr(dri2_dpy->gralloc, buf->handle, + 0, 0, 0, 0, 0, &ycbcr); + if (ret) { + _eglLog(_EGL_WARNING, "gralloc->lock_ycbcr failed: %d", ret); + return NULL; + } + dri2_dpy->gra
Mesa (master): egl/android: Remove handling of RGB_888 pixel format
Module: Mesa Branch: master Commit: 925ff0b5341e0df494b647f02fbc136757fdd48e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=925ff0b5341e0df494b647f02fbc136757fdd48e Author: Tomasz Figa Date: Wed Nov 9 17:32:54 2016 +0900 egl/android: Remove handling of RGB_888 pixel format It is currently completely broken, as it ends up using RGBX_ on hardware side, due to no way of distinguishing between these two in the DRI API, while HAL_PIXEL_FORMAT_RGB_888 is clearly defined to be the 3-byte per pixel RGB format. Signed-off-by: Tomasz Figa Reviewed-by: Emil Velikov --- src/egl/drivers/dri2/platform_android.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 4efba98..f62a038 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -54,9 +54,6 @@ get_format_bpp(int native) case HAL_PIXEL_FORMAT_BGRA_: bpp = 4; break; - case HAL_PIXEL_FORMAT_RGB_888: - bpp = 3; - break; case HAL_PIXEL_FORMAT_RGB_565: bpp = 2; break; @@ -93,8 +90,6 @@ static int get_format(int format) case HAL_PIXEL_FORMAT_RGB_565: return __DRI_IMAGE_FORMAT_RGB565; case HAL_PIXEL_FORMAT_RGBA_: return __DRI_IMAGE_FORMAT_ABGR; case HAL_PIXEL_FORMAT_RGBX_: return __DRI_IMAGE_FORMAT_XBGR; - case HAL_PIXEL_FORMAT_RGB_888: - /* unsupported */ default: _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", format); } @@ -819,7 +814,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy) } visuals[] = { { HAL_PIXEL_FORMAT_RGBA_, { 0xff, 0xff00, 0xff, 0xff00 } }, { HAL_PIXEL_FORMAT_RGBX_, { 0xff, 0xff00, 0xff, 0x0 } }, - { HAL_PIXEL_FORMAT_RGB_888, { 0xff, 0xff00, 0xff, 0x0 } }, { HAL_PIXEL_FORMAT_RGB_565, { 0xf800, 0x7e0, 0x1f, 0x0 } }, { HAL_PIXEL_FORMAT_BGRA_, { 0xff, 0xff00, 0xff, 0xff00 } }, }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: Fix resource leak in gs_copy_shader allocation failure path
Module: Mesa Branch: master Commit: 9c5b1c799073779101d358d85eff0bdc389c93fc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c5b1c799073779101d358d85eff0bdc389c93fc Author: Gwan-gyeong Mun Date: Sun Nov 20 13:19:57 2016 +0900 radeonsi: Fix resource leak in gs_copy_shader allocation failure path CID 1394028 Signed-off-by: Mun Gwan-gyeong Reviewed-by: Edward O'Callaghan Reviewed-by: Marek Olšák Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 917e148..608cb72 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6137,9 +6137,15 @@ si_generate_gs_copy_shader(struct si_screen *sscreen, outputs = MALLOC(gsinfo->num_outputs * sizeof(outputs[0])); + if (!outputs) + return NULL; + shader = CALLOC_STRUCT(si_shader); - if (!shader) + if (!shader) { + FREE(outputs); return NULL; + } + shader->selector = gs_selector; shader->is_gs_copy_shader = true; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit