1*f0687c8aSRaman Tenneti[](https://travis-ci.org/tomba/kmsxx) 2*f0687c8aSRaman Tenneti 3*f0687c8aSRaman Tenneti# kms++ - C++ library for kernel mode setting 4*f0687c8aSRaman Tenneti 5*f0687c8aSRaman Tennetikms++ is a C++17 library for kernel mode setting. 6*f0687c8aSRaman Tenneti 7*f0687c8aSRaman TennetiAlso included are some simple utilities for KMS and python bindings for kms++. 8*f0687c8aSRaman Tenneti 9*f0687c8aSRaman Tenneti## Utilities 10*f0687c8aSRaman Tenneti 11*f0687c8aSRaman Tenneti- kmstest - set modes and planes and show test pattern on crtcs/planes, and test page flips 12*f0687c8aSRaman Tenneti- kmsprint - print information about DRM objects 13*f0687c8aSRaman Tenneti- kmsview - view raw images 14*f0687c8aSRaman Tenneti- kmscube - rotating 3D cube on crtcs/planes 15*f0687c8aSRaman Tenneti- kmscapture - show captured frames from a camera on screen 16*f0687c8aSRaman Tenneti 17*f0687c8aSRaman Tenneti## Dependencies: 18*f0687c8aSRaman Tenneti 19*f0687c8aSRaman Tenneti- libdrm 20*f0687c8aSRaman Tenneti- Python 3.x (for python bindings) 21*f0687c8aSRaman Tenneti 22*f0687c8aSRaman Tenneti## Build instructions: 23*f0687c8aSRaman Tenneti 24*f0687c8aSRaman TennetiTo build the Python bindings you need to set up the git-submodule for pybind11: 25*f0687c8aSRaman Tenneti 26*f0687c8aSRaman Tenneti``` 27*f0687c8aSRaman Tennetigit submodule update --init 28*f0687c8aSRaman Tenneti``` 29*f0687c8aSRaman Tenneti 30*f0687c8aSRaman TennetiAnd to compile: 31*f0687c8aSRaman Tenneti 32*f0687c8aSRaman Tenneti``` 33*f0687c8aSRaman Tennetimeson build 34*f0687c8aSRaman Tennetininja -C build 35*f0687c8aSRaman Tenneti``` 36*f0687c8aSRaman Tenneti 37*f0687c8aSRaman Tenneti## Cross compiling instructions: 38*f0687c8aSRaman Tenneti 39*f0687c8aSRaman Tenneti``` 40*f0687c8aSRaman Tennetimeson build --cross-file=<path-to-meson-cross-file> 41*f0687c8aSRaman Tennetininja -C build 42*f0687c8aSRaman Tenneti``` 43*f0687c8aSRaman Tenneti 44*f0687c8aSRaman TennetiHere is my cross file for arm32 (where ${BROOT} is path to my buildroot output dir): 45*f0687c8aSRaman Tenneti 46*f0687c8aSRaman Tenneti``` 47*f0687c8aSRaman Tenneti[binaries] 48*f0687c8aSRaman Tennetic = ['ccache', '${BROOT}/host/bin/arm-buildroot-linux-gnueabihf-gcc'] 49*f0687c8aSRaman Tenneticpp = ['ccache', '${BROOT}/host/bin/arm-buildroot-linux-gnueabihf-g++'] 50*f0687c8aSRaman Tennetiar = '${BROOT}/host/bin/arm-buildroot-linux-gnueabihf-ar' 51*f0687c8aSRaman Tennetistrip = '${BROOT}/host/bin/arm-buildroot-linux-gnueabihf-strip' 52*f0687c8aSRaman Tennetipkgconfig = '${BROOT}/host/bin/pkg-config' 53*f0687c8aSRaman Tenneti 54*f0687c8aSRaman Tenneti[host_machine] 55*f0687c8aSRaman Tennetisystem = 'linux' 56*f0687c8aSRaman Tenneticpu_family = 'arm' 57*f0687c8aSRaman Tenneticpu = 'arm' 58*f0687c8aSRaman Tennetiendian = 'little' 59*f0687c8aSRaman Tenneti``` 60*f0687c8aSRaman Tenneti 61*f0687c8aSRaman Tenneti## Build options 62*f0687c8aSRaman Tenneti 63*f0687c8aSRaman TennetiYou can use meson options to configure the build. E.g. 64*f0687c8aSRaman Tenneti 65*f0687c8aSRaman Tenneti``` 66*f0687c8aSRaman Tennetimeson build -Dbuildtype=debug -Dkmscube=true 67*f0687c8aSRaman Tenneti``` 68*f0687c8aSRaman Tenneti 69*f0687c8aSRaman TennetiUse `meson configure build` to see all the configuration options and their current values. 70*f0687c8aSRaman Tenneti 71*f0687c8aSRaman Tennetikms++ specific build options are: 72*f0687c8aSRaman Tenneti 73*f0687c8aSRaman TennetiOption name | Values | Default | Notes 74*f0687c8aSRaman Tenneti---------------- | ------------- | --------------- | -------- 75*f0687c8aSRaman Tennetipykms | true, false | true | Python bindings 76*f0687c8aSRaman Tennetikmscube | true, false | false | GLES kmscube 77*f0687c8aSRaman Tennetiomap | enabled, disabled, auto | auto | libdrm-omap support 78*f0687c8aSRaman Tenneti 79*f0687c8aSRaman Tenneti## Env variables 80*f0687c8aSRaman Tenneti 81*f0687c8aSRaman TennetiYou can use the following runtime environmental variables to control the behavior of kms++. 82*f0687c8aSRaman Tenneti 83*f0687c8aSRaman TennetiVariable | Description 84*f0687c8aSRaman Tenneti--------------------------------- | ------------- 85*f0687c8aSRaman TennetiKMSXX_DISABLE_UNIVERSAL_PLANES | Set to disable the use of universal planes 86*f0687c8aSRaman TennetiKMSXX_DISABLE_ATOMIC | Set to disable the use of atomic modesetting 87*f0687c8aSRaman TennetiKMSXX_DEVICE | Path to the card device node to use 88*f0687c8aSRaman TennetiKMSXX_DRIVER | Name of the driver to use. The format is either "drvname" or "drvname:idx" 89*f0687c8aSRaman Tenneti 90*f0687c8aSRaman Tenneti## Python notes 91*f0687c8aSRaman Tenneti 92*f0687c8aSRaman TennetiYou can run the python code directly from the build dir by defining PYTHONPATH env variable. For example: 93*f0687c8aSRaman Tenneti 94*f0687c8aSRaman Tenneti``` 95*f0687c8aSRaman TennetiPYTHONPATH=build/py py/tests/hpd.py 96*f0687c8aSRaman Tenneti``` 97