Re: [poky] How to override mesa VULKAN_DRIVERS and GALLIUMDRIVERS variables?

Trent Piepho <[email protected]> Mon, 11 Aug 2025 10:12:38 -0700
Newsgroups org.yoctoproject.lists.poky
Message-ID <CAMHeXxMJ1NWKawm4R=g+UJLJ82+i6tFCeajqSDBXskngtU3LBw@mail.gmail.com>
On Mon, Aug 11, 2025 at 5:29 AM Quentin Schulz <[email protected]> wrote:
> >> 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.

I'm using Scarthgap.  Should have said that in the beginning.  So that
code isn't there already.  It could be added in a bbappend, and would
parse, but wouldn't have the desired effect.

> 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.

I'm using scarthgap, which is different here.  The intel and amd
drivers sets don't use PACKAGECONFIG.  It seems this is just a
limitation of scarthgap's mesa build that has since been fixed.

In the current master-next, nouveau and svga are :appended to
PACKAGECONFIG by default, rather than being explicitly enabled.  But
since it's space delimited instead of comma delimited it's possible to
remove them.  But it's not possible to add a machine override with the
PACKAGECONFIG value set to the desired list, as it's using append to
add them.  It's only to remove options from the default list.

> GALLIUMDRIVERS_IRIS = "${@bb.utils.contains('PACKAGECONFIG', 'intel libclc', ',iris', '', d)}"
> GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', '${GALLIUMDRIVERS_LLVM}', '', d)}"
>
> So you need "amd intel libclc gallium gallium-llvm" at a minimum in your
> PACKAGECONFIG for this to build properly.

There's an additional line later in the file:
GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG',
'intel', ',i915,crocus', '', d)}"

So that PACKAGECONFIG will also include the i915 and crocus drivers
along with the iris driver.  I'm trying to only include iris.

I'm not using amd, but it seems to have a similar issue: adding amd to
the PACKAGECONFIG will enable multiple amd drivers and there's no way
to edit the list via :remove or other layering techniques.

> 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 :)

I'm using the scarthgap versions, perhaps the libclc requirement is
newer than that?  But I'm quite sure this config builds and that
chromium's GPU acceleration works.  I have since disabled vulkan,
since it doesn't appear to work correctly in chromium (at all).  So
I'm not completely sure if the vulkan driver config works, including
if the swrast driver (which can not be disabled via PACKAGECONFIG) is
truly necessary to be forced on.