diff options
41 files changed, 464 insertions, 322 deletions
diff --git a/lib/mesa/VERSION b/lib/mesa/VERSION index 5ba2cf5ac..a011a9766 100644 --- a/lib/mesa/VERSION +++ b/lib/mesa/VERSION @@ -1 +1 @@ -21.3.7 +21.3.8 diff --git a/lib/mesa/docs/features.txt b/lib/mesa/docs/features.txt index 06d3e52e0..0e44155e4 100644 --- a/lib/mesa/docs/features.txt +++ b/lib/mesa/docs/features.txt @@ -331,7 +331,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve GL_EXT_texture_norm16 DONE (freedreno, i965, r600, radeonsi, nvc0i, softpipe, zink) GL_EXT_texture_sRGB_R8 DONE (all drivers that support GLES 3.0+) GL_KHR_blend_equation_advanced_coherent DONE (i965/gen9+, panfrost) - GL_KHR_texture_compression_astc_hdr DONE (i965/bxt, panfrost) + GL_KHR_texture_compression_astc_hdr DONE (core only) GL_KHR_texture_compression_astc_sliced_3d DONE (i965/gen9+, r600, radeonsi, panfrost, softpipe, swr, zink, lima) GL_OES_depth_texture_cube_map DONE (all drivers that support GLSL 1.30+) GL_OES_EGL_image DONE (all drivers) diff --git a/lib/mesa/generated/src/compiler/glsl/glcpp/glcpp-lex.c b/lib/mesa/generated/src/compiler/glsl/glcpp/glcpp-lex.c index 3009c78cb..a69bfb949 100644 --- a/lib/mesa/generated/src/compiler/glsl/glcpp/glcpp-lex.c +++ b/lib/mesa/generated/src/compiler/glsl/glcpp/glcpp-lex.c @@ -4,7 +4,7 @@ #define YY_INT_ALIGNED short int -/* $OpenBSD: glcpp-lex.c,v 1.7 2022/02/24 02:52:28 jsg Exp $ */ +/* $OpenBSD: glcpp-lex.c,v 1.8 2022/04/21 04:37:17 jsg Exp $ */ /* A lexical scanner generated by flex */ @@ -26,7 +26,7 @@ /* end standard C headers. */ -/* $OpenBSD: glcpp-lex.c,v 1.7 2022/02/24 02:52:28 jsg Exp $ */ +/* $OpenBSD: glcpp-lex.c,v 1.8 2022/04/21 04:37:17 jsg Exp $ */ /* flex integer type definitions */ diff --git a/lib/mesa/generated/src/compiler/glsl/glsl_lexer.cpp b/lib/mesa/generated/src/compiler/glsl/glsl_lexer.cpp index ae4a1a77f..4a1aef258 100644 --- a/lib/mesa/generated/src/compiler/glsl/glsl_lexer.cpp +++ b/lib/mesa/generated/src/compiler/glsl/glsl_lexer.cpp @@ -4,7 +4,7 @@ #define YY_INT_ALIGNED short int -/* $OpenBSD: glsl_lexer.cpp,v 1.7 2022/02/24 02:52:28 jsg Exp $ */ +/* $OpenBSD: glsl_lexer.cpp,v 1.8 2022/04/21 04:37:17 jsg Exp $ */ /* A lexical scanner generated by flex */ @@ -26,7 +26,7 @@ /* end standard C headers. */ -/* $OpenBSD: glsl_lexer.cpp,v 1.7 2022/02/24 02:52:28 jsg Exp $ */ +/* $OpenBSD: glsl_lexer.cpp,v 1.8 2022/04/21 04:37:17 jsg Exp $ */ /* flex integer type definitions */ diff --git a/lib/mesa/generated/src/mesa/program/lex.yy.c b/lib/mesa/generated/src/mesa/program/lex.yy.c index 9a6e5cc5e..dad31476a 100644 --- a/lib/mesa/generated/src/mesa/program/lex.yy.c +++ b/lib/mesa/generated/src/mesa/program/lex.yy.c @@ -4,7 +4,7 @@ #define YY_INT_ALIGNED short int -/* $OpenBSD: lex.yy.c,v 1.7 2022/02/24 02:52:29 jsg Exp $ */ +/* $OpenBSD: lex.yy.c,v 1.8 2022/04/21 04:37:17 jsg Exp $ */ /* A lexical scanner generated by flex */ @@ -26,7 +26,7 @@ /* end standard C headers. */ -/* $OpenBSD: lex.yy.c,v 1.7 2022/02/24 02:52:29 jsg Exp $ */ +/* $OpenBSD: lex.yy.c,v 1.8 2022/04/21 04:37:17 jsg Exp $ */ /* flex integer type definitions */ diff --git a/lib/mesa/generated/src/util/driconf_static.h b/lib/mesa/generated/src/util/driconf_static.h index 1d2895e22..0301b31bd 100644 --- a/lib/mesa/generated/src/util/driconf_static.h +++ b/lib/mesa/generated/src/util/driconf_static.h @@ -1958,285 +1958,62 @@ static const struct driconf_device device_399 = { .num_applications = 1, .applications = device_399_applications, }; - -static const struct driconf_option engine_447_options[] = { - { .name = "radv_zero_vram", .value = "true" }, -}; - - -static const struct driconf_option engine_449_options[] = { - { .name = "radv_zero_vram", .value = "true" }, - { .name = "radv_lower_discard_to_demote", .value = "true" }, - { .name = "radv_disable_tc_compat_htile_general", .value = "true" }, -}; -static const struct driconf_engine device_402_engines[] = { - { .engine_name_match = "vkd3d", - .num_options = 1, - .options = engine_447_options, - }, - { .engine_name_match = "Quantic Dream Engine", - .num_options = 3, - .options = engine_449_options, - }, -}; - static const struct driconf_option application_403_options[] = { - { .name = "radv_report_llvm9_version_string", .value = "true" }, - { .name = "radv_invariant_geom", .value = "true" }, -}; - - -static const struct driconf_option application_406_options[] = { - { .name = "radv_invariant_geom", .value = "true" }, -}; - - -static const struct driconf_option application_408_options[] = { - { .name = "radv_enable_mrt_output_nan_fixup", .value = "true" }, -}; - - -static const struct driconf_option application_410_options[] = { - { .name = "radv_no_dynamic_bounds", .value = "true" }, - { .name = "radv_absolute_depth_bias", .value = "true" }, -}; - - -static const struct driconf_option application_413_options[] = { - { .name = "radv_no_dynamic_bounds", .value = "true" }, - { .name = "radv_absolute_depth_bias", .value = "true" }, -}; - - -static const struct driconf_option application_416_options[] = { - { .name = "radv_no_dynamic_bounds", .value = "true" }, - { .name = "radv_absolute_depth_bias", .value = "true" }, -}; - - -static const struct driconf_option application_419_options[] = { - { .name = "radv_no_dynamic_bounds", .value = "true" }, - { .name = "radv_absolute_depth_bias", .value = "true" }, -}; - - -static const struct driconf_option application_422_options[] = { - { .name = "radv_disable_shrink_image_store", .value = "true" }, - { .name = "radv_zero_vram", .value = "true" }, -}; - - -static const struct driconf_option application_425_options[] = { - { .name = "radv_override_uniform_offset_alignment", .value = "16" }, - { .name = "radv_disable_shrink_image_store", .value = "true" }, - { .name = "radv_invariant_geom", .value = "true" }, -}; - - -static const struct driconf_option application_429_options[] = { - { .name = "radv_no_dynamic_bounds", .value = "true" }, -}; - - -static const struct driconf_option application_431_options[] = { - { .name = "radv_zero_vram", .value = "true" }, -}; - - -static const struct driconf_option application_433_options[] = { - { .name = "radv_lower_discard_to_demote", .value = "true" }, -}; - - -static const struct driconf_option application_435_options[] = { - { .name = "radv_invariant_geom", .value = "true" }, -}; - - -static const struct driconf_option application_437_options[] = { - { .name = "radv_disable_dcc", .value = "true" }, -}; - - -static const struct driconf_option application_439_options[] = { - { .name = "radv_disable_dcc", .value = "true" }, -}; - - -static const struct driconf_option application_441_options[] = { - { .name = "radv_report_apu_as_dgpu", .value = "true" }, -}; - - -static const struct driconf_option application_443_options[] = { - { .name = "radv_invariant_geom", .value = "true" }, -}; - - -static const struct driconf_option application_445_options[] = { - { .name = "radv_disable_htile_layers", .value = "true" }, -}; - - -static const struct driconf_application device_402_applications[] = { - { .name = "Shadow Of The Tomb Raider (Native)", - .application_name_match = "ShadowOfTheTomb", - .num_options = 2, - .options = application_403_options, - }, - { .name = "Shadow Of The Tomb Raider (DX11/DX12)", - .application_name_match = "SOTTR.exe", - .num_options = 1, - .options = application_406_options, - }, - { .name = "RAGE 2", - .executable = "RAGE2.exe", - .num_options = 1, - .options = application_408_options, - }, - { .name = "Path of Exile (64-bit, Steam)", - .executable = "PathOfExile_x64Steam.exe", - .num_options = 2, - .options = application_410_options, - }, - { .name = "Path of Exile (32-bit, Steam)", - .executable = "PathOfExileSteam.exe", - .num_options = 2, - .options = application_413_options, - }, - { .name = "Path of Exile (64-bit)", - .executable = "PathOfExile_x64.exe", - .num_options = 2, - .options = application_416_options, - }, - { .name = "Path of Exile (32-bit)", - .executable = "PathOfExile.exe", - .num_options = 2, - .options = application_419_options, - }, - { .name = "The Surge 2", - .application_name_match = "Fledge", - .num_options = 2, - .options = application_422_options, - }, - { .name = "World War Z (and World War Z: Aftermath)", - .application_name_match = "WWZ|wwz", - .num_options = 3, - .options = application_425_options, - }, - { .name = "DOOM VFR", - .application_name_match = "DOOM_VFR", - .num_options = 1, - .options = application_429_options, - }, - { .name = "DOOM Eternal", - .application_name_match = "DOOMEternal", - .num_options = 1, - .options = application_431_options, - }, - { .name = "No Man's Sky", - .application_name_match = "No Man's Sky", - .num_options = 1, - .options = application_433_options, - }, - { .name = "Monster Hunter World", - .application_name_match = "MonsterHunterWorld.exe", - .num_options = 1, - .options = application_435_options, - }, - { .name = "DOOM (2016)", - .application_name_match = "DOOM$", - .num_options = 1, - .options = application_437_options, - }, - { .name = "Wolfenstein II", - .application_name_match = "Wolfenstein II The New Colossus", - .num_options = 1, - .options = application_439_options, - }, - { .name = "RDR2", - .application_name_match = "Red Dead Redemption 2", - .num_options = 1, - .options = application_441_options, - }, - { .name = "Resident Evil Village", - .application_name_match = "re8.exe", - .num_options = 1, - .options = application_443_options, - }, - { .name = "F1 2021", - .application_name_match = "F1_2021_dx12.exe", - .num_options = 1, - .options = application_445_options, - }, -}; - -static const struct driconf_device device_402 = { - .driver = "radv", - .num_engines = 2, - .engines = device_402_engines, - .num_applications = 18, - .applications = device_402_applications, -}; - - - -static const struct driconf_option application_454_options[] = { { .name = "force_gl_renderer", .value = "Adreno (TM) 618" }, { .name = "force_gl_vendor", .value = "Qualcomm" }, }; -static const struct driconf_option application_457_options[] = { +static const struct driconf_option application_406_options[] = { { .name = "force_gl_renderer", .value = "Adreno (TM) 630" }, { .name = "force_gl_vendor", .value = "Qualcomm" }, }; -static const struct driconf_option application_460_options[] = { +static const struct driconf_option application_409_options[] = { { .name = "force_gl_renderer", .value = "Adreno (TM) 618" }, { .name = "force_gl_vendor", .value = "Qualcomm" }, }; -static const struct driconf_option application_463_options[] = { +static const struct driconf_option application_412_options[] = { { .name = "force_gl_renderer", .value = "Adreno (TM) 630" }, { .name = "force_gl_vendor", .value = "Qualcomm" }, }; -static const struct driconf_application device_453_applications[] = { +static const struct driconf_application device_402_applications[] = { { .name = "Call of Duty Mobile", .executable = "com.activision.callofduty.shooter", .num_options = 2, - .options = application_454_options, + .options = application_403_options, }, { .name = "Asphalt 8", .executable = "com.gameloft.android.ANMP.GloftA8HM", .num_options = 2, - .options = application_457_options, + .options = application_406_options, }, { .name = "Asphalt 9", .executable = "com.gameloft.android.ANMP.GloftA9HM", .num_options = 2, - .options = application_460_options, + .options = application_409_options, }, { .name = "PUBG Mobile", .executable = "com.tencent.ig", .num_options = 2, - .options = application_463_options, + .options = application_412_options, }, }; -static const struct driconf_device device_453 = { +static const struct driconf_device device_402 = { .driver = "msm", .device = "FD618", .num_engines = 0, .num_applications = 4, - .applications = device_453_applications, + .applications = device_402_applications, }; static const struct driconf_device *driconf[] = { @@ -2246,5 +2023,4 @@ static const struct driconf_device *driconf[] = { &device_396, &device_399, &device_402, - &device_453, }; diff --git a/lib/mesa/include/CL/cl_d3d10.h b/lib/mesa/include/CL/cl_d3d10.h index 509f07992..1ad0718af 100644 --- a/lib/mesa/include/CL/cl_d3d10.h +++ b/lib/mesa/include/CL/cl_d3d10.h @@ -26,7 +26,7 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ -/* $Revision: 1.23 $ on $Date: 2022/02/24 02:29:48 $ */ +/* $Revision: 1.24 $ on $Date: 2022/04/21 04:37:18 $ */ #ifndef __OPENCL_CL_D3D10_H #define __OPENCL_CL_D3D10_H diff --git a/lib/mesa/include/CL/cl_d3d11.h b/lib/mesa/include/CL/cl_d3d11.h index 128bbf03f..700cb5aea 100644 --- a/lib/mesa/include/CL/cl_d3d11.h +++ b/lib/mesa/include/CL/cl_d3d11.h @@ -26,7 +26,7 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ -/* $Revision: 1.23 $ on $Date: 2022/02/24 02:29:48 $ */ +/* $Revision: 1.24 $ on $Date: 2022/04/21 04:37:18 $ */ #ifndef __OPENCL_CL_D3D11_H #define __OPENCL_CL_D3D11_H diff --git a/lib/mesa/include/CL/cl_dx9_media_sharing.h b/lib/mesa/include/CL/cl_dx9_media_sharing.h index e34e8c21c..01b7a8e0a 100644 --- a/lib/mesa/include/CL/cl_dx9_media_sharing.h +++ b/lib/mesa/include/CL/cl_dx9_media_sharing.h @@ -26,7 +26,7 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ -/* $Revision: 1.23 $ on $Date: 2022/02/24 02:29:48 $ */ +/* $Revision: 1.24 $ on $Date: 2022/04/21 04:37:18 $ */ #ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H #define __OPENCL_CL_DX9_MEDIA_SHARING_H diff --git a/lib/mesa/include/CL/opencl.h b/lib/mesa/include/CL/opencl.h index c61094100..e017d56b0 100644 --- a/lib/mesa/include/CL/opencl.h +++ b/lib/mesa/include/CL/opencl.h @@ -26,7 +26,7 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ******************************************************************************/ -/* $Revision: 1.23 $ on $Date: 2022/02/24 02:29:48 $ */ +/* $Revision: 1.24 $ on $Date: 2022/04/21 04:37:18 $ */ #ifndef __OPENCL_H #define __OPENCL_H diff --git a/lib/mesa/include/EGL/eglplatform.h b/lib/mesa/include/EGL/eglplatform.h index 67d6c1f4e..d9c5f2e48 100644 --- a/lib/mesa/include/EGL/eglplatform.h +++ b/lib/mesa/include/EGL/eglplatform.h @@ -25,7 +25,7 @@ */ /* Platform-specific types and definitions for egl.h - * $Revision: 1.23 $ on $Date: 2022/02/24 02:29:48 $ + * $Revision: 1.24 $ on $Date: 2022/04/21 04:37:18 $ * * Adopters may modify khrplatform.h and this file to suit their platform. * You are encouraged to submit all modifications to the Khronos group so that diff --git a/lib/mesa/include/GLES3/gl3ext.h b/lib/mesa/include/GLES3/gl3ext.h index 49b62f16e..7cf85d855 100644 --- a/lib/mesa/include/GLES3/gl3ext.h +++ b/lib/mesa/include/GLES3/gl3ext.h @@ -1,7 +1,7 @@ #ifndef __gl3ext_h_ #define __gl3ext_h_ -/* $Revision: 1.23 $ on $Date: 2022/02/24 02:29:48 $ */ +/* $Revision: 1.24 $ on $Date: 2022/04/21 04:37:18 $ */ /* * This document is licensed under the SGI Free Software B License Version diff --git a/lib/mesa/meson.build b/lib/mesa/meson.build index 18fafff75..833b4369b 100644 --- a/lib/mesa/meson.build +++ b/lib/mesa/meson.build @@ -39,6 +39,13 @@ if get_option('layout') != 'mirror' error('`mirror` is the only build directory layout supported') endif +amber = get_option('amber') +if amber + package_version_suffix=' Amber' +else + package_version_suffix='' +endif + # Arguments for the preprocessor, put these in a separate array from the C and # C++ (cpp in meson terminology) arguments since they need to be added to the # default arguments for both C and C++. @@ -46,13 +53,18 @@ pre_args = [ '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', - '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()), + '-DPACKAGE_VERSION="@0@@1@"'.format(meson.project_version(), package_version_suffix), '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"', ] c_args = [] cpp_args = [] with_moltenvk_dir = get_option('moltenvk-dir') + +if amber + pre_args += '-DAMBER' +endif + with_vulkan_icd_dir = get_option('vulkan-icd-dir') with_tests = get_option('build-tests') with_aco_tests = get_option('build-aco-tests') @@ -199,7 +211,9 @@ with_dri = dri_drivers.length() != 0 gallium_drivers = get_option('gallium-drivers') if gallium_drivers.contains('auto') - if system_has_kms_drm + if amber + gallium_drivers = [] + elif system_has_kms_drm # TODO: PPC, Sparc if ['x86', 'x86_64'].contains(host_machine.cpu_family()) gallium_drivers = [ @@ -262,7 +276,9 @@ endif _vulkan_drivers = get_option('vulkan-drivers') if _vulkan_drivers.contains('auto') if system_has_kms_drm - if host_machine.cpu_family().startswith('x86') + if amber + _vulkan_drivers = [] + elif host_machine.cpu_family().startswith('x86') _vulkan_drivers = ['amd', 'intel', 'swrast'] elif ['arm', 'aarch64'].contains(host_machine.cpu_family()) _vulkan_drivers = ['swrast'] @@ -531,8 +547,22 @@ if with_glx != 'disabled' endif endif -with_glvnd = get_option('glvnd') +_glvnd = get_option('glvnd') +if _glvnd == 'true' or _glvnd == 'enabled' or (amber and _glvnd == 'auto') + with_glvnd = true +else + with_glvnd = false +endif + glvnd_vendor_name = get_option('glvnd-vendor-name') +if glvnd_vendor_name == 'auto' + if amber + glvnd_vendor_name = 'amber' + else + glvnd_vendor_name = 'mesa' + endif +endif + if with_glvnd if with_platform_windows error('glvnd cannot be used on Windows') diff --git a/lib/mesa/mk/libmesa_util/Makefile b/lib/mesa/mk/libmesa_util/Makefile index b39e14df4..dcd48e774 100644 --- a/lib/mesa/mk/libmesa_util/Makefile +++ b/lib/mesa/mk/libmesa_util/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2022/02/25 23:36:14 jsg Exp $ +# $OpenBSD: Makefile,v 1.6 2022/04/21 04:37:18 jsg Exp $ LIB= mesa_util diff --git a/lib/mesa/src/amd/common/ac_gpu_info.c b/lib/mesa/src/amd/common/ac_gpu_info.c index 5893f6640..ed57fd850 100644 --- a/lib/mesa/src/amd/common/ac_gpu_info.c +++ b/lib/mesa/src/amd/common/ac_gpu_info.c @@ -1080,6 +1080,8 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info, } info->has_3d_cube_border_color_mipmap = info->has_graphics || info->family == CHIP_ARCTURUS; + info->never_stop_sq_perf_counters = info->chip_class == GFX10 || + info->chip_class == GFX10_3; info->max_sgpr_alloc = info->family == CHIP_TONGA || info->family == CHIP_ICELAND ? 96 : 104; if (!info->has_graphics && info->family >= CHIP_ALDEBARAN) { @@ -1168,6 +1170,7 @@ void ac_print_gpu_info(struct radeon_info *info, FILE *f) fprintf(f, " has_ls_vgpr_init_bug = %i\n", info->has_ls_vgpr_init_bug); fprintf(f, " has_32bit_predication = %i\n", info->has_32bit_predication); fprintf(f, " has_3d_cube_border_color_mipmap = %i\n", info->has_3d_cube_border_color_mipmap); + fprintf(f, " never_stop_sq_perf_counters = %i\n", info->never_stop_sq_perf_counters); fprintf(f, "Display features:\n"); fprintf(f, " use_display_dcc_unaligned = %u\n", info->use_display_dcc_unaligned); diff --git a/lib/mesa/src/amd/common/ac_gpu_info.h b/lib/mesa/src/amd/common/ac_gpu_info.h index 142156a52..8b989d0d5 100644 --- a/lib/mesa/src/amd/common/ac_gpu_info.h +++ b/lib/mesa/src/amd/common/ac_gpu_info.h @@ -83,6 +83,7 @@ struct radeon_info { bool has_cs_regalloc_hang_bug; bool has_32bit_predication; bool has_3d_cube_border_color_mipmap; + bool never_stop_sq_perf_counters; /* Display features. */ /* There are 2 display DCC codepaths, because display expects unaligned DCC. */ diff --git a/lib/mesa/src/amd/vulkan/radv_pipeline.c b/lib/mesa/src/amd/vulkan/radv_pipeline.c index bd2c3361c..8ac786dea 100644 --- a/lib/mesa/src/amd/vulkan/radv_pipeline.c +++ b/lib/mesa/src/amd/vulkan/radv_pipeline.c @@ -2711,6 +2711,7 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline, key.invariant_geom = true; key.use_ngg = pipeline->device->physical_device->use_ngg; + key.adjust_frag_coord_z = pipeline->device->adjust_frag_coord_z; return key; } diff --git a/lib/mesa/src/amd/vulkan/radv_shader.c b/lib/mesa/src/amd/vulkan/radv_shader.c index 0cb330df5..a152aa56c 100644 --- a/lib/mesa/src/amd/vulkan/radv_shader.c +++ b/lib/mesa/src/amd/vulkan/radv_shader.c @@ -1762,7 +1762,7 @@ shader_variant_compile(struct radv_device *device, struct vk_shader_module *modu options->has_ls_vgpr_init_bug = device->physical_device->rad_info.has_ls_vgpr_init_bug; options->enable_mrt_output_nan_fixup = module && !module->nir && options->key.ps.enable_mrt_output_nan_fixup; - options->adjust_frag_coord_z = device->adjust_frag_coord_z; + options->adjust_frag_coord_z = options->key.adjust_frag_coord_z; options->has_image_load_dcc_bug = device->physical_device->rad_info.has_image_load_dcc_bug; options->debug.func = radv_compiler_debug; options->debug.private_data = &debug_data; diff --git a/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index ee804003c..8abed8703 100644 --- a/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/lib/mesa/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -316,7 +316,7 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, draw->rasterizer->clip_halfz, (draw->vs.edgeflag_output ? TRUE : FALSE) ); - draw_pt_so_emit_prepare( fpme->so_emit, gs == NULL ); + draw_pt_so_emit_prepare( fpme->so_emit, (gs == NULL && tes == NULL)); if (!(opt & PT_PIPELINE)) { draw_pt_emit_prepare( fpme->emit, out_prim, diff --git a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 0c9a41aeb..19bd8463d 100644 --- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -1726,7 +1726,10 @@ lp_build_cube_imapos(struct lp_build_context *coord_bld, LLVMValueRef coord) /* ima = +0.5 / abs(coord); */ LLVMValueRef posHalf = lp_build_const_vec(coord_bld->gallivm, coord_bld->type, 0.5); LLVMValueRef absCoord = lp_build_abs(coord_bld, coord); - LLVMValueRef ima = lp_build_div(coord_bld, posHalf, absCoord); + /* avoid div by zero */ + LLVMValueRef sel = lp_build_cmp(coord_bld, PIPE_FUNC_GREATER, absCoord, coord_bld->zero); + LLVMValueRef div = lp_build_div(coord_bld, posHalf, absCoord); + LLVMValueRef ima = lp_build_select(coord_bld, sel, div, coord_bld->zero); return ima; } diff --git a/lib/mesa/src/gallium/auxiliary/util/u_threaded_context.c b/lib/mesa/src/gallium/auxiliary/util/u_threaded_context.c index 8eb7f86f1..6cbe2567c 100644 --- a/lib/mesa/src/gallium/auxiliary/util/u_threaded_context.c +++ b/lib/mesa/src/gallium/auxiliary/util/u_threaded_context.c @@ -2148,11 +2148,9 @@ tc_buffer_map(struct pipe_context *_pipe, * only get resource_copy_region. */ if (usage & PIPE_MAP_DISCARD_RANGE) { - struct threaded_transfer *ttrans = slab_alloc(&tc->pool_transfers); + struct threaded_transfer *ttrans = slab_zalloc(&tc->pool_transfers); uint8_t *map; - ttrans->staging = NULL; - u_upload_alloc(tc->base.stream_uploader, 0, box->width + (box->x % tc->map_buffer_alignment), tc->map_buffer_alignment, &ttrans->b.offset, diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/lp_surface.c b/lib/mesa/src/gallium/drivers/llvmpipe/lp_surface.c index 8e905b8d7..ef5821bce 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/lib/mesa/src/gallium/drivers/llvmpipe/lp_surface.c @@ -311,6 +311,9 @@ llvmpipe_clear_render_target(struct pipe_context *pipe, if (render_condition_enabled && !llvmpipe_check_render_cond(llvmpipe)) return; + width = MIN2(width, dst->texture->width0 - dstx); + height = MIN2(height, dst->texture->height0 - dsty); + if (dst->texture->nr_samples > 1) { struct pipe_box box; u_box_2d(dstx, dsty, width, height, &box); @@ -379,6 +382,9 @@ llvmpipe_clear_depth_stencil(struct pipe_context *pipe, if (render_condition_enabled && !llvmpipe_check_render_cond(llvmpipe)) return; + width = MIN2(width, dst->texture->width0 - dstx); + height = MIN2(height, dst->texture->height0 - dsty); + if (dst->texture->nr_samples > 1) { uint64_t zstencil = util_pack64_z_stencil(dst->format, depth, stencil); struct pipe_box box; diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c b/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c index d235c8db5..a1daca18f 100644 --- a/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/lib/mesa/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1367,6 +1367,12 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch, for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) { struct panfrost_sampler_view *view = ctx->sampler_views[stage][i]; + + if (!view) { + memset(&out[i], 0, sizeof(out[i])); + continue; + } + struct pipe_sampler_view *pview = &view->base; struct panfrost_resource *rsrc = pan_resource(pview->texture); @@ -1379,11 +1385,14 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch, return T.gpu; #else - uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS]; + uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS] = { 0 }; for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) { struct panfrost_sampler_view *view = ctx->sampler_views[stage][i]; + if (!view) + continue; + panfrost_update_sampler_view(view, &ctx->base); trampolines[i] = panfrost_get_tex_desc(batch, stage, view); @@ -1411,8 +1420,11 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch, SAMPLER); struct mali_sampler_packed *out = (struct mali_sampler_packed *) T.cpu; - for (unsigned i = 0; i < ctx->sampler_count[stage]; ++i) - out[i] = ctx->samplers[stage][i]->hw; + for (unsigned i = 0; i < ctx->sampler_count[stage]; ++i) { + struct panfrost_sampler_state *st = ctx->samplers[stage][i]; + + out[i] = st ? st->hw : (struct mali_sampler_packed){0}; + } return T.gpu; } diff --git a/lib/mesa/src/gallium/drivers/radeonsi/si_perfcounter.c b/lib/mesa/src/gallium/drivers/radeonsi/si_perfcounter.c index 0bee2f7d0..ee996f525 100644 --- a/lib/mesa/src/gallium/drivers/radeonsi/si_perfcounter.c +++ b/lib/mesa/src/gallium/drivers/radeonsi/si_perfcounter.c @@ -158,7 +158,10 @@ static void si_pc_emit_stop(struct si_context *sctx, struct si_resource *buffer, radeon_emit(EVENT_TYPE(V_028A90_PERFCOUNTER_STOP) | EVENT_INDEX(0)); radeon_set_uconfig_reg( R_036020_CP_PERFMON_CNTL, - S_036020_PERFMON_STATE(V_036020_CP_PERFMON_STATE_STOP_COUNTING) | S_036020_PERFMON_SAMPLE_ENABLE(1)); + S_036020_PERFMON_STATE(sctx->screen->info.never_stop_sq_perf_counters ? + V_036020_CP_PERFMON_STATE_START_COUNTING : + V_036020_CP_PERFMON_STATE_STOP_COUNTING) | + S_036020_PERFMON_SAMPLE_ENABLE(1)); radeon_end(); } diff --git a/lib/mesa/src/gallium/drivers/radeonsi/si_pm4.c b/lib/mesa/src/gallium/drivers/radeonsi/si_pm4.c index ae4affa1b..d4ea07692 100644 --- a/lib/mesa/src/gallium/drivers/radeonsi/si_pm4.c +++ b/lib/mesa/src/gallium/drivers/radeonsi/si_pm4.c @@ -137,7 +137,7 @@ void si_pm4_reset_emitted(struct si_context *sctx, bool first_cs) * added to the buffer list on the next draw call. */ for (unsigned i = 0; i < SI_NUM_STATES; i++) { - struct si_pm4_state *state = sctx->emitted.array[i]; + struct si_pm4_state *state = sctx->queued.array[i]; if (state && state->is_shader) { sctx->emitted.array[i] = NULL; diff --git a/lib/mesa/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/lib/mesa/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 22d8b98ac..80b1698af 100644 --- a/lib/mesa/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/lib/mesa/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -608,6 +608,7 @@ static bool do_winsys_init(struct radeon_drm_winsys *ws) ws->info.num_physical_sgprs_per_simd = 512; ws->info.num_physical_wave64_vgprs_per_simd = 256; ws->info.has_3d_cube_border_color_mipmap = true; + ws->info.never_stop_sq_perf_counters = false; ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL || strstr(debug_get_option("AMD_DEBUG", ""), "check_vm") != NULL; diff --git a/lib/mesa/src/getopt/getopt.h b/lib/mesa/src/getopt/getopt.h index 3112b7dad..82a5aba39 100644 --- a/lib/mesa/src/getopt/getopt.h +++ b/lib/mesa/src/getopt/getopt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt.h,v 1.23 2022/02/24 02:30:02 jsg Exp $ */ +/* $OpenBSD: getopt.h,v 1.24 2022/04/21 04:37:19 jsg Exp $ */ /* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ /*- diff --git a/lib/mesa/src/getopt/getopt_long.c b/lib/mesa/src/getopt/getopt_long.c index c05408df8..ec74644bc 100644 --- a/lib/mesa/src/getopt/getopt_long.c +++ b/lib/mesa/src/getopt/getopt_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.23 2022/02/24 02:30:02 jsg Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.24 2022/04/21 04:37:19 jsg Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* diff --git a/lib/mesa/src/intel/compiler/brw_fs.cpp b/lib/mesa/src/intel/compiler/brw_fs.cpp index 62181cb7c..bb6e1e338 100644 --- a/lib/mesa/src/intel/compiler/brw_fs.cpp +++ b/lib/mesa/src/intel/compiler/brw_fs.cpp @@ -8936,7 +8936,12 @@ fs_visitor::allocate_registers(bool allow_spilling) if (last_scratch > 0) { ASSERTED unsigned max_scratch_size = 2 * 1024 * 1024; - prog_data->total_scratch = brw_get_scratch_size(last_scratch); + /* Take the max of any previously compiled variant of the shader. In the + * case of bindless shaders with return parts, this will also take the + * max of all parts. + */ + prog_data->total_scratch = MAX2(brw_get_scratch_size(last_scratch), + prog_data->total_scratch); if (stage == MESA_SHADER_COMPUTE || stage == MESA_SHADER_KERNEL) { if (devinfo->is_haswell) { @@ -9721,6 +9726,7 @@ brw_compile_fs(const struct brw_compiler *compiler, INTEL_DEBUG(params->debug_flag ? params->debug_flag : DEBUG_WM); prog_data->base.stage = MESA_SHADER_FRAGMENT; + prog_data->base.total_scratch = 0; const struct intel_device_info *devinfo = compiler->devinfo; const unsigned max_subgroup_size = compiler->devinfo->ver >= 6 ? 32 : 16; @@ -10110,6 +10116,7 @@ brw_compile_cs(const struct brw_compiler *compiler, prog_data->base.stage = MESA_SHADER_COMPUTE; prog_data->base.total_shared = nir->info.shared_size; + prog_data->base.total_scratch = 0; /* Generate code for all the possible SIMD variants. */ bool generate_all; @@ -10523,6 +10530,7 @@ brw_compile_bs(const struct brw_compiler *compiler, void *log_data, const bool debug_enabled = INTEL_DEBUG(DEBUG_RT); prog_data->base.stage = shader->info.stage; + prog_data->base.total_scratch = 0; prog_data->max_stack_size = 0; fs_generator g(compiler, log_data, mem_ctx, &prog_data->base, diff --git a/lib/mesa/src/intel/compiler/brw_shader.h b/lib/mesa/src/intel/compiler/brw_shader.h index 8d0c9c6b1..adf769a42 100644 --- a/lib/mesa/src/intel/compiler/brw_shader.h +++ b/lib/mesa/src/intel/compiler/brw_shader.h @@ -121,7 +121,7 @@ extern const char *const conditional_modifier[16]; extern const char *const pred_ctrl_align16[16]; /* Per-thread scratch space is a power-of-two multiple of 1KB. */ -static inline int +static inline unsigned brw_get_scratch_size(int size) { return MAX2(1024, util_next_power_of_two(size)); diff --git a/lib/mesa/src/intel/compiler/brw_vec4.cpp b/lib/mesa/src/intel/compiler/brw_vec4.cpp index 72165932c..52fdc67c8 100644 --- a/lib/mesa/src/intel/compiler/brw_vec4.cpp +++ b/lib/mesa/src/intel/compiler/brw_vec4.cpp @@ -2896,6 +2896,7 @@ brw_compile_vs(const struct brw_compiler *compiler, INTEL_DEBUG(params->debug_flag ? params->debug_flag : DEBUG_VS); prog_data->base.base.stage = MESA_SHADER_VERTEX; + prog_data->base.base.total_scratch = 0; const bool is_scalar = compiler->scalar_stage[MESA_SHADER_VERTEX]; brw_nir_apply_key(nir, compiler, &key->base, 8, is_scalar); diff --git a/lib/mesa/src/intel/compiler/brw_vec4_gs_visitor.cpp b/lib/mesa/src/intel/compiler/brw_vec4_gs_visitor.cpp index 1b55e9234..8032fa30b 100644 --- a/lib/mesa/src/intel/compiler/brw_vec4_gs_visitor.cpp +++ b/lib/mesa/src/intel/compiler/brw_vec4_gs_visitor.cpp @@ -600,6 +600,7 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data, const bool debug_enabled = INTEL_DEBUG(DEBUG_GS); prog_data->base.base.stage = MESA_SHADER_GEOMETRY; + prog_data->base.base.total_scratch = 0; /* The GLSL linker will have already matched up GS inputs and the outputs * of prior stages. The driver does extend VS outputs in some cases, but diff --git a/lib/mesa/src/intel/compiler/brw_vec4_tcs.cpp b/lib/mesa/src/intel/compiler/brw_vec4_tcs.cpp index 167f8a353..ea212c9c4 100644 --- a/lib/mesa/src/intel/compiler/brw_vec4_tcs.cpp +++ b/lib/mesa/src/intel/compiler/brw_vec4_tcs.cpp @@ -372,6 +372,7 @@ brw_compile_tcs(const struct brw_compiler *compiler, const unsigned *assembly; vue_prog_data->base.stage = MESA_SHADER_TESS_CTRL; + prog_data->base.base.total_scratch = 0; nir->info.outputs_written = key->outputs_written; nir->info.patch_outputs_written = key->patch_outputs_written; diff --git a/lib/mesa/src/intel/vulkan/anv_pipeline.c b/lib/mesa/src/intel/vulkan/anv_pipeline.c index f86ce8ec0..fee7e04b3 100644 --- a/lib/mesa/src/intel/vulkan/anv_pipeline.c +++ b/lib/mesa/src/intel/vulkan/anv_pipeline.c @@ -233,6 +233,12 @@ anv_shader_compile_to_nir(struct anv_device *device, */ NIR_PASS_V(nir, nir_lower_variable_initializers, ~0); + const nir_opt_access_options opt_access_options = { + .is_vulkan = true, + .infer_non_readable = true, + }; + NIR_PASS_V(nir, nir_opt_access, &opt_access_options); + /* Split member structs. We do this before lower_io_to_temporaries so that * it doesn't lower system values to temporaries by accident. */ diff --git a/lib/mesa/src/intel/vulkan/genX_cmd_buffer.c b/lib/mesa/src/intel/vulkan/genX_cmd_buffer.c index 8b249093b..cf7629f2f 100644 --- a/lib/mesa/src/intel/vulkan/genX_cmd_buffer.c +++ b/lib/mesa/src/intel/vulkan/genX_cmd_buffer.c @@ -1413,14 +1413,22 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer, anv_layout_to_aux_usage(devinfo, image, aspect, 0, initial_layout); enum isl_aux_usage final_aux_usage = anv_layout_to_aux_usage(devinfo, image, aspect, 0, final_layout); + enum anv_fast_clear_type initial_fast_clear = + anv_layout_to_fast_clear_type(devinfo, image, aspect, initial_layout); + enum anv_fast_clear_type final_fast_clear = + anv_layout_to_fast_clear_type(devinfo, image, aspect, final_layout); /* We must override the anv_layout_to_* functions because they are unaware of * acquire/release direction. */ if (mod_acquire) { initial_aux_usage = isl_mod_info->aux_usage; + initial_fast_clear = isl_mod_info->supports_clear_color ? + initial_fast_clear : ANV_FAST_CLEAR_NONE; } else if (mod_release) { final_aux_usage = isl_mod_info->aux_usage; + final_fast_clear = isl_mod_info->supports_clear_color ? + final_fast_clear : ANV_FAST_CLEAR_NONE; } /* The current code assumes that there is no mixing of CCS_E and CCS_D. @@ -1443,10 +1451,6 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer, /* If the initial layout supports more fast clear than the final layout * then we need at least a partial resolve. */ - const enum anv_fast_clear_type initial_fast_clear = - anv_layout_to_fast_clear_type(devinfo, image, aspect, initial_layout); - const enum anv_fast_clear_type final_fast_clear = - anv_layout_to_fast_clear_type(devinfo, image, aspect, final_layout); if (final_fast_clear < initial_fast_clear) resolve_op = ISL_AUX_OP_PARTIAL_RESOLVE; @@ -1822,7 +1826,7 @@ genX(BeginCommandBuffer)( const struct anv_image_view * const iview = anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); - if (iview) { + if (iview && (iview->image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) { VkImageLayout layout = cmd_buffer->state.subpass->depth_stencil_attachment->layout; @@ -4206,6 +4210,9 @@ void genX(CmdDrawIndirectByteCountEXT)( genX(cmd_buffer_flush_state)(cmd_buffer); + if (cmd_buffer->state.conditional_render_enabled) + genX(cmd_emit_conditional_render_predicate)(cmd_buffer); + if (vs_prog_data->uses_firstvertex || vs_prog_data->uses_baseinstance) emit_base_vertex_instance(cmd_buffer, firstVertex, firstInstance); @@ -4240,6 +4247,7 @@ void genX(CmdDrawIndirectByteCountEXT)( anv_batch_emit(&cmd_buffer->batch, GENX(3DPRIMITIVE), prim) { prim.IndirectParameterEnable = true; + prim.PredicateEnable = cmd_buffer->state.conditional_render_enabled; prim.VertexAccessType = SEQUENTIAL; prim.PrimitiveTopologyType = cmd_buffer->state.gfx.primitive_topology; } diff --git a/lib/mesa/src/mesa/main/fbobject.c b/lib/mesa/src/mesa/main/fbobject.c index a848c1df7..9f6c6397b 100644 --- a/lib/mesa/src/mesa/main/fbobject.c +++ b/lib/mesa/src/mesa/main/fbobject.c @@ -5192,9 +5192,19 @@ static void discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei numAttachments, const GLenum *attachments) { + GLenum depth_att, stencil_att; + if (!ctx->Driver.DiscardFramebuffer) return; + if (_mesa_is_user_fbo(fb)) { + depth_att = GL_DEPTH_ATTACHMENT; + stencil_att = GL_STENCIL_ATTACHMENT; + } else { + depth_att = GL_DEPTH; + stencil_att = GL_STENCIL; + } + for (int i = 0; i < numAttachments; i++) { struct gl_renderbuffer_attachment *att = get_fb_attachment(ctx, fb, attachments[i]); @@ -5207,12 +5217,12 @@ discard_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, * Driver.DiscardFramebuffer if the attachments list includes both depth * and stencil and they both point at the same renderbuffer. */ - if ((attachments[i] == GL_DEPTH_ATTACHMENT || - attachments[i] == GL_STENCIL_ATTACHMENT) && + if ((attachments[i] == depth_att || + attachments[i] == stencil_att) && (!att->Renderbuffer || att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL)) { - GLenum other_format = (attachments[i] == GL_DEPTH_ATTACHMENT ? - GL_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT); + GLenum other_format = (attachments[i] == depth_att ? + stencil_att : depth_att); bool has_both = false; for (int j = 0; j < numAttachments; j++) { if (attachments[j] == other_format) { diff --git a/lib/mesa/src/panfrost/bifrost/bi_schedule.c b/lib/mesa/src/panfrost/bifrost/bi_schedule.c index 421afdffc..1afe358ef 100644 --- a/lib/mesa/src/panfrost/bifrost/bi_schedule.c +++ b/lib/mesa/src/panfrost/bifrost/bi_schedule.c @@ -999,16 +999,21 @@ bi_instr_schedulable(bi_instr *instr, * same clause (most likely they will not), so if a later instruction * in the clause accesses the destination, the message-passing * instruction can't be scheduled */ - if (bi_opcode_props[instr->op].sr_write && !bi_is_null(instr->dest[0])) { - unsigned nr = bi_count_write_registers(instr, 0); - assert(instr->dest[0].type == BI_INDEX_REGISTER); - unsigned reg = instr->dest[0].value; + if (bi_opcode_props[instr->op].sr_write) { + bi_foreach_dest(instr, d) { + if (bi_is_null(instr->dest[d])) + continue; - for (unsigned i = 0; i < clause->access_count; ++i) { - bi_index idx = clause->accesses[i]; - for (unsigned d = 0; d < nr; ++d) { - if (bi_is_equiv(bi_register(reg + d), idx)) - return false; + unsigned nr = bi_count_write_registers(instr, d); + assert(instr->dest[d].type == BI_INDEX_REGISTER); + unsigned reg = instr->dest[d].value; + + for (unsigned i = 0; i < clause->access_count; ++i) { + bi_index idx = clause->accesses[i]; + for (unsigned d = 0; d < nr; ++d) { + if (bi_is_equiv(bi_register(reg + d), idx)) + return false; + } } } } diff --git a/lib/mesa/src/panfrost/util/pan_ir.h b/lib/mesa/src/panfrost/util/pan_ir.h index 8d6bb1f95..fa737b00b 100644 --- a/lib/mesa/src/panfrost/util/pan_ir.h +++ b/lib/mesa/src/panfrost/util/pan_ir.h @@ -112,11 +112,17 @@ struct panfrost_sysvals { unsigned sysval_count; }; -/* Technically Midgard could go up to 92 in a pathological case but we don't - * take advantage of that. Likewise Bifrost's FAU encoding can address 128 - * words but actual implementations (G72, G76) are capped at 64 */ - -#define PAN_MAX_PUSH 64 +/* Architecturally, Bifrost/Valhall can address 128 FAU slots of 64-bits each. + * In practice, the maximum number of FAU slots is limited by implementation. + * All known Bifrost and Valhall devices limit to 64 FAU slots. Therefore the + * maximum number of 32-bit words is 128, since there are 2 words per FAU slot. + * + * Midgard can push at most 92 words, so this bound suffices. The Midgard + * compiler pushes less than this, as Midgard uses register-mapped uniforms + * instead of FAU, preventing large numbers of uniforms to be pushed for + * nontrivial programs. + */ +#define PAN_MAX_PUSH 128 /* Architectural invariants (Midgard and Bifrost): UBO must be <= 2^16 bytes so * an offset to a word must be < 2^16. There are less than 2^8 UBOs */ diff --git a/lib/mesa/src/util/meson.build b/lib/mesa/src/util/meson.build index 156621aff..b61723da3 100644 --- a/lib/mesa/src/util/meson.build +++ b/lib/mesa/src/util/meson.build @@ -20,41 +20,72 @@ inc_util = include_directories('.') -subdir('xmlpool') +subdir('format') files_mesa_util = files( + 'anon_file.h', + 'anon_file.c', 'bigmath.h', 'bitscan.c', 'bitscan.h', 'bitset.h', + 'blob.c', + 'blob.h', 'build_id.c', 'build_id.h', + 'cnd_monotonic.h', + 'compiler.h', + 'compress.c', + 'compress.h', 'crc32.c', 'crc32.h', + 'dag.c', 'debug.c', 'debug.h', 'disk_cache.c', 'disk_cache.h', + 'disk_cache_os.c', + 'disk_cache_os.h', + 'double.c', + 'double.h', + 'enum_operators.h', 'fast_idiv_by_const.c', 'fast_idiv_by_const.h', 'format_r11g11b10f.h', 'format_rgb9e5.h', 'format_srgb.h', + 'fossilize_db.c', + 'fossilize_db.h', 'futex.h', 'half_float.c', 'half_float.h', 'hash_table.c', 'hash_table.h', + 'u_idalloc.c', + 'u_idalloc.h', 'list.h', + 'log.c', 'macros.h', + 'memstream.c', + 'memstream.h', 'mesa-sha1.c', 'mesa-sha1.h', 'os_time.c', 'os_time.h', + 'os_file.c', + 'os_memory_fd.c', 'os_misc.c', 'os_misc.h', + 'os_socket.c', + 'os_socket.h', + 'perf/u_trace.h', + 'perf/u_trace.c', + 'perf/u_trace_priv.h', 'u_process.c', 'u_process.h', + 'u_qsort.cpp', + 'u_qsort.h', + 'rwlock.h', 'sha1/sha1.c', 'sha1/sha1.h', 'ralloc.c', @@ -74,16 +105,28 @@ files_mesa_util = files( 'simple_mtx.h', 'slab.c', 'slab.h', + 'softfloat.c', + 'softfloat.h', + 'sparse_array.c', + 'sparse_array.h', 'string_buffer.c', 'string_buffer.h', 'strndup.h', 'strtod.c', 'strtod.h', 'texcompress_rgtc_tmp.h', + 'timespec.h', 'u_atomic.c', 'u_atomic.h', + 'u_debug_describe.c', + 'u_debug_describe.h', + 'u_debug_refcnt.c', + 'u_debug_refcnt.h', 'u_dynarray.h', 'u_endian.h', + 'u_fifo.h', + 'u_hash_table.c', + 'u_hash_table.h', 'u_queue.c', 'u_queue.h', 'u_string.h', @@ -92,21 +135,52 @@ files_mesa_util = files( 'u_vector.h', 'u_math.c', 'u_math.h', + 'u_memset.h', + 'u_mm.c', + 'u_mm.h', 'u_debug.c', 'u_debug.h', + 'u_debug_memory.c', 'u_cpu_detect.c', 'u_cpu_detect.h', + 'u_printf.cpp', + 'u_printf.h', + 'u_printf_length.c', 'vma.c', 'vma.h', + 'xxhash.h', ) -install_data('00-mesa-defaults.conf', install_dir : join_paths(get_option('datadir'), 'drirc.d')) +files_drirc = files('00-mesa-defaults.conf') + +install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d')) + +if with_tests + prog_xmllint = find_program('xmllint', required : false, native : true) + if prog_xmllint.found() + test( + 'drirc xml validation', + prog_xmllint, + args : ['--noout', '--valid', files_drirc], + suite : ['util'], + ) + endif +endif files_xmlconfig = files( 'xmlconfig.c', 'xmlconfig.h', ) +files_xmlconfig += custom_target( + 'driconf_static.h', + input: ['driconf_static.py', '00-mesa-defaults.conf'], + output: 'driconf_static.h', + command: [ + prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@' + ], +) + format_srgb = custom_target( 'format_srgb', input : ['format_srgb.py'], @@ -115,23 +189,73 @@ format_srgb = custom_target( capture : true, ) -libmesa_util = static_library( +deps_for_libmesa_util = [ + dep_zlib, + dep_clock, + dep_thread, + dep_atomic, + dep_m, + dep_valgrind, + dep_zstd, + dep_dl, + dep_unwind, +] + +if with_platform_android + deps_for_libmesa_util += dep_android + files_debug_stack = files('u_debug_stack_android.cpp') + else + files_debug_stack = files( + 'u_debug_stack.c', + 'u_debug_symbol.c', + 'u_debug_symbol.h', + ) +endif + +if with_platform_haiku + deps_for_libmesa_util += dep_network +endif + +if with_perfetto + files_mesa_util += files( + 'u_perfetto.cc', + 'u_perfetto.h', + ) + deps_for_libmesa_util += dep_perfetto +endif + +u_trace_py = files('perf/u_trace.py') + +_libmesa_util = static_library( 'mesa_util', - [files_mesa_util, format_srgb], - include_directories : inc_common, - dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m], - c_args : [c_msvc_compat_args, c_vis_args], + [files_mesa_util, files_debug_stack, format_srgb], + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : deps_for_libmesa_util, + link_with: libmesa_format, + c_args : [c_msvc_compat_args], + gnu_symbol_visibility : 'hidden', build_by_default : false ) -libxmlconfig = static_library( +idep_mesautil = declare_dependency( + link_with : _libmesa_util, + include_directories : [inc_util, inc_gallium], + dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m, dep_valgrind], +) + +xmlconfig_deps = [] +if not (with_platform_android or with_platform_windows) + xmlconfig_deps += dep_expat +endif +xmlconfig_deps += dep_regex + +_libxmlconfig = static_library( 'xmlconfig', files_xmlconfig, - include_directories : inc_common, - link_with : libmesa_util, - dependencies : [dep_expat, dep_m], + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : [idep_mesautil, dep_m, xmlconfig_deps], c_args : [ - c_msvc_compat_args, c_vis_args, + c_msvc_compat_args, '-DSYSCONFDIR="@0@"'.format( join_paths(get_option('prefix'), get_option('sysconfdir')) ), @@ -139,19 +263,71 @@ libxmlconfig = static_library( join_paths(get_option('prefix'), get_option('datadir')) ), ], + gnu_symbol_visibility : 'hidden', build_by_default : false, ) +idep_xmlconfig = declare_dependency( + dependencies : xmlconfig_deps, + link_with : _libxmlconfig, +) + +files_xxd = files('xxd.py') + if with_tests + # DRI_CONF macros use designated initializers (required for union + # initializaiton), so we need c++2a since gtest forces us to use c++ + if host_machine.system() != 'windows' and cpp.has_argument('-std=c++2a') + test('xmlconfig', + executable('xmlconfig_test', + files('tests/xmlconfig.cpp'), + include_directories : [inc_include, inc_src], + dependencies : [idep_mesautil, idep_xmlconfig, idep_gtest], + override_options : ['cpp_std=c++2a'], + cpp_args: ['-Wno-write-strings'] + ), + suite : ['util'], + env: ['HOME=' + join_paths(meson.current_source_dir(), + 'tests', 'drirc_home'), + 'DRIRC_CONFIGDIR=' + join_paths(meson.current_source_dir(), + 'tests', 'drirc_configdir')] + ) + endif + test( 'u_atomic', executable( 'u_atomic_test', files('u_atomic_test.c'), - include_directories : inc_common, - link_with : libmesa_util, + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : idep_mesautil, c_args : [c_msvc_compat_args], - ) + ), + suite : ['util'], + ) + + test( + 'blob', + executable( + 'blob_test', + files('blob_test.c'), + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : idep_mesautil, + c_args : [c_msvc_compat_args], + ), + suite : ['util'], + ) + + test( + 'rb_tree', + executable( + 'rb_tree_test', + files('rb_tree_test.c'), + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : idep_mesautil, + c_args : [c_msvc_compat_args], + ), + suite : ['util'], ) test( @@ -159,26 +335,102 @@ if with_tests executable( 'roundeven_test', files('roundeven_test.c'), - include_directories : inc_common, + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], c_args : [c_msvc_compat_args], dependencies : [dep_m], + ), + suite : ['util'], + should_fail : meson.get_cross_property('xfail', '').contains('roundeven'), + ) + + # FIXME: this test crashes on windows + if host_machine.system() != 'windows' + test( + 'mesa-sha1', + executable( + 'mesa-sha1_test', + files('mesa-sha1_test.c'), + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + link_with : _libmesa_util, + c_args : [c_msvc_compat_args], + ), + suite : ['util'], + ) + endif + + foreach t: ['bitset', 'register_allocate', 'u_debug_stack', 'u_qsort'] + test( + t, + executable( + t + '_test', + files(t + '_test.cpp'), + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : [idep_mesautil, idep_gtest], + ), + suite : ['util'], ) + endforeach + + process_test_exe = executable( + 'process_test', + files('process_test.c'), + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], + dependencies : idep_mesautil, + c_args : [c_msvc_compat_args], ) + if (host_machine.system() == 'windows' and build_machine.system() != 'windows') + # This conversion is only required on mingw crosscompilers, otherwise we hit at least one of these issues + # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2690 + # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2788 + prog_winepath = find_program('winepath') + process_test_exe_full_path = run_command( + prog_winepath, '-w', process_test_exe.full_path() + ).stdout().strip() + else + process_test_exe_full_path = process_test_exe.full_path() + endif test( - 'mesa-sha1', + 'process', + process_test_exe, + suite : ['util'], + env: ['BUILD_FULL_PATH='+process_test_exe_full_path] + ) + + test('int_min_max', + executable('int_min_max_test', + files('tests/int_min_max.cpp'), + include_directories : [inc_include, inc_src], + dependencies : [idep_mesautil, idep_gtest], + ), + suite : ['util'], + ) + + test( + 'dag', executable( - 'mesa-sha1_test', - files('mesa-sha1_test.c'), - include_directories : inc_common, - link_with : libmesa_util, - c_args : [c_msvc_compat_args], - ) + 'dag_test', + 'tests/dag_test.cpp', + dependencies : [idep_mesautil, idep_gtest], + include_directories : [inc_include, inc_src], + ), + suite : ['util'], ) + subdir('tests/cache') subdir('tests/fast_idiv_by_const') + subdir('tests/fast_urem_by_const') subdir('tests/hash_table') - subdir('tests/string_buffer') + if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc') + # FIXME: These tests fail with mingw, but not with msvc. + subdir('tests/string_buffer') + endif + if cc.has_header('sys/time.h') # MinGW has this, but Vanilla windows doesn't + subdir('tests/timespec') + endif subdir('tests/vma') subdir('tests/set') + subdir('tests/sparse_array') + subdir('tests/format') + subdir('tests/vector') endif diff --git a/lib/mesa/src/util/slab.c b/lib/mesa/src/util/slab.c index 1e778a123..9dee23621 100644 --- a/lib/mesa/src/util/slab.c +++ b/lib/mesa/src/util/slab.c @@ -110,6 +110,7 @@ slab_create_parent(struct slab_parent_pool *parent, parent->element_size = ALIGN_POT(sizeof(struct slab_element_header) + item_size, sizeof(intptr_t)); parent->num_elements = num_items; + parent->item_size = item_size; } void @@ -231,6 +232,18 @@ slab_alloc(struct slab_child_pool *pool) } /** + * Same as slab_alloc but memset the returned object to 0. + */ +void * +slab_zalloc(struct slab_child_pool *pool) +{ + void *r = slab_alloc(pool); + if (r) + memset(r, 0, pool->parent->item_size); + return r; +} + +/** * Free an object allocated from the slab. Single-threaded (i.e. the caller * must ensure that no operation happens on the same child pool in another * thread). diff --git a/lib/mesa/src/util/u_debug_stack.c b/lib/mesa/src/util/u_debug_stack.c index 8ad6d9f3b..86bfb2fb6 100644 --- a/lib/mesa/src/util/u_debug_stack.c +++ b/lib/mesa/src/util/u_debug_stack.c @@ -199,7 +199,6 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, unsigned start_frame, unsigned nr_frames) { - const void **frame_pointer = NULL; unsigned i = 0; if (!nr_frames) { @@ -254,15 +253,15 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, #if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION > 404) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wframe-address" - frame_pointer = ((const void **)__builtin_frame_address(1)); + const void **frame_pointer = ((const void **)__builtin_frame_address(1)); #pragma GCC diagnostic pop -#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) +#elif defined(PIPE_CC_MSVC) __asm { mov frame_pointer, ebp } - frame_pointer = (const void **)frame_pointer[0]; + const void **frame_pointer = (const void **)frame_pointer[0]; #else - frame_pointer = NULL; + const void **frame_pointer = NULL; #endif while (nr_frames) { @@ -287,8 +286,6 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, frame_pointer = next_frame_pointer; } -#else - (void) frame_pointer; #endif while (nr_frames) { |