All of lore.kernel.org
 help / color / mirror / Atom feed
* Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
@ 2021-12-01 16:43 Mike Crowe
  2021-12-01 17:21 ` [OE-core] " Alexander Kanavin
  2021-12-01 19:18 ` Justin Bronder
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Crowe @ 2021-12-01 16:43 UTC (permalink / raw)
  To: openembedded-core

I'm building for a specific chip and therefore don't wish to waste time and
electricity building and disk space on the target installing unwanted mesa
drivers. However, mesa.inc contains:

 GALLIUMDRIVERS = "swrast"
 GALLIUMDRIVERS:x86-x32 = ""
 GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
 GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"

and mesa_21.3.0.bb contains:

 DRIDRIVERS ??= ""
 DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
 DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"

I'm unable to find a way to override these values. Using (for example):

 DRIDRIVERS:forcevariable = ""
 GALLIUMDRIVERS:forcevariable = "swrast"

doesn't work because the append still happens after the forcevariable
override takes effect. :(

Is there a way that I can override GALLIUMDRIVERS and DRIDRIVERS with my
own values for x86 and x86-64 without modifying oe-core itself?

If not, should the oe-core recipe being using something like:

 GALLIUMDRIVERS_DEFAULT = "swrast"
 GALLIUMDRIVERS_DEFAULT:x86-x32 = ""
 GALLIUMDRIVERS_DEFAULT:append:x86:class-target = ",i915,iris,crocus"
 GALLIUMDRIVERS_DEFAULT:append:x86-64:class-target = ",i915,iris,crocus"
 GALLIUMDRIVERS ?= "${GALLIUMDRIVERS_DEFAULT}"

and similar for DRIDRIVERS to support this?

Thanks.

Mike.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 16:43 Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend Mike Crowe
@ 2021-12-01 17:21 ` Alexander Kanavin
  2021-12-01 18:05   ` Mike Crowe
  2021-12-01 19:18 ` Justin Bronder
  1 sibling, 1 reply; 8+ messages in thread
From: Alexander Kanavin @ 2021-12-01 17:21 UTC (permalink / raw)
  To: Mike Crowe; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 2161 bytes --]

I think you do need to modify oe-core unfortunately, like is done for other
drivers:

PACKAGECONFIG[etnaviv] = ""
GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv',
',etnaviv', '', d)}"

Alex

On Wed, 1 Dec 2021 at 17:44, Mike Crowe via lists.openembedded.org <mac=
mcrowe.com@lists.openembedded.org> wrote:

> I'm building for a specific chip and therefore don't wish to waste time and
> electricity building and disk space on the target installing unwanted mesa
> drivers. However, mesa.inc contains:
>
>  GALLIUMDRIVERS = "swrast"
>  GALLIUMDRIVERS:x86-x32 = ""
>  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
>  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
>
> and mesa_21.3.0.bb contains:
>
>  DRIDRIVERS ??= ""
>  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
>  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
>
> I'm unable to find a way to override these values. Using (for example):
>
>  DRIDRIVERS:forcevariable = ""
>  GALLIUMDRIVERS:forcevariable = "swrast"
>
> doesn't work because the append still happens after the forcevariable
> override takes effect. :(
>
> Is there a way that I can override GALLIUMDRIVERS and DRIDRIVERS with my
> own values for x86 and x86-64 without modifying oe-core itself?
>
> If not, should the oe-core recipe being using something like:
>
>  GALLIUMDRIVERS_DEFAULT = "swrast"
>  GALLIUMDRIVERS_DEFAULT:x86-x32 = ""
>  GALLIUMDRIVERS_DEFAULT:append:x86:class-target = ",i915,iris,crocus"
>  GALLIUMDRIVERS_DEFAULT:append:x86-64:class-target = ",i915,iris,crocus"
>  GALLIUMDRIVERS ?= "${GALLIUMDRIVERS_DEFAULT}"
>
> and similar for DRIDRIVERS to support this?
>
> Thanks.
>
> Mike.
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159048):
> https://lists.openembedded.org/g/openembedded-core/message/159048
> Mute This Topic: https://lists.openembedded.org/mt/87432435/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 3477 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 17:21 ` [OE-core] " Alexander Kanavin
@ 2021-12-01 18:05   ` Mike Crowe
  2021-12-01 20:33     ` Alexander Kanavin
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Crowe @ 2021-12-01 18:05 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

Hi Alex,

Thanks for responding.

Just to make sure I understand, you think that I should add something like:

 PACKAGECONFIG[i915] = ""
 PACKAGECONFIG[iris] = ""
 PACKAGECONFIG[crocus] = ""
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'i915', ',i915', '', d)}"
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'iris', ',iris', '', d)}"
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'crocus', ',crocus', '', d)}"

