From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4BhnJxpI416ncwAA0tVLHw (envelope-from ) for ; Fri, 12 Jun 2020 09:17:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IEVoIxpI416KHgAA1q6Kng (envelope-from ) for ; Fri, 12 Jun 2020 09:17:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1A6A7940668 for ; Fri, 12 Jun 2020 09:17:14 +0000 (UTC) Received: from localhost ([::1]:39576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjfoH-0001LK-2D for larch@yhetil.org; Fri, 12 Jun 2020 05:17:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjfo2-0001Kn-1L for guix-devel@gnu.org; Fri, 12 Jun 2020 05:16:58 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:37999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjfnz-0002iy-9l for guix-devel@gnu.org; Fri, 12 Jun 2020 05:16:57 -0400 X-Originating-IP: 92.169.129.147 Received: from bababa (lfbn-idf2-1-1315-147.w92-169.abo.wanadoo.fr [92.169.129.147]) (Authenticated sender: mail@ambrevar.xyz) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 60FB420008 for ; Fri, 12 Jun 2020 09:16:51 +0000 (UTC) From: Pierre Neidhardt To: guix-devel@gnu.org Subject: Reducing Mesa closure size Date: Fri, 12 Jun 2020 11:16:50 +0200 Message-ID: <87blloskxp.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=217.70.183.200; envelope-from=mail@ambrevar.xyz; helo=relay7-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 05:16:51 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=1, FROM_SUSPICIOUS_NTLD_FP=1, PDS_OTHER_BAD_TLD=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: 0.89 X-TUID: 8gGa1qxj0zNg --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Mesa is a dependency for more or less everything graphical. Since it's so ubiquitous, can we reduce it's closure size? =2D-8<---------------cut here---------------start------------->8--- > guix size mesa store item total s= elf /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% ... =2D-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: =2D-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 =2D-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: =2D-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")) ... =2D-8<---------------cut here---------------end--------------->8--- So what the following strategy: =2D Extract the various mesa drivers to separate package, e.g. mesa-radeon, mesa-radeonsi, mesa-nouveau, etc. =2D Modify xorg-wrapper to accept an extra `drivers' parameter. =2D Extend xorg-configuration to accept a list of mesa drivers. =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7jSAIACgkQm9z0l6S7 zH+jHwgAjsj3uLfFGvSP6h7Jjkz1vNyoYTBMSgNAITvfd5WICM6o1SYgPhQTA5bi aZxXE6jY40fOTEKd6tBxUGCgh/yHg/5RSXl+WuiyoZqye9z+BZqMvidfa6bVKmId b6SZCypHROjYu7RauWKk/JKpqQpnJ37KDHlX1hUCZKKAO9CGd+R3QUx6vg20sNnE CpFD1CzE9cH89jysY9WfEzdHAPl4pkNM1qWncsXfRt+D5cT+RU7kXppsbsS9QnyF TTl+IPpobgnRTMBUVO+spNDB5nzjQD1NawMR/SZrNkOcU20yMfDYU5ykiCM6H+M6 1CJ1yMGzVLCNNroGvamUFr7zcDQEWA== =jG5H -----END PGP SIGNATURE----- --=-=-=--