unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <mail@ambrevar.xyz>
To: guix-devel@gnu.org
Subject: Reducing Mesa closure size
Date: Fri, 12 Jun 2020 11:16:50 +0200	[thread overview]
Message-ID: <87blloskxp.fsf@ambrevar.xyz> (raw)

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

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

             reply	other threads:[~2020-06-12  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12  9:16 Pierre Neidhardt [this message]
2020-06-23  8:41 ` Reducing Mesa closure size Pierre Neidhardt
2020-06-23 20:44 ` Marius Bakke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blloskxp.fsf@ambrevar.xyz \
    --to=mail@ambrevar.xyz \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).