But then I need to find a way to get "i915 iris crocus" into PACKAGECONFIG
for x86 and x86-64 whilst still letting others override that. The best I
can come up with is to modify the existing default PACKAGECONFIG to be
something like:

 PACKAGECONFIG_DEFAULT_FOR_TARGET:x86 = "i915 iris crocus"
 PACKAGECONFIG_DEFAULT_FOR_TARGET:x86-64 = "i915 iris crocus"
 PACKAGECONFIG:class-target ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri gallium virgl', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
                    elf-tls \
                    ${PACKAGECONFIG_DEFAULT_FOR_TARGET} \
                    "

This will probably break anyone who currently sets their own PACKAGECONFIG
for x86 and x86-64 until they add the drivers they require. This would seem
to be worse than my GALLIUMDRIVERS_DEFAULT suggestion. :(

Have I misunderstood you, or is there a better way?

Thanks.

Mike.

On Wednesday 01 December 2021 at 18:21:44 +0100, Alexander Kanavin wrote:
> I think you do need to modify oe-core unfortunately, like is done for other
> drivers:
> 
> PACKAGECONFIG[etnaviv] = ""
> GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv',
> ',etnaviv', '', d)}"
> 
> Alex
> 
> On Wed, 1 Dec 2021 at 17:44, Mike Crowe via lists.openembedded.org <mac=
> mcrowe.com@lists.openembedded.org> wrote:
> 
> > I'm building for a specific chip and therefore don't wish to waste time and
> > electricity building and disk space on the target installing unwanted mesa
> > drivers. However, mesa.inc contains:
> >
> >  GALLIUMDRIVERS = "swrast"
> >  GALLIUMDRIVERS:x86-x32 = ""
> >  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
> >  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
> >
> > and mesa_21.3.0.bb contains:
> >
> >  DRIDRIVERS ??= ""
> >  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
> >  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
> >
> > I'm unable to find a way to override these values. Using (for example):
> >
> >  DRIDRIVERS:forcevariable = ""
> >  GALLIUMDRIVERS:forcevariable = "swrast"
> >
> > doesn't work because the append still happens after the forcevariable
> > override takes effect. :(
> >
> > Is there a way that I can override GALLIUMDRIVERS and DRIDRIVERS with my
> > own values for x86 and x86-64 without modifying oe-core itself?
> >
> > If not, should the oe-core recipe being using something like:
> >
> >  GALLIUMDRIVERS_DEFAULT = "swrast"
> >  GALLIUMDRIVERS_DEFAULT:x86-x32 = ""
> >  GALLIUMDRIVERS_DEFAULT:append:x86:class-target = ",i915,iris,crocus"
> >  GALLIUMDRIVERS_DEFAULT:append:x86-64:class-target = ",i915,iris,crocus"
> >  GALLIUMDRIVERS ?= "${GALLIUMDRIVERS_DEFAULT}"
> >
> > and similar for DRIDRIVERS to support this?
> >
> > Thanks.
> >
> > Mike.
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#159048):
> > https://lists.openembedded.org/g/openembedded-core/message/159048
> > Mute This Topic: https://lists.openembedded.org/mt/87432435/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> > alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 16:43 Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend Mike Crowe
  2021-12-01 17:21 ` [OE-core] " Alexander Kanavin
@ 2021-12-01 19:18 ` Justin Bronder
  2021-12-01 20:20   ` Mike Crowe
  1 sibling, 1 reply; 8+ messages in thread
From: Justin Bronder @ 2021-12-01 19:18 UTC (permalink / raw)
  To: mac; +Cc: openembedded-core

On 01/12/21 16:43 +0000, Mike Crowe via lists.openembedded.org wrote:
> I'm building for a specific chip and therefore don't wish to waste time and
> electricity building and disk space on the target installing unwanted mesa
> drivers. However, mesa.inc contains:
> 
>  GALLIUMDRIVERS = "swrast"
>  GALLIUMDRIVERS:x86-x32 = ""
>  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
>  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
> 
> and mesa_21.3.0.bb contains:
> 
>  DRIDRIVERS ??= ""
>  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
>  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
> 
> I'm unable to find a way to override these values. Using (for example):

You can use an anonymous python function which runs after parsing.
https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#anonymous-python-functions

    python __anonymous () {
        d.setVar("DRIDRIVERS", "i965")
    }

-- 
Justin Bronder


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 19:18 ` Justin Bronder
@ 2021-12-01 20:20   ` Mike Crowe
  2021-12-02 17:00     ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Crowe @ 2021-12-01 20:20 UTC (permalink / raw)
  To: Justin Bronder; +Cc: openembedded-core

On Wednesday 01 December 2021 at 14:18:19 -0500, Justin Bronder wrote:
> On 01/12/21 16:43 +0000, Mike Crowe via lists.openembedded.org wrote:
> > I'm building for a specific chip and therefore don't wish to waste time and
> > electricity building and disk space on the target installing unwanted mesa
> > drivers. However, mesa.inc contains:
> > 
> >  GALLIUMDRIVERS = "swrast"
> >  GALLIUMDRIVERS:x86-x32 = ""
> >  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
> >  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
> > 
> > and mesa_21.3.0.bb contains:
> > 
> >  DRIDRIVERS ??= ""
> >  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
> >  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
> > 
> > I'm unable to find a way to override these values. Using (for example):
> 
> You can use an anonymous python function which runs after parsing.
> https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#anonymous-python-functions
> 
>     python __anonymous () {
>         d.setVar("DRIDRIVERS", "i965")
>     }

Thanks for the suggestion. It solves my problem. However, it seems like
quite a subversive way to do the sort of external customisation that
recipes normally support.

Thanks.

Mike.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 18:05   ` Mike Crowe
@ 2021-12-01 20:33     ` Alexander Kanavin
  2021-12-02 15:58       ` Mike Crowe
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Kanavin @ 2021-12-01 20:33 UTC (permalink / raw)
  To: Mike Crowe; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 4620 bytes --]

