From eff193c9809390e0f17bf1e2cf50206820ee7864 Mon Sep 17 00:00:00 2001 From: kth5 Date: Tue, 23 Jul 2024 11:24:02 +0200 Subject: [PATCH] * update mesa to 1:24.1.4-1 --- ...-va-Fix-AV1-slice_data_offset-with-m.patch | 106 +++ mesa/0004-add-llvm-orcjit.patch | 771 ++++++---------- mesa/0005-llvmpipe-linkage.patch | 24 - mesa/PKGBUILD | 864 +++++++++--------- 4 files changed, 814 insertions(+), 951 deletions(-) create mode 100644 mesa/0001-Revert-frontends-va-Fix-AV1-slice_data_offset-with-m.patch delete mode 100644 mesa/0005-llvmpipe-linkage.patch diff --git a/mesa/0001-Revert-frontends-va-Fix-AV1-slice_data_offset-with-m.patch b/mesa/0001-Revert-frontends-va-Fix-AV1-slice_data_offset-with-m.patch new file mode 100644 index 0000000000..8701bd088a --- /dev/null +++ b/mesa/0001-Revert-frontends-va-Fix-AV1-slice_data_offset-with-m.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Rosca +Date: Thu, 18 Jul 2024 19:15:13 +0200 +Subject: [PATCH] Revert "frontends/va: Fix AV1 slice_data_offset with multiple + slice data buffers" + +This commit is fixing an issue where all AV1 slice data offsets always point +into the first slice data buffer, even when multiple slice data buffers +are submitted. However, after b0d6e58d88f ("Reapply "radeonsi/vcn: AV1 skip the redundant bs resize"") +only the first slice data buffer will be sent to decoder and the incorrect +behavior is required, so this commit also needs to be reverted. + +This reverts commit 6746d4df6eac83d048e88c2d54aa19e7c1a0a696. +--- + src/gallium/frontends/va/picture.c | 11 +++-------- + src/gallium/frontends/va/picture_av1.c | 4 ++-- + src/gallium/frontends/va/va_private.h | 2 +- + 3 files changed, 6 insertions(+), 11 deletions(-) + +diff --git a/src/gallium/frontends/va/picture.c b/src/gallium/frontends/va/picture.c +index 59692aeee91c..a2bb608ec96a 100644 +--- a/src/gallium/frontends/va/picture.c ++++ b/src/gallium/frontends/va/picture.c +@@ -299,7 +299,7 @@ handleIQMatrixBuffer(vlVaContext *context, vlVaBuffer *buf) + } + + static void +-handleSliceParameterBuffer(vlVaContext *context, vlVaBuffer *buf, unsigned num_slices, unsigned slice_offset) ++handleSliceParameterBuffer(vlVaContext *context, vlVaBuffer *buf, unsigned num_slices) + { + switch (u_reduce_video_profile(context->templat.profile)) { + case PIPE_VIDEO_FORMAT_MPEG12: +@@ -331,7 +331,7 @@ handleSliceParameterBuffer(vlVaContext *context, vlVaBuffer *buf, unsigned num_s + break; + + case PIPE_VIDEO_FORMAT_AV1: +- vlVaHandleSliceParameterBufferAV1(context, buf, num_slices, slice_offset); ++ vlVaHandleSliceParameterBufferAV1(context, buf, num_slices); + break; + + default: +@@ -968,7 +968,6 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff + + unsigned i; + unsigned slice_idx = 0; +- unsigned slice_offset = 0; + vlVaBuffer *seq_param_buf = NULL; + + if (!ctx) +@@ -1024,17 +1023,13 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff + + slice_idx is the zero based number of total slices received + before this call to handleSliceParameterBuffer +- +- slice_offset is the slice offset in bitstream buffer + */ +- handleSliceParameterBuffer(context, buf, slice_idx, slice_offset); ++ handleSliceParameterBuffer(context, buf, slice_idx); + slice_idx += buf->num_elements; + } break; + + case VASliceDataBufferType: + vaStatus = handleVASliceDataBufferType(context, buf); +- if (slice_idx) +- slice_offset += buf->size; + break; + + case VAProcPipelineParameterBufferType: +diff --git a/src/gallium/frontends/va/picture_av1.c b/src/gallium/frontends/va/picture_av1.c +index c014b0b1168c..e6f2652e3623 100644 +--- a/src/gallium/frontends/va/picture_av1.c ++++ b/src/gallium/frontends/va/picture_av1.c +@@ -396,18 +396,18 @@ void vlVaHandlePictureParameterBufferAV1(vlVaDriver *drv, vlVaContext *context, + context->desc.av1.slice_parameter.slice_count = 0; + } + +-void vlVaHandleSliceParameterBufferAV1(vlVaContext *context, vlVaBuffer *buf, unsigned num_slices, unsigned slice_offset) ++void vlVaHandleSliceParameterBufferAV1(vlVaContext *context, vlVaBuffer *buf, unsigned num_slices) + { + for (uint32_t buffer_idx = 0; buffer_idx < buf->num_elements; buffer_idx++) { + uint32_t slice_index = + /* slices obtained so far from vaRenderPicture in previous calls*/ + num_slices + + /* current slice index processing this VASliceParameterBufferAV1 */ + buffer_idx; + + VASliceParameterBufferAV1 *av1 = &(((VASliceParameterBufferAV1*)buf->data)[buffer_idx]); + context->desc.av1.slice_parameter.slice_data_size[slice_index] = av1->slice_data_size; +- context->desc.av1.slice_parameter.slice_data_offset[slice_index] = slice_offset + av1->slice_data_offset; ++ context->desc.av1.slice_parameter.slice_data_offset[slice_index] = av1->slice_data_offset; + context->desc.av1.slice_parameter.slice_data_row[slice_index] = av1->tile_row; + context->desc.av1.slice_parameter.slice_data_col[slice_index] = av1->tile_column; + context->desc.av1.slice_parameter.slice_data_anchor_frame_idx[slice_index] = av1->anchor_frame_idx; +diff --git a/src/gallium/frontends/va/va_private.h b/src/gallium/frontends/va/va_private.h +index 007ed95ce7f7..ad30f3bad2a9 100644 +--- a/src/gallium/frontends/va/va_private.h ++++ b/src/gallium/frontends/va/va_private.h +@@ -540,7 +540,7 @@ void vlVaHandlePictureParameterBufferVP9(vlVaDriver *drv, vlVaContext *context, + void vlVaHandleSliceParameterBufferVP9(vlVaContext *context, vlVaBuffer *buf); + void vlVaDecoderVP9BitstreamHeader(vlVaContext *context, vlVaBuffer *buf); + void vlVaHandlePictureParameterBufferAV1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf); +-void vlVaHandleSliceParameterBufferAV1(vlVaContext *context, vlVaBuffer *buf, unsigned num_slices, unsigned slice_offset); ++void vlVaHandleSliceParameterBufferAV1(vlVaContext *context, vlVaBuffer *buf, unsigned num_slices); + void getEncParamPresetH264(vlVaContext *context); + void getEncParamPresetH265(vlVaContext *context); + void getEncParamPresetAV1(vlVaContext *context); diff --git a/mesa/0004-add-llvm-orcjit.patch b/mesa/0004-add-llvm-orcjit.patch index f1a48b59c0..e054b9b5d0 100644 --- a/mesa/0004-add-llvm-orcjit.patch +++ b/mesa/0004-add-llvm-orcjit.patch @@ -1,93 +1,49 @@ -From 1a348f69d024b64557f166a36e2e81ebe1ebbcf1 Mon Sep 17 00:00:00 2001 -From: Yukari Chiba -Date: Thu, 21 Mar 2024 16:41:49 +0800 -Subject: [PATCH] llvmpipe: add an implementation with llvm orcjit ---- - meson.build | 4 +- - meson_options.txt | 9 +- - src/gallium/auxiliary/draw/draw_context.c | 4 + - src/gallium/auxiliary/draw/draw_llvm.c | 93 +- - src/gallium/auxiliary/draw/draw_llvm.h | 17 +- - src/gallium/auxiliary/gallivm/lp_bld_coro.c | 6 +- - src/gallium/auxiliary/gallivm/lp_bld_coro.h | 8 + - src/gallium/auxiliary/gallivm/lp_bld_init.c | 7 +- - src/gallium/auxiliary/gallivm/lp_bld_init.h | 41 +- - .../auxiliary/gallivm/lp_bld_init_orc.cpp | 959 ++++++++++++++++++ - src/gallium/auxiliary/meson.build | 6 +- - src/gallium/drivers/llvmpipe/lp_context.c | 18 + - src/gallium/drivers/llvmpipe/lp_context.h | 4 + - src/gallium/drivers/llvmpipe/lp_screen.c | 4 + - src/gallium/drivers/llvmpipe/lp_state_cs.c | 18 + - src/gallium/drivers/llvmpipe/lp_state_cs.h | 3 + - src/gallium/drivers/llvmpipe/lp_state_fs.c | 33 + - src/gallium/drivers/llvmpipe/lp_state_fs.h | 6 + - .../llvmpipe/lp_state_fs_linear_llvm.c | 4 + - src/gallium/drivers/llvmpipe/lp_state_setup.c | 9 + - src/gallium/drivers/llvmpipe/lp_state_setup.h | 3 + - src/gallium/drivers/llvmpipe/lp_test_arit.c | 19 + - src/gallium/drivers/llvmpipe/lp_test_blend.c | 33 +- - src/gallium/drivers/llvmpipe/lp_test_conv.c | 33 +- - src/gallium/drivers/llvmpipe/lp_test_format.c | 50 +- - .../llvmpipe/lp_test_lookup_multiple.c | 172 ++++ - src/gallium/drivers/llvmpipe/lp_test_printf.c | 31 +- - .../drivers/llvmpipe/lp_texture_handle.c | 20 + - src/gallium/drivers/llvmpipe/meson.build | 2 +- - src/util/detect_arch.h | 23 + - 30 files changed, 1617 insertions(+), 22 deletions(-) - create mode 100644 src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp - create mode 100644 src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c - -Index: mesa-24.0.3/meson.build +Index: mesa-24.0.7/meson.build =================================================================== ---- mesa-24.0.3.orig/meson.build -+++ mesa-24.0.3/meson.build -@@ -1725,13 +1725,14 @@ if with_clc - llvm_optional_modules += ['all-targets', 'windowsdriver', 'frontendhlsl'] - endif - draw_with_llvm = get_option('draw-use-llvm') -+llvm_with_orcjit = get_option('llvm-orcjit') - if draw_with_llvm - llvm_modules += 'native' - # lto is needded with LLVM>=15, but we don't know what LLVM verrsion we are using yet +--- mesa-24.0.7.orig/meson.build ++++ mesa-24.0.7/meson.build +@@ -1747,7 +1747,9 @@ llvm_optional_modules += ['lto'] endif --if with_amd_vk or with_gallium_radeonsi -+if with_amd_vk or with_gallium_radeonsi or llvm_with_orcjit +-if with_amd_vk or with_gallium_radeonsi or with_clc ++llvm_with_orcjit = get_option('llvm-orcjit') ++ ++if with_amd_vk or with_gallium_radeonsi or with_clc or llvm_with_orcjit _llvm_version = '>= 15.0.0' - elif with_intel_clc - _llvm_version = '>= 13.0.0' -@@ -1815,6 +1816,7 @@ else + elif with_gallium_opencl + _llvm_version = '>= 11.0.0' +@@ -1827,6 +1829,7 @@ endif pre_args += '-DLLVM_AVAILABLE=' + (with_llvm ? '1' : '0') pre_args += '-DDRAW_LLVM_AVAILABLE=' + (with_llvm and draw_with_llvm ? '1' : '0') +pre_args += '-DGALLIVM_USE_ORCJIT=' + (with_llvm and llvm_with_orcjit ? '1' : '0') - with_opencl_spirv = (_opencl != 'disabled' and get_option('opencl-spirv')) or with_clc - if with_opencl_spirv -Index: mesa-24.0.3/meson_options.txt + if with_clover_spirv or with_clc + chosen_llvm_version_array = dep_llvm.version().split('.') +Index: mesa-24.0.7/meson_options.txt =================================================================== ---- mesa-24.0.5/meson_options.txt.orig 2024-04-14 17:17:34.904240885 +0200 -+++ mesa-24.0.5/meson_options.txt 2024-04-14 17:17:47.570972342 +0200 -@@ -682,4 +682,11 @@ - description : 'Build custom xmlconfig (driconf) support. If disabled, ' + - 'the default driconf file is hardcoded into Mesa. ' + - 'Requires expat.' --) -\ No newline at end of file -+) -+ +--- mesa-24.0.7.orig/meson_options.txt ++++ mesa-24.0.7/meson_options.txt +@@ -416,6 +416,13 @@ option( + 'is included.' + ) + +option ( + 'llvm-orcjit', + type : 'boolean', + value : false, + description: 'Build llvmpipe with LLVM ORCJIT support.' +) -Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_context.c ++ + option( + 'valgrind', + type : 'feature', +Index: mesa-24.0.7/src/gallium/auxiliary/draw/draw_context.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/draw/draw_context.c -+++ mesa-24.0.3/src/gallium/auxiliary/draw/draw_context.c +--- mesa-24.0.7.orig/src/gallium/auxiliary/draw/draw_context.c ++++ mesa-24.0.7/src/gallium/auxiliary/draw/draw_context.c @@ -77,7 +77,11 @@ draw_create_context(struct pipe_context #if DRAW_LLVM_AVAILABLE @@ -100,10 +56,10 @@ Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_context.c } #endif -Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.c +Index: mesa-24.0.7/src/gallium/auxiliary/draw/draw_llvm.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/draw/draw_llvm.c -+++ mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.c +--- mesa-24.0.7.orig/src/gallium/auxiliary/draw/draw_llvm.c ++++ mesa-24.0.7/src/gallium/auxiliary/draw/draw_llvm.c @@ -381,8 +381,13 @@ get_vertex_header_ptr_type(struct draw_l /** * Create per-context LLVM info. @@ -172,55 +128,44 @@ Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.c create_vs_jit_types(variant); -@@ -529,8 +556,13 @@ draw_llvm_create_variant(struct draw_llv - +@@ -530,7 +557,8 @@ draw_llvm_create_variant(struct draw_llv gallivm_compile_module(variant->gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ variant->jit_func = (draw_jit_vert_func) -+ gallivm_jit_function(variant->gallivm, variant->function_name); -+#else variant->jit_func = (draw_jit_vert_func) - gallivm_jit_function(variant->gallivm, variant->function); -+#endif +- gallivm_jit_function(variant->gallivm, variant->function); ++ gallivm_jit_function(variant->gallivm, variant->function, ++ variant->function_name); if (needs_caching) llvm->draw->disk_cache_insert_shader(llvm->draw->disk_cache_cookie, -@@ -1633,6 +1665,10 @@ draw_llvm_generate(struct draw_llvm *llv +@@ -1633,6 +1661,8 @@ draw_llvm_generate(struct draw_llvm *llv variant_func = LLVMAddFunction(gallivm->module, func_name, func_type); variant->function = variant_func; -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name, func_name); -+#endif LLVMSetFunctionCallConv(variant_func, LLVMCCallConv); for (i = 0; i < num_arg_types; ++i) -@@ -2249,6 +2285,11 @@ draw_llvm_destroy_variant(struct draw_ll +@@ -2249,6 +2279,8 @@ draw_llvm_destroy_variant(struct draw_ll variant->shader->variants_cached--; list_del(&variant->list_item_global.list); llvm->nr_variants--; -+ -+#if GALLIVM_USE_ORCJIT == 1 + if(variant->function_name) + FREE(variant->function_name); -+#endif FREE(variant); } -@@ -2358,6 +2399,10 @@ draw_gs_llvm_generate(struct draw_llvm * +@@ -2358,6 +2390,8 @@ draw_gs_llvm_generate(struct draw_llvm * variant_func = LLVMAddFunction(gallivm->module, func_name, func_type); variant->function = variant_func; -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name, func_name); -+#endif LLVMSetFunctionCallConv(variant_func, LLVMCCallConv); -@@ -2524,7 +2569,11 @@ draw_gs_llvm_create_variant(struct draw_ +@@ -2524,7 +2558,11 @@ draw_gs_llvm_create_variant(struct draw_ if (!cached.data_size) needs_caching = true; } @@ -232,43 +177,35 @@ Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.c create_gs_jit_types(variant); -@@ -2535,8 +2584,13 @@ draw_gs_llvm_create_variant(struct draw_ - +@@ -2536,7 +2574,8 @@ draw_gs_llvm_create_variant(struct draw_ gallivm_compile_module(variant->gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ variant->jit_func = (draw_gs_jit_func) -+ gallivm_jit_function(variant->gallivm, variant->function_name); -+#else variant->jit_func = (draw_gs_jit_func) - gallivm_jit_function(variant->gallivm, variant->function); -+#endif +- gallivm_jit_function(variant->gallivm, variant->function); ++ gallivm_jit_function(variant->gallivm, variant->function, ++ variant->function_name); if (needs_caching) llvm->draw->disk_cache_insert_shader(llvm->draw->disk_cache_cookie, -@@ -2569,6 +2623,10 @@ draw_gs_llvm_destroy_variant(struct draw +@@ -2569,6 +2608,8 @@ draw_gs_llvm_destroy_variant(struct draw variant->shader->variants_cached--; list_del(&variant->list_item_global.list); llvm->nr_gs_variants--; -+#if GALLIVM_USE_ORCJIT == 1 + if(variant->function_name) + FREE(variant->function_name); -+#endif FREE(variant); } -@@ -2942,6 +3000,10 @@ draw_tcs_llvm_generate(struct draw_llvm +@@ -2942,6 +2983,8 @@ draw_tcs_llvm_generate(struct draw_llvm variant_coro = LLVMAddFunction(gallivm->module, func_name_coro, coro_func_type); variant->function = variant_func; -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name, func_name); -+#endif LLVMSetFunctionCallConv(variant_func, LLVMCCallConv); LLVMSetFunctionCallConv(variant_coro, LLVMCCallConv); -@@ -3177,8 +3239,11 @@ draw_tcs_llvm_create_variant(struct draw +@@ -3177,8 +3220,11 @@ draw_tcs_llvm_create_variant(struct draw if (!cached.data_size) needs_caching = true; } @@ -281,43 +218,35 @@ Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.c create_tcs_jit_types(variant); -@@ -3191,8 +3256,13 @@ draw_tcs_llvm_create_variant(struct draw - +@@ -3192,7 +3238,8 @@ draw_tcs_llvm_create_variant(struct draw gallivm_compile_module(variant->gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ variant->jit_func = (draw_tcs_jit_func) -+ gallivm_jit_function(variant->gallivm, variant->function_name); -+#else variant->jit_func = (draw_tcs_jit_func) - gallivm_jit_function(variant->gallivm, variant->function); -+#endif +- gallivm_jit_function(variant->gallivm, variant->function); ++ gallivm_jit_function(variant->gallivm, variant->function, ++ variant->function_name); if (needs_caching) llvm->draw->disk_cache_insert_shader(llvm->draw->disk_cache_cookie, -@@ -3225,6 +3295,10 @@ draw_tcs_llvm_destroy_variant(struct dra +@@ -3225,6 +3272,8 @@ draw_tcs_llvm_destroy_variant(struct dra variant->shader->variants_cached--; list_del(&variant->list_item_global.list); llvm->nr_tcs_variants--; -+#if GALLIVM_USE_ORCJIT == 1 + if(variant->function_name) + FREE(variant->function_name); -+#endif FREE(variant); } -@@ -3507,6 +3581,10 @@ draw_tes_llvm_generate(struct draw_llvm +@@ -3507,6 +3556,8 @@ draw_tes_llvm_generate(struct draw_llvm variant_func = LLVMAddFunction(gallivm->module, func_name, func_type); variant->function = variant_func; -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name, func_name); -+#endif LLVMSetFunctionCallConv(variant_func, LLVMCCallConv); for (i = 0; i < ARRAY_SIZE(arg_types); ++i) -@@ -3697,7 +3775,11 @@ draw_tes_llvm_create_variant(struct draw +@@ -3697,7 +3748,11 @@ draw_tes_llvm_create_variant(struct draw if (!cached.data_size) needs_caching = true; } @@ -329,35 +258,29 @@ Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.c create_tes_jit_types(variant); -@@ -3713,8 +3795,13 @@ draw_tes_llvm_create_variant(struct draw - +@@ -3714,7 +3769,8 @@ draw_tes_llvm_create_variant(struct draw gallivm_compile_module(variant->gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ variant->jit_func = (draw_tes_jit_func) -+ gallivm_jit_function(variant->gallivm, variant->function_name); -+#else variant->jit_func = (draw_tes_jit_func) - gallivm_jit_function(variant->gallivm, variant->function); -+#endif +- gallivm_jit_function(variant->gallivm, variant->function); ++ gallivm_jit_function(variant->gallivm, variant->function, ++ variant->function_name); if (needs_caching) llvm->draw->disk_cache_insert_shader(llvm->draw->disk_cache_cookie, -@@ -3747,6 +3834,10 @@ draw_tes_llvm_destroy_variant(struct dra +@@ -3747,6 +3803,8 @@ draw_tes_llvm_destroy_variant(struct dra variant->shader->variants_cached--; list_del(&variant->list_item_global.list); llvm->nr_tes_variants--; -+#if GALLIVM_USE_ORCJIT == 1 + if(variant->function_name) + FREE(variant->function_name); -+#endif FREE(variant); } -Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.h +Index: mesa-24.0.7/src/gallium/auxiliary/draw/draw_llvm.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/draw/draw_llvm.h -+++ mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.h +--- mesa-24.0.7.orig/src/gallium/auxiliary/draw/draw_llvm.h ++++ mesa-24.0.7/src/gallium/auxiliary/draw/draw_llvm.h @@ -42,6 +42,9 @@ #include "pipe/p_context.h" #include "util/list.h" @@ -425,10 +348,10 @@ Index: mesa-24.0.3/src/gallium/auxiliary/draw/draw_llvm.h void draw_llvm_destroy(struct draw_llvm *llvm); -Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_coro.c +Index: mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_coro.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/gallivm/lp_bld_coro.c -+++ mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_coro.c +--- mesa-24.0.7.orig/src/gallium/auxiliary/gallivm/lp_bld_coro.c ++++ mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_coro.c @@ -156,12 +156,14 @@ coro_free(char *ptr) void lp_build_coro_add_malloc_hooks(struct gallivm_state *gallivm) @@ -446,10 +369,10 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_coro.c } void lp_build_coro_declare_malloc_hooks(struct gallivm_state *gallivm) -Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_coro.h +Index: mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_coro.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/gallivm/lp_bld_coro.h -+++ mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_coro.h +--- mesa-24.0.7.orig/src/gallium/auxiliary/gallivm/lp_bld_coro.h ++++ mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_coro.h @@ -31,6 +31,10 @@ #include "gallivm/lp_bld.h" #include "gallivm/lp_bld_intr.h" @@ -470,10 +393,10 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_coro.h +#endif + #endif -Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.c +Index: mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_init.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/gallivm/lp_bld_init.c -+++ mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.c +--- mesa-24.0.7.orig/src/gallium/auxiliary/gallivm/lp_bld_init.c ++++ mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -515,6 +515,11 @@ gallivm_destroy(struct gallivm_state *ga FREE(gallivm); } @@ -486,7 +409,7 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.c /** * Validate a function. -@@ -670,7 +675,7 @@ gallivm_compile_module(struct gallivm_st +@@ -674,7 +679,7 @@ gallivm_compile_module(struct gallivm_st ++gallivm->compiled; lp_init_printf_hook(gallivm); @@ -495,10 +418,19 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.c lp_init_clock_hook(gallivm); LLVMAddGlobalMapping(gallivm->engine, gallivm->get_time_hook, os_time_get_nano); -Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.h +@@ -717,7 +722,7 @@ gallivm_compile_module(struct gallivm_st + + func_pointer + gallivm_jit_function(struct gallivm_state *gallivm, +- LLVMValueRef func) ++ LLVMValueRef func, const char *func_name) + { + void *code; + func_pointer jit_func; +Index: mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_init.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/gallivm/lp_bld_init.h -+++ mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.h +--- mesa-24.0.7.orig/src/gallium/auxiliary/gallivm/lp_bld_init.h ++++ mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_init.h @@ -29,11 +29,14 @@ #ifndef LP_BLD_INIT_H #define LP_BLD_INIT_H @@ -515,7 +447,7 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.h #ifdef __cplusplus extern "C" { -@@ -44,18 +47,27 @@ struct gallivm_state +@@ -44,18 +47,25 @@ struct gallivm_state { char *module_name; LLVMModuleRef module; @@ -539,14 +471,12 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.h LLVMMCJITMemoryManagerRef memorymgr; struct lp_generated_code *code; +#endif -+ + LLVMContextRef context; + LLVMBuilderRef builder; -+ struct lp_cached_code *cache; unsigned compiled; LLVMValueRef coro_malloc_hook; -@@ -77,10 +89,15 @@ lp_build_init_native_width(void); +@@ -77,10 +87,15 @@ lp_build_init_native_width(void); bool lp_build_init(void); @@ -563,7 +493,7 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.h void gallivm_destroy(struct gallivm_state *gallivm); -@@ -93,11 +110,25 @@ gallivm_verify_function(struct gallivm_s +@@ -93,11 +108,19 @@ gallivm_verify_function(struct gallivm_s LLVMValueRef func); void @@ -577,22 +507,17 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init.h +void gallivm_compile_module(struct gallivm_state *gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+func_pointer -+gallivm_jit_function(struct gallivm_state *gallivm, -+ const char *func_name); -+#else func_pointer gallivm_jit_function(struct gallivm_state *gallivm, - LLVMValueRef func); -+#endif +- LLVMValueRef func); ++ LLVMValueRef func, const char *func_name); unsigned gallivm_get_perf_flags(void); -Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp +Index: mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp =================================================================== --- /dev/null -+++ mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp ++++ mesa-24.0.7/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp @@ -0,0 +1,959 @@ +#include "util/detect.h" +#include "util/u_cpu_detect.h" @@ -1534,7 +1459,7 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp + +func_pointer +gallivm_jit_function(struct gallivm_state *gallivm, -+ const char *func_name) ++ LLVMValueRef func, const char *func_name) +{ + return pointer_to_func( + LPJit::lookup_in_jd(func_name, gallivm->_per_module_jd)); @@ -1553,10 +1478,10 @@ Index: mesa-24.0.3/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp + M->setOverrideStackAlignment(align); +#endif +} -Index: mesa-24.0.3/src/gallium/auxiliary/meson.build +Index: mesa-24.0.7/src/gallium/auxiliary/meson.build =================================================================== ---- mesa-24.0.3.orig/src/gallium/auxiliary/meson.build -+++ mesa-24.0.3/src/gallium/auxiliary/meson.build +--- mesa-24.0.7.orig/src/gallium/auxiliary/meson.build ++++ mesa-24.0.7/src/gallium/auxiliary/meson.build @@ -347,7 +347,6 @@ if draw_with_llvm 'gallivm/lp_bld_gather.c', 'gallivm/lp_bld_gather.h', @@ -1577,10 +1502,10 @@ Index: mesa-24.0.3/src/gallium/auxiliary/meson.build endif files_libgalliumvl = files( -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_context.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_context.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_context.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_context.c +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_context.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_context.c @@ -49,6 +49,10 @@ #include "lp_screen.h" #include "lp_fence.h" @@ -1631,10 +1556,10 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_context.c /* * Create drawing context and plug our rendering stage into it. -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_context.h +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_context.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_context.h -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_context.h +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_context.h ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_context.h @@ -190,7 +190,11 @@ struct llvmpipe_context { unsigned render_cond_offset; @@ -1647,11 +1572,11 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_context.h int max_global_buffers; struct pipe_resource **global_buffers; -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_screen.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_screen.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_screen.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_screen.c -@@ -950,7 +950,11 @@ static void +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_screen.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_screen.c +@@ -955,7 +955,11 @@ static void lp_disk_cache_create(struct llvmpipe_screen *screen) { struct mesa_sha1 ctx; @@ -1663,33 +1588,29 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_screen.c unsigned char sha1[20]; char cache_id[20 * 2 + 1]; _mesa_sha1_init(&ctx); -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_cs.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_cs.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_cs.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_cs.c -@@ -397,6 +397,10 @@ generate_compute(struct llvmpipe_context +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_cs.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_cs.c +@@ -397,6 +397,8 @@ generate_compute(struct llvmpipe_context lp_build_coro_add_presplit(coro); variant->function = function; -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name, func_name); -+#endif for (i = 0; i < CS_ARG_MAX - !is_mesh; ++i) { if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) { -@@ -1006,6 +1010,10 @@ llvmpipe_remove_cs_shader_variant(struct +@@ -1006,6 +1008,8 @@ llvmpipe_remove_cs_shader_variant(struct lp->nr_cs_variants--; lp->nr_cs_instrs -= variant->nr_instrs; -+#if GALLIVM_USE_ORCJIT == 1 + if(variant->function_name) + FREE(variant->function_name); -+#endif FREE(variant); } -@@ -1264,12 +1272,22 @@ generate_variant(struct llvmpipe_context +@@ -1264,12 +1268,20 @@ generate_variant(struct llvmpipe_context generate_compute(lp, shader, variant); @@ -1698,50 +1619,53 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_cs.c + variant->nr_instrs += lp_build_count_ir_module(variant->gallivm->module); + + gallivm_compile_module(variant->gallivm); -+ -+ variant->jit_function = (lp_jit_cs_func) -+ gallivm_jit_function(variant->gallivm, variant->function_name); +#else gallivm_compile_module(variant->gallivm); variant->nr_instrs += lp_build_count_ir_module(variant->gallivm->module); ++#endif variant->jit_function = (lp_jit_cs_func) - gallivm_jit_function(variant->gallivm, variant->function); -+#endif +- gallivm_jit_function(variant->gallivm, variant->function); ++ gallivm_jit_function(variant->gallivm, variant->function, ++ variant->function_name); if (needs_caching) { lp_disk_cache_insert_shader(screen, &cached, ir_sha1_cache_key); -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_cs.h +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_cs.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_cs.h -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_cs.h -@@ -91,6 +91,9 @@ struct lp_compute_shader_variant +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_cs.h ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_cs.h +@@ -91,6 +91,7 @@ struct lp_compute_shader_variant LLVMTypeRef jit_vertex_header_ptr_type; LLVMTypeRef jit_prim_type; LLVMValueRef function; -+#if GALLIVM_USE_ORCJIT == 1 + char* function_name; -+#endif lp_jit_cs_func jit_function; /* Total number of LLVM instructions generated */ -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_fs.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_fs.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs.c -@@ -3207,6 +3207,10 @@ generate_fragment(struct llvmpipe_contex +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_fs.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_fs.c +@@ -3207,6 +3207,8 @@ generate_fragment(struct llvmpipe_contex LLVMSetFunctionCallConv(function, LLVMCCallConv); variant->function[partial_mask] = function; -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name[partial_mask] = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name[partial_mask], func_name); -+#endif /* XXX: need to propagate noalias down into color param now we are * passing a pointer-to-pointer? -@@ -3913,20 +3917,37 @@ generate_variant(struct llvmpipe_context +@@ -3306,6 +3308,7 @@ generate_fragment(struct llvmpipe_contex + LLVMValueRef glob_sample_pos = + LLVMAddGlobal(gallivm->module, + LLVMArrayType(flt_type, key->coverage_samples * 2), ""); ++ LLVMSetLinkage(glob_sample_pos, LLVMInternalLinkage); + LLVMValueRef sample_pos_array; + + if (key->multisample && key->coverage_samples == 4) { +@@ -3913,20 +3916,29 @@ generate_variant(struct llvmpipe_context * Compile everything */ @@ -1758,140 +1682,115 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs.c if (variant->function[RAST_EDGE_TEST]) { variant->jit_function[RAST_EDGE_TEST] = (lp_jit_frag_func) -+#if GALLIVM_USE_ORCJIT == 1 -+ gallivm_jit_function(variant->gallivm, -+ variant->function_name[RAST_EDGE_TEST]); -+#else gallivm_jit_function(variant->gallivm, - variant->function[RAST_EDGE_TEST]); -+#endif +- variant->function[RAST_EDGE_TEST]); ++ variant->function[RAST_EDGE_TEST], ++ variant->function_name[RAST_EDGE_TEST]); } if (variant->function[RAST_WHOLE]) { variant->jit_function[RAST_WHOLE] = (lp_jit_frag_func) -+#if GALLIVM_USE_ORCJIT == 1 -+ gallivm_jit_function(variant->gallivm, -+ variant->function_name[RAST_WHOLE]); -+#else gallivm_jit_function(variant->gallivm, - variant->function[RAST_WHOLE]); -+#endif +- variant->function[RAST_WHOLE]); ++ variant->function[RAST_WHOLE], ++ variant->function_name[RAST_WHOLE]); } else if (!variant->jit_function[RAST_WHOLE]) { variant->jit_function[RAST_WHOLE] = (lp_jit_frag_func) variant->jit_function[RAST_EDGE_TEST]; -@@ -3935,7 +3956,11 @@ generate_variant(struct llvmpipe_context +@@ -3935,7 +3947,8 @@ generate_variant(struct llvmpipe_context if (linear_pipeline) { if (variant->linear_function) { variant->jit_linear_llvm = (lp_jit_linear_llvm_func) -+#if GALLIVM_USE_ORCJIT == 1 -+ gallivm_jit_function(variant->gallivm, variant->linear_function_name); -+#else - gallivm_jit_function(variant->gallivm, variant->linear_function); -+#endif +- gallivm_jit_function(variant->gallivm, variant->linear_function); ++ gallivm_jit_function(variant->gallivm, variant->linear_function, ++ variant->linear_function_name); } /* -@@ -4111,6 +4136,14 @@ llvmpipe_destroy_shader_variant(struct l +@@ -4111,6 +4124,12 @@ llvmpipe_destroy_shader_variant(struct l { gallivm_destroy(variant->gallivm); lp_fs_reference(lp, &variant->shader, NULL); -+#if GALLIVM_USE_ORCJIT == 1 + if (variant->function_name[RAST_EDGE_TEST]) + FREE(variant->function_name[RAST_EDGE_TEST]); + if (variant->function_name[RAST_WHOLE]) + FREE(variant->function_name[RAST_WHOLE]); + if (variant->linear_function_name) + FREE(variant->linear_function_name); -+#endif FREE(variant); } -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs.h +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_fs.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_fs.h -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs.h -@@ -168,6 +168,9 @@ struct lp_fragment_shader_variant +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_fs.h ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_fs.h +@@ -168,6 +168,7 @@ struct lp_fragment_shader_variant LLVMTypeRef jit_linear_textures_type; LLVMValueRef function[2]; // [RAST_WHOLE], [RAST_EDGE_TEST] -+#if GALLIVM_USE_ORCJIT == 1 + char* function_name[2]; -+#endif lp_jit_frag_func jit_function[2]; // [RAST_WHOLE], [RAST_EDGE_TEST] -@@ -177,6 +180,9 @@ struct lp_fragment_shader_variant +@@ -177,6 +178,7 @@ struct lp_fragment_shader_variant /* Functions within the linear path: */ LLVMValueRef linear_function; -+#if GALLIVM_USE_ORCJIT == 1 + char* linear_function_name; -+#endif lp_jit_linear_llvm_func jit_linear_llvm; /* Bitmask to say what cbufs are unswizzled */ -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c -@@ -289,6 +289,10 @@ llvmpipe_fs_variant_linear_llvm(struct l +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c +@@ -289,6 +289,8 @@ llvmpipe_fs_variant_linear_llvm(struct l LLVMSetFunctionCallConv(function, LLVMCCallConv); variant->linear_function = function; -+#if GALLIVM_USE_ORCJIT == 1 + variant->linear_function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->linear_function_name, func_name); -+#endif /* XXX: need to propagate noalias down into color param now we are * passing a pointer-to-pointer? -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_setup.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_setup.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_setup.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_setup.c -@@ -688,6 +688,10 @@ generate_setup_variant(struct lp_setup_v +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_setup.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_setup.c +@@ -688,6 +688,8 @@ generate_setup_variant(struct lp_setup_v arg_types, ARRAY_SIZE(arg_types), 0); variant->function = LLVMAddFunction(gallivm->module, func_name, func_type); -+#if GALLIVM_USE_ORCJIT == 1 + variant->function_name = MALLOC(strlen(func_name)+1); + strcpy(variant->function_name, func_name); -+#endif if (!variant->function) goto fail; -@@ -731,8 +735,13 @@ generate_setup_variant(struct lp_setup_v - +@@ -732,7 +734,7 @@ generate_setup_variant(struct lp_setup_v gallivm_compile_module(gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ variant->jit_function = (lp_jit_setup_triangle) -+ gallivm_jit_function(gallivm, variant->function_name); -+#else variant->jit_function = (lp_jit_setup_triangle) - gallivm_jit_function(gallivm, variant->function); -+#endif +- gallivm_jit_function(gallivm, variant->function); ++ gallivm_jit_function(gallivm, variant->function, variant->function_name); if (!variant->jit_function) goto fail; -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_setup.h +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_setup.h =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_state_setup.h -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_state_setup.h -@@ -66,6 +66,9 @@ struct lp_setup_variant { +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_state_setup.h ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_state_setup.h +@@ -66,6 +66,7 @@ struct lp_setup_variant { * assembly. */ LLVMValueRef function; -+#if GALLIVM_USE_ORCJIT == 1 + char *function_name; -+#endif /* The actual generated setup function: */ -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_arit.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_arit.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_test_arit.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_arit.c +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_test_arit.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -417,7 +417,11 @@ test_unary(unsigned verbose, FILE *fp, c { char test_name[128]; @@ -1904,13 +1803,13 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_arit.c struct gallivm_state *gallivm; LLVMValueRef test_func; unary_func_t test_func_jit; -@@ -433,17 +437,28 @@ test_unary(unsigned verbose, FILE *fp, c +@@ -433,17 +437,25 @@ test_unary(unsigned verbose, FILE *fp, c in[i] = 1.0; } +#if GALLIVM_USE_ORCJIT == 1 + context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else @@ -1925,15 +1824,13 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_arit.c gallivm_compile_module(gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ test_func_jit = (unary_func_t) gallivm_jit_function(gallivm, test_name); -+#else - test_func_jit = (unary_func_t) gallivm_jit_function(gallivm, test_func); -+#endif +- test_func_jit = (unary_func_t) gallivm_jit_function(gallivm, test_func); ++ test_func_jit = (unary_func_t) gallivm_jit_function(gallivm, test_func, ++ test_name); gallivm_free_ir(gallivm); -@@ -512,7 +527,11 @@ test_unary(unsigned verbose, FILE *fp, c +@@ -512,7 +524,11 @@ test_unary(unsigned verbose, FILE *fp, c } gallivm_destroy(gallivm); @@ -1945,57 +1842,11 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_arit.c align_free(in); align_free(out); -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_blend.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_blend.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_test_blend.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_blend.c -@@ -131,16 +131,24 @@ dump_blend_type(FILE *fp, - } - - -+#if GALLIVM_USE_ORCJIT == 1 -+static const char * -+add_blend_test(struct gallivm_state *gallivm, -+ const struct pipe_blend_state *blend, -+ struct lp_type type) -+#else - static LLVMValueRef - add_blend_test(struct gallivm_state *gallivm, - const struct pipe_blend_state *blend, - struct lp_type type) -+#endif - { - LLVMModuleRef module = gallivm->module; - LLVMContextRef context = gallivm->context; - LLVMTypeRef vec_type; - LLVMTypeRef args[5]; - LLVMValueRef func; -+ const char *func_name = "test"; - LLVMValueRef src_ptr; - LLVMValueRef src1_ptr; - LLVMValueRef dst_ptr; -@@ -160,7 +168,7 @@ add_blend_test(struct gallivm_state *gal - vec_type = lp_build_vec_type(gallivm, type); - - args[4] = args[3] = args[2] = args[1] = args[0] = LLVMPointerType(vec_type, 0); -- func = LLVMAddFunction(module, "test", LLVMFunctionType(LLVMVoidTypeInContext(context), args, 5, 0)); -+ func = LLVMAddFunction(module, func_name, LLVMFunctionType(LLVMVoidTypeInContext(context), args, 5, 0)); - LLVMSetFunctionCallConv(func, LLVMCCallConv); - src_ptr = LLVMGetParam(func, 0); - src1_ptr = LLVMGetParam(func, 1); -@@ -188,7 +196,11 @@ add_blend_test(struct gallivm_state *gal - - gallivm_verify_function(gallivm, func); - -+#if GALLIVM_USE_ORCJIT == 1 -+ return func_name; -+#else - return func; -+#endif - } - - -@@ -437,9 +449,17 @@ test_one(unsigned verbose, +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_test_blend.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_blend.c +@@ -437,7 +437,11 @@ test_one(unsigned verbose, const struct pipe_blend_state *blend, struct lp_type type) { @@ -2005,21 +1856,15 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_blend.c LLVMContextRef context; +#endif struct gallivm_state *gallivm; -+#if GALLIVM_USE_ORCJIT == 1 -+ const char *func; -+#else LLVMValueRef func = NULL; -+#endif blend_test_ptr_t blend_test_ptr; - bool success; - const unsigned n = LP_TEST_NUM_SAMPLES; -@@ -451,10 +471,17 @@ test_one(unsigned verbose, +@@ -451,17 +455,25 @@ test_one(unsigned verbose, if (verbose >= 1) dump_blend_type(stdout, blend, type); +#if GALLIVM_USE_ORCJIT == 1 + context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else @@ -2031,7 +1876,16 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_blend.c gallivm = gallivm_create("test_module", context, NULL); func = add_blend_test(gallivm, blend, type); -@@ -584,7 +611,11 @@ test_one(unsigned verbose, + + gallivm_compile_module(gallivm); + +- blend_test_ptr = (blend_test_ptr_t)gallivm_jit_function(gallivm, func); ++ blend_test_ptr = (blend_test_ptr_t)gallivm_jit_function(gallivm, func, ++ "test"); + + gallivm_free_ir(gallivm); + +@@ -584,7 +596,11 @@ test_one(unsigned verbose, write_tsv_row(fp, blend, type, cycles_avg, success); gallivm_destroy(gallivm); @@ -2043,57 +1897,11 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_blend.c return success; } -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_conv.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_conv.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_test_conv.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_conv.c -@@ -96,16 +96,24 @@ dump_conv_types(FILE *fp, - } - - -+#if GALLIVM_USE_ORCJIT == 1 -+static const char * -+add_conv_test(struct gallivm_state *gallivm, -+ struct lp_type src_type, unsigned num_srcs, -+ struct lp_type dst_type, unsigned num_dsts) -+#else - static LLVMValueRef - add_conv_test(struct gallivm_state *gallivm, - struct lp_type src_type, unsigned num_srcs, - struct lp_type dst_type, unsigned num_dsts) -+#endif - { - LLVMModuleRef module = gallivm->module; - LLVMContextRef context = gallivm->context; - LLVMBuilderRef builder = gallivm->builder; - LLVMTypeRef args[2]; - LLVMValueRef func; -+ const char *func_name = "test"; - LLVMValueRef src_ptr; - LLVMValueRef dst_ptr; - LLVMBasicBlockRef block; -@@ -118,7 +126,7 @@ add_conv_test(struct gallivm_state *gall - args[0] = LLVMPointerType(src_vec_type, 0); - args[1] = LLVMPointerType(dst_vec_type, 0); - -- func = LLVMAddFunction(module, "test", -+ func = LLVMAddFunction(module, func_name, - LLVMFunctionType(LLVMVoidTypeInContext(context), - args, 2, 0)); - LLVMSetFunctionCallConv(func, LLVMCCallConv); -@@ -146,7 +154,11 @@ add_conv_test(struct gallivm_state *gall - - gallivm_verify_function(gallivm, func); - -+#if GALLIVM_USE_ORCJIT == 1 -+ return func_name; -+#else - return func; -+#endif - } - - -@@ -157,9 +169,17 @@ test_one(unsigned verbose, +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_test_conv.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_conv.c +@@ -157,7 +157,11 @@ test_one(unsigned verbose, struct lp_type src_type, struct lp_type dst_type) { @@ -2103,21 +1911,15 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_conv.c LLVMContextRef context; +#endif struct gallivm_state *gallivm; -+#if GALLIVM_USE_ORCJIT == 1 -+ const char *func; -+#else LLVMValueRef func = NULL; -+#endif conv_test_ptr_t conv_test_ptr; - bool success; - const unsigned n = LP_TEST_NUM_SAMPLES; -@@ -222,10 +242,17 @@ test_one(unsigned verbose, +@@ -222,17 +226,25 @@ test_one(unsigned verbose, eps *= 2; } +#if GALLIVM_USE_ORCJIT == 1 + context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else @@ -2129,7 +1931,16 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_conv.c gallivm = gallivm_create("test_module", context, NULL); func = add_conv_test(gallivm, src_type, num_srcs, dst_type, num_dsts); -@@ -337,7 +364,11 @@ test_one(unsigned verbose, + + gallivm_compile_module(gallivm); + +- conv_test_ptr = (conv_test_ptr_t)gallivm_jit_function(gallivm, func); ++ conv_test_ptr = (conv_test_ptr_t)gallivm_jit_function(gallivm, func, ++ "test"); + + gallivm_free_ir(gallivm); + +@@ -337,7 +349,11 @@ test_one(unsigned verbose, write_tsv_row(fp, src_type, dst_type, cycles_avg, success); gallivm_destroy(gallivm); @@ -2141,17 +1952,17 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_conv.c return success; } -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_format.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_test_format.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_test_format.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -79,9 +79,9 @@ static LLVMValueRef add_fetch_rgba_test(struct gallivm_state *gallivm, unsigned verbose, const struct util_format_description *desc, struct lp_type type, - unsigned use_cache) + unsigned use_cache, -+ char *name) ++ char *name) { - char name[256]; LLVMContextRef context = gallivm->context; @@ -2181,13 +1992,13 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c fetch_ptr_t fetch_ptr; alignas(16) uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; alignas(16) float unpacked[4]; -@@ -149,18 +154,29 @@ test_format_float(unsigned verbose, FILE +@@ -149,18 +154,25 @@ test_format_float(unsigned verbose, FILE bool success = true; unsigned i, j, k, l; +#if GALLIVM_USE_ORCJIT == 1 + context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else @@ -2204,15 +2015,12 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c gallivm_compile_module(gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch_name); -+#else - fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch); -+#endif +- fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch); ++ fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch, fetch_name); gallivm_free_ir(gallivm); -@@ -228,7 +244,11 @@ test_format_float(unsigned verbose, FILE +@@ -228,7 +240,11 @@ test_format_float(unsigned verbose, FILE } gallivm_destroy(gallivm); @@ -2224,7 +2032,7 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c if (fp) write_tsv_row(fp, desc, success); -@@ -243,9 +263,14 @@ test_format_unorm8(unsigned verbose, FIL +@@ -243,9 +259,14 @@ test_format_unorm8(unsigned verbose, FIL const struct util_format_description *desc, unsigned use_cache) { @@ -2239,13 +2047,13 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c fetch_ptr_t fetch_ptr; alignas(16) uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; uint8_t unpacked[4]; -@@ -253,18 +278,29 @@ test_format_unorm8(unsigned verbose, FIL +@@ -253,18 +274,25 @@ test_format_unorm8(unsigned verbose, FIL bool success = true; unsigned i, j, k, l; +#if GALLIVM_USE_ORCJIT == 1 + context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else @@ -2262,15 +2070,12 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c gallivm_compile_module(gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch_name); -+#else - fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch); -+#endif +- fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch); ++ fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch, fetch_name); gallivm_free_ir(gallivm); -@@ -331,7 +367,11 @@ test_format_unorm8(unsigned verbose, FIL +@@ -331,7 +359,11 @@ test_format_unorm8(unsigned verbose, FIL } gallivm_destroy(gallivm); @@ -2282,11 +2087,11 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_format.c if (fp) write_tsv_row(fp, desc, success); -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c =================================================================== --- /dev/null -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c -@@ -0,0 +1,172 @@ ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c +@@ -0,0 +1,167 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. @@ -2381,20 +2186,22 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c +{ + struct gallivm_state *gallivm; + const int N = 10; -+ LLVMValueRef func[N]; ++ LLVMValueRef *func = ++ (LLVMValueRef *) malloc(N * sizeof(LLVMValueRef)); + char func_name[N][64]; -+ test_printf_t test_lookup_multiple_func[N]; ++ test_printf_t *test_lookup_multiple_func = ++ (test_printf_t *)malloc(N * sizeof(test_printf_t)); + bool success = true; + int i; + +#if GALLIVM_USE_ORCJIT == 1 + LLVMOrcThreadSafeContextRef context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else + LLVMContextRef context = LLVMContextCreate(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(context, false); +#endif +#endif @@ -2406,30 +2213,23 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c + + gallivm_compile_module(gallivm); + -+#if GALLIVM_USE_ORCJIT == 1 + for(i = 0; i < N; i++){ -+ test_lookup_multiple_func[i] = (test_printf_t) gallivm_jit_function(gallivm, func_name[i]); ++ test_lookup_multiple_func[i] = (test_printf_t) gallivm_jit_function(gallivm, func[i], func_name[i]); + } -+ (void)func; -+#else -+ for(i = 0; i < N; i++){ -+ test_lookup_multiple_func[i] = (test_printf_t) gallivm_jit_function(gallivm, func[i]); -+ } -+#endif + + gallivm_free_ir(gallivm); + + for(i = 0; i < N; i++){ + test_lookup_multiple_func[i](0); + } -+ ++ FREE(func); ++ FREE(test_lookup_multiple_func); + gallivm_destroy(gallivm); +#if GALLIVM_USE_ORCJIT == 1 + LLVMOrcDisposeThreadSafeContext(context); +#else + LLVMContextDispose(context); +#endif -+ + return success; +} + @@ -2459,43 +2259,11 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_lookup_multiple.c + printf("no test_single()"); + return true; +} -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_printf.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_printf.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_test_printf.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_printf.c -@@ -57,12 +57,18 @@ write_tsv_header(FILE *fp) - typedef void (*test_printf_t)(int i); - - -+#if GALLIVM_USE_ORCJIT == 1 -+static const char * -+add_printf_test(struct gallivm_state *gallivm) -+#else - static LLVMValueRef - add_printf_test(struct gallivm_state *gallivm) -+#endif - { - LLVMModuleRef module = gallivm->module; -+ const char *func_name = "test_printf"; - LLVMTypeRef args[1] = { LLVMIntTypeInContext(gallivm->context, 32) }; -- LLVMValueRef func = LLVMAddFunction(module, "test_printf", LLVMFunctionType(LLVMVoidTypeInContext(gallivm->context), args, 1, 0)); -+ LLVMValueRef func = LLVMAddFunction(module, func_name, LLVMFunctionType(LLVMVoidTypeInContext(gallivm->context), args, 1, 0)); - LLVMBuilderRef builder = gallivm->builder; - LLVMBasicBlockRef block = LLVMAppendBasicBlockInContext(gallivm->context, func, "entry"); - -@@ -80,7 +86,11 @@ add_printf_test(struct gallivm_state *ga - - gallivm_verify_function(gallivm, func); - -+#if GALLIVM_USE_ORCJIT == 1 -+ return func_name; -+#else - return func; -+#endif - } - - -@@ -89,16 +99,31 @@ static bool +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_test_printf.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_test_printf.c +@@ -89,30 +89,46 @@ static bool test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) { @@ -2505,17 +2273,13 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_printf.c LLVMContextRef context; +#endif struct gallivm_state *gallivm; -+#if GALLIVM_USE_ORCJIT == 1 -+ const char *test; -+#else LLVMValueRef test; -+#endif test_printf_t test_printf_func; bool success = true; +#if GALLIVM_USE_ORCJIT == 1 + context = LLVMOrcCreateNewThreadSafeContext(); -+#if LLVM_VERSION_MAJOR >= 15 ++#if LLVM_VERSION_MAJOR == 15 + LLVMContextSetOpaquePointers(LLVMOrcThreadSafeContextGetContext(context), false); +#endif +#else @@ -2527,7 +2291,15 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_printf.c gallivm = gallivm_create("test_module", context, NULL); test = add_printf_test(gallivm); -@@ -112,7 +137,11 @@ test_printf(unsigned verbose, FILE *fp, + + gallivm_compile_module(gallivm); + +- test_printf_func = (test_printf_t) gallivm_jit_function(gallivm, test); ++ test_printf_func = (test_printf_t) gallivm_jit_function(gallivm, test, ++ "test_printf"); + + gallivm_free_ir(gallivm); + test_printf_func(0); gallivm_destroy(gallivm); @@ -2539,73 +2311,60 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_test_printf.c return success; } -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_texture_handle.c +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_texture_handle.c =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/lp_texture_handle.c -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/lp_texture_handle.c -@@ -201,14 +201,22 @@ llvmpipe_sampler_matrix_destroy(struct l +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/lp_texture_handle.c ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/lp_texture_handle.c +@@ -201,14 +201,15 @@ llvmpipe_sampler_matrix_destroy(struct l } static void * -+#if GALLIVM_USE_ORCJIT == 1 +-compile_function(struct llvmpipe_context *ctx, struct gallivm_state *gallivm, LLVMValueRef function, +compile_function(struct llvmpipe_context *ctx, struct gallivm_state *gallivm, LLVMValueRef function, const char *func_name, -+#else - compile_function(struct llvmpipe_context *ctx, struct gallivm_state *gallivm, LLVMValueRef function, -+#endif bool needs_caching, uint8_t cache_key[SHA1_DIGEST_LENGTH]) { gallivm_verify_function(gallivm, function); gallivm_compile_module(gallivm); -+#if GALLIVM_USE_ORCJIT == 1 -+ void *function_ptr = func_to_pointer(gallivm_jit_function(gallivm, func_name)); -+#else - void *function_ptr = func_to_pointer(gallivm_jit_function(gallivm, function)); -+#endif +- void *function_ptr = func_to_pointer(gallivm_jit_function(gallivm, function)); ++ void *function_ptr = func_to_pointer(gallivm_jit_function(gallivm, function, ++ func_name)); if (needs_caching) lp_disk_cache_insert_shader(llvmpipe_screen(ctx->pipe.screen), gallivm->cache, cache_key); -@@ -336,7 +344,11 @@ compile_image_function(struct llvmpipe_c +@@ -336,7 +337,7 @@ compile_image_function(struct llvmpipe_c free(image_soa); -+#if GALLIVM_USE_ORCJIT == 1 +- return compile_function(ctx, gallivm, function, needs_caching, cache_key); + return compile_function(ctx, gallivm, function, "image", needs_caching, cache_key); -+#else - return compile_function(ctx, gallivm, function, needs_caching, cache_key); -+#endif } static void * -@@ -484,7 +496,11 @@ compile_sample_function(struct llvmpipe_ +@@ -484,7 +485,7 @@ compile_sample_function(struct llvmpipe_ free(sampler_soa); -+#if GALLIVM_USE_ORCJIT == 1 +- return compile_function(ctx, gallivm, function, needs_caching, cache_key); + return compile_function(ctx, gallivm, function, "sample", needs_caching, cache_key); -+#else - return compile_function(ctx, gallivm, function, needs_caching, cache_key); -+#endif } static void * -@@ -566,7 +582,11 @@ compile_size_function(struct llvmpipe_co +@@ -566,7 +567,8 @@ compile_size_function(struct llvmpipe_co free(sampler_soa); -+#if GALLIVM_USE_ORCJIT == 1 -+ return compile_function(ctx, gallivm, function, "size", needs_caching, cache_key); -+#else - return compile_function(ctx, gallivm, function, needs_caching, cache_key); -+#endif +- return compile_function(ctx, gallivm, function, needs_caching, cache_key); ++ return compile_function(ctx, gallivm, function, "sample", needs_caching, ++ cache_key); } static void -Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/meson.build +Index: mesa-24.0.7/src/gallium/drivers/llvmpipe/meson.build =================================================================== ---- mesa-24.0.3.orig/src/gallium/drivers/llvmpipe/meson.build -+++ mesa-24.0.3/src/gallium/drivers/llvmpipe/meson.build +--- mesa-24.0.7.orig/src/gallium/drivers/llvmpipe/meson.build ++++ mesa-24.0.7/src/gallium/drivers/llvmpipe/meson.build @@ -132,7 +132,7 @@ driver_swrast = declare_dependency( if with_tests and with_gallium_softpipe and draw_with_llvm @@ -2615,10 +2374,10 @@ Index: mesa-24.0.3/src/gallium/drivers/llvmpipe/meson.build test( t, executable( -Index: mesa-24.0.3/src/util/detect_arch.h +Index: mesa-24.0.7/src/util/detect_arch.h =================================================================== ---- mesa-24.0.3.orig/src/util/detect_arch.h -+++ mesa-24.0.3/src/util/detect_arch.h +--- mesa-24.0.7.orig/src/util/detect_arch.h ++++ mesa-24.0.7/src/util/detect_arch.h @@ -101,6 +101,17 @@ #define DETECT_ARCH_HPPA 1 #endif diff --git a/mesa/0005-llvmpipe-linkage.patch b/mesa/0005-llvmpipe-linkage.patch deleted file mode 100644 index ad7773bcaa..0000000000 --- a/mesa/0005-llvmpipe-linkage.patch +++ /dev/null @@ -1,24 +0,0 @@ -From f5078cd9198e0d50814a66ecd4a96f105b2d36d5 Mon Sep 17 00:00:00 2001 -From: Yukari Chiba -Date: Thu, 21 Mar 2024 16:42:11 +0800 -Subject: [PATCH] llvmpipe: make unnamed global have internal linkage - ---- - src/gallium/drivers/llvmpipe/lp_state_fs.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c -index af7f8c4378d18..03ea7327ef27c 100644 ---- a/src/gallium/drivers/llvmpipe/lp_state_fs.c -+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c -@@ -3310,6 +3310,7 @@ generate_fragment(struct llvmpipe_context *lp, - LLVMValueRef glob_sample_pos = - LLVMAddGlobal(gallivm->module, - LLVMArrayType(flt_type, key->coverage_samples * 2), ""); -+ LLVMSetLinkage(glob_sample_pos, LLVMInternalLinkage); - LLVMValueRef sample_pos_array; - - if (key->multisample && key->coverage_samples == 4) { --- -GitLab - diff --git a/mesa/PKGBUILD b/mesa/PKGBUILD index 3a20e71434..1e9ed8a392 100644 --- a/mesa/PKGBUILD +++ b/mesa/PKGBUILD @@ -7,96 +7,114 @@ pkgbase=mesa pkgname=( - 'vulkan-mesa-layers' - 'vulkan-nouveau' - 'libva-mesa-driver' - 'mesa-vdpau' + mesa + libva-mesa-driver + mesa-vdpau ) case "${CARCH}" in - powerpc64le|riscv64|x86_64) pkgname+=('opencl-clover-mesa' 'opencl-rusticl-mesa' 'vulkan-intel' 'vulkan-powervr' 'vulkan-radeon' 'vulkan-swrast' 'vulkan-virtio') ;; + powerpc64le|riscv64|x86_64) + pkgname+=( + opencl-clover-mesa + opencl-rusticl-mesa + vulkan-intel + vulkan-powervr + vulkan-radeon + vulkan-swrast + vulkan-virtio + vulkan-mesa-layers + vulkan-nouveau + ) + ;; esac -pkgname+=('mesa') -pkgver=24.0.9 +pkgver=24.1.4 pkgrel=1 epoch=1 pkgdesc="Open-source OpenGL drivers" url="https://www.mesa3d.org/" arch=(x86_64 powerpc64le powerpc64 powerpc riscv64) -license=('MIT AND BSD-3-Clause AND SGI-B-2.0') +license=("MIT AND BSD-3-Clause AND SGI-B-2.0") makedepends=( - 'clang' - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'libglvnd' - 'libva' - 'libvdpau' - 'libx11' - 'libxcb' - 'libxext' - 'libxfixes' - 'libxml2' - 'libxrandr' - 'libxshmfence' - 'libxxf86vm' - 'llvm' - 'llvm-libs' - 'lm_sensors' - 'python-packaging' - 'rust' - 'spirv-llvm-translator' - 'spirv-tools' - 'systemd-libs' - 'vulkan-icd-loader' - 'wayland' - 'xcb-util-keysyms' - 'zlib' - 'zstd' + clang + expat + gcc-libs + glibc + libdrm + libelf + libglvnd + libva + libvdpau + libx11 + libxcb + libxext + libxfixes + libxml2 + libxrandr + libxshmfence + libxxf86vm + llvm + llvm-libs + lm_sensors + rust + spirv-llvm-translator + spirv-tools + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd # shared between mesa and lib32-mesa - 'clang' - 'cmake' - 'elfutils' - 'glslang' - 'libclc' - 'meson' - 'python-mako' - 'python-ply' - 'rust-bindgen' - 'wayland-protocols' - 'xorgproto' + cbindgen + clang + cmake + elfutils + glslang + libclc + meson + python-pycparser + python-mako + python-packaging + python-ply + rust-bindgen + wayland-protocols + xorgproto # valgrind deps - 'valgrind' + valgrind # d3d12 deps - 'directx-headers' + directx-headers # gallium-omx deps - 'libomxil-bellagio' + libomxil-bellagio +) +options=( + # GCC 14 LTO causes segfault in LLVM under si_llvm_optimize_module + # https://gitlab.freedesktop.org/mesa/mesa/-/issues/11140 + # + # In general, upstream considers LTO to be broken until explicit notice. + !lto ) -options=(!lto) # use meson enabled LTO source=( - https://mesa.freedesktop.org/archive/mesa-${pkgver}.tar.xz{,.sig} + "https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz"{,.sig} + 0001-Revert-frontends-va-Fix-AV1-slice_data_offset-with-m.patch 0001-i915-non-x86.patch 0002-big-endian-flipping.patch 0003-gallivm-llvm17-temporary-stopgap.patch - 0004-add-llvm-orcjit.patch - 0005-llvmpipe-linkage.patch ) validpgpkeys=( - '8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D' # Emil Velikov - '946D09B5E4C9845E63075FF1D961C596A7203456' # Andres Gomez - 'E3E8F480C52ADD73B278EE78E1ECBE07D7D70895' # Juan Antonio Suárez Romero (Igalia, S.L.) - 'A5CC9FEC93F2F837CB044912336909B6B25FADFA' # Juan A. Suarez Romero - '71C4B75620BC75708B4BDB254C95FAAB3EB073EC' # Dylan Baker - '57551DE15B968F6341C248F68D8E31AFC32428A6' # Eric Engestrom + 946D09B5E4C9845E63075FF1D961C596A7203456 # Andres Gomez + 71C4B75620BC75708B4BDB254C95FAAB3EB073EC # Dylan Baker + 8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D # Emil Velikov + 57551DE15B968F6341C248F68D8E31AFC32428A6 # Eric Engestrom + A5CC9FEC93F2F837CB044912336909B6B25FADFA # Juan A. Suarez Romero + E3E8F480C52ADD73B278EE78E1ECBE07D7D70895 # Juan Antonio Suárez Romero (Igalia, S.L.) ) # Rust crates for NVK, used as Meson subprojects declare -A _crates=( + paste 1.0.14 proc-macro2 1.0.70 quote 1.0.33 syn 2.0.39 @@ -104,32 +122,37 @@ declare -A _crates=( ) for _crate in "${!_crates[@]}"; do - source+=($_crate-${_crates[$_crate]}.tar.gz::https://crates.io/api/v1/crates/$_crate/${_crates[$_crate]}/download) + _ver="${_crates[$_crate]}" + source+=( + "$_crate-$_ver.tar.gz::https://crates.io/api/v1/crates/$_crate/$_ver/download" + ) done -sha256sums=('51aa686ca4060e38711a9e8f60c8f1efaa516baf411946ed7f2c265cd582ca4c' +sha256sums=('7cf7c6f665263ad0122889c1d4b076654c1eedea7a2f38c69c8c51579937ade1' 'SKIP' + 'db209e829f8888396dc89f06cc650048170ab8a830247a8a243de206a8121937' 'a82392ed26b32a4edd57ec2ca40db0a556787932edd59681eeedf4a21861b9d0' '0a8f2792dfd0469bc41540884fe2a1dbf4f0fd92f53bad5b9db831ac1e59dd11' '91aa7f86d688d81cdbfaf2087ba302f5efe80ccdd347211dbb8c2cff81331f08' - '4190ff24b91794a323f3772499fc42f18f0b0a73fb3dd4bd173eade6cd3df576' - '765ce1a5b160ebf6579dc4bcbcf27801b05b9f0d1419251bcd5181bbde6f19a1' '39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b' '3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b' '5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae' + 'de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c' '23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a') -b2sums=('3c68e544898031fe76a57ea754f46ede5b105c259d13dd484eaa63fe51b7d52cf76a4084529b11a586c4d8d06f4cb32f993fd1ea4e6ccc4cbc91e78fe755743a' +b2sums=('2109fc604858a0927271d7b1edb76a24514acac6117e564c6999c99f068624964f5cf0b7d022cac5726e432353a32a5278b3aa00b64dd4118bb2f0b7123c3b41' 'SKIP' + 'bc2897ab0a7718d38e7843f85f15aa50b06fd89aed1ea494119f9e486ef0a82c500554913fb8ca26f2c0df4ce4fe9067188341a6c90556453fc80558afaaada9' '73489865623395ee749742145ea2f75473a85c14c9a129f68f29ae5936ffb3ea6018a5d2f53c19aefdd8a2aff2f2d7c1d0f393b00496f11867b8588c99d26432' 'c28718783873be25fa2d6c0f43fae900f93e2f20df1c11a40ec86622112b7be7e7f50c3b77e52849fec9288fb8da3744d8bc2027df941ffd0b8c558fe3a927ba' 'd394b24db892e0a3d9441366667ecb56b9c6b57086203993530876e6cafa33239707e6e98f1212c55a2bc92f590bf4f9895ac619252cdad215c4ae0479d2cd39' - '09ad43633a4001827ce484fddc9dd8a991cc1cb3254c008c01f9af502dfaf960648b292733e230af7fc85efc9751fec79baefa8eabfb49e2bea1aedf884799bd' - 'eccd452b553895c041199991b23a9aa7244a0651d089f230dd0393f9e4bb8515e7b30f94eeea4dc5526ea287f3a62e1a82cd86dc282664eeec6de2fe04598aee' 'fff0dec06b21e391783cc136790238acb783780eaedcf14875a350e7ceb46fdc100c8b9e3f09fb7f4c2196c25d4c6b61e574c0dad762d94533b628faab68cf5c' '4cede03c08758ccd6bf53a0d0057d7542dfdd0c93d342e89f3b90460be85518a9fd24958d8b1da2b5a09b5ddbee8a4263982194158e171c2bba3e394d88d6dac' '77c4b166f1200e1ee2ab94a5014acd334c1fe4b7d72851d73768d491c56c6779a0882a304c1f30c88732a6168351f0f786b10516ae537cff993892a749175848' + '35e8548611c51ee75f4d04926149e5e54870d7073d9b635d550a6fa0f85891f57f326bdbcff3dd8618cf40f8e08cf903ef87d9c034d5921d8b91e1db842cdd7c' '2cff6626624d03f70f1662af45a8644c28a9f92e2dfe38999bef3ba4a4c1ce825ae598277e9cb7abd5585eebfb17b239effc8d0bbf1c6ac196499f0d288e5e01') +# https://docs.mesa3d.org/relnotes.html + prepare() { cd mesa-$pkgver @@ -138,35 +161,36 @@ prepare() { # https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/2020604 echo "$pkgver-arch$epoch.$pkgrel" >VERSION - # be ready to intel graphics when 6.8 drops + # Fix AV1 decode + # https://gitlab.freedesktop.org/mesa/mesa/-/issues/11533 + # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30255 + patch -Np1 -i ../0001-Revert-frontends-va-Fix-AV1-slice_data_offset-with-m.patch + patch -Np1 -i ../0001-i915-non-x86.patch # Big endian specific patch -Np1 -i ../0002-big-endian-flipping.patch #FIXME: bypass passmanager in gallivm with LLVM 17 - patch -Np1 -i ../0003-gallivm-llvm17-temporary-stopgap.patch - - patch -Np1 -i ../0004-add-llvm-orcjit.patch - patch -Np1 -i ../0005-llvmpipe-linkage.patch + #patch -Np1 -i ../0003-gallivm-llvm17-temporary-stopgap.patch } build() { case "${CARCH}" in x86_64) - _platform_vulkan_drivers='amd,virtio,swrast,iris,intel_hasvk,nouveau-experimental' + _platform_vulkan_drivers='amd,virtio,swrast,iris,intel_hasvk,nouveau' _platform_gallium_drivers=',crocus,i915,iris,svga,virgl,zink,d3d12' ;; powerpc64le) - _platform_vulkan_drivers='amd,virtio,swrast,intel,intel,imagination-experimental,nouveau-experimental' + _platform_vulkan_drivers='amd,virtio,swrast,intel,intel,imagination-experimental,nouveau' _platform_gallium_drivers=',i915,iris,etnaviv,lima,swrast,virgl,zink,d3d12' ;; powerpc|powerpc64) - _platform_vulkan_drivers='nouveau-experimental' + _platform_vulkan_drivers='' _platform_gallium_drivers=',swrast' ;; riscv64) - _platform_vulkan_drivers='amd,virtio,swrast,intel,intel,imagination-experimental,nouveau-experimental' + _platform_vulkan_drivers='amd,virtio,swrast,intel,intel,imagination-experimental,nouveau' _platform_gallium_drivers=',i915,iris,etnaviv,lima,swrast,virgl,zink,d3d12' ;; esac @@ -174,25 +198,14 @@ build() { local meson_options=( -D android-libbacktrace=disabled -D b_ndebug=true - -D dri3=enabled - -D egl=enabled -D gallium-drivers=r300,r600,radeonsi,nouveau${_platform_gallium_drivers} -D gallium-extra-hud=true -D gallium-omx=bellagio - -D gallium-va=enabled - -D gallium-vdpau=enabled - -D gallium-xa=enabled - -D gbm=enabled -D gles1=disabled - -D gles2=enabled - -D glvnd=true -D glx=dri - -D intel-clc=enabled -D libunwind=disabled - -D lmsensors=enabled -D microsoft-clc=disabled -D platforms=x11,wayland - -D shared-glapi=enabled -D valgrind=enabled -D video-codecs=all -D vulkan-drivers=${_platform_vulkan_drivers} @@ -201,298 +214,150 @@ build() { case "${CARCH}" in powerpc|powerpc64) meson_options+=( - -D power8=false -D gallium-nine=false -D glx-direct=true -D llvm=disabled -D draw-use-llvm=false - -D osmesa=true) + -D osmesa=true + -D intel-rt=disabled + ) ;; powerpc64le) meson_options+=( - -D power8=true -D llvm=enabled + -D intel-clc=enabled -D gallium-nine=true -D gallium-opencl=icd -D gallium-rusticl=true - -D osmesa=true) ;; - riscv64) meson_options+=( - -D llvm-orcjit=true - -D gallium-nine=true - -D imagination-srv=true - -D llvm=enabled - -D gallium-opencl=icd - -D gallium-rusticl=true -D osmesa=true - -D llvm-orcjit=true + -D intel-rt=disabled ) ;; - *) meson_options+=( - -D power8=true + riscv64) meson_options+=( + #-D llvm-orcjit=true + -D gallium-nine=true + -D imagination-srv=true -D llvm=enabled + -D intel-clc=enabled + -D gallium-opencl=icd + -D gallium-rusticl=true + -D osmesa=true + -D intel-rt=disabled + ) + ;; + x86_64) meson_options+=( + -D intel-rt=enabled + -D llvm=enabled + -D intel-clc=enabled -D gallium-nine=true -D gallium-opencl=icd -D gallium-rusticl=true - -D osmesa=true) ;; + -D osmesa=true + ) + ;; esac # Build only minimal debug info to reduce size - CFLAGS+=' -g1' - CXXFLAGS+=' -g1' + CFLAGS+=" -g1" + CXXFLAGS+=" -g1" # Inject subproject packages export MESON_PACKAGE_CACHE_DIR="$srcdir" arch-meson mesa-$pkgver build "${meson_options[@]}" - meson configure build # Print config meson compile -C build - - # fake installation to be seperated into packages - # outside of fakeroot but mesa doesn't need to chown/mod - DESTDIR="${srcdir}/fakeinstall" meson install -C build } -_install() { - local src f dir - for src; do - f="${src#fakeinstall/}" - dir="${pkgdir}/${f%/*}" - install -m755 -d "${dir}" - mv -v "${src}" "${dir}/" +_pick() { + local p="$1" f d; shift + for f; do + d="$srcdir/$p/${f#$pkgdir/}" + mkdir -p "$(dirname "$d")" + mv -v "$f" "$d" + rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")" done } -_libdir=usr/lib - -package_vulkan-mesa-layers() { - pkgdesc="Mesa's Vulkan layers" +package_mesa() { depends=( - 'gcc-libs' - 'glibc' - 'libdrm' - 'libxcb' - 'wayland' + expat + gcc-libs + glibc + libdrm + libelf + libglvnd + libx11 + libxcb + libxext + libxfixes + libxshmfence + libxxf86vm + llvm-libs + lm_sensors + wayland + zlib + zstd - 'python' + libomxil-bellagio ) - conflicts=('vulkan-mesa-layer') - replaces=('vulkan-mesa-layer') - - _install fakeinstall/usr/share/vulkan/explicit_layer.d - _install fakeinstall/usr/share/vulkan/implicit_layer.d - _install fakeinstall/$_libdir/libVkLayer_*.so - _install fakeinstall/usr/bin/mesa-overlay-control.py - - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} - -package_opencl-clover-mesa() { - pkgdesc="Open-source OpenCL drivers - Clover variant" - depends=( - 'clang' - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'llvm-libs' - 'spirv-llvm-translator' - 'spirv-tools' - 'zlib' - 'zstd' - - 'libclc' + optdepends=("opengl-man-pages: for the OpenGL API man pages") + provides=( + mesa-libgl + opengl-driver ) - optdepends=('opencl-headers: headers necessary for OpenCL development') - provides=('opencl-driver') - replaces=("opencl-mesa<=23.1.4-1") - conflicts=('opencl-mesa') + conflicts=(mesa-libgl) + replaces=(mesa-libgl) - _install fakeinstall/etc/OpenCL/vendors/mesa.icd - _install fakeinstall/$_libdir/libMesaOpenCL* - _install fakeinstall/$_libdir/gallium-pipe + meson install -C build --destdir "$pkgdir" - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} + ( + local libdir=usr/lib icddir=usr/share/vulkan/icd.d -package_opencl-rusticl-mesa() { - pkgdesc="Open-source OpenCL drivers - RustICL variant" - depends=( - 'clang' - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'llvm-libs' - 'spirv-llvm-translator' - 'spirv-tools' - 'zlib' - 'zstd' + cd "$pkgdir" - 'libclc' + _pick libva $libdir/dri/*_drv_video.so + + _pick vdpau $libdir/vdpau + + case "${CARCH}" in + powerpc|powerpc64) ;; + *) + _pick clover $libdir/gallium-pipe + + _pick clover $libdir/libMesaOpenCL* + _pick clover etc/OpenCL/vendors/mesa.icd + + _pick clrust $libdir/libRusticlOpenCL* + _pick clrust etc/OpenCL/vendors/rusticl.icd + + _pick vkintel $icddir/intel_*.json + _pick vkintel $libdir/libvulkan_intel*.so + + _pick vklayer $libdir/libVkLayer_*.so + _pick vklayer usr/bin/mesa-overlay-control.py + _pick vklayer usr/share/vulkan/{ex,im}plicit_layer.d + + _pick vknvidia $icddir/nouveau_*.json + _pick vknvidia $libdir/libvulkan_nouveau*.so + + _pick vkradeon $icddir/radeon_icd*.json + _pick vkradeon $libdir/libvulkan_radeon.so + _pick vkradeon usr/share/drirc.d/00-radv-defaults.conf + + _pick vkswrast $icddir/lvp_icd*.json + _pick vkswrast $libdir/libvulkan_lvp.so + + _pick vkvirtio $icddir/virtio_icd*.json + _pick vkvirtio $libdir/libvulkan_virtio.so + + _pick vkpowervr $icddir/powervr_*.json + _pick vkpowervr $libdir/libpowervr_rogue.so + _pick vkpowervr $libdir/libvulkan_powervr*.so + + ;; + esac + # indirect rendering + ln -sr $libdir/libGLX_{mesa,indirect}.so.0 ) - optdepends=('opencl-headers: headers necessary for OpenCL development') - provides=('opencl-driver') - replaces=("opencl-mesa<=23.1.4-1") - conflicts=('opencl-mesa') - - _install fakeinstall/etc/OpenCL/vendors/rusticl.icd - _install fakeinstall/$_libdir/libRusticlOpenCL* - - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} - -package_vulkan-intel() { - pkgdesc="Open-source Vulkan driver for Intel GPUs" - depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libx11' - 'libxcb' - 'libxshmfence' - 'systemd-libs' - 'vulkan-icd-loader' - 'wayland' - 'xcb-util-keysyms' - 'zlib' - 'zstd' - ) - optdepends=('vulkan-mesa-layers: additional vulkan layers') - provides=('vulkan-driver') - - _install fakeinstall/usr/share/vulkan/icd.d/intel_*.json - _install fakeinstall/$_libdir/libvulkan_intel*.so - - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} - -package_vulkan-nouveau() { - pkgdesc="Open-source Vulkan driver for Nvidia GPUs" - depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libx11' - 'libxcb' - 'libxshmfence' - 'systemd-libs' - 'vulkan-icd-loader' - 'wayland' - 'xcb-util-keysyms' - 'zlib' - 'zstd' - ) - optdepends=('vulkan-mesa-layers: additional vulkan layers') - provides=('vulkan-driver') - - _install fakeinstall/usr/share/vulkan/icd.d/nouveau_*.json - _install fakeinstall/$_libdir/libvulkan_nouveau*.so - - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} - -package_vulkan-radeon() { - pkgdesc="Open-source Vulkan driver for AMD GPUs" - depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'libx11' - 'libxcb' - 'libxshmfence' - 'llvm-libs' - 'systemd-libs' - 'vulkan-icd-loader' - 'wayland' - 'xcb-util-keysyms' - 'zlib' - 'zstd' - ) - optdepends=('vulkan-mesa-layers: additional vulkan layers') - provides=('vulkan-driver') - - _install fakeinstall/usr/share/drirc.d/00-radv-defaults.conf - _install fakeinstall/usr/share/vulkan/icd.d/radeon_icd*.json - _install fakeinstall/$_libdir/libvulkan_radeon.so - - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} - -package_vulkan-swrast() { - pkgdesc="Open-source Vulkan driver for CPUs (Software Rasterizer)" - depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libx11' - 'libxcb' - 'libxshmfence' - 'llvm-libs' - 'systemd-libs' - 'vulkan-icd-loader' - 'wayland' - 'xcb-util-keysyms' - 'zlib' - 'zstd' - ) - optdepends=('vulkan-mesa-layers: additional vulkan layers') - conflicts=('vulkan-mesa') - replaces=('vulkan-mesa') - provides=('vulkan-driver') - - _install fakeinstall/usr/share/vulkan/icd.d/lvp_icd*.json - _install fakeinstall/$_libdir/libvulkan_lvp.so - - install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" -} - -package_vulkan-powervr() { - pkgdesc="Imagination PowerVR Vulkan mesa driver" - depends=( - 'libdrm' - 'libx11' - 'libxshmfence' - 'systemd' - 'wayland' - 'xcb-util-keysyms' - 'zstd' - ) - optdepends=('vulkan-mesa-layers: additional vulkan layers') - provides=('vulkan-driver') - - _install fakeinstall/usr/share/vulkan/icd.d/powervr_*.json - _install fakeinstall/$_libdir/libpowervr_rogue.so - _install fakeinstall/$_libdir/libvulkan_powervr*.so -} - -package_vulkan-virtio() { - pkgdesc="Open-source Vulkan driver for Virtio-GPU (Venus)" - depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libx11' - 'libxcb' - 'libxshmfence' - 'systemd-libs' - 'vulkan-icd-loader' - 'wayland' - 'xcb-util-keysyms' - 'zlib' - 'zstd' - ) - optdepends=('vulkan-mesa-layers: additional vulkan layers') - provides=('vulkan-driver') - - _install fakeinstall/usr/share/vulkan/icd.d/virtio_icd*.json - _install fakeinstall/$_libdir/libvulkan_virtio.so install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" } @@ -500,21 +365,21 @@ package_vulkan-virtio() { package_libva-mesa-driver() { pkgdesc="Open-source VA-API drivers" depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'libx11' - 'libxcb' - 'libxshmfence' - 'llvm-libs' - 'zlib' - 'zstd' + expat + gcc-libs + glibc + libdrm + libelf + libx11 + libxcb + libxshmfence + llvm-libs + zlib + zstd ) - provides=('libva-driver') + provides=(libva-driver) - _install fakeinstall/$_libdir/dri/*_drv_video.so + mv libva/* "$pkgdir" install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" } @@ -522,92 +387,249 @@ package_libva-mesa-driver() { package_mesa-vdpau() { pkgdesc="Open-source VDPAU drivers" depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'libx11' - 'libxcb' - 'libxshmfence' - 'llvm-libs' - 'zlib' - 'zstd' + expat + gcc-libs + glibc + libdrm + libelf + libx11 + libxcb + libxshmfence + llvm-libs + zlib + zstd ) - provides=('vdpau-driver') + provides=(vdpau-driver) - _install fakeinstall/$_libdir/vdpau + mv vdpau/* "$pkgdir" install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" } -package_mesa() { +package_opencl-clover-mesa() { + pkgdesc="Open-source OpenCL drivers - Clover variant" depends=( - 'expat' - 'gcc-libs' - 'glibc' - 'libdrm' - 'libelf' - 'libglvnd' - 'libx11' - 'libxcb' - 'libxext' - 'libxfixes' - 'libxshmfence' - 'libxxf86vm' - 'llvm-libs' - 'lm_sensors' - 'wayland' - 'zlib' - 'zstd' + clang + expat + gcc-libs + glibc + libdrm + libelf + llvm-libs + spirv-llvm-translator + spirv-tools + zlib + zstd - 'libomxil-bellagio' + libclc ) - optdepends=( - 'opengl-man-pages: for the OpenGL API man pages' + optdepends=("opencl-headers: headers necessary for OpenCL development") + provides=(opencl-driver) + replaces=("opencl-mesa<=23.1.4-1") + conflicts=(opencl-mesa) + + mv clover/* "$pkgdir" + + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} + +package_opencl-rusticl-mesa() { + pkgdesc="Open-source OpenCL drivers - RustICL variant" + depends=( + clang + expat + gcc-libs + glibc + libdrm + libelf + llvm-libs + spirv-llvm-translator + spirv-tools + zlib + zstd + + libclc ) - provides=( - 'mesa-libgl' - 'opengl-driver' + optdepends=("opencl-headers: headers necessary for OpenCL development") + provides=(opencl-driver) + replaces=("opencl-mesa<=23.1.4-1") + conflicts=(opencl-mesa) + + mv clrust/* "$pkgdir" + + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} + +package_vulkan-intel() { + pkgdesc="Open-source Vulkan driver for Intel GPUs" + depends=( + expat + gcc-libs + glibc + libdrm + libx11 + libxcb + libxshmfence + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd ) - conflicts=('mesa-libgl') - replaces=('mesa-libgl') + optdepends=("vulkan-mesa-layers: additional vulkan layers") + provides=(vulkan-driver) - _install fakeinstall/usr/share/drirc.d/00-mesa-defaults.conf - _install fakeinstall/usr/share/glvnd/egl_vendor.d/50_mesa.json + mv vkintel/* "$pkgdir" - # ati-dri, nouveau-dri, intel-dri, svga-dri, swrast, swr - _install fakeinstall/$_libdir/dri/*_dri.so + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} - case "${CARCH}" in - riscv64) _install fakeinstall/$_libdir/libomxil-bellagio0 ;; - *) _install fakeinstall/$_libdir/bellagio ;; - esac +package_vulkan-mesa-layers() { + pkgdesc="Mesa's Vulkan layers" + depends=( + gcc-libs + glibc + libdrm + libxcb + wayland - case "${CARCH}" in - powerpc|powerpc64) ;; - *) - _install fakeinstall/$_libdir/d3d - ;; - esac - - _install fakeinstall/$_libdir/libOSMesa.so* - - _install fakeinstall/$_libdir/lib{gbm,glapi}.so* - _install fakeinstall/$_libdir/libxatracker.so* + python + ) + conflicts=(vulkan-mesa-layer) + replaces=(vulkan-mesa-layer) - _install fakeinstall/usr/include - _install fakeinstall/$_libdir/pkgconfig + mv vklayer/* "$pkgdir" - # libglvnd support - _install fakeinstall/$_libdir/libGLX_mesa.so* - _install fakeinstall/$_libdir/libEGL_mesa.so* + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} - # indirect rendering - ln -sr "$pkgdir"/$_libdir/libGLX_{mesa,indirect}.so.0 +package_vulkan-nouveau() { + pkgdesc="Open-source Vulkan driver for Nvidia GPUs" + depends=( + expat + gcc-libs + glibc + libdrm + libx11 + libxcb + libxshmfence + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd + ) + optdepends=("vulkan-mesa-layers: additional vulkan layers") + provides=(vulkan-driver) - # make sure there are no files left to install - find fakeinstall -depth -print0 | xargs -0 rmdir + mv vknvidia/* "$pkgdir" + + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} + +package_vulkan-radeon() { + pkgdesc="Open-source Vulkan driver for AMD GPUs" + depends=( + expat + gcc-libs + glibc + libdrm + libelf + libx11 + libxcb + libxshmfence + llvm-libs + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd + ) + optdepends=("vulkan-mesa-layers: additional vulkan layers") + provides=(vulkan-driver) + + mv vkradeon/* "$pkgdir" + + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} + +package_vulkan-swrast() { + pkgdesc="Open-source Vulkan driver for CPUs (Software Rasterizer)" + depends=( + expat + gcc-libs + glibc + libdrm + libx11 + libxcb + libxshmfence + llvm-libs + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd + ) + optdepends=("vulkan-mesa-layers: additional vulkan layers") + conflicts=(vulkan-mesa) + replaces=(vulkan-mesa) + provides=(vulkan-driver) + + mv vkswrast/* "$pkgdir" + + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} + +package_vulkan-powervr() { + pkgdesc="Imagination PowerVR Vulkan mesa driver" + depends=( + expat + gcc-libs + glibc + libdrm + libx11 + libxcb + libxshmfence + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd + ) + optdepends=('vulkan-mesa-layers: additional vulkan layers') + provides=('vulkan-driver') + + mv vkpowervr/* "$pkgdir" + + install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" +} + +package_vulkan-virtio() { + pkgdesc="Open-source Vulkan driver for Virtio-GPU (Venus)" + depends=( + expat + gcc-libs + glibc + libdrm + libx11 + libxcb + libxshmfence + systemd-libs + vulkan-icd-loader + wayland + xcb-util-keysyms + zlib + zstd + ) + optdepends=("vulkan-mesa-layers: additional vulkan layers") + provides=(vulkan-driver) + + mv vkvirtio/* "$pkgdir" install -Dm644 mesa-$pkgver/docs/license.rst -t "$pkgdir/usr/share/licenses/$pkgname" }