ac/llvm: export ac_init_llvm_once in targets
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 25 Jun 2020 13:14:01 +0000 (15:14 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 10 Jul 2020 09:57:11 +0000 (11:57 +0200)
If a program like mpv uses both radeon_dri.so (because --vo=gpu) and
radeonsi_drv_video.so (because --hwdec=vaapi) then LLVM will be inialized twice.

The commit exports the ac_init_llvm_once so there's only one instance of the
function.

See also 18b12bf5335 ("targets: export radeon winsys_create functions to silence LLVM warning")
which implemented this workaround initially.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1377
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5648>

src/amd/llvm/ac_llvm_util.c
src/amd/vulkan/meson.build
src/gallium/targets/dri-vdpau.dyn
src/gallium/targets/dri/dri.sym
src/gallium/targets/omx/omx.sym
src/gallium/targets/pipe-loader/pipe.sym
src/gallium/targets/va/va.sym
src/gallium/targets/vdpau/vdpau.sym

index 62e163b0057433f7d6354f40a223f4f73c421039..937e0dbf1fbfb555ce93b60a4b255c7734ceda41 100644 (file)
@@ -78,10 +78,9 @@ static void ac_init_llvm_target()
        LLVMParseCommandLineOptions(ARRAY_SIZE(argv), argv, NULL);
 }
 
-static once_flag ac_init_llvm_target_once_flag = ONCE_FLAG_INIT;
-
-void ac_init_llvm_once(void)
+PUBLIC void ac_init_llvm_once(void)
 {
+       static once_flag ac_init_llvm_target_once_flag = ONCE_FLAG_INIT;
        call_once(&ac_init_llvm_target_once_flag, ac_init_llvm_target);
 }
 
index d4127b9d6020f9ed4beacf0f9f41ad26c5054350..a44e785b22319deb855ef1cdfce72aae6b8bfa46 100644 (file)
@@ -176,6 +176,7 @@ if with_symbols_check
     args : [
       '--lib', libvulkan_radeon,
       '--symbols-file', vulkan_icd_symbols,
+      '--ignore-symbol', 'ac_init_llvm_once',
       symbols_check_args,
     ],
     suite : ['amd'],
index a7919f7d3ba30c664debd8b3eee6e8303552ea25..d37123a865945e3450ee793d66a6bfc41ef79e5b 100644 (file)
@@ -2,4 +2,5 @@
        nouveau_drm_screen_create;
        radeon_drm_winsys_create;
        amdgpu_winsys_create;
+       ac_init_llvm_once;
 };
index 1fdf18beee76734152c6cec3d48f758941482682..83914c60cf3d1a1f7f7777f477d08e470a9f2641 100644 (file)
@@ -6,6 +6,7 @@
                radeon_drm_winsys_create;
                amdgpu_winsys_create;
                fd_drm_screen_create;
+               ac_init_llvm_once;
        local:
                *;
 };
index 07b65e57643fd8a55396c1954637f1657344b91b..1cca4645bbb331cce0266cb14dad2d0e53d6a266 100644 (file)
@@ -7,6 +7,7 @@
                # due to LLVM being initialized multiple times.
                radeon_drm_winsys_create;
                amdgpu_winsys_create;
+               ac_init_llvm_once;
        local:
                *;
 };
index 605cb83d802294f75cee7a791f576e7790ea48a3..8054e11ae18bcf84b55b62a43839b77dbdfee960 100644 (file)
@@ -7,6 +7,7 @@
                # due to LLVM being initialized multiple times.
                radeon_drm_winsys_create;
                amdgpu_winsys_create;
+               ac_init_llvm_once;
        local:
                *;
 };
index 917c3d3c3016a5892fc104b09fc1a0c49de548a2..3f48ab61e98ddb570f1b6ea655b6ca96d26347f7 100644 (file)
@@ -6,6 +6,7 @@
                # due to LLVM being initialized multiple times.
                radeon_drm_winsys_create;
                amdgpu_winsys_create;
+               ac_init_llvm_once;
        local:
                *;
 };
index 5e71c6285a644f5dad6fe6921d35312342d924c8..36935e9e14dece7b057c4d3b114d35a9089c2cb0 100644 (file)
@@ -4,6 +4,7 @@
                nouveau_drm_screen_create;
                radeon_drm_winsys_create;
                amdgpu_winsys_create;
+               ac_init_llvm_once;
        local:
                *;
 };