Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] from Firefox52: NO pure ALSA?, WAS: Firefox 49.0 & Youtube... Audio: No
Date: Sun, 18 Dec 2016 15:16:22
Message-Id: CAGfcS_=T69_eMQdAVJ==uVUT5d+Gd0+5aqx1ER2Btrrf=4bhaA@mail.gmail.com
In Reply to: Re: [gentoo-user] from Firefox52: NO pure ALSA?, WAS: Firefox 49.0 & Youtube... Audio: No by Daniel Campbell
1 On Sun, Dec 18, 2016 at 3:23 AM, Daniel Campbell <zlg@g.o> wrote:
2 >
3 > Thankfully the kernel seems to have sane management; as long as Linus is
4 > around, anyway. Just recently AMD had some of their code rejected, so
5 > with a vigilant-enough team, you can effectively protect your project
6 > from monied interests (be it poor code or an attempt to manipulate). Now
7 > picture what might have happened if AMD was employing Linus or had some
8 > other sort of contract. (For the record, I use an AMD CPU and like it;
9 > they just happened to be the most recent corporation who's rejected code
10 > popped on my radar. No bias intended.)
11 >
12
13 I think this is an oversimplification of the issues involved in the
14 AMD situation, which as with so many of these things people just
15 jumped on picking sides. And I think what has gotten lost is an issue
16 that actually comes up somewhat often in FOSS.
17
18 Let's step back and look at the reality in the gaming on Linux domain:
19 there are basically two GPU manufacturers in the game (AMD/NVidia),
20 and neither one has their best GPU drivers in the mainline kernel.
21 Both of them contribute to drivers which ARE merged into the kernel,
22 but in both cases these lack features found in the out-of-mainline
23 module.
24
25 AMD has been attempting to merge their better driver into the mainline
26 kernel. As far as I'm aware (I could be wrong) Nvidia hasn't really
27 tried to do this for the most part and are content to just keep
28 shipping a blob. AMD's reasons are certainly at least somewhat
29 selfish, as maintaining all that code out-of-tree is expensive since
30 linux doesn't have a stable API for drivers.
31
32 Ok, AMD wants to add a more capable driver to the kernel, and
33 obviously Linux users would prefer a more capable driver in the
34 kernel, so what is the problem?
35
36 And this is where we come to an issue that happens from time to time
37 in FOSS: the needs of the kernel maintainers are not aligned with the
38 needs of the AMD driver maintainers.
39
40 The AMD and NVidia out-of-mainline drivers both use an abstraction
41 layer to map the kernel APIs to an internal set of APIs used by the
42 driver, because their drivers are multi-platform. I'm not sure
43 exactly how their internal APIs work in both cases. They might
44 internally target the Windows APIs, or they might even target a
45 virtual API and use a translation layer on every platform. This
46 allows them to use one set of code for their core logic across all
47 platforms, at the cost of overhead on Linux (and possibly on other
48 platforms as well). On most platforms this is no big deal because the
49 APIs on those platforms are stable. On Linux this is not the case,
50 and the maintainers prefer to have the freedom to modify their
51 internal APIs and not maintain their own translation layers for
52 backwards compatibility.
53
54 IMO both sides are basically "right" in their designs, because they
55 have different priorities.
56
57 The AMD driver code isn't "poor code" - it just isn't natively written
58 for Linux and so it has a lot of code that is theoretically
59 unnecessary (in a world where all devices run Linux). And that is of
60 course more code for the Linux maintainers to deal with if they accept
61 the driver into mainline. On the other hand, writing a driver that
62 purely targets Linux means having to change the core part of the
63 driver anytime the Linux APIs change, which then means changing the
64 translation layers on every OTHER platform out there, when those
65 platforms otherwise feature stable APIs, or having a 3-layer solution
66 (Linux to single virtual API to various stable platform APIs).
67
68 Now, if the Linux maintainers wanted to have a stable API but wanted
69 to refactor their code internally, then you could actually have a
70 multiple-layer situation as well. You could have Linux internal APIs
71 to Linux stable API to AMD virtual API translation going on (which I
72 suspect is what happens on Windows). As far as I'm aware Microsoft
73 doesn't care if vendors use translation layers, because they don't
74 touch those modules other than testing them (which they get paid to do
75 anyway).
76
77 Both sides of this debate can legitimately cite maintainability as a
78 reason to not give in. The Linux guys don't to have to maintain a
79 de-facto stable API (which is what the translation layer turns into).
80 The AMD (and NVidia) guys don't want to write a different driver on
81 every platform. Keep in mind that besides Windows and Linux, they may
82 have multiple test harnesses that they need to map into their drivers,
83 and probably other OSes as well. There is also a huge benefit to
84 having the same bug list on every platform for the most part. And
85 Linux users benefit when the "Optimized for <AAA title here>" work
86 done for Windows automatically hits Linux as well, which gives the
87 publisher more incentive to spend the extra few bucks to release a
88 Linux version of the game.
89
90 So, saying that this is about moneyed interests trying to somehow
91 corrupt the "purity" of FOSS isn't really right here. Ultimately
92 issues like this become a bit of a tragedy for all. And mind you, I'm
93 not trying to say that the Linux maintainers should ignore their own
94 interests and just merge the code. If one side was right and the
95 other was wrong it wouldn't be the problem that it is.
96
97 And stuff like this is what leads to this thread. Did the Firefox
98 maintainers HAVE to require Pulseaudio? Of course not. Are they
99 going to be bothered to not require it for the sake of the 0.1% of
100 Linux users who want to use a web browser but don't have Pulseaudio
101 running? Probably not. The universe of Linux systems that are
102 running Firefox but not Pulseaudio is fairly small at this point.
103 From their standpoint requiring it costs them nothing and makes their
104 life a tiny bit easier.
105
106 I'd love to live in a world where all the code that everybody wants
107 exists for free and any subset of it is interoperable with any other
108 subset of it. However, that just isn't going to happen because all
109 the necessary translation layers needed to make that happen are a pain
110 to maintain. And so in a sense the same reasons that drove the Linux
111 maintainers to reject the AMD code are the same sorts of reasons that
112 are going to drive the Firefox maintainers to reject any patches that
113 let their software work without Pulseaudio, which brings us full
114 circle... :)
115
116 --
117 Rich

Replies