guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reducing Mesa closure size


From: Pierre Neidhardt
Subject: Reducing Mesa closure size
Date: Fri, 12 Jun 2020 11:16:50 +0200

Mesa is a dependency for more or less everything graphical.
Since it's so ubiquitous, can we reduce it's closure size?

--8<---------------cut here---------------start------------->8---
> guix size mesa
store item                                                       total    self
/gnu/store/skxkrhgn9z0fg9hmnbcyfdgzs5w4ryrr-llvm-9.0.1             199.9   
128.5  37.6%
/gnu/store/8jn365r0kk69j1f4b1q2b7aa2qm1xvg1-mesa-19.3.4            341.6   
114.6  33.6%
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31              38.4    
36.7  10.8%
/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib           71.0    
32.6   9.6%
/gnu/store/c8w9z48vvx2a3q3k44ch9yn00wk1qwhb-libxml2-2.9.10          81.1     
7.9   2.3%
/gnu/store/a8gdwnmpryd39jixzy4xs9p4i7gy17qv-libxcb-1.14             76.2     
4.5   1.3%
...
--8<---------------cut here---------------end--------------->8---

Reducing LLVM would help here.  See the other "Reducing LLVM closure
size" thread.

But Mesa itself can be substantially reduced.  Let's look at the files:

--8<---------------cut here---------------start------------->8---
$ du -h $(find /gnu/store/8jn365r0kk69j1f4b1q2b7aa2qm1xvg1-mesa-19 -type f 
-size +1M) | sort -n
7.5M    ./lib/libvulkan_radeon.so
7.6M    ./lib/libxatracker.so.2.5.0
8.4M    ./lib/libXvMCnouveau.so
8.7M    ./lib/libvulkan_intel.so
12M     ./lib/dri/nouveau_drv_video.so
12M     ./lib/vdpau/libvdpau_nouveau.so.1.0.0
14M     ./lib/libOSMesa.so.8.0.0
17M     ./lib/dri/i915_dri.so
26M     ./lib/dri/iris_dri.so
--8<---------------cut here---------------end--------------->8---

Most systems need only one graphics driver.  Allowing the user to choose
which mesa-driver they want could help them save quite a lot.  For
instance,
with a radeon (not radeonsi) I can remove

8.4M    ./lib/libXvMCnouveau.so
8.7M    ./lib/libvulkan_intel.so
12M     ./lib/dri/nouveau_drv_video.so
26M     ./lib/dri/iris_dri.so

which total 55.1 MiB.  Not bad, what do you think?
(libvdpau_nouveau.so.1.0.0 is used by all drivers.)


The "dri" folder is used at least by our Xorg wrapper.
See xorg-wrapper in gnu/services/xorg.scm:

--8<---------------cut here---------------start------------->8---
(define* (xorg-wrapper #:optional (config (xorg-configuration)))
  "Return a derivation that builds a script to start the X server with the
given @var{config}.  The resulting script should be used in place of
@code{/usr/bin/X}."
  define exp
    ;; Write a small wrapper around the X server.
    #~begin
        (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri"))
        ...
--8<---------------cut here---------------end--------------->8---

So what the following strategy:

- Extract the various mesa drivers to separate package,
  e.g. mesa-radeon, mesa-radeonsi, mesa-nouveau, etc.

- Modify xorg-wrapper to accept an extra `drivers'
  parameter.

- Extend xorg-configuration to accept a list of mesa drivers.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]