David Stes
2024-03-31 8cdd197ba643eb2608c5aab87567625bb9336cee
commit | author | age
6e58c7 1 libglvnd: the GL Vendor-Neutral Dispatch library
AL 2 ================================================
3
4 Introduction
5 ------------
6
7 libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL API calls
8 between multiple vendors. It allows multiple drivers from different vendors to
9 coexist on the same filesystem, and determines which vendor to dispatch each
10 API call to at runtime.
11
12 Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES.
13
14 libglvnd was originally described in Andy Ritger's OpenGL ABI proposal [1].
15
16
17 Building the library
18 ----------------------
19
20 libglvnd build-depends on libx11, glproto and libxext.
21 On Debian and derivatives, run:
22
23     sudo apt-get install libxext-dev libx11-dev x11proto-gl-dev
24
25 Run `./autogen.sh`, then run `./configure` and `make`.
26
27 Alternatively you can use meson and ninja, which is much faster but should be
28 otherwise the same (You will need packages from above too):
29
30     sudo apt-get install ninja-build meson
31     meson builddir 
32     ninja -C builddir
33
34 Meson 0.48.0 is currently required, if your distro doesn't have meson 0.48 in
35 the repos you can try the methods suggested
36 [here](https://mesonbuild.com/Getting-meson.html).
37
38 Code overview
39 -------------
40
41 The code in the src/ directory is organized as follows:
42
43 - GLX/ contains code for libGLX, the GLX window-system API library.
44 - EGL/ contains code for libEGL, the EGL window-system API library.
45 - GLdispatch/ contains code for libGLdispatch, which is responsible for
46   dispatching OpenGL functions to the correct vendor library based on the
47   current EGL or GLX rendering context. This implements the guts of the GL API
48   libraries. Most of the dispatch code is based on Mesa's glapi.
49 - OpenGL/, GLESv1/, and GLESv2/ contain code to generate libOpenGL.so,
50   libGLESv1\_CM.so, and libGLESv2.so, respectively. All three are merely
51   wrapper libraries for libGLdispatch. Ideally, these could be implemented via
52   ELF symbol filtering, but in practice they need to be implemented manually.
53   See the Issues section for details on why this is the case.
54 - GL/ contains code for libGL. This is a wrapper around libGLdispatch and
55   libGLX.
56 - util/ contains generic utility code.
57
58 In addition, libglvnd uses a GLX extension,
59 [GLX\_EXT\_libglvnd](https://khronos.org/registry/OpenGL/extensions/EXT/GLX_EXT_libglvnd.txt),
60 to determine which vendor library to use for a screen or XID.
61
62 There are a few good starting points for familiarizing oneself with the code:
63
64 - Look at the vendor-library to GLX ABI defined in `libglxabi.h`.
65 - Follow the flow of `glXGetProcAddress() -> __glDispatchGetProcAddress() ->
66   _glapi_get_proc_address()` to see how the dispatch table is updated as new GL
67   stubs are generated, and how GLX looks for vendor-library-implemented
68   dispatchers for GLX extension functions.
69 - Follow the flow of `glXMakeContextCurrent() -> __glDispatchMakeCurrent() ->
70   _glapi_set_current()` to see how the current dispatch table and state is
71   updated by the API library.
72 - Look at `libglxmapping.c:__glXLookupVendorBy{Name,Screen}()` to see how
73   vendor library names are queried.
74 - For EGL, follow the flow of `eglGetPlatformDisplay()` to see how EGL selects
75   a vendor library.
76
77 The tests/ directory contains several unit tests which verify that dispatching
78 to different vendors actually works. Run `make check` to run these unit tests.
79
80 Architecture
81 ------------
82
83 The library organization differs slightly from that of Andy's original proposal.
84 See the diagram below:
85
86 <pre>
87                 ┌──────────────────────────────────┐
88                 │                                  │
89           ┌─────┤        Application               │
90           │     │                                  │
91           │     └─────┬───────────────────┬────────┘
92           │           │                   │
93           │     ┌─────▾─────┐             │                    ┌──────────────────────┐
94           │     │           │             │                    │                      │
95           │     │ libOpenGL │             │                    │                      │
96           │     │           │             │                    │  X server            │
97           │     └─────┬─────┘             │                    │                      │
98           │        DT_FILTER              │                    │                      │
99           │     ┌─────▾──────────┐ ┌──────▾────────┐           │ ┌──────────────────┐ │
100           │     │                │ │               │           └─│GLX_EXT_libglvnd  │─┘
101           │     │ [mapi/glapi]   ◂─▸               │             │extension         │
102           │     │ libGLdispatch  │ │   libGLX      ├─────────────▸──────────────────┘
103           │     │                │ │               ◂──────────┬─────────────────┐
104           │     └───────▴────────┘ └──────▴────────┘          │                 │
105           │         DT_FILTER         DT_FILTER             ┌─▾─────────┐   ┌───▾────────┐
106           │     ┌───────┴─────────────────┴────────┐        │           │   │            │
107           │     │                                  │        │           │   │            │
108           └─────▸           libGL                  │        │ GLX_vendor│   │ GLX_vendor2│
109                 └──────────────────────────────────┘        │           │   │            │
110                                                             └───────────┘   └────────────┘
111 </pre>
112
113 In this diagram,
114
115 * `A ───▸ B` indicates that module A calls into module B.
116 * `A ── DT_FILTER ──▸ B` indicates that DSO A is (logically) a filter library on
117   DSO B.  If ELF symbol filtering is enabled, symbols exported by A are resolved
118   to entrypoints in B.
119
120 libGLX manages loading GLX vendor libraries and dispatching GLX core and
121 extension functions to the right vendor.
122
123 GLX\_EXT\_libglvnd is a simple GLX extension which allows libGLX to determine
124 the number of the screen belonging to an arbitrary drawable XID, and also the
125 GL vendor to use for a given screen.
126
127 libGLdispatch implements core GL dispatching and TLS. It acts as a thin wrapper
128 around glapi which provides some higher-level functionality for managing
129 dispatch tables, requesting vendor proc addresses, and making current to a given
130 context + dispatch table. This is a separate library rather than statically
131 linked into libGLX, since the same dispatching code is used by both GLX and
132 EGL.
133
134 libOpenGL is a wrapper library to libGLdispatch which exposes OpenGL 4.5 core and
135 compatibility entry points.
136
137 libGLESv{1,2} are wrapper libraries to libGLdispatch which expose OpenGL ES
138 entrypoints.
139
140 libGL is a wrapper library to libGLdispatch and libGLX which is provided for
141 backwards-compatibility with applications which link against the old ABI.
142
143 Note that since all OpenGL functions are dispatched through the same table in
144 libGLdispatch, it doesn't matter which library is used to find the entrypoint.
145 The same OpenGL function in libGL, libOpenGL, libGLES, and the function pointer
146 returned by glXGetProcAddress are all interchangeable.
147
148 ### OpenGL dispatching ###
149
150 By definition, all OpenGL functions are dispatched based on the current
151 context. OpenGL dispatching is handled in libGLdispatch, which is used by both
152 EGL and GLX.
153
154 libGLdispatch uses a per-thread dispatch table to look up the correct vendor
155 library function for every OpenGL function.
156
157 When an application calls eglMakeCurrent or glXMakeCurrent, the EGL or GLX
158 library finds the correct dispatch table and then calls into libGLdispatch to
159 set that table for the current thread.
160
161 Since they're all dispatched through the common libGLdispatch layer, that also
162 means that all OpenGL entrypoints will work correctly, regardless of whether
163 the current context is from EGL or GLX.
164
165 ### GLX dispatching ###
166
167 Unlike core OpenGL functions, whose vendor can be determined from the current
168 context, many GLX functions are context-independent. In order to successfully
169 map GLX API calls to the right vendor, we use the following strategy:
170
171 * Most GLX entry points specify (either explicitly, or implicitly) an
172   X screen.
173
174 * On a per-entry point basis, dispatch the call to the
175   `libGLX_VENDOR.so` for that screen.
176
177 * The first time `libGLX.so` gets called with a unique combination of X
178   Display + screen, do the following:
179
180   * Use the Display connection to query the X server for the GLX
181     vendor of that X screen.
182
183   * Load the corresponding `libGLX_VENDOR.so`.
184
185   * Read the vendor's GLX dispatch table from the `libGLX_VENDOR.so`.
186
187   * Cache that Display + screen <=> vendor dispatch table mapping, for
188     use in subsequent dispatching.
189
190 * Some GLX entry points imply an X screen by a GLX object they
191   specify. Such GLX objects are:
192
193   * GLXContext  (an opaque pointer)
194   * GLXFBConfig (an opaque pointer)
195   * GLXPixmap   (an XID)
196   * GLXDrawable (an XID)
197   * GLXWindow   (an XID)
198   * GLXPbuffer  (an XID)
199
200   To map from object to screen, record the corresponding screen when
201   the object is created. This means the current process needs to see
202   a GLX call to create the object. In the case of the opaque
203   pointers, this is reasonable, since the pointer is only meaningful
204   within the current process.
205
206   XIDs, however, can be created by another process, so libGLX may not know in
207   advance which screen they belong to. To deal with that, libGLX queries the
208   server using the GLX extension GLX\_EXT\_libglvnd.
209
210 ### EGL dispatching ###
211
212 EGL dispatching works similarly to GLX, but there are fewer object types to
213 deal with. Almost all EGL functions are dispatched based on an EGLDisplay or
214 EGLDeviceEXT parameter.
215
216 EGL can't rely on asking an X server for a vendor name like GLX can, so
217 instead, it enumerates and loads every available vendor library. Loading every
218 vendor is also needed to support extensions such as
219 EGL\_EXT\_device\_enumeration.
220
221 In order to find the available vendor libraries, each vendor provides a JSON
222 file in a well-known directory, similar to how Vulkan ICD's are loaded.
223 Please see [EGL ICD enumeration](src/EGL/icd_enumeration.md) for more details.
224
225 When the application calls eglGetPlatformDisplay, EGL will simply call into
226 each vendor library until it finds one that succeeds. After that, whichever
227 vendor succeeded owns that display.
228
229 As with GLX, vendor libraries must provide dispatch stubs for any display or
230 device extensions that they support, so that they can add new extensions
231 without having to modify libglvnd.
232
233 Since libglvnd passes eglGetPlatformDisplay calls through to each vendor, a
234 vendor can also add a new platform extension (e.g., EGL\_KHR\_platform\_x11)
235 without changing libglvnd.
236
237 Other EGL client extensions, by definition, do require modifying libglvnd.
238 Those are handled on a case-by-case basis.
239
240 Issues
241 ------
242
243 * Ideally, several components of libglvnd (namely, the `libGL` wrapper library
244   and the `libOpenGL, libGLES{v1_CM,v2}` interface libraries) could be
245   implemented via ELF symbol filtering (see [2] for a demonstration of this).
246   However, a loader bug (tracked in [3]) makes this mechanism unreliable:
247   dlopen(3)ing a shared library with `DT_FILTER` fields can crash the
248   application.  Instead, for now, ELF symbol filtering is disabled by default,
249   and an alternate approach is used to implement these libraries.
250
251 * The library currently indirectly associates a drawable with a vendor,
252   by first mapping a drawable to its screen, then mapping the screen to its
253   vendor. However, it may make sense in render offload scenarios to allow direct
254   mapping from drawables to vendors, so multiple vendors could potentially
255   operate on drawables in the same screen. The problem with this is that several
256   GLX functions, such as glXChooseFBConfig(), explicitly refer to screens, and
257   so it becomes a gray area which vendor the call should be dispatched to. Given
258   this issue, does it still make more sense to use a direct drawable to vendor
259   mapping? How would this be implemented? Should we add new API calls to "GLX
260   Next"?
261
262   * Note that the (drawable -> screen -> vendor) mapping mainly exists in the
263     GLX_EXT_libglvnd extension. libGLX itself keeps a simple
264     (drawable -> vendor) mapping, and exposes that mapping to the vendor
265     libraries.
266
267 * Along the same lines, would it be useful to include a
268   "glXGetProcAddressFromVendor()" or "glXGetProcAddressFromScreen()" entrypoint
269   in a new GLX version to obviate the need for this library in future
270   applications?
271
272 * Global state is required by both libGLX.so and libGLdispatch.so for various
273   purposes, and needs to be protected by locks in multithreaded environments.
274   Is it reasonable for the vendor-neutral library to depend on pthreads for
275   implementing these locks?
276
277   While there is no harm in having the API libraries link against pthreads even
278   if the application does not, we would like to avoid pthread locking overhead
279   if the application is single-threaded.  Hence, this library uses a
280   `glvnd_pthread` wrapper library which provides single-threaded fallbacks for
281   applications which are not linked against pthreads.  It is expected that
282   multi-threaded applications will either statically link against pthreads, or
283   load pthreads prior to loading libGL.
284
285 * Is using a hash table to store GLX extension entrypoints performant enough for
286   dispatching? Should we be using a flat array instead?
287
288 * How should malloc(3) failures be handled?
289
290 * How should forking be handled?
291
292 * The current libGLX implementation stores all GLXContext and GLXFBConfig
293   handles in global hashtables, which means that GLXContext and GLXFBConfig
294   handles must be unique between vendors. That is, two vendor libraries must
295   not come up with the same handle value for a GLXContext or GLXFBConfig. To
296   that end, GLXContext and GLXFBConfig handles must be pointers to memory
297   addresses that the vendor library somehow controls. The values are otherwise
298   opaque.
299
300 * Querying an XID <=> screen mapping without somehow "locking" the XID is
301   inherently racy, since a different process may destroy the drawable, and X
302   may recycle the XID, after the mapping is saved client-side. Is there a mechanism
303   we could use to notify the API library when a mapping is no longer valid?
304
305 References
306 ----------
307
308 [1] https://github.com/aritger/linux-opengl-abi-proposal/blob/master/linux-opengl-abi-proposal.txt
309
310 [2] https://github.com/aritger/libgl-elf-tricks-demo
311
312 [3] https://sourceware.org/bugzilla/show_bug.cgi?id=16272
313
314 Acknowledgements
315 -------
316
317 Thanks to Andy Ritger for the original libGLX implementation and README
318 documentation.
319
320 ### libglvnd ###
321
322 libglvnd itself (excluding components listed below) is licensed as follows:
323
324     Copyright (c) 2013, NVIDIA CORPORATION.
325
326     Permission is hereby granted, free of charge, to any person obtaining a
327     copy of this software and/or associated documentation files (the
328     "Materials"), to deal in the Materials without restriction, including
329     without limitation the rights to use, copy, modify, merge, publish,
330     distribute, sublicense, and/or sell copies of the Materials, and to
331     permit persons to whom the Materials are furnished to do so, subject to
332     the following conditions:
333
334     The above copyright notice and this permission notice shall be included
335     unaltered in all copies or substantial portions of the Materials.
336     Any additions, deletions, or changes to the original source files
337     must be clearly indicated in accompanying documentation.
338
339     If only executable code is distributed, then the accompanying
340     documentation must state that "this software is based in part on the
341     work of the Khronos Group."
342
343     THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
344     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
345     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
346     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
347     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
348     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
349     MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
350
351 ### X.Org ###
352
353 libglvnd contains list.h, a linked list implementation from the X.Org project.
354 Source code from the X.Org project is available from:
355
356     http://cgit.freedesktop.org/xorg/xserver
357
358 list.h carries the following license:
359
360     Copyright © 2010 Intel Corporation
361     Copyright © 2010 Francisco Jerez <currojerez@riseup.net>
362
363     Permission is hereby granted, free of charge, to any person obtaining a
364     copy of this software and associated documentation files (the "Software"),
365     to deal in the Software without restriction, including without limitation
366     the rights to use, copy, modify, merge, publish, distribute, sublicense,
367     and/or sell copies of the Software, and to permit persons to whom the
368     Software is furnished to do so, subject to the following conditions:
369
370     The above copyright notice and this permission notice (including the next
371     paragraph) shall be included in all copies or substantial portions of the
372     Software.
373
374     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
375     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
376     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
377     THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
378     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
379     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
380     IN THE SOFTWARE.
381
382 ### Mesa ###
383
384 libglvnd contains code from the Mesa project. Source code from the Mesa project
385 is available from:
386
387     http://cgit.freedesktop.org/mesa/mesa
388
389 The default Mesa license is as follows:
390
391     Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
392
393     Permission is hereby granted, free of charge, to any person obtaining a
394     copy of this software and associated documentation files (the "Software"),
395     to deal in the Software without restriction, including without limitation
396     the rights to use, copy, modify, merge, publish, distribute, sublicense,
397     and/or sell copies of the Software, and to permit persons to whom the
398     Software is furnished to do so, subject to the following conditions:
399
400     The above copyright notice and this permission notice shall be included
401     in all copies or substantial portions of the Software.
402
403     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
404     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
405     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
406     BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
407     AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
408     CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
409
410 ### uthash ###
411
412 libglvnd uses the hash table implementation 'uthash':
413
414     http://troydhanson.github.io/uthash/
415
416 This library carries the following copyright notice:
417
418     Copyright (c) 2005-2013, Troy D. Hanson
419     http://troydhanson.github.com/uthash/
420     All rights reserved.
421
422     Redistribution and use in source and binary forms, with or without
423     modification, are permitted provided that the following conditions are met:
424
425         * Redistributions of source code must retain the above copyright
426           notice, this list of conditions and the following disclaimer.
427
428     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
429     IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
430     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
431     PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
432     OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
433     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
434     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
435     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
436     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
437     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
438     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
439
440 ### buildconf ###
441
442 libglvnd uses the buildconf autotools bootstrapping script 'autogen.sh':
443
444     http://freecode.com/projects/buildconf
445
446 This script carries the following copyright notice:
447
448     Copyright (c) 2005-2009 United States Government as represented by
449     the U.S. Army Research Laboratory.
450
451     Redistribution and use in source and binary forms, with or without
452     modification, are permitted provided that the following conditions
453     are met:
454
455     1. Redistributions of source code must retain the above copyright
456     notice, this list of conditions and the following disclaimer.
457
458     2. Redistributions in binary form must reproduce the above
459     copyright notice, this list of conditions and the following
460     disclaimer in the documentation and/or other materials provided
461     with the distribution.
462
463     3. The name of the author may not be used to endorse or promote
464     products derived from this software without specific prior written
465     permission.
466
467     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
468     OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
469     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
470     ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
471     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
472     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
473     GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
474     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
475     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
476     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
477     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
478
479 ### ax-pthread ###
480
481 libglvnd uses the `AX_PTHREAD` autoconf macro for detecting pthreads.
482 The implementation of this macro carries the following license:
483
484     Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
485     Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
486
487     This program is free software: you can redistribute it and/or modify it
488     under the terms of the GNU General Public License as published by the 
489     Free Software Foundation, either version 3 of the License, or (at your
490     option) any later version.
491
492     This program is distributed in the hope that it will be useful, but 
493     WITHOUT ANY WARRANTY; without even the implied warranty of
494     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
495     Public License for more details.
496
497     You should have received a copy of the GNU General Public License along
498     with this program. If not, see <http://www.gnu.org/licenses/>.
499
500     As a special exception, the respective Autoconf Macro's copyright owner
501     gives unlimited permission to copy, distribute and modify the configure
502     scripts that are the output of Autoconf when processing the Macro. You 
503     need not follow the terms of the GNU General Public License when using
504     or distributing such scripts, even though portions of the text of the 
505     Macro appear in them. The GNU General Public License (GPL) does govern
506     all other use of the material that constitutes the Autoconf Macro.
507
508     This special exception to the GPL applies to versions of the Autoconf
509     Macro released by the Autoconf Archive. When you make and distribute a
510     modified version of the Autoconf Macro, you may extend this special
511     exception to the GPL to apply to your modified version as well.
512
513 libglvnd uses the cJSON library for reading JSON files:
514
515 https://github.com/DaveGamble/cJSON
516
517 This library carries the following copyright notice:
518
519     Copyright (c) 2009 Dave Gamble
520
521     Permission is hereby granted, free of charge, to any person obtaining a copy
522     of this software and associated documentation files (the "Software"), to deal
523     in the Software without restriction, including without limitation the rights
524     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
525     copies of the Software, and to permit persons to whom the Software is
526     furnished to do so, subject to the following conditions:
527
528     The above copyright notice and this permission notice shall be included in
529     all copies or substantial portions of the Software.
530
531     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
532     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
533     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
534     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
535     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
536     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
537     THE SOFTWARE.
538