I notice after enable amf useflag in ffmpeg create this file: ``` /etc/env.d/99amf-env-vulkan-override ---------------- VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json ``` This can break some vulkan app, for exemple on my laptop if this is set most vulkan will refuse to open until i set the VK_ICD_FILENAMES back to the icd loader install by mesa. I think the AMDGPU PRO ICD Loader shouldn't be set as the default since the gentoo wiki also said in the note: `It may be possible to set `VK_ICD_FILENAMES` via the env.d directory. It is likely better to set the variable per-application though as it may not always outperform Mesa, as mentioned above!` that should be set per package basis or the user could set in env.d I will open also a PR with a fix for this bug
Change the PR to apply the fix to vulkan-loader instead since some apps required the nvidia icd loader to be set VK_ICD_FILENAMES to open correctly.
I was testing a few things and read the wiki and find some option. 1 - Remove VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json and add DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 to the env.d when amf flag is set. This will allow to other apps to use the other ICD and only need to export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json when what to use AMDGPU Pro feature 2 - Remove VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json from env.d file of ffmpeg and add DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 when media-libs/amdgpu-pro-vulkan is intall and warning the user to export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json when need to use it this will make AMDGPU Pro on demand like the wiki states. I think will do the second approach is someone have a different opinion let me know
Hello, Thank you for bringing this up. I thought the ICD loader override in ffmpeg's ebuilds was _only_ for ffmpeg but it's system wide instead ? My original intent was that to override the ICD loader for ffmpeg only when the 'amf' useflag is enabled, which I believe to be a sane choice: 1- AMF can only work with the ICD override 2- AMF can only work with AMD GPUs 3- I believe that no other encoder offered by AMF requires an ICD override ? Nvidia maybe ? If so, then the ebuild should not override the ICD and simply display an elog stating that the user has to do it manually. Now, if the override is _only_ for ffmpeg, then no other app will break ?
Typo: "3- I believe that no other encoder offered by AMF [...]" -> "3- I believe that no other encoder offered by ffmpeg [...]"
Hello Adel, Answering your question yes creating the env file use ICD Loader system wide. I can understand your point of view in setting that as the default, since is only work of AMD GPU. You right other encoder not required ICD withouth the ICD set the Nvidia NVENC work withouth problems (since the ICD get loaded when starting recording), the same dont happen when using AMF. That why on my obs ebuild PR to support AMF I create a second desktop file to launch obs with amd icd loader being loading (I notice this problems because of that PR): https://github.com/gentoo/gentoo/pull/33745/commits/5396ead3997324a162b04a4c8b62a2ba6bf6b60d If you set the override to only be active when ffmpeg is run only app will not break other apps, but I think the better approach is just to warning the user when they install media-libs/amdgpu-pro-vulkan (or media-libs/amdgpu-pro-amf) or media-video/ffmpeg[amf+] or in both situation. In the PR I only add the warning only to media-libs/amdgpu-pro-vulkan and new useflag that set the ICD Loader for ondemand (enable by default), since the wiki recommend to use per app (and it the better approach to use mesa ICD in most cases) This ondemand useflag set DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 this make possible to still use other apps witthout problems and set VK_ICD_FILENAMES to AMDGPU PRO icd loader when needed If DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1 is not set even without specify VK_ICD_FILENAMES the system most of time will peak by alphabetic order picking amd_pro_icd64.json or amd_pro_icd32.json
Typo: If you set the override to only be active when ffmpeg is run only other app will not break [...]
The final approach was to remove the amf env file from the ffmpeg package, this way dont setting AMDGPU-PRO Vulkan ICD system wide. When programs need to use AMDGPU-PRO driver a new script call vk_pro will start the program with that Vulkan ICD. For programs that not use by default the mesa driver amd refuse to open with AMDGPU-PRO, one exemple gamescope, the vk_radv script can be use to force the mesa ICD to be use.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03fd84caec409a954d3556672b2dab9d8d58ce9a commit 03fd84caec409a954d3556672b2dab9d8d58ce9a Author: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com> AuthorDate: 2024-01-08 12:29:27 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-01-08 12:40:24 +0000 media-video/ffmpeg: not create 99amf-env-vulkan-override in /etc/env.d * This prevent setting the AMDGPU PRO Vulkan ICD Loader system wide * In some system can prevent some vulkan app from open * update elog message for amf use Closes: https://bugs.gentoo.org/917447 Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/33851 Signed-off-by: Sam James <sam@gentoo.org> media-video/ffmpeg/{ffmpeg-5.1.4-r1.ebuild => ffmpeg-5.1.4-r2.ebuild} | 2 +- media-video/ffmpeg/{ffmpeg-6.0-r10.ebuild => ffmpeg-6.0-r11.ebuild} | 2 +- media-video/ffmpeg/{ffmpeg-6.0.1.ebuild => ffmpeg-6.0.1-r1.ebuild} | 2 +- media-video/ffmpeg/{ffmpeg-6.1-r3.ebuild => ffmpeg-6.1-r4.ebuild} | 2 +- media-video/ffmpeg/{ffmpeg-6.1.1.ebuild => ffmpeg-6.1.1-r1.ebuild} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8d414e9b24c4fe6fbedd77d142a2b1e486ede59 commit d8d414e9b24c4fe6fbedd77d142a2b1e486ede59 Author: Gonçalo Duarte <gonegrier.duarte@gmail.com> AuthorDate: 2023-11-18 17:23:00 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-01-08 12:40:20 +0000 media-libs/amdgpu-pro-vulkan: add scripts and update elog * some programs have a bug when VK_ICD_FILENAMES is not set the can use the wrong Vulkan ICD * (since it exist multiple ICD for AMD GPU) * * since PRO driver don't support the AMD_VULKAN_ICD variable * was implemented this fix: * * Added vk_pro and vk_radv scripts: * vk_pro - launch programs using AMDGPU-PRO Vulkan ICD * vk_radv - launch programs using RADV Vulkan ICD Closes: https://bugs.gentoo.org/917447 Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> ...=> amdgpu-pro-vulkan-21.50.2.1384496-r1.ebuild} | 16 +++++++++++- ...=> amdgpu-pro-vulkan-22.10.4.1452060-r1.ebuild} | 29 +++++++++++----------- ...=> amdgpu-pro-vulkan-22.20.5.1511376-r1.ebuild} | 26 +++++++++---------- ...=> amdgpu-pro-vulkan-22.40.6.1580631-r1.ebuild} | 26 +++++++++---------- ...=> amdgpu-pro-vulkan-23.10.3.1620044-r1.ebuild} | 26 +++++++++---------- ...=> amdgpu-pro-vulkan-23.20.0.1654522-r1.ebuild} | 26 +++++++++---------- media-libs/amdgpu-pro-vulkan/files/vk_pro | 2 ++ media-libs/amdgpu-pro-vulkan/files/vk_radv | 2 ++ 8 files changed, 82 insertions(+), 71 deletions(-)