I'd like to see specifics though to understand the use case better. What
kind of target you're on, how much space will be saved by only building the
driver you need and which driver is that? If the drivers are in separate
.so objects, you can simply delete the ones you don't need from
do_install_append. The build time savings would be very minimal.

Alex


On Wed, 1 Dec 2021 at 19:06, Mike Crowe <mac@mcrowe.com> wrote:

> Hi Alex,
>
> Thanks for responding.
>
> Just to make sure I understand, you think that I should add something like:
>
>  PACKAGECONFIG[i915] = ""
>  PACKAGECONFIG[iris] = ""
>  PACKAGECONFIG[crocus] = ""
>  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'i915',
> ',i915', '', d)}"
>  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'iris',
> ',iris', '', d)}"
>  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'crocus',
> ',crocus', '', d)}"
>
> But then I need to find a way to get "i915 iris crocus" into PACKAGECONFIG
> for x86 and x86-64 whilst still letting others override that. The best I
> can come up with is to modify the existing default PACKAGECONFIG to be
> something like:
>
>  PACKAGECONFIG_DEFAULT_FOR_TARGET:x86 = "i915 iris crocus"
>  PACKAGECONFIG_DEFAULT_FOR_TARGET:x86-64 = "i915 iris crocus"
>  PACKAGECONFIG:class-target ??= "${@bb.utils.filter('DISTRO_FEATURES',
> 'wayland vulkan', d)} \
>                     ${@bb.utils.contains('DISTRO_FEATURES', 'opengl',
> 'opengl egl gles gbm dri gallium virgl', '', d)} \
>                     ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl',
> 'x11 dri3', '', d)} \
>                     ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan',
> 'dri3', '', d)} \
>                     elf-tls \
>                     ${PACKAGECONFIG_DEFAULT_FOR_TARGET} \
>                     "
>
> This will probably break anyone who currently sets their own PACKAGECONFIG
> for x86 and x86-64 until they add the drivers they require. This would seem
> to be worse than my GALLIUMDRIVERS_DEFAULT suggestion. :(
>
> Have I misunderstood you, or is there a better way?
>
> Thanks.
>
> Mike.
>
> On Wednesday 01 December 2021 at 18:21:44 +0100, Alexander Kanavin wrote:
> > I think you do need to modify oe-core unfortunately, like is done for
> other
> > drivers:
> >
> > PACKAGECONFIG[etnaviv] = ""
> > GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv',
> > ',etnaviv', '', d)}"
> >
> > Alex
> >
> > On Wed, 1 Dec 2021 at 17:44, Mike Crowe via lists.openembedded.org <mac=
> > mcrowe.com@lists.openembedded.org> wrote:
> >
> > > I'm building for a specific chip and therefore don't wish to waste
> time and
> > > electricity building and disk space on the target installing unwanted
> mesa
> > > drivers. However, mesa.inc contains:
> > >
> > >  GALLIUMDRIVERS = "swrast"
> > >  GALLIUMDRIVERS:x86-x32 = ""
> > >  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
> > >  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
> > >
> > > and mesa_21.3.0.bb contains:
> > >
> > >  DRIDRIVERS ??= ""
> > >  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
> > >  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
> > >
> > > I'm unable to find a way to override these values. Using (for example):
> > >
> > >  DRIDRIVERS:forcevariable = ""
> > >  GALLIUMDRIVERS:forcevariable = "swrast"
> > >
> > > doesn't work because the append still happens after the forcevariable
> > > override takes effect. :(
> > >
> > > Is there a way that I can override GALLIUMDRIVERS and DRIDRIVERS with
> my
> > > own values for x86 and x86-64 without modifying oe-core itself?
> > >
> > > If not, should the oe-core recipe being using something like:
> > >
> > >  GALLIUMDRIVERS_DEFAULT = "swrast"
> > >  GALLIUMDRIVERS_DEFAULT:x86-x32 = ""
> > >  GALLIUMDRIVERS_DEFAULT:append:x86:class-target = ",i915,iris,crocus"
> > >  GALLIUMDRIVERS_DEFAULT:append:x86-64:class-target =
> ",i915,iris,crocus"
> > >  GALLIUMDRIVERS ?= "${GALLIUMDRIVERS_DEFAULT}"
> > >
> > > and similar for DRIDRIVERS to support this?
> > >
> > > Thanks.
> > >
> > > Mike.
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#159048):
> > > https://lists.openembedded.org/g/openembedded-core/message/159048
> > > Mute This Topic: https://lists.openembedded.org/mt/87432435/1686489
> > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> [
> > > alex.kanavin@gmail.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
> > >
>

[-- Attachment #2: Type: text/html, Size: 6869 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 20:33     ` Alexander Kanavin
@ 2021-12-02 15:58       ` Mike Crowe
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Crowe @ 2021-12-02 15:58 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

Hi Alex,

It's not a case of simply deleting the so files we don't need since the
mesa build system stuffs everything into a small number of files and then
hard links them together. For example, the current unmodified oe-core build
for qemux86-64 yields:

$ ls -l tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk
-rw-r--r-- 2 mac mac 7993248 Dec  2 09:13 tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk

$ dpkg-deb -c tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/
-rwxr-xr-x root/root  17728664 2021-11-17 20:17 ./usr/lib/dri/crocus_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/i915_dri.so link to ./usr/lib/dri/crocus_dri.so
-rwxr-xr-x root/root  15903952 2021-11-17 20:17 ./usr/lib/dri/i965_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/iris_dri.so link to ./usr/lib/dri/crocus_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/kms_swrast_dri.so link to ./usr/lib/dri/crocus_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/nouveau_vieux_dri.so link to ./usr/lib/dri/i965_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/r200_dri.so link to ./usr/lib/dri/i965_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/radeon_dri.so link to ./usr/lib/dri/i965_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/swrast_dri.so link to ./usr/lib/dri/crocus_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/virtio_gpu_dri.so link to ./usr/lib/dri/crocus_dri.so
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/share/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/share/drirc.d/
-rw-r--r-- root/root     44273 2021-11-17 20:16 ./usr/share/drirc.d/00-mesa-defaults.conf

If I prune the default configuration do_install:append so I only keep
swrast_dri.so then I get:

$ ls -l tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk
-rw-r--r-- 2 mac mac 4247362 Dec  2 15:29 tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk

$ dpkg-deb -c tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/
-rwxr-xr-x root/root  17728664 2021-11-17 20:17 ./usr/lib/dri/swrast_dri.so
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/share/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/share/drirc.d/
-rw-r--r-- root/root     44273 2021-11-17 20:16 ./usr/share/drirc.d/00-mesa-defaults.conf

If I do no pruning but force:
 DRIDRIVERS = ""
 GALLIUMDRIVERS = "swrast"

then I get:

$ ls -l tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk
-rw-r--r-- 2 mac mac 2590320 Dec  2 15:15 tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk

$ dpkg-deb -c tmp-glibc/deploy/ipk/core2-64/mesa-megadriver_21.3.0-r0_core2-64.ipk
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/
-rwxr-xr-x root/root  11981240 2021-11-17 20:17 ./usr/lib/dri/kms_swrast_dri.so
hrwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/lib/dri/swrast_dri.so link to ./usr/lib/dri/kms_swrast_dri.so
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/share/
drwxr-xr-x root/root         0 2021-11-17 20:17 ./usr/share/drirc.d/
-rw-r--r-- root/root     44273 2021-11-17 20:16 ./usr/share/drirc.d/00-mesa-defaults.conf

This is an uncompressed saving of over five megabytes (32%) and a
compressed saving of 1.6MiB (39%) (assuming that the ipk compression is
indicative of whatever rootfs compression is used.)

I tried just crocus and just iris and there were still savings, albeit
not quite as large as for swrast.

(I have to admit that when I first started investigating this I misread the
numbers and thought they were a factor of ten higher. Nevertheless, it's
clear that there is a difference.)

Justin Bronder's suggestion has given me a workaround if you don't believe
that the space saving is more generally useful.

Thanks.

Mike.

On Wednesday 01 December 2021 at 21:33:39 +0100, Alexander Kanavin wrote:
> I'd like to see specifics though to understand the use case better. What
> kind of target you're on, how much space will be saved by only building the
> driver you need and which driver is that? If the drivers are in separate
> .so objects, you can simply delete the ones you don't need from
> do_install_append. The build time savings would be very minimal.
> 
> Alex
> 
> 
> On Wed, 1 Dec 2021 at 19:06, Mike Crowe <mac@mcrowe.com> wrote:
> 
> > Hi Alex,
> >
> > Thanks for responding.
> >
> > Just to make sure I understand, you think that I should add something like:
> >
> >  PACKAGECONFIG[i915] = ""
> >  PACKAGECONFIG[iris] = ""
> >  PACKAGECONFIG[crocus] = ""
> >  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'i915',
> > ',i915', '', d)}"
> >  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'iris',
> > ',iris', '', d)}"
> >  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'crocus',
> > ',crocus', '', d)}"
> >
> > But then I need to find a way to get "i915 iris crocus" into PACKAGECONFIG
> > for x86 and x86-64 whilst still letting others override that. The best I
> > can come up with is to modify the existing default PACKAGECONFIG to be
> > something like:
> >
> >  PACKAGECONFIG_DEFAULT_FOR_TARGET:x86 = "i915 iris crocus"
> >  PACKAGECONFIG_DEFAULT_FOR_TARGET:x86-64 = "i915 iris crocus"
> >  PACKAGECONFIG:class-target ??= "${@bb.utils.filter('DISTRO_FEATURES',
> > 'wayland vulkan', d)} \
> >                     ${@bb.utils.contains('DISTRO_FEATURES', 'opengl',
> > 'opengl egl gles gbm dri gallium virgl', '', d)} \
> >                     ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl',
> > 'x11 dri3', '', d)} \
> >                     ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan',
> > 'dri3', '', d)} \
> >                     elf-tls \
> >                     ${PACKAGECONFIG_DEFAULT_FOR_TARGET} \
> >                     "
> >
> > This will probably break anyone who currently sets their own PACKAGECONFIG
> > for x86 and x86-64 until they add the drivers they require. This would seem
> > to be worse than my GALLIUMDRIVERS_DEFAULT suggestion. :(
> >
> > Have I misunderstood you, or is there a better way?
> >
> > Thanks.
> >
> > Mike.
> >
> > On Wednesday 01 December 2021 at 18:21:44 +0100, Alexander Kanavin wrote:
> > > I think you do need to modify oe-core unfortunately, like is done for
> > other
> > > drivers:
> > >
> > > PACKAGECONFIG[etnaviv] = ""
> > > GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv',
> > > ',etnaviv', '', d)}"
> > >
> > > Alex
> > >
> > > On Wed, 1 Dec 2021 at 17:44, Mike Crowe via lists.openembedded.org <mac=
> > > mcrowe.com@lists.openembedded.org> wrote:
> > >
> > > > I'm building for a specific chip and therefore don't wish to waste
> > time and
> > > > electricity building and disk space on the target installing unwanted
> > mesa
> > > > drivers. However, mesa.inc contains:
> > > >
> > > >  GALLIUMDRIVERS = "swrast"
> > > >  GALLIUMDRIVERS:x86-x32 = ""
> > > >  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
> > > >  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
> > > >
> > > > and mesa_21.3.0.bb contains:
> > > >
> > > >  DRIDRIVERS ??= ""
> > > >  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
> > > >  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
> > > >
> > > > I'm unable to find a way to override these values. Using (for example):
> > > >
> > > >  DRIDRIVERS:forcevariable = ""
> > > >  GALLIUMDRIVERS:forcevariable = "swrast"
> > > >
> > > > doesn't work because the append still happens after the forcevariable
> > > > override takes effect. :(
> > > >
> > > > Is there a way that I can override GALLIUMDRIVERS and DRIDRIVERS with
> > my
> > > > own values for x86 and x86-64 without modifying oe-core itself?
> > > >
> > > > If not, should the oe-core recipe being using something like:
> > > >
> > > >  GALLIUMDRIVERS_DEFAULT = "swrast"
> > > >  GALLIUMDRIVERS_DEFAULT:x86-x32 = ""
> > > >  GALLIUMDRIVERS_DEFAULT:append:x86:class-target = ",i915,iris,crocus"
> > > >  GALLIUMDRIVERS_DEFAULT:append:x86-64:class-target =
> > ",i915,iris,crocus"
> > > >  GALLIUMDRIVERS ?= "${GALLIUMDRIVERS_DEFAULT}"
> > > >
> > > > and similar for DRIDRIVERS to support this?
> > > >
> > > > Thanks.
> > > >
> > > > Mike.
> > > >
> > > > -=-=-=-=-=-=-=-=-=-=-=-
> > > > Links: You receive all messages sent to this group.
> > > > View/Reply Online (#159048):
> > > > https://lists.openembedded.org/g/openembedded-core/message/159048
> > > > Mute This Topic: https://lists.openembedded.org/mt/87432435/1686489
> > > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> > [
> > > > alex.kanavin@gmail.com]
> > > > -=-=-=-=-=-=-=-=-=-=-=-
> > > >
> > > >
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend
  2021-12-01 20:20   ` Mike Crowe
@ 2021-12-02 17:00     ` Richard Purdie
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2021-12-02 17:00 UTC (permalink / raw)
  To: mac, Justin Bronder; +Cc: openembedded-core

On Wed, 2021-12-01 at 20:20 +0000, Mike Crowe via lists.openembedded.org wrote:
> On Wednesday 01 December 2021 at 14:18:19 -0500, Justin Bronder wrote:
> > On 01/12/21 16:43 +0000, Mike Crowe via lists.openembedded.org wrote:
> > > I'm building for a specific chip and therefore don't wish to waste time and
> > > electricity building and disk space on the target installing unwanted mesa
> > > drivers. However, mesa.inc contains:
> > > 
> > >  GALLIUMDRIVERS = "swrast"
> > >  GALLIUMDRIVERS:x86-x32 = ""
> > >  GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
> > >  GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
> > > 
> > > and mesa_21.3.0.bb contains:
> > > 
> > >  DRIDRIVERS ??= ""
> > >  DRIDRIVERS:append:x86:class-target = ",r100,r200,nouveau,i965"
> > >  DRIDRIVERS:append:x86-64:class-target = ",r100,r200,nouveau,i965"
> > > 
> > > I'm unable to find a way to override these values. Using (for example):
> > 
> > You can use an anonymous python function which runs after parsing.
> > https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#anonymous-python-functions
> > 
> >     python __anonymous () {
> >         d.setVar("DRIDRIVERS", "i965")
> >     }
> 
> Thanks for the suggestion. It solves my problem. However, it seems like
> quite a subversive way to do the sort of external customisation that
> recipes normally support.

I would like to work our how we can improve this situation, I'm just struggling
to see what we should do :/

Cheers,

Richard



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-02 17:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 16:43 Correct way to set DRIDRIVERS and GALLIUMDRIVERS from mesa bbappend Mike Crowe
2021-12-01 17:21 ` [OE-core] " Alexander Kanavin
2021-12-01 18:05   ` Mike Crowe
2021-12-01 20:33     ` Alexander Kanavin
2021-12-02 15:58       ` Mike Crowe
2021-12-01 19:18 ` Justin Bronder
2021-12-01 20:20   ` Mike Crowe
2021-12-02 17:00     ` [OE-core] " Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.