Tomi Valkeinen | 7785a21 | 2016-09-29 15:46:57 +0300 | [diff] [blame] | 1 | [](https://travis-ci.org/tomba/kmsxx) |
| 2 | |
Tomi Valkeinen | 711a0b8 | 2016-06-11 20:37:17 +0300 | [diff] [blame] | 3 | # kms++ - C++ library for kernel mode setting |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 4 | |
Tomi Valkeinen | 711a0b8 | 2016-06-11 20:37:17 +0300 | [diff] [blame] | 5 | kms++ is a C++11 library for kernel mode setting. |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 6 | |
Tomi Valkeinen | 711a0b8 | 2016-06-11 20:37:17 +0300 | [diff] [blame] | 7 | Also included are some simple utilities for KMS and python bindings for kms++. |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 8 | |
Tomi Valkeinen | df77e4a | 2016-05-23 10:12:34 +0300 | [diff] [blame] | 9 | ## Utilities |
Tomi Valkeinen | d8db846 | 2015-11-30 15:33:11 +0200 | [diff] [blame] | 10 | |
Tomi Valkeinen | 86f3c44 | 2016-08-24 15:02:06 +0300 | [diff] [blame] | 11 | - kmstest - set modes and planes and show test pattern on crtcs/planes, and test page flips |
Tomi Valkeinen | d8db846 | 2015-11-30 15:33:11 +0200 | [diff] [blame] | 12 | - kmsprint - print information about DRM objects |
Tomi Valkeinen | d8db846 | 2015-11-30 15:33:11 +0200 | [diff] [blame] | 13 | - kmsview - view raw images |
Tomi Valkeinen | d8db846 | 2015-11-30 15:33:11 +0200 | [diff] [blame] | 14 | - kmscube - rotating 3D cube on crtcs/planes |
Tomi Valkeinen | df77e4a | 2016-05-23 10:12:34 +0300 | [diff] [blame] | 15 | - kmscapture - show captured frames from a camera on screen |
Tomi Valkeinen | d8db846 | 2015-11-30 15:33:11 +0200 | [diff] [blame] | 16 | |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 17 | ## Dependencies: |
| 18 | |
| 19 | - libdrm |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 20 | - Python 3.x (for python bindings) |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 21 | |
| 22 | ## Build instructions: |
| 23 | |
Tomi Valkeinen | 5c21d85 | 2016-05-26 15:22:01 +0300 | [diff] [blame] | 24 | To build the Python bindings you need to set up the git-submodule for pybind11: |
| 25 | |
| 26 | ``` |
| 27 | git submodule update --init |
| 28 | ``` |
| 29 | |
| 30 | And to compile: |
| 31 | |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 32 | ``` |
| 33 | $ mkdir build |
| 34 | $ cd build |
| 35 | $ cmake .. |
| 36 | $ make -j4 |
| 37 | ``` |
| 38 | |
| 39 | ## Cross compiling instructions: |
| 40 | |
Tomi Valkeinen | df77e4a | 2016-05-23 10:12:34 +0300 | [diff] [blame] | 41 | Directions for cross compiling depend on your environment. |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 42 | |
Tomi Valkeinen | df77e4a | 2016-05-23 10:12:34 +0300 | [diff] [blame] | 43 | These are for mine with buildroot: |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 44 | |
| 45 | ``` |
Tomi Valkeinen | df77e4a | 2016-05-23 10:12:34 +0300 | [diff] [blame] | 46 | $ mkdir build |
| 47 | $ cd build |
| 48 | $ cmake -DCMAKE_TOOLCHAIN_FILE=<buildrootpath>/output/host/usr/share/buildroot/toolchainfile.cmake .. |
| 49 | $ make -j4 |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 50 | ``` |
| 51 | |
Tomi Valkeinen | b668200 | 2016-07-10 10:54:43 +0300 | [diff] [blame] | 52 | Your environment may provide similar toolchainfile. If not, you can create a toolchainfile of your own, something along these lines: |
| 53 | |
| 54 | ``` |
| 55 | SET(CMAKE_SYSTEM_NAME Linux) |
| 56 | |
| 57 | SET(BROOT "<buildroot>/output/") |
| 58 | |
| 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++) |
| 62 | |
| 63 | # where is the target environment |
| 64 | SET(CMAKE_FIND_ROOT_PATH ${BROOT}/target ${BROOT}/host) |
| 65 | |
| 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 | ``` |
| 70 | |
Tomi Valkeinen | 6b04b30 | 2015-10-01 11:40:36 +0300 | [diff] [blame] | 71 | ## Build options |
| 72 | |
| 73 | You can use the following cmake flags to control the build. Use `-DFLAG=VALUE` to set them. |
| 74 | |
Alejandro Hernandez | 643d678 | 2017-02-03 10:11:58 -0500 | [diff] [blame] | 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 |
Tomi Valkeinen | 894d615 | 2015-10-22 10:21:03 +0300 | [diff] [blame] | 82 | |
| 83 | ## Env variables |
| 84 | |
Tomi Valkeinen | 711a0b8 | 2016-06-11 20:37:17 +0300 | [diff] [blame] | 85 | You can use the following runtime environmental variables to control the behavior of kms++. |
Tomi Valkeinen | 894d615 | 2015-10-22 10:21:03 +0300 | [diff] [blame] | 86 | |
| 87 | Variable | Description |
| 88 | --------------------------------- | ------------- |
Tomi Valkeinen | 711a0b8 | 2016-06-11 20:37:17 +0300 | [diff] [blame] | 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 |
Tomi Valkeinen | a5545df | 2019-07-30 11:27:37 +0300 | [diff] [blame] | 91 | KMSXX_DEVICE | Path to the card device node to use |
| 92 | KMSXX_DRIVER | Name of the driver to use. The format is either "drvname" or "drvname:idx" |
Tomi Valkeinen | f1123bf | 2017-01-27 11:07:02 +0200 | [diff] [blame] | 93 | |
| 94 | ## Python notes |
| 95 | |
| 96 | You can run the python code directly from the build dir by defining PYTHONPATH env variable. For example: |
| 97 | |
| 98 | ``` |
| 99 | PYTHONPATH=build/py py/tests/hpd.py |
| 100 | |
| 101 | ``` |