xref: /third_party/libdrm/README.rst (revision d722e3fb)
1d722e3fbSopenharmony_cilibdrm - userspace library for drm
2d722e3fbSopenharmony_ci----------------------------------
3d722e3fbSopenharmony_ci
4d722e3fbSopenharmony_ciThis is libdrm, a userspace library for accessing the DRM, direct rendering
5d722e3fbSopenharmony_cimanager, on Linux, BSD and other operating systems that support the ioctl
6d722e3fbSopenharmony_ciinterface.
7d722e3fbSopenharmony_ciThe library provides wrapper functions for the ioctls to avoid exposing the
8d722e3fbSopenharmony_cikernel interface directly, and for chipsets with drm memory manager, support
9d722e3fbSopenharmony_cifor tracking relocations and buffers.
10d722e3fbSopenharmony_ciNew functionality in the kernel DRM drivers typically requires a new libdrm,
11d722e3fbSopenharmony_cibut a new libdrm will always work with an older kernel.
12d722e3fbSopenharmony_ci
13d722e3fbSopenharmony_cilibdrm is a low-level library, typically used by graphics drivers such as
14d722e3fbSopenharmony_cithe Mesa drivers, the X drivers, libva and similar projects.
15d722e3fbSopenharmony_ci
16d722e3fbSopenharmony_ciSyncing with the Linux kernel headers
17d722e3fbSopenharmony_ci-------------------------------------
18d722e3fbSopenharmony_ci
19d722e3fbSopenharmony_ciThe library should be regularly updated to match the recent changes in the
20d722e3fbSopenharmony_ci`include/uapi/drm/`.
21d722e3fbSopenharmony_ci
22d722e3fbSopenharmony_cilibdrm maintains a human-readable version for the token format modifier, with
23d722e3fbSopenharmony_cithe simpler ones being extracted automatically from `drm_fourcc.h` header file
24d722e3fbSopenharmony_ciwith the help of a python script.  This might not always possible, as some of
25d722e3fbSopenharmony_cithe vendors require decoding/extracting them programmatically.  For that
26d722e3fbSopenharmony_cireason one can enhance the current vendor functions to include/provide the
27d722e3fbSopenharmony_cinewly added token formats, or, in case there's no such decoding
28d722e3fbSopenharmony_cifunction, to add one that performs the tasks of extracting them.
29d722e3fbSopenharmony_ci
30d722e3fbSopenharmony_ciFor simpler format modifier tokens there's a script (gen_table_fourcc.py) that
31d722e3fbSopenharmony_cicreates a static table, by going over `drm_fourcc.h` header file. The script
32d722e3fbSopenharmony_cicould be further modified if it can't handle new (simpler) token format
33d722e3fbSopenharmony_cimodifiers instead of the generated static table.
34d722e3fbSopenharmony_ci
35d722e3fbSopenharmony_ciCompiling
36d722e3fbSopenharmony_ci---------
37d722e3fbSopenharmony_ci
38d722e3fbSopenharmony_ciTo set up meson:
39d722e3fbSopenharmony_ci
40d722e3fbSopenharmony_ci    meson builddir/
41d722e3fbSopenharmony_ci
42d722e3fbSopenharmony_ciBy default this will install into /usr/local, you can change your prefix
43d722e3fbSopenharmony_ciwith --prefix=/usr (or `meson configure builddir/ -Dprefix=/usr` after 
44d722e3fbSopenharmony_cithe initial meson setup).
45d722e3fbSopenharmony_ci
46d722e3fbSopenharmony_ciThen use ninja to build and install:
47d722e3fbSopenharmony_ci
48d722e3fbSopenharmony_ci    ninja -C builddir/ install
49d722e3fbSopenharmony_ci
50d722e3fbSopenharmony_ciIf you are installing into a system location you will need to run install
51d722e3fbSopenharmony_ciseparately, and as root.
52