Re: [poky] How to override mesa VULKAN_DRIVERS and GALLIUMDRIVERS variables?
Quentin Schulz <[email protected]> Mon, 11 Aug 2025 14:29:45 +0200
| Newsgroups | org.yoctoproject.lists.poky |
|---|---|
| Message-ID | <[email protected]> |
Hi Trent, On 8/4/25 7:19 PM, Trent Piepho via lists.yoctoproject.org wrote: > [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > On Mon, Aug 4, 2025 at 3:15 AM Alexander Kanavin via > lists.yoctoproject.org <[email protected]> > wrote: >> >> On Sun, 3 Aug 2025 at 08:28, trent.piepho via lists.yoctoproject.org >> <[email protected]> wrote: >>> Setting VULKAN_DRIVERS in an bbappend or machine conf file to something like "intel" doesn't work, because the append actions still append to that value all additional drivers. >>> Trying to remove other drivers with something like VULKAN_DRIVERS:remove = ",amd" doesn't work either, as remove only matches on word boundaries and the list is command delimited, not space delimited. >> >> VULKAN_DRIVERS is basically internal to the recipe. You need to set >> PACKAGECONFIG for mesa to include the needed set: >> >> VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', >> 'freedreno', ',freedreno', '', d)}" > > Not sure I follow what you're saying. If I add the above code inside > a machine conf file or via bbappend, I'm stuck only adding new drivers The above code already exists in mesa.inc, Alex was just pointing at the implementation and why setting PACKAGECONFIG appropriately would add what;s needed to VULKAN_DRIVERS. > and not able to remove those the recipe has already determined. While > it is possible to turn off, e.g., freedreno by PACKAGECONFIG, it can > be done for neither intel nor amd. > VULKAN_DRIVERS_AMD = "${@bb.utils.contains('PACKAGECONFIG', 'amd', ',amd', '', d)}" VULKAN_DRIVERS_INTEL = "${@bb.utils.contains('PACKAGECONFIG', 'intel libclc', ',intel', '', d)}" VULKAN_DRIVERS_LLVM = "${VULKAN_DRIVERS_SWRAST}${VULKAN_DRIVERS_AMD}${VULKAN_DRIVERS_ASAHI}${VULKAN_DRIVERS_INTEL}" VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', '${VULKAN_DRIVERS_LLVM}', '', d)}" So in order to have your intel and amd vulkan drivers, you need "amd intel libclc gallium-llvm" in PACKAGECONFIG at the very least. Removing other should just be a matter of not adding them to PACKAGECONFIG in the first place. If you don't have this code in mesa.inc, this means that you're using an older version of OE-Core than current master so it'd be nice to specify which one so it's easier for us to help you out, especially since mesa has seen a fair amount of changes recently. > Or are you saying that the mesa recipe should be modified to work > entirely this way: allowing *all* drivers to be configured via > PACKAGECONFIG? Ditto for the GALLIUMDRIVERS configuration, which has > the same issue. > GALLIUMDRIVERS_AMD = "${@bb.utils.contains('PACKAGECONFIG', 'amd', ',r300', '', d)}" GALLIUMDRIVERS_IRIS = "${@bb.utils.contains('PACKAGECONFIG', 'intel libclc', ',iris', '', d)}" GALLIUMDRIVERS_RADEONSI = "${@bb.utils.contains('PACKAGECONFIG', 'amd', ',radeonsi', '', d)}" GALLIUMDRIVERS_LLVM = "${GALLIUMDRIVERS_LLVMPIPE}${GALLIUMDRIVERS_AMD}${GALLIUMDRIVERS_ASAHI}${GALLIUMDRIVERS_IRIS}${GALLIUMDRIVERS_NOUVEAU}${GALLIUMDRIVERS_RADEONSI}${GALLIUMDRIVERS_SVGA}" GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', '${GALLIUMDRIVERS_LLVM}', '', d)}" PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm" So you need "amd intel libclc gallium gallium-llvm" at a minimum in your PACKAGECONFIG for this to build properly. > If the latter, is there a reason to not use `VULKAN_DRIVERS .= "${@…, > ',driver', '', d)}"`. It seems like as soon as recipes start to use > :append internally, they get harder to layer via bbappend and conf > files. > We could remove the use of :append indeed as this is very likely suboptimal in terms of parsing time and doesn't bring much. It's not as simple as jsut removing the :append, because of a few :override mechanism there but isn't rocker science either. However, I really don't think you should be modifying the variables (GALLIUMDRIVERS/VULKANDIVRERS) directly. PACKAGECONFIG is there for that. If it's not precise enough or is wrong, then it's something we can change in the mesa.inc to make sure other people benefit from it instead of just keeping some changes in your own layer. > I did find a workaround to configure the mesa drivers. In a mesa > bbappend, set the configure command line arguments directly: > > PACKAGECONFIG[gallium] = "-Dgallium-drivers=iris, -Dgallium-drivers='', libdrm" > PACKAGECONFIG[vulkan] = > "-Dvulkan-drivers=intel,-Dvulkan-drivers='',glslang-native > vulkan-loader vulkan-headers" > > But this unnecessarily duplicates internal code from the recipe that > will need to be kept in sync. IMHO, being able to select drivers via > package config would be a better design. > You should already be able to do that so please help us in helping you by telling us your PACKAGECONFIG (in your recipe and returned by bitbake-getvar -r mesa PACKAGECONFIG) and OE-Core version you're using. Note that this shouldn't be working according to our recipe as intel drivers should be requiring libclc. We may have a made a mistake here though, but something we could fix with the right amount of information, context and testing :) Cheers, Quentin