1 [![Build Status](https://travis-ci.org/tomba/kmsxx.svg?branch=master)](https://travis-ci.org/tomba/kmsxx)
3 # kms++ - C++ library for kernel mode setting
5 kms++ is a C++11 library for kernel mode setting.
7 Also included are some simple utilities for KMS and python bindings for kms++.
9 ## Utilities
11 - kmstest - set modes and planes and show test pattern on crtcs/planes, and test page flips
12 - kmsprint - print information about DRM objects
13 - kmsview - view raw images
14 - kmscube - rotating 3D cube on crtcs/planes
15 - kmscapture - show captured frames from a camera on screen
17 ## Dependencies:
19 - libdrm
20 - Python 3.x (for python bindings)
22 ## Build instructions:
24 To build the Python bindings you need to set up the git-submodule for pybind11:
26 ```
27 git submodule update --init
28 ```
30 And to compile:
32 ```
33 $ mkdir build
34 $ cd build
35 $ cmake ..
36 $ make -j4
37 ```
39 ## Cross compiling instructions:
41 Directions for cross compiling depend on your environment.
43 These are for mine with buildroot:
45 ```
46 $ mkdir build
47 $ cd build
48 $ cmake -DCMAKE_TOOLCHAIN_FILE=<buildrootpath>/output/host/usr/share/buildroot/toolchainfile.cmake ..
49 $ make -j4
50 ```
52 Your environment may provide similar toolchainfile. If not, you can create a toolchainfile of your own, something along these lines:
54 ```
55 SET(CMAKE_SYSTEM_NAME Linux)
57 SET(BROOT "<buildroot>/output/")
59 # specify the cross compiler
60 SET(CMAKE_C_COMPILER ${BROOT}/host/usr/bin/arm-buildroot-linux-gnueabihf-gcc)
61 SET(CMAKE_CXX_COMPILER ${BROOT}/host/usr/bin/arm-buildroot-linux-gnueabihf-g++)
63 # where is the target environment
64 SET(CMAKE_FIND_ROOT_PATH ${BROOT}/target ${BROOT}/host)
66 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
67 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
68 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
69 ```
71 ## Build options
73 You can use the following cmake flags to control the build. Use `-DFLAG=VALUE` to set them.
75 Option name | Values | Default | Notes
76 --------------------- | ------------- | --------------- | --------
77 CMAKE_BUILD_TYPE | Release/Debug | Release |
78 BUILD_SHARED_LIBS | ON/OFF | OFF |
79 KMSXX_ENABLE_PYTHON | ON/OFF | ON |
80 KMSXX_ENABLE_KMSCUBE | ON/OFF | OFF |
81 KMSXX_PYTHON_VERSION | python3/python2 | python3;python2 | Name of the python pkgconfig file
83 ## Env variables
85 You can use the following runtime environmental variables to control the behavior of kms++.
87 Variable | Description
88 --------------------------------- | -------------
89 KMSXX_DISABLE_UNIVERSAL_PLANES | Set to disable the use of universal planes
90 KMSXX_DISABLE_ATOMIC | Set to disable the use of atomic modesetting
92 ## Python notes
94 You can run the python code directly from the build dir by defining PYTHONPATH env variable. For example:
96 ```
97 PYTHONPATH=build/py py/tests/hpd.py
99 ```